Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@benev/slate

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@benev/slate - npm Package Compare versions

Comparing version 0.0.0-dev.8 to 0.0.0-dev.9

2

package.json
{
"name": "@benev/slate",
"version": "0.0.0-dev.8",
"version": "0.0.0-dev.9",
"description": "frontend web stuff",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -14,3 +14,3 @@

new(...args: any[]): BaseElement
styles?: CSSResultGroup
readonly styles?: CSSResultGroup
}

@@ -17,0 +17,0 @@

@@ -13,6 +13,8 @@

return class extends Base {
static styles = combineStyles(
Base.styles,
newStyles,
)
static get styles() {
return combineStyles(
Base.styles,
newStyles,
)
}
}

@@ -115,4 +117,4 @@ }

.flat()
.filter(notUndefined)
.filter(notUndefined) as CSSResultGroup
}
import {css} from "../shiny/html.js"
import {Context} from "../shiny/context.js"
import {prepare_frontend} from "../shiny/frontend.js"
export class DemoContext extends Context {
theme = css`
button {
padding: 0.5em;
font-style: italic;
}
`
}
export class DemoContext extends Context {}
export const demoContext = new DemoContext()

@@ -21,3 +14,3 @@ export const {

component,
} = prepare_frontend(new DemoContext)
} = prepare_frontend(demoContext)

@@ -11,3 +11,3 @@

