duckfn-docs-kit 0.4.0 → 0.4.1

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.
@@ -119,10 +119,167 @@ var m = class extends l {
119
119
  #m(e, t, n, r) {
120
120
  e.href = n.href, t.textContent = n.label, r ? (e.target = "_blank", e.rel = "noopener noreferrer") : (e.removeAttribute("target"), e.removeAttribute("rel"));
121
121
  }
122
+ }, h = class {
123
+ root = u("button", {
124
+ class: "dfk-icon-button",
125
+ type: "button"
126
+ });
127
+ #e = u("iconify-icon", {
128
+ class: "dfk-icon",
129
+ attrs: { "aria-hidden": "true" }
130
+ });
131
+ constructor(e, t) {
132
+ this.root.appendChild(this.#e), this.root.addEventListener("click", t), this.setIcon(e);
133
+ }
134
+ setIcon(e) {
135
+ this.#e.setAttribute("icon", e);
136
+ }
137
+ setLabel(e) {
138
+ this.root.setAttribute("data-tip", e), this.root.setAttribute("aria-label", e);
139
+ }
140
+ setOn(e) {
141
+ this.root.classList.toggle("dfk-icon-on", e);
142
+ }
143
+ setDisabled(e) {
144
+ e ? this.root.setAttribute("disabled", "") : this.root.removeAttribute("disabled");
145
+ }
146
+ };
147
+ //#endregion
148
+ //#region src/download.ts
149
+ function g(e) {
150
+ let t = new Blob([e.text], { type: e.mime }), n = URL.createObjectURL(t), r = u("a", {
151
+ href: n,
152
+ download: e.name
153
+ });
154
+ document.body.appendChild(r), r.click(), r.remove(), window.setTimeout(() => URL.revokeObjectURL(n), 0);
155
+ }
156
+ var _ = "diagram", ne = 80, v = "-", re = /^[\s\p{Cf}]+|[\s\p{Cf}]+$/gu;
157
+ function ie(e) {
158
+ return e === void 0 ? "" : e.replace(re, "");
159
+ }
160
+ function y(e, t, n = {}) {
161
+ let r = [
162
+ n.source === void 0 ? void 0 : ae(n.source),
163
+ se(e),
164
+ e.ownerDocument.title
165
+ ].map(ie).find((e) => e !== "");
166
+ return r === void 0 ? `${n.fallback ?? _}.${t}` : `${c(r, {
167
+ replacement: v,
168
+ maxLength: ne
169
+ })}.${t}`;
170
+ }
171
+ function ae(e) {
172
+ let t = /^---\r?\n([\s\S]*?)\r?\n---/.exec(e.trimStart())?.[1];
173
+ if (t === void 0) return;
174
+ let n = /^title\s*:\s*(.+)$/m.exec(t)?.[1];
175
+ return n === void 0 ? void 0 : oe(n.trim());
176
+ }
177
+ function oe(e) {
178
+ let t = e[0];
179
+ return (t === "\"" || t === "'") && e.endsWith(t) ? e.slice(1, -1) : e;
180
+ }
181
+ function se(e) {
182
+ let t = e.closest("article") ?? e.ownerDocument, n;
183
+ for (let r of t.querySelectorAll("h1, h2, h3, h4, h5, h6")) {
184
+ if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
185
+ let t = r.textContent?.trim();
186
+ t && (n = t);
187
+ }
188
+ return n;
189
+ }
190
+ //#endregion
191
+ //#region src/panzoom-view.ts
192
+ var ce = 1, le = 8, ue = .25, de = null;
193
+ function fe() {
194
+ return de ??= import("@panzoom/panzoom").then((e) => e.default), de;
195
+ }
196
+ var pe = class {
197
+ #e;
198
+ #t;
199
+ #n = null;
200
+ #r = !1;
201
+ #i = !1;
202
+ #a = !1;
203
+ #o = (e) => {
204
+ this.#n?.zoomWithWheel(e);
205
+ };
206
+ #s = () => {
207
+ this.#e.classList.toggle("dfk-panzoom-zoomed", this.zoomed);
208
+ };
209
+ #c = () => {
210
+ this.#e.classList.toggle("dfk-panzoom-grabbing", this.zoomed);
211
+ };
212
+ #l = () => {
213
+ this.#e.classList.remove("dfk-panzoom-grabbing");
214
+ };
215
+ constructor(e, t) {
216
+ this.#e = e, this.#t = t, t.addEventListener("panzoomchange", this.#s), t.addEventListener("panzoomstart", this.#c), t.addEventListener("panzoomend", this.#l);
217
+ }
218
+ get zoomed() {
219
+ return (this.#n?.getScale() ?? ce) > ce;
220
+ }
221
+ setContent(e) {
222
+ this.#t.replaceChildren(...e ? [e] : []), this.reset();
223
+ }
224
+ setActive(e) {
225
+ e !== this.#i && (this.#i = e, e ? this.#u() : (this.reset(), this.#d(!1), this.#m()));
226
+ }
227
+ reset() {
228
+ this.#n?.reset({ animate: !me() });
229
+ }
230
+ destroy() {
231
+ this.#i = !1, this.#m(), this.#n?.destroy(), this.#n = null, this.#e.classList.remove("dfk-panzoom-zoomed", "dfk-panzoom-grabbing");
232
+ }
233
+ async #u() {
234
+ if (this.#n !== null) {
235
+ this.#d(!0), this.#p();
236
+ return;
237
+ }
238
+ if (!this.#r) {
239
+ this.#r = !0;
240
+ try {
241
+ let e = await fe();
242
+ if (!this.#i || this.#n !== null) return;
243
+ this.#n = e(this.#t, {
244
+ maxScale: le,
245
+ minScale: ce,
246
+ step: ue,
247
+ panOnlyWhenZoomed: !0,
248
+ touchAction: "pan-y",
249
+ cursor: "",
250
+ disablePan: !1,
251
+ disableZoom: !1,
252
+ handleStartEvent: (e) => {
253
+ this.zoomed && (e.preventDefault(), e.stopPropagation());
254
+ }
255
+ }), this.#f(), this.#p();
256
+ } catch {} finally {
257
+ this.#r = !1;
258
+ }
259
+ }
260
+ }
261
+ #d(e) {
262
+ this.#n !== null && (this.#n.setOptions({
263
+ disablePan: !e,
264
+ disableZoom: !e
265
+ }), this.#f());
266
+ }
267
+ #f() {
268
+ this.#t.style.userSelect = "", this.#e.style.userSelect = "";
269
+ }
270
+ #p() {
271
+ this.#a || (this.#a = !0, this.#e.addEventListener("wheel", this.#o, { passive: !1 }));
272
+ }
273
+ #m() {
274
+ this.#a && (this.#a = !1, this.#e.removeEventListener("wheel", this.#o));
275
+ }
122
276
  };
277
+ function me() {
278
+ return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
279
+ }
123
280
  //#endregion
124
281
  //#region src/codemirror.ts
125
- async function ne(e, t, n, r = {}) {
282
+ async function he(e, t, n, r = {}) {
126
283
  let [{ basicSetup: i }, { EditorView: a, keymap: o }, { defaultKeymap: s, historyKeymap: c }, { Compartment: l }] = await Promise.all([
127
284
  import("codemirror"),
128
285
  import("@codemirror/view"),
@@ -139,7 +296,8 @@ async function ne(e, t, n, r = {}) {
139
296
  e.docChanged && n(e.state.doc.toString());
140
297
  })
141
298
  ],
142
- parent: e
299
+ parent: e,
300
+ root: e.getRootNode()
143
301
  });
144
302
  return {
145
303
  getValue: () => f.state.doc.toString(),
@@ -153,74 +311,101 @@ async function ne(e, t, n, r = {}) {
153
311
  };
154
312
  }
155
313
  //#endregion
156
- //#region src/IconButton.ts
157
- var h = class {
158
- root = u("button", {
159
- class: "dfk-icon-button",
314
+ //#region src/source-dialog.ts
315
+ var ge = class {
316
+ root = u("dialog", { class: "dfk-source-dialog" });
317
+ #e = u("h2", { class: "dfk-source-dialog-title" });
318
+ #t = u("div", { class: "dfk-source-dialog-editor" });
319
+ #n = u("button", {
320
+ class: "dfk-source-dialog-button dfk-source-dialog-apply",
160
321
  type: "button"
161
322
  });
162
- #e = u("iconify-icon", {
163
- class: "dfk-icon",
164
- attrs: { "aria-hidden": "true" }
323
+ #r = u("button", {
324
+ class: "dfk-source-dialog-button",
325
+ type: "button"
165
326
  });
