fairy-ring 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,272 @@
1
+ import { Task } from "@lit/task";
2
+ import { LitElement, css, html } from "lit";
3
+ import { property } from "lit/decorators.js";
4
+ import * as z from "zod/v4-mini";
5
+ import { parse } from "smol-toml";
6
+ // src/strings.ts
7
+ /** maps BCP 47 language tag (e.g. "en", "en-US") -> translation. */
8
+ const locStringSchema = z.record(z.string(), z.string());
9
+ /** pick the most specific translation for the user's preferred locales. i.e. `en-US`, then `en`. default to first locale in object. */
10
+ function localize(string, locales = navigator.languages) {
11
+ for (const tag of locales) {
12
+ const parts = tag.split("-");
13
+ for (let i = parts.length; i > 0; i--) {
14
+ const hit = string[parts.slice(0, i).join("-")];
15
+ if (hit !== void 0) return hit;
16
+ }
17
+ }
18
+ return Object.values(string)[0] ?? "";
19
+ }
20
+ const defaultNextString = {
21
+ en: "next",
22
+ es: "siguiente",
23
+ pt: "próximo",
24
+ fr: "suivant",
25
+ de: "weiter",
26
+ it: "successivo",
27
+ nl: "volgende",
28
+ pl: "następna",
29
+ ru: "следующий",
30
+ uk: "наступний",
31
+ tr: "sonraki",
32
+ ar: "التالي",
33
+ hi: "अगला",
34
+ bn: "পরবর্তী",
35
+ id: "berikutnya",
36
+ vi: "tiếp theo",
37
+ th: "ถัดไป",
38
+ ja: "次へ",
39
+ ko: "다음",
40
+ zh: "下一个",
41
+ "zh-TW": "下一個"
42
+ };
43
+ const defaultPrevString = {
44
+ en: "previous",
45
+ es: "anterior",
46
+ pt: "anterior",
47
+ fr: "précédent",
48
+ de: "zurück",
49
+ it: "precedente",
50
+ nl: "vorige",
51
+ pl: "poprzednia",
52
+ ru: "предыдущий",
53
+ uk: "попередній",
54
+ tr: "önceki",
55
+ ar: "السابق",
56
+ hi: "पिछला",
57
+ bn: "পূর্ববর্তী",
58
+ id: "sebelumnya",
59
+ vi: "trước",
60
+ th: "ก่อนหน้า",
61
+ ja: "前へ",
62
+ ko: "이전",
63
+ zh: "上一个",
64
+ "zh-TW": "上一個"
65
+ };
66
+ const defaultRandomString = {
67
+ en: "random",
68
+ es: "aleatorio",
69
+ pt: "aleatório",
70
+ fr: "aléatoire",
71
+ de: "zufällig",
72
+ it: "casuale",
73
+ nl: "willekeurig",
74
+ pl: "losowa",
75
+ ru: "случайный",
76
+ uk: "випадковий",
77
+ tr: "rastgele",
78
+ ar: "عشوائي",
79
+ hi: "रैंडम",
80
+ bn: "এলোমেলো",
81
+ id: "acak",
82
+ vi: "ngẫu nhiên",
83
+ th: "สุ่ม",
84
+ ja: "ランダム",
85
+ ko: "무작위",
86
+ zh: "随机",
87
+ "zh-TW": "隨機"
88
+ };
89
+ const defaultLoadingString = {
90
+ en: "loading",
91
+ es: "cargando",
92
+ pt: "carregando",
93
+ fr: "chargement",
94
+ de: "lädt",
95
+ it: "caricamento",
96
+ nl: "laden",
97
+ pl: "ładowanie",
98
+ ru: "загрузка",
99
+ uk: "завантаження",
100
+ tr: "yükleniyor",
101
+ ar: "جارٍ التحميل",
102
+ hi: "लोड हो रहा है",
103
+ bn: "লোড হচ্ছে",
104
+ id: "memuat",
105
+ vi: "đang tải",
106
+ th: "กำลังโหลด",
107
+ ja: "読み込み中",
108
+ ko: "로딩 중",
109
+ zh: "加载中",
110
+ "zh-TW": "載入中"
111
+ };
112
+ const defaultErrorString = {
113
+ en: "error",
114
+ es: "error",
115
+ pt: "erro",
116
+ fr: "erreur",
117
+ de: "fehler",
118
+ it: "errore",
119
+ nl: "fout",
120
+ pl: "błąd",
121
+ ru: "ошибка",
122
+ uk: "помилка",
123
+ tr: "hata",
124
+ ar: "خطأ",
125
+ hi: "त्रुटि",
126
+ bn: "ত্রুটি",
127
+ id: "kesalahan",
128
+ vi: "lỗi",
129
+ th: "ข้อผิดพลาด",
130
+ ja: "エラー",
131
+ ko: "오류",
132
+ zh: "错误",
133
+ "zh-TW": "錯誤"
134
+ };
135
+ // src/impossible.ts
136
+ function impossible(x) {
137
+ throw new Error(`reached impossible variant: ${x}`);
138
+ }
139
+ // src/lib.ts
140
+ const siteSchema = z.object({
141
+ /** where to link to */
142
+ url: z.url(),
143
+ /** what part of this link does the site own? */
144
+ scope: z.enum(["host", "path"])
145
+ });
146
+ const configSchema = z.object({
147
+ /** config schema version */
148
+ version: z.enum(["0.0"]),
149
+ /** name of this webring */
150
+ name: locStringSchema,
151
+ /** list sites in the webring */
152
+ sites: z.array(siteSchema),
153
+ options: z.prefault(z.object({
154
+ /** a homepage for the webring, if one exists */
155
+ homeUrl: z.optional(z.url()),
156
+ /** enable the "random" button */
157
+ showRandom: z._default(z.boolean(), true),
158
+ /** suggested stylesheet; loaded unless disabled by site developer */
159
+ cssHref: z.optional(z.url())
160
+ }), {}),
161
+ strings: z.prefault(z.object({
162
+ /** link to the next site */
163
+ next: z._default(locStringSchema, defaultNextString),
164
+ /** link to the previous site */
165
+ previous: z._default(locStringSchema, defaultPrevString),
166
+ /** link to a random site */
167
+ random: z._default(locStringSchema, defaultRandomString)
168
+ }), {})
169
+ });
170
+ async function fetchConfig({ url, init }) {
171
+ const result = await fetch(url, init);
172
+ if (!result.ok) throw new Error(`fetchConfig response error ${result.status}: ${await result.text()}`);
173
+ const raw = await result.text();
174
+ const json = parse(raw);
175
+ return configSchema.parse(json);
176
+ }
177
+ async function logConfigErrors(promise, log = console.error) {
178
+ try {
179
+ return await promise;
180
+ } catch (error) {
181
+ if (error instanceof z.core.$ZodError) log("[fairy-ring] invalid config:", z.prettifyError(error));
182
+ else log("[fairy-ring] error loading config:", error);
183
+ throw error;
184
+ }
185
+ }
186
+ /** match against the configured sites; if this is one of them, return [Site, index]; else, return null */
187
+ function getCurrent(config) {
188
+ const url = new URL(document.baseURI);
189
+ const index = config.sites.findIndex((site) => {
190
+ const siteUrl = new URL(site.url);
191
+ switch (site.scope) {
192
+ case "host": return siteUrl.host.toLowerCase() === url.host.toLowerCase();
193
+ case "path": return siteUrl.host.toLowerCase() === url.host.toLowerCase() && siteUrl.pathname === url.pathname;
194
+ default: impossible(site.scope);
195
+ }
196
+ });
197
+ if (index < 0) return null;
198
+ return [config.sites[index], index];
199
+ }
200
+ function mod(a, b) {
201
+ return (a % b + b) % b;
202
+ }
203
+ function getNext(config) {
204
+ const cur = getCurrent(config);
205
+ if (!cur) return null;
206
+ return config.sites[mod(cur[1] + 1, config.sites.length)];
207
+ }
208
+ function getPrev(config) {
209
+ const cur = getCurrent(config);
210
+ if (!cur) return null;
211
+ return config.sites[mod(cur[1] - 1, config.sites.length)];
212
+ }
213
+ function getRandom(config) {
214
+ if (config.sites.length === 0) return null;
215
+ if (config.sites.length === 1) return config.sites[0];
216
+ const [_, cur = 0] = getCurrent(config) ?? [];
217
+ let site = 0;
218
+ for (let i = 0; site === cur && i < 10; ++i) site = Math.floor(Math.random() * config.sites.length);
219
+ return config.sites[site];
220
+ }
221
+ // \0@oxc-project+runtime@0.159.0/helpers/esm/decorate.js
222
+ function __decorate(decorators, target, key, desc) {
223
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
224
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
225
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
226
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
227
+ }
228
+ // src/element.ts
229
+ var FairyRingElement = class extends LitElement {
230
+ static {
231
+ this.styles = css`
232
+ :host {
233
+ display: flex;
234
+ flex-direction: row;
235
+ gap: 1em;
236
+ }
237
+ `;
238
+ }
239
+ #config = new Task(this, {
240
+ args: () => [this.configUrl],
241
+ task: async ([url], { signal }) => {
242
+ if (!url) throw new Error("missing config-url");
243
+ return logConfigErrors(fetchConfig({
244
+ url,
245
+ init: { signal }
246
+ }));
247
+ }
248
+ });
249
+ render() {
250
+ return html`
251
+ ${this.#config.render({
252
+ pending: () => html`<div class="loading">${localize(defaultLoadingString)}</div>`,
253
+ error: () => html`<div class="error">${localize(defaultErrorString)}</div>`,
254
+ complete: (config) => html`
255
+ <a class="prev" href=${getPrev(config)?.url ?? ""}
256
+ >${localize(config.strings.previous)}</a
257
+ >
258
+ ${config.options.homeUrl ? html`<a class="home" href=${config.options.homeUrl}>${config.name}</a>` : html`<div>${localize(config.name)}</div>`}
259
+ <a class="random" href=${getRandom(config)?.url ?? ""}
260
+ >${localize(config.strings.random)}</a
261
+ >
262
+ <a class="next" href=${getNext(config)?.url ?? ""}>${localize(config.strings.next)}</a>
263
+ `
264
+ })}
265
+ `;
266
+ }
267
+ };
268
+ __decorate([property({ attribute: "config-url" })], FairyRingElement.prototype, "configUrl", void 0);
269
+ function define(tagName = "fairy-ring") {
270
+ if (!customElements.get(tagName)) customElements.define(tagName, FairyRingElement);
271
+ }
272
+ export { define as n, FairyRingElement as t };
package/dist/element.d.ts CHANGED
@@ -1,2 +1,8 @@
1
- export declare class FairyRingElement extends HTMLElement {}
1
+ import { LitElement } from "lit";
2
+ export declare class FairyRingElement extends LitElement {
3
+ #private;
4
+ static styles: import("lit").CSSResult;
5
+ configUrl?: string;
6
+ render(): import("lit").TemplateResult<1>;
7
+ }
2
8
  export declare function define(tagName?: string): void;
