fairy-ring 0.0.1 → 0.2.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.
- package/README.md +39 -1
- package/dist/element-CvyhlWFr.js +90 -0
- package/dist/element.d.ts +7 -1
- package/dist/element.js +1 -6
- package/dist/lib-B5FPZH-w.js +223 -0
- package/dist/lib.d.ts +46 -0
- package/dist/lib.js +1 -0
- package/dist/react.js +1 -1
- package/dist/solid.js +1 -1
- package/dist/standalone.js +367 -0
- package/dist/vue.js +1 -1
- package/package.json +20 -3
package/README.md
CHANGED
|
@@ -1,6 +1,38 @@
|
|
|
1
1
|
# fairy-ring
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
make webrings!
|
|
4
|
+
|
|
5
|
+
easy, customizable, ultramodern library for making your own webring. not a webring itself.
|
|
6
|
+
|
|
7
|
+
<details>
|
|
8
|
+
<summary>webring?</summary>
|
|
9
|
+
|
|
10
|
+
a webring is a collection of websites that link to each other, such that the links form a ring. A <-> B <-> C <-> A ...
|
|
11
|
+
|
|
12
|
+
each site has a "next" and a "previous" link so a user can browse through the ring.
|
|
13
|
+
|
|
14
|
+
it's an alternative method of content discovery with a long history.
|
|
15
|
+
|
|
16
|
+
</details>
|
|
17
|
+
|
|
18
|
+
<details>
|
|
19
|
+
<summary>development philosophy</summary>
|
|
20
|
+
|
|
21
|
+
use bleeding-edge web tooling to deliver a simple and fun developer and user experience.
|
|
22
|
+
|
|
23
|
+
</details>
|
|
24
|
+
|
|
25
|
+
## how?
|
|
26
|
+
|
|
27
|
+
[getting started](https://fairy-ring.loga.nz/?path=/story/docs-getting-started--getting-started)
|
|
28
|
+
|
|
29
|
+
1. write a fairy-ring config file in TOML and put it on the internet
|
|
30
|
+
2. embed your fairy-ring using a tiny snippet:
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/fairy-ring/dist/standalone.js"></script>
|
|
34
|
+
<fairy-ring class="my-ring" config-url="https://my-ring.example/fairy-ring.toml"></fairy-ring>
|
|
35
|
+
```
|
|
4
36
|
|
|
5
37
|
## development
|
|
6
38
|
|
|
@@ -15,3 +47,9 @@ Run storybook:
|
|
|
15
47
|
```bash
|
|
16
48
|
pnpm dev
|
|
17
49
|
```
|
|
50
|
+
|
|
51
|
+
Update screenshot snapshots (requires Docker):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pnpm test:update
|
|
55
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Task } from "@lit/task";
|
|
2
|
+
import { LitElement, css, html } from "lit";
|
|
3
|
+
import { property } from "lit/decorators.js";
|
|
4
|
+
import { a as getPrev, d as defaultLoadingString, i as getNext, l as renderTemplate, n as fetchConfig, o as getRandom, s as logConfigErrors, u as defaultErrorString } from "./lib-B5FPZH-w.js";
|
|
5
|
+
// \0@oxc-project+runtime@0.159.0/helpers/esm/decorate.js
|
|
6
|
+
function __decorate(decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
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;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
}
|
|
12
|
+
// src/element.ts
|
|
13
|
+
var FairyRingElement = class extends LitElement {
|
|
14
|
+
static {
|
|
15
|
+
this.styles = css`
|
|
16
|
+
:host {
|
|
17
|
+
display: grid;
|
|
18
|
+
grid-template-areas: "prev home random next";
|
|
19
|
+
justify-content: start;
|
|
20
|
+
align-items: center;
|
|
21
|
+
gap: 1em;
|
|
22
|
+
|
|
23
|
+
&::part(prev) {
|
|
24
|
+
grid-area: prev;
|
|
25
|
+
}
|
|
26
|
+
&::part(home) {
|
|
27
|
+
grid-area: home;
|
|
28
|
+
}
|
|
29
|
+
&::part(random) {
|
|
30
|
+
grid-area: random;
|
|
31
|
+
}
|
|
32
|
+
&::part(next) {
|
|
33
|
+
grid-area: next;
|
|
34
|
+
}
|
|
35
|
+
&::part(loading),
|
|
36
|
+
&::part(error) {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
:host([hidden]) {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* match the surrounding text instead of the browser's default link blue/purple */
|
|
46
|
+
a {
|
|
47
|
+
color: inherit;
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
#config = new Task(this, {
|
|
52
|
+
args: () => [this.configUrl],
|
|
53
|
+
task: async ([url], { signal }) => {
|
|
54
|
+
if (!url) throw new Error("missing config-url");
|
|
55
|
+
return logConfigErrors(fetchConfig({
|
|
56
|
+
url,
|
|
57
|
+
init: { signal }
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
render() {
|
|
62
|
+
return html`
|
|
63
|
+
${this.#config.render({
|
|
64
|
+
pending: () => html`<div part="loading">${renderTemplate(defaultLoadingString, {})}</div>`,
|
|
65
|
+
error: () => html`<div part="error">${renderTemplate(defaultErrorString, {})}</div>`,
|
|
66
|
+
complete: (config) => {
|
|
67
|
+
const r = (s) => renderTemplate(s, { name: config.name });
|
|
68
|
+
return html`
|
|
69
|
+
<a part="prev link widget" rel="prev" href=${getPrev(config)?.url ?? ""}
|
|
70
|
+
>${r(config.strings.previous)}</a
|
|
71
|
+
>
|
|
72
|
+
${config.homeUrl ? html`<a part="home link widget" href=${config.homeUrl}>${r(config.homeText)}</a>` : html`<div part="home widget">${r(config.homeText)}</div>`}
|
|
73
|
+
<a part="random link widget" href=${getRandom(config)?.url ?? ""}
|
|
74
|
+
>${r(config.strings.random)}</a
|
|
75
|
+
>
|
|
76
|
+
<a part="next link widget" rel="next" href=${getNext(config)?.url ?? ""}
|
|
77
|
+
>${r(config.strings.next)}</a
|
|
78
|
+
>
|
|
79
|
+
`;
|
|
80
|
+
}
|
|
81
|
+
})}
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
__decorate([property({ attribute: "config-url" })], FairyRingElement.prototype, "configUrl", void 0);
|
|
86
|
+
function define(tagName = "fairy-ring") {
|
|
87
|
+
if (customElements.get(tagName)) return;
|
|
88
|
+
customElements.define(tagName, FairyRingElement);
|
|
89
|
+
}
|
|
90
|
+
export { define as n, FairyRingElement as t };
|
package/dist/element.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { LitElement } from "lit";
|
|
2
|
+
export declare class FairyRingElement extends LitElement {
|
|
3
|
+
#private;
|
|
4
|
+
configUrl?: string;
|
|
5
|
+
static styles: import("lit").CSSResult;
|
|
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
|
-
|
|
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-CvyhlWFr.js";
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import * as z from "zod/v4-mini";
|
|
2
|
+
import { parse } from "smol-toml";
|
|
3
|
+
import { html, nothing } from "lit";
|
|
4
|
+
import { isTemplateResult } from "lit/directive-helpers.js";
|
|
5
|
+
// src/strings.ts
|
|
6
|
+
const locStringSchema = z.record(z.string().check(z.meta({ title: "language" })), z.string().check(z.describe("translation for a BCP 47 language tag, e.g. \"en\", \"en-US\""))).check(z.meta({
|
|
7
|
+
id: "LocString",
|
|
8
|
+
description: "maps language tag -> translation"
|
|
9
|
+
}));
|
|
10
|
+
/** pick the most specific translation for the user's preferred locales. i.e. `en-US`, then `en`. default to first locale in object. */
|
|
11
|
+
function localize(string) {
|
|
12
|
+
for (const tag of navigator.languages) {
|
|
13
|
+
const parts = tag.split("-");
|
|
14
|
+
for (let i = parts.length; i > 0; i--) {
|
|
15
|
+
const hit = string[parts.slice(0, i).join("-")];
|
|
16
|
+
if (hit !== void 0) return hit;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return Object.values(string)[0] ?? "";
|
|
20
|
+
}
|
|
21
|
+
const defaultNextString = {
|
|
22
|
+
en: "next",
|
|
23
|
+
es: "siguiente",
|
|
24
|
+
pt: "próximo",
|
|
25
|
+
fr: "suivant",
|
|
26
|
+
de: "weiter",
|
|
27
|
+
it: "successivo",
|
|
28
|
+
nl: "volgende",
|
|
29
|
+
pl: "następna",
|
|
30
|
+
ru: "следующий",
|
|
31
|
+
uk: "наступний",
|
|
32
|
+
tr: "sonraki",
|
|
33
|
+
ar: "التالي",
|
|
34
|
+
hi: "अगला",
|
|
35
|
+
bn: "পরবর্তী",
|
|
36
|
+
id: "berikutnya",
|
|
37
|
+
vi: "tiếp theo",
|
|
38
|
+
th: "ถัดไป",
|
|
39
|
+
ja: "次へ",
|
|
40
|
+
ko: "다음",
|
|
41
|
+
zh: "下一个",
|
|
42
|
+
"zh-TW": "下一個"
|
|
43
|
+
};
|
|
44
|
+
const defaultPrevString = {
|
|
45
|
+
en: "previous",
|
|
46
|
+
es: "anterior",
|
|
47
|
+
pt: "anterior",
|
|
48
|
+
fr: "précédent",
|
|
49
|
+
de: "zurück",
|
|
50
|
+
it: "precedente",
|
|
51
|
+
nl: "vorige",
|
|
52
|
+
pl: "poprzednia",
|
|
53
|
+
ru: "предыдущий",
|
|
54
|
+
uk: "попередній",
|
|
55
|
+
tr: "önceki",
|
|
56
|
+
ar: "السابق",
|
|
57
|
+
hi: "पिछला",
|
|
58
|
+
bn: "পূর্ববর্তী",
|
|
59
|
+
id: "sebelumnya",
|
|
60
|
+
vi: "trước",
|
|
61
|
+
th: "ก่อนหน้า",
|
|
62
|
+
ja: "前へ",
|
|
63
|
+
ko: "이전",
|
|
64
|
+
zh: "上一个",
|
|
65
|
+
"zh-TW": "上一個"
|
|
66
|
+
};
|
|
67
|
+
const defaultRandomString = {
|
|
68
|
+
en: "random",
|
|
69
|
+
es: "aleatorio",
|
|
70
|
+
pt: "aleatório",
|
|
71
|
+
fr: "aléatoire",
|
|
72
|
+
de: "zufällig",
|
|
73
|
+
it: "casuale",
|
|
74
|
+
nl: "willekeurig",
|
|
75
|
+
pl: "losowa",
|
|
76
|
+
ru: "случайный",
|
|
77
|
+
uk: "випадковий",
|
|
78
|
+
tr: "rastgele",
|
|
79
|
+
ar: "عشوائي",
|
|
80
|
+
hi: "रैंडम",
|
|
81
|
+
bn: "এলোমেলো",
|
|
82
|
+
id: "acak",
|
|
83
|
+
vi: "ngẫu nhiên",
|
|
84
|
+
th: "สุ่ม",
|
|
85
|
+
ja: "ランダム",
|
|
86
|
+
ko: "무작위",
|
|
87
|
+
zh: "随机",
|
|
88
|
+
"zh-TW": "隨機"
|
|
89
|
+
};
|
|
90
|
+
const defaultLoadingString = {
|
|
91
|
+
en: "loading",
|
|
92
|
+
es: "cargando",
|
|
93
|
+
pt: "carregando",
|
|
94
|
+
fr: "chargement",
|
|
95
|
+
de: "lädt",
|
|
96
|
+
it: "caricamento",
|
|
97
|
+
nl: "laden",
|
|
98
|
+
pl: "ładowanie",
|
|
99
|
+
ru: "загрузка",
|
|
100
|
+
uk: "завантаження",
|
|
101
|
+
tr: "yükleniyor",
|
|
102
|
+
ar: "جارٍ التحميل",
|
|
103
|
+
hi: "लोड हो रहा है",
|
|
104
|
+
bn: "লোড হচ্ছে",
|
|
105
|
+
id: "memuat",
|
|
106
|
+
vi: "đang tải",
|
|
107
|
+
th: "กำลังโหลด",
|
|
108
|
+
ja: "読み込み中",
|
|
109
|
+
ko: "로딩 중",
|
|
110
|
+
zh: "加载中",
|
|
111
|
+
"zh-TW": "載入中"
|
|
112
|
+
};
|
|
113
|
+
const defaultErrorString = {
|
|
114
|
+
en: "error",
|
|
115
|
+
es: "error",
|
|
116
|
+
pt: "erro",
|
|
117
|
+
fr: "erreur",
|
|
118
|
+
de: "fehler",
|
|
119
|
+
it: "errore",
|
|
120
|
+
nl: "fout",
|
|
121
|
+
pl: "błąd",
|
|
122
|
+
ru: "ошибка",
|
|
123
|
+
uk: "помилка",
|
|
124
|
+
tr: "hata",
|
|
125
|
+
ar: "خطأ",
|
|
126
|
+
hi: "त्रुटि",
|
|
127
|
+
bn: "ত্রুটি",
|
|
128
|
+
id: "kesalahan",
|
|
129
|
+
vi: "lỗi",
|
|
130
|
+
th: "ข้อผิดพลาด",
|
|
131
|
+
ja: "エラー",
|
|
132
|
+
ko: "오류",
|
|
133
|
+
zh: "错误",
|
|
134
|
+
"zh-TW": "錯誤"
|
|
135
|
+
};
|
|
136
|
+
// src/impossible.ts
|
|
137
|
+
function impossible(x) {
|
|
138
|
+
throw new Error(`reached impossible variant: ${x}`);
|
|
139
|
+
}
|
|
140
|
+
// src/template.ts
|
|
141
|
+
function renderTemplate(template, values) {
|
|
142
|
+
const parts = localize(template).split(/\{\{\s*(\w+)\s*\}\}/).map((s, i) => {
|
|
143
|
+
if (i % 2 === 1) {
|
|
144
|
+
const value = Object.hasOwn(values, s) ? values[s] : void 0;
|
|
145
|
+
if (isTemplateResult(value)) return value;
|
|
146
|
+
if (typeof value === "object") return localize(value);
|
|
147
|
+
if (value !== void 0) return value;
|
|
148
|
+
console.error("[fairy-ring] unknown template key:", s);
|
|
149
|
+
return nothing;
|
|
150
|
+
} else return s;
|
|
151
|
+
});
|
|
152
|
+
return html`${parts}`;
|
|
153
|
+
}
|
|
154
|
+
// src/lib.ts
|
|
155
|
+
const linkUrlSchema = z.url({ protocol: /^https?$/ });
|
|
156
|
+
const siteSchema = z.object({
|
|
157
|
+
url: linkUrlSchema.check(z.describe("where to link to")),
|
|
158
|
+
scope: z.enum(["host", "path"]).check(z.describe("what part of this link does the site own? \"host\": all of my.example.com. \"path\": just sub-paths of my.example.com/path, not my.example.com/other"))
|
|
159
|
+
}).check(z.meta({ id: "Site" }));
|
|
160
|
+
const configSchema = z.object({
|
|
161
|
+
configVersion: z.union([z.literal(1)]).check(z.describe("config schema version")),
|
|
162
|
+
name: z.nonoptional(locStringSchema).check(z.describe("name of this webring. include in a string with {{name}}.")),
|
|
163
|
+
homeText: z._default(locStringSchema, { und: "{{name}}" }).check(z.describe("text that links to the homepage. defaults to \"{{name}}\".")),
|
|
164
|
+
homeUrl: z.optional(linkUrlSchema).check(z.describe("a homepage for the webring, if one exists")),
|
|
165
|
+
sites: z.array(siteSchema).check(z.describe("list sites in the webring")),
|
|
166
|
+
strings: z.prefault(z.object({
|
|
167
|
+
next: z._default(locStringSchema, defaultNextString).check(z.describe("link to the next site")),
|
|
168
|
+
previous: z._default(locStringSchema, defaultPrevString).check(z.describe("link to the previous site")),
|
|
169
|
+
random: z._default(locStringSchema, defaultRandomString).check(z.describe("link to a random site"))
|
|
170
|
+
}).check(z.meta({ id: "Strings" })), {}).check(z.describe("overrides for built-in translations"))
|
|
171
|
+
});
|
|
172
|
+
async function fetchConfig({ url, init }) {
|
|
173
|
+
const result = await fetch(url, init);
|
|
174
|
+
if (!result.ok) throw new Error(`fetchConfig response error ${result.status}: ${await result.text()}`);
|
|
175
|
+
const raw = await result.text();
|
|
176
|
+
const json = parse(raw);
|
|
177
|
+
return configSchema.parse(json);
|
|
178
|
+
}
|
|
179
|
+
async function logConfigErrors(promise, log = console.error) {
|
|
180
|
+
try {
|
|
181
|
+
return await promise;
|
|
182
|
+
} catch (error) {
|
|
183
|
+
if (error instanceof z.core.$ZodError) log("[fairy-ring] invalid config:", z.prettifyError(error));
|
|
184
|
+
else log("[fairy-ring] error loading config:", error);
|
|
185
|
+
throw error;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
/** match against the configured sites; if this is one of them, return [Site, index]; else, return null */
|
|
189
|
+
function getCurrent(config) {
|
|
190
|
+
const url = new URL(document.baseURI);
|
|
191
|
+
const index = config.sites.findIndex((site) => {
|
|
192
|
+
const siteUrl = new URL(site.url);
|
|
193
|
+
switch (site.scope) {
|
|
194
|
+
case "host": return siteUrl.host.toLowerCase() === url.host.toLowerCase();
|
|
195
|
+
case "path": return siteUrl.host.toLowerCase() === url.host.toLowerCase() && siteUrl.pathname === url.pathname;
|
|
196
|
+
default: impossible(site.scope);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
if (index < 0) return null;
|
|
200
|
+
return [config.sites[index], index];
|
|
201
|
+
}
|
|
202
|
+
function mod(a, b) {
|
|
203
|
+
return (a % b + b) % b;
|
|
204
|
+
}
|
|
205
|
+
function getNext(config) {
|
|
206
|
+
const cur = getCurrent(config);
|
|
207
|
+
if (!cur) return null;
|
|
208
|
+
return config.sites[mod(cur[1] + 1, config.sites.length)];
|
|
209
|
+
}
|
|
210
|
+
function getPrev(config) {
|
|
211
|
+
const cur = getCurrent(config);
|
|
212
|
+
if (!cur) return null;
|
|
213
|
+
return config.sites[mod(cur[1] - 1, config.sites.length)];
|
|
214
|
+
}
|
|
215
|
+
function getRandom(config) {
|
|
216
|
+
if (config.sites.length === 0) return null;
|
|
217
|
+
if (config.sites.length === 1) return config.sites[0];
|
|
218
|
+
const [_, cur = 0] = getCurrent(config) ?? [];
|
|
219
|
+
let site = 0;
|
|
220
|
+
for (let i = 0; site === cur && i < 10; ++i) site = Math.floor(Math.random() * config.sites.length);
|
|
221
|
+
return config.sites[site];
|
|
222
|
+
}
|
|
223
|
+
export { getPrev as a, siteSchema as c, defaultLoadingString as d, localize as f, getNext as i, renderTemplate as l, fetchConfig as n, getRandom as o, getCurrent as r, logConfigErrors as s, configSchema as t, defaultErrorString as u };
|
package/dist/lib.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as z from "zod/v4-mini";
|
|
2
|
+
import { TemplateResult, nothing } from "lit";
|
|
3
|
+
declare const locStringSchema: z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>;
|
|
4
|
+
type LocString = z.infer<typeof locStringSchema>;
|
|
5
|
+
/** pick the most specific translation for the user's preferred locales. i.e. `en-US`, then `en`. default to first locale in object. */
|
|
6
|
+
export declare function localize(string: LocString): string;
|
|
7
|
+
export declare function renderTemplate(template: LocString, values: Record<string, string | LocString | TemplateResult | typeof nothing>): TemplateResult;
|
|
8
|
+
export declare const siteSchema: z.ZodMiniObject<{
|
|
9
|
+
url: z.ZodMiniURL;
|
|
10
|
+
scope: z.ZodMiniEnum<{
|
|
11
|
+
host: "host";
|
|
12
|
+
path: "path";
|
|
13
|
+
}>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export type Site = z.infer<typeof siteSchema>;
|
|
16
|
+
export declare const configSchema: z.ZodMiniObject<{
|
|
17
|
+
configVersion: z.ZodMiniUnion<readonly [z.ZodMiniLiteral<1>]>;
|
|
18
|
+
name: z.ZodMiniNonOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
19
|
+
homeText: z.ZodMiniDefault<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
20
|
+
homeUrl: z.ZodMiniOptional<z.ZodMiniURL>;
|
|
21
|
+
sites: z.ZodMiniArray<z.ZodMiniObject<{
|
|
22
|
+
url: z.ZodMiniURL;
|
|
23
|
+
scope: z.ZodMiniEnum<{
|
|
24
|
+
host: "host";
|
|
25
|
+
path: "path";
|
|
26
|
+
}>;
|
|
27
|
+
}, z.core.$strip>>;
|
|
28
|
+
strings: z.ZodMiniPrefault<z.ZodMiniObject<{
|
|
29
|
+
next: z.ZodMiniDefault<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
30
|
+
previous: z.ZodMiniDefault<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
31
|
+
random: z.ZodMiniDefault<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniString<string>>>;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type Config = z.infer<typeof configSchema>;
|
|
35
|
+
export type GetConfigOptions = {
|
|
36
|
+
url: string;
|
|
37
|
+
init?: RequestInit | undefined;
|
|
38
|
+
};
|
|
39
|
+
export declare function fetchConfig({ url, init }: GetConfigOptions): Promise<Config>;
|
|
40
|
+
export declare function logConfigErrors(promise: Promise<Config>, log?: (...data: any[]) => void): Promise<Config>;
|
|
41
|
+
/** match against the configured sites; if this is one of them, return [Site, index]; else, return null */
|
|
42
|
+
export declare function getCurrent(config: Config): [Site, number] | null;
|
|
43
|
+
export declare function getNext(config: Config): Site | null;
|
|
44
|
+
export declare function getPrev(config: Config): Site | null;
|
|
45
|
+
export declare function getRandom(config: Config): Site | null;
|
|
46
|
+
export type { LocString };
|
package/dist/lib.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as configSchema, n as fetchConfig, r as getCurrent, i as getNext, a as getPrev, o as getRandom, f as localize, s as logConfigErrors, l as renderTemplate, c as siteSchema } from "./lib-B5FPZH-w.js";
|
package/dist/react.js
CHANGED
package/dist/solid.js
CHANGED
|
@@ -0,0 +1,367 @@
|
|
|
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}},_=(e,t)=>!l(e,t),ie={attribute:!0,type:String,converter:g,reflect:!1,useDefault:!1,hasChanged:_};Symbol.metadata??=Symbol(`metadata`),m.litPropertyMetadata??=/* @__PURE__ */ new WeakMap;var v=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=ie){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)??ie}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??_)(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){}};v.elementStyles=[],v.shadowRootOptions={mode:`open`},v[h(`elementProperties`)]=/* @__PURE__ */ new Map,v[h(`finalized`)]=/* @__PURE__ */ new Map,re?.({ReactiveElement:v}),(m.reactiveElementVersions??=[]).push(`2.1.2`);const ae=Symbol();
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2017 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/
|
|
18
|
+
var oe=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??se,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===ae)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 se=(e,t)=>e===t||e.length===t.length&&e.every(((e,n)=>!_(e,t[n]))),ce=globalThis,le=e=>e,ue=ce.trustedTypes,de=ue?ue.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]===`.`?Oe:r[1]===`?`?ke:r[1]===`@`?Ae:j}),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=ue?ue.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 A(i,i.nextSibling,this,e):s.type===1?t=new s.ctor(i,s.name,s.strings,this,e):s.type===6&&(t=new je(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++}},A=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=le(e).nextSibling;le(e).remove(),e=t}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},j=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??``)}},Oe=class extends j{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===D?void 0:e}},ke=class extends j{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==D)}},Ae=class extends j{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)}},je=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)}};const Me={M:fe,P:y,A:pe,C:1,L:Te,R:De,D:ge,V:k,I:A,H:j,N:ke,U:Ae,B:Oe,F:je};(0,ce.litHtmlPolyfillSupport)?.(Ee,A),(ce.litHtmlVersions??=[]).push(`3.3.3`);const Ne=(e,t,n)=>{let r=n?.renderBefore??t,i=r._$litPart$;if(i===void 0){let e=n?.renderBefore??null;r._$litPart$=i=new A(t.insertBefore(x(),e),e,void 0,n??{})}return i._$AI(e),i},Pe=globalThis
|
|
26
|
+
/**
|
|
27
|
+
* @license
|
|
28
|
+
* Copyright 2017 Google LLC
|
|
29
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
30
|
+
*/
|
|
31
|
+
;var M=class extends v{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=Ne(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return E}};M._$litElement$=!0,M.finalized=!0,Pe.litElementHydrateSupport?.({LitElement:M}),(0,Pe.litElementPolyfillSupport)?.({LitElement:M}),(Pe.litElementVersions??=[]).push(`4.2.2`);
|
|
32
|
+
/**
|
|
33
|
+
* @license
|
|
34
|
+
* Copyright 2017 Google LLC
|
|
35
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
36
|
+
*/const Fe={attribute:!0,type:String,converter:g,reflect:!1,hasChanged:_},Ie=(e=Fe,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 Le(e){return(t,n)=>typeof n==`object`?Ie(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 Re(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 ze(e,t){return typeof t==`bigint`?t.toString():t}var Be=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 Ve(e){return new Be(e)}function He(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ue(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}const We=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function Ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Ke(e){if(Ge(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return Ge(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function qe(e){return Ke(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const Je=/* @__PURE__*/ new Set([`string`,`number`,`symbol`]);function Ye(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Xe(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function N(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 Ze(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}function P(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 Qe(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 F(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function I(e){return typeof e==`string`?e:e?.message}function $e(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 et(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function L(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:I(e.inst?._zod.def?.error?.(e))??I(a?.(e))??I(t?.error?.(e))??I(n.customError?.(e))??I(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 tt(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):rt(e,n,r.value)}}function R(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function nt(e,t,n){return R(e,t,n,!1)}function rt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:R(this,t,n.bind(this))},set(e){R(this,t,e)}})}function it(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}let at,z=!1;const ot={configurable:!0,get(){z=!0}};function B(e,t,n){let r=Object.getPrototypeOf(e._zod);t in r&&at!==e._zod?at=void 0:(at=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,ot);let e=z;z=!1;try{let r=n(this);return z?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),z||=e,r}catch(n){throw delete this[t],z||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}}))}function st(e,t,n,r){let i=it(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 ct;const lt={value:void 0,enumerable:!1};let ut=`captureStackTrace`in Error?Error:null;function dt(e){let t=ut;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ut=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}/* @__NO_SIDE_EFFECTS__ */
|
|
43
|
+
function V(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){lt.value=new a(r);try{Object.defineProperty(n,"_zod",lt)}finally{lt.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),tt(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?dt(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 H=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};(ct=globalThis).__zod_globalConfig??(ct.__zod_globalConfig={});const U=globalThis.__zod_globalConfig;function W(e){return e&&Object.assign(U,e),U}function ft(){let e=this._zod;return e.message??=JSON.stringify(e.def,ze,2),e.message}function pt(e){this._zod.message=e}const mt={get:ft,set:pt,enumerable:!0,configurable:!0},ht={value:void 0,enumerable:!1},gt=/* @__PURE__ */ new WeakSet([Object.prototype,Error.prototype]),_t=(e,t)=>{e.name=`$ZodError`,ht.value=t,Object.defineProperty(e,"issues",ht),ht.value=void 0,Object.defineProperty(e,"message",mt);let n=Object.getPrototypeOf(e);gt.has(n)||(gt.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})}}))},vt=/* @__PURE__ */ V(`$ZodError`,_t),G=/* @__PURE__ */ V(`$ZodError`,_t,void 0,{Parent:Error});function yt(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 bt(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 ${yt(e.path)}`);return t.join(`
|
|
44
|
+
`)}const xt=/* @__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 H;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>L(e,o,W())));throw We(n,a?.callee??t),n}return s.value};return t})(G),St=/* @__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=>L(e,o,W())));throw We(n,a?.callee??t),n}return s.value};return t})(G),Ct=/* @__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 H;return a.issues.length?wt(e,a.issues,i):{success:!0,data:a.value}})(G);function wt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>L(e,n,W()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}const Tt=/* @__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?wt(e,a.issues,i):{success:!0,data:a.value}})(G),Et=/^https?$/,Dt=/^[\s\S]{0,}$/,Ot=/^-?\d+(?:\.\d+)?$/,kt=/*@__PURE__*/ V(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),At=/*@__PURE__*/ V(`$ZodCheckStringFormat`,(e,t)=>{var n,r;kt.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=()=>{})}),jt={major:4,minor:6,patch:7},K=/*@__PURE__*/ V(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=jt;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=P(t),a;for(let o of n){if(o._zod.def.when){if(Qe(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 H;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(et(t.issues,n,e),i||=P(t,n))});else{if(t.issues.length===n)continue;et(t.issues,n,e),i||=P(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(P(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new H;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 H;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return nt(this,`~standard`,Pt(this))},set"~standard"(e){R(this,`~standard`,e)}}),Mt=(e,t)=>e.issues.length?{issues:e.issues.map(e=>L(e,t,W()))}:{value:e.value};async function Nt(e,t){let n={async:!0};return Mt(await e._zod.run({value:t,issues:[]},n),n)}function Pt(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Mt(r,n)}catch{}return Nt(e,t)},vendor:`zod`,version:1}}const Ft=/*@__PURE__*/ V(`$ZodString`,(e,t)=>{K.init(e,t),e._zod.pattern=t.pattern??Dt,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}}),It=/*@__PURE__*/ V(`$ZodStringFormat`,(e,t)=>{At.init(e,t),Ft.init(e,t)});function Lt(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Rt(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Lt(e)||2:zt(e,t)}function zt(e,t){if(!t.normalize&&t.protocol?.source===Et.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 Bt=/[\t\n\r]/g;function Vt(e){return e.replace(Bt,``)}function Ht(e,t){return t.lastIndex=0,t.test(e.hostname)}function Ut(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}const Wt=/*@__PURE__*/ V(`$ZodURL`,(e,t)=>{It.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Rt(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=Vt(r);return}t.hostname&&!Ht(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&&!Ut(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:Vt(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}});function Gt(e,t){let n=$e(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 $e(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,et(n.issues,t,e),n}}return i(n,a)}}const Kt=e=>Array.isArray(e)?e.length:-1;function qt(e,t,n){e.issues.length&&t.issues.push(...F(n,e.issues)),t.value[n]=e.value}const Jt=/*@__PURE__*/ V(`$ZodArray`,(e,t)=>{K.init(e,t);let n=U.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=>qt(t,r,e)));else if(qt(c,r,e),s&&c.issues.length!==0&&P(c))break}return o.length?Promise.all(o).then(()=>r):r},Gt(e,Kt)});function Yt(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(...F(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 Xt=[];function Zt(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Xt,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=Ze(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Qt(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(P(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=>Yt(e,n,i,t,d,f))):Yt(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 $t=/*@__PURE__*/ V(`$ZodObject`,(e,t)=>{K.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=Ve(()=>Zt(t));B(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)||Ue(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=Ge,o=t.catchall,s,c=U.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(P(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=>Yt(n,t,e,r,a,o))):Yt(s,t,e,r,a,o)}return o?Qt(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}});function en(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!P(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>L(e,r,W())))}),t)}const tn=/*@__PURE__*/ V(`$ZodUnion`,(e,t)=>{K.init(e,t),B(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),B(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),B(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),B(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>He(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>en(t,r,e,i)):en(o,r,e,i)}}),nn=/*@__PURE__*/ V(`$ZodRecord`,(e,t)=>{K.init(e,t);let n=U.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Ke(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=>L(e,i,W())),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(...F(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...F(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`&&Ot.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=>L(e,i,W())),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(...F(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...F(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__*/ V(`$ZodEnum`,(e,t)=>{K.init(e,t);let n=Re(t.entries),r=new Set(n);e._zod.values=r,B(e,`pattern`,e=>{let t=Re(e.def.entries).filter(e=>Je.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ye(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}}),an=/*@__PURE__*/ V(`$ZodLiteral`,(e,t)=>{K.init(e,t);let n=new Set(t.values);e._zod.values=n,B(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ye(e):e?Ye(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}});function on(e,t){return e.value=t.issues.length?void 0:t.value,e}const sn=/*@__PURE__*/ V(`$ZodOptional`,(e,t)=>{K.init(e,t),B(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,B(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?/* @__PURE__ */ new Set([...t,void 0]):void 0}),B(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${He(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=>on(e,t)):on(e,r)}return t.innerType._zod.run(e,n)}}),cn=/*@__PURE__*/ V(`$ZodDefault`,(e,t)=>{K.init(e,t),e._zod.optin=`defaulted`,B(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=>ln(e,t)):ln(r,t)}});function ln(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const un=/*@__PURE__*/ V(`$ZodPrefault`,(e,t)=>{K.init(e,t),e._zod.optin=`defaulted`,B(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))}),dn=/*@__PURE__*/ V(`$ZodNonOptional`,(e,t)=>{K.init(e,t),B(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>fn(t,e)):fn(i,e)}});function fn(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var pn,mn=class{constructor(){this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=/* @__PURE__ */ new WeakMap,this._idmap=/* @__PURE__ */ new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function hn(){return new mn}(pn=globalThis).__zod_globalRegistry??(pn.__zod_globalRegistry=hn());const gn=globalThis.__zod_globalRegistry;function _n(e){return e.checks&&=[...e.checks],e}// @__NO_SIDE_EFFECTS__
|
|
45
|
+
function vn(e,t){return new e(_n({type:`string`,...N(t)}))}// @__NO_SIDE_EFFECTS__
|
|
46
|
+
function yn(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...N(t)})}// @__NO_SIDE_EFFECTS__
|
|
47
|
+
function bn(e){let t=new kt({check:`describe`});return t._zod.onattach=[t=>{let n=gn.get(t)??{};gn.add(t,{...n,description:e})}],t._zod.check=()=>{},t}// @__NO_SIDE_EFFECTS__
|
|
48
|
+
function xn(e){let t=new kt({check:`meta`});return t._zod.onattach=[t=>{let n=gn.get(t)??{};gn.add(t,{...n,...e})}],t._zod.check=()=>{},t}const q=/*@__PURE__*/ V(`ZodMiniType`,(e,t)=>{if(!e._zod)throw Error(`Uninitialized schema in ZodMiniType.`);K.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){R(this,`with`,e)},parse(e,t){return xt(this,e,t,{callee:this.parse})},parseAsync(e,t){return St(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Ct(this,e,t)},safeParseAsync(e,t){return Tt(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 Xe(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)}}),Sn=/*@__PURE__*/ V(`ZodMiniString`,(e,t)=>{Ft.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
49
|
+
function Cn(e){return/* @__PURE__ */ vn(Sn,e)}const wn=/*@__PURE__*/ V(`ZodMiniStringFormat`,(e,t)=>{It.init(e,t),Sn.init(e,t)}),Tn=/*@__PURE__*/ V(`ZodMiniURL`,(e,t)=>{Wt.init(e,t),wn.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
50
|
+
function En(e){return/* @__PURE__ */ yn(Tn,e)}const Dn=/*@__PURE__*/ V(`ZodMiniArray`,(e,t)=>{Jt.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
51
|
+
function On(e,t){return new Dn({type:`array`,element:e,...N(t)})}const kn=/*@__PURE__*/ V(`ZodMiniObject`,(e,t)=>{$t.init(e,t),q.init(e,t),st(e,`shape`,e=>e._zod.def.shape,!1)});// @__NO_SIDE_EFFECTS__
|
|
52
|
+
function An(e,t){let n={type:`object`,shape:e??{},...N(t)};return new kn(n)}const jn=/*@__PURE__*/ V(`ZodMiniUnion`,(e,t)=>{tn.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
53
|
+
function Mn(e,t){return new jn({type:`union`,options:e,...N(t)})}const Nn=/*@__PURE__*/ V(`ZodMiniRecord`,(e,t)=>{nn.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
54
|
+
function Pn(e,t,n){return!t||!t._zod?new Nn({type:`record`,keyType:/* @__PURE__ */ Cn(),valueType:e,...N(t)}):new Nn({type:`record`,keyType:e,valueType:t,...N(n)})}const Fn=/*@__PURE__*/ V(`ZodMiniEnum`,(e,t)=>{rn.init(e,t),q.init(e,t),e.options=[...e._zod.values]});// @__NO_SIDE_EFFECTS__
|
|
55
|
+
function In(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new Fn({type:`enum`,entries:n,...N(t)})}const Ln=/*@__PURE__*/ V(`ZodMiniLiteral`,(e,t)=>{an.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
56
|
+
function Rn(e,t){return new Ln({type:`literal`,values:Array.isArray(e)?e:[e],...N(t)})}const zn=/*@__PURE__*/ V(`ZodMiniOptional`,(e,t)=>{sn.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
57
|
+
function Bn(e){return new zn({type:`optional`,innerType:e})}const Vn=/*@__PURE__*/ V(`ZodMiniDefault`,(e,t)=>{cn.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
58
|
+
function Hn(e,t){return new Vn({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():qe(t)}})}const Un=/*@__PURE__*/ V(`ZodMiniPrefault`,(e,t)=>{un.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
59
|
+
function Wn(e,t){return new Un({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():qe(t)}})}const Gn=/*@__PURE__*/ V(`ZodMiniNonOptional`,(e,t)=>{dn.init(e,t),q.init(e,t)});// @__NO_SIDE_EFFECTS__
|
|
60
|
+
function Kn(e,t){return new Gn({type:`nonoptional`,innerType:e,...N(t)})}const J=bn,qn=xn;
|
|
61
|
+
/*!
|
|
62
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
63
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
64
|
+
*
|
|
65
|
+
* Redistribution and use in source and binary forms, with or without
|
|
66
|
+
* modification, are permitted provided that the following conditions are met:
|
|
67
|
+
*
|
|
68
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
69
|
+
* list of conditions and the following disclaimer.
|
|
70
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
71
|
+
* this list of conditions and the following disclaimer in the
|
|
72
|
+
* documentation and/or other materials provided with the distribution.
|
|
73
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
74
|
+
* may be used to endorse or promote products derived from this software without
|
|
75
|
+
* specific prior written permission.
|
|
76
|
+
*
|
|
77
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
78
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
79
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
80
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
81
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
82
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
83
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
84
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
85
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
86
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
87
|
+
*/
|
|
88
|
+
function Jn(e,t){let n=e.slice(0,t).split(/\r?\n/);return[n.length,n.pop().length+1]}function Yn(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+=`
|
|
89
|
+
`,e===t&&(i+=` `.repeat(a+n+2),i+=`^
|
|
90
|
+
`))}return i}var Y=class e extends Error{line;column;codeblock;constructor(e,t){let[n,r]=Jn(t.toml,t.ptr),i=Yn(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})}};
|
|
91
|
+
/*!
|
|
92
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
93
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
94
|
+
*
|
|
95
|
+
* Redistribution and use in source and binary forms, with or without
|
|
96
|
+
* modification, are permitted provided that the following conditions are met:
|
|
97
|
+
*
|
|
98
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
99
|
+
* list of conditions and the following disclaimer.
|
|
100
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
101
|
+
* this list of conditions and the following disclaimer in the
|
|
102
|
+
* documentation and/or other materials provided with the distribution.
|
|
103
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
104
|
+
* may be used to endorse or promote products derived from this software without
|
|
105
|
+
* specific prior written permission.
|
|
106
|
+
*
|
|
107
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
108
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
109
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
110
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
111
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
112
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
113
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
114
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
115
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
116
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
117
|
+
*/
|
|
118
|
+
function Xn(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+=`
|
|
119
|
+
`: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)}
|
|
120
|
+
/*!
|
|
121
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
122
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
123
|
+
*
|
|
124
|
+
* Redistribution and use in source and binary forms, with or without
|
|
125
|
+
* modification, are permitted provided that the following conditions are met:
|
|
126
|
+
*
|
|
127
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
128
|
+
* list of conditions and the following disclaimer.
|
|
129
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
130
|
+
* this list of conditions and the following disclaimer in the
|
|
131
|
+
* documentation and/or other materials provided with the distribution.
|
|
132
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
133
|
+
* may be used to endorse or promote products derived from this software without
|
|
134
|
+
* specific prior written permission.
|
|
135
|
+
*
|
|
136
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
137
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
138
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
139
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
140
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
141
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
142
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
143
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
144
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
145
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
146
|
+
*/
|
|
147
|
+
let Zn=/^(\d{4}-\d{2}-\d{2})?[Tt ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|z|[-+]\d{2}:\d{2})?$/i;var Qn=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(Zn);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}};
|
|
148
|
+
/*!
|
|
149
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
150
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
151
|
+
*
|
|
152
|
+
* Redistribution and use in source and binary forms, with or without
|
|
153
|
+
* modification, are permitted provided that the following conditions are met:
|
|
154
|
+
*
|
|
155
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
156
|
+
* list of conditions and the following disclaimer.
|
|
157
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
158
|
+
* this list of conditions and the following disclaimer in the
|
|
159
|
+
* documentation and/or other materials provided with the distribution.
|
|
160
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
161
|
+
* may be used to endorse or promote products derived from this software without
|
|
162
|
+
* specific prior written permission.
|
|
163
|
+
*
|
|
164
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
165
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
166
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
167
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
168
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
169
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
170
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
171
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
172
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
173
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
174
|
+
*/
|
|
175
|
+
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 $n(e,t){return e===32||e===9||e===10||e===13||t&&(e===t||e===44)||e===35}function er(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?lr(e):cr(e);return e.d++,t}return r===34||r===39?Xn(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?tr(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?ir(e,r,t):e.s.charCodeAt(e.p+2)===58?ar(e,r,t):tr(e,e.p,r,0,t)}function tr(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||$n(a=e.s.charCodeAt(e.p),i))return e.bi===!0?0n:0;if(!r){if(a===120)return nr(e,t,16,i);if(a===98)return nr(e,t,2,i);if(a===111)return nr(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),!$n(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):rr(e,c,10,t)}function nr(e,t,n,r){let i,a=1;for(;++e.p<e.s.length&&(i=e.s.charCodeAt(e.p),!$n(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(`_`,``)),rr(e,o,n,t)}function rr(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 ir(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 tr(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 ar(e,t,n){let r=e.p;if(!X(t)||!X(e.s.charCodeAt(++e.p)))return tr(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 Qn(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)}}
|
|
176
|
+
/*!
|
|
177
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
178
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
179
|
+
*
|
|
180
|
+
* Redistribution and use in source and binary forms, with or without
|
|
181
|
+
* modification, are permitted provided that the following conditions are met:
|
|
182
|
+
*
|
|
183
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
184
|
+
* list of conditions and the following disclaimer.
|
|
185
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
186
|
+
* this list of conditions and the following disclaimer in the
|
|
187
|
+
* documentation and/or other materials provided with the distribution.
|
|
188
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
189
|
+
* may be used to endorse or promote products derived from this software without
|
|
190
|
+
* specific prior written permission.
|
|
191
|
+
*
|
|
192
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
193
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
194
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
195
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
196
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
197
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
198
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
199
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
200
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
201
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
202
|
+
*/
|
|
203
|
+
function or(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;or(e)}}
|
|
204
|
+
/*!
|
|
205
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
206
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
207
|
+
*
|
|
208
|
+
* Redistribution and use in source and binary forms, with or without
|
|
209
|
+
* modification, are permitted provided that the following conditions are met:
|
|
210
|
+
*
|
|
211
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
212
|
+
* list of conditions and the following disclaimer.
|
|
213
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
214
|
+
* this list of conditions and the following disclaimer in the
|
|
215
|
+
* documentation and/or other materials provided with the distribution.
|
|
216
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
217
|
+
* may be used to endorse or promote products derived from this software without
|
|
218
|
+
* specific prior written permission.
|
|
219
|
+
*
|
|
220
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
221
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
222
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
223
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
224
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
225
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
226
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
227
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
228
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
229
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
230
|
+
*/
|
|
231
|
+
function sr(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(Xn(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 cr(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=sr(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=er(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 lr(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(er(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)}
|
|
232
|
+
/*!
|
|
233
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
234
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
235
|
+
*
|
|
236
|
+
* Redistribution and use in source and binary forms, with or without
|
|
237
|
+
* modification, are permitted provided that the following conditions are met:
|
|
238
|
+
*
|
|
239
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
240
|
+
* list of conditions and the following disclaimer.
|
|
241
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
242
|
+
* this list of conditions and the following disclaimer in the
|
|
243
|
+
* documentation and/or other materials provided with the distribution.
|
|
244
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
245
|
+
* may be used to endorse or promote products derived from this software without
|
|
246
|
+
* specific prior written permission.
|
|
247
|
+
*
|
|
248
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
249
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
250
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
251
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
252
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
253
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
254
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
255
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
256
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
257
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
258
|
+
*/
|
|
259
|
+
function ur(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 dr(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 fr(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=sr(n,93);t&&(e.charCodeAt(n.p)!==93&&Y.x(`expected end of table array declaration`,n),n.p++);let u=ur(n,l,r,i,t?2:1);u?(c=u[2],s=u[1]):(dr(n,u,a),o=!0)}else{a=n.p;let e=ur(n,sr(n),s,c,0);!e&&!o&&dr(n,e,a),Q(n,!0,!0);let t=er(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}
|
|
260
|
+
/*!
|
|
261
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
262
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
263
|
+
*
|
|
264
|
+
* Redistribution and use in source and binary forms, with or without
|
|
265
|
+
* modification, are permitted provided that the following conditions are met:
|
|
266
|
+
*
|
|
267
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
268
|
+
* list of conditions and the following disclaimer.
|
|
269
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
270
|
+
* this list of conditions and the following disclaimer in the
|
|
271
|
+
* documentation and/or other materials provided with the distribution.
|
|
272
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
273
|
+
* may be used to endorse or promote products derived from this software without
|
|
274
|
+
* specific prior written permission.
|
|
275
|
+
*
|
|
276
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
277
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
278
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
279
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
280
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
281
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
282
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
283
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
284
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
285
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
286
|
+
*/
|
|
287
|
+
``.isWellFormed;
|
|
288
|
+
/*!
|
|
289
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
290
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
291
|
+
*
|
|
292
|
+
* Redistribution and use in source and binary forms, with or without
|
|
293
|
+
* modification, are permitted provided that the following conditions are met:
|
|
294
|
+
*
|
|
295
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
296
|
+
* list of conditions and the following disclaimer.
|
|
297
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
298
|
+
* this list of conditions and the following disclaimer in the
|
|
299
|
+
* documentation and/or other materials provided with the distribution.
|
|
300
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
301
|
+
* may be used to endorse or promote products derived from this software without
|
|
302
|
+
* specific prior written permission.
|
|
303
|
+
*
|
|
304
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
305
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
306
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
307
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
308
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
309
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
310
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
311
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
312
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
313
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
314
|
+
*/
|
|
315
|
+
const $=(/* @__PURE__ */ Pn((/* @__PURE__ */ Cn()).check(qn({title:`language`})),(/* @__PURE__ */ Cn()).check(J(`translation for a BCP 47 language tag, e.g. "en", "en-US"`)))).check(qn({id:`LocString`,description:`maps language tag -> translation`}));function pr(e){for(let t of navigator.languages){let n=t.split(`-`);for(let t=n.length;t>0;t--){let r=e[n.slice(0,t).join(`-`)];if(r!==void 0)return r}}return Object.values(e)[0]??``}const mr={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":`下一個`},hr={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":`上一個`},gr={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":`隨機`},_r={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":`載入中`},vr={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 yr(e){throw Error(`reached impossible variant: ${e}`)}
|
|
316
|
+
/**
|
|
317
|
+
* @license
|
|
318
|
+
* Copyright 2020 Google LLC
|
|
319
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
320
|
+
*/const{I:br}=Me,xr=(e,t)=>t===void 0?e?._$litType$!==void 0:e?._$litType$===t;function Sr(e,t){let n=pr(e).split(/\{\{\s*(\w+)\s*\}\}/).map((e,n)=>{if(n%2==1){let n=Object.hasOwn(t,e)?t[e]:void 0;return xr(n)?n:typeof n==`object`?pr(n):n===void 0?(console.error(`[fairy-ring] unknown template key:`,e),D):n}return e});return T`${n}`}const Cr=/* @__PURE__ */ En({protocol:/^https?$/}),wr=(/* @__PURE__ */ An({url:Cr.check(J(`where to link to`)),scope:(/* @__PURE__ */ In([`host`,`path`])).check(J(`what part of this link does the site own? "host": all of my.example.com. "path": just sub-paths of my.example.com/path, not my.example.com/other`))})).check(qn({id:`Site`})),Tr=/* @__PURE__ */ An({configVersion:(/* @__PURE__ */ Mn([/* @__PURE__ */ Rn(1)])).check(J(`config schema version`)),name:(/* @__PURE__ */ Kn($)).check(J(`name of this webring. include in a string with {{name}}.`)),homeText:(/* @__PURE__ */ Hn($,{und:`{{name}}`})).check(J(`text that links to the homepage. defaults to "{{name}}".`)),homeUrl:(/* @__PURE__ */ Bn(Cr)).check(J(`a homepage for the webring, if one exists`)),sites:(/* @__PURE__ */ On(wr)).check(J(`list sites in the webring`)),strings:(/* @__PURE__ */ Wn((/* @__PURE__ */ An({next:(/* @__PURE__ */ Hn($,mr)).check(J(`link to the next site`)),previous:(/* @__PURE__ */ Hn($,hr)).check(J(`link to the previous site`)),random:(/* @__PURE__ */ Hn($,gr)).check(J(`link to a random site`))})).check(qn({id:`Strings`})),{})).check(J(`overrides for built-in translations`))});async function Er({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=fr(await n.text());return Tr.parse(r)}async function Dr(e,t=console.error){try{return await e}catch(e){throw e instanceof vt?t(`[fairy-ring] invalid config:`,bt(e)):t(`[fairy-ring] error loading config:`,e),e}}function Or(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:yr(e.scope)}});return n<0?null:[e.sites[n],n]}function kr(e,t){return(e%t+t)%t}function Ar(e){let t=Or(e);return t?e.sites[kr(t[1]+1,e.sites.length)]:null}function jr(e){let t=Or(e);return t?e.sites[kr(t[1]-1,e.sites.length)]:null}function Mr(e){if(e.sites.length===0)return null;if(e.sites.length===1)return e.sites[0];let[t,n=0]=Or(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 Nr(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 Pr=class extends M{static{this.styles=o`
|
|
321
|
+
:host {
|
|
322
|
+
display: grid;
|
|
323
|
+
grid-template-areas: "prev home random next";
|
|
324
|
+
justify-content: start;
|
|
325
|
+
align-items: center;
|
|
326
|
+
gap: 1em;
|
|
327
|
+
|
|
328
|
+
&::part(prev) {
|
|
329
|
+
grid-area: prev;
|
|
330
|
+
}
|
|
331
|
+
&::part(home) {
|
|
332
|
+
grid-area: home;
|
|
333
|
+
}
|
|
334
|
+
&::part(random) {
|
|
335
|
+
grid-area: random;
|
|
336
|
+
}
|
|
337
|
+
&::part(next) {
|
|
338
|
+
grid-area: next;
|
|
339
|
+
}
|
|
340
|
+
&::part(loading),
|
|
341
|
+
&::part(error) {
|
|
342
|
+
display: none;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
:host([hidden]) {
|
|
347
|
+
display: none;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* match the surrounding text instead of the browser's default link blue/purple */
|
|
351
|
+
a {
|
|
352
|
+
color: inherit;
|
|
353
|
+
}
|
|
354
|
+
`}#e=new oe(this,{args:()=>[this.configUrl],task:async([e],{signal:t})=>{if(!e)throw Error(`missing config-url`);return Dr(Er({url:e,init:{signal:t}}))}});render(){return T`
|
|
355
|
+
${this.#e.render({pending:()=>T`<div part="loading">${Sr(_r,{})}</div>`,error:()=>T`<div part="error">${Sr(vr,{})}</div>`,complete:e=>{let t=t=>Sr(t,{name:e.name});return T`
|
|
356
|
+
<a part="prev link widget" rel="prev" href=${jr(e)?.url??``}
|
|
357
|
+
>${t(e.strings.previous)}</a
|
|
358
|
+
>
|
|
359
|
+
${e.homeUrl?T`<a part="home link widget" href=${e.homeUrl}>${t(e.homeText)}</a>`:T`<div part="home widget">${t(e.homeText)}</div>`}
|
|
360
|
+
<a part="random link widget" href=${Mr(e)?.url??``}
|
|
361
|
+
>${t(e.strings.random)}</a
|
|
362
|
+
>
|
|
363
|
+
<a part="next link widget" rel="next" href=${Ar(e)?.url??``}
|
|
364
|
+
>${t(e.strings.next)}</a
|
|
365
|
+
>
|
|
366
|
+
`}})}
|
|
367
|
+
`}};Nr([Le({attribute:`config-url`})],Pr.prototype,`configUrl`,void 0);function Fr(e=`fairy-ring`){customElements.get(e)||customElements.define(e,Pr)}Fr();export{Pr as FairyRingElement,Fr as define};
|
package/dist/vue.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairy-ring",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.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
|
],
|
|
9
13
|
"type": "module",
|
|
10
|
-
"sideEffects":
|
|
14
|
+
"sideEffects": [
|
|
15
|
+
"./dist/standalone.js"
|
|
16
|
+
],
|
|
11
17
|
"exports": {
|
|
12
18
|
".": {
|
|
13
19
|
"types": "./dist/index.d.ts",
|
|
@@ -17,6 +23,11 @@
|
|
|
17
23
|
"types": "./dist/element.d.ts",
|
|
18
24
|
"default": "./dist/element.js"
|
|
19
25
|
},
|
|
26
|
+
"./lib": {
|
|
27
|
+
"types": "./dist/lib.d.ts",
|
|
28
|
+
"default": "./dist/lib.js"
|
|
29
|
+
},
|
|
30
|
+
"./standalone": "./dist/standalone.js",
|
|
20
31
|
"./react": {
|
|
21
32
|
"types": "./dist/react.d.ts",
|
|
22
33
|
"default": "./dist/react.js"
|
|
@@ -32,14 +43,19 @@
|
|
|
32
43
|
"./package.json": "./package.json"
|
|
33
44
|
},
|
|
34
45
|
"dependencies": {
|
|
46
|
+
"@lit/task": "^1.0.3",
|
|
47
|
+
"lit": "^3.3.3",
|
|
48
|
+
"smol-toml": "^1.9.1",
|
|
35
49
|
"zod": "^4.6.7"
|
|
36
50
|
},
|
|
37
51
|
"devDependencies": {
|
|
38
52
|
"@changesets/cli": "^3.0.3",
|
|
53
|
+
"@storybook/addon-docs": "10.6.7",
|
|
39
54
|
"@storybook/addon-vitest": "^10.6.7",
|
|
40
55
|
"@storybook/web-components-vite": "^10.6.7",
|
|
41
56
|
"@types/react": "^19.3.0",
|
|
42
57
|
"@vitest/browser-playwright": "^5.1.1",
|
|
58
|
+
"highlight.js": "^11.12.0",
|
|
43
59
|
"oxfmt": "^0.79.0",
|
|
44
60
|
"oxlint": "^1.94.0",
|
|
45
61
|
"playwright": "^1.65.1",
|
|
@@ -47,7 +63,7 @@
|
|
|
47
63
|
"solid-js": "^2.0.1",
|
|
48
64
|
"storybook": "^10.6.7",
|
|
49
65
|
"tsdown": "^0.23.7",
|
|
50
|
-
"typescript": "
|
|
66
|
+
"typescript": "7.1.0-beta",
|
|
51
67
|
"vite": "^8.3.8",
|
|
52
68
|
"vitest": "^5.1.1",
|
|
53
69
|
"vue": "^3.5.45"
|
|
@@ -71,6 +87,7 @@
|
|
|
71
87
|
"scripts": {
|
|
72
88
|
"build": "tsdown",
|
|
73
89
|
"dev": "storybook dev -p 6006",
|
|
90
|
+
"pr-check": "pnpm typecheck && pnpm lint && pnpm format:check && pnpm build",
|
|
74
91
|
"typecheck": "tsc --noEmit",
|
|
75
92
|
"lint": "oxlint",
|
|
76
93
|
"format": "oxfmt",
|