166
- constructor(e, t) {
167
- this.root.appendChild(this.#e), this.root.addEventListener("click", t), this.setIcon(e);
327
+ #i = "";
328
+ #a = null;
329
+ #o = null;
330
+ #s = !1;
331
+ constructor(e) {
332
+ this.#n.addEventListener("click", () => this.#l()), this.#r.addEventListener("click", () => this.root.close()), this.root.append(u("div", { class: "dfk-source-dialog-body" }, (e) => e.append(this.#e, this.#t, u("div", { class: "dfk-source-dialog-footer" }, (e) => e.append(this.#r, this.#n))))), this.setLabels(e);
168
333
  }
169
- setIcon(e) {
170
- this.#e.setAttribute("icon", e);
334
+ setLabels(e) {
335
+ this.#e.textContent = e.title, this.#r.textContent = e.cancel, this.#n.textContent = e.apply;
171
336
  }
172
- setLabel(e) {
173
- this.root.setAttribute("data-tip", e), this.root.setAttribute("aria-label", e);
337
+ open(e, t) {
338
+ if (this.#i = e, this.#a = t, this.root.showModal(), this.#o) {
339
+ this.#o.setValue(e);
340
+ return;
341
+ }
342
+ this.#c();
174
343
  }
175
- setOn(e) {
176
- this.root.classList.toggle("dfk-icon-on", e);
344
+ destroy() {
345
+ this.#o?.destroy(), this.#o = null, this.root.open && this.root.close();
177
346
  }
178
- setDisabled(e) {
179
- e ? this.root.setAttribute("disabled", "") : this.root.removeAttribute("disabled");
347
+ async #c() {
348
+ if (!this.#s) {
349
+ this.#s = !0;
350
+ try {
351
+ let e = await he(this.#t, this.#i, () => void 0);
352
+ if (!this.root.isConnected || !this.root.open) {
353
+ e.destroy();
354
+ return;
355
+ }
356
+ e.setWrap(!0), this.#o = e;
357
+ } catch {} finally {
358
+ this.#s = !1;
359
+ }
360
+ }
180
361
  }
181
- }, g = {
362
+ #l() {
363
+ let e = this.#o?.getValue();
364
+ this.root.close(), e !== void 0 && e !== this.#i && (this.#i = e, this.#a?.(e));
365
+ }
366
+ }, b = {
182
367
  theme: {
183
368
  light: "redux-color",
184
369
  dark: "redux-dark-color"
185
370
  },
186
371
  options: { look: "neo" }
187
372
  };
188
- function _(e) {
373
+ function x(e) {
189
374
  return {
190
375
  theme: {
191
- light: e?.theme?.light ?? g.theme.light,
192
- dark: e?.theme?.dark ?? g.theme.dark
376
+ light: e?.theme?.light ?? b.theme.light,
377
+ dark: e?.theme?.dark ?? b.theme.dark
193
378
  },
194
379
  options: {
195
- ...g.options,
380
+ ...b.options,
196
381
  ...e?.options
197
382
  }
198
383
  };
199
384
  }
200
- function v(e) {
201
- if (!e) return _();
385
+ function _e(e) {
386
+ if (!e) return x();
202
387
  try {
203
- return _(JSON.parse(e));
388
+ return x(JSON.parse(e));
204
389
  } catch {
205
- return _();
390
+ return x();
206
391
  }
207
392
  }
208
393
  //#endregion
209
394
  //#region src/mermaid/render.ts
210
- var re = Promise.resolve();
211
- function ie(e) {
212
- let t = re.then(e, e);
213
- return re = t.catch(() => void 0), t;
214
- }
215
- var ae = null;
216
- function oe() {
217
- return ae ??= import("mermaid").then((e) => e.default), ae;
218
- }
219
- var se = 0;
220
- function ce({ source: e, config: t, colorMode: n }) {
221
- let r = `dfk-mermaid-svg-${se += 1}`;
222
- return ie(async () => {
223
- let i = await oe(), a = {
395
+ var ve = Promise.resolve();
396
+ function ye(e) {
397
+ let t = ve.then(e, e);
398
+ return ve = t.catch(() => void 0), t;
399
+ }
400
+ var be = null;
401
+ function xe() {
402
+ return be ??= import("mermaid").then((e) => e.default), be;
403
+ }
404
+ var Se = 0;
405
+ function Ce({ source: e, config: t, colorMode: n }) {
406
+ let r = `dfk-mermaid-svg-${Se += 1}`;
407
+ return ye(async () => {
408
+ let i = await xe(), a = {
224
409
  startOnLoad: !1,
225
410
  ...t.options,
226
411
  theme: t.theme[n]
@@ -237,68 +422,29 @@ function ce({ source: e, config: t, colorMode: n }) {
237
422
  }
238
423
  });
239
424
  }
240
- function le() {
425
+ function we() {
241
426
  return document.documentElement.getAttribute("data-theme") === "dark" ? "dark" : "light";
242
427
  }
243
- function ue(e) {
428
+ function Te(e) {
244
429
  let t = new MutationObserver(e);
245
430
  return t.observe(document.documentElement, { attributeFilter: ["data-theme"] }), () => t.disconnect();
246
431
  }
247
- function de(e, t) {
432
+ function Ee(e, t) {
248
433
  let n = new DOMParser().parseFromString(t, "text/html").body.querySelector("svg");
249
434
  return n ? e.importNode(n, !0) : null;
250
435
  }
251
- async function fe() {
252
- return (await import("@panzoom/panzoom")).default;
253
- }
254
- function pe(e) {
436
+ function De(e) {
255
437
  return new XMLSerializer().serializeToString(e);
256
438
  }
257
439
  //#endregion
258
440
  //#region src/mermaid/DfkMermaid.css?inline
259
- var me = "*,:before,:after{box-sizing:border-box}:host{margin:1rem 0;display:block}.dfk-mermaid-canvas{position:relative}.dfk-mermaid-viewport{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);padding:.75rem;overflow:hidden}.dfk-mermaid-content>svg{max-width:100%;height:auto;margin:0 auto;display:block}.dfk-mermaid-canvas.dfk-mermaid-zoomed{cursor:grab}.dfk-mermaid-canvas.dfk-mermaid-zoomed.dfk-mermaid-grabbing{cursor:grabbing}.dfk-mermaid-message{color:var(--ifm-color-emphasis-700,#666);margin:.5rem 0 0;font-size:.8rem}.dfk-mermaid-message:empty{display:none}.dfk-mermaid-message-error{border-radius:var(--ifm-global-radius,.25rem);color:var(--ifm-color-danger-contrast,#fff);background:var(--ifm-color-danger,#d32f2f);font-family:var(--ifm-font-family-monospace,ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--ifm-code-font-size,95%);white-space:pre-wrap;word-break:break-word;padding:.5rem .75rem}.dfk-mermaid-canvas[hidden],.dfk-mermaid-message[hidden]{display:none}.dfk-mermaid-actions{z-index:2;border-radius:var(--ifm-global-radius,.3rem);background:var(--ifm-color-emphasis-100,#f5f5f5);opacity:0;pointer-events:none;align-items:center;gap:.15rem;padding:.1rem .2rem;transition:opacity .12s;display:flex;position:absolute;top:.25rem;right:.25rem}.dfk-mermaid-canvas:hover .dfk-mermaid-actions,.dfk-mermaid-canvas:focus-within .dfk-mermaid-actions{opacity:1;pointer-events:auto}.dfk-icon-button{border-radius:var(--ifm-global-radius,.25rem);width:1.6rem;height:1.6rem;color:var(--ifm-color-emphasis-700,#666);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex;position:relative}.dfk-icon-button:hover:not(:disabled),.dfk-icon-button:focus-visible{background:var(--ifm-color-emphasis-200,#e6e6e6);color:var(--ifm-color-primary,#14459b)}.dfk-icon-button:disabled{opacity:.45;cursor:progress}.dfk-icon-button[hidden]{display:none}.dfk-icon{font-size:1rem}[data-tip]:after{content:attr(data-tip);z-index:2;border-radius:var(--ifm-global-radius,.25rem);background:var(--ifm-color-emphasis-800,#333);color:var(--ifm-color-emphasis-0,#fff);white-space:nowrap;opacity:0;pointer-events:none;padding:.15rem .4rem;font-size:.7rem;line-height:1.4;transition:opacity .12s;position:absolute;top:calc(100% + .3rem);right:0}[data-tip]:hover:after,[data-tip]:focus-visible:after{opacity:1}.dfk-mermaid-expanded{z-index:2147483000;background:var(--ifm-background-surface-color,#fff);flex-direction:column;display:flex;position:fixed;inset:0}.dfk-mermaid-expanded .dfk-mermaid-viewport{border:none;border-radius:0;flex:1}.dfk-mermaid-dialog{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);width:min(56rem,92vw);max-width:none;color:var(--ifm-font-color-base,#181818);padding:0}.dfk-mermaid-dialog::backdrop{background:#00000073}.dfk-mermaid-dialog-body{flex-direction:column;gap:.5rem;padding:.75rem;display:flex}.dfk-mermaid-dialog-title{margin:0;font-size:.95rem;font-weight:600}.dfk-mermaid-dialog-editor{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);font-size:var(--ifm-code-font-size,95%);overflow:hidden}.dfk-mermaid-dialog-editor .cm-editor{outline:none}.dfk-mermaid-dialog-editor .cm-scroller{max-height:55vh;font-family:var(--ifm-font-family-monospace,ui-monospace, SFMono-Regular, Menlo, monospace);line-height:1.6}.dfk-mermaid-dialog-footer{justify-content:flex-end;gap:.5rem;display:flex}.dfk-mermaid-dialog-button{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.25rem);background:var(--ifm-background-surface-color,#fff);color:var(--ifm-font-color-base,#181818);cursor:pointer;padding:.3rem .9rem;font-family:inherit;font-size:.85rem}.dfk-mermaid-dialog-button:hover{border-color:var(--ifm-color-primary,#14459b);color:var(--ifm-color-primary,#14459b)}.dfk-mermaid-dialog-apply{border-color:var(--ifm-color-primary,#14459b);background:var(--ifm-color-primary,#14459b);color:var(--ifm-button-color,#fff)}.dfk-mermaid-dialog-apply:hover{color:var(--ifm-button-color,#fff);filter:brightness(1.1)}", y = null;
260
- function he() {
261
- return y || (y = new CSSStyleSheet(), y.replaceSync(me)), y;
262
- }
263
- //#endregion
264
- //#region src/mermaid/title.ts
265
- var ge = "mermaid-diagram.svg", _e = 80, ve = "-", ye = /^[\s\p{Cf}]+|[\s\p{Cf}]+$/gu;
266
- function be(e) {
267
- return e === void 0 ? "" : e.replace(ye, "");
268
- }
269
- function xe(e, t) {
270
- let n = [
271
- Se(e),
272
- we(t),
273
- t.ownerDocument.title
274
- ].map(be).find((e) => e !== "");
275
- return n === void 0 ? ge : `${c(n, {
276
- replacement: ve,
277
- maxLength: _e
278
- })}.svg`;
279
- }
280
- function Se(e) {
281
- let t = /^---\r?\n([\s\S]*?)\r?\n---/.exec(e.trimStart())?.[1];
282
- if (t === void 0) return;
283
- let n = /^title\s*:\s*(.+)$/m.exec(t)?.[1];
284
- return n === void 0 ? void 0 : Ce(n.trim());
285
- }
286
- function Ce(e) {
287
- let t = e[0];
288
- return (t === "\"" || t === "'") && e.endsWith(t) ? e.slice(1, -1) : e;
289
- }
290
- function we(e) {
291
- let t = e.closest("article") ?? e.ownerDocument, n;
292
- for (let r of t.querySelectorAll("h1, h2, h3, h4, h5, h6")) {
293
- if (!(r.compareDocumentPosition(e) & Node.DOCUMENT_POSITION_FOLLOWING)) break;
294
- let t = r.textContent?.trim();
295
- t && (n = t);
296
- }
297
- return n;
441
+ var Oe = "*,:before,:after{box-sizing:border-box}:host{margin:1rem 0;display:block}:host([embedded]){margin:0}.dfk-mermaid-canvas{position:relative}.dfk-mermaid-viewport{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);padding:.75rem;overflow:hidden}:host([embedded]) .dfk-mermaid-viewport{border:none;border-radius:0;padding:0}:host(.dfk-mermaid-fullscreen),:host(.dfk-mermaid-fullscreen) .dfk-mermaid-canvas,:host(.dfk-mermaid-fullscreen) .dfk-mermaid-viewport{height:100%}.dfk-mermaid-content>svg{max-width:100%;height:auto;margin:0 auto;display:block}.dfk-mermaid-viewport.dfk-panzoom-zoomed{cursor:grab}.dfk-mermaid-viewport.dfk-panzoom-zoomed.dfk-panzoom-grabbing{cursor:grabbing}.dfk-mermaid-message{color:var(--ifm-color-emphasis-700,#666);margin:.5rem 0 0;font-size:.8rem}.dfk-mermaid-message:empty{display:none}.dfk-mermaid-message-error{border-radius:var(--ifm-global-radius,.25rem);color:var(--ifm-color-danger-contrast,#fff);background:var(--ifm-color-danger,#d32f2f);font-family:var(--ifm-font-family-monospace,ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--ifm-code-font-size,95%);white-space:pre-wrap;word-break:break-word;padding:.5rem .75rem}.dfk-mermaid-canvas[hidden],.dfk-mermaid-message[hidden]{display:none}.dfk-mermaid-actions{z-index:2;border-radius:var(--ifm-global-radius,.3rem);background:var(--ifm-color-emphasis-100,#f5f5f5);opacity:0;pointer-events:none;align-items:center;gap:.15rem;padding:.1rem .2rem;transition:opacity .12s;display:flex;position:absolute;top:.25rem;right:.25rem}.dfk-mermaid-canvas:hover .dfk-mermaid-actions,.dfk-mermaid-canvas:focus-within .dfk-mermaid-actions{opacity:1;pointer-events:auto}.dfk-icon-button{border-radius:var(--ifm-global-radius,.25rem);width:1.6rem;height:1.6rem;color:var(--ifm-color-emphasis-700,#666);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex;position:relative}.dfk-icon-button:hover:not(:disabled),.dfk-icon-button:focus-visible{background:var(--ifm-color-emphasis-200,#e6e6e6);color:var(--ifm-color-primary,#14459b)}.dfk-icon-button:disabled{opacity:.45;cursor:progress}.dfk-icon-button[hidden]{display:none}.dfk-icon{font-size:1rem}[data-tip]:after{content:attr(data-tip);z-index:2;border-radius:var(--ifm-global-radius,.25rem);background:var(--ifm-color-emphasis-800,#333);color:var(--ifm-color-emphasis-0,#fff);white-space:nowrap;opacity:0;pointer-events:none;padding:.15rem .4rem;font-size:.7rem;line-height:1.4;transition:opacity .12s;position:absolute;top:calc(100% + .3rem);right:0}[data-tip]:hover:after,[data-tip]:focus-visible:after{opacity:1}.dfk-mermaid-expanded{z-index:2147483000;background:var(--ifm-background-surface-color,#fff);flex-direction:column;display:flex;position:fixed;inset:0}.dfk-mermaid-expanded .dfk-mermaid-viewport{border:none;border-radius:0;flex:1}.dfk-source-dialog{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);width:min(56rem,92vw);max-width:none;color:var(--ifm-font-color-base,#181818);padding:0}.dfk-source-dialog::backdrop{background:#00000073}.dfk-source-dialog-body{flex-direction:column;gap:.5rem;padding:.75rem;display:flex}.dfk-source-dialog-title{margin:0;font-size:.95rem;font-weight:600}.dfk-source-dialog-editor{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);font-size:var(--ifm-code-font-size,95%);overflow:hidden}.dfk-source-dialog-editor .cm-editor{outline:none}.dfk-source-dialog-editor .cm-scroller{max-height:55vh;font-family:var(--ifm-font-family-monospace,ui-monospace, SFMono-Regular, Menlo, monospace);line-height:1.6}.dfk-source-dialog-footer{justify-content:flex-end;gap:.5rem;display:flex}.dfk-source-dialog-button{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.25rem);background:var(--ifm-background-surface-color,#fff);color:var(--ifm-font-color-base,#181818);cursor:pointer;padding:.3rem .9rem;font-family:inherit;font-size:.85rem}.dfk-source-dialog-button:hover{border-color:var(--ifm-color-primary,#14459b);color:var(--ifm-color-primary,#14459b)}.dfk-source-dialog-apply{border-color:var(--ifm-color-primary,#14459b);background:var(--ifm-color-primary,#14459b);color:var(--ifm-button-color,#fff)}.dfk-source-dialog-apply:hover{color:var(--ifm-button-color,#fff);filter:brightness(1.1)}", S = null;
442
+ function ke() {
443
+ return S || (S = new CSSStyleSheet(), S.replaceSync(Oe)), S;
298
444
  }
299
445
  //#endregion
300
446
  //#region src/mermaid/DfkMermaid.ts
301
- var b = {
447
+ var C = {
302
448
  en: {
303
449
  reset: "Reset zoom",
304
450
  fullscreen: "Fullscreen",
@@ -323,185 +469,133 @@ var b = {
323
469
  rendering: "正在渲染图表…",
324
470
  renderFailed: "图表渲染失败"
325
471
  }
326
- }, x = 1, Te = 8, Ee = .25, De = class extends l {
472
+ }, Ae = "mermaid-diagram", je = class extends l {
327
473
  #e = u("div", {
328
474
  class: "dfk-mermaid-canvas",
329
475
  hidden: !0
330
476
  });
331
477
  #t = u("div", { class: "dfk-mermaid-viewport" });
332
478
  #n = u("div", { class: "dfk-mermaid-content" });
333
- #r = u("div", { class: "dfk-mermaid-actions" });
334
- #i = u("p", {
479
+ #r = new pe(this.#t, this.#n);
480
+ #i = u("div");
481
+ #a = u("p", {
335
482
  class: "dfk-mermaid-message",
336
483
  attrs: { "aria-live": "polite" },
337
484
  hidden: !0
338
485
  });
339
- #a;
340
- #o;
341
- #s;
342
- #c;
343
- #l = u("dialog", { class: "dfk-mermaid-dialog" });
344
- #u = u("h2", { class: "dfk-mermaid-dialog-title" });
345
- #d = u("div", { class: "dfk-mermaid-dialog-editor" });
346
- #f = u("button", {
347
- class: "dfk-mermaid-dialog-button dfk-mermaid-dialog-apply",
348
- type: "button"
486
+ #o = new h("lucide:rotate-ccw", () => this.#r.reset());
487
+ #s = new h("lucide:pencil", () => this.#N());
488
+ #c = null;
489
+ #l = null;
490
+ #u = new ge({
491
+ title: C.en.editTitle,
492
+ apply: C.en.apply,
493
+ cancel: C.en.cancel
349
494
  });
350
- #p = u("button", {
351
- class: "dfk-mermaid-dialog-button",
352
- type: "button"
353
- });
354
- #m = b.en;
355
- #h = v(null);
356
- #g = "";
357
- #_ = null;
358
- #v = null;
495
+ #d = C.en;
496
+ #f = _e(null);
497
+ #p = "";
498
+ #m = !1;
499
+ #h = null;
500
+ #g = null;
501
+ #_ = !1;
502
+ #v = !1;
359
503
  #y = !1;
360
504
  #b = !1;
361
- #x = !1;
362
- #S = 0;
363
- #C = null;
364
- #w = !1;
365
- #T = null;
366
- #E = !1;
367
- #D = null;
368
- #O = (e) => {
369
- e.key === "Escape" && this.#b && !this.#l.open && this.#H(!1);
370
- };
371
- #k = (e) => {
372
- this.#C?.zoomWithWheel(e);
373
- };
374
- #A = () => {
375
- this.#e.classList.toggle("dfk-mermaid-zoomed", this.#B());
505
+ #x = 0;
506
+ #S = null;
507
+ #C = (e) => {
508
+ e.key === "Escape" && this.#v && !this.#u.root.open && this.#j(!1);
376
509
  };
377
- #j = () => {
378
- this.#e.classList.remove("dfk-mermaid-grabbing");
379
- };
380
- #M = () => {
381
- this.#e.classList.toggle("dfk-mermaid-grabbing", this.#B());
382
- };
383
- #N = () => {
384
- le() !== this.#v && this.#I();
510
+ #w = () => {
511
+ we() !== this.#g && this.#O();
385
512
  };
386
513
  constructor() {
387
- super(), this.#a = new h("lucide:rotate-ccw", () => this.#V()), this.#o = new h("lucide:pencil", () => this.#W()), this.#s = new h("lucide:download", () => this.#U()), this.#c = new h("lucide:maximize", () => this.#H(!this.#b)), this.#r.append(this.#a.root, this.#o.root, this.#s.root, this.#c.root), this.#t.appendChild(this.#n), this.#e.append(this.#t, this.#r), this.#n.addEventListener("panzoomchange", this.#A), this.#n.addEventListener("panzoomstart", this.#M), this.#n.addEventListener("panzoomend", this.#j), this.#f.addEventListener("click", () => this.#K()), this.#p.addEventListener("click", () => this.#l.close()), this.#l.append(u("div", { class: "dfk-mermaid-dialog-body" }, (e) => e.append(this.#u, this.#d, u("div", { class: "dfk-mermaid-dialog-footer" }, (e) => e.append(this.#p, this.#f)))));
514
+ super(), this.#t.appendChild(this.#n), this.#e.appendChild(this.#t);
388
515
  let e = this.attachShadow({ mode: "open" });
389
- e.adoptedStyleSheets = [he()], e.append(this.#e, this.#i, this.#l), this.#F();
516
+ e.adoptedStyleSheets = [ke()], e.append(this.#e, this.#a, this.#u.root), this.#D();
517
+ }
518
+ get actions() {
519
+ return this.#T(), this.#i;
390
520
  }
391
521
  connectedCallback() {
392
- this.#y ||= (this.#P(), !0), this.#D ??= ue(this.#N), this.#z(), this.#g && !this.#n.hasChildNodes() && this.#I();
522
+ this.#T(), this.#S ??= Te(this.#w), this.#p && !this.#n.hasChildNodes() && this.#O();
393
523
  }
394
524
  disconnectedCallback() {
395
- this.#H(!1), this.#D?.(), this.#D = null, this.#t.removeEventListener("wheel", this.#k), this.#C?.destroy(), this.#C = null, this.#e.classList.remove("dfk-mermaid-zoomed", "dfk-mermaid-grabbing"), this.#S += 1, this.#T?.destroy(), this.#T = null, this.#l.open && this.#l.close();
525
+ this.#j(!1), this.#S?.(), this.#S = null, this.#r.destroy(), this.#x += 1, this.#u.destroy();
526
+ }
527
+ setFullscreen(e) {
528
+ this.#T(), this.#y = e, this.classList.toggle("dfk-mermaid-fullscreen", e), this.#r.setActive(e);
529
+ }
530
+ downloadPayload() {
531
+ return this.#h === null ? null : {
532
+ name: y(this, "svg", {
533
+ source: this.#p,
534
+ fallback: Ae
535
+ }),
536
+ mime: "image/svg+xml;charset=utf-8",
537
+ text: De(this.#h)
538
+ };
396
539
  }
397
- #P() {
398
- this.#m = b[(document.documentElement.getAttribute("lang") ?? "en").toLowerCase()] ?? b.en;
540
+ #T() {
541
+ this.#_ || (this.#_ = !0, this.#E());
542
+ }
543
+ #E() {
544
+ this.#d = C[(document.documentElement.getAttribute("lang") ?? "en").toLowerCase()] ?? C.en;
399
545
  let e = this.getAttribute("source");
400
- e !== null && (this.#g = e), this.#h = v(this.getAttribute("config")), this.#F();
546
+ e !== null && (this.#p = e), this.#f = _e(this.getAttribute("config")), this.#m = this.hasAttribute("embedded"), this.#m ? (this.#i.className = "dfk-sql-tab-actions", this.#i.append(this.#o.root, this.#s.root)) : (this.#c = new h("lucide:download", () => this.#M()), this.#l = new h("lucide:maximize", () => this.#j(!this.#v)), this.#i.className = "dfk-mermaid-actions", this.#i.append(this.#o.root, this.#s.root, this.#c.root, this.#l.root), this.#e.appendChild(this.#i)), this.#D(), this.#A(!1);
401
547
  }
402
- #F() {
403
- this.#a.setLabel(this.#m.reset), this.#o.setLabel(this.#m.edit), this.#s.setLabel(this.#m.download), this.#c.setLabel(this.#b ? this.#m.exitFullscreen : this.#m.fullscreen), this.#u.textContent = this.#m.editTitle, this.#p.textContent = this.#m.cancel, this.#f.textContent = this.#m.apply;
548
+ #D() {
549
+ this.#o.setLabel(this.#d.reset), this.#s.setLabel(this.#d.edit), this.#c?.setLabel(this.#d.download), this.#l?.setLabel(this.#v ? this.#d.exitFullscreen : this.#d.fullscreen), this.#u.setLabels({
550
+ title: this.#d.editTitle,
551
+ apply: this.#d.apply,
552
+ cancel: this.#d.cancel
553
+ });
404
554
  }
405
- async #I() {
406
- if (!this.#g) return;
407
- let e = this.#S += 1, t = le();
408
- this.#v = t, this.#_ === null && this.#L(this.#m.rendering, !1);
555
+ async #O() {
556
+ if (!this.#p) return;
557
+ let e = this.#x += 1, t = we();
558
+ this.#g = t, this.#h === null && this.#k(this.#d.rendering, !1);
409
559
  try {
410
- let n = await ce({
411
- source: this.#g,
412
- config: this.#h,
560
+ let n = await Ce({
561
+ source: this.#p,
562
+ config: this.#f,
413
563
  colorMode: t
414
564
  });
415
- if (e !== this.#S || !this.isConnected) return;
416
- let r = de(this.ownerDocument, n.svg);
417
- if (!r) throw Error(this.#m.renderFailed);
418
- this.#_ = r, this.#n.replaceChildren(r), n.bind?.(this.#n), this.#e.hidden = !1, this.#L("", !1), this.#R(!0), this.#V();
565
+ if (e !== this.#x || !this.isConnected) return;
566
+ let r = Ee(this.ownerDocument, n.svg);
567
+ if (!r) throw Error(this.#d.renderFailed);
568
+ this.#h = r, this.#r.setContent(r), n.bind?.(this.#n), this.#e.hidden = !1, this.#k("", !1), this.#A(!0);
419
569
  } catch (t) {
420
- if (e !== this.#S || !this.isConnected) return;
421
- this.#_ = null, this.#n.replaceChildren(), this.#e.hidden = !0, this.#R(!1), this.#L(`${this.#m.renderFailed}: ${Oe(t)}`, !0);
570
+ if (e !== this.#x || !this.isConnected) return;
571
+ this.#h = null, this.#r.setContent(null), this.#e.hidden = !0, this.#A(!1), this.#k(`${this.#d.renderFailed}: ${Me(t)}`, !0);
422
572
  }
423
573
  }
424
- #L(e, t) {
425
- this.#i.textContent = e, this.#i.hidden = e === "", this.#i.classList.toggle("dfk-mermaid-message-error", t);
574
+ #k(e, t) {
575
+ this.#a.textContent = e, this.#a.hidden = e === "", this.#a.classList.toggle("dfk-mermaid-message-error", t);
426
576
  }
427
- #R(e) {
428
- this.#a.root.hidden = !e, this.#s.root.hidden = !e;
429
- }
430
- async #z() {
431
- if (!(this.#C !== null || this.#w)) {
432
- this.#w = !0;
433
- try {
434
- let e = await fe();
435
- if (!this.isConnected) return;
436
- this.#t.addEventListener("wheel", this.#k, { passive: !1 }), this.#C = e(this.#n, {
437
- maxScale: Te,
438
- minScale: x,
439
- step: Ee,
440
- panOnlyWhenZoomed: !0,
441
- touchAction: "pan-y",
442
- cursor: "",
443
- handleStartEvent: (e) => {
444
- this.#B() && (e.preventDefault(), e.stopPropagation());
445
- }
446
- }), this.#n.style.userSelect = "", this.#t.style.userSelect = "";
447
- } catch {} finally {
448
- this.#w = !1;
449
- }
450
- }
451
- }
452
- #B() {
453
- return (this.#C?.getScale() ?? x) > x;
577
+ #A(e) {
578
+ this.#o.root.hidden = !e, this.#s.root.hidden = !e, this.#c && (this.#c.root.hidden = !e);
454
579
  }
455
- #V() {
456
- this.#C?.reset({ animate: !ke() });
580
+ #j(e) {
581
+ this.#v = e, this.#e.classList.toggle("dfk-mermaid-expanded", e), this.#r.setActive(e), this.#l?.setIcon(e ? "lucide:minimize" : "lucide:maximize"), this.#D(), e !== this.#b && (e ? document.addEventListener("keydown", this.#C) : document.removeEventListener("keydown", this.#C), this.#b = e);
457
582
  }
458
- #H(e) {
459
- this.#b = e, this.#e.classList.toggle("dfk-mermaid-expanded", e), this.#c.setIcon(e ? "lucide:minimize" : "lucide:maximize"), this.#F(), e !== this.#x && (e ? document.addEventListener("keydown", this.#O) : document.removeEventListener("keydown", this.#O), this.#x = e);
583
+ #M() {
584
+ let e = this.downloadPayload();
585
+ e && g(e);
460
586
  }
461
- #U() {
462
- if (this.#_ === null) return;
463
- let e = pe(this.#_), t = new Blob([e], { type: "image/svg+xml;charset=utf-8" }), n = URL.createObjectURL(t), r = u("a", {
464
- href: n,
465
- download: xe(this.#g, this)
587
+ #N() {
588
+ this.#u.open(this.#p, (e) => {
589
+ this.#p = e, this.#O();
466
590
  });
467
- this.shadowRoot?.appendChild(r), r.click(), r.remove(), window.setTimeout(() => URL.revokeObjectURL(n), 0);
468
- }
469
- #W() {
470
- if (this.#l.showModal(), this.#T) {
471
- this.#T.setValue(this.#g);
472
- return;
473
- }
474
- this.#G();
475
- }
476
- async #G() {
477
- if (!this.#E) {
478
- this.#E = !0;
479
- try {
480
- let e = await ne(this.#d, this.#g, () => void 0);
481
- if (!this.isConnected || !this.#l.open) {
482
- e.destroy();
483
- return;
484
- }
485
- e.setWrap(!0), this.#T = e;
486
- } catch {} finally {
487
- this.#E = !1;
488
- }
489
- }
490
- }
491
- #K() {
492
- let e = this.#T?.getValue();
493
- this.#l.close(), e !== void 0 && e !== this.#g && (this.#g = e, this.#I());
494
591
  }
495
592
  };
496
- function Oe(e) {
593
+ function Me(e) {
497
594
  return e instanceof Error ? e.message : String(e);
498
595
  }
499
- function ke() {
500
- return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
501
- }
502
596
  //#endregion
503
597
  //#region src/home/DfkNextSteps.ts
504
- var Ae = class extends l {
598
+ var Ne = class extends l {
505
599
  #e = u("section", { class: "dfk-section" });
506
600
  #t = u("div", { class: "dfk-section-inner" });
507
601
  #n = u("h2", { class: "dfk-section-title" });
@@ -518,12 +612,12 @@ var Ae = class extends l {
518
612
  setSteps(e) {
519
613
  for (; this.#i.length > e.length;) this.#i.pop()?.root.remove();
520
614
  for (; this.#i.length < e.length;) {
521
- let e = new je();
615
+ let e = new Pe();
522
616
  this.#i.push(e), this.#r.appendChild(e.root);
523
617
  }
524
618
  e.forEach((e, t) => this.#i[t].setStep(e));
525
619
  }
526
- }, je = class {
620
+ }, Pe = class {
527
621
  root = u("a", { class: "dfk-next-card" });
528
622
  #e = u("span", { class: "dfk-next-card-title" });
529
623
  #t = u("span", { class: "dfk-next-card-details" });
@@ -540,9 +634,9 @@ var Ae = class extends l {
540
634
  setStep(e) {
541
635
  this.root.href = e.href, this.#e.textContent = e.title, this.#t.textContent = e.details;
542
636
  }
543
- }, Me = null, S = class e {
637
+ }, Fe = null, w = class e {
544
638
  static getInstance() {
545
- return Me ??= new e(), Me;
639
+ return Fe ??= new e(), Fe;
546
640
  }
547
641
  #e = "idle";
548
642
  #t = "";
@@ -564,11 +658,11 @@ var Ae = class extends l {
564
658
  if (this.#n) return this.#n;
565
659
  let t = this.#l();
566
660
  return t.allowUnsignedExtensions && (this.#a = !0), this.#e = "loading", this.#n = this.#u(t.preload).catch((e) => {
567
- throw this.#e = "error", this.#t = C(e), this.#n = null, e;
661
+ throw this.#e = "error", this.#t = T(e), this.#n = null, e;
568
662
  }), this.#n;
569
663
  }
570
664
  #l() {
571
- return this.#s ??= Fe(), this.#s;
665
+ return this.#s ??= Re(), this.#s;
572
666
  }
573
667
  async #u(e) {
574
668
  let t = await import("@duckdb/duckdb-wasm");
@@ -606,7 +700,7 @@ var Ae = class extends l {
606
700
  return {
607
701
  columns: [],
608
702
  rows: [],
609
- error: C(e)
703
+ error: T(e)
610
704
  };
611
705
  }
612
706
  }
@@ -637,10 +731,10 @@ var Ae = class extends l {
637
731
  async #p(e, t) {
638
732
  if (!r.test(e)) throw Error(`Not a valid extension name: ${e}`);
639
733
  let n = this.#h();
640
- t !== void 0 && await n.query(`INSTALL ${e} FROM ${Ne(t)}`), await n.query(`LOAD ${e}`);
734
+ t !== void 0 && await n.query(`INSTALL ${e} FROM ${Ie(t)}`), await n.query(`LOAD ${e}`);
641
735
  }
642
736
  async #m(e) {
643
- await this.#h().query(`LOAD '${Pe(e)}'`);
737
+ await this.#h().query(`LOAD '${Le(e)}'`);
644
738
  }
645
739
  #h() {
646
740
  let e = this.#i;
@@ -648,145 +742,219 @@ var Ae = class extends l {
648
742
  return e;
649
743
  }
650
744
  };
651
- function Ne(e) {
745
+ function Ie(e) {
652
746
  let t = e.toLowerCase();
653
747
  if (a.has(t)) return t;
654
748
  if (!n.test(e)) throw Error(`Not a valid extension repository: ${e}`);
655
749
  return `'${e}'`;
656
750
  }
657
- function Pe(t) {
751
+ function Le(t) {
658
752
  let n = i(t) ? t : new URL(t, window.location.origin).href;
659
753
  if (!r.test(e(n))) throw Error(`An extension file must be named <extension>.duckdb_extension.wasm — the base name before the first dot is the entry symbol: ${n}`);
660
754
  return n;
661
755
  }
662
- function Fe() {
756
+ function Re() {
663
757
  if (typeof document > "u") return { preload: [] };
664
758
  let e = document.getElementById(s)?.textContent?.trim();
665
759
  if (!e) return { preload: [] };
666
760
  try {
667
761
  return t(JSON.parse(e));
668
762
  } catch (e) {
669
- throw Error(`Invalid <script id="${s}"> config: ${C(e)}`);
763
+ throw Error(`Invalid <script id="${s}"> config: ${T(e)}`);
670
764
  }
671
765
  }
672
- function C(e) {
766
+ function T(e) {
673
767
  return e instanceof Error ? e.message : String(e);
674
768
  }
675
769
  //#endregion
676
770
  //#region src/sql/PreviewTabs.ts
677
- var Ie = 0, w = class {
771
+ var ze = 0, Be = class {
678
772
  #e = [];
679
773
  #t = [];
680
774
  #n = [];
681
775
  #r = [];
682
- #i;
683
- #a = null;
684
- #o = !1;
685
- constructor(e, t, n, r, i) {
686
- this.#i = r;
687
- let a = `dfk-sql-tabs-${Ie += 1}`, o = u("div", { class: "dfk-sql-tabs" }), s = u("div", {
776
+ #i = [];
777
+ #a;
778
+ #o = 0;
779
+ #s = !1;
780
+ #c = !1;
781
+ constructor(e, t, n, r) {
782
+ let i = `dfk-sql-tabs-${ze += 1}`, a = u("div", { class: "dfk-sql-tabs" }), o = u("div", {
688
783
  class: "dfk-sql-tab-list",
689
784
  attrs: { role: "tablist" }
690
- }), c = u("div", { class: "dfk-sql-panels" }), l = (e, t) => {
691
- let n = this.#e.length, r = u("div", {
785
+ }), s = u("div", { class: "dfk-sql-tab-corner" }), c = u("div", { class: "dfk-sql-panels" }), l = (e) => {
786
+ let t = this.#e.length, n = u("div", {
692
787
  class: "dfk-sql-panel",
693
788
  hidden: !0,
694
789
  attrs: {
695
790
  role: "tabpanel",
696
- id: `${a}-panel-${n}`,
697
- "aria-labelledby": `${a}-tab-${n}`
791
+ id: `${i}-panel-${t}`,
792
+ "aria-labelledby": `${i}-tab-${t}`
698
793
  }
699
- }), i = u("button", {
794
+ }), r = u("button", {
700
795
  class: "dfk-sql-tab",
701
796
  type: "button",
702
- text: e,
703
- tabIndex: n === 0 ? 0 : -1,
797
+ text: e.label,
798
+ tabIndex: t === 0 ? 0 : -1,
704
799
  attrs: {
705
800
  role: "tab",
706
- id: `${a}-tab-${n}`,
707
- "aria-controls": `${a}-panel-${n}`,
801
+ id: `${i}-tab-${t}`,
802
+ "aria-controls": `${i}-panel-${t}`,
708
803
  "aria-selected": "false"
709
804
  }
710
805
  });
711
- i.addEventListener("click", () => this.#s(n)), i.addEventListener("keydown", (e) => this.#l(e, n)), this.#e.push(i), this.#t.push(r), this.#n.push(t), this.#r.push(!1), s.appendChild(i), c.appendChild(r);
806
+ r.addEventListener("click", () => this.#l(t)), r.addEventListener("keydown", (e) => this.#f(e, t)), this.#e.push(r), this.#t.push(n), this.#n.push(e), this.#r.push(!1), o.appendChild(r), c.appendChild(n), e.actions && (e.actions.hidden = !0, s.appendChild(e.actions));
712
807
  };
713
- for (let e of t) l(e.label, e);
714
- l(n, null), o.appendChild(s), i && o.appendChild(i), e.replaceChildren(o, c), this.#s(0);
808
+ for (let e of t) l(e);
809
+ this.#a = new h("lucide:download", () => this.#d()), this.#a.setLabel(n), this.#a.root.hidden = !0, s.appendChild(this.#a.root), r && s.appendChild(r), a.append(o, s), e.replaceChildren(a, c), this.#l(0);
715
810
  }
716
811
  dispose() {
717
- this.#o = !0, this.#a?.dispose(), this.#a = null;
812
+ this.#c = !0;
813
+ for (let e of this.#i) e();
814
+ this.#i.length = 0;
718
815
  for (let e of this.#t) e.replaceChildren();
719
816
  }
720
- #s(e) {
817
+ setFullscreen(e) {
818
+ this.#s = e, this.#n[this.#o]?.setFullscreen?.(e);
819
+ }
820
+ #l(e) {
821
+ this.#o = e;
721
822
  for (let t = 0; t < this.#e.length; t += 1) {
722
823
  let n = t === e, r = this.#e[t];
723
824
  r.classList.toggle("dfk-sql-tab-active", n), r.setAttribute("aria-selected", String(n)), r.tabIndex = n ? 0 : -1, this.#t[t].hidden = !n;
825
+ let i = this.#n[t].actions;
826
+ i && (i.hidden = !n);
724
827
  }
725
- if (this.#r[e]) return;
726
- this.#r[e] = !0;
727
828
  let t = this.#n[e];
728
- t ? t.mount(this.#t[e]) : this.#c(e);
829
+ this.#a.root.hidden = t.download === void 0, t.setFullscreen?.(this.#s), !this.#r[e] && (this.#r[e] = !0, this.#u(e));
729
830
  }
730
- async #c(e) {
731
- let t = await this.#i(this.#t[e]);
732
- if (this.#o) {
733
- t.dispose();
734
- return;
831
+ async #u(e) {
832
+ let t = await this.#n[e].mount(this.#t[e]);
833
+ if (typeof t == "function") {
834
+ if (this.#c) {
835
+ t();
836
+ return;
837
+ }
838
+ this.#i.push(t);
735
839
  }
736
- this.#a = t;
737
840
  }
738
- #l(e, t) {
841
+ #d() {
842
+ let e = this.#n[this.#o]?.download?.();
843
+ e && g(e);
844
+ }
845
+ #f(e, t) {
739
846
  let n = e.key === "ArrowRight" ? 1 : e.key === "ArrowLeft" ? -1 : 0;
740
847
  if (n === 0) return;
741
848
  e.preventDefault();
742
849
  let r = (t + n + this.#e.length) % this.#e.length;
743
- this.#s(r), this.#e[r].focus();
850
+ this.#l(r), this.#e[r].focus();
851
+ }
852
+ }, Ve = class {
853
+ root = u("div", { class: "dfk-sql-svg" });
854
+ actions = u("div", { class: "dfk-sql-tab-actions" });
855
+ #e = u("div", { class: "dfk-sql-svg-content" });
856
+ #t = new pe(this.root, this.#e);
857
+ #n = new h("lucide:rotate-ccw", () => this.#t.reset());
858
+ #r;
859
+ #i;
860
+ #a;
861
+ #o = null;
862
+ #s;
863
+ constructor(e, t, n, r) {
864
+ this.#a = t, this.#s = r, this.#o = e, this.#r = new h("lucide:pencil", () => this.#c()), this.#i = new ge({
865
+ title: n.editTitle,
866
+ apply: n.apply,
867
+ cancel: n.cancel
868
+ }), this.#n.setLabel(n.reset), this.#r.setLabel(n.edit), this.actions.append(this.#n.root, this.#r.root), this.#t.setContent(e ?? He(t)), this.root.append(this.#e, this.#i.root);
869
+ }
870
+ setFullscreen(e) {
871
+ this.#t.setActive(e);
872
+ }
873
+ downloadPayload() {
874
+ let e = y(this.root, this.#o === null ? "txt" : "svg", { fallback: this.#s });
875
+ return this.#o === null ? {
876
+ name: e,
877
+ mime: "text/plain;charset=utf-8",
878
+ text: this.#a
879
+ } : {
880
+ name: e,
881
+ mime: "image/svg+xml;charset=utf-8",
882
+ text: new XMLSerializer().serializeToString(this.#o)
883
+ };
884
+ }
885
+ dispose() {
886
+ this.#t.destroy(), this.#i.destroy(), this.#i.root.remove();
887
+ }
888
+ #c() {
889
+ this.#i.open(this.#a, (e) => {
890
+ this.#a = e, this.#o = We(this.root.ownerDocument, e), this.#t.setContent(this.#o ?? He(e));
891
+ });
744
892
  }
745
- }, Le = "allow-scripts", T = 30, Re = 32, E = {
893
+ };
894
+ function He(e) {
895
+ return u("pre", {
896
+ class: "dfk-sql-text",
897
+ text: e
898
+ });
899
+ }
900
+ var Ue = "http://www.w3.org/2000/svg";
901
+ function We(e, t) {
902
+ if (!t.trim()) return null;
903
+ let n = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
904
+ return !n || n.localName === "parsererror" || n.namespaceURI !== Ue ? null : (Ge(n), e.importNode(n, !0));
905
+ }
906
+ function Ge(e) {
907
+ for (let t of e.querySelectorAll("script, foreignObject")) t.remove();
908
+ let t = (e) => {
909
+ for (let t of [...e.attributes]) {
910
+ let n = t.name.toLowerCase(), r = t.value.replace(/\s/g, "").toLowerCase();
911
+ (n.startsWith("on") || (n === "href" || n === "xlink:href") && r.startsWith("javascript:")) && e.removeAttribute(t.name);
912
+ }
913
+ for (let n of e.children) t(n);
914
+ };
915
+ t(e);
916
+ }
917
+ //#endregion
918
+ //#region src/sql/renderers.ts
919
+ var Ke = "allow-scripts", E = 30, qe = 32, D = {
746
920
  copyCell: "dfk-copy-cell",
747
- copyAll: "dfk-copy-all",
748
921
  wrap: "dfk-wrap",
749
922
  unwrap: "dfk-unwrap",
750
- freeze: "dfk-freeze",
751
- unfreeze: "dfk-unfreeze",
752
- reset: "dfk-reset",
753
- widthAdaptive: "dfk-width-adaptive",
754
- widthStandard: "dfk-width-standard",
755
- widthFill: "dfk-width-fill"
756
- }, ze = [
923
+ freeze: "dfk-freeze"
924
+ }, O = [
757
925
  {
758
- menuKey: E.widthAdaptive,
926
+ id: "dfk-width-adaptive",
759
927
  label: "widthAdaptive",
760
928
  widthMode: "adaptive",
761
929
  autoFillWidth: !1,
762
930
  fallback: "Fill the width"
763
931
  },
764
932
  {
765
- menuKey: E.widthStandard,
933
+ id: "dfk-width-standard",
766
934
  label: "widthStandard",
767
935
  widthMode: "standard",
768
936
  autoFillWidth: !1,
769
937
  fallback: "Content widths, scroll sideways"
770
938
  },
771
939
  {
772
- menuKey: E.widthFill,
940
+ id: "dfk-width-fill",
773
941
  label: "widthFill",
774
942
  widthMode: "standard",
775
943
  autoFillWidth: !0,
776
944
  fallback: "Content first, fill when it fits"
777
945
  }
778
946
  ];
779
- function Be(e) {
780
- return ze.find((t) => t.menuKey === e) ?? ze[0];
947
+ function Je(e) {
948
+ return O.find((t) => t.id === e) ?? O[0];
781
949
  }
782
- var Ve;
783
- function He(e, t) {
784
- return Ve ??= new Intl.Collator(void 0, {
950
+ var Ye;
951
+ function Xe(e, t) {
952
+ return Ye ??= new Intl.Collator(void 0, {
785
953
  numeric: !0,
786
954
  sensitivity: "base"
787
- }), Ve.compare(e, t);
955
+ }), Ye.compare(e, t);
788
956
  }
789
- function Ue(e) {
957
+ function Ze(e) {
790
958
  if (typeof e == "number") return Number.isNaN(e) ? null : e;
791
959
  if (typeof e == "bigint") return Number(e);
792
960
  if (e instanceof Date) {
@@ -795,56 +963,144 @@ function Ue(e) {
795
963
  }
796
964
  return typeof e == "boolean" ? +!!e : null;
797
965
  }
798
- function We(e, t, n) {
966
+ function Qe(e, t, n) {
799
967
  let r = e == null, i = t == null;
800
968
  if (r || i) return r && i ? 0 : r ? 1 : -1;
801
- let a = Ue(e), o = Ue(t), s;
802
- s = a !== null && o !== null ? a === o ? 0 : a < o ? -1 : 1 : He(A(e), A(t));
969
+ let a = Ze(e), o = Ze(t), s;
970
+ s = a !== null && o !== null ? a === o ? 0 : a < o ? -1 : 1 : Xe(M(e), M(t));
803
971
  let c = s === 0 ? 0 : s < 0 ? -1 : 1;
804
972
  return c === 0 ? 0 : String(n).toLowerCase() === "desc" ? -c : c;
805
973
  }
806
- var Ge = "http://www.w3.org/2000/svg";
807
- function Ke(e) {
974
+ function $e(e) {
808
975
  return e instanceof Error ? e.message : String(e);
809
976
  }
810
- function qe(e, t) {
977
+ function et(e, t) {
811
978
  let n = e.createElement("pre");
812
979
  return n.className = "dfk-sql-error", n.textContent = t, n;
813
980
  }
814
- function D(e, t) {
981
+ function k(e, t) {
815
982
  return `${e.error ?? "Error"}: ${t}`;
816
983
  }
817
- var Je = class {
984
+ function A(e) {
985
+ return /[",\r\n]/.test(e) ? `"${e.replaceAll("\"", "\"\"")}"` : e;
986
+ }
987
+ var tt = class {
818
988
  #e;
819
989
  #t;
820
990
  #n;
821
991
  #r;
822
992
  #i;
823
- #a = /* @__PURE__ */ new Set();
824
- #o = 0;
825
- #s = 0;
993
+ #a;
994
+ #o;
995
+ #s;
826
996
  #c;
827
- #l = E.widthAdaptive;
997
+ #l;
828
998
  #u;
829
- #d;
830
- constructor(e, t, n, r) {
831
- this.#t = t, this.#n = n, this.#r = r, this.#i = e.themes, this.#e = new e.ListTable(this.#y()), this.#c = this.#h(), this.#u = new ResizeObserver(() => {
832
- cancelAnimationFrame(this.#s), this.#s = requestAnimationFrame(() => {
833
- this.#s = 0, this.#e.resize();
999
+ #d = /* @__PURE__ */ new Set();
1000
+ #f = 0;
1001
+ #p = 0;
1002
+ #m;
1003
+ #h = O[0].id;
1004
+ #g = null;
1005
+ #_ = !1;
1006
+ #v;
1007
+ #y;
1008
+ constructor(e, t, n, r, i) {
1009
+ this.#t = t, this.#n = n, this.#r = r, this.#i = e.themes, this.#a = i, this.#o = new h("lucide:search", () => this.#S()), this.#s = u("input", {
1010
+ class: "dfk-sql-search-input",
1011
+ type: "search",
1012
+ hidden: !0,
1013
+ attrs: {
1014
+ placeholder: r.search ?? "Search",
1015
+ "aria-label": r.search ?? "Search"
1016
+ }
1017
+ }), this.#c = u("span", {
1018
+ class: "dfk-sql-search-count",
1019
+ hidden: !0
1020
+ }), this.#l = new h("lucide:stretch-horizontal", () => this.#D()), this.#u = new h("lucide:pin-off", () => this.#H(-1)), this.#e = new e.ListTable(this.#L()), this.#m = this.#N(), this.#b(), this.#v = new ResizeObserver(() => {
1021
+ cancelAnimationFrame(this.#p), this.#p = requestAnimationFrame(() => {
1022
+ this.#p = 0, this.#e.resize();
1023
+ });
1024
+ }), this.#v.observe(t), this.#y = new MutationObserver(() => {
1025
+ this.#P();
1026
+ }), this.#y.observe(t.ownerDocument.documentElement, { attributeFilter: ["data-theme", "class"] }), this.#e.on("dropdown_menu_click", (e) => this.#z(e));
1027
+ }
1028
+ #b() {
1029
+ let e = new h("lucide:copy", () => void this.#K(this.#G()));
1030
+ e.setLabel(this.#r.copyAll ?? "Copy table");
1031
+ let t = new h("lucide:rotate-ccw", () => this.#W());
1032
+ t.setLabel(this.#r.resetView ?? "Reset view"), this.#o.setLabel(this.#r.search ?? "Search"), this.#u.setLabel(this.#r.unfreezeColumns ?? "Unfreeze columns"), this.#s.addEventListener("input", () => this.#T()), this.#s.addEventListener("keydown", (e) => this.#w(e)), this.#a.append(this.#o.root, this.#c, this.#s, e.root, this.#l.root, t.root, this.#u.root), this.#O(), this.#k();
1033
+ }
1034
+ async #x() {
1035
+ if (this.#g !== null || this.#_) return this.#g;
1036
+ this.#_ = !0;
1037
+ try {
1038
+ let { SearchComponent: e } = await import("@visactor/vtable-search"), t = this.#N() === "DARK";
1039
+ this.#g = new e({
1040
+ table: this.#e,
1041
+ skipHeader: !0,
1042
+ highlightCellStyle: { bgColor: t ? "rgba(255, 214, 0, 0.25)" : "rgba(255, 214, 0, 0.45)" },
1043
+ focusHighlightCellStyle: { bgColor: t ? "rgba(255, 152, 0, 0.55)" : "rgba(255, 152, 0, 0.7)" }
834
1044
  });
835
- }), this.#u.observe(t), this.#d = new MutationObserver(() => {
836
- this.#g();
837
- }), this.#d.observe(t.ownerDocument.documentElement, { attributeFilter: ["data-theme", "class"] }), this.#e.on("dropdown_menu_click", (e) => this.#S(e));
1045
+ } catch {} finally {
1046
+ this.#_ = !1;
1047
+ }
1048
+ return this.#g;
1049
+ }
1050
+ #S() {
1051
+ if (!this.#s.hidden) {
1052
+ this.#C();
1053
+ return;
1054
+ }
1055
+ this.#s.hidden = !1, this.#o.setOn(!0), this.#s.focus();
1056
+ }
1057
+ #C() {
1058
+ this.#s.value = "", this.#s.hidden = !0, this.#c.hidden = !0, this.#c.textContent = "", this.#o.setOn(!1), this.#g?.clear();
1059
+ }
1060
+ #w(e) {
1061
+ if (e.key === "Escape") {
1062
+ e.preventDefault(), this.#C();
1063
+ return;
1064
+ }
1065
+ e.key === "Enter" && (e.preventDefault(), this.#s.value.trim() && this.#g !== null && this.#E(e.shiftKey ? this.#g.prev() : this.#g.next()));
1066
+ }
1067
+ async #T() {
1068
+ let e = this.#s.value.trim();
1069
+ if (!e) {
1070
+ this.#g?.clear(), this.#E(null);
1071
+ return;
1072
+ }
1073
+ let t = await this.#x();
1074
+ t !== null && this.#E(t.search(e));
1075
+ }
1076
+ #E(e) {
1077
+ let t = e?.results.length ?? 0, n = t === 0 ? 0 : (e?.index ?? 0) + 1;
1078
+ if (this.#s.value.trim() === "") {
1079
+ this.#c.textContent = "", this.#c.hidden = !0;
1080
+ return;
1081
+ }
1082
+ this.#c.textContent = `${n}/${t}`, this.#c.hidden = !1;
1083
+ }
1084
+ #D() {
1085
+ let e = O.findIndex((e) => e.id === this.#h);
1086
+ this.#U(O[(e + 1) % O.length]), this.#O();
1087
+ }
1088
+ #O() {
1089
+ let e = Je(this.#h);
1090
+ this.#l.setLabel(this.#r[e.label] ?? e.fallback);
1091
+ }
1092
+ #k() {
1093
+ this.#u.root.hidden = this.#f === 0;
838
1094
  }
839
- #f(e) {
1095
+ #A(e) {
840
1096
  return e.map((e) => ({
841
1097
  field: e,
842
1098
  title: e,
843
- sort: We,
844
- style: { autoWrapText: this.#a.has(e) }
1099
+ sort: Qe,
1100
+ style: { autoWrapText: this.#d.has(e) }
845
1101
  }));
846
1102
  }
847
- #p() {
1103
+ #j() {
848
1104
  let e = [];
849
1105
  for (let t = 0; t < this.#e.colCount; t += 1) {
850
1106
  let n = this.#e.getHeaderField(t, 0);
@@ -853,35 +1109,35 @@ var Je = class {
853
1109
  }
854
1110
  return e.length === this.#n.columns.length ? e : [...this.#n.columns];
855
1111
  }
856
- #m() {
857
- return this.#i[this.#h()];
1112
+ #M() {
1113
+ return this.#i[this.#N()];
858
1114
  }
859
- #h() {
1115
+ #N() {
860
1116
  return this.#t.ownerDocument.documentElement.getAttribute("data-theme") === "dark" ? "DARK" : "DEFAULT";
861
1117
  }
862
- #g() {
863
- let e = this.#h();
864
- e !== this.#c && (this.#c = e, this.#e.updateTheme(this.#m()));
1118
+ #P() {
1119
+ let e = this.#N();
1120
+ e !== this.#m && (this.#m = e, this.#e.updateTheme(this.#M()));
865
1121
  }
866
- #_() {
867
- let e = this.#m(), t = e.bodyStyle?.color ?? e.defaultStyle?.color;
1122
+ #F() {
1123
+ let e = this.#M(), t = e.bodyStyle?.color ?? e.defaultStyle?.color;
868
1124
  return typeof t == "string" ? t : "#000";
869
1125
  }
870
- #v() {
871
- let e = this.#m(), t = e.bodyStyle?.fontSize ?? e.defaultStyle?.fontSize;
1126
+ #I() {
1127
+ let e = this.#M(), t = e.bodyStyle?.fontSize ?? e.defaultStyle?.fontSize;
872
1128
  return typeof t == "number" ? t : 12;
873
1129
  }
874
- #y() {
875
- let e = Be(this.#l);
1130
+ #L() {
1131
+ let e = Je(this.#h);
876
1132
  return {
877
1133
  container: this.#t,
878
1134
  records: this.#n.rows,
879
- columns: this.#f(this.#n.columns),
880
- theme: this.#m(),
1135
+ columns: this.#A(this.#n.columns),
1136
+ theme: this.#M(),
881
1137
  widthMode: e.widthMode,
882
1138
  autoFillWidth: e.autoFillWidth,
883
- defaultRowHeight: this.#a.size > 0 ? "auto" : T,
884
- defaultHeaderRowHeight: Re,
1139
+ defaultRowHeight: this.#d.size > 0 ? "auto" : E,
1140
+ defaultHeaderRowHeight: qe,
885
1141
  columnResizeMode: "all",
886
1142
  rowResizeMode: "all",
887
1143
  dragHeaderMode: "column",
@@ -893,26 +1149,20 @@ var Je = class {
893
1149
  tooltip: { isShowOverflowTextTooltip: !0 },
894
1150
  menu: {
895
1151
  renderMode: "html",
896
- contextMenuItems: (e) => this.#b(String(e))
1152
+ contextMenuItems: (e) => this.#R(String(e))
897
1153
  },
898
- frozenColCount: this.#o,
1154
+ frozenColCount: this.#f,
899
1155
  emptyTip: {
900
1156
  text: this.#r.noData ?? "No rows",
901
1157
  textStyle: {
902
- fontSize: this.#v(),
903
- color: this.#_()
1158
+ fontSize: this.#I(),
1159
+ color: this.#F()
904
1160
  }
905
1161
  }
906
1162
  };
907
1163
  }
908
- #b(e) {
909
- let t = this.#r, n = this.#a.has(e), r = this.#o > 0 ? {
910
- text: t.unfreezeColumns ?? "Unfreeze columns",
911
- menuKey: E.unfreeze
912
- } : {
913
- text: t.freezeColumn ?? "Freeze up to here",
914
- menuKey: E.freeze
915
- };
1164
+ #R(e) {
1165
+ let t = this.#r, n = this.#d.has(e);
916
1166
  return [
917
1167
  {
918
1168
  text: e,
@@ -921,241 +1171,265 @@ var Je = class {
921
1171
  { type: "split" },
922
1172
  {
923
1173
  text: t.copy ?? "Copy cell",
924
- menuKey: E.copyCell
925
- },
926
- {
927
- text: t.copyAll ?? "Copy table",
928
- menuKey: E.copyAll
1174
+ menuKey: D.copyCell
929
1175
  },
930
1176
  {
931
1177
  text: n ? t.unwrapColumn ?? "Stop wrapping column" : t.wrapColumn ?? "Wrap column",
932
- menuKey: n ? E.unwrap : E.wrap
1178
+ menuKey: n ? D.unwrap : D.wrap
933
1179
  },
934
- r,
935
- { type: "split" },
936
1180
  {
937
- text: t.widthMode ?? "Column width",
938
- children: this.#x()
939
- },
940
- {
941
- text: t.resetView ?? "Reset view",
942
- menuKey: E.reset
1181
+ text: t.freezeColumn ?? "Freeze up to here",
1182
+ menuKey: D.freeze
943
1183
  }
944
1184
  ];
945
1185
  }
946
- #x() {
947
- return ze.map((e) => ({
948
- text: `${e.menuKey === this.#l ? "✓ " : ""}${this.#r[e.label] ?? e.fallback}`,
949
- menuKey: e.menuKey
950
- }));
951
- }
952
- #S(e) {
1186
+ #z(e) {
953
1187
  let t = e.col ?? -1, n = e.row ?? -1, r = e.menuKey;
954
1188
  if (!r) return;
955
1189
  let i = t >= 0 && n >= 0 ? this.#e.getCellInfo(t, n) : void 0, a = i?.field === void 0 ? "" : String(i.field);
956
1190
  switch (r) {
957
- case E.copyCell:
958
- this.#k(this.#C(t, n));
959
- break;
960
- case E.copyAll:
961
- this.#k(this.#O());
962
- break;
963
- case E.wrap:
964
- a && this.#w(a, !0);
1191
+ case D.copyCell:
1192
+ this.#K(this.#B(t, n));
965
1193
  break;
966
- case E.unwrap:
967
- a && this.#w(a, !1);
1194
+ case D.wrap:
1195
+ a && this.#V(a, !0);
968
1196
  break;
969
- case E.freeze:
970
- this.#T(t);
1197
+ case D.unwrap:
1198
+ a && this.#V(a, !1);
971
1199
  break;
972
- case E.unfreeze:
973
- this.#T(-1);
974
- break;
975
- case E.widthAdaptive:
976
- case E.widthStandard:
977
- case E.widthFill:
978
- this.#E(Be(r));
979
- break;
980
- case E.reset: this.#D();
1200
+ case D.freeze: this.#H(t);
981
1201
  }
982
1202
  }
983
- #C(e, t) {
984
- return e < 0 || t < 0 ? "" : A(this.#e.getCellRawValue(e, t));
1203
+ #B(e, t) {
1204
+ return e < 0 || t < 0 ? "" : M(this.#e.getCellRawValue(e, t));
985
1205
  }
986
- #w(e, t) {
987
- t ? this.#a.add(e) : this.#a.delete(e), this.#e.defaultRowHeight = this.#a.size > 0 ? "auto" : T, this.#e.updateColumns(this.#f(this.#p()), {
1206
+ #V(e, t) {
1207
+ t ? this.#d.add(e) : this.#d.delete(e), this.#e.defaultRowHeight = this.#d.size > 0 ? "auto" : E, this.#e.updateColumns(this.#A(this.#j()), {
988
1208
  clearColWidthCache: !1,
989
1209
  clearRowHeightCache: !0
990
1210
  });
991
1211
  }
992
- #T(e) {
993
- this.#e.setFrozenColCount(e < 0 ? 0 : e + 1), this.#o = this.#e.frozenColCount;
1212
+ #H(e) {
1213
+ this.#e.setFrozenColCount(e < 0 ? 0 : e + 1), this.#f = this.#e.frozenColCount, this.#k();
994
1214
  }
995
- #E(e) {
996
- e.menuKey !== this.#l && (this.#l = e.menuKey, this.#e.widthMode = e.widthMode, this.#e.autoFillWidth = e.autoFillWidth, this.#e.updateColumns(this.#f(this.#p()), {
1215
+ #U(e) {
1216
+ e.id !== this.#h && (this.#h = e.id, this.#e.widthMode = e.widthMode, this.#e.autoFillWidth = e.autoFillWidth, this.#e.updateColumns(this.#A(this.#j()), {
997
1217
  clearColWidthCache: !0,
998
1218
  clearRowHeightCache: !1
999
1219
  }));
