@e280/authlocal
Version:
User-sovereign login system for everybody
279 lines (241 loc) • 111 kB
JavaScript
class t{#t=!1;lock(t){this.#t=!0;const e=t();return this.#t=!1,e}get locked(){return this.#t}}const e=()=>new Map,n=()=>new Set;function s(t){return{guarantee:(e,n)=>function(t,e,n){if(t.has(e))return t.get(e);{const s=n();return t.set(e,s),s}}(t,e,n)}}class r{#e=new WeakMap;grab_keymap(t){const n=s(this.#e).guarantee(t,e);return{keymap:n,grab_symbolmap:t=>s(n).guarantee(t,e)}}clear(){this.#e=new WeakMap}}class i{#n=new Map;stop(t){const e=this.#n.get(t);e&&(this.#n.delete(t),e())}add(t,e){this.#n.set(t,e)}}class o{#s=[];record(t){const n=e();this.#s.push(n);const s=t();return this.#s.pop(),{payload:s,recording:n}}record_that_key_was_accessed(t,e){const r=this.#s.at(-1);if(r){s(r).guarantee(t,n).add(e)}}}class a extends Error{name=this.constructor.name}class c extends a{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}}class l extends a{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}}function d(t){return new Proxy(t,{get:(t,e)=>t[e],set(t,e){throw new l(e)}})}function u(t,e){let n,s,r=[];function i(){n=[],s&&clearTimeout(s),s=void 0,r=[]}return i(),(...o)=>{n=o,s&&clearTimeout(s);const a=new Promise(((t,e)=>{r.push({resolve:t,reject:e})}));return s=setTimeout((()=>{Promise.resolve().then((()=>e(...n))).then((t=>{for(const{resolve:e}of r)e(t);i()})).catch((t=>{for(const{reject:e}of r)e(t);i()}))}),t),a}}class h{#r=new Map;#i=Promise.resolve();#o=u(0,(()=>{const t=[...this.#r.values()];this.#r.clear();for(const e of t)e()}));get wait(){return this.#i}add(t,e){this.#r.set(t,e),this.#i=this.#o()}}function p(t){return function(e){return()=>{const n="function"==typeof t?t():t;return e(n)}}}function f(t,e,n,s){const r=[];for(const[i,o]of e){const{grab_symbolmap:e}=n.grab_keymap(i);for(const n of o){const i=e(n);i.set(t,s),r.push((()=>i.delete(t)))}}return()=>r.forEach((t=>t()))}function m(t,e){return g.on_change(t,(()=>t.requestUpdate())),g.proxy(t,e)}var g;!function(t){t.proxy=(t,e)=>new Proxy(e,{get:(n,s)=>{const r=e[s],i=t.getAttribute(s);switch(r){case String:return i??void 0;case Number:return null!==i?Number(i):void 0;case Boolean:return null!==i;default:throw new Error(`invalid attribute type for "${s}"`)}},set:(n,s,r)=>{switch(e[s]){case String:return t.setAttribute(s,r),!0;case Number:return t.setAttribute(s,r.toString()),!0;case Boolean:return r?t.setAttribute(s,""):t.removeAttribute(s),!0;default:throw new Error(`invalid attribute type for "${s}"`)}}}),t.on_change=function(t,e){const n=new MutationObserver(e);return n.observe(t,{attributes:!0}),()=>n.disconnect()}}(g||(g={}));class y{#a;constructor(t){this.#a=t}get state(){return this.#a.getter(this.#a.parent.state)}transmute(t){this.#a.parent.transmute((e=>{const n=this.#a.getter(e),s=t(n);return this.#a.setter(e,s)}))}slice({getter:t,setter:e}){return new y({parent:this,getter:t,setter:e})}}const b=t=>"object"==typeof t&&null!==t;const w={clone:function t(e,n=new Set){if(n.has(e))throw new Error("cannot clone circular reference");let s;return"function"==typeof e||null!==e&&"object"==typeof e?(n.add(e),s=Array.isArray(e)?e.map((e=>t(e,new Set(n)))):e.constructor===Object?Object.fromEntries(Object.entries(e).map((([e,s])=>[e,t(s,new Set(n))]))):e instanceof Map?new Map(Array.from(e,(([e,s])=>[e,t(s,new Set(n))]))):e instanceof Set?new Set(Array.from(e,(e=>t(e,new Set(n))))):e instanceof Date?new Date(e.getTime()):e,n.delete(e)):s=e,s},equal:(t,e)=>function t(e,n,s){if(!b(e)||!b(n))return e===n;if(s.includes(e))throw new Error("forbidden circularity detected in deep equal comparison");const r=[...s,e];if(e instanceof Map&&n instanceof Map){if(e.size!==n.size)return!1;for(const[s,i]of e)if(!n.has(s)||!t(i,n.get(s),r))return!1}else if(e instanceof Set&&n instanceof Set){if(e.size!==n.size)return!1;for(const s of e)if(!Array.from(n).some((e=>t(s,e,r))))return!1}else{const s=Object.keys(e),i=Object.keys(n);if(s.length!==i.length)return!1;for(const o of s){if(!i.includes(o))return!1;if(!t(e[o],n[o],r))return!1}}return!0}(t,e,[]),freeze:function(t){return function t(e,n){if(!b(e)||n.includes(e))return e;const s=[...n,e];if(e instanceof Map)for(const n of e.entries())for(const e of n)t(e,s);else if(e instanceof Set)for(const n of e)t(n,s);else if(Array.isArray(e))for(const n of e)t(n,s);else for(const n of Object.values(e))t(n,s);return Object.freeze(e)}(t,[])}};class v{#c;#l;#d;#u=!1;#h(){return w.freeze(structuredClone(this.#c))}constructor(t,e=()=>{}){this.#c=structuredClone(t),this.#l=this.#h(),this.#d=e}get state(){return this.#l}transmute(t){if(this.#u)throw new Error("circular error");this.#u=!0,this.#c=t(structuredClone(this.#c)),this.#l=this.#h(),this.#d(),this.#u=!1}slice({getter:t,setter:e}){return new y({parent:this,getter:t,setter:e})}}const x=Error;var $;function k(t){return{map:e=>_(t,e),filter:e=>A(t,e)}}!function(t){function e(t){return"ready"===t.status?t.payload:void 0}function n(t,e){switch(t.status){case"loading":return e.loading();case"error":return e.error(t.reason);case"ready":return e.ready(t.payload);default:throw console.error("op",t),new x("invalid op status")}}t.loading=()=>({status:"loading"}),t.error=t=>({status:"error",reason:t}),t.ready=t=>({status:"ready",payload:t}),t.is=Object.freeze({loading:t=>"loading"===t.status,error:t=>"error"===t.status,ready:t=>"ready"===t.status}),t.payload=e,t.reason=function(t){return"error"===t.status?t.reason:void 0},t.select=n,t.load=async function(e,n){e(t.loading());try{const s=await n();return e(t.ready(s)),s}catch(n){const s=n instanceof x?n.message:"string"==typeof n?n:"error";throw e(t.error(s)),n}},t.morph=function(e,s){return n(e,{loading:()=>t.loading(),error:e=>t.error(e),ready:e=>t.ready(s(e))})},t.all=function(...n){const s=n.find(t.is.error);return s||(n.every(t.is.ready)?t.ready(n.map(e)):t.loading())}}($||($={})),k.pipe=Object.freeze({map:t=>e=>_(e,t),filter:t=>e=>A(e,t)});const _=(t,e)=>Object.fromEntries(Object.entries(t).map((([t,n])=>[t,e(n,t)]))),A=(t,e)=>Object.fromEntries(Object.entries(t).filter((([t,n])=>e(n,t)))),S=Symbol();class E extends Error{name=this.constructor.name}class C{static unwrap=t=>t instanceof C?t.value:t;#p;#f=!1;#i;#m=new Set;[S]=!1;constructor(t){this.#p=t,this.#i=Promise.resolve(t)}subscribe(t){return this.on(t)}on(t){return this.#m.add(t),()=>{this.#m.delete(t)}}once(t){const e=n=>{t(n),this.#m.delete(e)};return this.#m.add(e),()=>{this.#m.delete(e)}}clear(){return this.#m.clear()}#g=u(0,(()=>{const t=this.#p;this.#f=!0;for(const e of this.#m)e(t);return this.#f=!1,t}));async publish(){this.#i=this.#g(),await this.#i}get wait(){return this.#i}get value(){return this[S]=!0,this.#p}set value(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p!==t&&(this.#p=t,this.publish())}setDeep(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");w.equal(t,this.#p)||(this.#p=t,this.publish())}setAndPublish(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t,this.publish()}setWithoutPublish(t){if(this.#f)throw new E("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t}setValueNoPublish(t){return this.setWithoutPublish(t)}}class B extends C{#y=0;constructor(t){super(t)}async load(t){const e=++this.#y;return $.load((t=>{this.#y===e&&(this.value=t)}),t)}setLoading(){this.value=$.loading()}setError(t){this.value=$.error(t)}setReady(t){this.value=$.ready(t)}isLoading(){return $.is.loading(this.value)}isError(){return $.is.error(this.value)}isReady(){return $.is.ready(this.value)}get payload(){return $.payload(this.value)}select(t){return $.select(this.value,t)}}class O{#b=!0;#w;#v;#x=new Set;#$=new Set;constructor({all_signals:t,waiters:e}){this.#w=t,this.#v=e}#o=u(0,(t=>{if(this.#b)if("lean"in t)t.actor();else{const{payload:e,recording:n}=this.observe(t.collector);this.add_listeners(t,n),t.responder&&t.responder(e)}}));#k(){for(const t of this.#w)t[S]=!1}get#_(){return[...this.#w].filter((t=>t[S]&&!this.#x.has(t)))}observe(t){this.#k();return{payload:t(),recording:this.#_}}add_listeners(t,e){for(const n of e)this.#x.add(n),this.#$.add(n.on((()=>this.#v.add(this.#o(t)))))}shutdown(){this.#b=!1,this.#$.forEach((t=>t()))}}const z=new class{static readonly=d;static collectivize=p;#A=new r;#S=new o;#E=new t;#C=new i;#B=new h;#O=function(t,e,n,s,r){function i([n,r]){if("lean"in r)r.actor();else{const{payload:i,recording:o}=e.record(r.collector);s.add(n,f(n,o,t,r)),r.responder&&r.responder(i)}}return{get:(t,n)=>(e.record_that_key_was_accessed(t,n),t[n]),set:(e,s,o)=>{if(n.locked)throw new c(s);e[s]=o;const a=[...t.grab_keymap(e).grab_symbolmap(s)];for(const t of a){const[e]=t;r.add(e,(()=>n.lock((()=>i(t)))))}return!0}}}(this.#A,this.#S,this.#E,this.#C,this.#B);get wait(){return this.#B.wait}state(t){return new Proxy(t,this.#O)}reaction(t,e){const n=Symbol(),{recording:s}=this.#S.record((()=>this.#E.lock(t)));return this.#C.add(n,f(n,s,this.#A,{collector:t,responder:e})),()=>this.#C.stop(n)}lean(t){const e=Symbol();return{stop:()=>this.#C.stop(e),collect:n=>{const{payload:s,recording:r}=this.#S.record((()=>this.#E.lock(n)));return this.#C.add(e,f(e,r,this.#A,{lean:!0,actor:t})),s}}}clear(){this.#A.clear()}},j=new class{#z=new Set;#v=new Set;signal(t){const e=new C(t);return this.#z.add(e),e}computed(t){const e=this.signal(t());return this.reaction((()=>{e.value=t()})),e}async computedAsync(t,e){const n=await e(t()),s=this.signal(n);return this.reaction(t,(async t=>{s.value=await e(t)})),s}op(t=$.loading()){const e=new B(t);return this.#z.add(e),e}load(t){const e=this.op($.loading());return e.load(t),e}many(t){return k(t).map((t=>this.signal(t)))}reaction(t,e){const n=new O({waiters:this.#v,all_signals:this.#z}),s={collector:t,responder:e},{recording:r}=n.observe(s.collector);return n.add_listeners(s,r),()=>n.shutdown()}lean(t){const e=new O({waiters:this.#v,all_signals:this.#z}),n={lean:!0,actor:t};return{stop:()=>e.shutdown(),collect:t=>{const{payload:s,recording:r}=e.observe(t);return e.add_listeners(n,r),s}}}async#j(){return await Promise.all([...this.#z].map((t=>t.wait))).then((()=>Promise.all([...this.#v]))).then((()=>{this.#v.clear()}))}get wait(){return Promise.resolve().then((()=>this.#j())).then((()=>this.#j()))}},M=new class{#z;#M=new Set;#m=new Set;#P=new Map;#T=Promise.resolve();constructor(t){this.#z=t}get wait(){return this.#T}#R=u(0,(()=>{for(const t of this.#M)t();for(const t of this.#m)t()}));dispatch(){this.#T=this.#R()}computed(t){const e=this.#z.signal(t());return this.#M.add((()=>{e.value=t()})),e}track(t,e){let n=!0;const s=()=>{const s=t(),r=this.#P.get(t);!n&&w.equal(s,r)||(n=!1,this.#P.set(t,s),e(s))};s(),this.#m.add(s);return()=>this.#m.delete(s)}stateTree(t){return new v(t,(()=>this.dispatch()))}}(j);z.state.bind(z);const P=j.signal.bind(j);j.computed.bind(j);const T=j.op.bind(j),R=new class{flat;signals;#i=Promise.resolve();constructor(t,e){this.flat=t,this.signals=e}get wait(){return Promise.all([this.flat.wait,this.signals.wait]).then((()=>this.#i))}reaction(t,e){const n=e?()=>e(r()):()=>r(),s=this.lean(n),r=()=>s.collect(t);return r(),s.stop}lean(t){const e=this.flat.lean(t),n=this.signals.lean(t);return{stop(){e.stop(),n.stop()},collect:t=>e.collect((()=>n.collect(t)))}}}(z,j);let U=class t{static with(t){return new this(t)}#U;constructor(t){this.#U=t}to(e){return new t(e(this.#U))}done(){return this.#U}};var D;function q(t){return[t].flat().filter((t=>!!t))}!function(t){function e(...t){return function(e){return class extends e{static get styles(){return N(e.styles,t)}}}}function n(t=R){return function(e){return class extends e{#D=null;render(){return this.#D?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#D=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#D&&(this.#D.stop(),this.#D=null)}}}}t.css=e,t.css_deferred=function(t){return function(e){return class extends e{static get styles(){return N(e.styles,t())}}}},t.signals=function(t){return function(e){return class extends e{#D=null;render(){return this.#D?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#D=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#D&&(this.#D.stop(),this.#D=null)}}}},t.flat=function(t){return function(e){return class extends e{#D=null;render(){return this.#D?.collect((()=>super.render()))}connectedCallback(){super.connectedCallback(),this.#D=t.lean((()=>this.requestUpdate()))}disconnectedCallback(){super.disconnectedCallback(),this.#D&&(this.#D.stop(),this.#D=null)}}}},t.reactive=n,t.reactor=n,t.setup=function(...t){return function(s){return U.with(s).to(e(...t)).to(n()).done()}}}(D||(D={}));const I=t=>void 0!==t;function N(t,e){return[...q(t)??[],...q(e)].flat().filter(I)}var H;function L(t,e={}){const{soft:n=!1,upgrade:s=!0}=e;for(const[e,r]of Object.entries(t)){const t=e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase(),i=customElements.get(t);n&&i||(customElements.define(t,r),s&&document.querySelectorAll(t).forEach((t=>{t.constructor===HTMLElement&&customElements.upgrade(t)})))}}!function(t){t.css=t=>e=>k(e).map((e=>D.css(t)(e))),t.flat=t=>e=>k(e).map((e=>D.flat(t)(e))),t.signals=t=>e=>k(e).map((e=>D.signals(t)(e))),t.reactive=(t=R)=>e=>k(e).map((e=>D.reactive(t)(e))),t.reactor=t.reactive,t.context=e=>n=>U.with(n).to(t.css(e.theme)).to(t.reactive()).done(),t.setup=(...t)=>e=>k(e).map((e=>D.setup(...t)(e)))}(H||(H={}));const V=L,W=globalThis,F=W.ShadowRoot&&(void 0===W.ShadyCSS||W.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,G=Symbol(),J=new WeakMap;
/**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/let Y=class{constructor(t,e,n){if(this._$cssResult$=!0,n!==G)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(F&&void 0===t){const n=void 0!==e&&1===e.length;n&&(t=J.get(e)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&J.set(e,t))}return t}toString(){return this.cssText}};const K=(t,...e)=>{const n=1===t.length?t[0]:e.reduce(((e,n,s)=>e+(t=>{if(!0===t._$cssResult$)return t.cssText;if("number"==typeof t)return t;throw Error("Value passed to 'css' function must be a 'css' function result: "+t+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+t[s+1]),t[0]);return new Y(n,t,G)},Z=(t,e)=>{if(F)t.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const n of e){const e=document.createElement("style"),s=W.litNonce;void 0!==s&&e.setAttribute("nonce",s),e.textContent=n.cssText,t.appendChild(e)}},X=F?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const n of t.cssRules)e+=n.cssText;return(t=>new Y("string"==typeof t?t:t+"",void 0,G))(e)})(t):t,{is:Q,defineProperty:tt,getOwnPropertyDescriptor:et,getOwnPropertyNames:nt,getOwnPropertySymbols:st,getPrototypeOf:rt}=Object,it=globalThis,ot=it.trustedTypes,at=ot?ot.emptyScript:"",ct=it.reactiveElementPolyfillSupport,lt=(t,e)=>t,dt={toAttribute(t,e){switch(e){case Boolean:t=t?at:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let n=t;switch(e){case Boolean:n=null!==t;break;case Number:n=null===t?null:Number(t);break;case Object:case Array:try{n=JSON.parse(t)}catch(t){n=null}}return n}},ut=(t,e)=>!Q(t,e),ht={attribute:!0,type:String,converter:dt,reflect:!1,useDefault:!1,hasChanged:ut};
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/Symbol.metadata??=Symbol("metadata"),it.litPropertyMetadata??=new WeakMap;let pt=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=ht){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){const n=Symbol(),s=this.getPropertyDescriptor(t,n,e);void 0!==s&&tt(this.prototype,t,s)}}static getPropertyDescriptor(t,e,n){const{get:s,set:r}=et(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get:s,set(e){const i=s?.call(this);r?.call(this,e),this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??ht}static _$Ei(){if(this.hasOwnProperty(lt("elementProperties")))return;const t=rt(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(lt("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(lt("properties"))){const t=this.properties,e=[...nt(t),...st(t)];for(const n of e)this.createProperty(n,t[n])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,n]of e)this.elementProperties.set(t,n)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const n=this._$Eu(t,e);void 0!==n&&this._$Eh.set(n,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(X(t))}else void 0!==t&&e.push(X(t));return e}static _$Eu(t,e){const n=e.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof t?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),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const n of e.keys())this.hasOwnProperty(n)&&(t.set(n,this[n]),delete this[n]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Z(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,n){this._$AK(t,n)}_$ET(t,e){const n=this.constructor.elementProperties.get(t),s=this.constructor._$Eu(t,n);if(void 0!==s&&!0===n.reflect){const r=(void 0!==n.converter?.toAttribute?n.converter:dt).toAttribute(e,n.type);this._$Em=t,null==r?this.removeAttribute(s):this.setAttribute(s,r),this._$Em=null}}_$AK(t,e){const n=this.constructor,s=n._$Eh.get(t);if(void 0!==s&&this._$Em!==s){const t=n.getPropertyOptions(s),r="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:dt;this._$Em=s,this[s]=r.fromAttribute(e,t.type)??this._$Ej?.get(s)??null,this._$Em=null}}requestUpdate(t,e,n){if(void 0!==t){const s=this.constructor,r=this[t];if(n??=s.getPropertyOptions(t),!((n.hasChanged??ut)(r,e)||n.useDefault&&n.reflect&&r===this._$Ej?.get(t)&&!this.hasAttribute(s._$Eu(t,n))))return;this.C(t,e,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(t,e,{useDefault:n,reflect:s,wrapped:r},i){n&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,i??e??this[t]),!0!==r||void 0!==i)||(this._$AL.has(t)||(this.hasUpdated||n||(e=void 0),this._$AL.set(t,e)),!0===s&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(t){Promise.reject(t)}const t=this.scheduleUpdate();return null!=t&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[t,e]of this._$Ep)this[t]=e;this._$Ep=void 0}const t=this.constructor.elementProperties;if(t.size>0)for(const[e,n]of t){const{wrapped:t}=n,s=this[e];!0!==t||this._$AL.has(e)||void 0===s||this.C(e,void 0,n,s)}}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$EM()}catch(e){throw t=!1,this._$EM(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach((t=>t.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((t=>this._$ET(t,this[t]))),this._$EM()}updated(t){}firstUpdated(t){}};pt.elementStyles=[],pt.shadowRootOptions={mode:"open"},pt[lt("elementProperties")]=new Map,pt[lt("finalized")]=new Map,ct?.({ReactiveElement:pt}),(it.reactiveElementVersions??=[]).push("2.1.0");
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
const ft=globalThis,mt=ft.trustedTypes,gt=mt?mt.createPolicy("lit-html",{createHTML:t=>t}):void 0,yt="$lit$",bt=`lit$${Math.random().toFixed(9).slice(2)}$`,wt="?"+bt,vt=`<${wt}>`,xt=document,$t=()=>xt.createComment(""),kt=t=>null===t||"object"!=typeof t&&"function"!=typeof t,_t=Array.isArray,At="[ \t\n\f\r]",St=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Et=/-->/g,Ct=/>/g,Bt=RegExp(`>|${At}(?:([^\\s"'>=/]+)(${At}*=${At}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),Ot=/'/g,zt=/"/g,jt=/^(?:script|style|textarea|title)$/i,Mt=t=>(e,...n)=>({_$litType$:t,strings:e,values:n}),Pt=Mt(1),Tt=Mt(2),Rt=Symbol.for("lit-noChange"),Ut=Symbol.for("lit-nothing"),Dt=new WeakMap,qt=xt.createTreeWalker(xt,129);function It(t,e){if(!_t(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==gt?gt.createHTML(e):e}const Nt=(t,e)=>{const n=t.length-1,s=[];let r,i=2===e?"<svg>":3===e?"<math>":"",o=St;for(let e=0;e<n;e++){const n=t[e];let a,c,l=-1,d=0;for(;d<n.length&&(o.lastIndex=d,c=o.exec(n),null!==c);)d=o.lastIndex,o===St?"!--"===c[1]?o=Et:void 0!==c[1]?o=Ct:void 0!==c[2]?(jt.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=Bt):void 0!==c[3]&&(o=Bt):o===Bt?">"===c[0]?(o=r??St,l=-1):void 0===c[1]?l=-2:(l=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?Bt:'"'===c[3]?zt:Ot):o===zt||o===Ot?o=Bt:o===Et||o===Ct?o=St:(o=Bt,r=void 0);const u=o===Bt&&t[e+1].startsWith("/>")?" ":"";i+=o===St?n+vt:l>=0?(s.push(a),n.slice(0,l)+yt+n.slice(l)+bt+u):n+bt+(-2===l?e:u)}return[It(t,i+(t[n]||"<?>")+(2===e?"</svg>":3===e?"</math>":"")),s]};let Ht=class t{constructor({strings:e,_$litType$:n},s){let r;this.parts=[];let i=0,o=0;const a=e.length-1,c=this.parts,[l,d]=Nt(e,n);if(this.el=t.createElement(l,s),qt.currentNode=this.el.content,2===n||3===n){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=qt.nextNode())&&c.length<a;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(yt)){const e=d[o++],n=r.getAttribute(t).split(bt),s=/([.?@])?(.*)/.exec(e);c.push({type:1,index:i,name:s[2],strings:n,ctor:"."===s[1]?Gt:"?"===s[1]?Jt:"@"===s[1]?Yt:Ft}),r.removeAttribute(t)}else t.startsWith(bt)&&(c.push({type:6,index:i}),r.removeAttribute(t));if(jt.test(r.tagName)){const t=r.textContent.split(bt),e=t.length-1;if(e>0){r.textContent=mt?mt.emptyScript:"";for(let n=0;n<e;n++)r.append(t[n],$t()),qt.nextNode(),c.push({type:2,index:++i});r.append(t[e],$t())}}}else if(8===r.nodeType)if(r.data===wt)c.push({type:2,index:i});else{let t=-1;for(;-1!==(t=r.data.indexOf(bt,t+1));)c.push({type:7,index:i}),t+=bt.length-1}i++}}static createElement(t,e){const n=xt.createElement("template");return n.innerHTML=t,n}};function Lt(t,e,n=t,s){if(e===Rt)return e;let r=void 0!==s?n._$Co?.[s]:n._$Cl;const i=kt(e)?void 0:e._$litDirective$;return r?.constructor!==i&&(r?._$AO?.(!1),void 0===i?r=void 0:(r=new i(t),r._$AT(t,n,s)),void 0!==s?(n._$Co??=[])[s]=r:n._$Cl=r),void 0!==r&&(e=Lt(t,r._$AS(t,e.values),r,s)),e}let Vt=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){const{el:{content:e},parts:n}=this._$AD,s=(t?.creationScope??xt).importNode(e,!0);qt.currentNode=s;let r=qt.nextNode(),i=0,o=0,a=n[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new Wt(r,r.nextSibling,this,t):1===a.type?e=new a.ctor(r,a.name,a.strings,this,t):6===a.type&&(e=new Kt(r,this,t)),this._$AV.push(e),a=n[++o]}i!==a?.index&&(r=qt.nextNode(),i++)}return qt.currentNode=xt,s}p(t){let e=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(t,n,e),e+=n.strings.length-2):n._$AI(t[e])),e++}};class Wt{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,n,s){this.type=2,this._$AH=Ut,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=n,this.options=s,this._$Cv=s?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return void 0!==e&&11===t?.nodeType&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=Lt(this,t,e),kt(t)?t===Ut||null==t||""===t?(this._$AH!==Ut&&this._$AR(),this._$AH=Ut):t!==this._$AH&&t!==Rt&&this._(t):void 0!==t._$litType$?this.$(t):void 0!==t.nodeType?this.T(t):(t=>_t(t)||"function"==typeof t?.[Symbol.iterator])(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!==Ut&&kt(this._$AH)?this._$AA.nextSibling.data=t:this.T(xt.createTextNode(t)),this._$AH=t}$(t){const{values:e,_$litType$:n}=t,s="number"==typeof n?this._$AC(t):(void 0===n.el&&(n.el=Ht.createElement(It(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===s)this._$AH.p(e);else{const t=new Vt(s,this),n=t.u(this.options);t.p(e),this.T(n),this._$AH=t}}_$AC(t){let e=Dt.get(t.strings);return void 0===e&&Dt.set(t.strings,e=new Ht(t)),e}k(t){_t(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let n,s=0;for(const r of t)s===e.length?e.push(n=new Wt(this.O($t()),this.O($t()),this,this.options)):n=e[s],n._$AI(r),s++;s<e.length&&(this._$AR(n&&n._$AB.nextSibling,s),e.length=s)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){const e=t.nextSibling;t.remove(),t=e}}setConnected(t){void 0===this._$AM&&(this._$Cv=t,this._$AP?.(t))}}class Ft{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,n,s,r){this.type=1,this._$AH=Ut,this._$AN=void 0,this.element=t,this.name=e,this._$AM=s,this.options=r,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ut}_$AI(t,e=this,n,s){const r=this.strings;let i=!1;if(void 0===r)t=Lt(this,t,e,0),i=!kt(t)||t!==this._$AH&&t!==Rt,i&&(this._$AH=t);else{const s=t;let o,a;for(t=r[0],o=0;o<r.length-1;o++)a=Lt(this,s[n+o],e,o),a===Rt&&(a=this._$AH[o]),i||=!kt(a)||a!==this._$AH[o],a===Ut?t=Ut:t!==Ut&&(t+=(a??"")+r[o+1]),this._$AH[o]=a}i&&!s&&this.j(t)}j(t){t===Ut?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class Gt extends Ft{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===Ut?void 0:t}}let Jt=class extends Ft{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==Ut)}},Yt=class extends Ft{constructor(t,e,n,s,r){super(t,e,n,s,r),this.type=5}_$AI(t,e=this){if((t=Lt(this,t,e,0)??Ut)===Rt)return;const n=this._$AH,s=t===Ut&&n!==Ut||t.capture!==n.capture||t.once!==n.once||t.passive!==n.passive,r=t!==Ut&&(n===Ut||s);s&&this.element.removeEventListener(this.name,this,n),r&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}};class Kt{constructor(t,e,n){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(t){Lt(this,t)}}const Zt=ft.litHtmlPolyfillSupport;Zt?.(Ht,Wt),(ft.litHtmlVersions??=[]).push("3.3.0");const Xt=(t,e,n)=>{const s=n?.renderBefore??e;let r=s._$litPart$;if(void 0===r){const t=n?.renderBefore??null;s._$litPart$=r=new Wt(e.insertBefore($t(),t),t,void 0,n??{})}return r._$AI(t),r
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/},Qt=globalThis;let te=class extends pt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Xt(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Rt}};te._$litElement$=!0,te.finalized=!0,Qt.litElementHydrateSupport?.({LitElement:te});const ee=Qt.litElementPolyfillSupport;ee?.({LitElement:te}),(Qt.litElementVersions??=[]).push("4.2.0");class ne extends(function(t){return class extends t{#q=(new Set).add((()=>this.setup()));#I=new Set;register_setup(t){this.#q.add(t)}setup(){return()=>{}}connectedCallback(){for(const t of this.#q)this.#I.add(t())}disconnectedCallback(){for(const t of this.#I)t();this.#I.clear()}}}(HTMLElement)){}function se(){let t,e;const n=new Promise(((n,s)=>{t=n,e=s}));return{promise:n,resolve:t,reject:e,entangle:function(s){return s.then(t).catch(e),n}}}function re(t,e){Z(t,function(t){const e=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const t of n)e.unshift(X(t))}else void 0!==t&&e.push(X(t));return e}(e))}class ie extends ne{static get styles(){}#N;#H=se();#i=this.#H.promise;init(){}constructor(){super(),this.#N=this.attachShadow({mode:"open"});const t=this.constructor;re(this.#N,t.styles),this.init()}get root(){return this.#N}get updateComplete(){return this.#i.then((()=>!0))}render(){}#L=u(0,(()=>{const t=this.#N,e=this.render();e&&Xt(e,t,{host:this})}));async requestUpdate(){const t=this.#L();return this.#H&&(t.then(this.#H.resolve),this.#H=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}class oe extends ne{#H=se();#i=this.#H.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#i.then((()=>!0))}render(){}#L=u(0,(()=>{const t=this.render();Xt(t,this,{host:this})}));async requestUpdate(){const t=this.#L();return this.#H&&(t.then(this.#H.resolve),this.#H=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}const ae=Symbol();class ce{#p=0;pull(){return this.#p++}reset(){this.#p=0}}class le{[ae]={wrap:t=>(...e)=>(this.#V.reset(),t(...e)),disconnect:()=>{for(const t of this.#W)t();this.#W.clear();for(const t of this.#F)t();this.#F.clear(),this.#G.clear();for(const{untrack:t}of this.#J.values())t();this.#J.clear()},reconnect:()=>{for(const t of this.#Y.values())this.#W.add(t());for(const[t,e]of this.#K.entries()){const[n,s]=e();this.#G.set(t,n),this.#F.add(s)}},afterRender:()=>{for(const t of this.#Z.values())t()}};#X;#Q;#V=new ce;constructor(t,e){this.#Q=t,this.#X=e}get context(){return this.#X}rerender(){this.#Q()}#Y=new Map;#W=new Set;mount(t){const e=this.#V.pull();this.#Y.has(e)||(this.#Y.set(e,t),this.#W.add(t()))}#K=new Map;#G=new Map;#F=new Set;init(t){const e=this.#V.pull();if(!this.#K.has(e)){this.#K.set(e,t);const[n,s]=t();return this.#G.set(e,n),this.#F.add(s),n}return this.#G.get(e)}#tt=new Map;once(t){const e=this.#V.pull();return s(this.#tt).guarantee(e,t)}#Z=new Map;defer(t){const e=this.signal(void 0),n=this.#V.pull();return this.#Z.has(n)||this.#Z.set(n,(()=>{e.value=t()})),e}#et=new Set;deferOnce(t){this.mount((()=>(this.#et.clear(),()=>{})));const e=this.signal(void 0),n=this.#V.pull();return this.#Z.has(n)||this.#Z.set(n,(()=>{this.#et.has(n)||(this.#et.add(n),e.value=t())})),e}#nt=new Map;state(t){const e=this.#V.pull();return[s(this.#nt).guarantee(e,(()=>"function"==typeof t?t():t)),t=>{this.#nt.set(e,t),this.#Q()},()=>this.#nt.get(e)]}#st=new Map;flatstate(t){const e=this.#V.pull();return s(this.#st).guarantee(e,(()=>z.state("function"==typeof t?t():t)))}#z=new Map;signal(t){const e=this.#V.pull();return s(this.#z).guarantee(e,(()=>j.signal("function"==typeof t?t():t)))}computed(t){const e=this.#V.pull();return s(this.#z).guarantee(e,(()=>j.computed(t)))}op(){const t=this.#V.pull();return s(this.#z).guarantee(t,(()=>j.op()))}load(t){const e=this.op();return this.once((()=>e.load(t))),e}#J=new Map;watch(t){const e=this.#V.pull(),{data:n}=s(this.#J).guarantee(e,(()=>{const e={data:t(),untrack:()=>{}};return e.untrack=M.track(t,(t=>{e.data=t,this.#Q()})),e}));return n}#rt=new Map;effect(t,e){e=e.map(C.unwrap);const n=this.#V.pull(),s=this.#rt.get(n);if(s){const[r,i]=s;w.equal(e,i)||(r(),this.#rt.set(n,[t(),e]))}else{this.#Y.set(n,t);const s=t();this.#W.add(s),this.#rt.set(n,[s,e])}}}class de extends le{#it;get element(){return this.#it}#ot;get shadow(){return this.#ot}styles(...t){this.once((()=>re(this.shadow,[this.context.theme,...t])))}css(...t){return this.styles(...t)}constructor(t,e,n,s){super(n,s),this.#it=t,this.#ot=e}}function ue(t){let e;return function(n){return e||(e=m(t,n)),e}}class he extends de{attrs;constructor(t,e,n,s){super(t,e,n,s),this.attrs=ue(t)}}class pe extends le{#it;get element(){return this.#it}attrs;constructor(t,e,n){super(e,n),this.#it=t,this.attrs=ue(t)}}class fe extends he{}class me extends pe{}class ge extends le{element;name(t){this.once((()=>this.element.setAttribute("view",t)))}constructor(t,e,n){super(e,n),this.element=t}}class ye extends de{name(t){this.once((()=>this.element.setAttribute("view",t)))}}class be{#X;constructor(t){this.#X=t}get context(){if(this.#X)return this.#X;throw new Error("nexus.context was not set, but it's necessary")}set context(t){this.#X=t}}function we(t,e){const n=R.lean(e);return{stop:n.stop,render:(...e)=>n.collect((()=>t(...e)))}}const ve=t=>e=>class extends ie{#at=new fe(this,this.root,(()=>{this.requestUpdate()}),t.context);#ct=this.#at[ae].wrap((()=>e(this.#at)));#lt;render(){return this.updateComplete.then((()=>this.#at[ae].afterRender())),this.#lt?.render()}connectedCallback(){super.connectedCallback(),this.#at[ae].reconnect(),this.#lt=we(this.#ct,(()=>{this.requestUpdate()}))}disconnectedCallback(){super.disconnectedCallback(),this.#at[ae].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}},xe=2;
/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/class $e{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,n){this._$Ct=t,this._$AM=e,this._$Ci=n}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/const ke=(t,e)=>{const n=t._$AN;if(void 0===n)return!1;for(const t of n)t._$AO?.(e,!1),ke(t,e);return!0},_e=t=>{let e,n;do{if(void 0===(e=t._$AM))break;n=e._$AN,n.delete(t),t=e}while(0===n?.size)},Ae=t=>{for(let e;e=t._$AM;t=e){let n=e._$AN;if(void 0===n)e._$AN=n=new Set;else if(n.has(t))break;n.add(t),Ce(e)}};function Se(t){void 0!==this._$AN?(_e(this),this._$AM=t,Ae(this)):this._$AM=t}function Ee(t,e=!1,n=0){const s=this._$AH,r=this._$AN;if(void 0!==r&&0!==r.size)if(e)if(Array.isArray(s))for(let t=n;t<s.length;t++)ke(s[t],!1),_e(s[t]);else null!=s&&(ke(s,!1),_e(s));else ke(this,t)}const Ce=t=>{t.type==xe&&(t._$AP??=Ee,t._$AQ??=Se)};class Be extends $e{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,n){super._$AT(t,e,n),Ae(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ke(this,t),_e(this))}setValue(t){if((t=>void 0===t.strings)(this._$Ct))this._$Ct._$AI(t,this);else{const e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}}function Oe(){const t=new Set;function e(e){return t.add(e),()=>{t.delete(e)}}return e.publish=e=>{for(const n of t)n(e)},e.clear=()=>t.clear(),e.once=e=>{const n=s=>{e(s),t.delete(n)};return t.add(n),()=>{t.delete(n)}},e}class ze extends HTMLElement{static tag="slate-view";onConnected=Oe();onDisconnected=Oe();connectedCallback(){this.onConnected.publish()}disconnectedCallback(){this.onDisconnected.publish()}}function je(...t){const e=new Set,n=t.map((t=>t??"")).flatMap(Me);for(const t of n)e.add(t);return e}function Me(t){return t.split(/\s+/).map((t=>t.trim())).filter((t=>!!t))}function Pe(t){return t.split(",").map((t=>t.trim())).filter((t=>!!t)).map((t=>t.includes(":")?t.split(":").map((t=>t.trim()))[1]:t))}function Te(t,e){const n=je(t.getAttribute("part")),s=je(t.getAttribute("data-gpart")),r=function(t,e){return Object.fromEntries(Object.entries(e).map((([e,n])=>[e,Array.from(t.querySelectorAll(`[${n}]`)).map((t=>t.getAttribute(n)))])))}(e,{part:"part",gpart:"data-gpart",exportparts:"exportparts",gexportparts:"gexportparts"}),i=new Set([...r.part.flatMap(Me),...r.exportparts.flatMap(Pe)]),o=new Set([...r.gpart.flatMap(Me),...r.gexportparts.flatMap(Me)]);i.size&&t.setAttribute("exportparts",[...n].flatMap(function(t,e){return n=>[...t].flatMap((t=>[`${t}:${n}-${t}`,...e.has(t)?[t]:[]]))}(i,o)).join(", ")),(o.size||t.hasAttribute("data-gpart"))&&t.setAttribute("gexportparts",[...o,...[...s].flatMap((t=>[...i].map((e=>`${t}-${e}`))))].join(" "))}function Re(t,e={},n={}){const{content:s,attrs:r={}}=e,{attrs:i={}}=n;function o(e,n,s,r){e!==n&&(void 0===e?t.removeAttribute(s):t.setAttribute(s,r()))}r&&function(t,e){for(const[n,s]of Object.entries(e))"string"==typeof s?t.setAttribute(n,s):"number"==typeof s?t.setAttribute(n,s.toString()):"boolean"==typeof s?!0===s?t.setAttribute(n,""):t.removeAttribute(n):void 0===s?t.removeAttribute(n):console.warn(`invalid attribute type ${n} is ${typeof s}`)}(t,r),o(r.class,i?.class,"class",(()=>r.class)),o(r.part,i?.part,"part",(()=>r.part)),o(r.gpart,i?.gpart,"data-gpart",(()=>r.gpart)),s&&Xt(s,t,{host:t})}const Ue=t=>e=>(t=>(e,n={})=>({_$litDirective$:t,values:[{meta:n,props:e}]}))(class extends Be{#U;#dt=!0;#N=function({afterRender:t,onConnected:e,onDisconnected:n}){const s=document.createElement(ze.tag);s.onConnected(e),s.onDisconnected(n);const r=s.attachShadow({mode:"open"});let i=!1;return{container:s,shadow:r,set auto_exportparts(t){i=t},render_into_shadow:e=>(Xt(e,r),i&&Te(s,r),t(),s)}}({afterRender:()=>this.#at[ae].afterRender(),onDisconnected:()=>this.disconnected(),onConnected:()=>{this.#dt||this.reconnected(),this.#dt=!1}});#Q=u(0,(()=>{this.#U&&this.isConnected&&this.setValue(this.#N.render_into_shadow(this.render(this.#U)))}));#at=new ye(this.#N.container,this.#N.shadow,this.#Q,t.context);#ct=this.#at[ae].wrap(e(this.#at));#lt=we(this.#ct,this.#Q);update(t,e){return this.#N.render_into_shadow(this.render(...e))}render(t){return Re(this.#N.container,t.meta,this.#U?.meta),this.#U=t,this.#N.auto_exportparts=t.meta.auto_exportparts??!0,this.#lt?.render(...t.props)}reconnected(){this.#at[ae].reconnect(),this.#lt=we(this.#ct,this.#Q)}disconnected(){this.#at[ae].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}}),De=t=>e=>class extends oe{#at=new me(this,(()=>{this.requestUpdate()}),t.context);#ct=this.#at[ae].wrap((()=>e(this.#at)));#lt;render(){return this.updateComplete.then((()=>this.#at[ae].afterRender())),this.#lt?.render()}connectedCallback(){super.connectedCallback(),this.#lt=we(this.#ct,(()=>{this.requestUpdate()})),this.#at[ae].reconnect()}disconnectedCallback(){super.disconnectedCallback(),this.#lt&&(this.#lt.stop(),this.#lt=void 0),this.#at[ae].disconnect()}},qe=t=>e=>(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends Be{#ut;#it=document.createElement(ze.tag);#ht(t){return Xt(t,this.#it),this.#at[ae].afterRender(),this.#it}#Q=u(0,(()=>{this.#ut&&this.isConnected&&this.setValue(this.#ht(this.render(...this.#ut)))}));#at=new ge(this.#it,this.#Q,t.context);#ct=this.#at[ae].wrap(e(this.#at));#lt=we(this.#ct,this.#Q);update(t,e){return this.#ht(this.render(...e))}render(...t){return this.#ut=t,this.#lt?.render(...t)}reconnected(){this.#at[ae].reconnect(),this.#lt=we(this.#ct,this.#Q)}disconnected(){this.#at[ae].disconnect(),this.#lt&&(this.#lt.stop(),this.#lt=void 0)}});K`
@layer reset {
* {
margin: 0;
padding: 0;
box-sizing: border-box;
scrollbar-width: thin;
scrollbar-color: #888 transparent;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
::-webkit-scrollbar-thumb:hover { background: #444; }
}
`;const Ie=(t,...e)=>Pt(t,...e.map(C.unwrap));const Ne=K`
:host {
display: contents;
}
`;"undefined"!=typeof process&&process.versions&&process.versions.node||"undefined"!=typeof Deno&&void 0!==Deno.version||V({SlateView:ze},{soft:!0});const He=new class extends be{lightComponent;shadowComponent;lightView;shadowView;shadowComponentify;constructor(t){super(t),this.lightComponent=De(this),this.shadowComponent=ve(this),this.lightView=qe(this),this.shadowView=Ue(this),this.shadowComponentify=(t=>e=>t.shadowComponent((t=>(t.styles(Ne),e([])))))(this)}component=t=>D.setup(this.context.theme)(t);components=t=>H.setup(this.context.theme)(t)}(new class{theme=[]}),Le=He;He.lightView,He.lightComponent;const Ve=He.shadowView,We=He.shadowComponent;function Fe(t,e){const n=setInterval(e,t);return()=>clearInterval(n)}He.component,He.components,He.shadowComponentify,Fe.hz=(t,e)=>Fe(1e3/t,e);const Ge=K`
:host {
color: red;
font-family: monospace;
}
`,Je=Le.shadowView((t=>e=>(t.name("error-indicator"),t.styles(Ge),Ie`${e||"unknown error"}`))),Ye=K`
:host {
font-family: monospace;
}
`,Ke=Le.shadowView((t=>(e,n)=>{t.name("loading-indicator"),t.styles(Ye);const s=t.signal(0);return t.mount((()=>Fe.hz(e,(()=>{const t=s.value+1;s.value=t<n.length?t:0})))),Ie`${n[s.value]}`})),Ze=(t,e)=>function({loading:t,error:e}){return function(n,s){const r=n instanceof C?n.value:n;return $.select(r,{loading:t,error:e,ready:s})}}({error:t=>Je([t]),loading:()=>Ke([t,e])}),Xe={binary:Ze(20,["00000","00001","00010","00101","01011","10110","01100","11001","10011","00111","01110","11101","11011","10110","01101","11010","10100","01000","10000"]),braille:Ze(20,["⣾","⣷","⣯","⣟","⡿","⢿","⣻","⣽"])};class Qe{#pt;#ft=P(!1);constructor(t){this.#pt=t}get indicator(){return this.#ft.value}reset_indicator=()=>{this.#ft.value=!1};dragover=t=>{t.preventDefault(),this.#pt.predicate(t)&&(this.#ft.value=!0)};dragleave=t=>{(function(t){if(!t.relatedTarget||0===t.clientX&&0===t.clientY)return!0;const e=t.currentTarget.getBoundingClientRect(),n=t.clientX>=e.left&&t.clientX<=e.right,s=t.clientY>=e.top&&t.clientY<=e.bottom;return!(n&&s)})(t)&&(this.#ft.value=!1)};drop=t=>{t.preventDefault(),this.#ft.value=!1,this.#pt.predicate(t)&&this.#pt.handle_drop(t)}}function tn(t,e,n){const s=Object.entries(e);for(const[e,r]of s)t.addEventListener(e,r,n);return function(){for(const[e,n]of s)t.removeEventListener(e,n)}}const en=[..."aeiou"],nn=[..."bcdfghjklmnprstvwxyz"],sn=new Set(["fuc","sex","cum","dic","coc","pen","vag","pus","gay","fap","jiz","fag","cun","nig","jew","goy","sem","bal","fat","god","big","dog","cow","pet","vax","sis","rot","zog","ana","uti","cat","bag","cuc","fuk","fak","wet","cux","bug","gey","pig","rat","bat","dik","bed","boy","man","fem","men","nob","rub","fut","jap","tit","gun","job","nip","but","rim","guy","suc","dad","mom","buk","jis","peg","kox","ded","mum","son","nog","hun","wop","cuk"]);function rn(t,e){const n=e.length-t;if(n<=0)return e;const s=e.length/n,r=[];let i=s;for(let t=0;t<e.length;t++)t>=Math.round(i)?i+=s:r.push(e[t]);return r.slice(0,t)}function on(t){return[...new Set(t)]}const an=on(rn(256,nn.map((t=>en.map((e=>nn.map((n=>t+e+n)))))).flat(2).filter((t=>!sn.has(t))))),cn=on(rn(256,en.map((t=>nn.map((e=>en.map((n=>t+e+n)))))).flat(2).filter((t=>!sn.has(t))))),ln=on([...rn(192,an),...rn(64,cn)]);if(256!==an.length)throw new Error("xox not 256");if(256!==cn.length)throw new Error("oxo not 256");if(256!==ln.length)throw new Error("syllables not 256");new Set([..."अआइईउऊऋएऐओऔकखगघङचछजझञटठडढणतथदधनपफबभमयरलवशषसह",..."அஆஇஈஉஊஎஏஐஒஓகஙசஜஞடணதநபமயரலவழளறன",..."অআইঈউঊএঐওকখগঘঙচছজঝঞটঠডঢণতথদধনপফবভমযরলশষসহ",..."ਅਆਇਈਉਊਏਐਓਕਖਗਘਙਚਛਜਝਞਟਠਡਢਣਤਥਦਧਨਪਫਬਭਮਯਰਲਵਸਹ",..."അആഇഈഉഊഎഏഐഒഓകഖഗഘങചഛജഝഞടഠഡഢണതഥദധനപഫബഭമയരലവശസഹളഴറ",..."અઆઇઈઉઊએઐઓકખગઘઙચછજઝઞટઠડઢણતથદધનપફબભમયરલવશષસહ",..."ଅଆଇଈଉଊଏଐଓଔକଖଗଘଙଚଛଜଝଞଟଠଡଢଣତଥଦଧନପଫବଭମଯରଲଶଷସହ"]);const dn=t=>Tt(t.strings,...t.values);var un;!function(t){t.actualize=function t(e,n){return k(n).map((n=>"function"==typeof n?(...t)=>{e.transmute((e=>(n(e,(t=>{e=t}))(...t),e)))}:t(e,n)))},t.fn=function(){return t=>t},t.blueprint=function(){return t=>t},t.prepFn=t=>e=>(n,s)=>(...r)=>(e(t(n,s))(...r),n),t.prepBlueprint=e=>n=>n(t.prepFn(e)),t.prep=function(e){return{action:t.prepFn(e),blueprint:t.prepBlueprint(e)}}}(un||(un={}));
/**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*/
class hn extends $e{constructor(t){if(super(t),this.it=Ut,t.type!==xe)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===Ut||null==t)return this._t=void 0,this.it=t;if(t===Rt)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;const e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}}hn.directiveName="unsafeHTML",hn.resultType=1;var pn=K`
.zone {
position: relative;
&[x-drop-indicator] {
&::before {
border: 0.5rem dashed var(--seed);
border-radius: 1rem;
position: absolute;
display: flex;
content: "DROP SEED FILE";
justify-content: center;
align-items: center;
font-size: 2em;
font-weight: bold;
z-index: 1;
inset: 0;
margin: 0;
color: white;
background: color-mix(in lch, transparent, var(--seed) 25%);
backdrop-filter: blur(0.3em);
}
}
}
footer {
margin-top: 4em;
display: flex;
justify-content: center;
.persistence {
opacity: 0.5;
font-size: 0.8em;
display: flex;
align-items: center;
justify-content: center;
gap: 0.5em;
svg {
width: 1.5em;
height: 1.5em;
stroke-width: 2;
}
}
}
`,fn=K`@layer theme, view; @layer theme {
:root {
color-scheme: dark;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
scrollbar-width: thin;
scrollbar-color: #333 transparent;
}
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 1em; }
::-webkit-scrollbar-thumb:hover { background: #444; }
ul, ol {
padding: 0;
list-style: none;
}
a {
color: var(--link);
text-decoration: none;
&:visited {
color: color-mix(in srgb, purple, var(--link) 70%);
}
&:hover {
color: color-mix(in srgb, white, var(--link) 90%);
text-decoration: underline;
}
&:active {
color: color-mix(in srgb, white, var(--link) 50%);
}
}
h2 {
font-size: 1.2em;
text-shadow:
0 0 2em color-mix(in lch, transparent, currentColor 50%),
0 0 .5em color-mix(in lch, transparent, currentColor 50%);
}
p {
color: color-mix(in srgb, transparent, currentColor 60%);
}
button {
color: inherit;
background: none;
border: none;
font: inherit;
user-select: none;
}
[theme-button] {
color: inherit;
background: none;
border: none;
font: inherit;
user-select: none;
&:not([theme-button^="plain"]) {
cursor: pointer;
padding: 1em 0.5em;
color: color-mix(in srgb, var(--alpha), white 50%);
text-shadow: 0 0 1em color-mix(in srgb, transparent, currentColor 80%);
font-weight: bold;
border-radius: 0.3em;
&[theme-hush] {
opacity: 0.7;
font-size: 0.9em;
font-weight: normal;
}
&[theme-loud] {
background: color-mix(in lch, transparent, currentColor 30%);
border: 0.15em solid color-mix(in srgb, transparent, currentColor 50%);
border-top-color: color-mix(in srgb, transparent, currentColor 80%);
box-shadow:
0 0 3em color-mix(in srgb, transparent, currentColor 20%),
inset 0 0 1em color-mix(in srgb, transparent, currentColor 15%);
}
&[disabled] {
cursor: default;
opacity: 0.3;
}
&:not([disabled]) {
cursor: pointer;
&[theme-button="happy"] { color: var(--happy); }
&[theme-button="angry"] { color: var(--angry); }
&[theme-button="login"] { color: var(--login); }
&[theme-button="back"] { color: var(--back); }
&[theme-button="seed"] { color: var(--seed); }
&:is(:hover, :focus) {
filter: brightness(120%); text-decoration: underline;
&[theme-loud] {
box-shadow:
0 0 1em color-mix(in srgb, transparent, currentColor 20%),
0 0 3em color-mix(in srgb, transparent, currentColor 20%),
inset 0 0 1em color-mix(in srgb, transparent, currentColor 15%);
}
}
&:active { filter: brightness(90%); }
}
}
&[theme-button="plain-subtle"] {
color: #a3b1ff;
font-weight: bold;
text-shadow: .04em .08em .1em #0008;
&[disabled] {
cursor: default;
color: #666;
opacity: 0.5;
text-decoration: line-through;
}
&:not([disabled]) {
cursor: pointer;
&:hover { filter: brightness(120%); text-decoration: underline; }
&:active { filter: brightness(90%); }
}
}
&[theme-flashing] {
transition: background 100ms linear;
&[theme-flashing="good"] { background: var(--happy); }
&[theme-flashing="bad"] { background: var(--angry); }
}
}
[theme-plate] {
display: flex;
flex-direction: column;
text-align: center;
gap: 1em;
padding: 1em;
border-radius: 1em;
border: 0.2em solid color-mix(in srgb, var(--alpha), white 25%);
backdrop-filter: blur(0.2em);
box-shadow:
0 0 16em color-mix(in srgb, transparent, var(--alpha) 33%),
0 0 2em color-mix(in srgb, transparent, var(--alpha) 33%),
inset 0 0 1em color-mix(in srgb, transparent, var(--alpha) 50%);
}
[theme-zone] {
width: 1