UNPKG

@e280/authlocal

Version:

User-sovereign login system for everybody

3 lines 97.3 kB
var _e=class{#t=!1;lock(t){this.#t=!0;let e=t();return this.#t=!1,e}get locked(){return this.#t}};var Yt=()=>new Map,Zo=()=>new Set;function E(r){return{guarantee:(t,e)=>wi(r,t,e)}}function wi(r,t,e){if(r.has(t))return r.get(t);{let o=e();return r.set(t,o),o}}var Ae=class{#t=new WeakMap;grab_keymap(t){let e=E(this.#t).guarantee(t,Yt);return{keymap:e,grab_symbolmap(o){return E(e).guarantee(o,Yt)}}}clear(){this.#t=new WeakMap}};var $e=class{#t=new Map;stop(t){let e=this.#t.get(t);e&&(this.#t.delete(t),e())}add(t,e){this.#t.set(t,e)}};var Se=class{#t=[];record(t){let e=Yt();this.#t.push(e);let o=t();return this.#t.pop(),{payload:o,recording:e}}record_that_key_was_accessed(t,e){let o=this.#t.at(-1);o&&E(o).guarantee(t,Zo).add(e)}};var ke=class extends Error{name=this.constructor.name},Ee=class extends ke{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}},Ce=class extends ke{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}};function Xo(r){return new Proxy(r,{get(t,e){return t[e]},set(t,e){throw new Ce(e)}})}function w(r,t){let e,o,s=[];function n(){e=[],o&&clearTimeout(o),o=void 0,s=[]}return n(),(...i)=>{e=i,o&&clearTimeout(o);let a=new Promise((c,u)=>{s.push({resolve:c,reject:u})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(c=>{for(let{resolve:u}of s)u(c);n()}).catch(c=>{for(let{reject:u}of s)u(c);n()})},r),a}}var Be=class{#t=new Map;#e=Promise.resolve();#r=w(0,()=>{let t=[...this.#t.values()];this.#t.clear();for(let e of t)e()});get wait(){return this.#e}add(t,e){this.#t.set(t,e),this.#e=this.#r()}};function Jo(r){return function(t){return()=>{let e=typeof r=="function"?r():r;return t(e)}}}function Kt(r,t,e,o){let s=[];for(let[n,i]of t){let{grab_symbolmap:a}=e.grab_keymap(n);for(let c of i){let u=a(c);u.set(r,o),s.push(()=>u.delete(r))}}return()=>s.forEach(n=>n())}function Qo(r,t,e,o,s){function n([i,a]){if("lean"in a)a.actor();else{let{payload:c,recording:u}=t.record(a.collector);o.add(i,Kt(i,u,r,a)),a.responder&&a.responder(c)}}return{get:(i,a)=>(t.record_that_key_was_accessed(i,a),i[a]),set:(i,a,c)=>{if(e.locked)throw new Ee(a);i[a]=c;let u=[...r.grab_keymap(i).grab_symbolmap(a)];for(let l of u){let[p]=l;s.add(p,()=>e.lock(()=>n(l)))}return!0}}}var Te=class{static readonly=Xo;static collectivize=Jo;#t=new Ae;#e=new Se;#r=new _e;#o=new $e;#s=new Be;#i=Qo(this.#t,this.#e,this.#r,this.#o,this.#s);get wait(){return this.#s.wait}state(t){return new Proxy(t,this.#i)}reaction(t,e){let o=Symbol(),{recording:s}=this.#e.record(()=>this.#r.lock(t));return this.#o.add(o,Kt(o,s,this.#t,{collector:t,responder:e})),()=>this.#o.stop(o)}lean(t){let e=Symbol();return{stop:()=>this.#o.stop(e),collect:o=>{let{payload:s,recording:n}=this.#e.record(()=>this.#r.lock(o));return this.#o.add(e,Kt(e,n,this.#t,{lean:!0,actor:t})),s}}}clear(){this.#t.clear()}};function St(r,t){return Pe.on_change(r,()=>r.requestUpdate()),Pe.proxy(r,t)}var Pe;(function(r){r.proxy=(e,o)=>new Proxy(o,{get:(s,n)=>{let i=o[n],a=e.getAttribute(n);switch(i){case String:return a??void 0;case Number:return a!==null?Number(a):void 0;case Boolean:return a!==null;default:throw new Error(`invalid attribute type for "${n}"`)}},set:(s,n,i)=>{switch(o[n]){case String:return e.setAttribute(n,i),!0;case Number:return e.setAttribute(n,i.toString()),!0;case Boolean:return i?e.setAttribute(n,""):e.removeAttribute(n),!0;default:throw new Error(`invalid attribute type for "${n}"`)}}});function t(e,o){let s=new MutationObserver(o);return s.observe(e,{attributes:!0}),()=>s.disconnect()}r.on_change=t})(Pe||(Pe={}));var Oe=class r{#t;constructor(t){this.#t=t}get state(){return this.#t.getter(this.#t.parent.state)}transmute(t){this.#t.parent.transmute(e=>{let o=this.#t.getter(e),s=t(o);return this.#t.setter(e,s)})}slice({getter:t,setter:e}){return new r({parent:this,getter:t,setter:e})}};function kt(r,t=new Set){if(t.has(r))throw new Error("cannot clone circular reference");let e;return typeof r=="function"||r!==null&&typeof r=="object"?(t.add(r),Array.isArray(r)?e=r.map(o=>kt(o,new Set(t))):r.constructor===Object?e=Object.fromEntries(Object.entries(r).map(([o,s])=>[o,kt(s,new Set(t))])):r instanceof Map?e=new Map(Array.from(r,([o,s])=>[o,kt(s,new Set(t))])):r instanceof Set?e=new Set(Array.from(r,o=>kt(o,new Set(t)))):r instanceof Date?e=new Date(r.getTime()):e=r,t.delete(r)):e=r,e}var Et={available:r=>r!=null,unavailable:r=>r==null,void:r=>r==null,defined:r=>r!=null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r)};var ts=(r,t)=>{function e(o,s,n){if(!Et.object(o)||!Et.object(s))return o===s;if(n.includes(o))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...n,o];if(o instanceof Map&&s instanceof Map){if(o.size!==s.size)return!1;for(let[a,c]of o)if(!s.has(a)||!e(c,s.get(a),i))return!1}else if(o instanceof Set&&s instanceof Set){if(o.size!==s.size)return!1;for(let a of o)if(!Array.from(s).some(c=>e(a,c,i)))return!1}else{let a=Object.keys(o),c=Object.keys(s);if(a.length!==c.length)return!1;for(let u of a)if(!c.includes(u)||!e(o[u],s[u],i))return!1}return!0}return e(r,t,[])};function es(r){function t(e,o){if(!Et.object(e)||o.includes(e))return e;let s=[...o,e];if(e instanceof Map)for(let n of e.entries())for(let i of n)t(i,s);else if(e instanceof Set)for(let n of e)t(n,s);else if(Array.isArray(e))for(let n of e)t(n,s);else for(let n of Object.values(e))t(n,s);return Object.freeze(e)}return t(r,[])}var V={clone:kt,equal:ts,freeze:es};var Me=class{#t;#e;#r;#o=!1;#s(){return V.freeze(structuredClone(this.#t))}constructor(t,e=()=>{}){this.#t=structuredClone(t),this.#e=this.#s(),this.#r=e}get state(){return this.#e}transmute(t){if(this.#o)throw new Error("circular error");this.#o=!0,this.#t=t(structuredClone(this.#t)),this.#e=this.#s(),this.#r(),this.#o=!1}slice({getter:t,setter:e}){return new Oe({parent:this,getter:t,setter:e})}};var je=class{#t;#e=new Set;#r=new Set;#o=new Map;#s=Promise.resolve();constructor(t){this.#t=t}get wait(){return this.#s}#i=w(0,()=>{for(let t of this.#e)t();for(let t of this.#r)t()});dispatch(){this.#s=this.#i()}computed(t){let e=this.#t.signal(t());return this.#e.add(()=>{e.value=t()}),e}track(t,e){let o=!0,s=()=>{let i=t(),a=this.#o.get(t);(o||!V.equal(i,a))&&(o=!1,this.#o.set(t,i),e(i))};return s(),this.#r.add(s),()=>this.#r.delete(s)}stateTree(t){return new Me(t,()=>this.dispatch())}};var O=Object.freeze({eq(r,t){if(r.length!==t.length)return!1;for(let e=0;e<=r.length;e++)if(r.at(e)!==t.at(e))return!1;return!0},random(r){return crypto.getRandomValues(new Uint8Array(r))}});var b=Object.freeze({fromBytes(r){return[...r].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(r){if(r.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(r.length/2);for(let e=0;e<r.length;e+=2)t[e/2]=parseInt(r.slice(e,e+2),16);return t},random(r=32){return this.fromBytes(O.random(r))},string(r){return b.fromBytes(r)},bytes(r){return b.toBytes(r)}});var Jr=["doz","mar","bin","wan","sam","lit","sig","hid","fid","lis","sog","dir","wac","sab","wis","sib","rig","sol","dop","mod","fog","lid","hop","dar","dor","lor","hod","fol","rin","tog","sil","mir","hol","pas","lac","rov","liv","dal","sat","lib","tab","han","tic","pid","tor","bol","fos","dot","los","dil","for","pil","ram","tir","win","tad","bic","dif","roc","wid","bis","das","mid","lop","ril","nar","dap","mol","san","loc","nov","sit","nid","tip","sic","rop","wit","nat","pan","min","rit","pod","mot","tam","tol","sav","pos","nap","nop","som","fin","fon","ban","mor","wor","sip","ron","nor","bot","wic","soc","wat","dol","mag","pic","dav","bid","bal","tim","tas","mal","lig","siv","tag","pad","sal","div","dac","tan","sid","fab","tar","mon","ran","nis","wol","mis","pal","las","dis","map","rab","tob","rol","lat","lon","nod","nav","fig","nom","nib","pag","sop","ral","bil","had","doc","rid","moc","pac","rav","rip","fal","tod","til","tin","hap","mic","fan","pat","tac","lab","mog","sim","son","pin","lom","ric","tap","fir","has","bos","bat","poc","hac","tid","hav","sap","lin","dib","hos","dab","bit","bar","rac","par","lod","dos","bor","toc","hil","mac","tom","dig","fil","fas","mit","hob","har","mig","hin","rad","mas","hal","rag","lag","fad","top","mop","hab","nil","nos","mil","fop","fam","dat","nol","din","hat","nac","ris","fot","rib","hoc","nim","lar","fit","wal","rap","sar","nal","mos","lan","don","dan","lad","dov","riv","bac","pol","lap","tal","pit","nam","bon","ros","ton","fod","pon","sov","noc","sor","lav","mat","mip","fip"];var Qr=["zod","nec","bud","wes","sev","per","sut","let","ful","pen","syt","dur","wep","ser","wyl","sun","ryp","syx","dyr","nup","heb","peg","lup","dep","dys","put","lug","hec","ryt","tyv","syd","nex","lun","mep","lut","sep","pes","del","sul","ped","tem","led","tul","met","wen","byn","hex","feb","pyl","dul","het","mev","rut","tyl","wyd","tep","bes","dex","sef","wyc","bur","der","nep","pur","rys","reb","den","nut","sub","pet","rul","syn","reg","tyd","sup","sem","wyn","rec","meg","net","sec","mul","nym","tev","web","sum","mut","nyx","rex","teb","fus","hep","ben","mus","wyx","sym","sel","ruc","dec","wex","syr","wet","dyl","myn","mes","det","bet","bel","tux","tug","myr","pel","syp","ter","meb","set","dut","deg","tex","sur","fel","tud","nux","rux","ren","wyt","nub","med","lyt","dus","neb","rum","tyn","seg","lyx","pun","res","red","fun","rev","ref","mec","ted","rus","bex","leb","dux","ryn","num","pyx","ryg","ryx","fep","tyr","tus","tyc","leg","nem","fer","mer","ten","lus","nus","syl","tec","mex","pub","rym","tuc","fyl","lep","deb","ber","mug","hut","tun","byl","sud","pem","dev","lur","def","bus","bep","run","mel","pex","dyt","byt","typ","lev","myl","wed","duc","fur","fex","nul","luc","len","ner","lex","rup","ned","lec","ryd","lyd","fen","wel","nyd","hus","rel","rud","nes","hes","fet","des","ret","dun","ler","nyr","seb","hul","ryl","lud","rem","lys","fyn","wer","ryc","sug","nys","nyl","lyn","dyn","dem","lux","fed","sed","bec","mun","lyr","tes","mud","nyt","byr","sen","weg","fyr","mur","tel","rep","teg","pec","nel","nev","fes"];var W={defaults:{groupSize:4,wordSeparator:".",groupSeparator:" "},random(r,t){let e=O.random(r);return this.fromBytes(e,t)},fromBytes(r,t={}){let{groupSize:e=W.defaults.groupSize,wordSeparator:o=W.defaults.wordSeparator,groupSeparator:s=W.defaults.groupSeparator}=t,n=[],i=[];r.forEach((c,u)=>{let l=u%2===0?Jr:Qr;i.push(l[c]),i.length===2&&(n.push(i.join("")),i=[])}),i.length&&n.push(i.join(""));let a=[];for(let c=0;c<n.length;c+=e)a.push(n.slice(c,c+e).join(o));return a.join(s)},toBytes(r){let t=r.toLowerCase().replace(/[^a-z]/g,"");if(t.length/3%1!==0)throw new Error(`invalid triplet count, ${t.length} does not divide into triplets`);let o=[];for(let s=0;s<t.length;s+=3)o.push(t.slice(s,s+3));return new Uint8Array(o.map((s,n)=>{let a=(n%2===0?Jr:Qr).findIndex(c=>c===s);if(a===-1)throw new Error(`unknown triplet ${s}`);return a}))},toHex(r){return b.fromBytes(W.toBytes(r))},fromHex(r,t){return W.fromBytes(b.toBytes(r),t)}};var to=58,Re="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Zt=Object.freeze({fromBytes(r){let t=BigInt("0x"+b.fromBytes(r)),e="";for(;t>0;){let o=t%BigInt(to);t=t/BigInt(to),e=Re[Number(o)]+e}for(let o of r)if(o===0)e=Re[0]+e;else break;return e},toBytes(r){let t=BigInt(0);for(let i of r){let a=Re.indexOf(i);if(a===-1)throw new Error(`Invalid character '${i}' in base58 string`);t=t*BigInt(to)+BigInt(a)}let e=t.toString(16);e.length%2!==0&&(e="0"+e);let o=b.toBytes(e),s=0;for(let i of r)if(i===Re[0])s++;else break;let n=new Uint8Array(s+o.length);return n.set(o,s),n},random(r=32){return this.fromBytes(O.random(r))},string(r){return Zt.fromBytes(r)},bytes(r){return Zt.toBytes(r)}});var z={defaults:{delimiter:".",sigilBytes:4,previewBytes:8},toBytes(r){r=r.trim();let t=r.split(/[^a-zA-Z0-9]+/m).filter(Boolean).map(s=>s.trim());if(t.length<2)return W.toBytes(t.join(""));let e=t.pop(),o=t.join("");return new Uint8Array([...W.toBytes(o),...Zt.toBytes(e)])},parse(r,t){let e=z.toBytes(r);return z.build.fromBytes(e,t)},build:{fromBytes(r,t={}){let{delimiter:e,previewBytes:o,sigilBytes:s}={...z.defaults,...t},n=l=>r.length>0?W.fromBytes(r.slice(0,l),{wordSeparator:e,groupSeparator:e}):"",i=n(s),a=n(o),c=r.length>o?Zt.fromBytes(r.slice(o)):"",u=[a,c].filter(l=>l.length>0).join(e);return{bytes:r,thumbprint:u,preview:a,bulk:c,sigil:i}},fromHex(r,t){let e=b.toBytes(r);return z.build.fromBytes(e,t)}},toHex(r){let t=z.toBytes(r);return b.fromBytes(t)},fromBytes(r,t){return z.build.fromBytes(r,t).thumbprint},fromHex(r,t){return z.fromBytes(b.toBytes(r),t)},sigil:{fromHex(r,t){return z.build.fromHex(r,t).sigil},fromBytes(r,t){return z.build.fromBytes(r,t).sigil}}};var rs=class{lexicon;static lexicons=Object.freeze({base2:{characters:"01"},hex:{characters:"0123456789abcdef"},base36:{characters:"0123456789abcdefghijklmnopqrstuvwxyz"},base58:{characters:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"},base62:{characters:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"},base64url:{negativePrefix:"~",characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},base64:{characters:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",padding:{character:"=",size:4}}});lookup;negativePrefix;constructor(t){this.lexicon=t,this.lookup=Object.fromEntries([...t.characters].map((e,o)=>[e,o])),this.negativePrefix=t.negativePrefix??"-"}toBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let a=0,c=0,u=[];for(let l of t){if(l===this.lexicon.padding?.character)continue;let p=this.lookup[l];if(p===void 0)throw new Error(`Invalid character: ${l}`);for(a=a<<e|p,c+=e;c>=8;)c-=8,u.push(a>>c&255)}return new Uint8Array(u)}let o=0n,s=BigInt(this.lexicon.characters.length),n=!1;t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),n=!0);for(let a of t){let c=this.lookup[a];if(c===void 0)throw new Error(`Invalid character: ${a}`);o=o*s+BigInt(c)}let i=[];for(;o>0n;)i.unshift(Number(o%256n)),o=o/256n;return new Uint8Array(i)}fromBytes(t){let e=Math.log2(this.lexicon.characters.length);if(Number.isInteger(e)){let i=0,a=0,c="";for(let u of t)for(i=i<<8|u,a+=8;a>=e;){a-=e;let l=i>>a&(1<<e)-1;c+=this.lexicon.characters[l]}if(a>0){let u=i<<e-a&(1<<e)-1;c+=this.lexicon.characters[u]}if(this.lexicon.padding)for(;c.length%this.lexicon.padding.size!==0;)c+=this.lexicon.padding.character;return c}let o=0n;for(let i of t)o=(o<<8n)+BigInt(i);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return n}toInteger(t){if(!t)return 0;let e=0n,o=!1,s=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),o=!0);for(let n of t){let i=this.lookup[n];if(i===void 0)throw new Error(`Invalid character: ${n}`);e=e*s+BigInt(i)}return Number(o?-e:e)}fromInteger(t){t=Math.floor(t);let e=t<0,o=BigInt(e?-t:t);if(o===0n)return this.lexicon.characters[0];let s=BigInt(this.lexicon.characters.length),n="";for(;o>0n;)n=this.lexicon.characters[Number(o%s)]+n,o=o/s;return e?`${this.negativePrefix}${n}`:n}random(t=32){return this.fromBytes(O.random(t))}};var Xt=Object.freeze({fromBytes(r){return typeof btoa=="function"?btoa(String.fromCharCode(...r)):Buffer.from(r).toString("base64")},toBytes(r){return typeof atob=="function"?Uint8Array.from(atob(r),t=>t.charCodeAt(0)):Uint8Array.from(Buffer.from(r,"base64"))},random(r=32){return this.fromBytes(O.random(r))},string(r){return Xt.fromBytes(r)},bytes(r){return Xt.toBytes(r)}});var H={fromBytes(r){return Xt.fromBytes(r).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},toBytes(r){let t=r.replace(/-/g,"+").replace(/_/g,"/");return t.length%4!==0&&(t=t.padEnd(t.length+(4-t.length%4)%4,"=")),Xt.toBytes(t)},random(r=32){return this.fromBytes(O.random(r))},string(r){return H.fromBytes(r)},bytes(r){return H.toBytes(r)}};var J=Object.freeze({fromBytes(r){return new TextDecoder().decode(r)},toBytes(r){return new TextEncoder().encode(r)},string(r){return J.fromBytes(r)},bytes(r){return J.toBytes(r)}});function Jt(r,t){let e,o,s=[];function n(){e=[],o&&clearTimeout(o),o=void 0,s=[]}return n(),(...i)=>{e=i,o&&clearTimeout(o);let a=new Promise((c,u)=>{s.push({resolve:c,reject:u})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...e)).then(c=>{for(let{resolve:u}of s)u(c);n()}).catch(c=>{for(let{reject:u}of s)u(c);n()})},r),a}}var ze=Object.freeze({set:r=>r!=null,unset:r=>r==null,boolean:r=>typeof r=="boolean",number:r=>typeof r=="number",string:r=>typeof r=="string",bigint:r=>typeof r=="bigint",object:r=>typeof r=="object"&&r!==null,array:r=>Array.isArray(r),fn:r=>typeof r=="function",symbol:r=>typeof r=="symbol"});var Qt=class extends Error{milliseconds;name=this.constructor.name;constructor(t){super(`deadline exceeded (${(t/1e3).toFixed(1)} seconds)`),this.milliseconds=t}};function De(r,t){return r<=0||r===1/0?t():new Promise((e,o)=>{let s=setTimeout(()=>o(new Qt(r)),r);t().then(e).catch(o).finally(()=>clearTimeout(s))})}function lt(){let r,t,e=new Promise((s,n)=>{r=s,t=n});function o(s){return s.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:o}}function os(r,t){let e=r;for(let o of t)if(e=e[o],ze.unset(e))break;return e}function eo(r){return{map:t=>ss(r,t),filter:t=>ns(r,t)}}eo.pipe=Object.freeze({map:r=>t=>ss(t,r),filter:r=>t=>ns(t,r)});var ss=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,o])=>[e,t(o,e)])),ns=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,o])=>t(o,e)));var Ct=class r{static with(t){return new this(t)}#t;constructor(t){this.#t=t}to(t){return new r(t(this.#t))}done(){return this.#t}};function is(){let r=new Set;function t(n){return r.add(n),()=>{r.delete(n)}}async function e(...n){await Promise.all([...r].map(i=>i(...n)))}async function o(){let{promise:n,resolve:i}=lt(),a=t((...c)=>{i(c),a()});return n}function s(){r.clear()}return t.pub=e,t.sub=t,t.on=t,t.next=o,t.clear=s,e.pub=e,e.sub=t,e.on=t,e.next=o,e.clear=s,[e,t]}function D(r){let t=is()[1];return r&&t.sub(r),t}function Ue(r){let t=is()[0];return r&&t.sub(r),t}var G=class{#t=[];add(...t){return this.#t.push(...t),this}disposable(t){return this.bag(t,()=>t.dispose())}bag(t,e){return this.add(()=>e(t)),t}dispose(){for(let t of this.#t.reverse())t();this.#t=[]}};var ro=class{#t=[];#e=new WeakMap;#r=[];#o=new Set;see(t){this.#t.at(-1)?.add(t)}seen(t){this.#t.push(new Set);let e=t();return{seen:this.#t.pop(),result:e}}async change(t){if(this.#o.has(t))throw new Error("circularity forbidden");let e=this.#s(t).pub();return this.#r.at(-1)?.add(e),e}changed(t,e){return this.#s(t)(async()=>{let o=new Set;this.#r.push(o),this.#o.add(t),o.add(e()),this.#o.delete(t),await Promise.all(o),this.#r.pop()})}#s(t){let e=this.#e.get(t);return e||(e=D(),this.#e.set(t,e)),e}},vi=Symbol.for("e280.tracker.v2"),U=globalThis[vi]??=new ro;function oo(r,t=r){let{seen:e,result:o}=U.seen(r),s=Jt(0,t),n=[],i=()=>n.forEach(a=>a());for(let a of e){let c=U.changed(a,s);n.push(c)}return{result:o,dispose:i}}var _i={compare:(r,t)=>r===t};function Bt(r={}){return{..._i,...r}}var Le=class{sneak;constructor(t){this.sneak=t}get(){return U.see(this),this.sneak}get value(){return this.get()}},Ie=class extends Le{on=D();dispose(){this.on.clear()}},te=class extends Ie{_options;kind="signal";_lock=!1;constructor(t,e){super(t),this._options=e}async set(t){!this._options.compare(this.sneak,t)&&await this.publish(t)}get value(){return this.get()}set value(t){this.set(t)}async publish(t=this.get()){if(this._lock)throw new Error("forbid circularity");let e=Promise.resolve();try{this._lock=!0,this.sneak=t,e=Promise.all([U.change(this),this.on.pub(t)])}finally{this._lock=!1}return e}},ee=class extends Le{_formula;_options;kind="lazy";_dirty=!1;_effect;constructor(t,e){super(void 0),this._formula=t,this._options=e}get(){if(!this._effect){let{result:t,dispose:e}=oo(this._formula,()=>this._dirty=!0);this._effect=e,this.sneak=t}if(this._dirty){this._dirty=!1;let t=this._formula();!this._options.compare(this.sneak,t)&&(this.sneak=t,U.change(this))}return super.get()}get value(){return this.get()}dispose(){this._effect&&this._effect()}},re=class extends Ie{_effect;static make(t,e,o){let{result:s,dispose:n}=oo(e,async()=>{let i=e();!o.compare(t.sneak,i)&&(t.sneak=i,await Promise.all([U.change(t),t.on.pub(i)]))});return new this(s,n)}kind="derived";constructor(t,e){super(t),this._effect=e}get value(){return this.get()}dispose(){super.dispose(),this._effect()}};function as(r,t={}){function e(){return e.value}let o=Bt(t),s=new ee(r,o);return Object.setPrototypeOf(e,ee.prototype),Object.assign(e,s),e}function cs(r,t={}){function e(){return e.value}let o=Bt(t),s=re.make(e,r,o);return Object.setPrototypeOf(e,re.prototype),Object.assign(e,s),e}function Ne(r,t={}){function e(n){return n!==void 0?e.set(n):e.get()}let o=Bt(t),s=new te(r,o);return Object.setPrototypeOf(e,te.prototype),Object.assign(e,s),e}Ne.lazy=as;Ne.derive=cs;var He=class{flat;signals;#t=Promise.resolve();constructor(t,e){this.flat=t,this.signals=e}get wait(){return Promise.all([this.flat.wait,this.signals.wait]).then(()=>this.#t)}reaction(t,e){let o=e?()=>e(n()):()=>n(),s=this.lean(o),n=()=>s.collect(t);return n(),s.stop}lean(t){let e=this.flat.lean(t),o=this.signals.lean(t),s=new Map;return{stop(){e.stop(),o.stop();for(let n of s.values())n();s.clear()},collect(n){return e.collect(()=>o.collect(()=>{let{seen:i,result:a}=U.seen(n);for(let c of i)s.has(c)||s.set(c,U.changed(c,async()=>t()));return a}))}}}};var us=Error,v;(function(r){r.loading=()=>({status:"loading"}),r.error=a=>({status:"error",reason:a}),r.ready=a=>({status:"ready",payload:a}),r.is=Object.freeze({loading:a=>a.status==="loading",error:a=>a.status==="error",ready:a=>a.status==="ready"});function t(a){return a.status==="ready"?a.payload:void 0}r.payload=t;function e(a){return a.status==="error"?a.reason:void 0}r.reason=e;function o(a,c){switch(a.status){case"loading":return c.loading();case"error":return c.error(a.reason);case"ready":return c.ready(a.payload);default:throw console.error("op",a),new us("invalid op status")}}r.select=o;async function s(a,c){a(r.loading());try{let u=await c();return a(r.ready(u)),u}catch(u){let l=u instanceof us?u.message:typeof u=="string"?u:"error";throw a(r.error(l)),u}}r.load=s;function n(a,c){return o(a,{loading:()=>r.loading(),error:u=>r.error(u),ready:u=>r.ready(c(u))})}r.morph=n;function i(...a){let c=a.find(r.is.error);return c||(a.every(r.is.ready)?r.ready(a.map(t)):r.loading())}r.all=i})(v||(v={}));function S(r){return{map:t=>ps(r,t),filter:t=>ls(r,t)}}S.pipe=Object.freeze({map:r=>t=>ps(t,r),filter:r=>t=>ls(t,r)});var ps=(r,t)=>Object.fromEntries(Object.entries(r).map(([e,o])=>[e,t(o,e)])),ls=(r,t)=>Object.fromEntries(Object.entries(r).filter(([e,o])=>t(o,e)));var Tt=Symbol();var ft=class extends Error{name=this.constructor.name};var C=class r{static unwrap=t=>t instanceof r?t.value:t;#t;#e=!1;#r;#o=new Set;[Tt]=!1;constructor(t){this.#t=t,this.#r=Promise.resolve(t)}subscribe(t){return this.on(t)}on(t){return this.#o.add(t),()=>void this.#o.delete(t)}once(t){let e=o=>{t(o),this.#o.delete(e)};return this.#o.add(e),()=>void this.#o.delete(e)}clear(){return this.#o.clear()}#s=w(0,()=>{let t=this.#t;this.#e=!0;for(let e of this.#o)e(t);return this.#e=!1,t});async publish(){this.#r=this.#s(),await this.#r}get wait(){return this.#r}get value(){return this[Tt]=!0,this.#t}set value(t){if(this.#e)throw new ft("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#t!==t&&(this.#t=t,this.publish())}setDeep(t){if(this.#e)throw new ft("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");V.equal(t,this.#t)||(this.#t=t,this.publish())}setAndPublish(t){if(this.#e)throw new ft("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#t=t,this.publish()}setWithoutPublish(t){if(this.#e)throw new ft("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#t=t}setValueNoPublish(t){return this.setWithoutPublish(t)}};var qe=class extends C{#t=0;constructor(t){super(t)}async load(t){let e=++this.#t;return v.load(o=>{this.#t===e&&(this.value=o)},t)}setLoading(){this.value=v.loading()}setError(t){this.value=v.error(t)}setReady(t){this.value=v.ready(t)}isLoading(){return v.is.loading(this.value)}isError(){return v.is.error(this.value)}isReady(){return v.is.ready(this.value)}get payload(){return v.payload(this.value)}select(t){return v.select(this.value,t)}};var oe=class{#t=!0;#e;#r;#o=new Set;#s=new Set;constructor({all_signals:t,waiters:e}){this.#e=t,this.#r=e}#i=w(0,t=>{if(this.#t)if("lean"in t)t.actor();else{let{payload:e,recording:o}=this.observe(t.collector);this.add_listeners(t,o),t.responder&&t.responder(e)}});#n(){for(let t of this.#e)t[Tt]=!1}get#a(){return[...this.#e].filter(t=>t[Tt]&&!this.#o.has(t))}observe(t){return this.#n(),{payload:t(),recording:this.#a}}add_listeners(t,e){for(let o of e)this.#o.add(o),this.#s.add(o.on(()=>this.#r.add(this.#i(t))))}shutdown(){this.#t=!1,this.#s.forEach(t=>t())}};var Fe=class{#t=new Set;#e=new Set;signal(t){let e=new C(t);return this.#t.add(e),e}computed(t){let e=this.signal(t());return this.reaction(()=>{e.value=t()}),e}async computedAsync(t,e){let o=await e(t()),s=this.signal(o);return this.reaction(t,async n=>{s.value=await e(n)}),s}op(t=v.loading()){let e=new qe(t);return this.#t.add(e),e}load(t){let e=this.op(v.loading());return e.load(t),e}many(t){return S(t).map(e=>this.signal(e))}reaction(t,e){let o=new oe({waiters:this.#e,all_signals:this.#t}),s={collector:t,responder:e},{recording:n}=o.observe(s.collector);return o.add_listeners(s,n),()=>o.shutdown()}lean(t){let e=new oe({waiters:this.#e,all_signals:this.#t}),o={lean:!0,actor:t};return{stop:()=>e.shutdown(),collect:s=>{let{payload:n,recording:i}=e.observe(s);return e.add_listeners(o,i),n}}}async#r(){return await Promise.all([...this.#t].map(t=>t.wait)).then(()=>Promise.all([...this.#e])).then(()=>{this.#e.clear()})}get wait(){return Promise.resolve().then(()=>this.#r()).then(()=>this.#r())}};var Pt=new Te,M=new Fe,Ve=new je(M),Xl=Pt.state.bind(Pt),se=M.signal.bind(M),Jl=M.computed.bind(M),Ql=M.op.bind(M),Ot=new He(Pt,M);var Mt=class r{static with(t){return new this(t)}#t;constructor(t){this.#t=t}to(t){return new r(t(this.#t))}done(){return this.#t}};var A;(function(r){function t(...a){return function(c){return class extends c{static get styles(){return hs(c.styles,a)}}}}r.css=t;function e(a){return function(c){return class extends c{static get styles(){return hs(c.styles,a())}}}}r.css_deferred=e;function o(a){return function(c){return class extends c{#t=null;render(){return this.#t?.collect(()=>super.render())}connectedCallback(){super.connectedCallback(),this.#t=a.lean(()=>this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.#t&&(this.#t.stop(),this.#t=null)}}}}r.signals=o;function s(a){return function(c){return class extends c{#t=null;render(){return this.#t?.collect(()=>super.render())}connectedCallback(){super.connectedCallback(),this.#t=a.lean(()=>this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.#t&&(this.#t.stop(),this.#t=null)}}}}r.flat=s;function n(a=Ot){return function(c){return class extends c{#t=null;render(){return this.#t?.collect(()=>super.render())}connectedCallback(){super.connectedCallback(),this.#t=a.lean(()=>this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.#t&&(this.#t.stop(),this.#t=null)}}}}r.reactive=n,r.reactor=n;function i(...a){return function(c){return Mt.with(c).to(t(...a)).to(n()).done()}}r.setup=i})(A||(A={}));function ds(r){return[r].flat().filter(t=>!!t)}var Si=r=>r!==void 0;function hs(r,t){return[...ds(r)??[],...ds(t)].flat().filter(Si)}var Q;(function(r){r.css=t=>e=>S(e).map(o=>A.css(t)(o)),r.flat=t=>e=>S(e).map(o=>A.flat(t)(o)),r.signals=t=>e=>S(e).map(o=>A.signals(t)(o)),r.reactive=(t=Ot)=>e=>S(e).map(o=>A.reactive(t)(o)),r.reactor=r.reactive,r.context=t=>e=>Mt.with(e).to(r.css(t.theme)).to(r.reactive()).done(),r.setup=(...t)=>e=>S(e).map(o=>A.setup(...t)(o))})(Q||(Q={}));function ms(r){return r.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function so(r,t={}){let{soft:e=!1,upgrade:o=!0}=t;for(let[s,n]of Object.entries(r)){let i=ms(s),a=customElements.get(i);e&&a||(customElements.define(i,n),o&&document.querySelectorAll(i).forEach(c=>{c.constructor===HTMLElement&&customElements.upgrade(c)}))}}var gs=so;var We=globalThis,Ge=We.ShadowRoot&&(We.ShadyCSS===void 0||We.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,no=Symbol(),ys=new WeakMap,jt=class{constructor(t,e,o){if(this._$cssResult$=!0,o!==no)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(Ge&&t===void 0){let o=e!==void 0&&e.length===1;o&&(t=ys.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&ys.set(e,t))}return t}toString(){return this.cssText}},io=r=>new jt(typeof r=="string"?r:r+"",void 0,no),_=(r,...t)=>{let e=r.length===1?r[0]:t.reduce((o,s,n)=>o+(i=>{if(i._$cssResult$===!0)return i.cssText;if(typeof i=="number")return i;throw Error("Value passed to 'css' function must be a 'css' function result: "+i+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(s)+r[n+1],r[0]);return new jt(e,r,no)},Ye=(r,t)=>{if(Ge)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let o=document.createElement("style"),s=We.litNonce;s!==void 0&&o.setAttribute("nonce",s),o.textContent=e.cssText,r.appendChild(o)}},Rt=Ge?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(let o of t.cssRules)e+=o.cssText;return io(e)})(r):r;var{is:ki,defineProperty:Ei,getOwnPropertyDescriptor:Ci,getOwnPropertyNames:Bi,getOwnPropertySymbols:Ti,getPrototypeOf:Pi}=Object,Ke=globalThis,xs=Ke.trustedTypes,Oi=xs?xs.emptyScript:"",Mi=Ke.reactiveElementPolyfillSupport,ne=(r,t)=>r,ao={toAttribute(r,t){switch(t){case Boolean:r=r?Oi:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,t){let e=r;switch(t){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r)}catch{e=null}}return e}},ws=(r,t)=>!ki(r,t),bs={attribute:!0,type:String,converter:ao,reflect:!1,useDefault:!1,hasChanged:ws};Symbol.metadata??=Symbol("metadata"),Ke.litPropertyMetadata??=new WeakMap;var Y=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=bs){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let o=Symbol(),s=this.getPropertyDescriptor(t,o,e);s!==void 0&&Ei(this.prototype,t,s)}}static getPropertyDescriptor(t,e,o){let{get:s,set:n}=Ci(this.prototype,t)??{get(){return this[e]},set(i){this[e]=i}};return{get:s,set(i){let a=s?.call(this);n?.call(this,i),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??bs}static _$Ei(){if(this.hasOwnProperty(ne("elementProperties")))return;let t=Pi(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(ne("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(ne("properties"))){let e=this.properties,o=[...Bi(e),...Ti(e)];for(let s of o)this.createProperty(s,e[s])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[o,s]of e)this.elementProperties.set(o,s)}this._$Eh=new Map;for(let[e,o]of this.elementProperties){let s=this._$Eu(e,o);s!==void 0&&this._$Eh.set(s,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let s of o)e.unshift(Rt(s))}else t!==void 0&&e.push(Rt(t));return e}static _$Eu(t,e){let o=e.attribute;return o===!1?void 0:typeof o=="string"?o:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let o of e.keys())this.hasOwnProperty(o)&&(t.set(o,this[o]),delete this[o]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ye(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,o){this._$AK(t,o)}_$ET(t,e){let o=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,o);if(s!==void 0&&o.reflect===!0){let n=(o.converter?.toAttribute!==void 0?o.converter:ao).toAttribute(e,o.type);this._$Em=t,n==null?this.removeAttribute(s):this.setAttribute(s,n),this._$Em=null}}_$AK(t,e){let o=this.constructor,s=o._$Eh.get(t);if(s!==void 0&&this._$Em!==s){let n=o.getPropertyOptions(s),i=typeof n.converter=="function"?{fromAttribute:n.converter}:n.converter?.fromAttribute!==void 0?n.converter:ao;this._$Em=s,this[s]=i.fromAttribute(e,n.type)??this._$Ej?.get(s)??null,this._$Em=null}}requestUpdate(t,e,o){if(t!==void 0){let s=this.constructor,n=this[t];if(o??=s.getPropertyOptions(t),!((o.hasChanged??ws)(n,e)||o.useDefault&&o.reflect&&n===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,o))))return;this.C(t,e,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:o,reflect:s,wrapped:n},i){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),n!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(e=void 0),this._$AL.set(t,e)),s===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[s,n]of this._$Ep)this[s]=n;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[s,n]of o){let{wrapped:i}=n,a=this[s];i!==!0||this._$AL.has(s)||a===void 0||this.C(s,void 0,n,a)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(o=>o.hostUpdate?.()),this.update(e)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};Y.elementStyles=[],Y.shadowRootOptions={mode:"open"},Y[ne("elementProperties")]=new Map,Y[ne("finalized")]=new Map,Mi?.({ReactiveElement:Y}),(Ke.reactiveElementVersions??=[]).push("2.1.0");var uo=globalThis,Ze=uo.trustedTypes,vs=Ze?Ze.createPolicy("lit-html",{createHTML:r=>r}):void 0,po="$lit$",K=`lit$${Math.random().toFixed(9).slice(2)}$`,lo="?"+K,ji=`<${lo}>`,mt=document,ae=()=>mt.createComment(""),ce=r=>r===null||typeof r!="object"&&typeof r!="function",fo=Array.isArray,Es=r=>fo(r)||typeof r?.[Symbol.iterator]=="function",co=`[ \f\r]`,ie=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,_s=/-->/g,As=/>/g,dt=RegExp(`>|${co}(?:([^\\s"'>=/]+)(${co}*=${co}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),$s=/'/g,Ss=/"/g,Cs=/^(?:script|style|textarea|title)$/i,ho=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Bs=ho(1),mo=ho(2),wf=ho(3),L=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),ks=new WeakMap,ht=mt.createTreeWalker(mt,129);function Ts(r,t){if(!fo(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return vs!==void 0?vs.createHTML(t):t}var Ps=(r,t)=>{let e=r.length-1,o=[],s,n=t===2?"<svg>":t===3?"<math>":"",i=ie;for(let a=0;a<e;a++){let c=r[a],u,l,p=-1,d=0;for(;d<c.length&&(i.lastIndex=d,l=i.exec(c),l!==null);)d=i.lastIndex,i===ie?l[1]==="!--"?i=_s:l[1]!==void 0?i=As:l[2]!==void 0?(Cs.test(l[2])&&(s=RegExp("</"+l[2],"g")),i=dt):l[3]!==void 0&&(i=dt):i===dt?l[0]===">"?(i=s??ie,p=-1):l[1]===void 0?p=-2:(p=i.lastIndex-l[2].length,u=l[1],i=l[3]===void 0?dt:l[3]==='"'?Ss:$s):i===Ss||i===$s?i=dt:i===_s||i===As?i=ie:(i=dt,s=void 0);let h=i===dt&&r[a+1].startsWith("/>")?" ":"";n+=i===ie?c+ji:p>=0?(o.push(u),c.slice(0,p)+po+c.slice(p)+K+h):c+K+(p===-2?a:h)}return[Ts(r,n+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},ue=class r{constructor({strings:t,_$litType$:e},o){let s;this.parts=[];let n=0,i=0,a=t.length-1,c=this.parts,[u,l]=Ps(t,e);if(this.el=r.createElement(u,o),ht.currentNode=this.el.content,e===2||e===3){let p=this.el.content.firstChild;p.replaceWith(...p.childNodes)}for(;(s=ht.nextNode())!==null&&c.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let p of s.getAttributeNames())if(p.endsWith(po)){let d=l[i++],h=s.getAttribute(p).split(K),m=/([.?@])?(.*)/.exec(d);c.push({type:1,index:n,name:m[2],strings:h,ctor:m[1]==="."?Je:m[1]==="?"?Qe:m[1]==="@"?tr:yt}),s.removeAttribute(p)}else p.startsWith(K)&&(c.push({type:6,index:n}),s.removeAttribute(p));if(Cs.test(s.tagName)){let p=s.textContent.split(K),d=p.length-1;if(d>0){s.textContent=Ze?Ze.emptyScript:"";for(let h=0;h<d;h++)s.append(p[h],ae()),ht.nextNode(),c.push({type:2,index:++n});s.append(p[d],ae())}}}else if(s.nodeType===8)if(s.data===lo)c.push({type:2,index:n});else{let p=-1;for(;(p=s.data.indexOf(K,p+1))!==-1;)c.push({type:7,index:n}),p+=K.length-1}n++}}static createElement(t,e){let o=mt.createElement("template");return o.innerHTML=t,o}};function gt(r,t,e=r,o){if(t===L)return t;let s=o!==void 0?e._$Co?.[o]:e._$Cl,n=ce(t)?void 0:t._$litDirective$;return s?.constructor!==n&&(s?._$AO?.(!1),n===void 0?s=void 0:(s=new n(r),s._$AT(r,e,o)),o!==void 0?(e._$Co??=[])[o]=s:e._$Cl=s),s!==void 0&&(t=gt(r,s._$AS(r,t.values),s,o)),t}var Xe=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:o}=this._$AD,s=(t?.creationScope??mt).importNode(e,!0);ht.currentNode=s;let n=ht.nextNode(),i=0,a=0,c=o[0];for(;c!==void 0;){if(i===c.index){let u;c.type===2?u=new zt(n,n.nextSibling,this,t):c.type===1?u=new c.ctor(n,c.name,c.strings,this,t):c.type===6&&(u=new er(n,this,t)),this._$AV.push(u),c=o[++a]}i!==c?.index&&(n=ht.nextNode(),i++)}return ht.currentNode=mt,s}p(t){let e=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,e),e+=o.strings.length-2):o._$AI(t[e])),e++}},zt=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,o,s){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=o,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=gt(this,t,e),ce(t)?t===g||t==null||t===""?(this._$AH!==g&&this._$AR(),this._$AH=g):t!==this._$AH&&t!==L&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Es(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==g&&ce(this._$AH)?this._$AA.nextSibling.data=t:this.T(mt.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:o}=t,s=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=ue.createElement(Ts(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===s)this._$AH.p(e);else{let n=new Xe(s,this),i=n.u(this.options);n.p(e),this.T(i),this._$AH=n}}_$AC(t){let e=ks.get(t.strings);return e===void 0&&ks.set(t.strings,e=new ue(t)),e}k(t){fo(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,o,s=0;for(let n of t)s===e.length?e.push(o=new r(this.O(ae()),this.O(ae()),this,this.options)):o=e[s],o._$AI(n),s++;s<e.length&&(this._$AR(o&&o._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let o=t.nextSibling;t.remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},yt=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,o,s,n){this.type=1,this._$AH=g,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=n,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=g}_$AI(t,e=this,o,s){let n=this.strings,i=!1;if(n===void 0)t=gt(this,t,e,0),i=!ce(t)||t!==this._$AH&&t!==L,i&&(this._$AH=t);else{let a=t,c,u;for(t=n[0],c=0;c<n.length-1;c++)u=gt(this,a[o+c],e,c),u===L&&(u=this._$AH[c]),i||=!ce(u)||u!==this._$AH[c],u===g?t=g:t!==g&&(t+=(u??"")+n[c+1]),this._$AH[c]=u}i&&!s&&this.j(t)}j(t){t===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},Je=class extends yt{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===g?void 0:t}},Qe=class extends yt{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==g)}},tr=class extends yt{constructor(t,e,o,s,n){super(t,e,o,s,n),this.type=5}_$AI(t,e=this){if((t=gt(this,t,e,0)??g)===L)return;let o=this._$AH,s=t===g&&o!==g||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,n=t!==g&&(o===g||s);s&&this.element.removeEventListener(this.name,this,o),n&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},er=class{constructor(t,e,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){gt(this,t)}},Os={M:po,P:K,A:lo,C:1,L:Ps,R:Xe,D:Es,V:gt,I:zt,H:yt,N:Qe,U:tr,B:Je,F:er},Ri=uo.litHtmlPolyfillSupport;Ri?.(ue,zt),(uo.litHtmlVersions??=[]).push("3.3.0");var B=(r,t,e)=>{let o=e?.renderBefore??t,s=o._$litPart$;if(s===void 0){let n=e?.renderBefore??null;o._$litPart$=s=new zt(t.insertBefore(ae(),n),n,void 0,e??{})}return s._$AI(r),s};var go=globalThis,Dt=class extends Y{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=B(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return L}};Dt._$litElement$=!0,Dt.finalized=!0,go.litElementHydrateSupport?.({LitElement:Dt});var zi=go.litElementPolyfillSupport;zi?.({LitElement:Dt});(go.litElementVersions??=[]).push("4.2.0");function Ms(r){return class extends r{#t=new Set().add(()=>this.setup());#e=new Set;register_setup(t){this.#t.add(t)}setup(){return()=>{}}connectedCallback(){for(let t of this.#t)this.#e.add(t())}disconnectedCallback(){for(let t of this.#e)t();this.#e.clear()}}}var Ut=class extends Ms(HTMLElement){};function pe(){let r,t,e=new Promise((s,n)=>{r=s,t=n});function o(s){return s.then(r).catch(t),e}return{promise:e,resolve:r,reject:t,entangle:o}}function js(r){let t=[];if(Array.isArray(r)){let e=new Set(r.flat(1/0).reverse());for(let o of e)t.unshift(Rt(o))}else r!==void 0&&t.push(Rt(r));return t}function rr(r,t){Ye(r,js(t))}var tt=class extends Ut{static get styles(){}#t;#e=pe();#r=this.#e.promise;init(){}constructor(){super(),this.#t=this.attachShadow({mode:"open"});let t=this.constructor;rr(this.#t,t.styles),this.init()}get root(){return this.#t}get updateComplete(){return this.#r.then(()=>!0)}render(){}#o=w(0,()=>{let t=this.#t,e=this.render();e&&B(e,t,{host:this})});async requestUpdate(){let t=this.#o();return this.#e&&(t.then(this.#e.resolve),this.#e=void 0),this.#r=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}};var or=class extends Ut{#t=pe();#e=this.#t.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#e.then(()=>!0)}render(){}#r=w(0,()=>{let t=this.render();B(t,this,{host:this})});async requestUpdate(){let t=this.#r();return this.#t&&(t.then(this.#t.resolve),this.#t=void 0),this.#e=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}};var y=Symbol();var sr=class{#t=0;pull(){return this.#t++}reset(){this.#t=0}};var et=class{[y]={wrap:t=>(...e)=>(this.#r.reset(),t(...e)),disconnect:()=>{for(let t of this.#s)t();this.#s.clear();for(let t of this.#a)t();this.#a.clear(),this.#n.clear();for(let{untrack:t}of this.#f.values())t();this.#f.clear()},reconnect:()=>{for(let t of this.#o.values())this.#s.add(t());for(let[t,e]of this.#i.entries()){let[o,s]=e();this.#n.set(t,o),this.#a.add(s)}},afterRender:()=>{for(let t of this.#c.values())t()}};#t;#e;#r=new sr;constructor(t,e){this.#e=t,this.#t=e}get context(){return this.#t}rerender(){this.#e()}#o=new Map;#s=new Set;mount(t){let e=this.#r.pull();this.#o.has(e)||(this.#o.set(e,t),this.#s.add(t()))}#i=new Map;#n=new Map;#a=new Set;init(t){let e=this.#r.pull();if(!this.#i.has(e)){this.#i.set(e,t);let[o,s]=t();return this.#n.set(e,o),this.#a.add(s),o}return this.#n.get(e)}#h=new Map;once(t){let e=this.#r.pull();return E(this.#h).guarantee(e,t)}#c=new Map;defer(t){let e=this.signal(void 0),o=this.#r.pull();return this.#c.has(o)||this.#c.set(o,()=>{e.value=t()}),e}#u=new Set;deferOnce(t){this.mount(()=>(this.#u.clear(),()=>{}));let e=this.signal(void 0),o=this.#r.pull();return this.#c.has(o)||this.#c.set(o,()=>{this.#u.has(o)||(this.#u.add(o),e.value=t())}),e}#p=new Map;state(t){let e=this.#r.pull();return[E(this.#p).guarantee(e,()=>typeof t=="function"?t():t),i=>{this.#p.set(e,i),this.#e()},()=>this.#p.get(e)]}#m=new Map;flatstate(t){let e=this.#r.pull();return E(this.#m).guarantee(e,()=>Pt.state(typeof t=="function"?t():t))}#l=new Map;signal(t){let e=this.#r.pull();return E(this.#l).guarantee(e,()=>M.signal(typeof t=="function"?t():t))}computed(t){let e=this.#r.pull();return E(this.#l).guarantee(e,()=>M.computed(t))}op(){let t=this.#r.pull();return E(this.#l).guarantee(t,()=>M.op())}load(t){let e=this.op();return this.once(()=>e.load(t)),e}#f=new Map;watch(t){let e=this.#r.pull(),{data:o}=E(this.#f).guarantee(e,()=>{let s={data:t(),untrack:()=>{}};return s.untrack=Ve.track(t,n=>{s.data=n,this.#e()}),s});return o}#d=new Map;effect(t,e){e=e.map(C.unwrap);let o=this.#r.pull(),s=this.#d.get(o);if(s){let[n,i]=s;V.equal(e,i)||(n(),this.#d.set(o,[t(),e]))}else{this.#o.set(o,t);let n=t();this.#s.add(n),this.#d.set(o,[n,e])}}};var Lt=class extends et{#t;get element(){return this.#t}#e;get shadow(){return this.#e}styles(...t){this.once(()=>rr(this.shadow,[this.context.theme,...t]))}css(...t){return this.styles(...t)}constructor(t,e,o,s){super(o,s),this.#t=t,this.#e=e}};function nr(r){let t;return function(e){return t||(t=St(r,e)),t}}var ir=class extends Lt{attrs;constructor(t,e,o,s){super(t,e,o,s),this.attrs=nr(t)}};var ar=class extends et{#t;get element(){return this.#t}attrs;constructor(t,e,o){super(e,o),this.#t=t,this.attrs=nr(t)}};var cr=class extends ir{},ur=class extends ar{},pr=class extends et{element;name(t){this.once(()=>this.element.setAttribute("view",t))}constructor(t,e,o){super(e,o),this.element=t}},lr=class extends Lt{name(t){this.once(()=>this.element.setAttribute("view",t))}};var fr=class{#t;constructor(t){this.#t=t}get context(){if(this.#t)return this.#t;throw new Error("nexus.context was not set, but it's necessary")}set context(t){this.#t=t}};function q(r,t){let e=Ot.lean(t);return{stop:e.stop,render:(...o)=>e.collect(()=>r(...o))}}var Rs=r=>t=>class extends tt{#t=new cr(this,this.root,()=>void this.requestUpdate(),r.context);#e=this.#t[y].wrap(()=>t(this.#t));#r;render(){return this.updateComplete.then(()=>this.#t[y].afterRender()),this.#r?.render()}connectedCallback(){super.connectedCallback(),this.#t[y].reconnect(),this.#r=q(this.#e,()=>void this.requestUpdate())}disconnectedCallback(){super.disconnectedCallback(),this.#t[y].disconnect(),this.#r&&(this.#r.stop(),this.#r=void 0)}};var{I:Di}=Os;var Ds=r=>r.strings===void 0,zs=()=>document.createComment(""),It=(r,t,e)=>{let o=r._$AA.parentNode,s=t===void 0?r._$AB:t._$AA;if(e===void 0){let n=o.insertBefore(zs(),s),i=o.insertBefore(zs(),s);e=new Di(n,i,r,r.options)}else{let n=e._$AB.nextSibling,i=e._$AM,a=i!==r;if(a){let c;e._$AQ?.(r),e._$AM=r,e._$AP!==void 0&&(c=r._$AU)!==i._$AU&&e._$AP(c)}if(n!==s||a){let c=e._$AA;for(;c!==n;){let u=c.nextSibling;o.insertBefore(c,s),c=u}}}return e},rt=(r,t,e=r)=>(r._$AI(t,e),r),Ui={},Us=(r,t=Ui)=>r._$AH=t,Ls=r=>r._$AH,dr=r=>{r._$AP?.(!1,!0);let t=r._$AA,e=r._$AB.nextSibling;for(;t!==e;){let o=t.nextSibling;t.remove(),t=o}};var Nt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},xt=r=>(...t)=>({_$litDirective$:r,values:t}),ot=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,o){this._$Ct=t,this._$AM=e,this._$Ci=o}_$AS(t,e){return this.update(t,e)}update(t,e)