1000
1220
  }
1001
- #D() {
1002
- this.#a.clear(), this.#o = 0, this.#l = E.widthAdaptive, this.#e.updateOption(this.#y(), {
1221
+ #W() {
1222
+ this.#d.clear(), this.#f = 0, this.#h = O[0].id, this.#e.updateOption(this.#L(), {
1003
1223
  clearColWidthCache: !0,
1004
1224
  clearRowHeightCache: !0
1005
- });
1225
+ }), this.#O(), this.#k();
1006
1226
  }
1007
- #O() {
1008
- let e = this.#e, t = [this.#n.columns.join(" ")];
1227
+ #G() {
1228
+ let e = this.#e, t = [this.#j().join(" ")];
1009
1229
  for (let n = e.columnHeaderLevelCount; n < e.rowCount; n += 1) {
1010
1230
  let r = [];
1011
- for (let t = 0; t < e.colCount; t += 1) r.push(A(e.getCellRawValue(t, n)));
1231
+ for (let t = 0; t < e.colCount; t += 1) r.push(M(e.getCellRawValue(t, n)));
1012
1232
  t.push(r.join(" "));
1013
1233
  }
1014
1234
  return t.join("\n");
1015
1235
  }
1016
- async #k(e) {
1236
+ csv() {
1237
+ let e = this.#e, t = [this.#j().map(A).join(",")];
1238
+ for (let n = e.columnHeaderLevelCount; n < e.rowCount; n += 1) {
1239
+ let r = [];
1240
+ for (let t = 0; t < e.colCount; t += 1) r.push(A(M(e.getCellRawValue(t, n))));
1241
+ t.push(r.join(","));
1242
+ }
1243
+ return t.join("\n");
1244
+ }
1245
+ async #K(e) {
1017
1246
  try {
1018
1247
  await navigator.clipboard.writeText(e);
1019
1248
  } catch {}