export class GoldElement extends MetallicElement implements BaseElement {
static styles?: CSSResultGroup
static get styles(): CSSResultGroup | undefined { return undefined }

@@ -14,0 +14,0 @@ #root: ShadowRoot

import {css} from "lit"
import {SlateGold} from "./demo/elements/slate-gold.js"

@@ -7,4 +9,11 @@ import {SlateSilver} from "./demo/elements/slate-silver.js"

import {demoContext} from "./demo/frontend.js"
import {register_to_dom} from "./base/helpers/register_to_dom.js"
demoContext.theme = css`
button {
color: red;
}
`
register_to_dom({

@@ -11,0 +20,0 @@ SlateCarbon,

import {CSSResultGroup, css} from "lit"
import {css} from "lit"

@@ -16,6 +16,8 @@ import {Context} from "./context.js"

static name = settings.name
static styles: CSSResultGroup = [
context.theme,
settings.styles ?? css``,
]
static get styles() {
return [
context.theme,
settings.styles ?? css``,
]
}

@@ -22,0 +24,0 @@ #use = new UseCarbon(

@@ -18,2 +18,26 @@

setLoading() {
this.value = Op.loading()
}
setError(reason: string) {
this.value = Op.error(reason)
}
setReady(payload: V) {
this.value = Op.ready(payload)
}
get loading() {
return Op.is.loading(this.value)
}
get error() {
return Op.is.error(this.value)
}
get ready() {
return Op.is.ready(this.value)
}
get payload() {

@@ -23,8 +47,2 @@ return Op.payload(this.value)

is = {
loading: () => Op.is.loading(this.value),
error: () => Op.is.error(this.value),
ready: () => Op.is.ready(this.value),
}
select<R>(choices: Op.Choices<V, R>) {

@@ -31,0 +49,0 @@ return Op.select(this.value, choices)

@@ -11,3 +11,3 @@ import { CSSResultGroup, TemplateResult } from "lit";

new (...args: any[]): BaseElement;
styles?: CSSResultGroup;
readonly styles?: CSSResultGroup;
};

@@ -14,0 +14,0 @@ export type HTMLElementClasses = {

@@ -6,3 +6,5 @@ export var mixin;

return class extends Base {
static styles = combineStyles(Base.styles, newStyles);
static get styles() {
return combineStyles(Base.styles, newStyles);
}
};

@@ -9,0 +11,0 @@ };

@@ -349,3 +349,3 @@ export declare const SlateGold: {

};
styles?: import("lit").CSSResultGroup | undefined;
readonly styles: import("lit").CSSResultGroup | undefined;
};
import { Context } from "../shiny/context.js";
export declare class DemoContext extends Context {
theme: import("lit").CSSResult;
}
export declare const demoContext: DemoContext;
export declare const oxygen: (renderer: import("../shiny/parts/types.js").OxygenRenderer<DemoContext>) => {

@@ -6,0 +6,0 @@ new (): {

@@ -1,13 +0,7 @@

import { css } from "../shiny/html.js";
import { Context } from "../shiny/context.js";
import { prepare_frontend } from "../shiny/frontend.js";
export class DemoContext extends Context {
theme = css `
button {
padding: 0.5em;
font-style: italic;
}
`;
}
export const { oxygen, carbon, quartz, obsidian, component, } = prepare_frontend(new DemoContext);
export const demoContext = new DemoContext();
export const { oxygen, carbon, quartz, obsidian, component, } = prepare_frontend(demoContext);
//# sourceMappingURL=frontend.js.map

@@ -6,3 +6,3 @@ import { CSSResultGroup, TemplateResult } from "lit";

#private;
static styles?: CSSResultGroup;
static get styles(): CSSResultGroup | undefined;
init(): void;

@@ -9,0 +9,0 @@ constructor();

@@ -7,3 +7,3 @@ import { render } from "lit";

export class GoldElement extends MetallicElement {
static styles;
static get styles() { return undefined; }
#root;

@@ -10,0 +10,0 @@ #init = explode_promise();

@@ -33,91 +33,2 @@

function debounce(delay, action) {
let latestArgs;
let timeout;
let waitingQueue = [];
function reset() {
latestArgs = [];
if (timeout)
clearTimeout(timeout);
timeout = undefined;
waitingQueue = [];
}
reset();
return ((...args) => {
latestArgs = args;
if (timeout)
clearTimeout(timeout);
const promise = new Promise((resolve, reject) => {
waitingQueue.push({ resolve, reject });
});
timeout = setTimeout(() => {
Promise.resolve()
.then(() => action(...latestArgs))
.then(r => {
for (const { resolve } of waitingQueue)
resolve(r);
reset();
})
.catch(err => {
for (const { reject } of waitingQueue)
reject(err);
reset();
});
}, delay);
return promise;
});
}
class SignalCircularError extends Error {
name = this.constructor.name;
}
class Signal {
#value;
#lock = false;
#wait;
#listeners = new Set();
accessed = false;
constructor(v) {
this.#value = v;
this.#wait = Promise.resolve(v);
}
subscribe(listener) {
this.#listeners.add(listener);
return () => void this.#listeners.delete(listener);
}
clear() {
return this.#listeners.clear();
}
#invoke_listeners = debounce(0, () => {
const value = this.#value;
this.#lock = true;
for (const listener of this.#listeners)
listener(value);
this.#lock = false;
return value;
});
async publish() {
this.#wait = this.#invoke_listeners();
await this.#wait;
}
get wait() {
return this.#wait;
}
get value() {
this.accessed = true;
return this.#value;
}
set value(s) {
if (this.#lock)
throw new SignalCircularError("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");
this.#value = s;
this.publish();
}
}
const html = (strings, ...values) => (x(strings, ...values.map(value => ((value instanceof Signal)
? value.value
: value))));
class Locker {

@@ -231,2 +142,39 @@ #locked = false;

function debounce(delay, action) {
let latestArgs;
let timeout;
let waitingQueue = [];
function reset() {
latestArgs = [];
if (timeout)
clearTimeout(timeout);
timeout = undefined;
waitingQueue = [];
}
reset();
return ((...args) => {
latestArgs = args;
if (timeout)
clearTimeout(timeout);
const promise = new Promise((resolve, reject) => {
waitingQueue.push({ resolve, reject });
});
timeout = setTimeout(() => {
Promise.resolve()
.then(() => action(...latestArgs))
.then(r => {
for (const { resolve } of waitingQueue)
resolve(r);
reset();
})
.catch(err => {
for (const { reject } of waitingQueue)
reject(err);
reset();
});
}, delay);
return promise;
});
}
class Scheduler {

@@ -369,2 +317,50 @@ #queue = new Map();

class SignalCircularError extends Error {
name = this.constructor.name;
}
class Signal {
#value;
#lock = false;
#wait;
#listeners = new Set();
accessed = false;
constructor(v) {
this.#value = v;
this.#wait = Promise.resolve(v);
}
subscribe(listener) {
this.#listeners.add(listener);
return () => void this.#listeners.delete(listener);
}
clear() {
return this.#listeners.clear();
}
#invoke_listeners = debounce(0, () => {
const value = this.#value;
this.#lock = true;
for (const listener of this.#listeners)
listener(value);
this.#lock = false;
return value;
});
async publish() {
this.#wait = this.#invoke_listeners();
await this.#wait;
}
get wait() {
return this.#wait;
}
get value() {
this.accessed = true;
return this.#value;
}
set value(s) {
if (this.#lock)
throw new SignalCircularError("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");
this.#value = s;
this.publish();
}
}
const JsError = Error;

@@ -435,10 +431,23 @@ var Op;

}
setLoading() {
this.value = Op.loading();
}
setError(reason) {
this.value = Op.error(reason);
}
setReady(payload) {
this.value = Op.ready(payload);
}
get loading() {
return Op.is.loading(this.value);
}
get error() {
return Op.is.error(this.value);
}
get ready() {
return Op.is.ready(this.value);
}
get payload() {
return Op.payload(this.value);
}
is = {
loading: () => Op.is.loading(this.value),
error: () => Op.is.error(this.value),
ready: () => Op.is.ready(this.value),
};
select(choices) {

@@ -561,3 +570,3 @@ return Op.select(this.value, choices);

class GoldElement extends MetallicElement {
static styles;
static get styles() { return undefined; }
#root;

@@ -809,6 +818,8 @@ #init = explode_promise();

static name = settings.name;
static styles = [
context.theme,
settings.styles ?? i$3 ``,
];
static get styles() {
return [
context.theme,
settings.styles ?? i$3 ``,
];
}
#use = new UseCarbon(this, this.root, () => void this.requestUpdate(), context);

@@ -923,3 +934,5 @@ #rend = UseCarbon.wrap(this.#use, () => renderer(this.#use));

return class extends Base {
static styles = combineStyles(Base.styles, newStyles);
static get styles() {
return combineStyles(Base.styles, newStyles);
}
};

@@ -1195,10 +1208,5 @@ };

class DemoContext extends Context {
theme = i$3 `
button {
padding: 0.5em;
font-style: italic;
}
`;
}
const { oxygen, carbon, quartz, obsidian, component, } = prepare_frontend(new DemoContext);
const demoContext = new DemoContext();
const { oxygen, carbon, quartz, obsidian, component, } = prepare_frontend(demoContext);

@@ -1217,2 +1225,6 @@ const SlateGold = component(context => class extends GoldElement {

const html = (strings, ...values) => (x(strings, ...values.map(value => ((value instanceof Signal)
? value.value
: value))));
const QuartzTripler = quartz(use => (start) => {

@@ -1280,2 +1292,7 @@ // react hooks state

demoContext.theme = i$3 `
button {
color: red;
}
`;
register_to_dom({

@@ -1282,0 +1299,0 @@ SlateCarbon,

@@ -1,10 +0,5 @@

Array.prototype.at=function(t){return t>=0?this[t]:this[this.length+t]};const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),r=new WeakMap;let n=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=r.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&r.set(s,t))}return t}toString(){return this.cssText}};const i=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,s,r)=>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.")})(s)+t[r+1]),t[0]);return new n(r,t,s)},o=(s,r)=>{if(e)s.adoptedStyleSheets=r.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of r){const r=document.createElement("style"),n=t.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,s.appendChild(r)}},a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:l,getOwnPropertyNames:u,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,f=globalThis,$=f.trustedTypes,_=$?$.emptyScript:"",g=f.reactiveElementPolyfillSupport,m=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},b=(t,e)=>!c(t,e),A={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:b};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class v 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=A){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&h(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:n}=l(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const i=r?.call(this);n.call(this,e),this.requestUpdate(t,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??A}static _$Ei(){if(this.hasOwnProperty(m("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(m("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m("properties"))){const t=this.properties,e=[...u(t),...d(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"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._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$ES??=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$ES?.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return o(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$ES?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$ES?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const n=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=r,this[r]=n.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??b)(r?n:this[t],e))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}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._$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,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$ES?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$ES?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}v.elementStyles=[],v.shadowRootOptions={mode:"open"},v[m("elementProperties")]=new Map,v[m("finalized")]=new Map,g?.({ReactiveElement:v}),(f.reactiveElementVersions??=[]).push("2.0.0");const w=globalThis,S=w.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",k=`lit$${(Math.random()+"").slice(9)}$`,C="?"+k,M=`<${C}>`,P=document,U=()=>P.createComment(""),T=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,O="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,j=/>/g,z=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,L=/"/g,D=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),I=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),W=new WeakMap,Z=P.createTreeWalker(P,129);function J(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const K=(t,e)=>{const s=t.length-1,r=[];let n,i=2===e?"<svg>":"",o=H;for(let e=0;e<s;e++){const s=t[e];let a,c,h=-1,l=0;for(;l<s.length&&(o.lastIndex=l,c=o.exec(s),null!==c);)l=o.lastIndex,o===H?"!--"===c[1]?o=R:void 0!==c[1]?o=j:void 0!==c[2]?(D.test(c[2])&&(n=RegExp("</"+c[2],"g")),o=z):void 0!==c[3]&&(o=z):o===z?">"===c[0]?(o=n??H,h=-1):void 0===c[1]?h=-2:(h=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?z:'"'===c[3]?L:q):o===L||o===q?o=z:o===R||o===j?o=H:(o=z,n=void 0);const u=o===z&&t[e+1].startsWith("/>")?" ":"";i+=o===H?s+M:h>=0?(r.push(a),s.slice(0,h)+E+s.slice(h)+k+u):s+k+(-2===h?e:u)}return[J(t,i+(t[s]||"<?>")+(2===e?"</svg>":"")),r]};class G{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0;const o=t.length-1,a=this.parts,[c,h]=K(t,e);if(this.el=G.createElement(c,s),Z.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Z.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(E)){const e=h[i++],s=r.getAttribute(t).split(k),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:o[2],strings:s,ctor:"."===o[1]?tt:"?"===o[1]?et:"@"===o[1]?st:Y}),r.removeAttribute(t)}else t.startsWith(k)&&(a.push({type:6,index:n}),r.removeAttribute(t));if(D.test(r.tagName)){const t=r.textContent.split(k),e=t.length-1;if(e>0){r.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],U()),Z.nextNode(),a.push({type:2,index:++n});r.append(t[e],U())}}}else if(8===r.nodeType)if(r.data===C)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=r.data.indexOf(k,t+1));)a.push({type:7,index:n}),t+=k.length-1}n++}}static createElement(t,e){const s=P.createElement("template");return s.innerHTML=t,s}}function Q(t,e,s=t,r){if(e===I)return e;let n=void 0!==r?s._$Co?.[r]:s._$Cl;const i=T(e)?void 0:e._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),void 0===i?n=void 0:(n=new i(t),n._$AT(t,s,r)),void 0!==r?(s._$Co??=[])[r]=n:s._$Cl=n),void 0!==n&&(e=Q(t,n._$AS(t,e.values),n,r)),e}class F{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:s}=this._$AD,r=(t?.creationScope??P).importNode(e,!0);Z.currentNode=r;let n=Z.nextNode(),i=0,o=0,a=s[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new X(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new rt(n,this,t)),this._$AV.push(e),a=s[++o]}i!==a?.index&&(n=Z.nextNode(),i++)}return Z.currentNode=P,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class X{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.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=Q(this,t,e),T(t)?t===V||null==t||""===t?(this._$AH!==V&&this._$AR(),this._$AH=V):t!==this._$AH&&t!==I&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>N(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==V&&T(this._$AH)?this._$AA.nextSibling.data=t:this.$(P.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=G.createElement(J(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new F(r,this),s=t.u(this.options);t.p(e),this.$(s),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new G(t)),e}T(t){N(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const n of t)r===e.length?e.push(s=new X(this.k(U()),this.k(U()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$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 Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=V,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=V}_$AI(t,e=this,s,r){const n=this.strings;let i=!1;if(void 0===n)t=Q(this,t,e,0),i=!T(t)||t!==this._$AH&&t!==I,i&&(this._$AH=t);else{const r=t;let o,a;for(t=n[0],o=0;o<n.length-1;o++)a=Q(this,r[s+o],e,o),a===I&&(a=this._$AH[o]),i||=!T(a)||a!==this._$AH[o],a===V?t=V:t!==V&&(t+=(a??"")+n[o+1]),this._$AH[o]=a}i&&!r&&this.j(t)}j(t){t===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends Y{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===V?void 0:t}}class et extends Y{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==V)}}class st extends Y{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??V)===I)return;const s=this._$AH,r=t===V&&s!==V||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==V&&(s===V||r);r&&this.element.removeEventListener(this.name,this,s),n&&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 rt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const nt=w.litHtmlPolyfillSupport;nt?.(G,X),(w.litHtmlVersions??=[]).push("3.0.0");const it=(t,e,s)=>{const r=s?.renderBefore??e;let n=r._$litPart$;if(void 0===n){const t=s?.renderBefore??null;r._$litPart$=n=new X(e.insertBefore(U(),t),t,void 0,s??{})}return n._$AI(t),n};let ot=class extends v{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=it(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return I}};ot._$litElement$=!0,ot.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ot});const at=globalThis.litElementPolyfillSupport;function ct(t,e){let s,r,n=[];function i(){s=[],r&&clearTimeout(r),r=void 0,n=[]}return i(),(...o)=>{s=o,r&&clearTimeout(r);const a=new Promise(((t,e)=>{n.push({resolve:t,reject:e})}));return r=setTimeout((()=>{Promise.resolve().then((()=>e(...s))).then((t=>{for(const{resolve:e}of n)e(t);i()})).catch((t=>{for(const{reject:e}of n)e(t);i()}))}),t),a}}at?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.0.0");class ht extends Error{name=this.constructor.name}class lt{#t;#e=!1;#s;#r=new Set;accessed=!1;constructor(t){this.#t=t,this.#s=Promise.resolve(t)}subscribe(t){return this.#r.add(t),()=>{this.#r.delete(t)}}clear(){return this.#r.clear()}#n=ct(0,(()=>{const t=this.#t;this.#e=!0;for(const e of this.#r)e(t);return this.#e=!1,t}));async publish(){this.#s=this.#n(),await this.#s}get wait(){return this.#s}get value(){return this.accessed=!0,this.#t}set value(t){if(this.#e)throw new ht("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#t=t,this.publish()}}const ut=(t,...e)=>B(t,...e.map((t=>t instanceof lt?t.value:t)));class dt{#i=!1;lock(t){this.#i=!0,t(),this.#i=!1}get locked(){return this.#i}}const pt=()=>new Map,ft=()=>new Set;function $t(t){return new _t(t)}class _t{map;constructor(t){this.map=t}grab(t,e){const{map:s}=this;if(s.has(t))return s.get(t);{const r=e();return s.set(t,r),r}}}class gt{#o=new WeakMap;grab_keymap(t){const e=$t(this.#o).grab(t,pt);return{keymap:e,grab_symbolmap:t=>$t(e).grab(t,pt)}}clear(){this.#o=new WeakMap}}class mt{#a=new Map;stop(t){const e=this.#a.get(t);e&&(this.#a.delete(t),e())}add(t,e){this.#a.set(t,e)}}class yt{#c=[];record(t){const e=pt();return this.#c.push(e),t(),this.#c.pop(),e}record_that_key_was_accessed(t,e){const s=this.#c.at(-1);if(s){$t(s).grab(t,ft).add(e)}}}class bt extends Error{name=this.constructor.name}class At extends bt{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}}class vt extends bt{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}}function wt(t){return new Proxy(t,{get:(t,e)=>t[e],set(t,e){throw new vt(e)}})}class St{#h=new Map;#s=Promise.resolve();#l=ct(0,(()=>{const t=[...this.#h.values()];this.#h.clear();for(const e of t)e()}));get wait(){return this.#s}add(t,e){this.#h.set(t,e),this.#s=this.#l()}}function xt(t){return function(e){return()=>{const s="function"==typeof t?t():t;return e(s)}}}function Et(t,e,s,r){const n=[];for(const[i,o]of e){const{grab_symbolmap:e}=s.grab_keymap(i);for(const s of o){const i=e(s);i.set(t,r),n.push((()=>i.delete(t)))}}return()=>n.forEach((t=>t()))}class kt{static readonly=wt;static collectivize=xt;#u=new gt;#d=new yt;#p=new dt;#f=new mt;#$=new St;#_=function(t,e,s,r,n){function i([n,i]){if(s.lock(i.responder),i.discover){r.stop(n);const o=e.record((()=>s.lock(i.collector)));r.add(n,Et(n,o,t,i))}}return{get:(t,s)=>(e.record_that_key_was_accessed(t,s),t[s]),set:(e,r,o)=>{if(s.locked)throw new At(r);e[r]=o;const a=[...t.grab_keymap(e).grab_symbolmap(r)];for(const t of a){const[e,s]=t;s.debounce?n.add(e,(()=>i(t))):i(t)}return!0}}}(this.#u,this.#d,this.#p,this.#f,this.#$);get wait(){return this.#$.wait}state(t){return new Proxy(t,this.#_)}manual(t){const e=Symbol(),s=this.#d.record((()=>this.#p.lock(t.collector)));return this.#f.add(e,Et(e,s,this.#u,t)),()=>this.#f.stop(e)}auto({debounce:t,discover:e,collector:s,responder:r}){return this.manual({debounce:t,discover:e,collector:s,responder:r?()=>r(s()):s})}reaction(t,e){return this.auto({debounce:!0,discover:!1,collector:t,responder:e})}deepReaction(t,e){return this.auto({debounce:!0,discover:!0,collector:t,responder:e})}clear(){this.#u.clear()}}var Ct;!function(t){var e;t.map=(t,e)=>Object.fromEntries(Object.entries(t).map((([t,s])=>[t,e(s,t)]))),t.filter=(t,e)=>Object.fromEntries(Object.entries(t).filter((([t,s])=>e(s,t)))),(e=t.pipe||(t.pipe={})).map=e=>s=>t.map(s,e),e.filter=e=>s=>t.filter(s,e)}(Ct||(Ct={}));const Mt=Error;var Pt,Ut;!function(t){function e(t,e){switch(t.mode){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 Mt("invalid op mode")}}t.loading=()=>({mode:"loading"}),t.error=t=>({mode:"error",reason:t}),t.ready=t=>({mode:"ready",payload:t}),t.is=Object.freeze({loading:t=>"loading"===t.mode,error:t=>"error"===t.mode,ready:t=>"ready"===t.mode}),t.payload=function(t){return"ready"===t.mode?t.payload:void 0},t.select=e,t.run=async function(e,s){e(t.loading());try{const r=await s();return e(t.ready(r)),r}catch(s){const r=s instanceof Mt?s.message:"string"==typeof s?s:"error";e(t.error(r))}},t.morph=function(s,r){return e(s,{loading:()=>t.loading(),error:e=>t.error(e),ready:e=>t.ready(r(e))})}}(Pt||(Pt={}));class Tt extends lt{constructor(){super(Pt.loading())}async run(t){return Pt.run((t=>this.value=t),t)}get payload(){return Pt.payload(this.value)}is={loading:()=>Pt.is.loading(this.value),error:()=>Pt.is.error(this.value),ready:()=>Pt.is.ready(this.value)};select(t){return Pt.select(this.value,t)}}class Nt{#g=new Set;signal(t){const e=new lt(t);return this.#g.add(e),e}computed(t){const e=this.signal(t());return this.track(t,(()=>e.value=t())),e}op(){const t=new Tt;return this.#g.add(t),t}many(t){return Ct.map(t,(t=>this.signal(t)))}track(t,e){const s=ct(0,e),r=[];for(const t of this.#g)t.accessed=!1;t();for(const t of this.#g)t.accessed&&r.push(t);const n=r.map((t=>t.subscribe((()=>s()))));return()=>n.forEach((t=>t()))}}class Ot{theme=i``;flat=new kt;tower=new Nt}class Ht{static with(t){return new this(t)}#m;constructor(t){this.#m=t}to(t){return new Ht(t(this.#m))}done(){return this.#m}}class Rt extends(function(t){return class extends t{#y=(new Set).add((()=>this.setup()));#b=new Set;register_setup(t){this.#y.add(t)}setup(){return()=>{}}connectedCallback(){for(const t of this.#y)this.#b.add(t())}disconnectedCallback(){for(const t of this.#b)t();this.#b.clear()}}}(HTMLElement)){}function jt(){let t,e;return{promise:new Promise(((s,r)=>{t=s,e=r})),resolve:t,reject:e}}function zt(t,e){o(t,function(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}(e))}class qt extends Rt{static styles;#A;#v=jt();#s=this.#v.promise;init(){}constructor(){super(),this.#A=this.attachShadow({mode:"open"});const t=this.constructor;zt(this.#A,t.styles),this.init()}get root(){return this.#A}get updateComplete(){return this.#s.then((()=>!0))}render(){}#w=ct(0,(()=>{const t=this.#A,e=this.render();e&&it(e,t,{host:this})}));async requestUpdate(){const t=this.#w();return this.#v&&(t.then(this.#v.resolve),this.#v=void 0),this.#s=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}class Lt{static wrap(t,e){return(...s)=>(t.#S.value=0,e(...s))}static disconnect(t){for(const e of t.#b)e();t.#b.clear()}static reconnect(t){for(const e of t.#y.values())t.#b.add(e())}#x;#E;#S={value:0};#y=new Map;#b=new Set;#k=new Map;#C=new Map;#M=new Map;#g=new Map;constructor(t,e){this.#E=t,this.#x=e}get context(){return this.#x}rerender(){this.#E()}setup(t){const e=this.#S.value;this.#y.has(e)||(this.#y.set(e,t),this.#b.add(t()))}prepare(t){const e=this.#S.value++;return $t(this.#C).grab(e,t)}state(t){const e=this.#S.value++;return[$t(this.#k).grab(e,(()=>"function"==typeof t?t():t)),t=>{this.#k.set(e,t),this.#E()},()=>this.#k.get(e)]}flatstate(t){const e=this.#S.value++;return $t(this.#M).grab(e,(()=>this.#x.flat.state("function"==typeof t?t():t)))}signal(t){const e=this.#S.value++;return $t(this.#g).grab(e,(()=>this.#x.tower.signal("function"==typeof t?t():t)))}op(){const t=this.#S.value++;return $t(this.#g).grab(t,(()=>this.#x.tower.op()))}}class Dt extends Lt{#P;get element(){return this.#P}#U;get shadow(){return this.#U}constructor(t,e,s,r){super(s,r),this.#P=t,this.#U=e}}function Bt(t){let e;return function(s){return e||(e=Ut.base(t,s)),e}}!function(t){function e(t,e){const s=new MutationObserver(e);return s.observe(t,{attributes:!0}),()=>s.disconnect()}t.proxy=(t,e)=>new Proxy(e,{get:(s,r)=>{const n=e[r],i=t.getAttribute(r);switch(n){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 "${r}"`)}},set:(s,r,n)=>{switch(e[r]){case String:return t.setAttribute(r,n),!0;case Number:return t.setAttribute(r,n.toString()),!0;case Boolean:return n?t.setAttribute(r,""):t.removeAttribute(r),!0;default:throw new Error(`invalid attribute type for "${r}"`)}}}),t.on_change=e,t.base=function(s,r){return e(s,(()=>s.requestUpdate())),t.proxy(s,r)}}(Ut||(Ut={}));class It extends Dt{attrs;constructor(t,e,s,r){super(t,e,s,r),this.attrs=Bt(t)}}class Vt extends Lt{#P;get element(){return this.#P}attrs;constructor(t,e,s){super(e,s),this.#P=t,this.attrs=Bt(t)}}class Wt extends It{}class Zt extends Vt{}class Jt extends Lt{}class Kt extends Dt{}function Gt(t,e,s){let r,n;return function(...i){let o;return n&&n(),n=t.flat.manual({debounce:!0,discover:!1,collector:()=>{o=function(...n){let i;return r&&r(),r=t.tower.track((()=>{i=e(...n)}),s),i}(...i)},responder:s}),o}}const Qt=t=>(e,s)=>class extends qt{static name=e.name;static styles=[t.theme,e.styles??i``];#T=new Wt(this,this.root,(()=>{this.requestUpdate()}),t);#N=Wt.wrap(this.#T,(()=>s(this.#T)));#O=Gt(t,this.#N,(()=>{this.requestUpdate()}));render(){return this.#O()}connectedCallback(){super.connectedCallback(),Wt.reconnect(this.#T)}disconnectedCallback(){super.disconnectedCallback(),Wt.disconnect(this.#T)}};class Ft extends Rt{#v=jt();#s=this.#v.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#s.then((()=>!0))}render(){}#w=ct(0,(()=>{const t=this.render();it(t,this,{host:this})}));async requestUpdate(){const t=this.#w();return this.#v&&(t.then(this.#v.resolve),this.#v=void 0),this.#s=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}const Xt=t=>e=>class extends Ft{#T=new Zt(this,(()=>{this.requestUpdate()}),t);#N=Zt.wrap(this.#T,(()=>e(this.#T)));#O=Gt(t,this.#N,(()=>{this.requestUpdate()}));render(){return this.#O()}connectedCallback(){super.connectedCallback(),Zt.reconnect(this.#T)}disconnectedCallback(){super.disconnectedCallback(),Zt.disconnect(this.#T)}},Yt=2;class te{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const ee=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),ee(t,e);return!0},se=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},re=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),oe(e)}};function ne(t){void 0!==this._$AN?(se(this),this._$AM=t,re(this)):this._$AM=t}function ie(t,e=!1,s=0){const r=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(r))for(let t=s;t<r.length;t++)ee(r[t],!1),se(r[t]);else null!=r&&(ee(r,!1),se(r));else ee(this,t)}const oe=t=>{t.type==Yt&&(t._$AP??=ie,t._$AQ??=ne)};class ae extends te{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),re(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(ee(this,t),se(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(){}}const ce=t=>e=>(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends ae{#H;#E=ct(0,(()=>{this.#H&&this.setValue(this.render(...this.#H))}));#T=new Jt(this.#E,t);#N=Jt.wrap(this.#T,e(this.#T));#O=Gt(t,this.#N,this.#E);render(...t){return this.#H=t,this.#O(...t)}reconnected(){Jt.reconnect(this.#T)}disconnected(){Jt.disconnect(this.#T)}});var he;function le(t){return[t].flat().filter((t=>!!t))}!function(t){t.css=function(...t){return function(e){return class extends e{static styles=function(t,e){const s=[...le(t)??[],...le(e)];return s.flat().filter(ue)}(e.styles,t)}}},t.signals=function(t){return function(e){return class extends e{#R=[];connectedCallback(){super.connectedCallback(),this.#R.push(t.track((()=>this.render()),(()=>this.requestUpdate())))}disconnectedCallback(){super.disconnectedCallback();for(const t of this.#R)t();this.#R=[]}}}},t.flat=function(t){return function(e){return class extends e{#j=void 0;render(){let e;return this.#j&&this.#j(),this.#j=t.manual({debounce:!1,discover:!1,collector:()=>{e=super.render()},responder:()=>{this.requestUpdate()}}),e}disconnectedCallback(){super.disconnectedCallback(),this.#j&&this.#j(),this.#j=void 0}}}}}(he||(he={}));const ue=t=>void 0!==t;const de=t=>{for(const[e,s]of Object.entries(t))customElements.define(e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase(),s)};class pe extends HTMLElement{static tag="obsidian-view"}function fe(...t){const e=new Set,s=t.map((t=>t??"")).flatMap($e);for(const t of s)e.add(t);return e}function $e(t){return t.split(/\s+/).map((t=>t.trim())).filter((t=>!!t))}function _e(t){return t.split(",").map((t=>t.trim())).filter((t=>!!t)).map((t=>t.includes(":")?t.split(":").map((t=>t.trim()))[1]:t))}function ge(t,e){const s=fe(t.getAttribute("part")),r=fe(t.getAttribute("data-gpart")),n=function(t,e){return Object.fromEntries(Object.entries(e).map((([e,s])=>[e,Array.from(t.querySelectorAll(`[${s}]`)).map((t=>t.getAttribute(s)))])))}(e,{part:"part",gpart:"data-gpart",exportparts:"exportparts",gexportparts:"gexportparts"}),i=new Set([...n.part.flatMap($e),...n.exportparts.flatMap(_e)]),o=new Set([...n.gpart.flatMap($e),...n.gexportparts.flatMap($e)]);i.size&&t.setAttribute("exportparts",[...s].flatMap(function(t,e){return s=>[...t].flatMap((t=>[`${t}:${s}-${t}`,...e.has(t)?[t]:[]]))}(i,o)).join(", ")),(o.size||t.hasAttribute("data-gpart"))&&t.setAttribute("gexportparts",[...o,...[...r].flatMap((t=>[...i].map((e=>`${t}-${e}`))))].join(" "))}function me(t,e={},s={}){const{content:r,attrs:n={}}=e,{attrs:i={}}=s;function o(e,s,r,n){e!==s&&(void 0===e?t.removeAttribute(r):t.setAttribute(r,n()))}n&&function(t,e){for(const[s,r]of Object.entries(e))"string"==typeof r?t.setAttribute(s,r):"number"==typeof r?t.setAttribute(s,r.toString()):"boolean"==typeof r?!0===r?t.setAttribute(s,""):t.removeAttribute(s):void 0===r?t.removeAttribute(s):console.warn(`invalid attribute type ${s} is ${typeof r}`)}(t,n),o(n.class,i?.class,"class",(()=>n.class)),o(n.part,i?.part,"part",(()=>n.part)),o(n.gpart,i?.gpart,"data-gpart",(()=>n.gpart)),r&&it(r,t,{host:t})}de({ObsidianView:pe});const ye=t=>(e={},s)=>(t=>(e,s={})=>({_$litDirective$:t,values:[{meta:s,props:e}]}))(class extends ae{#m;#A=function(t,e){const s=document.createElement(pe.tag);s.setAttribute("view",t);const r=s.attachShadow({mode:"open"});zt(r,e);let n=!1;return{container:s,shadow:r,set auto_exportparts(t){n=t},render_into_shadow:t=>(it(t,r),n&&ge(s,r),s)}}(e.name??"",[t.theme,e.styles??i``]);#E=ct(0,(()=>{this.#m&&this.setValue(this.#A.render_into_shadow(this.render(this.#m)))}));#T=new Kt(this.#A.container,this.#A.shadow,this.#E,t);#N=Kt.wrap(this.#T,s(this.#T));#O=Gt(t,this.#N,this.#E);update(t,e){return this.#A.render_into_shadow(this.render(...e))}render(t){return me(this.#A.container,t.meta,this.#m?.meta),this.#m=t,this.#A.auto_exportparts=t.meta.auto_exportparts??e.auto_exportparts??!0,this.#O(...t.props)}reconnected(){Kt.reconnect(this.#T)}disconnected(){Kt.disconnect(this.#T)}});const{oxygen:be,carbon:Ae,quartz:ve,obsidian:we,component:Se}=(xe=new class extends Ot{theme=i`
button {
padding: 0.5em;
font-style: italic;
}
`},{oxygen:Xt(xe),carbon:Qt(xe),quartz:ce(xe),obsidian:ye(xe),component:t=>Ht.with(t(xe)).to(he.css(xe.theme)).to(he.flat(xe.flat)).to(he.signals(xe.tower)).done()});var xe;const Ee=Se((t=>class extends qt{#z=t.flat.state({count:0});render(){return B`
Array.prototype.at=function(t){return t>=0?this[t]:this[this.length+t]};const t=globalThis,e=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),r=new WeakMap;let n=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const s=this.t;if(e&&void 0===t){const e=void 0!==s&&1===s.length;e&&(t=r.get(s)),void 0===t&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),e&&r.set(s,t))}return t}toString(){return this.cssText}};const i=(t,...e)=>{const r=1===t.length?t[0]:e.reduce(((e,s,r)=>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.")})(s)+t[r+1]),t[0]);return new n(r,t,s)},o=(s,r)=>{if(e)s.adoptedStyleSheets=r.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet));else for(const e of r){const r=document.createElement("style"),n=t.litNonce;void 0!==n&&r.setAttribute("nonce",n),r.textContent=e.cssText,s.appendChild(r)}},a=e?t=>t:t=>t instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return(t=>new n("string"==typeof t?t:t+"",void 0,s))(e)})(t):t,{is:c,defineProperty:h,getOwnPropertyDescriptor:l,getOwnPropertyNames:u,getOwnPropertySymbols:d,getPrototypeOf:p}=Object,f=globalThis,$=f.trustedTypes,_=$?$.emptyScript:"",g=f.reactiveElementPolyfillSupport,m=(t,e)=>t,y={toAttribute(t,e){switch(e){case Boolean:t=t?_:null;break;case Object:case Array:t=null==t?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=null!==t;break;case Number:s=null===t?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch(t){s=null}}return s}},b=(t,e)=>!c(t,e),v={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:b};Symbol.metadata??=Symbol("metadata"),f.litPropertyMetadata??=new WeakMap;class A 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=v){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){const s=Symbol(),r=this.getPropertyDescriptor(t,s,e);void 0!==r&&h(this.prototype,t,r)}}static getPropertyDescriptor(t,e,s){const{get:r,set:n}=l(this.prototype,t)??{get(){return this[e]},set(t){this[e]=t}};return{get(){return r?.call(this)},set(e){const i=r?.call(this);n.call(this,e),this.requestUpdate(t,i,s)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??v}static _$Ei(){if(this.hasOwnProperty(m("elementProperties")))return;const t=p(this);t.finalize(),void 0!==t.l&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(m("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(m("properties"))){const t=this.properties,e=[...u(t),...d(t)];for(const s of e)this.createProperty(s,t[s])}const t=this[Symbol.metadata];if(null!==t){const e=litPropertyMetadata.get(t);if(void 0!==e)for(const[t,s]of e)this.elementProperties.set(t,s)}this._$Eh=new Map;for(const[t,e]of this.elementProperties){const s=this._$Eu(t,e);void 0!==s&&this._$Eh.set(s,t)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}static _$Eu(t,e){const s=e.attribute;return!1===s?void 0:"string"==typeof s?s:"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._$Eg=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach((t=>t(this)))}addController(t){(this._$ES??=[]).push(t),void 0!==this.renderRoot&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$ES?.splice(this._$ES.indexOf(t)>>>0,1)}_$E_(){const t=new Map,e=this.constructor.elementProperties;for(const s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._$Ep=t)}createRenderRoot(){const t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return o(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$ES?.forEach((t=>t.hostConnected?.()))}enableUpdating(t){}disconnectedCallback(){this._$ES?.forEach((t=>t.hostDisconnected?.()))}attributeChangedCallback(t,e,s){this._$AK(t,s)}_$EO(t,e){const s=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,s);if(void 0!==r&&!0===s.reflect){const n=(void 0!==s.converter?.toAttribute?s.converter:y).toAttribute(e,s.type);this._$Em=t,null==n?this.removeAttribute(r):this.setAttribute(r,n),this._$Em=null}}_$AK(t,e){const s=this.constructor,r=s._$Eh.get(t);if(void 0!==r&&this._$Em!==r){const t=s.getPropertyOptions(r),n="function"==typeof t.converter?{fromAttribute:t.converter}:void 0!==t.converter?.fromAttribute?t.converter:y;this._$Em=r,this[r]=n.fromAttribute(e,t.type),this._$Em=null}}requestUpdate(t,e,s,r=!1,n){if(void 0!==t){if(s??=this.constructor.getPropertyOptions(t),!(s.hasChanged??b)(r?n:this[t],e))return;this.C(t,e,s)}!1===this.isUpdatePending&&(this._$Eg=this._$EP())}C(t,e,s){this._$AL.has(t)||this._$AL.set(t,e),!0===s.reflect&&this._$Em!==t&&(this._$Ej??=new Set).add(t)}async _$EP(){this.isUpdatePending=!0;try{await this._$Eg}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._$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,s]of t)!0!==s.wrapped||this._$AL.has(e)||void 0===this[e]||this.C(e,this[e],s)}let t=!1;const e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$ES?.forEach((t=>t.hostUpdate?.())),this.update(e)):this._$ET()}catch(e){throw t=!1,this._$ET(),e}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$ES?.forEach((t=>t.hostUpdated?.())),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$ET(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$Eg}shouldUpdate(t){return!0}update(t){this._$Ej&&=this._$Ej.forEach((t=>this._$EO(t,this[t]))),this._$ET()}updated(t){}firstUpdated(t){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[m("elementProperties")]=new Map,A[m("finalized")]=new Map,g?.({ReactiveElement:A}),(f.reactiveElementVersions??=[]).push("2.0.0");const w=globalThis,S=w.trustedTypes,x=S?S.createPolicy("lit-html",{createHTML:t=>t}):void 0,E="$lit$",k=`lit$${(Math.random()+"").slice(9)}$`,C="?"+k,M=`<${C}>`,P=document,U=()=>P.createComment(""),T=t=>null===t||"object"!=typeof t&&"function"!=typeof t,N=Array.isArray,O="[ \t\n\f\r]",H=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,R=/-->/g,j=/>/g,z=RegExp(`>|${O}(?:([^\\s"'>=/]+)(${O}*=${O}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,L=/"/g,D=/^(?:script|style|textarea|title)$/i,B=(t=>(e,...s)=>({_$litType$:t,strings:e,values:s}))(1),I=Symbol.for("lit-noChange"),V=Symbol.for("lit-nothing"),W=new WeakMap,Z=P.createTreeWalker(P,129);function J(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==x?x.createHTML(e):e}const K=(t,e)=>{const s=t.length-1,r=[];let n,i=2===e?"<svg>":"",o=H;for(let e=0;e<s;e++){const s=t[e];let a,c,h=-1,l=0;for(;l<s.length&&(o.lastIndex=l,c=o.exec(s),null!==c);)l=o.lastIndex,o===H?"!--"===c[1]?o=R:void 0!==c[1]?o=j:void 0!==c[2]?(D.test(c[2])&&(n=RegExp("</"+c[2],"g")),o=z):void 0!==c[3]&&(o=z):o===z?">"===c[0]?(o=n??H,h=-1):void 0===c[1]?h=-2:(h=o.lastIndex-c[2].length,a=c[1],o=void 0===c[3]?z:'"'===c[3]?L:q):o===L||o===q?o=z:o===R||o===j?o=H:(o=z,n=void 0);const u=o===z&&t[e+1].startsWith("/>")?" ":"";i+=o===H?s+M:h>=0?(r.push(a),s.slice(0,h)+E+s.slice(h)+k+u):s+k+(-2===h?e:u)}return[J(t,i+(t[s]||"<?>")+(2===e?"</svg>":"")),r]};class G{constructor({strings:t,_$litType$:e},s){let r;this.parts=[];let n=0,i=0;const o=t.length-1,a=this.parts,[c,h]=K(t,e);if(this.el=G.createElement(c,s),Z.currentNode=this.el.content,2===e){const t=this.el.content.firstChild;t.replaceWith(...t.childNodes)}for(;null!==(r=Z.nextNode())&&a.length<o;){if(1===r.nodeType){if(r.hasAttributes())for(const t of r.getAttributeNames())if(t.endsWith(E)){const e=h[i++],s=r.getAttribute(t).split(k),o=/([.?@])?(.*)/.exec(e);a.push({type:1,index:n,name:o[2],strings:s,ctor:"."===o[1]?tt:"?"===o[1]?et:"@"===o[1]?st:Y}),r.removeAttribute(t)}else t.startsWith(k)&&(a.push({type:6,index:n}),r.removeAttribute(t));if(D.test(r.tagName)){const t=r.textContent.split(k),e=t.length-1;if(e>0){r.textContent=S?S.emptyScript:"";for(let s=0;s<e;s++)r.append(t[s],U()),Z.nextNode(),a.push({type:2,index:++n});r.append(t[e],U())}}}else if(8===r.nodeType)if(r.data===C)a.push({type:2,index:n});else{let t=-1;for(;-1!==(t=r.data.indexOf(k,t+1));)a.push({type:7,index:n}),t+=k.length-1}n++}}static createElement(t,e){const s=P.createElement("template");return s.innerHTML=t,s}}function Q(t,e,s=t,r){if(e===I)return e;let n=void 0!==r?s._$Co?.[r]:s._$Cl;const i=T(e)?void 0:e._$litDirective$;return n?.constructor!==i&&(n?._$AO?.(!1),void 0===i?n=void 0:(n=new i(t),n._$AT(t,s,r)),void 0!==r?(s._$Co??=[])[r]=n:s._$Cl=n),void 0!==n&&(e=Q(t,n._$AS(t,e.values),n,r)),e}class F{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:s}=this._$AD,r=(t?.creationScope??P).importNode(e,!0);Z.currentNode=r;let n=Z.nextNode(),i=0,o=0,a=s[0];for(;void 0!==a;){if(i===a.index){let e;2===a.type?e=new X(n,n.nextSibling,this,t):1===a.type?e=new a.ctor(n,a.name,a.strings,this,t):6===a.type&&(e=new rt(n,this,t)),this._$AV.push(e),a=s[++o]}i!==a?.index&&(n=Z.nextNode(),i++)}return Z.currentNode=P,r}p(t){let e=0;for(const s of this._$AV)void 0!==s&&(void 0!==s.strings?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class X{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,s,r){this.type=2,this._$AH=V,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=r,this._$Cv=r?.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=Q(this,t,e),T(t)?t===V||null==t||""===t?(this._$AH!==V&&this._$AR(),this._$AH=V):t!==this._$AH&&t!==I&&this._(t):void 0!==t._$litType$?this.g(t):void 0!==t.nodeType?this.$(t):(t=>N(t)||"function"==typeof t?.[Symbol.iterator])(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==V&&T(this._$AH)?this._$AA.nextSibling.data=t:this.$(P.createTextNode(t)),this._$AH=t}g(t){const{values:e,_$litType$:s}=t,r="number"==typeof s?this._$AC(t):(void 0===s.el&&(s.el=G.createElement(J(s.h,s.h[0]),this.options)),s);if(this._$AH?._$AD===r)this._$AH.p(e);else{const t=new F(r,this),s=t.u(this.options);t.p(e),this.$(s),this._$AH=t}}_$AC(t){let e=W.get(t.strings);return void 0===e&&W.set(t.strings,e=new G(t)),e}T(t){N(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,r=0;for(const n of t)r===e.length?e.push(s=new X(this.k(U()),this.k(U()),this,this.options)):s=e[r],s._$AI(n),r++;r<e.length&&(this._$AR(s&&s._$AB.nextSibling,r),e.length=r)}_$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 Y{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,r,n){this.type=1,this._$AH=V,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,s.length>2||""!==s[0]||""!==s[1]?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=V}_$AI(t,e=this,s,r){const n=this.strings;let i=!1;if(void 0===n)t=Q(this,t,e,0),i=!T(t)||t!==this._$AH&&t!==I,i&&(this._$AH=t);else{const r=t;let o,a;for(t=n[0],o=0;o<n.length-1;o++)a=Q(this,r[s+o],e,o),a===I&&(a=this._$AH[o]),i||=!T(a)||a!==this._$AH[o],a===V?t=V:t!==V&&(t+=(a??"")+n[o+1]),this._$AH[o]=a}i&&!r&&this.j(t)}j(t){t===V?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class tt extends Y{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===V?void 0:t}}class et extends Y{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==V)}}class st extends Y{constructor(t,e,s,r,n){super(t,e,s,r,n),this.type=5}_$AI(t,e=this){if((t=Q(this,t,e,0)??V)===I)return;const s=this._$AH,r=t===V&&s!==V||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,n=t!==V&&(s===V||r);r&&this.element.removeEventListener(this.name,this,s),n&&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 rt{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){Q(this,t)}}const nt=w.litHtmlPolyfillSupport;nt?.(G,X),(w.litHtmlVersions??=[]).push("3.0.0");const it=(t,e,s)=>{const r=s?.renderBefore??e;let n=r._$litPart$;if(void 0===n){const t=s?.renderBefore??null;r._$litPart$=n=new X(e.insertBefore(U(),t),t,void 0,s??{})}return n._$AI(t),n};let ot=class extends A{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=it(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return I}};ot._$litElement$=!0,ot.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:ot});const at=globalThis.litElementPolyfillSupport;at?.({LitElement:ot}),(globalThis.litElementVersions??=[]).push("4.0.0");class ct{#t=!1;lock(t){this.#t=!0,t(),this.#t=!1}get locked(){return this.#t}}const ht=()=>new Map,lt=()=>new Set;function ut(t){return new dt(t)}class dt{map;constructor(t){this.map=t}grab(t,e){const{map:s}=this;if(s.has(t))return s.get(t);{const r=e();return s.set(t,r),r}}}class pt{#e=new WeakMap;grab_keymap(t){const e=ut(this.#e).grab(t,ht);return{keymap:e,grab_symbolmap:t=>ut(e).grab(t,ht)}}clear(){this.#e=new WeakMap}}class ft{#s=new Map;stop(t){const e=this.#s.get(t);e&&(this.#s.delete(t),e())}add(t,e){this.#s.set(t,e)}}class $t{#r=[];record(t){const e=ht();return this.#r.push(e),t(),this.#r.pop(),e}record_that_key_was_accessed(t,e){const s=this.#r.at(-1);if(s){ut(s).grab(t,lt).add(e)}}}class _t extends Error{name=this.constructor.name}class gt extends _t{constructor(t){super(`forbidden circularity, rejected assignment to "${t}"`)}}class mt extends _t{constructor(t){super(`forbidden assignment to readonly property "${t}"`)}}function yt(t){return new Proxy(t,{get:(t,e)=>t[e],set(t,e){throw new mt(e)}})}function bt(t,e){let s,r,n=[];function i(){s=[],r&&clearTimeout(r),r=void 0,n=[]}return i(),(...o)=>{s=o,r&&clearTimeout(r);const a=new Promise(((t,e)=>{n.push({resolve:t,reject:e})}));return r=setTimeout((()=>{Promise.resolve().then((()=>e(...s))).then((t=>{for(const{resolve:e}of n)e(t);i()})).catch((t=>{for(const{reject:e}of n)e(t);i()}))}),t),a}}class vt{#n=new Map;#i=Promise.resolve();#o=bt(0,(()=>{const t=[...this.#n.values()];this.#n.clear();for(const e of t)e()}));get wait(){return this.#i}add(t,e){this.#n.set(t,e),this.#i=this.#o()}}function At(t){return function(e){return()=>{const s="function"==typeof t?t():t;return e(s)}}}function wt(t,e,s,r){const n=[];for(const[i,o]of e){const{grab_symbolmap:e}=s.grab_keymap(i);for(const s of o){const i=e(s);i.set(t,r),n.push((()=>i.delete(t)))}}return()=>n.forEach((t=>t()))}class St{static readonly=yt;static collectivize=At;#a=new pt;#c=new $t;#h=new ct;#l=new ft;#u=new vt;#d=function(t,e,s,r,n){function i([n,i]){if(s.lock(i.responder),i.discover){r.stop(n);const o=e.record((()=>s.lock(i.collector)));r.add(n,wt(n,o,t,i))}}return{get:(t,s)=>(e.record_that_key_was_accessed(t,s),t[s]),set:(e,r,o)=>{if(s.locked)throw new gt(r);e[r]=o;const a=[...t.grab_keymap(e).grab_symbolmap(r)];for(const t of a){const[e,s]=t;s.debounce?n.add(e,(()=>i(t))):i(t)}return!0}}}(this.#a,this.#c,this.#h,this.#l,this.#u);get wait(){return this.#u.wait}state(t){return new Proxy(t,this.#d)}manual(t){const e=Symbol(),s=this.#c.record((()=>this.#h.lock(t.collector)));return this.#l.add(e,wt(e,s,this.#a,t)),()=>this.#l.stop(e)}auto({debounce:t,discover:e,collector:s,responder:r}){return this.manual({debounce:t,discover:e,collector:s,responder:r?()=>r(s()):s})}reaction(t,e){return this.auto({debounce:!0,discover:!1,collector:t,responder:e})}deepReaction(t,e){return this.auto({debounce:!0,discover:!0,collector:t,responder:e})}clear(){this.#a.clear()}}var xt;!function(t){var e;t.map=(t,e)=>Object.fromEntries(Object.entries(t).map((([t,s])=>[t,e(s,t)]))),t.filter=(t,e)=>Object.fromEntries(Object.entries(t).filter((([t,s])=>e(s,t)))),(e=t.pipe||(t.pipe={})).map=e=>s=>t.map(s,e),e.filter=e=>s=>t.filter(s,e)}(xt||(xt={}));class Et extends Error{name=this.constructor.name}class kt{#p;#f=!1;#i;#$=new Set;accessed=!1;constructor(t){this.#p=t,this.#i=Promise.resolve(t)}subscribe(t){return this.#$.add(t),()=>{this.#$.delete(t)}}clear(){return this.#$.clear()}#_=bt(0,(()=>{const t=this.#p;this.#f=!0;for(const e of this.#$)e(t);return this.#f=!1,t}));async publish(){this.#i=this.#_(),await this.#i}get wait(){return this.#i}get value(){return this.accessed=!0,this.#p}set value(t){if(this.#f)throw new Et("you can't set a signal in a signal's subscription listener (infinite loop forbidden)");this.#p=t,this.publish()}}const Ct=Error;var Mt,Pt;!function(t){function e(t,e){switch(t.mode){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 Ct("invalid op mode")}}t.loading=()=>({mode:"loading"}),t.error=t=>({mode:"error",reason:t}),t.ready=t=>({mode:"ready",payload:t}),t.is=Object.freeze({loading:t=>"loading"===t.mode,error:t=>"error"===t.mode,ready:t=>"ready"===t.mode}),t.payload=function(t){return"ready"===t.mode?t.payload:void 0},t.select=e,t.run=async function(e,s){e(t.loading());try{const r=await s();return e(t.ready(r)),r}catch(s){const r=s instanceof Ct?s.message:"string"==typeof s?s:"error";e(t.error(r))}},t.morph=function(s,r){return e(s,{loading:()=>t.loading(),error:e=>t.error(e),ready:e=>t.ready(r(e))})}}(Mt||(Mt={}));class Ut extends kt{constructor(){super(Mt.loading())}async run(t){return Mt.run((t=>this.value=t),t)}setLoading(){this.value=Mt.loading()}setError(t){this.value=Mt.error(t)}setReady(t){this.value=Mt.ready(t)}get loading(){return Mt.is.loading(this.value)}get error(){return Mt.is.error(this.value)}get ready(){return Mt.is.ready(this.value)}get payload(){return Mt.payload(this.value)}select(t){return Mt.select(this.value,t)}}class Tt{#g=new Set;signal(t){const e=new kt(t);return this.#g.add(e),e}computed(t){const e=this.signal(t());return this.track(t,(()=>e.value=t())),e}op(){const t=new Ut;return this.#g.add(t),t}many(t){return xt.map(t,(t=>this.signal(t)))}track(t,e){const s=bt(0,e),r=[];for(const t of this.#g)t.accessed=!1;t();for(const t of this.#g)t.accessed&&r.push(t);const n=r.map((t=>t.subscribe((()=>s()))));return()=>n.forEach((t=>t()))}}class Nt{theme=i``;flat=new St;tower=new Tt}class Ot{static with(t){return new this(t)}#m;constructor(t){this.#m=t}to(t){return new Ot(t(this.#m))}done(){return this.#m}}class Ht extends(function(t){return class extends t{#y=(new Set).add((()=>this.setup()));#b=new Set;register_setup(t){this.#y.add(t)}setup(){return()=>{}}connectedCallback(){for(const t of this.#y)this.#b.add(t())}disconnectedCallback(){for(const t of this.#b)t();this.#b.clear()}}}(HTMLElement)){}function Rt(){let t,e;return{promise:new Promise(((s,r)=>{t=s,e=r})),resolve:t,reject:e}}function jt(t,e){o(t,function(t){const e=[];if(Array.isArray(t)){const s=new Set(t.flat(1/0).reverse());for(const t of s)e.unshift(a(t))}else void 0!==t&&e.push(a(t));return e}(e))}class zt extends Ht{static get styles(){}#v;#A=Rt();#i=this.#A.promise;init(){}constructor(){super(),this.#v=this.attachShadow({mode:"open"});const t=this.constructor;jt(this.#v,t.styles),this.init()}get root(){return this.#v}get updateComplete(){return this.#i.then((()=>!0))}render(){}#w=bt(0,(()=>{const t=this.#v,e=this.render();e&&it(e,t,{host:this})}));async requestUpdate(){const t=this.#w();return this.#A&&(t.then(this.#A.resolve),this.#A=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}class qt{static wrap(t,e){return(...s)=>(t.#S.value=0,e(...s))}static disconnect(t){for(const e of t.#b)e();t.#b.clear()}static reconnect(t){for(const e of t.#y.values())t.#b.add(e())}#x;#E;#S={value:0};#y=new Map;#b=new Set;#k=new Map;#C=new Map;#M=new Map;#g=new Map;constructor(t,e){this.#E=t,this.#x=e}get context(){return this.#x}rerender(){this.#E()}setup(t){const e=this.#S.value;this.#y.has(e)||(this.#y.set(e,t),this.#b.add(t()))}prepare(t){const e=this.#S.value++;return ut(this.#C).grab(e,t)}state(t){const e=this.#S.value++;return[ut(this.#k).grab(e,(()=>"function"==typeof t?t():t)),t=>{this.#k.set(e,t),this.#E()},()=>this.#k.get(e)]}flatstate(t){const e=this.#S.value++;return ut(this.#M).grab(e,(()=>this.#x.flat.state("function"==typeof t?t():t)))}signal(t){const e=this.#S.value++;return ut(this.#g).grab(e,(()=>this.#x.tower.signal("function"==typeof t?t():t)))}op(){const t=this.#S.value++;return ut(this.#g).grab(t,(()=>this.#x.tower.op()))}}class Lt extends qt{#P;get element(){return this.#P}#U;get shadow(){return this.#U}constructor(t,e,s,r){super(s,r),this.#P=t,this.#U=e}}function Dt(t){let e;return function(s){return e||(e=Pt.base(t,s)),e}}!function(t){function e(t,e){const s=new MutationObserver(e);return s.observe(t,{attributes:!0}),()=>s.disconnect()}t.proxy=(t,e)=>new Proxy(e,{get:(s,r)=>{const n=e[r],i=t.getAttribute(r);switch(n){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 "${r}"`)}},set:(s,r,n)=>{switch(e[r]){case String:return t.setAttribute(r,n),!0;case Number:return t.setAttribute(r,n.toString()),!0;case Boolean:return n?t.setAttribute(r,""):t.removeAttribute(r),!0;default:throw new Error(`invalid attribute type for "${r}"`)}}}),t.on_change=e,t.base=function(s,r){return e(s,(()=>s.requestUpdate())),t.proxy(s,r)}}(Pt||(Pt={}));class Bt extends Lt{attrs;constructor(t,e,s,r){super(t,e,s,r),this.attrs=Dt(t)}}class It extends qt{#P;get element(){return this.#P}attrs;constructor(t,e,s){super(e,s),this.#P=t,this.attrs=Dt(t)}}class Vt extends Bt{}class Wt extends It{}class Zt extends qt{}class Jt extends Lt{}function Kt(t,e,s){let r,n;return function(...i){let o;return n&&n(),n=t.flat.manual({debounce:!0,discover:!1,collector:()=>{o=function(...n){let i;return r&&r(),r=t.tower.track((()=>{i=e(...n)}),s),i}(...i)},responder:s}),o}}const Gt=t=>(e,s)=>class extends zt{static name=e.name;static get styles(){return[t.theme,e.styles??i``]}#T=new Vt(this,this.root,(()=>{this.requestUpdate()}),t);#N=Vt.wrap(this.#T,(()=>s(this.#T)));#O=Kt(t,this.#N,(()=>{this.requestUpdate()}));render(){return this.#O()}connectedCallback(){super.connectedCallback(),Vt.reconnect(this.#T)}disconnectedCallback(){super.disconnectedCallback(),Vt.disconnect(this.#T)}};class Qt extends Ht{#A=Rt();#i=this.#A.promise;init(){}constructor(){super(),this.init()}get updateComplete(){return this.#i.then((()=>!0))}render(){}#w=bt(0,(()=>{const t=this.render();it(t,this,{host:this})}));async requestUpdate(){const t=this.#w();return this.#A&&(t.then(this.#A.resolve),this.#A=void 0),this.#i=t,t}connectedCallback(){super.connectedCallback(),this.requestUpdate()}}const Ft=t=>e=>class extends Qt{#T=new Wt(this,(()=>{this.requestUpdate()}),t);#N=Wt.wrap(this.#T,(()=>e(this.#T)));#O=Kt(t,this.#N,(()=>{this.requestUpdate()}));render(){return this.#O()}connectedCallback(){super.connectedCallback(),Wt.reconnect(this.#T)}disconnectedCallback(){super.disconnectedCallback(),Wt.disconnect(this.#T)}},Xt=2;class Yt{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,s){this._$Ct=t,this._$AM=e,this._$Ci=s}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}}const te=(t,e)=>{const s=t._$AN;if(void 0===s)return!1;for(const t of s)t._$AO?.(e,!1),te(t,e);return!0},ee=t=>{let e,s;do{if(void 0===(e=t._$AM))break;s=e._$AN,s.delete(t),t=e}while(0===s?.size)},se=t=>{for(let e;e=t._$AM;t=e){let s=e._$AN;if(void 0===s)e._$AN=s=new Set;else if(s.has(t))break;s.add(t),ie(e)}};function re(t){void 0!==this._$AN?(ee(this),this._$AM=t,se(this)):this._$AM=t}function ne(t,e=!1,s=0){const r=this._$AH,n=this._$AN;if(void 0!==n&&0!==n.size)if(e)if(Array.isArray(r))for(let t=s;t<r.length;t++)te(r[t],!1),ee(r[t]);else null!=r&&(te(r,!1),ee(r));else te(this,t)}const ie=t=>{t.type==Xt&&(t._$AP??=ne,t._$AQ??=re)};class oe extends Yt{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,s){super._$AT(t,e,s),se(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(te(this,t),ee(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(){}}const ae=t=>e=>(t=>(...e)=>({_$litDirective$:t,values:e}))(class extends oe{#H;#E=bt(0,(()=>{this.#H&&this.setValue(this.render(...this.#H))}));#T=new Zt(this.#E,t);#N=Zt.wrap(this.#T,e(this.#T));#O=Kt(t,this.#N,this.#E);render(...t){return this.#H=t,this.#O(...t)}reconnected(){Zt.reconnect(this.#T)}disconnected(){Zt.disconnect(this.#T)}});var ce;function he(t){return[t].flat().filter((t=>!!t))}!function(t){t.css=function(...t){return function(e){return class extends e{static get styles(){return function(t,e){const s=[...he(t)??[],...he(e)];return s.flat().filter(le)}(e.styles,t)}}}},t.signals=function(t){return function(e){return class extends e{#R=[];connectedCallback(){super.connectedCallback(),this.#R.push(t.track((()=>this.render()),(()=>this.requestUpdate())))}disconnectedCallback(){super.disconnectedCallback();for(const t of this.#R)t();this.#R=[]}}}},t.flat=function(t){return function(e){return class extends e{#j=void 0;render(){let e;return this.#j&&this.#j(),this.#j=t.manual({debounce:!1,discover:!1,collector:()=>{e=super.render()},responder:()=>{this.requestUpdate()}}),e}disconnectedCallback(){super.disconnectedCallback(),this.#j&&this.#j(),this.#j=void 0}}}}}(ce||(ce={}));const le=t=>void 0!==t;const ue=t=>{for(const[e,s]of Object.entries(t))customElements.define(e.replace(/([a-zA-Z])(?=[A-Z])/g,"$1-").toLowerCase(),s)};class de extends HTMLElement{static tag="obsidian-view"}function pe(...t){const e=new Set,s=t.map((t=>t??"")).flatMap(fe);for(const t of s)e.add(t);return e}function fe(t){return t.split(/\s+/).map((t=>t.trim())).filter((t=>!!t))}function $e(t){return t.split(",").map((t=>t.trim())).filter((t=>!!t)).map((t=>t.includes(":")?t.split(":").map((t=>t.trim()))[1]:t))}function _e(t,e){const s=pe(t.getAttribute("part")),r=pe(t.getAttribute("data-gpart")),n=function(t,e){return Object.fromEntries(Object.entries(e).map((([e,s])=>[e,Array.from(t.querySelectorAll(`[${s}]`)).map((t=>t.getAttribute(s)))])))}(e,{part:"part",gpart:"data-gpart",exportparts:"exportparts",gexportparts:"gexportparts"}),i=new Set([...n.part.flatMap(fe),...n.exportparts.flatMap($e)]),o=new Set([...n.gpart.flatMap(fe),...n.gexportparts.flatMap(fe)]);i.size&&t.setAttribute("exportparts",[...s].flatMap(function(t,e){return s=>[...t].flatMap((t=>[`${t}:${s}-${t}`,...e.has(t)?[t]:[]]))}(i,o)).join(", ")),(o.size||t.hasAttribute("data-gpart"))&&t.setAttribute("gexportparts",[...o,...[...r].flatMap((t=>[...i].map((e=>`${t}-${e}`))))].join(" "))}function ge(t,e={},s={}){const{content:r,attrs:n={}}=e,{attrs:i={}}=s;function o(e,s,r,n){e!==s&&(void 0===e?t.removeAttribute(r):t.setAttribute(r,n()))}n&&function(t,e){for(const[s,r]of Object.entries(e))"string"==typeof r?t.setAttribute(s,r):"number"==typeof r?t.setAttribute(s,r.toString()):"boolean"==typeof r?!0===r?t.setAttribute(s,""):t.removeAttribute(s):void 0===r?t.removeAttribute(s):console.warn(`invalid attribute type ${s} is ${typeof r}`)}(t,n),o(n.class,i?.class,"class",(()=>n.class)),o(n.part,i?.part,"part",(()=>n.part)),o(n.gpart,i?.gpart,"data-gpart",(()=>n.gpart)),r&&it(r,t,{host:t})}ue({ObsidianView:de});const me=t=>(e={},s)=>(t=>(e,s={})=>({_$litDirective$:t,values:[{meta:s,props:e}]}))(class extends oe{#m;#v=function(t,e){const s=document.createElement(de.tag);s.setAttribute("view",t);const r=s.attachShadow({mode:"open"});jt(r,e);let n=!1;return{container:s,shadow:r,set auto_exportparts(t){n=t},render_into_shadow:t=>(it(t,r),n&&_e(s,r),s)}}(e.name??"",[t.theme,e.styles??i``]);#E=bt(0,(()=>{this.#m&&this.setValue(this.#v.render_into_shadow(this.render(this.#m)))}));#T=new Jt(this.#v.container,this.#v.shadow,this.#E,t);#N=Jt.wrap(this.#T,s(this.#T));#O=Kt(t,this.#N,this.#E);update(t,e){return this.#v.render_into_shadow(this.render(...e))}render(t){return ge(this.#v.container,t.meta,this.#m?.meta),this.#m=t,this.#v.auto_exportparts=t.meta.auto_exportparts??e.auto_exportparts??!0,this.#O(...t.props)}reconnected(){Jt.reconnect(this.#T)}disconnected(){Jt.disconnect(this.#T)}});const ye=new class extends Nt{},{oxygen:be,carbon:ve,quartz:Ae,obsidian:we,component:Se}={oxygen:Ft(xe=ye),carbon:Gt(xe),quartz:ae(xe),obsidian:me(xe),component:t=>Ot.with(t(xe)).to(ce.css(xe.theme)).to(ce.flat(xe.flat)).to(ce.signals(xe.tower)).done()};var xe;const Ee=Se((t=>class extends zt{#z=t.flat.state({count:0});render(){return B`
<span>${this.#z.count}</span>
<button @click=${()=>this.#z.count++}>gold</button>
`}})),ke=ve((t=>e=>{const[s,r]=t.state(e),n=t.flatstate({count:e}),i=t.signal(e);return ut`
`}})),ke=(t,...e)=>B(t,...e.map((t=>t instanceof kt?t.value:t))),Ce=Ae((t=>e=>{const[s,r]=t.state(e),n=t.flatstate({count:e}),i=t.signal(e);return ke`
<span>${s}</span>

@@ -18,14 +13,18 @@ <button @click=${()=>r(3*s)}>quartz-a</button>

<button @click=${()=>i.value*=3}>quartz-c</button>
`})),Ce=we({name:"quadrupler",styles:i`span { color: yellow }`},(t=>e=>{const s=t.signal(e);return ut`
`})),Me=we({name:"quadrupler",styles:i`span { color: yellow }`},(t=>e=>{const s=t.signal(e);return ke`
<span>${s}</span>
<button @click=${()=>s.value*=4}>obsidian</button>
`})),Me=Se((t=>class extends Ft{render(){return B`
${ke(1)}
${Ce([33])}
`}})),Pe=()=>Math.ceil(1e3*Math.random()),Ue=Ae({styles:i`button { color: green }`},(t=>{const e=t.signal(Pe);return ut`
`})),Pe=Se((t=>class extends Qt{render(){return B`
${Ce(1)}
${Me([33])}
`}})),Ue=()=>Math.ceil(1e3*Math.random()),Te=ve({styles:i`button { color: green }`},(t=>{const e=t.signal(Ue);return ke`
<span>${e}</span>
<button @click=${()=>e.value=Pe()}>carbon</button>
`}));de({SlateCarbon:Ue,SlateGold:Ee,SlateOxygen:be((t=>{const e=t.signal(256);return ut`
<button @click=${()=>e.value=Ue()}>carbon</button>
`})),Ne=be((t=>{const e=t.signal(256);return ke`
<span>${e}</span>
<button @click=${()=>e.value-=8}>oxygen</button>
`})),SlateSilver:Me});
`}));ye.theme=i`
button {
color: red;
}
`,ue({SlateCarbon:Te,SlateGold:Ee,SlateOxygen:Ne,SlateSilver:Pe});

@@ -0,1 +1,2 @@

import { css } from "lit";
import { SlateGold } from "./demo/elements/slate-gold.js";

@@ -5,3 +6,9 @@ import { SlateSilver } from "./demo/elements/slate-silver.js";

import { SlateOxygen } from "./demo/elements/slate-oxygen.js";
import { demoContext } from "./demo/frontend.js";
import { register_to_dom } from "./base/helpers/register_to_dom.js";
demoContext.theme = css `
button {
color: red;
}
`;
register_to_dom({

@@ -8,0 +15,0 @@ SlateCarbon,

@@ -7,6 +7,8 @@ import { css } from "lit";

static name = settings.name;
static styles = [
context.theme,
settings.styles ?? css ``,
];
static get styles() {
return [
context.theme,
settings.styles ?? css ``,
];
}
#use = new UseCarbon(this, this.root, () => void this.requestUpdate(), context);

@@ -13,0 +15,0 @@ #rend = UseCarbon.wrap(this.#use, () => renderer(this.#use));

@@ -6,9 +6,10 @@ import { Op } from "../op/op.js";

run(operation: () => Promise<V>): Promise<V | undefined>;
setLoading(): void;
setError(reason: string): void;
setReady(payload: V): void;
get loading(): boolean;
get error(): boolean;
get ready(): boolean;
get payload(): V | undefined;
is: {
loading: () => boolean;
error: () => boolean;
ready: () => boolean;
};
select<R>(choices: Op.Choices<V, R>): R;
}

@@ -10,10 +10,23 @@ import { Op } from "../op/op.js";

}
setLoading() {
this.value = Op.loading();
}
setError(reason) {
this.value = Op.error(reason);
}
setReady(payload) {
this.value = Op.ready(payload);
}
get loading() {
return Op.is.loading(this.value);
}
get error() {
return Op.is.error(this.value);
}
get ready() {
return Op.is.ready(this.value);
}
get payload() {
return Op.payload(this.value);
}
is = {
loading: () => Op.is.loading(this.value),
error: () => Op.is.error(this.value),
ready: () => Op.is.ready(this.value),
};
select(choices) {

@@ -20,0 +33,0 @@ return Op.select(this.value, choices);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc