@e280/authlocal
Version:
User-sovereign login system for everybody
3 lines • 128 kB
JavaScript
var Ne=class{#t=!1;lock(t){this.#t=!0;let r=t();return this.#t=!1,r}get locked(){return this.#t}};var ue=()=>new Map,Tn=()=>new Set;function O(e){return{guarantee:(t,r)=>ba(e,t,r)}}function ba(e,t,r){if(e.has(t))return e.get(t);{let o=r();return e.set(t,o),o}}var He=class{#t=new WeakMap;grab_keymap(t){let r=O(this.#t).guarantee(t,ue);return{keymap:r,grab_symbolmap(o){return O(r).guarantee(o,ue)}}}clear(){this.#t=new WeakMap}};var qe=class{#t=new Map;stop(t){let r=this.#t.get(t);r&&(this.#t.delete(t),r())}add(t,r){this.#t.set(t,r)}};var Ve=class{#t=[];record(t){let r=ue();this.#t.push(r);let o=t();return this.#t.pop(),{payload:o,recording:r}}record_that_key_was_accessed(t,r){let o=this.#t.at(-1);o&&O(o).guarantee(t,Tn).add(r)}};var Fe=class extends Error{name=this.constructor.name},We=class extends Fe{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}},Ge=class extends Fe{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}};function Pn(e){return new Proxy(e,{get(t,r){return t[r]},set(t,r){throw new Ge(r)}})}function $(e,t){let r,o,n=[];function s(){r=[],o&&clearTimeout(o),o=void 0,n=[]}return s(),(...i)=>{r=i,o&&clearTimeout(o);let a=new Promise((c,l)=>{n.push({resolve:c,reject:l})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...r)).then(c=>{for(let{resolve:l}of n)l(c);s()}).catch(c=>{for(let{reject:l}of n)l(c);s()})},e),a}}var Ke=class{#t=new Map;#e=Promise.resolve();#r=$(0,()=>{let t=[...this.#t.values()];this.#t.clear();for(let r of t)r()});get wait(){return this.#e}add(t,r){this.#t.set(t,r),this.#e=this.#r()}};function Mn(e){return function(t){return()=>{let r=typeof e=="function"?e():e;return t(r)}}}function de(e,t,r,o){let n=[];for(let[s,i]of t){let{grab_symbolmap:a}=r.grab_keymap(s);for(let c of i){let l=a(c);l.set(e,o),n.push(()=>l.delete(e))}}return()=>n.forEach(s=>s())}function On(e,t,r,o,n){function s([i,a]){if("lean"in a)a.actor();else{let{payload:c,recording:l}=t.record(a.collector);o.add(i,de(i,l,e,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(r.locked)throw new We(a);i[a]=c;let l=[...e.grab_keymap(i).grab_symbolmap(a)];for(let p of l){let[u]=p;n.add(u,()=>r.lock(()=>s(p)))}return!0}}}var Ye=class{static readonly=Pn;static collectivize=Mn;#t=new He;#e=new Ve;#r=new Ne;#o=new qe;#n=new Ke;#i=On(this.#t,this.#e,this.#r,this.#o,this.#n);get wait(){return this.#n.wait}state(t){return new Proxy(t,this.#i)}reaction(t,r){let o=Symbol(),{recording:n}=this.#e.record(()=>this.#r.lock(t));return this.#o.add(o,de(o,n,this.#t,{collector:t,responder:r})),()=>this.#o.stop(o)}lean(t){let r=Symbol();return{stop:()=>this.#o.stop(r),collect:o=>{let{payload:n,recording:s}=this.#e.record(()=>this.#r.lock(o));return this.#o.add(r,de(r,s,this.#t,{lean:!0,actor:t})),n}}}clear(){this.#t.clear()}};function Je(e,t){return Ze.on_change(e,()=>e.requestUpdate()),Ze.proxy(e,t)}var Ze;(function(e){e.proxy=(r,o)=>new Proxy(o,{get:(n,s)=>{let i=o[s],a=r.getAttribute(s);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 "${s}"`)}},set:(n,s,i)=>{switch(o[s]){case String:return r.setAttribute(s,i),!0;case Number:return r.setAttribute(s,i.toString()),!0;case Boolean:return i?r.setAttribute(s,""):r.removeAttribute(s),!0;default:throw new Error(`invalid attribute type for "${s}"`)}}});function t(r,o){let n=new MutationObserver(o);return n.observe(r,{attributes:!0}),()=>n.disconnect()}e.on_change=t})(Ze||(Ze={}));var Xe=class e{#t;constructor(t){this.#t=t}get state(){return this.#t.getter(this.#t.parent.state)}transmute(t){this.#t.parent.transmute(r=>{let o=this.#t.getter(r),n=t(o);return this.#t.setter(r,n)})}slice({getter:t,setter:r}){return new e({parent:this,getter:t,setter:r})}};function Rt(e,t=new Set){if(t.has(e))throw new Error("cannot clone circular reference");let r;return typeof e=="function"||e!==null&&typeof e=="object"?(t.add(e),Array.isArray(e)?r=e.map(o=>Rt(o,new Set(t))):e.constructor===Object?r=Object.fromEntries(Object.entries(e).map(([o,n])=>[o,Rt(n,new Set(t))])):e instanceof Map?r=new Map(Array.from(e,([o,n])=>[o,Rt(n,new Set(t))])):e instanceof Set?r=new Set(Array.from(e,o=>Rt(o,new Set(t)))):e instanceof Date?r=new Date(e.getTime()):r=e,t.delete(e)):r=e,r}var Dt={available:e=>e!=null,unavailable:e=>e==null,void:e=>e==null,defined:e=>e!=null,boolean:e=>typeof e=="boolean",number:e=>typeof e=="number",string:e=>typeof e=="string",bigint:e=>typeof e=="bigint",object:e=>typeof e=="object"&&e!==null,array:e=>Array.isArray(e)};var jn=(e,t)=>{function r(o,n,s){if(!Dt.object(o)||!Dt.object(n))return o===n;if(s.includes(o))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...s,o];if(o instanceof Map&&n instanceof Map){if(o.size!==n.size)return!1;for(let[a,c]of o)if(!n.has(a)||!r(c,n.get(a),i))return!1}else if(o instanceof Set&&n instanceof Set){if(o.size!==n.size)return!1;for(let a of o)if(!Array.from(n).some(c=>r(a,c,i)))return!1}else{let a=Object.keys(o),c=Object.keys(n);if(a.length!==c.length)return!1;for(let l of a)if(!c.includes(l)||!r(o[l],n[l],i))return!1}return!0}return r(e,t,[])};function zn(e){function t(r,o){if(!Dt.object(r)||o.includes(r))return r;let n=[...o,r];if(r instanceof Map)for(let s of r.entries())for(let i of s)t(i,n);else if(r instanceof Set)for(let s of r)t(s,n);else if(Array.isArray(r))for(let s of r)t(s,n);else for(let s of Object.values(r))t(s,n);return Object.freeze(r)}return t(e,[])}var X={clone:Rt,equal:jn,freeze:zn};var Qe=class{#t;#e;#r;#o=!1;#n(){return X.freeze(structuredClone(this.#t))}constructor(t,r=()=>{}){this.#t=structuredClone(t),this.#e=this.#n(),this.#r=r}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.#n(),this.#r(),this.#o=!1}slice({getter:t,setter:r}){return new Xe({parent:this,getter:t,setter:r})}};var tr=class{#t;#e=new Set;#r=new Set;#o=new Map;#n=Promise.resolve();constructor(t){this.#t=t}get wait(){return this.#n}#i=$(0,()=>{for(let t of this.#e)t();for(let t of this.#r)t()});dispatch(){this.#n=this.#i()}computed(t){let r=this.#t.signal(t());return this.#e.add(()=>{r.value=t()}),r}track(t,r){let o=!0,n=()=>{let i=t(),a=this.#o.get(t);(o||!X.equal(i,a))&&(o=!1,this.#o.set(t,i),r(i))};return n(),this.#r.add(n),()=>this.#r.delete(n)}stateTree(t){return new Qe(t,()=>this.dispatch())}};var D=Object.freeze({eq(e,t){if(e.length!==t.length)return!1;for(let r=0;r<=e.length;r++)if(e.at(r)!==t.at(r))return!1;return!0},random(e){return crypto.getRandomValues(new Uint8Array(e))}});var _=Object.freeze({fromBytes(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")},toBytes(e){if(e.length%2!==0)throw new Error("must have even number of hex characters");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r/2]=parseInt(e.slice(r,r+2),16);return t},random(e=32){return this.fromBytes(D.random(e))},string(e){return _.fromBytes(e)},bytes(e){return _.toBytes(e)}});var To=["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 Po=["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 I={defaults:{groupSize:4,wordSeparator:".",groupSeparator:" "},random(e,t){let r=D.random(e);return this.fromBytes(r,t)},fromBytes(e,t={}){let{groupSize:r=I.defaults.groupSize,wordSeparator:o=I.defaults.wordSeparator,groupSeparator:n=I.defaults.groupSeparator}=t,s=[],i=[];e.forEach((c,l)=>{let p=l%2===0?To:Po;i.push(p[c]),i.length===2&&(s.push(i.join("")),i=[])}),i.length&&s.push(i.join(""));let a=[];for(let c=0;c<s.length;c+=r)a.push(s.slice(c,c+r).join(o));return a.join(n)},toBytes(e){let t=e.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 n=0;n<t.length;n+=3)o.push(t.slice(n,n+3));return new Uint8Array(o.map((n,s)=>{let a=(s%2===0?To:Po).findIndex(c=>c===n);if(a===-1)throw new Error(`unknown triplet ${n}`);return a}))},toHex(e){return _.fromBytes(I.toBytes(e))},fromHex(e,t){return I.fromBytes(_.toBytes(e),t)}};var Mo=58,er="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",fe=Object.freeze({fromBytes(e){let t=BigInt("0x"+_.fromBytes(e)),r="";for(;t>0;){let o=t%BigInt(Mo);t=t/BigInt(Mo),r=er[Number(o)]+r}for(let o of e)if(o===0)r=er[0]+r;else break;return r},toBytes(e){let t=BigInt(0);for(let i of e){let a=er.indexOf(i);if(a===-1)throw new Error(`Invalid character '${i}' in base58 string`);t=t*BigInt(Mo)+BigInt(a)}let r=t.toString(16);r.length%2!==0&&(r="0"+r);let o=_.toBytes(r),n=0;for(let i of e)if(i===er[0])n++;else break;let s=new Uint8Array(n+o.length);return s.set(o,n),s},random(e=32){return this.fromBytes(D.random(e))},string(e){return fe.fromBytes(e)},bytes(e){return fe.toBytes(e)}});var A={defaults:{delimiter:".",sigilBytes:4,previewBytes:8},toBytes(e){e=e.trim();let t=e.split(/[^a-zA-Z0-9]+/m).filter(Boolean).map(n=>n.trim());if(t.length<2)return I.toBytes(t.join(""));let r=t.pop(),o=t.join("");return new Uint8Array([...I.toBytes(o),...fe.toBytes(r)])},parse(e,t){let r=A.toBytes(e);return A.build.fromBytes(r,t)},build:{fromBytes(e,t={}){let{delimiter:r,previewBytes:o,sigilBytes:n}={...A.defaults,...t},s=p=>e.length>0?I.fromBytes(e.slice(0,p),{wordSeparator:r,groupSeparator:r}):"",i=s(n),a=s(o),c=e.length>o?fe.fromBytes(e.slice(o)):"",l=[a,c].filter(p=>p.length>0).join(r);return{bytes:e,thumbprint:l,preview:a,bulk:c,sigil:i}},fromHex(e,t){let r=_.toBytes(e);return A.build.fromBytes(r,t)}},toHex(e){let t=A.toBytes(e);return _.fromBytes(t)},fromBytes(e,t){return A.build.fromBytes(e,t).thumbprint},fromHex(e,t){return A.fromBytes(_.toBytes(e),t)},sigil:{fromHex(e,t){return A.build.fromHex(e,t).sigil},fromBytes(e,t){return A.build.fromBytes(e,t).sigil}}};var Rn=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((r,o)=>[r,o])),this.negativePrefix=t.negativePrefix??"-"}toBytes(t){let r=Math.log2(this.lexicon.characters.length);if(Number.isInteger(r)){let a=0,c=0,l=[];for(let p of t){if(p===this.lexicon.padding?.character)continue;let u=this.lookup[p];if(u===void 0)throw new Error(`Invalid character: ${p}`);for(a=a<<r|u,c+=r;c>=8;)c-=8,l.push(a>>c&255)}return new Uint8Array(l)}let o=0n,n=BigInt(this.lexicon.characters.length),s=!1;t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),s=!0);for(let a of t){let c=this.lookup[a];if(c===void 0)throw new Error(`Invalid character: ${a}`);o=o*n+BigInt(c)}let i=[];for(;o>0n;)i.unshift(Number(o%256n)),o=o/256n;return new Uint8Array(i)}fromBytes(t){let r=Math.log2(this.lexicon.characters.length);if(Number.isInteger(r)){let i=0,a=0,c="";for(let l of t)for(i=i<<8|l,a+=8;a>=r;){a-=r;let p=i>>a&(1<<r)-1;c+=this.lexicon.characters[p]}if(a>0){let l=i<<r-a&(1<<r)-1;c+=this.lexicon.characters[l]}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 n=BigInt(this.lexicon.characters.length),s="";for(;o>0n;)s=this.lexicon.characters[Number(o%n)]+s,o=o/n;return s}toInteger(t){if(!t)return 0;let r=0n,o=!1,n=BigInt(this.lexicon.characters.length);t.startsWith(this.negativePrefix)&&(t=t.slice(this.negativePrefix.length),o=!0);for(let s of t){let i=this.lookup[s];if(i===void 0)throw new Error(`Invalid character: ${s}`);r=r*n+BigInt(i)}return Number(o?-r:r)}fromInteger(t){t=Math.floor(t);let r=t<0,o=BigInt(r?-t:t);if(o===0n)return this.lexicon.characters[0];let n=BigInt(this.lexicon.characters.length),s="";for(;o>0n;)s=this.lexicon.characters[Number(o%n)]+s,o=o/n;return r?`${this.negativePrefix}${s}`:s}random(t=32){return this.fromBytes(D.random(t))}};var me=Object.freeze({fromBytes(e){return typeof btoa=="function"?btoa(String.fromCharCode(...e)):Buffer.from(e).toString("base64")},toBytes(e){return typeof atob=="function"?Uint8Array.from(atob(e),t=>t.charCodeAt(0)):Uint8Array.from(Buffer.from(e,"base64"))},random(e=32){return this.fromBytes(D.random(e))},string(e){return me.fromBytes(e)},bytes(e){return me.toBytes(e)}});var G={fromBytes(e){return me.fromBytes(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/g,"")},toBytes(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");return t.length%4!==0&&(t=t.padEnd(t.length+(4-t.length%4)%4,"=")),me.toBytes(t)},random(e=32){return this.fromBytes(D.random(e))},string(e){return G.fromBytes(e)},bytes(e){return G.toBytes(e)}};var st=Object.freeze({fromBytes(e){return new TextDecoder().decode(e)},toBytes(e){return new TextEncoder().encode(e)},string(e){return st.fromBytes(e)},bytes(e){return st.toBytes(e)}});function ht(e,t){let r,o,n=[];function s(){r=[],o&&clearTimeout(o),o=void 0,n=[]}return s(),(...i)=>{r=i,o&&clearTimeout(o);let a=new Promise((c,l)=>{n.push({resolve:c,reject:l})});return o=setTimeout(()=>{Promise.resolve().then(()=>t(...r)).then(c=>{for(let{resolve:l}of n)l(c);s()}).catch(c=>{for(let{reject:l}of n)l(c);s()})},e),a}}function It(e,t=new Set){if(t.has(e))throw new Error("cannot clone circular reference");let r;return typeof e=="function"||e!==null&&typeof e=="object"?(t.add(e),Array.isArray(e)?r=e.map(o=>It(o,new Set(t))):e.constructor===Object?r=Object.fromEntries(Object.entries(e).map(([o,n])=>[o,It(n,new Set(t))])):e instanceof Map?r=new Map(Array.from(e,([o,n])=>[o,It(n,new Set(t))])):e instanceof Set?r=new Set(Array.from(e,o=>It(o,new Set(t)))):e instanceof Date?r=new Date(e.getTime()):r=e,t.delete(e)):r=e,r}var K=Object.freeze({set:e=>e!=null,unset:e=>e==null,boolean:e=>typeof e=="boolean",number:e=>typeof e=="number",string:e=>typeof e=="string",bigint:e=>typeof e=="bigint",object:e=>typeof e=="object"&&e!==null,array:e=>Array.isArray(e),fn:e=>typeof e=="function",symbol:e=>typeof e=="symbol"});var Dn=(e,t)=>{function r(o,n,s){if(!K.object(o)||!K.object(n))return o===n;if(s.includes(o))throw new Error("forbidden circularity detected in deep equal comparison");let i=[...s,o];if(o instanceof Map&&n instanceof Map){if(o.size!==n.size)return!1;for(let[a,c]of o)if(!n.has(a)||!r(c,n.get(a),i))return!1}else if(o instanceof Set&&n instanceof Set){if(o.size!==n.size)return!1;for(let a of o)if(!Array.from(n).some(c=>r(a,c,i)))return!1}else{let a=Object.keys(o),c=Object.keys(n);if(a.length!==c.length)return!1;for(let l of a)if(!c.includes(l)||!r(o[l],n[l],i))return!1}return!0}return r(e,t,[])};function In(e){function t(r,o){if(!K.object(r)||o.includes(r))return r;let n=[...o,r];if(r instanceof Map)for(let s of r.entries())for(let i of s)t(i,n);else if(r instanceof Set)for(let s of r)t(s,n);else if(Array.isArray(r))for(let s of r)t(s,n);else for(let s of Object.values(r))t(s,n);return Object.freeze(r)}return t(e,[])}var rr={clone:It,equal:Dn,freeze:In};var he=class extends Error{milliseconds;name=this.constructor.name;constructor(t){super(`deadline exceeded (${(t/1e3).toFixed(1)} seconds)`),this.milliseconds=t}};function or(e,t){return e<=0||e===1/0?t():new Promise((r,o)=>{let n=setTimeout(()=>o(new he(e)),e);t().then(r).catch(o).finally(()=>clearTimeout(n))})}function Q(){let e,t,r=new Promise((n,s)=>{e=n,t=s});function o(n){return n.then(e).catch(t),r}return{promise:r,resolve:e,reject:t,entangle:o}}function Un(e,t){let r=e;for(let o of t)if(r=r[o],K.unset(r))break;return r}function wa(e){return{map:t=>Ln(e,t),filter:t=>Nn(e,t)}}wa.pipe=Object.freeze({map:e=>t=>Ln(t,e),filter:e=>t=>Nn(t,e)});var Ln=(e,t)=>Object.fromEntries(Object.entries(e).map(([r,o])=>[r,t(o,r)])),Nn=(e,t)=>Object.fromEntries(Object.entries(e).filter(([r,o])=>t(o,r)));var nr=class e{static with(t){return new this(t)}#t;constructor(t){this.#t=t}to(t){return new e(t(this.#t))}done(){return this.#t}};function Hn(){let e=new Set;function t(s){return e.add(s),()=>{e.delete(s)}}async function r(...s){await Promise.all([...e].map(i=>i(...s)))}async function o(){let{promise:s,resolve:i}=Q(),a=t((...c)=>{i(c),a()});return s}function n(){e.clear()}return t.pub=r,t.sub=t,t.on=t,t.next=o,t.clear=n,r.pub=r,r.sub=t,r.on=t,r.next=o,r.clear=n,[r,t]}function gt(e){let t=Hn()[1];return e&&t.sub(e),t}function sr(e){let t=Hn()[0];return e&&t.sub(e),t}var j={seconds:e=>e*1e3,minutes:e=>e*j.seconds(60),hours:e=>e*j.minutes(60),days:e=>e*j.hours(24),future:{seconds:e=>Date.now()+j.seconds(e),minutes:e=>Date.now()+j.minutes(e),hours:e=>Date.now()+j.hours(e),days:e=>Date.now()+j.days(e)},past:{seconds:e=>Date.now()-j.seconds(e),minutes:e=>Date.now()-j.minutes(e),hours:e=>Date.now()-j.hours(e),days:e=>Date.now()-j.days(e)}};var tt=class{#t=[];add(...t){return this.#t.push(...t),this}disposable(t){return this.bag(t,()=>t.dispose())}bag(t,r){return this.add(()=>r(t)),t}dispose(){for(let t of this.#t.reverse())t();this.#t=[]}};var Oo=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 r=t();return{seen:this.#t.pop(),result:r}}async change(t){if(this.#o.has(t))throw new Error("circularity forbidden");let r=this.#n(t).pub();return this.#r.at(-1)?.add(r),r}changed(t,r){return this.#n(t)(async()=>{let o=new Set;this.#r.push(o),this.#o.add(t),o.add(r()),this.#o.delete(t),await Promise.all(o),this.#r.pop()})}#n(t){let r=this.#e.get(t);return r||(r=gt(),this.#e.set(t,r)),r}},va=Symbol.for("e280.tracker.v2"),q=globalThis[va]??=new Oo;function jo(e,t=e){let{seen:r,result:o}=q.seen(e),n=ht(0,t),s=[],i=()=>s.forEach(a=>a());for(let a of r){let c=q.changed(a,n);s.push(c)}return{result:o,dispose:i}}var _a={compare:(e,t)=>e===t};function Ut(e={}){return{..._a,...e}}var ir=class{sneak;constructor(t){this.sneak=t}get(){return q.see(this),this.sneak}get value(){return this.get()}},ar=class extends ir{on=gt();dispose(){this.on.clear()}},ge=class extends ar{_options;kind="signal";_lock=!1;constructor(t,r){super(t),this._options=r}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 r=Promise.resolve();try{this._lock=!0,this.sneak=t,r=Promise.all([q.change(this),this.on.pub(t)])}finally{this._lock=!1}return r}},ye=class extends ir{_formula;_options;kind="lazy";_dirty=!1;_effect;constructor(t,r){super(void 0),this._formula=t,this._options=r}get(){if(!this._effect){let{result:t,dispose:r}=jo(this._formula,()=>this._dirty=!0);this._effect=r,this.sneak=t}if(this._dirty){this._dirty=!1;let t=this._formula();!this._options.compare(this.sneak,t)&&(this.sneak=t,q.change(this))}return super.get()}get value(){return this.get()}dispose(){this._effect&&this._effect()}},xe=class extends ar{_effect;static make(t,r,o){let{result:n,dispose:s}=jo(r,async()=>{let i=r();!o.compare(t.sneak,i)&&(t.sneak=i,await Promise.all([q.change(t),t.on.pub(i)]))});return new this(n,s)}kind="derived";constructor(t,r){super(t),this._effect=r}get value(){return this.get()}dispose(){super.dispose(),this._effect()}};function qn(e,t={}){function r(){return r.value}let o=Ut(t),n=new ye(e,o);return Object.setPrototypeOf(r,ye.prototype),Object.assign(r,n),r}function Vn(e,t={}){function r(){return r.value}let o=Ut(t),n=xe.make(r,e,o);return Object.setPrototypeOf(r,xe.prototype),Object.assign(r,n),r}function cr(e,t={}){function r(s){return s!==void 0?r.set(s):r.get()}let o=Ut(t),n=new ge(e,o);return Object.setPrototypeOf(r,ge.prototype),Object.assign(r,n),r}cr.lazy=qn;cr.derive=Vn;var lr=class{flat;signals;#t=Promise.resolve();constructor(t,r){this.flat=t,this.signals=r}get wait(){return Promise.all([this.flat.wait,this.signals.wait]).then(()=>this.#t)}reaction(t,r){let o=r?()=>r(s()):()=>s(),n=this.lean(o),s=()=>n.collect(t);return s(),n.stop}lean(t){let r=this.flat.lean(t),o=this.signals.lean(t),n=new Map;return{stop(){r.stop(),o.stop();for(let s of n.values())s();n.clear()},collect(s){return r.collect(()=>o.collect(()=>{let{seen:i,result:a}=q.seen(s);for(let c of i)n.has(c)||n.set(c,q.changed(c,async()=>t()));return a}))}}}};var Fn=Error,B;(function(e){e.loading=()=>({status:"loading"}),e.error=a=>({status:"error",reason:a}),e.ready=a=>({status:"ready",payload:a}),e.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}e.payload=t;function r(a){return a.status==="error"?a.reason:void 0}e.reason=r;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 Fn("invalid op status")}}e.select=o;async function n(a,c){a(e.loading());try{let l=await c();return a(e.ready(l)),l}catch(l){let p=l instanceof Fn?l.message:typeof l=="string"?l:"error";throw a(e.error(p)),l}}e.load=n;function s(a,c){return o(a,{loading:()=>e.loading(),error:l=>e.error(l),ready:l=>e.ready(c(l))})}e.morph=s;function i(...a){let c=a.find(e.is.error);return c||(a.every(e.is.ready)?e.ready(a.map(t)):e.loading())}e.all=i})(B||(B={}));function M(e){return{map:t=>Wn(e,t),filter:t=>Gn(e,t)}}M.pipe=Object.freeze({map:e=>t=>Wn(t,e),filter:e=>t=>Gn(t,e)});var Wn=(e,t)=>Object.fromEntries(Object.entries(e).map(([r,o])=>[r,t(o,r)])),Gn=(e,t)=>Object.fromEntries(Object.entries(e).filter(([r,o])=>t(o,r)));var Lt=Symbol();var yt=class extends Error{name=this.constructor.name};var z=class e{static unwrap=t=>t instanceof e?t.value:t;#t;#e=!1;#r;#o=new Set;[Lt]=!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 r=o=>{t(o),this.#o.delete(r)};return this.#o.add(r),()=>void this.#o.delete(r)}clear(){return this.#o.clear()}#n=$(0,()=>{let t=this.#t;this.#e=!0;for(let r of this.#o)r(t);return this.#e=!1,t});async publish(){this.#r=this.#n(),await this.#r}get wait(){return this.#r}get value(){return this[Lt]=!0,this.#t}set value(t){if(this.#e)throw new yt("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 yt("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");X.equal(t,this.#t)||(this.#t=t,this.publish())}setAndPublish(t){if(this.#e)throw new yt("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 yt("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 pr=class extends z{#t=0;constructor(t){super(t)}async load(t){let r=++this.#t;return B.load(o=>{this.#t===r&&(this.value=o)},t)}setLoading(){this.value=B.loading()}setError(t){this.value=B.error(t)}setReady(t){this.value=B.ready(t)}isLoading(){return B.is.loading(this.value)}isError(){return B.is.error(this.value)}isReady(){return B.is.ready(this.value)}get payload(){return B.payload(this.value)}select(t){return B.select(this.value,t)}};var be=class{#t=!0;#e;#r;#o=new Set;#n=new Set;constructor({all_signals:t,waiters:r}){this.#e=t,this.#r=r}#i=$(0,t=>{if(this.#t)if("lean"in t)t.actor();else{let{payload:r,recording:o}=this.observe(t.collector);this.add_listeners(t,o),t.responder&&t.responder(r)}});#s(){for(let t of this.#e)t[Lt]=!1}get#a(){return[...this.#e].filter(t=>t[Lt]&&!this.#o.has(t))}observe(t){return this.#s(),{payload:t(),recording:this.#a}}add_listeners(t,r){for(let o of r)this.#o.add(o),this.#n.add(o.on(()=>this.#r.add(this.#i(t))))}shutdown(){this.#t=!1,this.#n.forEach(t=>t())}};var ur=class{#t=new Set;#e=new Set;signal(t){let r=new z(t);return this.#t.add(r),r}computed(t){let r=this.signal(t());return this.reaction(()=>{r.value=t()}),r}async computedAsync(t,r){let o=await r(t()),n=this.signal(o);return this.reaction(t,async s=>{n.value=await r(s)}),n}op(t=B.loading()){let r=new pr(t);return this.#t.add(r),r}load(t){let r=this.op(B.loading());return r.load(t),r}many(t){return M(t).map(r=>this.signal(r))}reaction(t,r){let o=new be({waiters:this.#e,all_signals:this.#t}),n={collector:t,responder:r},{recording:s}=o.observe(n.collector);return o.add_listeners(n,s),()=>o.shutdown()}lean(t){let r=new be({waiters:this.#e,all_signals:this.#t}),o={lean:!0,actor:t};return{stop:()=>r.shutdown(),collect:n=>{let{payload:s,recording:i}=r.observe(n);return r.add_listeners(o,i),s}}}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 Nt=new Ye,U=new ur,dr=new tr(U),Fd=Nt.state.bind(Nt),C=U.signal.bind(U),Wd=U.computed.bind(U),Kn=U.op.bind(U),Ht=new lr(Nt,U);var qt=class e{static with(t){return new this(t)}#t;constructor(t){this.#t=t}to(t){return new e(t(this.#t))}done(){return this.#t}};var L;(function(e){function t(...a){return function(c){return class extends c{static get styles(){return Jn(c.styles,a)}}}}e.css=t;function r(a){return function(c){return class extends c{static get styles(){return Jn(c.styles,a())}}}}e.css_deferred=r;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)}}}}e.signals=o;function n(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)}}}}e.flat=n;function s(a=Ht){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)}}}}e.reactive=s,e.reactor=s;function i(...a){return function(c){return qt.with(c).to(t(...a)).to(s()).done()}}e.setup=i})(L||(L={}));function Zn(e){return[e].flat().filter(t=>!!t)}var ka=e=>e!==void 0;function Jn(e,t){return[...Zn(e)??[],...Zn(t)].flat().filter(ka)}var Vt;(function(e){e.css=t=>r=>M(r).map(o=>L.css(t)(o)),e.flat=t=>r=>M(r).map(o=>L.flat(t)(o)),e.signals=t=>r=>M(r).map(o=>L.signals(t)(o)),e.reactive=(t=Ht)=>r=>M(r).map(o=>L.reactive(t)(o)),e.reactor=e.reactive,e.context=t=>r=>qt.with(r).to(e.css(t.theme)).to(e.reactive()).done(),e.setup=(...t)=>r=>M(r).map(o=>L.setup(...t)(o))})(Vt||(Vt={}));function Xn(e){return e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase()}function zo(e,t={}){let{soft:r=!1,upgrade:o=!0}=t;for(let[n,s]of Object.entries(e)){let i=Xn(n),a=customElements.get(i);r&&a||(customElements.define(i,s),o&&document.querySelectorAll(i).forEach(c=>{c.constructor===HTMLElement&&customElements.upgrade(c)}))}}var Qn=zo;var fr=globalThis,mr=fr.ShadowRoot&&(fr.ShadyCSS===void 0||fr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ro=Symbol(),ts=new WeakMap,Ft=class{constructor(t,r,o){if(this._$cssResult$=!0,o!==Ro)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o,r=this.t;if(mr&&t===void 0){let o=r!==void 0&&r.length===1;o&&(t=ts.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),o&&ts.set(r,t))}return t}toString(){return this.cssText}},Do=e=>new Ft(typeof e=="string"?e:e+"",void 0,Ro),x=(e,...t)=>{let r=e.length===1?e[0]:t.reduce((o,n,s)=>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.")})(n)+e[s+1],e[0]);return new Ft(r,e,Ro)},hr=(e,t)=>{if(mr)e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet);else for(let r of t){let o=document.createElement("style"),n=fr.litNonce;n!==void 0&&o.setAttribute("nonce",n),o.textContent=r.cssText,e.appendChild(o)}},Wt=mr?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(let o of t.cssRules)r+=o.cssText;return Do(r)})(e):e;var{is:Sa,defineProperty:Aa,getOwnPropertyDescriptor:Ca,getOwnPropertyNames:Ea,getOwnPropertySymbols:Ba,getPrototypeOf:Ta}=Object,gr=globalThis,es=gr.trustedTypes,Pa=es?es.emptyScript:"",Ma=gr.reactiveElementPolyfillSupport,we=(e,t)=>e,Io={toAttribute(e,t){switch(t){case Boolean:e=e?Pa:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},os=(e,t)=>!Sa(e,t),rs={attribute:!0,type:String,converter:Io,reflect:!1,useDefault:!1,hasChanged:os};Symbol.metadata??=Symbol("metadata"),gr.litPropertyMetadata??=new WeakMap;var et=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,r=rs){if(r.state&&(r.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((r=Object.create(r)).wrapped=!0),this.elementProperties.set(t,r),!r.noAccessor){let o=Symbol(),n=this.getPropertyDescriptor(t,o,r);n!==void 0&&Aa(this.prototype,t,n)}}static getPropertyDescriptor(t,r,o){let{get:n,set:s}=Ca(this.prototype,t)??{get(){return this[r]},set(i){this[r]=i}};return{get:n,set(i){let a=n?.call(this);s?.call(this,i),this.requestUpdate(t,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??rs}static _$Ei(){if(this.hasOwnProperty(we("elementProperties")))return;let t=Ta(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(we("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(we("properties"))){let r=this.properties,o=[...Ea(r),...Ba(r)];for(let n of o)this.createProperty(n,r[n])}let t=this[Symbol.metadata];if(t!==null){let r=litPropertyMetadata.get(t);if(r!==void 0)for(let[o,n]of r)this.elementProperties.set(o,n)}this._$Eh=new Map;for(let[r,o]of this.elementProperties){let n=this._$Eu(r,o);n!==void 0&&this._$Eh.set(n,r)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let r=[];if(Array.isArray(t)){let o=new Set(t.flat(1/0).reverse());for(let n of o)r.unshift(Wt(n))}else t!==void 0&&r.push(Wt(t));return r}static _$Eu(t,r){let o=r.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,r=this.constructor.elementProperties;for(let o of r.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 hr(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,r,o){this._$AK(t,o)}_$ET(t,r){let o=this.constructor.elementProperties.get(t),n=this.constructor._$Eu(t,o);if(n!==void 0&&o.reflect===!0){let s=(o.converter?.toAttribute!==void 0?o.converter:Io).toAttribute(r,o.type);this._$Em=t,s==null?this.removeAttribute(n):this.setAttribute(n,s),this._$Em=null}}_$AK(t,r){let o=this.constructor,n=o._$Eh.get(t);if(n!==void 0&&this._$Em!==n){let s=o.getPropertyOptions(n),i=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Io;this._$Em=n,this[n]=i.fromAttribute(r,s.type)??this._$Ej?.get(n)??null,this._$Em=null}}requestUpdate(t,r,o){if(t!==void 0){let n=this.constructor,s=this[t];if(o??=n.getPropertyOptions(t),!((o.hasChanged??os)(s,r)||o.useDefault&&o.reflect&&s===this._$Ej?.get(t)&&!this.hasAttribute(n._$Eu(t,o))))return;this.C(t,r,o)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,r,{useDefault:o,reflect:n,wrapped:s},i){o&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??r??this[t]),s!==!0||i!==void 0)||(this._$AL.has(t)||(this.hasUpdated||o||(r=void 0),this._$AL.set(t,r)),n===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(r){Promise.reject(r)}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[n,s]of this._$Ep)this[n]=s;this._$Ep=void 0}let o=this.constructor.elementProperties;if(o.size>0)for(let[n,s]of o){let{wrapped:i}=s,a=this[n];i!==!0||this._$AL.has(n)||a===void 0||this.C(n,void 0,s,a)}}let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),this._$EO?.forEach(o=>o.hostUpdate?.()),this.update(r)):this._$EM()}catch(o){throw t=!1,this._$EM(),o}t&&this._$AE(r)}willUpdate(t){}_$AE(t){this._$EO?.forEach(r=>r.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(r=>this._$ET(r,this[r])),this._$EM()}updated(t){}firstUpdated(t){}};et.elementStyles=[],et.shadowRootOptions={mode:"open"},et[we("elementProperties")]=new Map,et[we("finalized")]=new Map,Ma?.({ReactiveElement:et}),(gr.reactiveElementVersions??=[]).push("2.1.0");var Lo=globalThis,yr=Lo.trustedTypes,ns=yr?yr.createPolicy("lit-html",{createHTML:e=>e}):void 0,No="$lit$",rt=`lit$${Math.random().toFixed(9).slice(2)}$`,Ho="?"+rt,Oa=`<${Ho}>`,wt=document,_e=()=>wt.createComment(""),$e=e=>e===null||typeof e!="object"&&typeof e!="function",qo=Array.isArray,ps=e=>qo(e)||typeof e?.[Symbol.iterator]=="function",Uo=`[
\f\r]`,ve=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ss=/-->/g,is=/>/g,xt=RegExp(`>|${Uo}(?:([^\\s"'>=/]+)(${Uo}*=${Uo}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),as=/'/g,cs=/"/g,us=/^(?:script|style|textarea|title)$/i,Vo=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),ds=Vo(1),Fo=Vo(2),ff=Vo(3),V=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),ls=new WeakMap,bt=wt.createTreeWalker(wt,129);function fs(e,t){if(!qo(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return ns!==void 0?ns.createHTML(t):t}var ms=(e,t)=>{let r=e.length-1,o=[],n,s=t===2?"<svg>":t===3?"<math>":"",i=ve;for(let a=0;a<r;a++){let c=e[a],l,p,u=-1,f=0;for(;f<c.length&&(i.lastIndex=f,p=i.exec(c),p!==null);)f=i.lastIndex,i===ve?p[1]==="!--"?i=ss:p[1]!==void 0?i=is:p[2]!==void 0?(us.test(p[2])&&(n=RegExp("</"+p[2],"g")),i=xt):p[3]!==void 0&&(i=xt):i===xt?p[0]===">"?(i=n??ve,u=-1):p[1]===void 0?u=-2:(u=i.lastIndex-p[2].length,l=p[1],i=p[3]===void 0?xt:p[3]==='"'?cs:as):i===cs||i===as?i=xt:i===ss||i===is?i=ve:(i=xt,n=void 0);let g=i===xt&&e[a+1].startsWith("/>")?" ":"";s+=i===ve?c+Oa:u>=0?(o.push(l),c.slice(0,u)+No+c.slice(u)+rt+g):c+rt+(u===-2?a:g)}return[fs(e,s+(e[r]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),o]},ke=class e{constructor({strings:t,_$litType$:r},o){let n;this.parts=[];let s=0,i=0,a=t.length-1,c=this.parts,[l,p]=ms(t,r);if(this.el=e.createElement(l,o),bt.currentNode=this.el.content,r===2||r===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(n=bt.nextNode())!==null&&c.length<a;){if(n.nodeType===1){if(n.hasAttributes())for(let u of n.getAttributeNames())if(u.endsWith(No)){let f=p[i++],g=n.getAttribute(u).split(rt),h=/([.?@])?(.*)/.exec(f);c.push({type:1,index:s,name:h[2],strings:g,ctor:h[1]==="."?br:h[1]==="?"?wr:h[1]==="@"?vr:_t}),n.removeAttribute(u)}else u.startsWith(rt)&&(c.push({type:6,index:s}),n.removeAttribute(u));if(us.test(n.tagName)){let u=n.textContent.split(rt),f=u.length-1;if(f>0){n.textContent=yr?yr.emptyScript:"";for(let g=0;g<f;g++)n.append(u[g],_e()),bt.nextNode(),c.push({type:2,index:++s});n.append(u[f],_e())}}}else if(n.nodeType===8)if(n.data===Ho)c.push({type:2,index:s});else{let u=-1;for(;(u=n.data.indexOf(rt,u+1))!==-1;)c.push({type:7,index:s}),u+=rt.length-1}s++}}static createElement(t,r){let o=wt.createElement("template");return o.innerHTML=t,o}};function vt(e,t,r=e,o){if(t===V)return t;let n=o!==void 0?r._$Co?.[o]:r._$Cl,s=$e(t)?void 0:t._$litDirective$;return n?.constructor!==s&&(n?._$AO?.(!1),s===void 0?n=void 0:(n=new s(e),n._$AT(e,r,o)),o!==void 0?(r._$Co??=[])[o]=n:r._$Cl=n),n!==void 0&&(t=vt(e,n._$AS(e,t.values),n,o)),t}var xr=class{constructor(t,r){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:r},parts:o}=this._$AD,n=(t?.creationScope??wt).importNode(r,!0);bt.currentNode=n;let s=bt.nextNode(),i=0,a=0,c=o[0];for(;c!==void 0;){if(i===c.index){let l;c.type===2?l=new Gt(s,s.nextSibling,this,t):c.type===1?l=new c.ctor(s,c.name,c.strings,this,t):c.type===6&&(l=new _r(s,this,t)),this._$AV.push(l),c=o[++a]}i!==c?.index&&(s=bt.nextNode(),i++)}return bt.currentNode=wt,n}p(t){let r=0;for(let o of this._$AV)o!==void 0&&(o.strings!==void 0?(o._$AI(t,o,r),r+=o.strings.length-2):o._$AI(t[r])),r++}},Gt=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,r,o,n){this.type=2,this._$AH=k,this._$AN=void 0,this._$AA=t,this._$AB=r,this._$AM=o,this.options=n,this._$Cv=n?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,r=this._$AM;return r!==void 0&&t?.nodeType===11&&(t=r.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,r=this){t=vt(this,t,r),$e(t)?t===k||t==null||t===""?(this._$AH!==k&&this._$AR(),this._$AH=k):t!==this._$AH&&t!==V&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ps(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!==k&&$e(this._$AH)?this._$AA.nextSibling.data=t:this.T(wt.createTextNode(t)),this._$AH=t}$(t){let{values:r,_$litType$:o}=t,n=typeof o=="number"?this._$AC(t):(o.el===void 0&&(o.el=ke.createElement(fs(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===n)this._$AH.p(r);else{let s=new xr(n,this),i=s.u(this.options);s.p(r),this.T(i),this._$AH=s}}_$AC(t){let r=ls.get(t.strings);return r===void 0&&ls.set(t.strings,r=new ke(t)),r}k(t){qo(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,o,n=0;for(let s of t)n===r.length?r.push(o=new e(this.O(_e()),this.O(_e()),this,this.options)):o=r[n],o._$AI(s),n++;n<r.length&&(this._$AR(o&&o._$AB.nextSibling,n),r.length=n)}_$AR(t=this._$AA.nextSibling,r){for(this._$AP?.(!1,!0,r);t&&t!==this._$AB;){let o=t.nextSibling;t.remove(),t=o}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},_t=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,r,o,n,s){this.type=1,this._$AH=k,this._$AN=void 0,this.element=t,this.name=r,this._$AM=n,this.options=s,o.length>2||o[0]!==""||o[1]!==""?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=k}_$AI(t,r=this,o,n){let s=this.strings,i=!1;if(s===void 0)t=vt(this,t,r,0),i=!$e(t)||t!==this._$AH&&t!==V,i&&(this._$AH=t);else{let a=t,c,l;for(t=s[0],c=0;c<s.length-1;c++)l=vt(this,a[o+c],r,c),l===V&&(l=this._$AH[c]),i||=!$e(l)||l!==this._$AH[c],l===k?t=k:t!==k&&(t+=(l??"")+s[c+1]),this._$AH[c]=l}i&&!n&&this.j(t)}j(t){t===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},br=class extends _t{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===k?void 0:t}},wr=class extends _t{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==k)}},vr=class extends _t{constructor(t,r,o,n,s){super(t,r,o,n,s),this.type=5}_$AI(t,r=this){if((t=vt(this,t,r,0)??k)===V)return;let o=this._$AH,n=t===k&&o!==k||t.capture!==o.capture||t.once!==o.once||t.passive!==o.passive,s=t!==k&&(o===k||n);n&&this.element.removeEventListener(this.name,this,o),s&&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)}},_r=class{constructor(t,r,o){this.element=t,this.type=6,this._$AN=void 0,this._$AM=r,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(t){vt(this,t)}},hs={M:No,P:rt,A:Ho,C:1,L:ms,R:xr,D:ps,V:vt,I:Gt,H:_t,N:wr,U:vr,B:br,F:_r},ja=Lo.litHtmlPolyfillSupport;ja?.(ke,Gt),(Lo.litHtmlVersions??=[]).push("3.3.0");var R=(e,t,r)=>{let o=r?.renderBefore??t,n=o._$litPart$;if(n===void 0){let s=r?.renderBefore??null;o._$litPart$=n=new Gt(t.insertBefore(_e(),s),s,void 0,r??{})}return n._$AI(e),n};var Wo=globalThis,Kt=class extends et{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 r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=R(r,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return V}};Kt._$litElement$=!0,Kt.finalized=!0,Wo.litElementHydrateSupport?.({LitElement:Kt});var za=Wo.litElementPolyfillSupport;za?.({LitElement:Kt});(Wo.litElementVersions??=[]).push("4.2.0");function gs(e){return class extends e{#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 Yt=class extends gs(HTMLElement){};function Se(){let e,t,r=new Promise((n,s)=>{e=n,t=s});function o(n){return n.then(e).catch(t),r}return{promise:r,resolve:e,reject:t,entangle:o}}function ys(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let o of r)t.unshift(Wt(o))}else e!==void 0&&t.push(Wt(e));return t}function $r(e,t){hr(e,ys(t))}var Zt=class extends Yt{static get styles(){}#t;#e=Se();#r=this.#e.promise;init(){}constructor(){super(),this.#t=this.attachShadow({mode:"open"});let t=this.constructor;$r(this.#t,t.styles),this.init()}get root(){return this.#t}get updateComplete(){return this.#r.then(()=>!0)}render(){}#o=$(0,()=>{let t=this.#t,r=this.render();r&&R(r,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 kr=class extends Yt{#t=Se();#e=this.#t.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#e.then(()=>!0)}render(){}#r=$(0,()=>{let t=this.render();R(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 S=Symbol();var Sr=class{#t=0;pull(){return this.#t++}reset(){this.#t=0}};var it=class{[S]={wrap:t=>(...r)=>(this.#r.reset(),t(...r)),disconnect:()=>{for(let t of this.#n)t();this.#n.clear();for(let t of this.#a)t();this.#a.clear(),this.#s.clear();for(let{untrack:t}of this.#d.values())t();this.#d.clear()},reconnect:()=>{for(let t of this.#o.values())this.#n.add(t());for(let[t,r]of this.#i.entries()){let[o,n]=r();this.#s.set(t,o),this.#a.add(n)}},afterRender:()=>{for(let t of this.#c.values())t()}};#t;#e;#r=new Sr;constructor(t,r){this.#e=t,this.#t=r}get context(){return this.#t}rerender(){this.#e()}#o=new Map;#n=new Set;mount(t){let r=this.#r.pull();this.#o.has(r)||(this.#o.set(r,t),this.#n.add(t()))}#i=new Map;#s=new Map;#a=new Set;init(t){let r=this.#r.pull();if(!this.#i.has(r)){this.#i.set(r,t);let[o,n]=t();return this.#s.set(r,o),this.#a.add(n),o}return this.#s.get(r)}#m=new Map;once(t){let r=this.#r.pull();return O(this.#m).guarantee(r,t)}#c=new Map;defer(t){let r=this.signal(void 0),o=this.#r.pull();return this.#c.has(o)||this.#c.set(o,()=>{r.value=t()}),r}#l=new Set;deferOnce(t){this.mount(()=>(this.#l.clear(),()=>{}));let r=this.signal(void 0),o=this.#r.pull();return this.#c.has(o)||this.#c.set(o,()=>{this.#l.has(o)||(this.#l.add(o),r.value=t())}),r}#p=new Map;state(t){let r=this.#r.pull();return[O(this.#p).guarantee(r,()=>typeof t=="function"?t():t),i=>{this.#p.set(r,i),this.#e()},()=>this.#p.get(r)]}#h=new Map;flatstate(t){let r=this.#r.pull();return O(this.#h).guarantee(r,()=>Nt.state(typeof t=="function"?t():t))}#u=new Map;signal(t){let r=this.#r.pull();return O(this.#u).guarantee(r,()=>U.signal(typeof t=="function"?t():t))}computed(t){let r=this.#r.pull();return O(this.#u).guarantee(r,()=>U.computed(t))}op(){let t=this.#r.pull();return O(this.#u).guarantee(t,()=>U.op())}load(t){let r=this.op();return this.once(()=>r.load(t)),r}#d=new Map;watch(t){let r=this.#r.pull(),{data:o}=O(this.#d).guarantee(r,()=>{let n={data:t(),untrack:()=>{}};return n.untrack=dr.track(t,s=>{n.data=s,this.#e()}),n});return o}#f=new Map;effect(t,r){r=r.map(z.unwrap);let o=this.#r.pull(),n=this.#f.get(o);if(n){let[s,i]=n;X.equal(r,i)||(s(),this.#f.set(o,[t(),r]))}else{this.#o.set(o,t);let s=t();this.#n.add(s),this.#f.set(o,[s,r])}}};var Jt=class extends it{#t;get element(){return this.#t}#e;get shadow(){return this.#e}styles(...t){this.once(()=>$r(this.shadow,[this.context.theme,...t]))}css(...t){return this.styles(...t)}constructor(t,r,o,n){super(o,n),this.#t=t,this.#e=r}};function Ar(e){let t;return function(r){return t||(t=Je(e,r)),t}}var Cr=class extends Jt{attrs;constructor(t,r,o,n){super(t,r,o,n),this.attrs=Ar(t)}};var Er=class extends it{#t;get element(){return this.#t}attrs;constructor(t,r,o){super(r,o),this.#t=t,this.attrs=Ar(t)}};var Br=class extends Cr{},Tr=c