1020
1249
  }
1021
1250
  dispose() {
1022
- cancelAnimationFrame(this.#s), this.#u?.disconnect(), this.#d?.disconnect(), this.#e.release();
1251
+ cancelAnimationFrame(this.#p), this.#v?.disconnect(), this.#y?.disconnect(), this.#e.release();
1023
1252
  }
1024
- }, Ye = 2, Xe = 4;
1025
- function Ze() {
1253
+ }, nt = 2, rt = 4;
1254
+ function it() {
1026
1255
  let e = u("div", { class: "dfk-sql-table-skeleton" });
1027
- e.style.setProperty("--dfk-sql-skeleton-row-height", `${T}px`);
1028
- for (let t = 0; t < Ye; t += 1) e.appendChild(u("div", { class: "dfk-sql-table-skeleton-row" }, (e) => {
1029
- for (let t = 0; t < Xe; t += 1) e.appendChild(u("span", { class: "dfk-sql-table-skeleton-cell" }));
1256
+ e.style.setProperty("--dfk-sql-skeleton-row-height", `${E}px`);
1257
+ for (let t = 0; t < nt; t += 1) e.appendChild(u("div", { class: "dfk-sql-table-skeleton-row" }, (e) => {
1258
+ for (let t = 0; t < rt; t += 1) e.appendChild(u("span", { class: "dfk-sql-table-skeleton-cell" }));
1030
1259
  }));
1031
1260
  return e;
1032
1261
  }
1033
- async function O(e, t, n) {
1034
- let r = e.ownerDocument, i = u("div", { class: "dfk-sql-table" });
1035
- i.style.setProperty("--dfk-sql-table-height", `${Math.min(360, 36 + t.rows.length * T)}px`);
1036
- let a = Ze();
1037
- i.appendChild(a), e.appendChild(i);
1262
+ async function at(e, t, n, r) {
1263
+ let i = e.ownerDocument, a = u("div", { class: "dfk-sql-table" });
1264
+ a.style.setProperty("--dfk-sql-table-height", `${Math.min(360, 36 + t.rows.length * E)}px`);
1265
+ let o = it();
1266
+ a.appendChild(o), e.appendChild(a);
1038
1267
  try {
1039
- let e = new Je(await import("@visactor/vtable"), i, t, n);
1040
- return a.remove(), { dispose: () => e.dispose() };
1268
+ let e = new tt(await import("@visactor/vtable"), a, t, n, r);
1269
+ return o.remove(), {
1270
+ dispose: () => e.dispose(),
1271
+ csv: () => e.csv()
1272
+ };
1041
1273
  } catch (e) {
1042
- return a.remove(), i.appendChild(qe(r, D(n, Ke(e)))), { dispose: () => {} };
1274
+ return o.remove(), a.appendChild(et(i, k(n, $e(e)))), {
1275
+ dispose: () => {},
1276
+ csv: () => lt(t)
1277
+ };
1043
1278
  }
1044
1279
  }
1045
- var Qe = async ({ host: e, labels: t, fullscreenButton: n }, r) => {
1046
- let i = new w(e, [], t.table ?? "Table", (e) => O(e, r, t), n);
1280
+ function ot(e, t, n) {
1281
+ let r = u("div", { class: "dfk-sql-tab-actions" }), i = null;
1282
+ return {
1283
+ label: t.table ?? "Table",
1284
+ actions: r,
1285
+ mount: async (n) => (i = await at(n, e, t, r), () => {
1286
+ i?.dispose(), i = null;
1287
+ }),
1288
+ download: () => i === null ? null : {
1289
+ name: y(n, "csv", { fallback: "table" }),
1290
+ mime: "text/csv;charset=utf-8",
1291
+ text: i.csv()
1292
+ }
1293
+ };
1294
+ }
1295
+ var st = async ({ host: e, labels: t, fullscreenButton: n }, r) => {
1296
+ let i = new Be(e, [ot(r, t, e)], t.download ?? "Download", n);
1047
1297
  return () => i.dispose();
1048
1298
  };
1049
- function $e(e, t) {
1050
- let n = e.createElement("pre");
1051
- n.className = "dfk-sql-text";
1052
- let r = [t.columns.join(" ")];
1053
- for (let e of t.rows) r.push(t.columns.map((t) => A(e[t])).join(" "));
1054
- return n.textContent = r.join("\n"), n;
1055
- }
1056
- var et = async ({ host: e, labels: t, fullscreenButton: n }, r) => {
1057
- let i = new w(e, [{
1299
+ function ct(e) {
1300
+ let t = [e.columns.join(" ")];
1301
+ for (let n of e.rows) t.push(e.columns.map((e) => M(n[e])).join(" "));
1302
+ return t.join("\n");
1303
+ }
1304
+ function lt(e) {
1305
+ let t = [e.columns.map(A).join(",")];
1306
+ for (let n of e.rows) t.push(e.columns.map((e) => A(M(n[e]))).join(","));
1307
+ return t.join("\n");
1308
+ }
1309
+ var ut = async ({ host: e, labels: t, fullscreenButton: n }, r) => {
1310
+ let i = ct(r), a = new Be(e, [{
1058
1311
  label: t.text ?? "Text",
1059
- mount: (e) => e.appendChild($e(e.ownerDocument, r))
1060
- }], t.table ?? "Table", (e) => O(e, r, t), n);
1061
- return () => i.dispose();
1062
- }, tt = async ({ host: e, labels: t }, n) => {
1063
- e.replaceChildren(qe(e.ownerDocument, D(t, n.error ?? "unknown")));
1312
+ mount: (e) => {
1313
+ e.appendChild(u("pre", {
1314
+ class: "dfk-sql-text",
1315
+ text: i
1316
+ }));
1317
+ },
1318
+ download: () => ({
1319
+ name: y(e, "txt", { fallback: "text" }),
1320
+ mime: "text/plain;charset=utf-8",
1321
+ text: i
1322
+ })
1323
+ }, ot(r, t, e)], t.download ?? "Download", n);
1324
+ return () => a.dispose();
1325
+ }, dt = async ({ host: e, labels: t }, n) => {
1326
+ e.replaceChildren(et(e.ownerDocument, k(t, n.error ?? "unknown")));
1064
1327
  };
1065
- function nt(e, t) {
1328
+ function ft(e, t) {
1066
1329
  return e.field ? e.field : t.columns.length === 1 ? t.columns[0] : null;
1067
1330
  }
1068
- function rt(e, t) {
1069
- if (!t.trim()) return null;
1070
- let n = new DOMParser().parseFromString(t, "image/svg+xml").documentElement;
1071
- return !n || n.localName === "parsererror" || n.namespaceURI !== Ge ? null : (it(n), e.importNode(n, !0));
1072
- }
1073
- function it(e) {
1074
- for (let t of e.querySelectorAll("script, foreignObject")) t.remove();
1075
- let t = (e) => {
1076
- for (let t of [...e.attributes]) {
1077
- let n = t.name.toLowerCase(), r = t.value.replace(/\s/g, "").toLowerCase();
1078
- (n.startsWith("on") || (n === "href" || n === "xlink:href") && r.startsWith("javascript:")) && e.removeAttribute(t.name);
1079
- }
1080
- for (let n of e.children) t(n);
1081
- };
1082
- t(e);
1083
- }
1084
- function at(e, t) {
1331
+ function pt(e, t) {
1085
1332
  let { width: n, height: r } = t.option ?? {};
1086
1333
  n && e.style.setProperty("--dfk-sql-preview-width", n), r && e.style.setProperty("--dfk-sql-preview-height", r);
1087
1334
  }
1088
- function ot(e, t, n, r, i) {
1089
- let a = n == null ? "" : String(n);
1335
+ function mt(e) {
1336
+ return e == null ? "" : String(e);
1337
+ }
1338
+ function ht(e, t, n, r, i, a) {
1090
1339
  if (e === "iframe") {
1091
1340
  let e = u("iframe", {
1092
1341
  class: "dfk-sql-frame",
1093
- srcdoc: a,
1342
+ srcdoc: t,
1094
1343
  attrs: {
1095
- sandbox: i.option?.sandbox ?? Le,
1344
+ sandbox: r.option?.sandbox ?? Ke,
1096
1345
  loading: "lazy",
1097
1346
  referrerpolicy: "no-referrer",
1098
- title: r
1347
+ title: n
1099
1348
  }
1100
1349
  });
1101
- at(e, i), t.appendChild(e);
1102
- return;
1350
+ return pt(e, r), {
1351
+ label: n,
1352
+ mount: (t) => {
1353
+ t.appendChild(e);
1354
+ },
1355
+ download: () => ({
1356
+ name: y(i, "html", { fallback: "preview" }),
1357
+ mime: "text/html;charset=utf-8",
1358
+ text: t
1359
+ })
1360
+ };
1103
1361
  }
1104
1362
  if (e === "mermaid") {
1105
- t.appendChild(u("dfk-mermaid", { attrs: { source: a } }));
1106
- return;
1107
- }
1108
- let o = rt(t.ownerDocument, a);
1109
- if (!o) {
1110
- t.appendChild(u("pre", {
1111
- class: "dfk-sql-text",
1112
- text: a
1113
- }));
1114
- return;
1363
+ let e = u("dfk-mermaid", { attrs: {
1364
+ embedded: "",
1365
+ source: t
1366
+ } });
1367
+ return {
1368
+ label: n,
1369
+ actions: e.actions,
1370
+ mount: (t) => {
1371
+ t.appendChild(e);
1372
+ },
1373
+ download: () => e.downloadPayload(),
1374
+ setFullscreen: (t) => e.setFullscreen(t)
1375
+ };
1115
1376
  }
1116
- let s = u("div", { class: "dfk-sql-svg" });
1117
- s.appendChild(o), at(s, i), t.appendChild(s);
1377
+ let o = new Ve(We(i.ownerDocument, t), t, a, "figure");
1378
+ return pt(o.root, r), {
1379
+ label: n,
1380
+ actions: o.actions,
1381
+ mount: (e) => (e.appendChild(o.root), () => o.dispose()),
1382
+ download: () => o.downloadPayload(),
1383
+ setFullscreen: (e) => o.setFullscreen(e)
1384
+ };
1118
1385
  }
1119
- function k(e) {
1120
- return async ({ host: t, config: n, labels: r, fullscreenButton: i }, a) => {
1121
- let o = nt(n, a);
1122
- if (!o) {
1123
- t.replaceChildren(qe(t.ownerDocument, D(r, r.noField ?? "this result has no markup column; set `field`")));
1386
+ function j(e) {
1387
+ return async ({ host: t, config: n, labels: r, fullscreenButton: i, onFullscreenChange: a }, o) => {
1388
+ let s = ft(n, o);
1389
+ if (!s) {
1390
+ t.replaceChildren(et(t.ownerDocument, k(r, r.noField ?? "this result has no markup column; set `field`")));
1124
1391
  return;
1125
1392
  }
1126
- let s = n.tab_name, c = new w(t, a.rows.map((t, i) => {
1127
- let a = s ? t[s] : void 0;
1128
- return {
1129
- label: a == null ? `${r.row ?? "Row"} ${i + 1}` : A(a),
1130
- mount: (r) => ot(e, r, t[o], "", n)
1131
- };
1132
- }), r.table ?? "Table", (e) => O(e, a, r), i);
1133
- return () => c.dispose();
1393
+ let c = {
1394
+ reset: r.resetZoom ?? "Reset zoom",
1395
+ edit: r.editSource ?? "Edit source",
1396
+ editTitle: r.svgSource ?? "SVG source",
1397
+ apply: r.apply ?? "Apply",
1398
+ cancel: r.cancel ?? "Cancel"
1399
+ }, l = n.tab_name, u = o.rows.map((i, a) => {
1400
+ let o = l ? i[l] : void 0, u = o == null ? `${r.row ?? "Row"} ${a + 1}` : M(o);
1401
+ return ht(e, mt(i[s]), u, n, t, c);
1402
+ });
1403
+ u.push(ot(o, r, t));
1404
+ let d = new Be(t, u, r.download ?? "Download", i), f = e === "iframe" ? null : a((e) => d.setFullscreen(e));
1405
+ return () => {
1406
+ f?.(), d.dispose();
1407
+ };
1134
1408
  };
1135
1409
  }
1136
- function A(e) {
1410
+ function M(e) {
1137
1411
  return e == null ? "NULL" : e instanceof Date ? e.toLocaleString() : typeof e == "object" ? JSON.stringify(e) : String(e);
1138
1412
  }
1139
- var st = {
1140
- table: Qe,
1141
- text: et,
1142
- iframe: k("iframe"),
1143
- html: k("iframe"),
1144
- svg: k("svg"),
1145
- mermaid: k("mermaid")
1413
+ var gt = {
1414
+ table: st,
1415
+ text: ut,
1416
+ iframe: j("iframe"),
1417
+ html: j("iframe"),
1418
+ svg: j("svg"),
1419
+ mermaid: j("mermaid")
1146
1420
  };
1147
- function ct(e, t) {
1148
- return t.error ? tt : st[e.show ?? (t.columns.length === 1 && t.rows.length === 1 ? "text" : "table")] ?? Qe;
1421
+ function _t(e, t) {
1422
+ return t.error ? dt : gt[e.show ?? (t.columns.length === 1 && t.rows.length === 1 ? "text" : "table")] ?? st;
1149
1423
  }
1150
1424
  //#endregion
1151
1425
  //#region src/sql/DfkSql.css?inline
1152
- var lt = "*,:before,:after{box-sizing:border-box}:host{margin:1rem 0;display:block}.dfk-sql-code{position:relative}.dfk-sql-editor{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);font-size:var(--ifm-code-font-size,95%);overflow:hidden}.dfk-sql-editor .cm-editor{outline:none}.dfk-sql-editor-skeleton{padding:4px .75rem}.dfk-sql-editor-skeleton-line{align-items:center;height:1.6em;display:flex}.dfk-sql-editor-skeleton-line:before{content:\"\";background-color:var(--ifm-color-emphasis-200,#e6e6e6);background-image:linear-gradient(90deg, transparent 0%, var(--ifm-color-emphasis-100,#f5f5f5) 50%, transparent 100%);background-size:200% 100%;border-radius:.25em;flex:1;height:.75em;animation:1.6s linear infinite dfk-sql-shimmer}@keyframes dfk-sql-shimmer{0%{background-position:0 0}to{background-position:100% 0}}@media (prefers-reduced-motion:reduce){.dfk-sql-editor-skeleton-line{animation:none}}.dfk-sql-editor .cm-scroller{font-family:var(--ifm-font-family-monospace,ui-monospace, SFMono-Regular, Menlo, monospace);line-height:1.6}.dfk-sql-actions{z-index:1;border-radius:var(--ifm-global-radius,.3rem);background:var(--ifm-color-emphasis-100,#f5f5f5);opacity:0;pointer-events:none;align-items:center;gap:.15rem;padding:.1rem .2rem;transition:opacity .12s;display:flex;position:absolute;top:.25rem;right:.25rem}.dfk-sql-code:hover .dfk-sql-actions,.dfk-sql-code:focus-within .dfk-sql-actions,.dfk-sql-actions-busy{opacity:1;pointer-events:auto}.dfk-sql-status{color:var(--ifm-color-emphasis-700,#666);white-space:nowrap;padding:0 .25rem;font-size:.72rem}.dfk-sql-status:empty{display:none}.dfk-icon-button{border-radius:var(--ifm-global-radius,.25rem);width:1.6rem;height:1.6rem;color:var(--ifm-color-emphasis-700,#666);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex;position:relative}.dfk-icon-button:hover:not(:disabled),.dfk-icon-button:focus-visible{background:var(--ifm-color-emphasis-200,#e6e6e6);color:var(--ifm-color-primary,#14459b)}.dfk-icon-button:disabled{opacity:.45;cursor:progress}.dfk-icon-button[hidden]{display:none}.dfk-icon-on{color:var(--ifm-color-primary,#14459b)}.dfk-icon{font-size:1rem}[data-tip]:after{content:attr(data-tip);z-index:2;border-radius:var(--ifm-global-radius,.25rem);background:var(--ifm-color-emphasis-800,#333);color:var(--ifm-color-emphasis-0,#fff);white-space:nowrap;opacity:0;pointer-events:none;padding:.15rem .4rem;font-size:.7rem;line-height:1.4;transition:opacity .12s;position:absolute;top:calc(100% + .3rem);right:0}[data-tip]:hover:after,[data-tip]:focus-visible:after{opacity:1}", j = null;
1153
- function ut() {
1154
- return j || (j = new CSSStyleSheet(), j.replaceSync(lt)), j;
1426
+ var vt = "*,:before,:after{box-sizing:border-box}:host{margin:1rem 0;display:block}.dfk-sql-code{position:relative}.dfk-sql-editor{border:1px solid var(--ifm-global-border-color,#e0e0e0);border-radius:var(--ifm-global-radius,.4rem);background:var(--ifm-background-surface-color,#fff);font-size:var(--ifm-code-font-size,95%);overflow:hidden}.dfk-sql-editor .cm-editor{outline:none}.dfk-sql-editor-skeleton{padding:4px .75rem}.dfk-sql-editor-skeleton-line{align-items:center;height:1.6em;display:flex}.dfk-sql-editor-skeleton-line:before{content:\"\";background-color:var(--ifm-color-emphasis-200,#e6e6e6);background-image:linear-gradient(90deg, transparent 0%, var(--ifm-color-emphasis-100,#f5f5f5) 50%, transparent 100%);background-size:200% 100%;border-radius:.25em;flex:1;height:.75em;animation:1.6s linear infinite dfk-sql-shimmer}@keyframes dfk-sql-shimmer{0%{background-position:0 0}to{background-position:100% 0}}@media (prefers-reduced-motion:reduce){.dfk-sql-editor-skeleton-line{animation:none}}.dfk-sql-editor .cm-scroller{font-family:var(--ifm-font-family-monospace,ui-monospace, SFMono-Regular, Menlo, monospace);line-height:1.6}.dfk-sql-actions{z-index:1;border-radius:var(--ifm-global-radius,.3rem);background:var(--ifm-color-emphasis-100,#f5f5f5);opacity:0;pointer-events:none;align-items:center;gap:.15rem;padding:.1rem .2rem;transition:opacity .12s;display:flex;position:absolute;top:.25rem;right:.25rem}.dfk-sql-code:hover .dfk-sql-actions,.dfk-sql-code:focus-within .dfk-sql-actions,.dfk-sql-actions-busy{opacity:1;pointer-events:auto}.dfk-sql-status{color:var(--ifm-color-emphasis-700,#666);white-space:nowrap;padding:0 .25rem;font-size:.72rem}.dfk-sql-status:empty{display:none}.dfk-icon-button{border-radius:var(--ifm-global-radius,.25rem);width:1.6rem;height:1.6rem;color:var(--ifm-color-emphasis-700,#666);cursor:pointer;background:0 0;border:none;justify-content:center;align-items:center;padding:0;transition:background .12s,color .12s;display:inline-flex;position:relative}.dfk-icon-button:hover:not(:disabled),.dfk-icon-button:focus-visible{background:var(--ifm-color-emphasis-200,#e6e6e6);color:var(--ifm-color-primary,#14459b)}.dfk-icon-button:disabled{opacity:.45;cursor:progress}.dfk-icon-button[hidden]{display:none}.dfk-icon-on{color:var(--ifm-color-primary,#14459b)}.dfk-icon{font-size:1rem}[data-tip]:after{content:attr(data-tip);z-index:2;border-radius:var(--ifm-global-radius,.25rem);background:var(--ifm-color-emphasis-800,#333);color:var(--ifm-color-emphasis-0,#fff);white-space:nowrap;opacity:0;pointer-events:none;padding:.15rem .4rem;font-size:.7rem;line-height:1.4;transition:opacity .12s;position:absolute;top:calc(100% + .3rem);right:0}[data-tip]:hover:after,[data-tip]:focus-visible:after{opacity:1}", N = null;
1427
+ function yt() {
1428
+ return N || (N = new CSSStyleSheet(), N.replaceSync(vt)), N;
1155
1429
  }
1156
1430
  //#endregion
1157
1431
  //#region src/sql/DfkSql.ts
1158
- var dt = {
1432
+ var bt = {
1159
1433
  en: {
1160
1434
  run: "Run",
1161
1435
  format: "Format SQL",
@@ -1171,10 +1445,16 @@ var dt = {
1171
1445
  unfreezeColumns: "Unfreeze columns",
1172
1446
  resetView: "Reset view",
1173
1447
  noData: "No rows",
1174
- widthMode: "Column width",
1448
+ search: "Search",
1175
1449
  widthAdaptive: "Fill the width",
1176
1450
  widthStandard: "Content widths, scroll sideways",
1177
1451
  widthFill: "Content first, fill when it fits",
1452
+ download: "Download",
1453
+ resetZoom: "Reset zoom",
1454
+ editSource: "Edit source",
1455
+ svgSource: "SVG source",
1456
+ apply: "Apply",
1457
+ cancel: "Cancel",
1178
1458
  running: "Running…",
1179
1459
  initializing: "Initializing DuckDB…",
1180
1460
  loadingExtensions: "Loading extensions…",
@@ -1203,10 +1483,16 @@ var dt = {
1203
1483
  unfreezeColumns: "取消冻结",
1204
1484
  resetView: "重置视图",
1205
1485
  noData: "无数据",
1206
- widthMode: "列宽模式",
1486
+ search: "搜索",
1207
1487
  widthAdaptive: "铺满宽度",
1208
1488
  widthStandard: "按内容列宽(可横向滚动)",
1209
1489
  widthFill: "内容优先,装得下就铺满",
1490
+ download: "下载",
1491
+ resetZoom: "还原缩放",
1492
+ editSource: "编辑源码",
1493
+ svgSource: "SVG 源码",
1494
+ apply: "应用",
1495
+ cancel: "取消",
1210
1496
  running: "执行中…",
1211
1497
  initializing: "正在初始化 DuckDB…",
1212
1498
  loadingExtensions: "正在加载扩展…",
@@ -1220,11 +1506,11 @@ var dt = {
1220
1506
  row: "行",
1221
1507
  noField: "该结果没有可展示的标记列,请设置 `field`"
1222
1508
  }
1223
- }, ft = 1600, pt = null;
1224
- function mt() {
1225
- return pt ??= import("sql-formatter"), pt;
1509
+ }, xt = 1600, St = null;
1510
+ function Ct() {
1511
+ return St ??= import("sql-formatter"), St;
1226
1512
  }
1227
- var ht = class extends l {
1513
+ var wt = class extends l {
1228
1514
  #e = u("div", { class: "dfk-sql-editor" });
1229
1515
  #t = u("div", { class: "dfk-sql-editor-skeleton" });
1230
1516
  #n = [];
@@ -1240,7 +1526,7 @@ var ht = class extends l {
1240
1526
  #l;
1241
1527
  #u;
1242
1528
  #d;
1243
- #f = dt.en;
1529
+ #f = bt.en;
1244
1530
  #p = { type: "duckfn" };
1245
1531
  #m = "";
1246
1532
  #h = "";
@@ -1253,41 +1539,42 @@ var ht = class extends l {
1253
1539
  #S = !1;
1254
1540
  #C = 0;
1255
1541
  #w = (e) => {
1256
- e.key === "Escape" && this.#L(!1);
1542
+ e.key === "Escape" && this.#R(!1);
1257
1543
  };
1258
1544
  #T = null;
1259
1545
  #E = null;
1260
1546
  #D = null;
1547
+ #O = /* @__PURE__ */ new Set();
1261
1548
  constructor() {
1262
- super(), this.#o = new h("lucide:play", () => void this.#z()), this.#s = new h("lucide:wand-sparkles", () => void this.#P()), this.#c = new h("lucide:rotate-ccw", () => this.#N()), this.#l = new h("lucide:wrap-text", () => this.#F()), this.#u = new h("lucide:copy", () => void this.#I()), this.#d = new h("lucide:maximize", () => this.#L(!this.#x)), this.#i.append(this.#a, this.#o.root, this.#s.root, this.#c.root, this.#l.root, this.#u.root), this.#A(!0), this.#r.append(this.#e, this.#i);
1549
+ super(), this.#o = new h("lucide:play", () => void this.#V()), this.#s = new h("lucide:wand-sparkles", () => void this.#F()), this.#c = new h("lucide:rotate-ccw", () => this.#P()), this.#l = new h("lucide:wrap-text", () => this.#I()), this.#u = new h("lucide:copy", () => void this.#L()), this.#d = new h("lucide:maximize", () => this.#R(!this.#x)), this.#i.append(this.#a, this.#o.root, this.#s.root, this.#c.root, this.#l.root, this.#u.root), this.#j(!0), this.#r.append(this.#e, this.#i);
1263
1550
  let e = this.attachShadow({ mode: "open" });
1264
- e.adoptedStyleSheets = [ut()], e.append(this.#r, u("slot", { attrs: { name: "dfk-result" } })), this.#k();
1551
+ e.adoptedStyleSheets = [yt()], e.append(this.#r, u("slot", { attrs: { name: "dfk-result" } })), this.#A();
1265
1552
  }
1266
1553
  connectedCallback() {
1267
- this.#y ||= (this.#O(), !0), this.#R(), this.#M();
1554
+ this.#y ||= (this.#k(), !0), this.#B(), this.#N();
1268
1555
  }
1269
1556
  disconnectedCallback() {
1270
- this.#L(!1), this.#D?.(), this.#D = null, this.#E?.destroy(), this.#E = null, this.#C !== 0 && (window.clearTimeout(this.#C), this.#C = 0);
1557
+ this.#R(!1), this.#D?.(), this.#D = null, this.#E?.destroy(), this.#E = null, this.#C !== 0 && (window.clearTimeout(this.#C), this.#C = 0);
1271
1558
  }
1272
- #O() {
1273
- this.#f = dt[(document.documentElement.getAttribute("lang") ?? "en").toLowerCase()] ?? dt.en;
1559
+ #k() {
1560
+ this.#f = bt[(document.documentElement.getAttribute("lang") ?? "en").toLowerCase()] ?? bt.en;
1274
1561
  let e = this.getAttribute("config");
1275
1562
  if (e) try {
1276
1563
  this.#p = JSON.parse(e);
1277
1564
  } catch {}
1278
- this.#m = this.getAttribute("sql") ?? "", this.#h = this.#m, this.#k();
1565
+ this.#m = this.getAttribute("sql") ?? "", this.#h = this.#m, this.#A();
1279
1566
  }
1280
- #k() {
1567
+ #A() {
1281
1568
  this.#o.setLabel(this.#f.run), this.#s.setLabel(this.#f.format), this.#c.setLabel(this.#f.reset), this.#l.setLabel(this.#g ? this.#f.wrapOff : this.#f.wrapOn), this.#l.setOn(this.#g), this.#u.setLabel(this.#f.copy), this.#d.setLabel(this.#x ? this.#f.exitFullscreen : this.#f.fullscreen);
1282
1569
  }
1283
- #A(e) {
1570
+ #j(e) {
1284
1571
  if (!e) {
1285
1572
  this.#t.remove();
1286
1573
  return;
1287
1574
  }
1288
- this.#j(), this.#e.appendChild(this.#t);
1575
+ this.#M(), this.#e.appendChild(this.#t);
1289
1576
  }
1290
- #j() {
1577
+ #M() {
1291
1578
  let e = Math.max(1, this.#h.split("\n").length);
1292
1579
  for (; this.#n.length > e;) this.#n.pop()?.remove();
1293
1580
  for (; this.#n.length < e;) {
@@ -1295,45 +1582,45 @@ var ht = class extends l {
1295
1582
  this.#n.push(e), this.#t.appendChild(e);
1296
1583
  }
1297
1584
  }
1298
- async #M() {
1585
+ async #N() {
1299
1586
  if (!(this.#E || this.#b)) {
1300
- this.#b = !0, this.#A(!0);
1587
+ this.#b = !0, this.#j(!0);
1301
1588
  try {
1302
- let e = await ne(this.#e, this.#h, (e) => {
1589
+ let e = await he(this.#e, this.#h, (e) => {
1303
1590
  this.#h = e;
1304
1591
  }, { language: "sql" });
1305
1592
  if (!this.isConnected) {
1306
1593
  e.destroy();
1307
1594
  return;
1308
1595
  }
1309
- e.setWrap(this.#g), this.#E = e, this.#A(!1);
1596
+ e.setWrap(this.#g), this.#E = e, this.#j(!1);
1310
1597
  } catch (e) {
1311
- this.#A(!1), this.#V(gt(e));
1598
+ this.#j(!1), this.#U(Tt(e));
1312
1599
  } finally {
1313
1600
  this.#b = !1;
1314
1601
  }
1315
1602
  }
1316
1603
  }
1317
- #N() {
1318
- this.#h = this.#m, this.#E?.setValue(this.#h), this.#K();
1604
+ #P() {
1605
+ this.#h = this.#m, this.#E?.setValue(this.#h), this.#J();
1319
1606
  }
1320
- async #P() {
1607
+ async #F() {
1321
1608
  if (!this.#v) {
1322
1609
  this.#v = !0, this.#s.setDisabled(!0);
1323
1610
  try {
1324
- let { format: e } = await mt(), t = e(this.#h, { language: "duckdb" });
1611
+ let { format: e } = await Ct(), t = e(this.#h, { language: "duckdb" });
1325
1612
  this.#h = t, this.#E?.setValue(t);
1326
1613
  } catch {
1327
- this.#V(this.#f.formatFailed);
1614
+ this.#U(this.#f.formatFailed);
1328
1615
  } finally {
1329
1616
  this.#v = !1, this.#s.setDisabled(!1);
1330
1617
  }
1331
1618
  }
1332
1619
  }
1333
- #F() {
1334
- this.#g = !this.#g, this.#E?.setWrap(this.#g), this.#k();
1620
+ #I() {
1621
+ this.#g = !this.#g, this.#E?.setWrap(this.#g), this.#A();
1335
1622
  }
1336
- async #I() {
1623
+ async #L() {
1337
1624
  try {
1338
1625
  await navigator.clipboard.writeText(this.#h);
1339
1626
  } catch {
@@ -1341,109 +1628,116 @@ var ht = class extends l {
1341
1628
  }
1342
1629
  this.#u.setIcon("lucide:check"), this.#u.setLabel(this.#f.copied), this.#C !== 0 && window.clearTimeout(this.#C), this.#C = window.setTimeout(() => {
1343
1630
  this.#C = 0, this.#u.setIcon("lucide:copy"), this.#u.setLabel(this.#f.copy);
1344
- }, ft);
1631
+ }, xt);
1345
1632
  }
1346
- #L(e) {
1347
- this.#x = e, this.#T?.classList.toggle("dfk-sql-result-expanded", e), this.#d.setIcon(e ? "lucide:minimize" : "lucide:maximize"), this.#k(), e !== this.#S && (e ? document.addEventListener("keydown", this.#w) : document.removeEventListener("keydown", this.#w), this.#S = e);
1633
+ #R(e) {
1634
+ this.#x = e, this.#T?.classList.toggle("dfk-sql-result-expanded", e), this.#d.setIcon(e ? "lucide:minimize" : "lucide:maximize"), this.#A(), e !== this.#S && (e ? document.addEventListener("keydown", this.#w) : document.removeEventListener("keydown", this.#w), this.#S = e);
1635
+ for (let t of this.#O) t(e);
1348
1636
  }
1349
- #R() {
1350
- S.getInstance().init({ allowUnsignedExtensions: this.#p.allowUnsignedExtensions === !0 }).catch(() => void 0);
1637
+ #z(e) {
1638
+ return this.#O.add(e), e(this.#x), () => {
1639
+ this.#O.delete(e);
1640
+ };
1641
+ }
1642
+ #B() {
1643
+ w.getInstance().init({ allowUnsignedExtensions: this.#p.allowUnsignedExtensions === !0 }).catch(() => void 0);
1351
1644
  }
1352
- async #z() {
1645
+ async #V() {
1353
1646
  if (this.#_) return;
1354
- this.#_ = !0, this.#B(!0);
1355
- let e = S.getInstance();
1647
+ this.#_ = !0, this.#H(!0);
1648
+ let e = w.getInstance();
1356
1649
  try {
1357
- e.state !== "ready" && this.#V(this.#f.initializing);
1650
+ e.state !== "ready" && this.#U(this.#f.initializing);
1358
1651
  try {
1359
1652
  await e.init({ allowUnsignedExtensions: this.#p.allowUnsignedExtensions === !0 });
1360
1653
  } catch {
1361
- this.#H();
1654
+ this.#W();
1362
1655
  return;
1363
1656
  }
1364
1657
  let t = this.#p.extensions ?? [];
1365
1658
  if (t.length > 0) {
1366
- this.#V(this.#f.loadingExtensions);
1659
+ this.#U(this.#f.loadingExtensions);
1367
1660
  try {
1368
1661
  for (let n of t) await e.loadExtension(n, { repository: this.#p.repository });
1369
1662
  } catch (e) {
1370
- this.#G(_t(this.#f, gt(e)));
1663
+ this.#q(Et(this.#f, Tt(e)));
1371
1664
  return;
1372
1665
  }
1373
1666
  }
1374
- this.#V(this.#f.running);
1667
+ this.#U(this.#f.running);
1375
1668
  let n = await e.execute(this.#h);
1376
- this.#W(n);
1669
+ this.#K(n);
1377
1670
  } finally {
1378
- this.#_ = !1, this.#B(!1), this.#V("");
1671
+ this.#_ = !1, this.#H(!1), this.#U("");
1379
1672
  }
1380
1673
  }
1381
- #B(e) {
1674
+ #H(e) {
1382
1675
  this.#o.setDisabled(e), this.#s.setDisabled(e), this.#c.setDisabled(e), this.#i.classList.toggle("dfk-sql-actions-busy", e);
1383
1676
  }
1384
- #V(e) {
1677
+ #U(e) {
1385
1678
  this.#a.textContent = e;
1386
1679
  }
1387
- #H() {
1388
- let e = S.getInstance().message;
1389
- this.#G(this.#f.initFailed + (e ? `: ${e}` : ""));
1680
+ #W() {
1681
+ let e = w.getInstance().message;
1682
+ this.#q(this.#f.initFailed + (e ? `: ${e}` : ""));
1390
1683
  }
1391
- #U() {
1684
+ #G() {
1392
1685
  return this.#T || (this.#T = u("div", { class: "dfk-sql-result" }), this.#T.slot = "dfk-result", this.appendChild(this.#T)), this.#T.hidden = !1, this.#T;
1393
1686
  }
1394
- #W(e) {
1395
- this.#D?.(), this.#D = null, e.error && this.#L(!1);
1687
+ #K(e) {
1688
+ this.#D?.(), this.#D = null, e.error && this.#R(!1);
1396
1689
  let t = {
1397
- host: this.#U(),
1690
+ host: this.#G(),
1398
1691
  config: this.#p,
1399
1692
  labels: this.#f,
1400
- fullscreenButton: this.#d.root
1693
+ fullscreenButton: this.#d.root,
1694
+ onFullscreenChange: (e) => this.#z(e)
1401
1695
  };
1402
- ct(this.#p, e)(t, e).then((e) => {
1696
+ _t(this.#p, e)(t, e).then((e) => {
1403
1697
  this.#D = e ?? null;
1404
1698
  });
1405
1699
  }
1406
- #G(e) {
1407
- this.#L(!1);
1408
- let t = this.#U(), n = t.ownerDocument.createElement("pre");
1700
+ #q(e) {
1701
+ this.#R(!1);
1702
+ let t = this.#G(), n = t.ownerDocument.createElement("pre");
1409
1703
  n.className = "dfk-sql-error", n.textContent = e, t.replaceChildren(n);
1410
1704
  }
1411
- #K() {
1412
- this.#L(!1), this.#D?.(), this.#D = null, this.#T && (this.#T.replaceChildren(), this.#T.hidden = !0);
1705
+ #J() {
1706
+ this.#R(!1), this.#D?.(), this.#D = null, this.#T && (this.#T.replaceChildren(), this.#T.hidden = !0);
1413
1707
  }
1414
1708
  };
1415
- function gt(e) {
1709
+ function Tt(e) {
1416
1710
  return e instanceof Error ? e.message : String(e);
1417
1711
  }
1418
- function _t(e, t) {
1712
+ function Et(e, t) {
1419
1713
  return `${e.error}: ${t}`;
1420
1714
  }
1421
1715
  //#endregion
1422
1716
  //#region ../node_modules/iconify-icon/dist/iconify-icon.mjs
1423
- var vt = Object.freeze({
1717
+ var Dt = Object.freeze({
1424
1718
  left: 0,
1425
1719
  top: 0,
1426
1720
  width: 16,
1427
1721
  height: 16
1428
- }), M = Object.freeze({
1722
+ }), P = Object.freeze({
1429
1723
  rotate: 0,
1430
1724
  vFlip: !1,
1431
1725
  hFlip: !1
1432
- }), N = Object.freeze({
1433
- ...vt,
1434
- ...M
1435
- }), P = Object.freeze({
1436
- ...N,
1726
+ }), F = Object.freeze({
1727
+ ...Dt,
1728
+ ...P
1729
+ }), Ot = Object.freeze({
1730
+ ...F,
1437
1731
  body: "",
1438
1732
  hidden: !1
1439
- }), yt = Object.freeze({
1733
+ }), kt = Object.freeze({
1440
1734
  width: null,
1441
1735
  height: null
1442
- }), bt = Object.freeze({
1443
- ...yt,
1444
- ...M
1736
+ }), At = Object.freeze({
1737
+ ...kt,
1738
+ ...P
1445
1739
  });
1446
- function xt(e, t = 0) {
1740
+ function jt(e, t = 0) {
1447
1741
  let n = e.replace(/^-?[0-9.]*/, "");
1448
1742
  function r(e) {
1449
1743
  for (; e < 0;) e += 4;
@@ -1468,9 +1762,9 @@ function xt(e, t = 0) {
1468
1762
  }
1469
1763
  return t;
1470
1764
  }
1471
- var St = /[\s,]+/;
1472
- function Ct(e, t) {
1473
- t.split(St).forEach((t) => {
1765
+ var Mt = /[\s,]+/;
1766
+ function Nt(e, t) {
1767
+ t.split(Mt).forEach((t) => {
1474
1768
  switch (t.trim()) {
1475
1769
  case "horizontal":
1476
1770
  e.hFlip = !0;
@@ -1479,19 +1773,19 @@ function Ct(e, t) {
1479
1773
  }
1480
1774
  });
1481
1775
  }
1482
- var wt = {
1483
- ...bt,
1776
+ var Pt = {
1777
+ ...At,
1484
1778
  preserveAspectRatio: ""
1485
1779
  };
1486
- function Tt(e) {
1487
- let t = { ...wt }, n = (t, n) => e.getAttribute(t) || n;
1488
- return t.width = n("width", null), t.height = n("height", null), t.rotate = xt(n("rotate", "")), Ct(t, n("flip", "")), t.preserveAspectRatio = n("preserveAspectRatio", n("preserveaspectratio", "")), t;
1780
+ function Ft(e) {
1781
+ let t = { ...Pt }, n = (t, n) => e.getAttribute(t) || n;
1782
+ return t.width = n("width", null), t.height = n("height", null), t.rotate = jt(n("rotate", "")), Nt(t, n("flip", "")), t.preserveAspectRatio = n("preserveAspectRatio", n("preserveaspectratio", "")), t;
1489
1783
  }
1490
- function Et(e, t) {
1491
- for (let n in wt) if (e[n] !== t[n]) return !0;
1784
+ function It(e, t) {
1785
+ for (let n in Pt) if (e[n] !== t[n]) return !0;
1492
1786
  return !1;
1493
1787
  }
1494
- var Dt = /^[a-z0-9]+(-[a-z0-9]+)*$/, F = (e, t, n, r = "") => {
1788
+ var Lt = /^[a-z0-9]+(-[a-z0-9]+)*$/, I = (e, t, n, r = "") => {
1495
1789
  let i = e.split(":");
1496
1790
  if (e.slice(0, 1) === "@") {
1497
1791
  if (i.length < 2 || i.length > 3) return null;
@@ -1504,7 +1798,7 @@ var Dt = /^[a-z0-9]+(-[a-z0-9]+)*$/, F = (e, t, n, r = "") => {
1504
1798
  prefix: n,
1505
1799
  name: e
1506
1800
  };
1507
- return t && !I(a) ? null : a;
1801
+ return t && !L(a) ? null : a;
1508
1802
  }
1509
1803
  let a = i[0], o = a.split("-");
1510
1804
  if (o.length > 1) {
@@ -1513,7 +1807,7 @@ var Dt = /^[a-z0-9]+(-[a-z0-9]+)*$/, F = (e, t, n, r = "") => {
1513
1807
  prefix: o.shift(),
1514
1808
  name: o.join("-")
1515
1809
  };
1516
- return t && !I(e) ? null : e;
1810
+ return t && !L(e) ? null : e;
1517
1811
  }
1518
1812
  if (n && r === "") {
1519
1813
  let e = {
@@ -1521,11 +1815,11 @@ var Dt = /^[a-z0-9]+(-[a-z0-9]+)*$/, F = (e, t, n, r = "") => {
1521
1815
  prefix: "",
1522
1816
  name: a
1523
1817
  };
1524
- return t && !I(e, n) ? null : e;
1818
+ return t && !L(e, n) ? null : e;
1525
1819
  }
1526
1820
  return null;
1527
- }, I = (e, t) => e ? !!((t && e.prefix === "" || e.prefix) && e.name) : !1;
1528
- function Ot(e, t) {
1821
+ }, L = (e, t) => e ? !!((t && e.prefix === "" || e.prefix) && e.name) : !1;
1822
+ function Rt(e, t) {
1529
1823
  let n = e.icons, r = e.aliases || Object.create(null), i = Object.create(null);
1530
1824
  function a(e) {
1531
1825
  if (n[e]) return i[e] = [];
@@ -1538,65 +1832,65 @@ function Ot(e, t) {
1538
1832
  }
1539
1833
  return Object.keys(n).concat(Object.keys(r)).forEach(a), i;
1540
1834
  }
1541
- function kt(e, t) {
1835
+ function zt(e, t) {
1542
1836
  let n = {};
1543
1837
  !e.hFlip != !t.hFlip && (n.hFlip = !0), !e.vFlip != !t.vFlip && (n.vFlip = !0);
1544
1838
  let r = ((e.rotate || 0) + (t.rotate || 0)) % 4;
1545
1839
  return r && (n.rotate = r), n;
1546
1840
  }
1547
- function At(e, t) {
1548
- let n = kt(e, t);
1549
- for (let r in P) r in M ? r in e && !(r in n) && (n[r] = M[r]) : r in t ? n[r] = t[r] : r in e && (n[r] = e[r]);
1841
+ function Bt(e, t) {
1842
+ let n = zt(e, t);
1843
+ for (let r in Ot) r in P ? r in e && !(r in n) && (n[r] = P[r]) : r in t ? n[r] = t[r] : r in e && (n[r] = e[r]);
1550
1844
  return n;
1551
1845
  }
1552
- function jt(e, t, n) {
1846
+ function Vt(e, t, n) {
1553
1847
  let r = e.icons, i = e.aliases || Object.create(null), a = {};
1554
1848
  function o(e) {
1555
- a = At(r[e] || i[e], a);
1849
+ a = Bt(r[e] || i[e], a);
1556
1850
  }
1557
- return o(t), n.forEach(o), At(e, a);
1851
+ return o(t), n.forEach(o), Bt(e, a);
1558
1852
  }
1559
- function Mt(e, t) {
1853
+ function Ht(e, t) {
1560
1854
  let n = [];
1561
1855
  if (typeof e != "object" || typeof e.icons != "object") return n;
1562
1856
  e.not_found instanceof Array && e.not_found.forEach((e) => {
1563
1857
  t(e, null), n.push(e);
1564
1858
  });
1565
- let r = Ot(e);
1859
+ let r = Rt(e);
1566
1860
  for (let i in r) {
1567
1861
  let a = r[i];
1568
- a && (t(i, jt(e, i, a)), n.push(i));
1862
+ a && (t(i, Vt(e, i, a)), n.push(i));
1569
1863
  }
1570
1864
  return n;
1571
1865
  }
1572
- var Nt = {
1866
+ var Ut = {
1573
1867
  provider: "",
1574
1868
  aliases: {},
1575
1869
  not_found: {},
1576
- ...vt
1870
+ ...Dt
1577
1871
  };
1578
- function Pt(e, t) {
1872
+ function Wt(e, t) {
1579
1873
  for (let n in t) if (n in e && typeof e[n] != typeof t[n]) return !1;
1580
1874
  return !0;
1581
1875
  }
1582
- function Ft(e) {
1876
+ function Gt(e) {
1583
1877
  if (typeof e != "object" || !e) return null;
1584
1878
  let t = e;
1585
- if (typeof t.prefix != "string" || !e.icons || typeof e.icons != "object" || !Pt(e, Nt)) return null;
1879
+ if (typeof t.prefix != "string" || !e.icons || typeof e.icons != "object" || !Wt(e, Ut)) return null;
1586
1880
  let n = t.icons;
1587
1881
  for (let e in n) {
1588
1882
  let t = n[e];
1589
- if (!e || typeof t.body != "string" || !Pt(t, P)) return null;
1883
+ if (!e || typeof t.body != "string" || !Wt(t, Ot)) return null;
1590
1884
  }
1591
1885
  let r = t.aliases || Object.create(null);
1592
1886
  for (let e in r) {
1593
1887
  let t = r[e], i = t.parent;
1594
- if (!e || typeof i != "string" || !n[i] && !r[i] || !Pt(t, P)) return null;
1888
+ if (!e || typeof i != "string" || !n[i] && !r[i] || !Wt(t, Ot)) return null;
1595
1889
  }
1596
1890
  return t;
1597
1891
  }
1598
- var L = Object.create(null);
1599
- function It(e, t) {
1892
+ var R = Object.create(null);
1893
+ function Kt(e, t) {
1600
1894
  return {
1601
1895
  provider: e,
1602
1896
  prefix: t,
@@ -1604,78 +1898,78 @@ function It(e, t) {
1604
1898
  missing: /* @__PURE__ */ new Set()
1605
1899
  };
1606
1900
  }
1607
- function R(e, t) {
1608
- let n = L[e] || (L[e] = Object.create(null));
1609
- return n[t] || (n[t] = It(e, t));
1901
+ function z(e, t) {
1902
+ let n = R[e] || (R[e] = Object.create(null));
1903
+ return n[t] || (n[t] = Kt(e, t));
1610
1904
  }
1611
- function Lt(e, t) {
1612
- return Ft(t) ? Mt(t, (t, n) => {
1905
+ function qt(e, t) {
1906
+ return Gt(t) ? Ht(t, (t, n) => {
1613
1907
  n ? e.icons[t] = n : e.missing.add(t);
1614
1908
  }) : [];
1615
1909
  }
1616
- function Rt(e, t, n) {
1910
+ function Jt(e, t, n) {
1617
1911
  try {
1618
1912
  if (typeof n.body == "string") return e.icons[t] = { ...n }, !0;
1619
1913
  } catch {}
1620
1914
  return !1;
1621
1915
  }
1622
- function zt(e, t) {
1916
+ function Yt(e, t) {
1623
1917
  let n = [];
1624
- return (typeof e == "string" ? [e] : Object.keys(L)).forEach((e) => {
1625
- (typeof e == "string" && typeof t == "string" ? [t] : Object.keys(L[e] || {})).forEach((t) => {
1626
- let r = R(e, t);
1918
+ return (typeof e == "string" ? [e] : Object.keys(R)).forEach((e) => {
1919
+ (typeof e == "string" && typeof t == "string" ? [t] : Object.keys(R[e] || {})).forEach((t) => {
1920
+ let r = z(e, t);
1627
1921
  n = n.concat(Object.keys(r.icons).map((n) => (e === "" ? "" : "@" + e + ":") + t + ":" + n));
1628
1922
  });
1629
1923
  }), n;
1630
1924
  }
1631
- var z = !1;
1632
- function Bt(e) {
1633
- return typeof e == "boolean" && (z = e), z;
1925
+ var B = !1;
1926
+ function Xt(e) {
1927
+ return typeof e == "boolean" && (B = e), B;
1634
1928
  }
1635
- function B(e) {
1636
- let t = typeof e == "string" ? F(e, !0, z) : e;
1929
+ function V(e) {
1930
+ let t = typeof e == "string" ? I(e, !0, B) : e;
1637
1931
  if (t) {
1638
- let e = R(t.provider, t.prefix), n = t.name;
1932
+ let e = z(t.provider, t.prefix), n = t.name;
1639
1933
  return e.icons[n] || (e.missing.has(n) ? null : void 0);
1640
1934
  }
1641
1935
  }
1642
- function Vt(e, t) {
1643
- let n = F(e, !0, z);
1936
+ function Zt(e, t) {
1937
+ let n = I(e, !0, B);
1644
1938
  if (!n) return !1;
1645
- let r = R(n.provider, n.prefix);
1646
- return t ? Rt(r, n.name, t) : (r.missing.add(n.name), !0);
1939
+ let r = z(n.provider, n.prefix);
1940
+ return t ? Jt(r, n.name, t) : (r.missing.add(n.name), !0);
1647
1941
  }
1648
- function Ht(e, t) {
1942
+ function Qt(e, t) {
1649
1943
  if (typeof e != "object") return !1;
1650
- if (typeof t != "string" && (t = e.provider || ""), z && !t && !e.prefix) {
1944
+ if (typeof t != "string" && (t = e.provider || ""), B && !t && !e.prefix) {
1651
1945
  let t = !1;
1652
- return Ft(e) && (e.prefix = "", Mt(e, (e, n) => {
1653
- Vt(e, n) && (t = !0);
1946
+ return Gt(e) && (e.prefix = "", Ht(e, (e, n) => {
1947
+ Zt(e, n) && (t = !0);
1654
1948
  })), t;
1655
1949
  }
1656
1950
  let n = e.prefix;
1657
- return I({
1951
+ return L({
1658
1952
  prefix: n,
1659
1953
  name: "a"
1660
- }) ? !!Lt(R(t, n), e) : !1;
1954
+ }) ? !!qt(z(t, n), e) : !1;
1661
1955
  }
1662
- function Ut(e) {
1663
- return !!B(e);
1956
+ function $t(e) {
1957
+ return !!V(e);
1664
1958
  }
1665
- function Wt(e) {
1666
- let t = B(e);
1959
+ function en(e) {
1960
+ let t = V(e);
1667
1961
  return t && {
1668
- ...N,
1962
+ ...F,
1669
1963
  ...t
1670
1964
  };
1671
1965
  }
1672
- function Gt(e, t) {
1966
+ function tn(e, t) {
1673
1967
  e.forEach((e) => {
1674
1968
  let n = e.loaderCallbacks;
1675
1969
  n && (e.loaderCallbacks = n.filter((e) => e.id !== t));
1676
1970
  });
1677
1971
  }
1678
- function Kt(e) {
1972
+ function nn(e) {
1679
1973
  e.pendingCallbacksFlag || (e.pendingCallbacksFlag = !0, setTimeout(() => {
1680
1974
  e.pendingCallbacksFlag = !1;
1681
1975
  let t = e.loaderCallbacks ? e.loaderCallbacks.slice(0) : [];
@@ -1698,13 +1992,13 @@ function Kt(e) {
1698
1992
  });
1699
1993
  else return n = !0, !0;
1700
1994
  return !1;
1701
- }), a.pending.length !== o && (n || Gt([e], t.id), t.callback(a.loaded.slice(0), a.missing.slice(0), a.pending.slice(0), t.abort));
1995
+ }), a.pending.length !== o && (n || tn([e], t.id), t.callback(a.loaded.slice(0), a.missing.slice(0), a.pending.slice(0), t.abort));
1702
1996
  });
1703
1997
  }));
1704
1998
  }
1705
- var qt = 0;
1706
- function Jt(e, t, n) {
1707
- let r = qt++, i = Gt.bind(null, n, r);
1999
+ var rn = 0;
2000
+ function an(e, t, n) {
2001
+ let r = rn++, i = tn.bind(null, n, r);
1708
2002
  if (!t.pending.length) return i;
1709
2003
  let a = {
1710
2004
  id: r,
@@ -1716,7 +2010,7 @@ function Jt(e, t, n) {
1716
2010
  (e.loaderCallbacks ||= []).push(a);
1717
2011
  }), i;
1718
2012
  }
1719
- function Yt(e) {
2013
+ function on(e) {
1720
2014
  let t = {
1721
2015
  loaded: [],
1722
2016
  missing: [],
@@ -1731,7 +2025,7 @@ function Yt(e) {
1731
2025
  return e.forEach((e) => {
1732
2026
  if (r.name === e.name && r.prefix === e.prefix && r.provider === e.provider) return;
1733
2027
  r = e;
1734
- let i = e.provider, a = e.prefix, o = e.name, s = n[i] || (n[i] = Object.create(null)), c = s[a] || (s[a] = R(i, a)), l;
2028
+ let i = e.provider, a = e.prefix, o = e.name, s = n[i] || (n[i] = Object.create(null)), c = s[a] || (s[a] = z(i, a)), l;
1735
2029
  l = o in c.icons ? t.loaded : a === "" || c.missing.has(o) ? t.missing : t.pending;
1736
2030
  let u = {
1737
2031
  provider: i,
@@ -1741,21 +2035,21 @@ function Yt(e) {
1741
2035
  l.push(u);
1742
2036
  }), t;
1743
2037
  }
1744
- var V = Object.create(null);
1745
- function Xt(e, t) {
1746
- V[e] = t;
2038
+ var H = Object.create(null);
2039
+ function sn(e, t) {
2040
+ H[e] = t;
1747
2041
  }
1748
- function H(e) {
1749
- return V[e] || V[""];
2042
+ function U(e) {
2043
+ return H[e] || H[""];
1750
2044
  }
1751
- function Zt(e, t = !0, n = !1) {
2045
+ function cn(e, t = !0, n = !1) {
1752
2046
  let r = [];
1753
2047
  return e.forEach((e) => {
1754
- let i = typeof e == "string" ? F(e, t, n) : e;
2048
+ let i = typeof e == "string" ? I(e, t, n) : e;
1755
2049
  i && r.push(i);
1756
2050
  }), r;
1757
2051
  }
1758
- function U(e) {
2052
+ function W(e) {
1759
2053
  let t;
1760
2054
  if (typeof e.resources == "string") t = [e.resources];
1761
2055
  else if (t = e.resources, !(t instanceof Array) || !t.length) return null;
@@ -1770,19 +2064,19 @@ function U(e) {
1770
2064
  dataAfterTimeout: e.dataAfterTimeout !== !1
1771
2065
  };
1772
2066
  }
1773
- for (var W = Object.create(null), G = ["https://api.simplesvg.com", "https://api.unisvg.com"], K = []; G.length > 0;) G.length === 1 || Math.random() > .5 ? K.push(G.shift()) : K.push(G.pop());
1774
- W[""] = U({ resources: ["https://api.iconify.design"].concat(K) });
1775
- function Qt(e, t) {
1776
- let n = U(t);
1777
- return n !== null && (W[e] = n, !0);
2067
+ for (var G = Object.create(null), K = ["https://api.simplesvg.com", "https://api.unisvg.com"], ln = []; K.length > 0;) K.length === 1 || Math.random() > .5 ? ln.push(K.shift()) : ln.push(K.pop());
2068
+ G[""] = W({ resources: ["https://api.iconify.design"].concat(ln) });
2069
+ function un(e, t) {
2070
+ let n = W(t);
2071
+ return n !== null && (G[e] = n, !0);
1778
2072
  }
1779
2073
  function q(e) {
1780
- return W[e];
2074
+ return G[e];
1781
2075
  }
1782
- function $t() {
1783
- return Object.keys(W);
2076
+ function dn() {
2077
+ return Object.keys(G);
1784
2078
  }
1785
- var en = {
2079
+ var fn = {
1786
2080
  resources: [],
1787
2081
  index: 0,
1788
2082
  timeout: 2e3,
@@ -1790,7 +2084,7 @@ var en = {
1790
2084
  random: !1,
1791
2085
  dataAfterTimeout: !1
1792
2086
  };
1793
- function tn(e, t, n, r) {
2087
+ function pn(e, t, n, r) {
1794
2088
  let i = e.resources.length, a = e.random ? Math.floor(Math.random() * i) : e.index, o;
1795
2089
  if (e.random) {
1796
2090
  let t = e.resources.slice(0);
@@ -1813,7 +2107,7 @@ function tn(e, t, n, r) {
1813
2107
  function te(e, t) {
1814
2108
  t && (p = []), typeof e == "function" && p.push(e);
1815
2109
  }
1816
- function ne() {
2110
+ function h() {
1817
2111
  return {
1818
2112
  startTime: s,
1819
2113
  payload: t,
@@ -1824,17 +2118,17 @@ function tn(e, t, n, r) {
1824
2118
  abort: ee
1825
2119
  };
1826
2120
  }
1827
- function h() {
2121
+ function g() {
1828
2122
  c = "failed", p.forEach((e) => {
1829
2123
  e(void 0, u);
1830
2124
  });
1831
2125
  }
1832
- function g() {
2126
+ function _() {
1833
2127
  f.forEach((e) => {
1834
2128
  e.status === "pending" && (e.status = "aborted");
1835
2129
  }), f = [];
1836
2130
  }
1837
- function _(t, n, r) {
2131
+ function ne(t, n, r) {
1838
2132
  let i = n !== "success";
1839
2133
  switch (f = f.filter((e) => e !== t), c) {
1840
2134
  case "pending": break;
@@ -1844,14 +2138,14 @@ function tn(e, t, n, r) {
1844
2138
  default: return;
1845
2139
  }
1846
2140
  if (n === "abort") {
1847
- u = r, h();
2141
+ u = r, g();
1848
2142
  return;
1849
2143
  }
1850
2144
  if (i) {
1851
- u = r, f.length || (o.length ? v() : h());
2145
+ u = r, f.length || (o.length ? v() : g());
1852
2146
  return;
1853
2147
  }
1854
- if (m(), g(), !e.random) {
2148
+ if (m(), _(), !e.random) {
1855
2149
  let n = e.resources.indexOf(t.resource);
1856
2150
  n !== -1 && n !== e.index && (e.index = n);
1857
2151
  }
@@ -1866,34 +2160,34 @@ function tn(e, t, n, r) {
1866
2160
  if (r === void 0) {
1867
2161
  if (f.length) {
1868
2162
  d = setTimeout(() => {
1869
- m(), c === "pending" && (g(), h());
2163
+ m(), c === "pending" && (_(), g());
1870
2164
  }, e.timeout);
1871
2165
  return;
1872
2166
  }
1873
- h();
2167
+ g();
1874
2168
  return;
1875
2169
  }
1876
2170
  let i = {
1877
2171
  status: "pending",
1878
2172
  resource: r,
1879
2173
  callback: (e, t) => {
1880
- _(i, e, t);
2174
+ ne(i, e, t);
1881
2175
  }
1882
2176
  };
1883
2177
  f.push(i), l++, d = setTimeout(v, e.rotate), n(r, t, i.callback);
1884
2178
  }
1885
- return setTimeout(v), ne;
2179
+ return setTimeout(v), h;
1886
2180
  }
1887
- function nn(e) {
2181
+ function mn(e) {
1888
2182
  let t = {
1889
- ...en,
2183
+ ...fn,
1890
2184
  ...e
1891
2185
  }, n = [];
1892
2186
  function r() {
1893
2187
  n = n.filter((e) => e().status === "pending");
1894
2188
  }
1895
2189
  function i(e, i, a) {
1896
- let o = tn(t, e, i, (e, t) => {
2190
+ let o = pn(t, e, i, (e, t) => {
1897
2191
  r(), a && a(e, t);
1898
2192
  });
1899
2193
  return n.push(o), o;
@@ -1911,47 +2205,47 @@ function nn(e) {
1911
2205
  cleanup: r
1912
2206
  };
1913
2207
  }
1914
- function rn() {}
1915
- var an = Object.create(null);
1916
- function on(e) {
1917
- if (!an[e]) {
2208
+ function hn() {}
2209
+ var gn = Object.create(null);
2210
+ function _n(e) {
2211
+ if (!gn[e]) {
1918
2212
  let t = q(e);
1919
2213
  if (!t) return;
1920
- an[e] = {
2214
+ gn[e] = {
1921
2215
  config: t,
1922
- redundancy: nn(t)
2216
+ redundancy: mn(t)
1923
2217
  };
1924
2218
  }
1925
- return an[e];
2219
+ return gn[e];
1926
2220
  }
1927
- function sn(e, t, n) {
2221
+ function vn(e, t, n) {
1928
2222
  let r, i;
1929
2223
  if (typeof e == "string") {
1930
- let t = H(e);
1931
- if (!t) return n(void 0, 424), rn;
2224
+ let t = U(e);
2225
+ if (!t) return n(void 0, 424), hn;
1932
2226
  i = t.send;
1933
- let a = on(e);
2227
+ let a = _n(e);
1934
2228
  a && (r = a.redundancy);
1935
2229
  } else {
1936
- let t = U(e);
2230
+ let t = W(e);
1937
2231
  if (t) {
1938
- r = nn(t);
1939
- let n = H(e.resources ? e.resources[0] : "");
2232
+ r = mn(t);
2233
+ let n = U(e.resources ? e.resources[0] : "");
1940
2234
  n && (i = n.send);
1941
2235
  }
1942
2236
  }
1943
- return !r || !i ? (n(void 0, 424), rn) : r.query(t, i, n)().abort;
2237
+ return !r || !i ? (n(void 0, 424), hn) : r.query(t, i, n)().abort;
1944
2238
  }
1945
- function cn() {}
1946
- function ln(e) {
2239
+ function yn() {}
2240
+ function bn(e) {
1947
2241
  e.iconsLoaderFlag || (e.iconsLoaderFlag = !0, setTimeout(() => {
1948
- e.iconsLoaderFlag = !1, Kt(e);
2242
+ e.iconsLoaderFlag = !1, nn(e);
1949
2243
  }));
1950
2244
  }
1951
- function un(e) {
2245
+ function xn(e) {
1952
2246
  let t = [], n = [];
1953
2247
  return e.forEach((e) => {
1954
- (e.match(Dt) ? t : n).push(e);
2248
+ (e.match(Lt) ? t : n).push(e);
1955
2249
  }), {
1956
2250
  valid: t,
1957
2251
  invalid: n
@@ -1965,37 +2259,37 @@ function J(e, t, n) {
1965
2259
  });
1966
2260
  }
1967
2261
  if (n && typeof n == "object") try {
1968
- if (!Lt(e, n).length) {
2262
+ if (!qt(e, n).length) {
1969
2263
  r();
1970
2264
  return;
1971
2265
  }
1972
2266
  } catch (e) {
1973
2267
  console.error(e);
1974
2268
  }
1975
- r(), ln(e);
2269
+ r(), bn(e);
1976
2270
  }
1977
- function dn(e, t) {
2271
+ function Sn(e, t) {
1978
2272
  e instanceof Promise ? e.then((e) => {
1979
2273
  t(e);
1980
2274
  }).catch(() => {
1981
2275
  t(null);
1982
2276
  }) : t(e);
1983
2277
  }
1984
- function fn(e, t) {
2278
+ function Cn(e, t) {
1985
2279
  e.iconsToLoad = e.iconsToLoad ? e.iconsToLoad.concat(t).sort() : t, e.iconsQueueFlag || (e.iconsQueueFlag = !0, setTimeout(() => {
1986
2280
  e.iconsQueueFlag = !1;
1987
2281
  let { provider: t, prefix: n } = e, r = e.iconsToLoad;
1988
2282
  if (delete e.iconsToLoad, !r || !r.length) return;
1989
2283
  let i = e.loadIcon;
1990
2284
  if (e.loadIcons && (r.length > 1 || !i)) {
1991
- dn(e.loadIcons(r, n, t), (t) => {
2285
+ Sn(e.loadIcons(r, n, t), (t) => {
1992
2286
  J(e, r, t);
1993
2287
  });
1994
2288
  return;
1995
2289
  }
1996
2290
  if (i) {
1997
2291
  r.forEach((r) => {
1998
- dn(i(r, n, t), (t) => {
2292
+ Sn(i(r, n, t), (t) => {
1999
2293
  J(e, [r], t ? {
2000
2294
  prefix: n,
2001
2295
  icons: { [r]: t }
@@ -2004,26 +2298,26 @@ function fn(e, t) {
2004
2298
  });
2005
2299
  return;
2006
2300
  }
2007
- let { valid: a, invalid: o } = un(r);
2301
+ let { valid: a, invalid: o } = xn(r);
2008
2302
  if (o.length && J(e, o, null), !a.length) return;
2009
- let s = n.match(Dt) ? H(t) : null;
2303
+ let s = n.match(Lt) ? U(t) : null;
2010
2304
  if (!s) {
2011
2305
  J(e, a, null);
2012
2306
  return;
2013
2307
  }
2014
2308
  s.prepare(t, n, a).forEach((n) => {
2015
- sn(t, n, (t) => {
2309
+ vn(t, n, (t) => {
2016
2310
  J(e, n.icons, t);
2017
2311
  });
2018
2312
  });
2019
2313
  }));
2020
2314
  }
2021
- var pn = (e, t) => {
2022
- let n = Yt(Zt(e, !0, Bt()));
2315
+ var wn = (e, t) => {
2316
+ let n = on(cn(e, !0, Xt()));
2023
2317
  if (!n.pending.length) {
2024
2318
  let e = !0;
2025
2319
  return t && setTimeout(() => {
2026
- e && t(n.loaded, n.missing, n.pending, cn);
2320
+ e && t(n.loaded, n.missing, n.pending, yn);
2027
2321
  }), () => {
2028
2322
  e = !1;
2029
2323
  };
@@ -2032,28 +2326,28 @@ var pn = (e, t) => {
2032
2326
  return n.pending.forEach((e) => {
2033
2327
  let { provider: t, prefix: n } = e;
2034
2328
  if (n === o && t === a) return;
2035
- a = t, o = n, i.push(R(t, n));
2329
+ a = t, o = n, i.push(z(t, n));
2036
2330
  let s = r[t] || (r[t] = Object.create(null));
2037
2331
  s[n] || (s[n] = []);
2038
2332
  }), n.pending.forEach((e) => {
2039
- let { provider: t, prefix: n, name: i } = e, a = R(t, n), o = a.pendingIcons ||= /* @__PURE__ */ new Set();
2333
+ let { provider: t, prefix: n, name: i } = e, a = z(t, n), o = a.pendingIcons ||= /* @__PURE__ */ new Set();
2040
2334
  o.has(i) || (o.add(i), r[t][n].push(i));
2041
2335
  }), i.forEach((e) => {
2042
2336
  let t = r[e.provider][e.prefix];
2043
- t.length && fn(e, t);
2044
- }), t ? Jt(t, n, i) : cn;
2045
- }, mn = (e) => new Promise((t, n) => {
2046
- let r = typeof e == "string" ? F(e, !0) : e;
2337
+ t.length && Cn(e, t);
2338
+ }), t ? an(t, n, i) : yn;
2339
+ }, Tn = (e) => new Promise((t, n) => {
2340
+ let r = typeof e == "string" ? I(e, !0) : e;
2047
2341
  if (!r) {
2048
2342
  n(e);
2049
2343
  return;
2050
2344
  }
2051
- pn([r || e], (i) => {
2345
+ wn([r || e], (i) => {
2052
2346
  if (i.length && r) {
2053
- let e = B(r);
2347
+ let e = V(r);
2054
2348
  if (e) {
2055
2349
  t({
2056
- ...N,
2350
+ ...F,
2057
2351
  ...e
2058
2352
  });
2059
2353
  return;
@@ -2062,28 +2356,28 @@ var pn = (e, t) => {
2062
2356
  n(e);
2063
2357
  });
2064
2358
  });
2065
- function hn(e) {
2359
+ function En(e) {
2066
2360
  try {
2067
2361
  let t = typeof e == "string" ? JSON.parse(e) : e;
2068
2362
  if (typeof t.body == "string") return { ...t };
2069
2363
  } catch {}
2070
2364
  }
2071
- function gn(e, t) {
2365
+ function Dn(e, t) {
2072
2366
  if (typeof e == "object") return {
2073
- data: hn(e),
2367
+ data: En(e),
2074
2368
  value: e
2075
2369
  };
2076
2370
  if (typeof e != "string") return { value: e };
2077
2371
  if (e.includes("{")) {
2078
- let t = hn(e);
2372
+ let t = En(e);
2079
2373
  if (t) return {
2080
2374
  data: t,
2081
2375
  value: e
2082
2376
  };
2083
2377
  }
2084
- let n = F(e, !0, !0);
2378
+ let n = I(e, !0, !0);
2085
2379
  if (!n) return { value: e };
2086
- let r = B(n);
2380
+ let r = V(n);
2087
2381
  return r !== void 0 || !n.prefix ? {
2088
2382
  value: e,
2089
2383
  name: n,
@@ -2091,29 +2385,29 @@ function gn(e, t) {
2091
2385
  } : {
2092
2386
  value: e,
2093
2387
  name: n,
2094
- loading: pn([n], () => t(e, n, B(n)))
2388
+ loading: wn([n], () => t(e, n, V(n)))
2095
2389
  };
2096
2390
  }
2097
- var _n = !1;
2391
+ var On = !1;
2098
2392
  try {
2099
- _n = navigator.vendor.indexOf("Apple") === 0;
2393
+ On = navigator.vendor.indexOf("Apple") === 0;
2100
2394
  } catch {}
2101
- function vn(e, t) {
2395
+ function kn(e, t) {
2102
2396
  switch (t) {
2103
2397
  case "svg":
2104
2398
  case "bg":
2105
2399
  case "mask": return t;
2106
2400
  }
2107
- return t !== "style" && (_n || e.indexOf("<a") === -1) ? "svg" : e.indexOf("currentColor") === -1 ? "bg" : "mask";
2401
+ return t !== "style" && (On || e.indexOf("<a") === -1) ? "svg" : e.indexOf("currentColor") === -1 ? "bg" : "mask";
2108
2402
  }
2109
- var yn = /(-?[0-9.]*[0-9]+[0-9.]*)/g, bn = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
2110
- function xn(e, t, n) {
2403
+ var An = /(-?[0-9.]*[0-9]+[0-9.]*)/g, jn = /^-?[0-9.]*[0-9]+[0-9.]*$/g;
2404
+ function Mn(e, t, n) {
2111
2405
  if (t === 1) return e;
2112
2406
  if (n ||= 100, typeof e == "number") return Math.ceil(e * t * n) / n;
2113
2407
  if (typeof e != "string") return e;
2114
- let r = e.split(yn);
2408
+ let r = e.split(An);
2115
2409
  if (r === null || !r.length) return e;
2116
- let i = [], a = r.shift(), o = bn.test(a);
2410
+ let i = [], a = r.shift(), o = jn.test(a);
2117
2411
  for (;;) {
2118
2412
  if (o) {
2119
2413
  let e = parseFloat(a);
@@ -2123,7 +2417,7 @@ function xn(e, t, n) {
2123
2417
  o = !o;
2124
2418
  }
2125
2419
  }
2126
- function Sn(e, t = "defs") {
2420
+ function Nn(e, t = "defs") {
2127
2421
  let n = "", r = e.indexOf("<" + t);
2128
2422
  for (; r >= 0;) {
2129
2423
  let i = e.indexOf(">", r), a = e.indexOf("</" + t);
@@ -2137,20 +2431,20 @@ function Sn(e, t = "defs") {
2137
2431
  content: e
2138
2432
  };
2139
2433
  }
2140
- function Cn(e, t) {
2434
+ function Pn(e, t) {
2141
2435
  return e ? "<defs>" + e + "</defs>" + t : t;
2142
2436
  }
2143
- function wn(e, t, n) {
2144
- let r = Sn(e);
2145
- return Cn(r.defs, t + r.content + n);
2437
+ function Fn(e, t, n) {
2438
+ let r = Nn(e);
2439
+ return Pn(r.defs, t + r.content + n);
2146
2440
  }
2147
- var Tn = (e) => e === "unset" || e === "undefined" || e === "none";
2148
- function En(e, t) {
2441
+ var In = (e) => e === "unset" || e === "undefined" || e === "none";
2442
+ function Ln(e, t) {
2149
2443
  let n = {
2150
- ...N,
2444
+ ...F,
2151
2445
  ...e
2152
2446
  }, r = {
2153
- ...bt,
2447
+ ...At,
2154
2448
  ...t
2155
2449
  }, i = {
2156
2450
  left: n.left,
@@ -2171,12 +2465,12 @@ function En(e, t) {
2171
2465
  break;
2172
2466
  case 3: s = i.width / 2 + i.left, t.unshift("rotate(-90 " + s.toString() + " " + s.toString() + ")");
2173
2467
  }
2174
- o % 2 == 1 && (i.left !== i.top && (s = i.left, i.left = i.top, i.top = s), i.width !== i.height && (s = i.width, i.width = i.height, i.height = s)), t.length && (a = wn(a, "<g transform=\"" + t.join(" ") + "\">", "</g>"));
2468
+ o % 2 == 1 && (i.left !== i.top && (s = i.left, i.left = i.top, i.top = s), i.width !== i.height && (s = i.width, i.width = i.height, i.height = s)), t.length && (a = Fn(a, "<g transform=\"" + t.join(" ") + "\">", "</g>"));
2175
2469
  });
2176
2470
  let o = r.width, s = r.height, c = i.width, l = i.height, u, d;
2177
- o === null ? (d = s === null ? "1em" : s === "auto" ? l : s, u = xn(d, c / l)) : (u = o === "auto" ? c : o, d = s === null ? xn(u, l / c) : s === "auto" ? l : s);
2471
+ o === null ? (d = s === null ? "1em" : s === "auto" ? l : s, u = Mn(d, c / l)) : (u = o === "auto" ? c : o, d = s === null ? Mn(u, l / c) : s === "auto" ? l : s);
2178
2472
  let f = {}, p = (e, t) => {
2179
- Tn(t) || (f[e] = t.toString());
2473
+ In(t) || (f[e] = t.toString());
2180
2474
  };
2181
2475
  p("width", u), p("height", d);
2182
2476
  let m = [
@@ -2191,19 +2485,19 @@ function En(e, t) {
2191
2485
  body: a
2192
2486
  };
2193
2487
  }
2194
- function Dn(e, t) {
2488
+ function Rn(e, t) {
2195
2489
  let n = e.indexOf("xlink:") === -1 ? "" : " xmlns:xlink=\"http://www.w3.org/1999/xlink\"";
2196
2490
  for (let e in t) n += " " + e + "=\"" + t[e] + "\"";
2197
2491
  return "<svg xmlns=\"http://www.w3.org/2000/svg\"" + n + ">" + e + "</svg>";
2198
2492
  }
2199
- function On(e) {
2493
+ function zn(e) {
2200
2494
  return e.replace(/"/g, "'").replace(/%/g, "%25").replace(/#/g, "%23").replace(/</g, "%3C").replace(/>/g, "%3E").replace(/\s+/g, " ").replace(/:/g, "%3A").replace(/\//g, "%2F");
2201
2495
  }
2202
- function kn(e) {
2203
- return "data:image/svg+xml," + On(e);
2496
+ function Bn(e) {
2497
+ return "data:image/svg+xml," + zn(e);
2204
2498
  }
2205
- function An(e) {
2206
- return "url(\"" + kn(e) + "\")";
2499
+ function Vn(e) {
2500
+ return "url(\"" + Bn(e) + "\")";
2207
2501
  }
2208
2502
  var Y = (() => {
2209
2503
  let e;
@@ -2211,13 +2505,13 @@ var Y = (() => {
2211
2505
  if (e = fetch, typeof e == "function") return e;
2212
2506
  } catch {}
2213
2507
  })();
2214
- function jn(e) {
2508
+ function Hn(e) {
2215
2509
  Y = e;
2216
2510
  }
2217
- function Mn() {
2511
+ function Un() {
2218
2512
  return Y;
2219
2513
  }
2220
- function Nn(e, t) {
2514
+ function Wn(e, t) {
2221
2515
  let n = q(e);
2222
2516
  if (!n) return 0;
2223
2517
  let r;
@@ -2232,11 +2526,11 @@ function Nn(e, t) {
2232
2526
  }
2233
2527
  return r;
2234
2528
  }
2235
- function Pn(e) {
2529
+ function Gn(e) {
2236
2530
  return e === 404;
2237
2531
  }
2238
- var Fn = (e, t, n) => {
2239
- let r = [], i = Nn(e, t), a = "icons", o = {
2532
+ var Kn = (e, t, n) => {
2533
+ let r = [], i = Wn(e, t), a = "icons", o = {
2240
2534
  type: a,
2241
2535
  provider: e,
2242
2536
  prefix: t,
@@ -2251,21 +2545,21 @@ var Fn = (e, t, n) => {
2251
2545
  }, s = n.length), o.icons.push(n);
2252
2546
  }), r.push(o), r;
2253
2547
  };
2254
- function In(e) {
2548
+ function qn(e) {
2255
2549
  if (typeof e == "string") {
2256
2550
  let t = q(e);
2257
2551
  if (t) return t.path;
2258
2552
  }
2259
2553
  return "/";
2260
2554
  }
2261
- var Ln = {
2262
- prepare: Fn,
2555
+ var Jn = {
2556
+ prepare: Kn,
2263
2557
  send: (e, t, n) => {
2264
2558
  if (!Y) {
2265
2559
  n("abort", 424);
2266
2560
  return;
2267
2561
  }
2268
- let r = In(t.provider);
2562
+ let r = qn(t.provider);
2269
2563
  switch (t.type) {
2270
2564
  case "icons": {
2271
2565
  let e = t.prefix, n = t.icons.join(","), i = new URLSearchParams({ icons: n });
@@ -2286,7 +2580,7 @@ var Ln = {
2286
2580
  let t = e.status;
2287
2581
  if (t !== 200) {
2288
2582
  setTimeout(() => {
2289
- n(Pn(t) ? "abort" : "next", t);
2583
+ n(Gn(t) ? "abort" : "next", t);
2290
2584
  });
2291
2585
  return;
2292
2586
  }
@@ -2306,38 +2600,38 @@ var Ln = {
2306
2600
  });
2307
2601
  }
2308
2602
  };
2309
- function Rn(e, t, n) {
2310
- R(n || "", t).loadIcons = e;
2603
+ function Yn(e, t, n) {
2604
+ z(n || "", t).loadIcons = e;
2311
2605
  }
2312
- function zn(e, t, n) {
2313
- R(n || "", t).loadIcon = e;
2606
+ function Xn(e, t, n) {
2607
+ z(n || "", t).loadIcon = e;
2314
2608
  }
2315
- var Bn = "data-style", Vn = "", X = {};
2609
+ var Zn = "data-style", Qn = "", X = {};
2316
2610
  function Z(e) {
2317
- return ":host{display:inline-block;vertical-align:" + (e ? "-0.125em" : "0") + "}span,svg{display:block;margin:auto}" + Vn;
2611
+ return ":host{display:inline-block;vertical-align:" + (e ? "-0.125em" : "0") + "}span,svg{display:block;margin:auto}" + Qn;
2318
2612
  }
2319
- function Hn(e) {
2613
+ function $n(e) {
2320
2614
  return "adoptedStyleSheets" in e && typeof CSSStyleSheet == "function" && typeof CSSStyleSheet.prototype.replaceSync == "function";
2321
2615
  }
2322
- function Un(e) {
2616
+ function er(e) {
2323
2617
  let t = e ? "inline" : "block", n = X[t];
2324
2618
  return n || (n = X[t] = new CSSStyleSheet(), n.replaceSync(Z(e))), n;
2325
2619
  }
2326
- function Wn(e) {
2327
- Vn = e, X.inline?.replaceSync(Z(!0)), X.block?.replaceSync(Z(!1));
2620
+ function tr(e) {
2621
+ Qn = e, X.inline?.replaceSync(Z(!0)), X.block?.replaceSync(Z(!1));
2328
2622
  }
2329
- function Gn(e, t) {
2330
- if (Hn(e)) {
2331
- let n = Un(t), r = e.adoptedStyleSheets;
2623
+ function nr(e, t) {
2624
+ if ($n(e)) {
2625
+ let n = er(t), r = e.adoptedStyleSheets;
2332
2626
  if (r.includes(n)) return;
2333
2627
  e.adoptedStyleSheets = r.filter((e) => e !== X.inline && e !== X.block).concat(n);
2334
2628
  return;
2335
2629
  }
2336
- let n = Array.from(e.childNodes).find((e) => e.hasAttribute && e.hasAttribute(Bn));
2337
- n || (n = document.createElement("style"), n.setAttribute(Bn, Bn), e.appendChild(n)), n.textContent = Z(t);
2630
+ let n = Array.from(e.childNodes).find((e) => e.hasAttribute && e.hasAttribute(Zn));
2631
+ n || (n = document.createElement("style"), n.setAttribute(Zn, Zn), e.appendChild(n)), n.textContent = Z(t);
2338
2632
  }
2339
- function Kn() {
2340
- Xt("", Ln), Bt(!0);
2633
+ function rr() {
2634
+ sn("", Jn), Xt(!0);
2341
2635
  let e;
2342
2636
  try {
2343
2637
  e = window;
@@ -2347,7 +2641,7 @@ function Kn() {
2347
2641
  let t = e.IconifyPreload, n = "Invalid IconifyPreload syntax.";
2348
2642
  typeof t == "object" && t && (t instanceof Array ? t : [t]).forEach((e) => {
2349
2643
  try {
2350
- (typeof e != "object" || !e || e instanceof Array || typeof e.icons != "object" || typeof e.prefix != "string" || !Ht(e)) && console.error(n);
2644
+ (typeof e != "object" || !e || e instanceof Array || typeof e.icons != "object" || typeof e.prefix != "string" || !Qt(e)) && console.error(n);
2351
2645
  } catch {
2352
2646
  console.error(n);
2353
2647
  }
@@ -2360,7 +2654,7 @@ function Kn() {
2360
2654
  try {
2361
2655
  let r = t[e];
2362
2656
  if (typeof r != "object" || !r || r.resources === void 0) continue;
2363
- Qt(e, r) || console.error(n);
2657
+ un(e, r) || console.error(n);
2364
2658
  } catch {
2365
2659
  console.error(n);
2366
2660
  }
@@ -2368,101 +2662,101 @@ function Kn() {
2368
2662
  }
2369
2663
  }
2370
2664
  return {
2371
- iconLoaded: Ut,
2372
- getIcon: Wt,
2373
- listIcons: zt,
2374
- addIcon: Vt,
2375
- addCollection: Ht,
2376
- calculateSize: xn,
2377
- buildIcon: En,
2378
- iconToHTML: Dn,
2379
- svgToURL: An,
2380
- loadIcons: pn,
2381
- loadIcon: mn,
2382
- addAPIProvider: Qt,
2383
- setCustomIconLoader: zn,
2384
- setCustomIconsLoader: Rn,
2385
- appendCustomStyle: Wn,
2665
+ iconLoaded: $t,
2666
+ getIcon: en,
2667
+ listIcons: Yt,
2668
+ addIcon: Zt,
2669
+ addCollection: Qt,
2670
+ calculateSize: Mn,
2671
+ buildIcon: Ln,
2672
+ iconToHTML: Rn,
2673
+ svgToURL: Vn,
2674
+ loadIcons: wn,
2675
+ loadIcon: Tn,
2676
+ addAPIProvider: un,
2677
+ setCustomIconLoader: Xn,
2678
+ setCustomIconsLoader: Yn,
2679
+ appendCustomStyle: tr,
2386
2680
  _api: {
2387
2681
  getAPIConfig: q,
2388
- setAPIModule: Xt,
2389
- sendAPIQuery: sn,
2390
- setFetch: jn,
2391
- getFetch: Mn,
2392
- listAPIProviders: $t
2682
+ setAPIModule: sn,
2683
+ sendAPIQuery: vn,
2684
+ setFetch: Hn,
2685
+ getFetch: Un,
2686
+ listAPIProviders: dn
2393
2687
  }
2394
2688
  };
2395
2689
  }
2396
- var qn = { "background-color": "currentColor" }, Jn = { "background-color": "transparent" }, Yn = {
2690
+ var ir = { "background-color": "currentColor" }, ar = { "background-color": "transparent" }, or = {
2397
2691
  image: "var(--svg)",
2398
2692
  repeat: "no-repeat",
2399
2693
  size: "100% 100%"
2400
- }, Xn = {
2401
- "-webkit-mask": qn,
2402
- mask: qn,
2403
- background: Jn
2694
+ }, sr = {
2695
+ "-webkit-mask": ir,
2696
+ mask: ir,
2697
+ background: ar
2404
2698
  };
2405
- for (let e in Xn) {
2406
- let t = Xn[e];
2407
- for (let n in Yn) t[e + "-" + n] = Yn[n];
2699
+ for (let e in sr) {
2700
+ let t = sr[e];
2701
+ for (let n in or) t[e + "-" + n] = or[n];
2408
2702
  }
2409
- function Zn(e) {
2703
+ function cr(e) {
2410
2704
  return e ? e + (e.match(/^[-0-9.]+$/) ? "px" : "") : "inherit";
2411
2705
  }
2412
- function Qn(e, t, n) {
2706
+ function lr(e, t, n) {
2413
2707
  let r = document.createElement("span"), i = e.body;
2414
2708
  i.indexOf("<a") !== -1 && (i += "<!-- " + Date.now() + " -->");
2415
- let a = e.attributes, o = An(Dn(i, {
2709
+ let a = e.attributes, o = Vn(Rn(i, {
2416
2710
  ...a,
2417
2711
  width: t.width + "",
2418
2712
  height: t.height + ""
2419
2713
  })), s = r.style, c = {
2420
2714
  "--svg": o,
2421
- width: Zn(a.width),
2422
- height: Zn(a.height),
2423
- ...n ? qn : Jn
2715
+ width: cr(a.width),
2716
+ height: cr(a.height),
2717
+ ...n ? ir : ar
2424
2718
  };
2425
2719
  for (let e in c) s.setProperty(e, c[e]);
2426
2720
  return r;
2427
2721
  }
2428
2722
  var Q;
2429
- function $n() {
2723
+ function ur() {
2430
2724
  try {
2431
2725
  Q = window.trustedTypes.createPolicy("iconify", { createHTML: (e) => e });
2432
2726
  } catch {
2433
2727
  Q = null;
2434
2728
  }
2435
2729
  }
2436
- function er(e) {
2437
- return Q === void 0 && $n(), Q ? Q.createHTML(e) : e;
2730
+ function dr(e) {
2731
+ return Q === void 0 && ur(), Q ? Q.createHTML(e) : e;
2438
2732
  }
2439
- function tr(e) {
2733
+ function fr(e) {
2440
2734
  let t = document.createElement("span"), n = e.attributes, r = "";
2441
- return n.width || (r = "width: inherit;"), n.height || (r += "height: inherit;"), r && (n.style = r), t.innerHTML = er(Dn(e.body, n)), t.firstChild;
2735
+ return n.width || (r = "width: inherit;"), n.height || (r += "height: inherit;"), r && (n.style = r), t.innerHTML = dr(Rn(e.body, n)), t.firstChild;
2442
2736
  }
2443
- function nr(e) {
2737
+ function pr(e) {
2444
2738
  return Array.from(e.childNodes).find((e) => {
2445
2739
  let t = e.tagName && e.tagName.toUpperCase();
2446
2740
  return t === "SPAN" || t === "SVG";
2447
2741
  });
2448
2742
  }
2449
- function rr(e, t) {
2450
- let n = t.icon.data, r = t.customisations, i = En(n, r);
2743
+ function mr(e, t) {
2744
+ let n = t.icon.data, r = t.customisations, i = Ln(n, r);
2451
2745
  r.preserveAspectRatio && (i.attributes.preserveAspectRatio = r.preserveAspectRatio);
2452
2746
  let a = t.renderedMode, o;
2453
2747
  switch (a) {
2454
2748
  case "svg":
2455
- o = tr(i);
2749
+ o = fr(i);
2456
2750
  break;
2457
- default: o = Qn(i, {
2458
- ...N,
2751
+ default: o = lr(i, {
2752
+ ...F,
2459
2753
  ...n
2460
2754
  }, a === "mask");
2461
2755
  }
2462
- let s = nr(e);
2756
+ let s = pr(e);
2463
2757
  s ? o.tagName === "SPAN" && s.tagName === o.tagName ? s.setAttribute("style", o.getAttribute("style")) : e.replaceChild(o, s) : e.appendChild(o);
2464
2758
  }
2465
- function ir(e, t, n) {
2759
+ function hr(e, t, n) {
2466
2760
  return {
2467
2761
  rendered: !1,
2468
2762
  inline: t,
@@ -2470,7 +2764,7 @@ function ir(e, t, n) {
2470
2764
  lastRender: n && (n.rendered ? n : n.lastRender)
2471
2765
  };
2472
2766
  }
2473
- function ar(e = "iconify-icon") {
2767
+ function gr(e = "iconify-icon") {
2474
2768
  let t, n;
2475
2769
  try {
2476
2770
  t = window.customElements, n = window.HTMLElement;
@@ -2500,7 +2794,7 @@ function ar(e = "iconify-icon") {
2500
2794
  constructor() {
2501
2795
  super();
2502
2796
  let e = this._shadowRoot = this.attachShadow({ mode: "open" }), t = this.hasAttribute("inline");
2503
- Gn(e, t), this._state = ir({ value: "" }, t), this._queueCheck();
2797
+ nr(e, t), this._state = hr({ value: "" }, t), this._queueCheck();
2504
2798
  }
2505
2799
  connectedCallback() {
2506
2800
  this._connected = !0, this.startObserver();
@@ -2515,7 +2809,7 @@ function ar(e = "iconify-icon") {
2515
2809
  switch (e) {
2516
2810
  case "inline": {
2517
2811
  let e = this.hasAttribute("inline"), t = this._state;
2518
- e !== t.inline && (t.inline = e, Gn(this._shadowRoot, e));
2812
+ e !== t.inline && (t.inline = e, nr(this._shadowRoot, e));
2519
2813
  break;
2520
2814
  }
2521
2815
  case "noobserver":
@@ -2554,7 +2848,7 @@ function ar(e = "iconify-icon") {
2554
2848
  t.lastChild.setCurrentTime(0);
2555
2849
  return;
2556
2850
  } catch {}
2557
- rr(t, e);
2851
+ mr(t, e);
2558
2852
  }
2559
2853
  }
2560
2854
  get status() {
@@ -2575,11 +2869,11 @@ function ar(e = "iconify-icon") {
2575
2869
  return;
2576
2870
  }
2577
2871
  if (!e.rendered || !this._visible) return;
2578
- let n = this.getAttribute("mode"), r = Tt(this);
2579
- (e.attrMode !== n || Et(e.customisations, r) || !nr(this._shadowRoot)) && this._renderIcon(e.icon, r, n);
2872
+ let n = this.getAttribute("mode"), r = Ft(this);
2873
+ (e.attrMode !== n || It(e.customisations, r) || !pr(this._shadowRoot)) && this._renderIcon(e.icon, r, n);
2580
2874
  }
2581
2875
  _iconChanged(e) {
2582
- let t = gn(e, (e, t, n) => {
2876
+ let t = Dn(e, (e, t, n) => {
2583
2877
  let r = this._state;
2584
2878
  if (r.rendered || this.getAttribute("icon") !== e) return;
2585
2879
  let i = {
@@ -2589,22 +2883,22 @@ function ar(e = "iconify-icon") {
2589
2883
  };
2590
2884
  i.data ? this._gotIconData(i) : r.icon = i;
2591
2885
  });
2592
- t.data ? this._gotIconData(t) : this._state = ir(t, this._state.inline, this._state);
2886
+ t.data ? this._gotIconData(t) : this._state = hr(t, this._state.inline, this._state);
2593
2887
  }
2594
2888
  _forceRender() {
2595
2889
  if (!this._visible) {
2596
- let e = nr(this._shadowRoot);
2890
+ let e = pr(this._shadowRoot);
2597
2891
  e && this._shadowRoot.removeChild(e);
2598
2892
  return;
2599
2893
  }
2600
2894
  this._queueCheck();
2601
2895
  }
2602
2896
  _gotIconData(e) {
2603
- this._checkQueued = !1, this._renderIcon(e, Tt(this), this.getAttribute("mode"));
2897
+ this._checkQueued = !1, this._renderIcon(e, Ft(this), this.getAttribute("mode"));
2604
2898
  }
2605
2899
  _renderIcon(e, t, n) {
2606
- let r = vn(e.data.body, n), i = this._state.inline;
2607
- rr(this._shadowRoot, this._state = {
2900
+ let r = kn(e.data.body, n), i = this._state.inline;
2901
+ mr(this._shadowRoot, this._state = {
2608
2902
  rendered: !0,
2609
2903
  icon: e,
2610
2904
  inline: i,
@@ -2642,25 +2936,25 @@ function ar(e = "iconify-icon") {
2642
2936
  }
2643
2937
  });
2644
2938
  });
2645
- let o = Kn();
2939
+ let o = rr();
2646
2940
  for (let e in o) a[e] = a.prototype[e] = o[e];
2647
2941
  return t.define(e, a), a;
2648
2942
  }
2649
- var { iconLoaded: or, getIcon: sr, listIcons: cr, addIcon: lr, addCollection: ur, calculateSize: dr, buildIcon: fr, iconToHTML: pr, svgToURL: mr, loadIcons: hr, loadIcon: gr, setCustomIconLoader: _r, setCustomIconsLoader: vr, addAPIProvider: yr, _api: br } = ar() || Kn(), $ = {
2943
+ var { iconLoaded: _r, getIcon: vr, listIcons: yr, addIcon: br, addCollection: xr, calculateSize: Sr, buildIcon: Cr, iconToHTML: wr, svgToURL: Tr, loadIcons: Er, loadIcon: Dr, setCustomIconLoader: Or, setCustomIconsLoader: kr, addAPIProvider: Ar, _api: jr } = gr() || rr(), $ = {
2650
2944
  hero: "dfk-hero",
2651
2945
  features: "dfk-features",
2652
2946
  nextSteps: "dfk-next-steps",
2653
2947
  sql: "dfk-sql",
2654
2948
  mermaid: "dfk-mermaid"
2655
2949
  };
2656
- function xr() {
2950
+ function Mr() {
2657
2951
  if (typeof customElements < "u") for (let [e, t] of Object.entries({
2658
2952
  [$.hero]: te,
2659
2953
  [$.features]: m,
2660
- [$.nextSteps]: Ae,
2661
- [$.sql]: ht,
2662
- [$.mermaid]: De
2954
+ [$.nextSteps]: Ne,
2955
+ [$.sql]: wt,
2956
+ [$.mermaid]: je
2663
2957
  })) customElements.get(e) || customElements.define(e, t);
2664
2958
  }
2665
2959
  //#endregion
2666
- export { te as a, De as i, ht as n, m as o, Ae as r, xr as t };
2960
+ export { te as a, je as i, wt as n, m as o, Ne as r, Mr as t };