package/dist/element.js CHANGED
@@ -1,6 +1 @@
1
- // src/element.ts
2
- var FairyRingElement = class extends HTMLElement {};
3
- function define(tagName = "fairy-ring") {
4
- if (!customElements.get(tagName)) customElements.define(tagName, FairyRingElement);
5
- }
6
- export { FairyRingElement, define };
1
+ export { t as FairyRingElement, n as define } from "./element-GEcIko-6.js";
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createElement } from "react";
2
- import { define } from "./element.js";
2
+ import { n as define } from "./element-GEcIko-6.js";
3
3
  // src/react.ts
4
4
  function FairyRing() {
5
5
  define();
package/dist/solid.js CHANGED
@@ -1,4 +1,4 @@
1
- import { define } from "./element.js";
1
+ import { n as define } from "./element-GEcIko-6.js";
2
2
  // src/solid.ts
3
3
  function FairyRing() {
4
4
  define();
@@ -1 +1,329 @@
1
- var e=class extends HTMLElement{};function t(t=`fairy-ring`){customElements.get(t)||customElements.define(t,e)}t();export{e as FairyRingElement,t as define};
1
+ /**
2
+ * @license
3
+ * Copyright 2019 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */
6
+ const e=globalThis,t=e.ShadowRoot&&(e.ShadyCSS===void 0||e.ShadyCSS.nativeShadow)&&`adoptedStyleSheets`in Document.prototype&&`replace`in CSSStyleSheet.prototype,n=Symbol(),r=/* @__PURE__ */ new WeakMap;var i=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==n)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,n=this.t;if(t&&e===void 0){let t=n!==void 0&&n.length===1;t&&(e=r.get(n)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),t&&r.set(n,e))}return e}toString(){return this.cssText}};const a=e=>new i(typeof e==`string`?e:e+``,void 0,n),o=(e,...t)=>new i(e.length===1?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if(typeof e==`number`)return e;throw Error(`Value passed to 'css' function must be a 'css' function result: `+e+`. Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.`)})(n)+e[r+1],e[0]),e,n),s=(n,r)=>{if(t)n.adoptedStyleSheets=r.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let t of r){let r=document.createElement(`style`),i=e.litNonce;i!==void 0&&r.setAttribute(`nonce`,i),r.textContent=t.cssText,n.appendChild(r)}},c=t?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t=``;for(let n of e.cssRules)t+=n.cssText;return a(t)})(e):e,{is:l,defineProperty:u,getOwnPropertyDescriptor:d,getOwnPropertyNames:f,getOwnPropertySymbols:p,getPrototypeOf:ee}=Object,m=globalThis,te=m.trustedTypes,ne=te?te.emptyScript:``,re=m.reactiveElementPolyfillSupport,h=(e,t)=>e,g={toAttribute(e,t){
7
+ /**
8
+ * @license
9
+ * Copyright 2017 Google LLC
10
+ * SPDX-License-Identifier: BSD-3-Clause
11
+ */
12
+ switch(t){case Boolean:e=e?ne:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=e!==null;break;case Number:n=e===null?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch{n=null}}return n}},ie=(e,t)=>!l(e,t),ae={attribute:!0,type:String,converter:g,reflect:!1,useDefault:!1,hasChanged:ie};Symbol.metadata??=Symbol(`metadata`),m.litPropertyMetadata??=/* @__PURE__ */ new WeakMap;var _=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=ae){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,t);r!==void 0&&u(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){let{get:r,set:i}=d(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){let a=r?.call(this);i?.call(this,t),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??ae}static _$Ei(){if(this.hasOwnProperty(h(`elementProperties`)))return;let e=ee(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(h(`finalized`)))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(h(`properties`))){let e=this.properties,t=[...f(e),...p(e)];for(let n of t)this.createProperty(n,e[n])}let e=this[Symbol.metadata];if(e!==null){let t=litPropertyMetadata.get(e);if(t!==void 0)for(let[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=/* @__PURE__ */ new Map;for(let[e,t]of this.elementProperties){let n=this._$Eu(e,t);n!==void 0&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let e of n)t.unshift(c(e))}else e!==void 0&&t.push(c(e));return t}static _$Eu(e,t){let n=t.attribute;return!1===n?void 0:typeof n==`string`?n:typeof e==`string`?e.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(e=>this.enableUpdating=e),this._$AL=/* @__PURE__ */ new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=/* @__PURE__ */ new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=/* @__PURE__ */ new Map,t=this.constructor.elementProperties;for(let n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return s(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&!0===n.reflect){let i=(n.converter?.toAttribute===void 0?g:n.converter).toAttribute(t,n.type);this._$Em=e,i==null?this.removeAttribute(r):this.setAttribute(r,i),this._$Em=null}}_$AK(e,t){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let e=n.getPropertyOptions(r),i=typeof e.converter==`function`?{fromAttribute:e.converter}:e.converter?.fromAttribute===void 0?g:e.converter;this._$Em=r;let a=i.fromAttribute(t,e.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,t,n,r=!1,i){if(e!==void 0){let a=this.constructor;if(!1===r&&(i=this[e]),n??=a.getPropertyOptions(e),!((n.hasChanged??ie)(i,t)||n.useDefault&&n.reflect&&i===this._$Ej?.get(e)&&!this.hasAttribute(a._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:i},a){n&&!(this._$Ej??=/* @__PURE__ */ new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==i||a!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=/* @__PURE__ */ new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,n]of e){let{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||r===void 0||this.C(t,void 0,n,r)}}let e=!1,t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=/* @__PURE__ */ new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};_.elementStyles=[],_.shadowRootOptions={mode:`open`},_[h(`elementProperties`)]=/* @__PURE__ */ new Map,_[h(`finalized`)]=/* @__PURE__ */ new Map,re?.({ReactiveElement:_}),(m.reactiveElementVersions??=[]).push(`2.1.2`);const oe=Symbol();
13
+ /**
14
+ * @license
15
+ * Copyright 2017 Google LLC
16
+ * SPDX-License-Identifier: BSD-3-Clause
17
+ */
18
+ var se=class{get taskComplete(){return this.t||=this.i===1?new Promise(((e,t)=>{this.o=e,this.h=t})):this.i===3?Promise.reject(this.l):Promise.resolve(this.u),this.t}constructor(e,t,n){this.p=0,this.i=0,(this._=e).addController(this);let r=typeof t==`object`?t:{task:t,args:n};this.v=r.task,this.j=r.args,this.m=r.argsEqual??ce,this.k=r.onComplete,this.A=r.onError,this.autoRun=r.autoRun??!0,`initialValue`in r&&(this.u=r.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){!0===this.autoRun&&this.S()}hostUpdated(){this.autoRun===`afterUpdate`&&this.S()}T(){if(this.j===void 0)return;let e=this.j();if(!Array.isArray(e))throw Error(`The args function must return an array`);return e}async S(){let e=this.T(),t=this.O;this.O=e,e===t||e===void 0||t!==void 0&&this.m(t,e)||await this.run(e)}async run(e){let t,n;e??=this.T(),this.O=e,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun===`afterUpdate`?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let r=++this.p;this.q=new AbortController;let i=!1;try{t=await this.v(e,{signal:this.q.signal})}catch(e){i=!0,n=e}if(this.p===r){if(t===oe)this.i=0;else{if(!1===i){try{this.k?.(t)}catch{}this.i=2,this.o?.(t)}else{try{this.A?.(n)}catch{}this.i=3,this.h?.(n)}this.u=t,this.l=n}this._.requestUpdate()}}abort(e){this.i===1&&this.q?.abort(e)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(e){switch(this.i){case 0:return e.initial?.();case 1:return e.pending?.();case 2:return e.complete?.(this.value);case 3:return e.error?.(this.error);default:throw Error(`Unexpected status: `+this.i)}}};const ce=(e,t)=>e===t||e.length===t.length&&e.every(((e,n)=>!ie(e,t[n]))),le=globalThis,ue=e=>e,v=le.trustedTypes,de=v?v.createPolicy(`lit-html`,{createHTML:e=>e}):void 0,fe=`$lit$`,y=`lit$${Math.random().toFixed(9).slice(2)}$`,pe=`?`+y,me=`<${pe}>`,b=document,x=()=>b.createComment(``),S=e=>e===null||typeof e!=`object`&&typeof e!=`function`,he=Array.isArray,ge=e=>he(e)||typeof e?.[Symbol.iterator]==`function`,_e=`[
19
+ \f\r]`,C=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ve=/-->/g,ye=/>/g,w=RegExp(`>|${_e}(?:([^\\s"'>=/]+)(${_e}*=${_e}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,`g`),be=/'/g,xe=/"/g,Se=/^(?:script|style|textarea|title)$/i,T=(e=>(t,...n)=>({_$litType$:e,strings:t,values:n}))(1),E=Symbol.for(`lit-noChange`),D=Symbol.for(`lit-nothing`),Ce=/* @__PURE__ */ new WeakMap,O=b.createTreeWalker(b,129)
20
+ /**
21
+ * @license
22
+ * Copyright 2017 Google LLC
23
+ * SPDX-License-Identifier: BSD-3-Clause
24
+ */
25
+ ;function we(e,t){if(!he(e)||!e.hasOwnProperty(`raw`))throw Error(`invalid template strings array`);return de===void 0?t:de.createHTML(t)}const Te=(e,t)=>{let n=e.length-1,r=[],i,a=t===2?`<svg>`:t===3?`<math>`:``,o=C;for(let t=0;t<n;t++){let n=e[t],s,c,l=-1,u=0;for(;u<n.length&&(o.lastIndex=u,c=o.exec(n),c!==null);)u=o.lastIndex,o===C?c[1]===`!--`?o=ve:c[1]===void 0?c[2]===void 0?c[3]!==void 0&&(o=w):(Se.test(c[2])&&(i=RegExp(`</`+c[2],`g`)),o=w):o=ye:o===w?c[0]===`>`?(o=i??C,l=-1):c[1]===void 0?l=-2:(l=o.lastIndex-c[2].length,s=c[1],o=c[3]===void 0?w:c[3]===`"`?xe:be):o===xe||o===be?o=w:o===ve||o===ye?o=C:(o=w,i=void 0);let d=o===w&&e[t+1].startsWith(`/>`)?` `:``;a+=o===C?n+me:l>=0?(r.push(s),n.slice(0,l)+fe+n.slice(l)+y+d):n+y+(l===-2?t:d)}return[we(e,a+(e[n]||`<?>`)+(t===2?`</svg>`:t===3?`</math>`:``)),r]};var Ee=class e{constructor({strings:t,_$litType$:n},r){let i;this.parts=[];let a=0,o=0,s=t.length-1,c=this.parts,[l,u]=Te(t,n);if(this.el=e.createElement(l,r),O.currentNode=this.el.content,n===2||n===3){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;(i=O.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(fe)){let t=u[o++],n=i.getAttribute(e).split(y),r=/([.?@])?(.*)/.exec(t);c.push({type:1,index:a,name:r[2],strings:n,ctor:r[1]===`.`?Ae:r[1]===`?`?je:r[1]===`@`?Me:ke}),i.removeAttribute(e)}else e.startsWith(y)&&(c.push({type:6,index:a}),i.removeAttribute(e));if(Se.test(i.tagName)){let e=i.textContent.split(y),t=e.length-1;if(t>0){i.textContent=v?v.emptyScript:``;for(let n=0;n<t;n++)i.append(e[n],x()),O.nextNode(),c.push({type:2,index:++a});i.append(e[t],x())}}}else if(i.nodeType===8){if(i.data===pe)c.push({type:2,index:a});else{let e=-1;for(;(e=i.data.indexOf(y,e+1))!==-1;)c.push({type:7,index:a}),e+=y.length-1}}a++}}static createElement(e,t){let n=b.createElement(`template`);return n.innerHTML=e,n}};function k(e,t,n=e,r){if(t===E)return t;let i=r===void 0?n._$Cl:n._$Co?.[r],a=S(t)?void 0:t._$litDirective$;return i?.constructor!==a&&(i?._$AO?.(!1),a===void 0?i=void 0:(i=new a(e),i._$AT(e,n,r)),r===void 0?n._$Cl=i:(n._$Co??=[])[r]=i),i!==void 0&&(t=k(e,i._$AS(e,t.values),i,r)),t}var De=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??b).importNode(t,!0);O.currentNode=r;let i=O.nextNode(),a=0,o=0,s=n[0];for(;s!==void 0;){if(a===s.index){let t;s.type===2?t=new Oe(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new Ne(i,this,e)),this._$AV.push(t),s=n[++o]}a!==s?.index&&(i=O.nextNode(),a++)}return O.currentNode=b,r}p(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings===void 0?n._$AI(e[t]):(n._$AI(e,n,t),t+=n.strings.length-2)),t++}},Oe=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=D,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=k(this,e,t),S(e)?e===D||e==null||e===``?(this._$AH!==D&&this._$AR(),this._$AH=D):e!==this._$AH&&e!==E&&this._(e):e._$litType$===void 0?e.nodeType===void 0?ge(e)?this.k(e):this._(e):this.T(e):this.$(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==D&&S(this._$AH)?this._$AA.nextSibling.data=e:this.T(b.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:n}=e,r=typeof n==`number`?this._$AC(e):(n.el===void 0&&(n.el=Ee.createElement(we(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{let e=new De(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=Ce.get(e.strings);return t===void 0&&Ce.set(e.strings,t=new Ee(e)),t}k(t){he(this._$AH)||(this._$AH=[],this._$AR());let n=this._$AH,r,i=0;for(let a of t)i===n.length?n.push(r=new e(this.O(x()),this.O(x()),this,this.options)):r=n[i],r._$AI(a),i++;i<n.length&&(this._$AR(r&&r._$AB.nextSibling,i),n.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){let t=ue(e).nextSibling;ue(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},ke=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,i){this.type=1,this._$AH=D,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=i,n.length>2||n[0]!==``||n[1]!==``?(this._$AH=Array(n.length-1).fill(/* @__PURE__ */ new String),this.strings=n):this._$AH=D}_$AI(e,t=this,n,r){let i=this.strings,a=!1;if(i===void 0)e=k(this,e,t,0),a=!S(e)||e!==this._$AH&&e!==E,a&&(this._$AH=e);else{let r=e,o,s;for(e=i[0],o=0;o<i.length-1;o++)s=k(this,r[n+o],t,o),s===E&&(s=this._$AH[o]),a||=!S(s)||s!==this._$AH[o],s===D?e=D:e!==D&&(e+=(s??``)+i[o+1]),this._$AH[o]=s}a&&!r&&this.j(e)}j(e){e===D?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??``)}},Ae=class extends ke{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===D?void 0:e}},je=class extends ke{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==D)}},Me=class extends ke{constructor(e,t,n,r,i){super(e,t,n,r,i),this.type=5}_$AI(e,t=this){if((e=k(this,e,t,0)??D)===E)return;let n=this._$AH,r=e===D&&n!==D||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,i=e!==D&&(n===D||r);r&&this.element.removeEventListener(this.name,this,n),i&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH==`function`?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ne=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){k(this,e)}};(0,le.litHtmlPolyfillSupport)?.(Ee,Oe),(le.litHtmlVersions??=[]).push(`3.3.3`);const Pe=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new Oe(t.insertBefore(x(),e),e,void 0,n??{})}return i._$AI(e),i},Fe=globalThis
26
+ /**
27
+ * @license
28
+ * Copyright 2017 Google LLC
29
+ * SPDX-License-Identifier: BSD-3-Clause
30
+ */
31
+ ;var A=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Pe(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}};A._$litElement$=!0,A.finalized=!0,Fe.litElementHydrateSupport?.({LitElement:A}),(0,Fe.litElementPolyfillSupport)?.({LitElement:A}),(Fe.litElementVersions??=[]).push(`4.2.2`);
32
+ /**
33
+ * @license
34
+ * Copyright 2017 Google LLC
35
+ * SPDX-License-Identifier: BSD-3-Clause
36
+ */const Ie={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:ie},Le=(e=Ie,t,n)=>{let{kind:r,metadata:i}=n,a=globalThis.litPropertyMetadata.get(i);if(a===void 0&&globalThis.litPropertyMetadata.set(i,a=/* @__PURE__ */ new Map),r===`setter`&&((e=Object.create(e)).wrapped=!0),a.set(n.name,e),r===`accessor`){let{name:r}=n;return{set(n){let i=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,i,e,!0,n)},init(t){return t!==void 0&&this.C(r,void 0,e,t),t}}}if(r===`setter`){let{name:r}=n;return function(n){let i=this[r];t.call(this,n),this.requestUpdate(r,i,e,!0,n)}}throw Error(`Unsupported decorator location: `+r)};function Re(e){return(t,n)=>typeof n==`object`?Le(e,t,n):((e,t,n)=>{let r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}
37
+ /**
38
+ * @license
39
+ * Copyright 2017 Google LLC
40
+ * SPDX-License-Identifier: BSD-3-Clause
41
+ */
42
+ function ze(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Be(e,t){return typeof t==`bigint`?t.toString():t}var Ve=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function He(e){return new Ve(e)}function Ue(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function We(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}const Ge=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ke(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function qe(e){if(Ke(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ke(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function Je(e){return qe(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Ye=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Ze(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function j(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Qe(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function M(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function $e(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function N(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function P(e){return typeof e==`string`?e:e?.message}function et(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function tt(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function F(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:P(e.inst?._zod.def?.error?.(e))??P(a?.(e))??P(t?.error?.(e))??P(n.customError?.(e))??P(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}function nt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):it(e,n,r.value)}}function I(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function rt(e,t,n){return I(e,t,n,!1)}function it(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:I(this,t,n.bind(this))},set(e){I(this,t,e)}})}function at(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let ot,L=!1;const st={configurable:!0,get(){L=!0}};function R(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&ot!==e._zod?ot=void 0:(ot=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,st);let e=L;L=!1;try{let r=n(this);return L?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),L||=e,r}catch(n){throw delete this[t],L||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function ct(e,t,n,r){let i=at(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var lt;const ut={value:void 0,enumerable:!1};let dt=`captureStackTrace`in Error?Error:null;function ft(e){let t=dt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return dt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
43
+ function z(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=/* @__PURE__ */ new Set}a.prototype=i;let o=n,s=o&&/* @__PURE__ */ new WeakSet;function c(n,r){if(!n._zod){ut.value=new a(r);try{Object.defineProperty(n,"_zod",ut)}finally{ut.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),nt(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?ft(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var B=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(lt=globalThis).__zod_globalConfig??(lt.__zod_globalConfig={});const V=globalThis.__zod_globalConfig;function H(e){return e&&Object.assign(V,e),V}function pt(){let e=this._zod;return e.message??=JSON.stringify(e.def,Be,2),e.message}function mt(e){this._zod.message=e}const ht={get:pt,set:mt,enumerable:!0,configurable:!0},gt={value:void 0,enumerable:!1},_t=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),vt=(e,t)=>{e.name=`$ZodError`,gt.value=t,Object.defineProperty(e,"issues",gt),gt.value=void 0,Object.defineProperty(e,"message",ht);let n=Object.getPrototypeOf(e);_t.has(n)||(_t.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},yt=/* @__PURE__ */ z(`$ZodError`,vt),U=/* @__PURE__ */ z(`$ZodError`,vt,void 0,{Parent:Error});function bt(e){let t=[],n=e.map(e=>typeof e==`object`?e.key:e);for(let e of n)typeof e==`number`?t.push(`[${e}]`):typeof e==`symbol`?t.push(`[${JSON.stringify(String(e))}]`):/[^\w$]/.test(e)?t.push(`[${JSON.stringify(e)}]`):(t.length&&t.push(`.`),t.push(e));return t.join(``)}function xt(e){let t=[],n=[...e.issues].sort((e,t)=>(e.path??[]).length-(t.path??[]).length);for(let e of n)t.push(`✖ ${e.message}`),e.path?.length&&t.push(` → at ${bt(e.path)}`);return t.join(`
44
+ `)}const St=/* @__PURE__*/ (e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new B;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>F(e,o,H())));throw Ge(n,a?.callee??t),n}return s.value};return t})(U),Ct=/* @__PURE__*/ (e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>F(e,o,H())));throw Ge(n,a?.callee??t),n}return s.value};return t})(U),wt=/* @__PURE__*/ (e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new B;return a.issues.length?Tt(e,a.issues,i):{success:!0,data:a.value}})(U);function Tt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>F(e,n,H()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Et=/* @__PURE__*/ (e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Tt(e,a.issues,i):{success:!0,data:a.value}})(U),Dt=/^https?$/,Ot=/^[\s\S]{0,}$/,kt=/^-?\d+(?:\.\d+)?$/,At=/^(?:true|false)$/i,jt=/*@__PURE__*/ z(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Mt=/*@__PURE__*/ z(`$ZodCheckStringFormat`,(e,t)=>{var n,r;jt.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Nt={major:4,minor:6,patch:7},W=/*@__PURE__*/ z(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nt;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=M(t),a;for(let o of n){if(o._zod.def.when){if($e(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new B;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(tt(t.issues,n,e),i||=M(t,n))});else{if(t.issues.length===n)continue;tt(t.issues,n,e),i||=M(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(M(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new B;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new B;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return rt(this,`~standard`,It(this))},set"~standard"(e){I(this,`~standard`,e)}}),Pt=(e,t)=>e.issues.length?{issues:e.issues.map(e=>F(e,t,H()))}:{value:e.value};async function Ft(e,t){let n={async:!0};return Pt(await e._zod.run({value:t,issues:[]},n),n)}function It(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Pt(r,n)}catch{}return Ft(e,t)},vendor:`zod`,version:1}}const Lt=/*@__PURE__*/ z(`$ZodString`,(e,t)=>{W.init(e,t),e._zod.pattern=t.pattern??Ot,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),Rt=/*@__PURE__*/ z(`$ZodStringFormat`,(e,t)=>{Mt.init(e,t),Lt.init(e,t)});function zt(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Bt(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?zt(e)||2:Vt(e,t)}function Vt(e,t){if(!t.normalize&&t.protocol?.source===Dt.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}const Ht=/[\t\n\r]/g;function Ut(e){return e.replace(Ht,``)}function Wt(e,t){return t.lastIndex=0,t.test(e.hostname)}function Gt(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Kt=/*@__PURE__*/ z(`$ZodURL`,(e,t)=>{Rt.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Bt(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=Ut(r);return}t.hostname&&!Wt(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!Gt(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:Ut(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),qt=/*@__PURE__*/ z(`$ZodBoolean`,(e,t)=>{W.init(e,t),e._zod.pattern=At,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}});function Jt(e,t){let n=et(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of et(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,tt(n.issues,t,e),n}}return i(n,a)}}const Yt=e=>Array.isArray(e)?e.length:-1;function Xt(e,t,n){e.issues.length&&t.issues.push(...N(n,e.issues)),t.value[n]=e.value}const Zt=/*@__PURE__*/ z(`$ZodArray`,(e,t)=>{W.init(e,t);let n=V.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Xt(t,r,e)));else if(Xt(c,r,e),s&&c.issues.length!==0&&M(c))break}return o.length?Promise.all(o).then(()=>r):r},Jt(e,Yt)});function G(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...N(n,e.issues))}!o&&i===void 0?e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]}):e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}const Qt=[];function $t(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Qt,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=Qe(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function en(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(M(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>G(e,n,i,t,d,f))):G(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}const tn=/*@__PURE__*/ z(`$ZodObject`,(e,t)=>{W.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=He(()=>$t(t));R(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||We(n,e,/* @__PURE__ */ new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=Ke,o=t.catchall,s,c=V.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(M(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>G(n,t,e,r,a,o))):G(s,t,e,r,a,o)}return o?en(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),nn=/*@__PURE__*/ z(`$ZodRecord`,(e,t)=>{W.init(e,t);let n=V.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!qe(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=/* @__PURE__ */ new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>F(e,i,H())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...N(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...N(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&kt.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>F(e,i,H())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...N(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...N(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),rn=/*@__PURE__*/ z(`$ZodEnum`,(e,t)=>{W.init(e,t);let n=ze(t.entries),r=new Set(n);e._zod.values=r,R(e,`pattern`,e=>{let t=ze(e.def.entries).filter(e=>Ye.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Xe(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}});function an(e,t){return e.value=t.issues.length?void 0:t.value,e}const on=/*@__PURE__*/ z(`$ZodOptional`,(e,t)=>{W.init(e,t),R(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,R(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),R(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${Ue(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>an(e,t)):an(e,r)}return t.innerType._zod.run(e,n)}}),sn=/*@__PURE__*/ z(`$ZodDefault`,(e,t)=>{W.init(e,t),e._zod.optin=`defaulted`,R(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>cn(e,t)):cn(r,t)}});function cn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const ln=/*@__PURE__*/ z(`$ZodPrefault`,(e,t)=>{W.init(e,t),e._zod.optin=`defaulted`,R(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))});function un(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
45
+ function dn(e,t){return new e(un({type:`string`,...j(t)}))}// @__NO_SIDE_EFFECTS__
46
+ function fn(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...j(t)})}// @__NO_SIDE_EFFECTS__
47
+ function pn(e,t){return new e({type:`boolean`,...j(t)})}const K=/*@__PURE__*/ z(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);W.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){I(this,`with`,e)},parse(e,t){return St(this,e,t,{callee:this.parse})},parseAsync(e,t){return Ct(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return wt(this,e,t)},safeParseAsync(e,t){return Et(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]},{parent:!0})},clone(e,t){return Ze(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),mn=/*@__PURE__*/ z(`ZodMiniString`,(e,t)=>{Lt.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
48
+ function hn(e){return/* @__PURE__ */ dn(mn,e)}const gn=/*@__PURE__*/ z(`ZodMiniStringFormat`,(e,t)=>{Rt.init(e,t),mn.init(e,t)}),_n=/*@__PURE__*/ z(`ZodMiniURL`,(e,t)=>{Kt.init(e,t),gn.init(e,t)});// @__NO_SIDE_EFFECTS__
49
+ function vn(e){return/* @__PURE__ */ fn(_n,e)}const yn=/*@__PURE__*/ z(`ZodMiniBoolean`,(e,t)=>{qt.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
50
+ function bn(e){return/* @__PURE__ */ pn(yn,e)}const xn=/*@__PURE__*/ z(`ZodMiniArray`,(e,t)=>{Zt.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
51
+ function Sn(e,t){return new xn({type:`array`,element:e,...j(t)})}const Cn=/*@__PURE__*/ z(`ZodMiniObject`,(e,t)=>{tn.init(e,t),K.init(e,t),ct(e,`shape`,e=>e._zod.def.shape,!1)});// @__NO_SIDE_EFFECTS__
52
+ function q(e,t){let n={type:`object`,shape:e??{},...j(t)};return new Cn(n)}const wn=/*@__PURE__*/ z(`ZodMiniRecord`,(e,t)=>{nn.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
53
+ function Tn(e,t,n){return!t||!t._zod?new wn({type:`record`,keyType:/* @__PURE__ */ hn(),valueType:e,...j(t)}):new wn({type:`record`,keyType:e,valueType:t,...j(n)})}const En=/*@__PURE__*/ z(`ZodMiniEnum`,(e,t)=>{rn.init(e,t),K.init(e,t),e.options=[...e._zod.values]});// @__NO_SIDE_EFFECTS__
54
+ function Dn(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new En({type:`enum`,entries:n,...j(t)})}const On=/*@__PURE__*/ z(`ZodMiniOptional`,(e,t)=>{on.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
55
+ function kn(e){return new On({type:`optional`,innerType:e})}const An=/*@__PURE__*/ z(`ZodMiniDefault`,(e,t)=>{sn.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
56
+ function J(e,t){return new An({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Je(t)}})}const jn=/*@__PURE__*/ z(`ZodMiniPrefault`,(e,t)=>{ln.init(e,t),K.init(e,t)});// @__NO_SIDE_EFFECTS__
57
+ function Mn(e,t){return new jn({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Je(t)}})}
58
+ /*!
59
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
60
+ * SPDX-License-Identifier: BSD-3-Clause
61
+ *
62
+ * Redistribution and use in source and binary forms, with or without
63
+ * modification, are permitted provided that the following conditions are met:
64
+ *
65
+ * 1. Redistributions of source code must retain the above copyright notice, this
66
+ * list of conditions and the following disclaimer.
67
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
68
+ * this list of conditions and the following disclaimer in the
69
+ * documentation and/or other materials provided with the distribution.
70
+ * 3. Neither the name of the copyright holder nor the names of its contributors
71
+ * may be used to endorse or promote products derived from this software without
72
+ * specific prior written permission.
73
+ *
74
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
75
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
76
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
77
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
78
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
79
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
80
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
81
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
82
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
83
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
84
+ */
85
+ function Nn(e,t){let n=e.slice(0,t).split(/\r?\n/);return[n.length,n.pop().length+1]}function Pn(e,t,n){let r=e.split(/\r?\n/),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
86
+ `,e===t&&(i+=` `.repeat(a+n+2),i+=`^
87
+ `))}return i}var Y=class e extends Error{line;column;codeblock;constructor(e,t){let[n,r]=Nn(t.toml,t.ptr),i=Pn(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}static x(t,n,r){throw new e(t,{toml:n.s,ptr:r??n.p})}};
88
+ /*!
89
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
90
+ * SPDX-License-Identifier: BSD-3-Clause
91
+ *
92
+ * Redistribution and use in source and binary forms, with or without
93
+ * modification, are permitted provided that the following conditions are met:
94
+ *
95
+ * 1. Redistributions of source code must retain the above copyright notice, this
96
+ * list of conditions and the following disclaimer.
97
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
98
+ * this list of conditions and the following disclaimer in the
99
+ * documentation and/or other materials provided with the distribution.
100
+ * 3. Neither the name of the copyright holder nor the names of its contributors
101
+ * may be used to endorse or promote products derived from this software without
102
+ * specific prior written permission.
103
+ *
104
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
105
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
106
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
107
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
108
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
109
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
110
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
111
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
112
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
113
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
114
+ */
115
+ function Fn(e){let t=e.p,n=e.s.charCodeAt(e.p++),r=n,i=n===39,a=n===e.s.charCodeAt(e.p)&&n===e.s.charCodeAt(e.p+1);a&&((n=e.s.charCodeAt(e.p+=2))===10?e.p++:n===13&&e.s.charCodeAt(e.p+1)===10&&(e.p+=2));let o=``,s=e.p,c=0;for(;e.p<e.s.length;e.p++)if(n=e.s.charCodeAt(e.p),a&&(n===10||n===13&&e.s.charCodeAt(e.p+1)===10))c&&=3;else if(n<32&&n!==9||n===127)Y.x(`control characters are not allowed in strings`,e);else if((!c||c===3)&&n===r&&(!a||e.s.charCodeAt(e.p+1)===r&&e.s.charCodeAt(e.p+2)===r)){if(a&&(e.s.charCodeAt(e.p+3)===r&&e.p++,e.s.charCodeAt(e.p+3)===r&&e.p++),!c){let t=e.s.slice(s,e.p);o=o?o+t:t}return e.p+=a?3:1,o}else if(!c)!i&&n===92&&(o+=e.s.slice(s,s=e.p),c=1);else if(c===1){if(n===120||n===117||n===85){let t=e.p++-1,r=0,i=n===120?2:n===117?4:8;for(let t=0;t<i;t++,e.p++){let t=e.s.charCodeAt(e.p),n=t>=48&&t<=57?t-48:t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:-1;n<0&&Y.x(`invalid non-hex character in unicode escape`,e),r=r<<4|n}(r<0||r>1114111||r>=55296&&r<=57343)&&Y.x(`invalid unicode escape`,e,t),o+=String.fromCodePoint(r),s=e.p--,c=0}else a&&(n===32||n===9)?c=2:(n===98?o+=`\b`:n===116?o+=` `:n===110?o+=`
116
+ `:n===102?o+=`\f`:n===114?o+=`\r`:n===101?o+=`\x1B`:n===34?o+=`"`:n===92?o+=`\\`:Y.x(`unrecognised escape sequence`,e),s=e.p+1,c=0)}else n!==32&&n!==9&&(c===2&&Y.x(`invalid escape: only line-ending whitespace may be escaped`,e,s),c=+(!i&&n===92),s=e.p);Y.x(`unfinished string`,e,t)}
117
+ /*!
118
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
119
+ * SPDX-License-Identifier: BSD-3-Clause
120
+ *
121
+ * Redistribution and use in source and binary forms, with or without
122
+ * modification, are permitted provided that the following conditions are met:
123
+ *
124
+ * 1. Redistributions of source code must retain the above copyright notice, this
125
+ * list of conditions and the following disclaimer.
126
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
127
+ * this list of conditions and the following disclaimer in the
128
+ * documentation and/or other materials provided with the distribution.
129
+ * 3. Neither the name of the copyright holder nor the names of its contributors
130
+ * may be used to endorse or promote products derived from this software without
131
+ * specific prior written permission.
132
+ *
133
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
134
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
135
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
136
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
137
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
138
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
139
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
140
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
141
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
142
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
143
+ */
144
+ let In=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;var Ln=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e,t,n){let r=!0,i=!0,a=`Z`,o;if(typeof e==`string`){if(t)e:{if(t<3){if(+e.slice(11,13)>23){e=``;break e}t===2?(a=null,e+=`Z`):(o=e.charCodeAt(e.length-1))!==90&&o!==122&&(a=e.slice(e.length-6)),n&&(e=e.slice(0,10)+`T`+e.slice(11))}else t===4&&(e=+e.slice(0,2)>23?``:`0000-01-01T${e}Z`);r=t!==4,i=t!==3}else{let t=e.match(In);t?(t[1]||(r=!1,e=`0000-01-01T${e}`),i=!!t[2],i&&e[10]===` `&&(e=e.replace(` `,`T`)),t[2]&&+t[2]>23?e=``:(a=t[3]||null,!a&&i&&(e+=`Z`))):e=``}}super(e),isNaN(this.getTime())||(this.#e=r,this.#t=i,this.#n=a)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`||this.#n===`z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,(/* @__PURE__ */ new Date(this.getTime()-t*6e4)).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
145
+ /*!
146
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
147
+ * SPDX-License-Identifier: BSD-3-Clause
148
+ *
149
+ * Redistribution and use in source and binary forms, with or without
150
+ * modification, are permitted provided that the following conditions are met:
151
+ *
152
+ * 1. Redistributions of source code must retain the above copyright notice, this
153
+ * list of conditions and the following disclaimer.
154
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
155
+ * this list of conditions and the following disclaimer in the
156
+ * documentation and/or other materials provided with the distribution.
157
+ * 3. Neither the name of the copyright holder nor the names of its contributors
158
+ * may be used to endorse or promote products derived from this software without
159
+ * specific prior written permission.
160
+ *
161
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
162
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
163
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
164
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
165
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
166
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
167
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
168
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
169
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
170
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
171
+ */
172
+ function X(e,t=10){return t===16?e>47&&e<58||e>64&&e<71||e>96&&e<103:e>47&&e<48+t}function Rn(e,t){return e===32||e===9||e===10||e===13||t&&(e===t||e===44)||e===35}function zn(e,t){let n=e.p,r=e.s.charCodeAt(e.p);if(r===91||r===123){e.d--||Y.x(`document contains excessively nested structures. aborting.`,e);let t=r===91?Jn(e):qn(e);return e.d++,t}return r===34||r===39?Fn(e):r===116?((e.s.charCodeAt(++e.p)!==114||e.s.charCodeAt(++e.p)!==117||e.s.charCodeAt(++e.p)!==101)&&Y.x(`invalid value`,e,n),e.p++,!0):r===102?((e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==108||e.s.charCodeAt(++e.p)!==115||e.s.charCodeAt(++e.p)!==101)&&Y.x(`invalid value`,e,n),e.p++,!1):r===43||r===45?Bn(e,e.p,e.s.charCodeAt(++e.p),44-r,t):e.s.charCodeAt(e.p+4)===45&&e.s.charCodeAt(e.p+7)===45?Un(e,r,t):e.s.charCodeAt(e.p+2)===58?Wn(e,r,t):Bn(e,e.p,r,0,t)}function Bn(e,t,n,r,i){let a=n,o=0,s=!1;if(a===105)return(e.s.charCodeAt(++e.p)!==110||e.s.charCodeAt(++e.p)!==102)&&Y.x(`invalid value`,e,t),e.p++,(r||1)/0;if(a===110)return(e.s.charCodeAt(++e.p)!==97||e.s.charCodeAt(++e.p)!==110)&&Y.x(`invalid value`,e,t),e.p++,NaN;if(a===48){if(++e.p>=e.s.length||Rn(a=e.s.charCodeAt(e.p),i))return e.bi===!0?0n:0;if(!r){if(a===120)return Vn(e,t,16,i);if(a===98)return Vn(e,t,2,i);if(a===111)return Vn(e,t,8,i)}a===46?o=2:a===101||a===69?o=4:Y.x(`illegal leading zero`,e,t)}else X(a)||Y.x(`invalid value`,e,t);for(;++e.p<e.s.length&&(a=e.s.charCodeAt(e.p),!Rn(a,i));)o||=1,a===95?(o&1||Y.x(`illegal underscore`,e),o+=11,s=!0):o===1&&a===46?o=2:(o===1||o===3)&&(a===101||a===69)?o=4:o===4&&(a===43||a===45)?o=6:X(a)?o>9?o-=11:o&1||o++:Y.x(`illegal character in numeric literal`,e);if(!o){let t=(n-48)*(r||1);return e.bi===!0?BigInt(t):t}o&1||Y.x(`unfinished numeric value`,e,t);let c=e.s.slice(t,e.p);return s&&(c=c.replaceAll(`_`,``)),o>1?parseFloat(c):Hn(e,c,10,t)}function Vn(e,t,n,r){let i,a=1;for(;++e.p<e.s.length&&(i=e.s.charCodeAt(e.p),!Rn(i,r));)i===95?(a&1&&Y.x(`illegal underscore`,e),a=3):X(i,n)?a&1&&a--:Y.x(`illegal character in numeric literal`,e);a&1&&Y.x(`unfinished numeric value`,e);let o=e.s.slice(t+2,e.p);return a&&(o=o.replaceAll(`_`,``)),Hn(e,o,n,t)}function Hn(e,t,n,r){if(e.bi!==!0)e:{let i=parseInt(t,n);if(!Number.isSafeInteger(i)){if(e.bi)break e;Y.x(`integer value cannot be represented losslessly`,e,r)}return i}return BigInt(n===10?t:(n===2?`0b`:n===8?`0o`:`0x`)+t)}function Un(e,t,n){let r=e.p++,i;if(!X(t)||!X(e.s.charCodeAt(e.p++))||!X(e.s.charCodeAt(e.p++))||!X(e.s.charCodeAt(e.p++)))return Bn(e,e.p=r,t,0,n);if(e.p+=5,X(e.s.charCodeAt(e.p++))||Y.x(`invalid date-time: date part is malformed`,e,r),e.p>=e.s.length||((t=e.s.charCodeAt(e.p))!==32||(i=!0,!X(e.s.charCodeAt(e.p+1))))&&t!==84&&t!==116)return Z(e,e.s.slice(r,e.p),3,!1,r);if(e.s.charCodeAt(e.p+=3)!==58&&Y.x(`invalid date-time: time part is malformed`,e,r),e.s.charCodeAt(e.p+=3)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;X(e.s.charCodeAt(++e.p)););if(t=e.s.charCodeAt(e.p)){if(t===90||t===122)return Z(e,e.s.slice(r,++e.p),1,i,r,`[+00:00]`);if(t===43||t===45)return Z(e,e.s.slice(r,e.p+=6),1,i,r,!e.ld&&`[`+e.s.slice(e.p-6,e.p)+`]`)}return Z(e,e.s.slice(r,e.p),2,i,r)}function Wn(e,t,n){let r=e.p;if(!X(t)||!X(e.s.charCodeAt(++e.p)))return Bn(e,--e.p,t,0,n);if(e.s.charCodeAt(e.p+=4)===58&&(e.p+=3),e.s.charCodeAt(e.p)===46)for(;X(e.s.charCodeAt(++e.p)););return Z(e,e.s.slice(r,e.p),4,!1,r)}function Z(e,t,n,r,i,a){if(e.ld){let a=new Ln(t,n,r);return a.isValid()||Y.x(`invalid date`,e,i),a}try{switch(a&&(t+=a),n){case 1:return Temporal.ZonedDateTime.from(t);case 2:return Temporal.PlainDateTime.from(t);case 3:return Temporal.PlainDate.from(t);case 4:return Temporal.PlainTime.from(t)}}catch(t){Y.x(t instanceof Error?t.message:``+t,e,i)}}
173
+ /*!
174
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
175
+ * SPDX-License-Identifier: BSD-3-Clause
176
+ *
177
+ * Redistribution and use in source and binary forms, with or without
178
+ * modification, are permitted provided that the following conditions are met:
179
+ *
180
+ * 1. Redistributions of source code must retain the above copyright notice, this
181
+ * list of conditions and the following disclaimer.
182
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
183
+ * this list of conditions and the following disclaimer in the
184
+ * documentation and/or other materials provided with the distribution.
185
+ * 3. Neither the name of the copyright holder nor the names of its contributors
186
+ * may be used to endorse or promote products derived from this software without
187
+ * specific prior written permission.
188
+ *
189
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
190
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
191
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
192
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
193
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
194
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
195
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
196
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
197
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
198
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
199
+ */
200
+ function Gn(e){for(;e.p<e.s.length;e.p++){let t=e.s.charCodeAt(e.p);if(t===10)break;if(t===13&&e.s.charCodeAt(e.p+1)===10){e.p++;break}(t<32&&t!==9||t===127)&&Y.x(`control characters are not allowed in comments`,e)}}function Q(e,t,n){let r;for(;e.p<e.s.length;){for(;e.p<e.s.length&&((r=e.s.charCodeAt(e.p))===32||r===9||!t&&(r===10||r===13&&e.s.charCodeAt(e.p+1)===10));)e.p++;if(n||r!==35)break;Gn(e)}}
201
+ /*!
202
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
203
+ * SPDX-License-Identifier: BSD-3-Clause
204
+ *
205
+ * Redistribution and use in source and binary forms, with or without
206
+ * modification, are permitted provided that the following conditions are met:
207
+ *
208
+ * 1. Redistributions of source code must retain the above copyright notice, this
209
+ * list of conditions and the following disclaimer.
210
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
211
+ * this list of conditions and the following disclaimer in the
212
+ * documentation and/or other materials provided with the distribution.
213
+ * 3. Neither the name of the copyright holder nor the names of its contributors
214
+ * may be used to endorse or promote products derived from this software without
215
+ * specific prior written permission.
216
+ *
217
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
218
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
219
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
220
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
221
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
222
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
223
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
224
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
225
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
226
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
227
+ */
228
+ function Kn(e,t=61){let n,r=0,i=[],a,o=e.s.charCodeAt(n=e.p);do if(o===t)return r||Y.x(`unexpected end of key`,e),r===1&&i.push(e.s.slice(a,e.p)),e.p++,i;else o===46?(r||Y.x(`illegal empty bare key`,e),r===1&&i.push(e.s.slice(a,e.p)),r=0):!r&&(o===34||o===39)?(o===e.s.charCodeAt(e.p+1)&&o===e.s.charCodeAt(e.p+2)&&Y.x(`illegal quoted key: multiline strings are not allowed`,e),i.push(Fn(e)),r=2,e.p--):o===32||o===9?r===1&&(i.push(e.s.slice(a,e.p)),r=2):r===2||o<48&&o!==45||o>57&&o<65||o>90&&o<97&&o!==95||o>122?Y.x(`illegal character in key`,e):r||(r=1,a=e.p);while(o=e.s.charCodeAt(++e.p));Y.x(`incomplete key-value: cannot find end of key`,e,n)}function qn(e){let t=e.p++,n=Object.create(null),r=/* @__PURE__ */ new Set,i;for(;e.p<e.s.length;){if(Q(e),(i=e.s.charCodeAt(e.p))===125)return e.p++,n;let t,a=n,o=!1,s=e.p,c=Kn(e);for(let n=0;n<c.length;n++){n&&(a=o?a[t]:a[t]=Object.create(null)),t=c[n],(o=Object.hasOwn(a,t))&&(typeof a[t]!=`object`||r.has(a[t]))&&Y.x(`trying to redefine an already defined value`,e,s);let i=t===`__proto__`;if(e.uk&&(i||t===`constructor`)){a=e.uk!==1&&Y.x(`document contains an unsafe property`,e,s);break}!o&&i&&Object.defineProperty(a,t,{enumerable:!0,configurable:!0,writable:!0})}o&&Y.x(`trying to redefine an already defined value`,e,s),Q(e,!0,!0);let l=zn(e,125);if(a&&typeof(a[t]=l)==`object`&&r.add(l),Q(e),(i=e.s.charCodeAt(e.p++))===125)return n;i!==44&&Y.x(`expected comma or end of structure`,e,e.p-1)}Y.x(`unfinished table`,e,t)}function Jn(e){let t=e.p++,n=[],r;for(;e.p<e.s.length;){if(Q(e),(r=e.s.charCodeAt(e.p))===93)return e.p++,n;if(n.push(zn(e,93)),Q(e),(r=e.s.charCodeAt(e.p++))===93)return n;r!==44&&Y.x(`expected comma or end of structure`,e,e.p-1)}Y.x(`unfinished array`,e,t)}
229
+ /*!
230
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
231
+ * SPDX-License-Identifier: BSD-3-Clause
232
+ *
233
+ * Redistribution and use in source and binary forms, with or without
234
+ * modification, are permitted provided that the following conditions are met:
235
+ *
236
+ * 1. Redistributions of source code must retain the above copyright notice, this
237
+ * list of conditions and the following disclaimer.
238
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
239
+ * this list of conditions and the following disclaimer in the
240
+ * documentation and/or other materials provided with the distribution.
241
+ * 3. Neither the name of the copyright holder nor the names of its contributors
242
+ * may be used to endorse or promote products derived from this software without
243
+ * specific prior written permission.
244
+ *
245
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
246
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
247
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
248
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
249
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
250
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
251
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
252
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
253
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
254
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
255
+ */
256
+ function Yn(e,t,n,r,i){let a=n,o=r,s,c=!1,l;for(let n=0;n<t.length;n++){if(n){if(a=c?a[s]:a[s]=Object.create(null),o=(l=o[s]).c,i===0&&(l.t===1||l.t===2))return null;if(l.t===2){let e=a.length-1;a=a[e],o=o[e].c}}if(s=t[n],(c=Object.hasOwn(a,s))&&o[s]?.t===0&&o[s]?.d)return null;if(!c){let r=s===`__proto__`;if(e.uk&&(r||s===`constructor`))return!1;r&&(Object.defineProperty(a,s,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(o,s,{enumerable:!0,configurable:!0,writable:!0})),o[s]={t:n<t.length-1&&i===2?3:i,d:!1,i:0,c:Object.create(null)}}}if(l=o[s],l.t!==i&&(i!==1||l.t!==3)||(i===2&&(l.d||(l.d=!0,a[s]=[]),a[s].push(a=Object.create(null)),l.c[l.i++]=l={t:1,d:!1,i:0,c:Object.create(null)}),l.d))return null;if(l.d=!0,i===1)a=c?a[s]:a[s]=Object.create(null);else if(i===0&&c)return null;return[s,a,l.c]}function Xn(e,t,n){(t===null||e.uk===2)&&Y.x(t===null?`trying to redefine an already defined table or value`:`document contains an unsafe property`,e,n)}function Zn(e,t={}){let n={s:e,p:0,d:t.maxDepth??1e3,bi:t.integersAsBigInt??!1,ld:t.useLegacyDate??!0,uk:t.unsafeKeyBehaviour===`throw`?2:+(t.unsafeKeyBehaviour===`drop`)},r=Object.create(null),i=Object.create(null),a,o=!1,s=r,c=i;for(e.charCodeAt(0)===65279&&n.p++,Q(n);n.p<e.length;){if(e.charCodeAt(n.p)===91){let t=e.charCodeAt(++n.p)===91;a=n.p+=+t,o=!1;let l=Kn(n,93);t&&(e.charCodeAt(n.p)!==93&&Y.x(`expected end of table array declaration`,n),n.p++);let u=Yn(n,l,r,i,t?2:1);u?(c=u[2],s=u[1]):(Xn(n,u,a),o=!0)}else{a=n.p;let e=Yn(n,Kn(n),s,c,0);!e&&!o&&Xn(n,e,a),Q(n,!0,!0);let t=zn(n,void 0);e&&!o&&(e[1][e[0]]=t)}Q(n,!0),n.p<e.length&&(a=e.charCodeAt(n.p))!==10&&(a!==13||e.charCodeAt(n.p+1)!==10)&&Y.x(`each key-value declaration must be followed by an end-of-line`,n),Q(n)}return r}
257
+ /*!
258
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
259
+ * SPDX-License-Identifier: BSD-3-Clause
260
+ *
261
+ * Redistribution and use in source and binary forms, with or without
262
+ * modification, are permitted provided that the following conditions are met:
263
+ *
264
+ * 1. Redistributions of source code must retain the above copyright notice, this
265
+ * list of conditions and the following disclaimer.
266
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
267
+ * this list of conditions and the following disclaimer in the
268
+ * documentation and/or other materials provided with the distribution.
269
+ * 3. Neither the name of the copyright holder nor the names of its contributors
270
+ * may be used to endorse or promote products derived from this software without
271
+ * specific prior written permission.
272
+ *
273
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
274
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
275
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
276
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
277
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
278
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
279
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
280
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
281
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
282
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
283
+ */
284
+ ``.isWellFormed;
285
+ /*!
286
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
287
+ * SPDX-License-Identifier: BSD-3-Clause
288
+ *
289
+ * Redistribution and use in source and binary forms, with or without
290
+ * modification, are permitted provided that the following conditions are met:
291
+ *
292
+ * 1. Redistributions of source code must retain the above copyright notice, this
293
+ * list of conditions and the following disclaimer.
294
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
295
+ * this list of conditions and the following disclaimer in the
296
+ * documentation and/or other materials provided with the distribution.
297
+ * 3. Neither the name of the copyright holder nor the names of its contributors
298
+ * may be used to endorse or promote products derived from this software without
299
+ * specific prior written permission.
300
+ *
301
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
302
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
303
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
304
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
305
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
306
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
307
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
308
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
309
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
310
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
311
+ */
312
+ const Qn=/* @__PURE__ */ Tn(/* @__PURE__ */ hn(),/* @__PURE__ */ hn());function $(e,t=navigator.languages){for(let n of t){let t=n.split(`-`);for(let n=t.length;n>0;n--){let r=e[t.slice(0,n).join(`-`)];if(r!==void 0)return r}}return Object.values(e)[0]??``}const $n={en:`next`,es:`siguiente`,pt:`próximo`,fr:`suivant`,de:`weiter`,it:`successivo`,nl:`volgende`,pl:`następna`,ru:`следующий`,uk:`наступний`,tr:`sonraki`,ar:`التالي`,hi:`अगला`,bn:`পরবর্তী`,id:`berikutnya`,vi:`tiếp theo`,th:`ถัดไป`,ja:`次へ`,ko:`다음`,zh:`下一个`,"zh-TW":`下一個`},er={en:`previous`,es:`anterior`,pt:`anterior`,fr:`précédent`,de:`zurück`,it:`precedente`,nl:`vorige`,pl:`poprzednia`,ru:`предыдущий`,uk:`попередній`,tr:`önceki`,ar:`السابق`,hi:`पिछला`,bn:`পূর্ববর্তী`,id:`sebelumnya`,vi:`trước`,th:`ก่อนหน้า`,ja:`前へ`,ko:`이전`,zh:`上一个`,"zh-TW":`上一個`},tr={en:`random`,es:`aleatorio`,pt:`aleatório`,fr:`aléatoire`,de:`zufällig`,it:`casuale`,nl:`willekeurig`,pl:`losowa`,ru:`случайный`,uk:`випадковий`,tr:`rastgele`,ar:`عشوائي`,hi:`रैंडम`,bn:`এলোমেলো`,id:`acak`,vi:`ngẫu nhiên`,th:`สุ่ม`,ja:`ランダム`,ko:`무작위`,zh:`随机`,"zh-TW":`隨機`},nr={en:`loading`,es:`cargando`,pt:`carregando`,fr:`chargement`,de:`lädt`,it:`caricamento`,nl:`laden`,pl:`ładowanie`,ru:`загрузка`,uk:`завантаження`,tr:`yükleniyor`,ar:`جارٍ التحميل`,hi:`लोड हो रहा है`,bn:`লোড হচ্ছে`,id:`memuat`,vi:`đang tải`,th:`กำลังโหลด`,ja:`読み込み中`,ko:`로딩 중`,zh:`加载中`,"zh-TW":`載入中`},rr={en:`error`,es:`error`,pt:`erro`,fr:`erreur`,de:`fehler`,it:`errore`,nl:`fout`,pl:`błąd`,ru:`ошибка`,uk:`помилка`,tr:`hata`,ar:`خطأ`,hi:`त्रुटि`,bn:`ত্রুটি`,id:`kesalahan`,vi:`lỗi`,th:`ข้อผิดพลาด`,ja:`エラー`,ko:`오류`,zh:`错误`,"zh-TW":`錯誤`};function ir(e){throw Error(`reached impossible variant: ${e}`)}const ar=/* @__PURE__ */ q({version:/* @__PURE__ */ Dn([`0.0`]),name:Qn,sites:/* @__PURE__ */ Sn(/* @__PURE__ */ q({url:/* @__PURE__ */ vn(),scope:/* @__PURE__ */ Dn([`host`,`path`])})),options:/* @__PURE__ */ Mn(/* @__PURE__ */ q({homeUrl:/* @__PURE__ */ kn(/* @__PURE__ */ vn()),showRandom:/* @__PURE__ */ J(/* @__PURE__ */ bn(),!0),cssHref:/* @__PURE__ */ kn(/* @__PURE__ */ vn())}),{}),strings:/* @__PURE__ */ Mn(/* @__PURE__ */ q({next:/* @__PURE__ */ J(Qn,$n),previous:/* @__PURE__ */ J(Qn,er),random:/* @__PURE__ */ J(Qn,tr)}),{})});async function or({url:e,init:t}){let n=await fetch(e,t);if(!n.ok)throw Error(`fetchConfig response error ${n.status}: ${await n.text()}`);let r=Zn(await n.text());return ar.parse(r)}async function sr(e,t=console.error){try{return await e}catch(e){throw e instanceof yt?t(`[fairy-ring] invalid config:`,xt(e)):t(`[fairy-ring] error loading config:`,e),e}}function cr(e){let t=new URL(document.baseURI),n=e.sites.findIndex(e=>{let n=new URL(e.url);switch(e.scope){case`host`:return n.host.toLowerCase()===t.host.toLowerCase();case`path`:return n.host.toLowerCase()===t.host.toLowerCase()&&n.pathname===t.pathname;default:ir(e.scope)}});return n<0?null:[e.sites[n],n]}function lr(e,t){return(e%t+t)%t}function ur(e){let t=cr(e);return t?e.sites[lr(t[1]+1,e.sites.length)]:null}function dr(e){let t=cr(e);return t?e.sites[lr(t[1]-1,e.sites.length)]:null}function fr(e){if(e.sites.length===0)return null;if(e.sites.length===1)return e.sites[0];let[t,n=0]=cr(e)??[],r=0;for(let t=0;r===n&&t<10;++t)r=Math.floor(Math.random()*e.sites.length);return e.sites[r]}function pr(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}var mr=class extends A{static{this.styles=o`
313
+ :host {
314
+ display: flex;
315
+ flex-direction: row;
316
+ gap: 1em;
317
+ }
318
+ `}#e=new se(this,{args:()=>[this.configUrl],task:async([e],{signal:t})=>{if(!e)throw Error(`missing config-url`);return sr(or({url:e,init:{signal:t}}))}});render(){return T`
319
+ ${this.#e.render({pending:()=>T`<div class="loading">${$(nr)}</div>`,error:()=>T`<div class="error">${$(rr)}</div>`,complete:e=>T`
320
+ <a class="prev" href=${dr(e)?.url??``}
321
+ >${$(e.strings.previous)}</a
322
+ >
323
+ ${e.options.homeUrl?T`<a class="home" href=${e.options.homeUrl}>${e.name}</a>`:T`<div>${$(e.name)}</div>`}
324
+ <a class="random" href=${fr(e)?.url??``}
325
+ >${$(e.strings.random)}</a
326
+ >
327
+ <a class="next" href=${ur(e)?.url??``}>${$(e.strings.next)}</a>
328
+ `})}
329
+ `}};pr([Re({attribute:`config-url`})],mr.prototype,`configUrl`,void 0);function hr(e=`fairy-ring`){customElements.get(e)||customElements.define(e,mr)}hr();export{mr as FairyRingElement,hr as define};
package/dist/vue.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { defineComponent, h } from "vue";
2
- import { define } from "./element.js";
2
+ import { n as define } from "./element-GEcIko-6.js";
3
3
  // src/vue.ts
4
4
  const FairyRing = defineComponent(() => {
5
5
  define();
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "fairy-ring",
3
- "version": "0.0.0",
3
+ "version": "0.1.0",
4
4
  "description": "",
5
5
  "license": "ISC",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/loganzartman/fairy-ring.git"
9
+ },
6
10
  "files": [
7
11
  "dist"
8
12
  ],
@@ -34,6 +38,12 @@
34
38
  },
35
39
  "./package.json": "./package.json"
36
40
  },
41
+ "dependencies": {
42
+ "@lit/task": "^1.0.3",
43
+ "lit": "^3.3.3",
44
+ "smol-toml": "^1.9.1",
45
+ "zod": "^4.6.7"
46
+ },
37
47
  "devDependencies": {
38
48
  "@changesets/cli": "^3.0.3",
39
49
  "@storybook/addon-vitest": "^10.6.7",
@@ -71,6 +81,7 @@
71
81
  "scripts": {
72
82
  "build": "tsdown",
73
83
  "dev": "storybook dev -p 6006",
84
+ "pr-check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build",
74
85
  "typecheck": "tsc --noEmit",
75
86
  "lint": "oxlint",
76
87
  "format": "oxfmt",