//#region node_modules/svelte/src/internal/disclose-version.js
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
//#endregion
//#region node_modules/svelte/src/constants.js
var e = {}, t = Symbol("uninitialized"), n = "http://www.w3.org/1999/xhtml", r = "http://www.w3.org/2000/svg", i = "http://www.w3.org/1998/Math/MathML", a = Array.isArray, o = Array.prototype.indexOf, s = Array.prototype.includes, c = Array.from, l = Object.keys, u = Object.defineProperty, d = Object.getOwnPropertyDescriptor, f = Object.getOwnPropertyDescriptors, p = Object.prototype, m = Array.prototype, h = Object.getPrototypeOf, g = Object.isExtensible, _ = () => {};
function v(e) {
	for (var t = 0; t < e.length; t++) e[t]();
}
function y() {
	var e, t;
	return {
		promise: new Promise((n, r) => {
			e = n, t = r;
		}),
		resolve: e,
		reject: t
	};
}
var b = 1024, x = 2048, S = 4096, C = 8192, ee = 16384, w = 32768, te = 1 << 25, ne = 65536, T = 1 << 19, re = 1 << 20, ie = 1 << 25, ae = 65536, oe = 1 << 21, se = 1 << 22, ce = 1 << 23, le = Symbol("$state"), ue = Symbol("legacy props"), E = Symbol(""), de = Symbol("attributes"), fe = Symbol("class"), pe = Symbol("style"), me = Symbol("text"), he = Symbol("form reset"), ge = new class extends Error {
	name = "StaleReactionError";
	message = "The reaction that called `getAbortSignal()` was re-run or destroyed";
}(), _e = !!globalThis.document?.contentType && /* @__PURE__ */ globalThis.document.contentType.includes("xml");
//#endregion
//#region node_modules/svelte/src/internal/client/errors.js
function ve() {
	throw Error("https://svelte.dev/e/async_derived_orphan");
}
function ye(e, t, n) {
	throw Error("https://svelte.dev/e/each_key_duplicate");
}
function D(e) {
	throw Error("https://svelte.dev/e/effect_in_teardown");
}
function be() {
	throw Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function O(e) {
	throw Error("https://svelte.dev/e/effect_orphan");
}
function xe() {
	throw Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function Se() {
	throw Error("https://svelte.dev/e/hydration_failed");
}
function Ce(e) {
	throw Error("https://svelte.dev/e/props_invalid_value");
}
function we() {
	throw Error("https://svelte.dev/e/state_descriptors_fixed");
}
function Te() {
	throw Error("https://svelte.dev/e/state_prototype_fixed");
}
function Ee() {
	throw Error("https://svelte.dev/e/state_unsafe_mutation");
}
function De() {
	throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
function Oe() {
	console.warn("https://svelte.dev/e/derived_inert");
}
function ke(e) {
	console.warn("https://svelte.dev/e/hydration_mismatch");
}
function Ae() {
	console.warn("https://svelte.dev/e/svelte_boundary_reset_noop");
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/hydration.js
var k = !1;
function je(e) {
	k = e;
}
var A;
function Me(t) {
	if (t === null) throw ke(), e;
	return A = t;
}
function Ne() {
	return Me(/* @__PURE__ */ sn(A));
}
function j(t) {
	if (k) {
		if (/* @__PURE__ */ sn(A) !== null) throw ke(), e;
		A = t;
	}
}
function Pe(e = 1) {
	if (k) {
		for (var t = e, n = A; t--;) n = /* @__PURE__ */ sn(n);
		A = n;
	}
}
function Fe(e = !0) {
	for (var t = 0, n = A;;) {
		if (n.nodeType === 8) {
			var r = n.data;
			if (r === "]") {
				if (t === 0) return n;
				--t;
			} else (r === "[" || r === "[!" || r[0] === "[" && !isNaN(Number(r.slice(1)))) && (t += 1);
		}
		var i = /* @__PURE__ */ sn(n);
		e && n.remove(), n = i;
	}
}
function Ie(t) {
	if (!t || t.nodeType !== 8) throw ke(), e;
	return t.data;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/equality.js
function Le(e) {
	return e === this.v;
}
function Re(e, t) {
	return e == e ? e !== t || typeof e == "object" && !!e || typeof e == "function" : t == t;
}
function ze(e) {
	return !Re(e, this.v);
}
//#endregion
//#region node_modules/svelte/src/internal/client/context.js
var Be = null;
function Ve(e) {
	Be = e;
}
function He(e, t = !1, n) {
	Be = {
		p: Be,
		i: !1,
		c: null,
		e: null,
		s: e,
		x: null,
		r: V,
		l: null
	};
}
function Ue(e) {
	var t = Be, n = t.e;
	if (n !== null) {
		t.e = null;
		for (var r of n) yn(r);
	}
	return e !== void 0 && (t.x = e), t.i = !0, Be = t.p, e ?? {};
}
function We() {
	return !0;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/task.js
var Ge = [];
function Ke() {
	var e = Ge;
	Ge = [], v(e);
}
function qe(e) {
	if (Ge.length === 0 && !At) {
		var t = Ge;
		queueMicrotask(() => {
			t === Ge && Ke();
		});
	}
	Ge.push(e);
}
function Je() {
	for (; Ge.length > 0;) Ke();
}
function Ye(e) {
	var t = V;
	if (t === null) return B.f |= ce, e;
	if (!(t.f & 32768) && !(t.f & 4)) throw e;
	Xe(e, t);
}
function Xe(e, t) {
	if (!(t !== null && t.f & 16384)) {
		for (; t !== null;) {
			if (t.f & 128) {
				if (!(t.f & 32768)) throw e;
				try {
					t.b.error(e);
					return;
				} catch (t) {
					e = t;
				}
			}
			t = t.parent;
		}
		throw e;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/status.js
var Ze = ~(x | S | b);
function Qe(e, t) {
	e.f = e.f & Ze | t;
}
function $e(e) {
	e.f & 512 || e.deps === null ? Qe(e, b) : Qe(e, S);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/utils.js
function et(e) {
	if (e !== null) for (let t of e) !(t.f & 2) || !(t.f & 65536) || (t.f ^= ae, et(t.deps));
}
function tt(e, t, n) {
	e.f & 2048 ? t.add(e) : e.f & 4096 && n.add(e), et(e.deps), Qe(e, b);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/store.js
var nt = !1;
function rt(e) {
	var t = nt;
	try {
		return nt = !1, [e(), nt];
	} finally {
		nt = t;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/misc.js
function it(e) {
	k && /* @__PURE__ */ on(e) !== null && ln(e);
}
var at = !1;
function ot() {
	at || (at = !0, document.addEventListener("reset", (e) => {
		Promise.resolve().then(() => {
			if (!e.defaultPrevented) for (let t of e.target.elements) t[he]?.();
		});
	}, { capture: !0 }));
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/shared.js
function st(e) {
	var t = B, n = V;
	Un(null), Wn(null);
	try {
		return e();
	} finally {
		Un(t), Wn(n);
	}
}
function ct(e, t, n, r = n) {
	e.addEventListener(t, () => st(n));
	let i = e[he];
	e[he] = i ? () => {
		i(), r(!0);
	} : () => r(!0), ot();
}
//#endregion
//#region node_modules/svelte/src/reactivity/create-subscriber.js
function lt(e) {
	let t = 0, n = Kt(0), r;
	return () => {
		gn() && (H(n), wn(() => (t === 0 && (r = dr(() => e(() => Xt(n)))), t += 1, () => {
			qe(() => {
				--t, t === 0 && (r?.(), r = void 0, Xt(n));
			});
		})));
	};
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/boundary.js
var ut = ne | T;
function dt(e, t, n, r) {
	new ft(e, t, n, r);
}
var ft = class {
	parent;
	is_pending = !1;
	transform_error;
	#e;
	#t = k ? A : null;
	#n;
	#r;
	#i;
	#a = null;
	#o = null;
	#s = null;
	#c = null;
	#l = 0;
	#u = 0;
	#d = !1;
	#f = /* @__PURE__ */ new Set();
	#p = /* @__PURE__ */ new Set();
	#m = null;
	#h = lt(() => (this.#m = Kt(this.#l), () => {
		this.#m = null;
	}));
	constructor(e, t, n, r) {
		this.#e = e, this.#n = t, this.#r = (e) => {
			var t = V;
			t.b = this, t.f |= 128, n(e);
		}, this.parent = V.b, this.transform_error = r ?? this.parent?.transform_error ?? ((e) => e), this.#i = Tn(() => {
			if (k) {
				let e = this.#t;
				Ne();
				let t = e.data === "[!";
				if (e.data.startsWith("[?")) {
					let t = JSON.parse(e.data.slice(2));
					this.#_(t);
				} else t ? this.#y() : this.#g();
			} else this.#b();
		}, ut), k && (this.#e = A);
	}
	#g() {
		try {
			this.#a = En(() => this.#r(this.#e));
		} catch (e) {
			this.error(e);
		}
	}
	#_(e) {
		let t = this.#n.failed, { reset: n, invoke_onerror: r } = this.#v(e);
		qe(r), t && (this.#s = En(() => {
			t(this.#e, () => e, () => n);
		}));
	}
	#v(e) {
		var t = !1, n = !1;
		let r = () => {
			if (t) {
				Ae();
				return;
			}
			t = !0, n && De(), this.#s !== null && Nn(this.#s, () => {
				this.#s = null;
			}), this.#S(() => {
				this.#b();
			});
		};
		return {
			reset: r,
			invoke_onerror: () => {
				try {
					n = !0, this.#n.onerror?.(e, r), n = !1;
				} catch (e) {
					Xe(e, this.#i && this.#i.parent);
				}
			}
		};
	}
	#y() {
		let e = this.#n.pending;
		e && (this.is_pending = !0, this.#o = En(() => e(this.#e)), qe(() => {
			var e = this.#c = document.createDocumentFragment(), t = an();
			e.append(t), this.#a = this.#S(() => En(() => this.#r(t))), this.#u === 0 && (this.#e.before(e), this.#c = null, Nn(this.#o, () => {
				this.#o = null;
			}), this.#x(N));
		}));
	}
	#b() {
		try {
			if (this.is_pending = this.has_pending_snippet(), this.#u = 0, this.#l = 0, this.#a = En(() => {
				this.#r(this.#e);
			}), this.#u > 0) {
				var e = this.#c = document.createDocumentFragment();
				Ln(this.#a, e);
				let t = this.#n.pending;
				this.#o = En(() => t(this.#e));
			} else this.#x(N);
		} catch (e) {
			this.error(e);
		}
	}
	#x(e) {
		this.is_pending = !1, e.transfer_effects(this.#f, this.#p);
	}
	defer_effect(e) {
		tt(e, this.#f, this.#p);
	}
	is_rendered() {
		return !this.is_pending && (!this.parent || this.parent.is_rendered());
	}
	has_pending_snippet() {
		return !!this.#n.pending;
	}
	#S(e) {
		var t = V, n = B, r = Be;
		Wn(this.#i), Un(this.#i), Ve(this.#i.ctx);
		try {
			return It.ensure(), e();
		} catch (e) {
			return Ye(e), null;
		} finally {
			Wn(t), Un(n), Ve(r);
		}
	}
	#C(e, t) {
		if (!this.has_pending_snippet()) {
			this.parent && this.parent.#C(e, t);
			return;
		}
		this.#u += e, this.#u === 0 && (this.#x(t), this.#o && Nn(this.#o, () => {
			this.#o = null;
		}), this.#c &&= (this.#e.before(this.#c), null));
	}
	update_pending_count(e, t) {
		this.#C(e, t), this.#l += e, !(!this.#m || this.#d) && (this.#d = !0, qe(() => {
			this.#d = !1, this.#m && Jt(this.#m, this.#l);
		}));
	}
	get_effect_pending() {
		return this.#h(), H(this.#m);
	}
	error(e) {
		if (!this.#n.onerror && !this.#n.failed) throw e;
		N?.is_fork ? (this.#a && N.skip_effect(this.#a), this.#o && N.skip_effect(this.#o), this.#s && N.skip_effect(this.#s), N.oncommit(() => {
			this.#w(e);
		})) : this.#w(e);
	}
	#w(e) {
		this.#a &&= (An(this.#a), null), this.#o &&= (An(this.#o), null), this.#s &&= (An(this.#s), null), k && (Me(this.#t), Pe(), Me(Fe()));
		let t = this.#n.failed, n = (e) => {
			let { reset: n, invoke_onerror: r } = this.#v(e);
			r(), t && (this.#s = this.#S(() => {
				try {
					return En(() => {
						var r = V;
						r.b = this, r.f |= 128, t(this.#e, () => e, () => n);
					});
				} catch (e) {
					return Xe(e, this.#i.parent), null;
				}
			}));
		};
		qe(() => {
			var t;
			try {
				t = this.transform_error(e);
			} catch (e) {
				Xe(e, this.#i && this.#i.parent);
				return;
			}
			typeof t == "object" && t && typeof t.then == "function" ? t.then(n, (e) => Xe(e, this.#i && this.#i.parent)) : n(t);
		});
	}
};
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/async.js
function pt(e, t, n, r) {
	let i = We() ? _t : bt;
	var a = e.filter((e) => !e.settled), o = t.map(i);
	if (n.length === 0 && a.length === 0) {
		r(o);
		return;
	}
	var s = V, c = mt(), l = a.length === 1 ? a[0].promise : a.length > 1 ? Promise.all(a.map((e) => e.promise)) : null;
	function u(e) {
		if (!(s.f & 16384)) {
			c();
			try {
				r([...o, ...e]);
			} catch (e) {
				Xe(e, s);
			}
			ht();
		}
	}
	var d = gt();
	if (n.length === 0) {
		l.then(() => u([])).finally(d);
		return;
	}
	function f() {
		Promise.all(n.map((e) => /* @__PURE__ */ yt(e))).then(u).catch((e) => Xe(e, s)).finally(d);
	}
	l ? l.then(() => {
		c(), f(), ht();
	}) : f();
}
function mt() {
	var e = V, t = B, n = Be, r = N;
	return function(i = !0) {
		Wn(e), Un(t), Ve(n), i && !(e.f & 16384) && (r?.activate(), r?.apply());
	};
}
function ht(e = !0) {
	Wn(null), Un(null), Ve(null), e && N?.deactivate();
}
function gt() {
	var e = V, t = e.b, n = N, r = !!t?.is_rendered();
	return t?.update_pending_count(1, n), n.increment(r, e), () => {
		t?.update_pending_count(-1, n), n.decrement(r, e);
	};
}
/*#__NO_SIDE_EFFECTS__*/
function _t(e) {
	var n = 2 | x;
	return V !== null && (V.f |= T), {
		ctx: Be,
		deps: null,
		effects: null,
		equals: Le,
		f: n,
		fn: e,
		reactions: null,
		rv: 0,
		v: t,
		wv: 0,
		parent: V,
		ac: null
	};
}
var vt = Symbol("obsolete");
/*#__NO_SIDE_EFFECTS__*/
function yt(e, n, r) {
	let i = V;
	i === null && ve();
	var a = void 0, o = Kt(t), s = !B, c = /* @__PURE__ */ new Set();
	return Cn(() => {
		var t = V, n = y();
		a = n.promise;
		try {
			Promise.resolve(e()).then(n.resolve, (e) => {
				e !== ge && n.reject(e);
			}).finally(ht);
		} catch (e) {
			n.reject(e), ht();
		}
		var r = N;
		if (s) {
			if (t.f & 32768) var l = gt();
			if (i.b?.is_rendered()) r.async_deriveds.get(t)?.reject(vt);
			else for (let e of c.values()) e.reject(vt);
			c.add(n), r.async_deriveds.set(t, n);
		}
		let u = (e, t = void 0) => {
			l?.(), c.delete(n), t !== vt && (r.activate(), t ? (o.f |= ce, Jt(o, t)) : (o.f & 8388608 && (o.f ^= ce), Jt(o, e)), r.deactivate());
		};
		n.promise.then(u, (e) => u(null, e || "unknown"));
	}), _n(() => {
		for (let e of c) e.reject(vt);
	}), new Promise((e) => {
		function t(n) {
			function r() {
				n === a ? e(o) : t(a);
			}
			n.then(r, r);
		}
		t(a);
	});
}
/*#__NO_SIDE_EFFECTS__*/
function M(e) {
	let t = /* @__PURE__ */ _t(e);
	return Kn(t), t;
}
/*#__NO_SIDE_EFFECTS__*/
function bt(e) {
	let t = /* @__PURE__ */ _t(e);
	return t.equals = ze, t;
}
function xt(e) {
	var t = e.effects;
	if (t !== null) {
		e.effects = null;
		for (var n = 0; n < t.length; n += 1) An(t[n]);
	}
}
function St(e) {
	var n, r = V, i = e.parent;
	if (!Bn && i !== null && e.v !== t && i.f & 24576) return Oe(), e.v;
	Wn(i);
	try {
		e.f &= ~ae, xt(e), n = ir(e);
	} finally {
		Wn(r);
	}
	return n;
}
function Ct(e) {
	var t = St(e);
	if (!e.equals(t) && (e.wv = tr(), (!N?.is_fork || e.deps === null) && (N === null ? e.v = t : (N.capture(e, t, !0), Dt?.capture(e, t, !0)), e.deps === null))) {
		Qe(e, b);
		return;
	}
	Bn || (Ot === null ? $e(e) : (gn() || N?.is_fork) && Ot.set(e, t));
}
function wt(e) {
	if (e.effects !== null) for (let t of e.effects) (t.teardown || t.ac) && (t.teardown?.(), t.ac !== null && st(() => {
		t.ac.abort(ge), t.ac = null;
	}), t.fn !== null && (t.teardown = _), or(t, 0), On(t));
}
function Tt(e) {
	if (e.effects !== null) for (let t of e.effects) t.teardown && t.fn !== null && sr(t);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/batch.js
var Et = null, N = null, Dt = null, Ot = null, kt = null, At = !1, jt = !1, Mt = null, Nt = null, Pt = 0, Ft = 1, It = class e {
	id = Ft++;
	#e = !1;
	linked = !0;
	#t = null;
	#n = null;
	async_deriveds = /* @__PURE__ */ new Map();
	current = /* @__PURE__ */ new Map();
	previous = /* @__PURE__ */ new Map();
	#r = /* @__PURE__ */ new Set();
	#i = /* @__PURE__ */ new Set();
	#a = 0;
	#o = /* @__PURE__ */ new Map();
	#s = null;
	#c = [];
	#l = [];
	#u = /* @__PURE__ */ new Set();
	#d = /* @__PURE__ */ new Set();
	#f = /* @__PURE__ */ new Map();
	#p = /* @__PURE__ */ new Set();
	is_fork = !1;
	#m = !1;
	constructor() {
		Et === null ? Et = this : (Et.#n = this, this.#t = Et), Et = this;
	}
	#h() {
		if (this.is_fork) return !0;
		for (let n of this.#o.keys()) {
			for (var e = n, t = !1; e.parent !== null;) {
				if (this.#f.has(e)) {
					t = !0;
					break;
				}
				e = e.parent;
			}
			if (!t) return !0;
		}
		return !1;
	}
	skip_effect(e) {
		this.#f.has(e) || this.#f.set(e, {
			d: [],
			m: []
		}), this.#p.delete(e);
	}
	unskip_effect(e, t = (e) => this.schedule(e)) {
		var n = this.#f.get(e);
		if (n) {
			this.#f.delete(e);
			for (var r of n.d) Qe(r, x), t(r);
			for (r of n.m) Qe(r, S), t(r);
		}
		this.#p.add(e);
	}
	#g() {
		this.#e = !0, Pt++ > 1e3 && (this.#x(), Lt());
		for (let e of this.#u) this.#d.delete(e), Qe(e, x), this.schedule(e);
		for (let e of this.#d) Qe(e, S), this.schedule(e);
		let t = this.#c;
		this.#c = [], this.apply();
		var n = Mt = [], r = [], i = Nt = [];
		for (let e of t) try {
			this.#_(e, n, r);
		} catch (t) {
			throw Ht(e), this.#h() || this.discard(), t;
		}
		if (N = null, i.length > 0) {
			var a = e.ensure();
			for (let e of i) a.schedule(e);
		}
		if (Mt = null, Nt = null, this.#h()) {
			this.#b(r), this.#b(n);
			for (let [e, t] of this.#f) Vt(e, t);
			i.length > 0 && N.#g();
			return;
		}
		let o = this.#v();
		if (o) {
			this.#b(r), this.#b(n), o.#y(this);
			return;
		}
		this.#u.clear(), this.#d.clear();
		for (let e of this.#r) e(this);
		this.#r.clear(), Dt = this, zt(r), zt(n), Dt = null, this.#s?.resolve();
		var s = N;
		if (this.#a === 0 && (this.#c.length === 0 || s !== null) && this.#x(), this.#c.length > 0) {
			if (s !== null) {
				let e = s;
				e.#c.push(...this.#c.filter((t) => !e.#c.includes(t)));
			} else s = this;
		}
		s !== null && s.#g();
	}
	#_(e, t, n) {
		e.f ^= b;
		for (var r = e.first; r !== null;) {
			var i = r.f, a = !!(i & 96);
			if (!(a && i & 1024 || i & 8192 || this.#f.has(r)) && r.fn !== null) {
				a ? r.f ^= b : i & 4 ? t.push(r) : nr(r) && (i & 16 && this.#d.add(r), sr(r));
				var o = r.first;
				if (o !== null) {
					r = o;
					continue;
				}
			}
			for (; r !== null;) {
				var s = r.next;
				if (s !== null) {
					r = s;
					break;
				}
				r = r.parent;
			}
		}
	}
	#v() {
		for (var e = this.#t; e !== null;) {
			if (!e.is_fork) {
				for (let [t, [, n]] of this.current) if (e.current.has(t) && !n) return e;
			}
			e = e.#t;
		}
		return null;
	}
	#y(e) {
		for (let [t, n] of e.current) !this.previous.has(t) && e.previous.has(t) && this.previous.set(t, e.previous.get(t)), this.current.set(t, n);
		for (let [t, n] of e.async_deriveds) {
			let e = this.async_deriveds.get(t);
			e && n.promise.then(e.resolve).catch(e.reject);
		}
		e.async_deriveds.clear(), this.transfer_effects(e.#u, e.#d);
		let t = (e) => {
			var n = e.reactions;
			if (n !== null && !(e.f & 2 && !(e.f & 6144))) for (let e of n) {
				var r = e.f;
				if (r & 2) t(e);
				else {
					var i = e;
					r & 4194320 && !this.async_deriveds.has(i) && (this.#d.delete(i), Qe(i, x), this.schedule(i));
				}
			}
		};
		for (let e of this.current.keys()) t(e);
		this.oncommit(() => e.discard()), e.#x(), N = this, this.#g();
	}
	#b(e) {
		for (var t = 0; t < e.length; t += 1) tt(e[t], this.#u, this.#d);
	}
	capture(e, n, r = !1) {
		e.v !== t && !this.previous.has(e) && this.previous.set(e, e.v), e.f & 8388608 || (this.current.set(e, [n, r]), Ot?.set(e, n)), this.is_fork || (e.v = n);
	}
	activate() {
		N = this;
	}
	deactivate() {
		N = null, Ot = null;
	}
	flush() {
		try {
			jt = !0, N = this, this.#g();
		} finally {
			Pt = 0, kt = null, Mt = null, Nt = null, jt = !1, N = null, Ot = null, Wt.clear();
		}
	}
	discard() {
		for (let e of this.#i) e(this);
		this.#i.clear();
		for (let e of this.async_deriveds.values()) e.reject(vt);
		this.#x(), this.#s?.resolve();
	}
	register_created_effect(e) {
		this.#l.push(e);
	}
	increment(e, t) {
		if (this.#a += 1, e) {
			let e = this.#o.get(t) ?? 0;
			this.#o.set(t, e + 1);
		}
	}
	decrement(e, t) {
		if (--this.#a, e) {
			let e = this.#o.get(t) ?? 0;
			e === 1 ? this.#o.delete(t) : this.#o.set(t, e - 1);
		}
		this.#m || (this.#m = !0, qe(() => {
			this.#m = !1, this.linked && this.flush();
		}));
	}
	transfer_effects(e, t) {
		for (let t of e) this.#u.add(t);
		for (let e of t) this.#d.add(e);
		e.clear(), t.clear();
	}
	oncommit(e) {
		this.#r.add(e);
	}
	ondiscard(e) {
		this.#i.add(e);
	}
	settled() {
		return (this.#s ??= y()).promise;
	}
	static ensure() {
		if (N === null) {
			let t = N = new e();
			!jt && !At && qe(() => {
				t.#e || t.flush();
			});
		}
		return N;
	}
	apply() {
		Ot = null;
	}
	schedule(e) {
		if (kt = e, e.b?.is_pending && e.f & 16777228 && !(e.f & 32768)) {
			e.b.defer_effect(e);
			return;
		}
		for (var t = e; t.parent !== null;) {
			t = t.parent;
			var n = t.f;
			if (Mt !== null && t === V && (B === null || !(B.f & 2))) return;
			if (n & 96) {
				if (!(n & 1024)) return;
				t.f ^= b;
			}
		}
		this.#c.push(t);
	}
	#x() {
		if (this.linked) {
			var e = this.#t, t = this.#n;
			e === null || (e.#n = t), t === null ? Et = e : t.#t = e, this.linked = !1;
		}
	}
};
function P(e) {
	var t = At;
	At = !0;
	try {
		var n;
		for (e && (N !== null && !N.is_fork && N.flush(), n = e());;) {
			if (Je(), N === null) return n;
			N.flush();
		}
	} finally {
		At = t;
	}
}
function Lt() {
	try {
		xe();
	} catch (e) {
		Xe(e, kt);
	}
}
var Rt = null;
function zt(e) {
	var t = e.length;
	if (t !== 0) {
		for (var n = 0; n < t;) {
			var r = e[n++];
			if (!(r.f & 24576) && nr(r) && (Rt = /* @__PURE__ */ new Set(), sr(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Mn(r), Rt?.size > 0)) {
				Wt.clear();
				for (let e of Rt) {
					if (e.f & 24576) continue;
					let t = [e], n = e.parent;
					for (; n !== null;) Rt.has(n) && (Rt.delete(n), t.push(n)), n = n.parent;
					for (let e = t.length - 1; e >= 0; e--) {
						let n = t[e];
						n.f & 24576 || sr(n);
					}
				}
				Rt.clear();
			}
		}
		Rt = null;
	}
}
function Bt(e) {
	N.schedule(e);
}
function Vt(e, t) {
	if (!(e.f & 32 && e.f & 1024)) {
		e.f & 2048 ? t.d.push(e) : e.f & 4096 && t.m.push(e), Qe(e, b);
		for (var n = e.first; n !== null;) Vt(n, t), n = n.next;
	}
}
function Ht(e) {
	Qe(e, b);
	for (var t = e.first; t !== null;) Ht(t), t = t.next;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/sources.js
var Ut = /* @__PURE__ */ new Set(), Wt = /* @__PURE__ */ new Map(), Gt = !1;
function Kt(e, t) {
	return {
		f: 0,
		v: e,
		reactions: null,
		equals: Le,
		rv: 0,
		wv: 0
	};
}
/*#__NO_SIDE_EFFECTS__*/
function F(e, t) {
	let n = Kt(e, t);
	return Kn(n), n;
}
/*#__NO_SIDE_EFFECTS__*/
function qt(e, t = !1, n = !0) {
	let r = Kt(e);
	return t || (r.equals = ze), r;
}
function I(e, t, n = !1) {
	return B !== null && (!Hn || B.f & 131072) && We() && B.f & 4325394 && (Gn === null || !Gn.has(e)) && Ee(), Jt(e, n ? Qt(t) : t, Nt);
}
function Jt(e, t, n = null) {
	if (!e.equals(t)) {
		Wt.set(e, Bn ? t : e.v);
		var r = It.ensure();
		if (r.capture(e, t), e.f & 2) {
			let t = e;
			e.f & 2048 && St(t), Ot === null && $e(t);
		}
		e.wv = tr(), Zt(e, x, n), We() && V !== null && V.f & 1024 && !(V.f & 96) && (Yn === null ? Xn([e]) : Yn.push(e)), !r.is_fork && Ut.size > 0 && !Gt && Yt();
	}
	return t;
}
function Yt() {
	Gt = !1;
	for (let e of Ut) {
		e.f & 1024 && Qe(e, S);
		let t;
		try {
			t = nr(e);
		} catch {
			t = !0;
		}
		t && sr(e);
	}
	Ut.clear();
}
function Xt(e) {
	I(e, e.v + 1);
}
function Zt(e, t, n) {
	var r = e.reactions;
	if (r !== null) for (var i = We(), a = r.length, o = 0; o < a; o++) {
		var s = r[o], c = s.f;
		if (!(!i && s === V)) {
			var l = (c & x) === 0;
			if (l && Qe(s, t), c & 131072) Ut.add(s);
			else if (c & 2) {
				var u = s;
				Ot?.delete(u), c & 65536 || (c & 512 && (V === null || !(V.f & 2097152)) && (s.f |= ae), Zt(u, S, n));
			} else if (l) {
				var d = s;
				c & 16 && Rt !== null && Rt.add(d), n === null ? Bt(d) : n.push(d);
			}
		}
	}
}
function Qt(e) {
	if (typeof e != "object" || !e || le in e) return e;
	let n = h(e);
	if (n !== p && n !== m) return e;
	var r = /* @__PURE__ */ new Map(), i = a(e), o = /* @__PURE__ */ F(0), s = null, c = $n, l = (e) => {
		if ($n === c) return e();
		var t = B, n = $n;
		Un(null), er(c);
		var r = e();
		return Un(t), er(n), r;
	};
	return i && r.set("length", /* @__PURE__ */ F(e.length, s)), new Proxy(e, {
		defineProperty(e, t, n) {
			(!("value" in n) || n.configurable === !1 || n.enumerable === !1 || n.writable === !1) && we();
			var i = r.get(t);
			return i === void 0 ? l(() => {
				var e = /* @__PURE__ */ F(n.value, s);
				return r.set(t, e), e;
			}) : I(i, n.value, !0), !0;
		},
		deleteProperty(e, n) {
			var i = r.get(n);
			if (i === void 0) {
				if (n in e) {
					let e = l(() => /* @__PURE__ */ F(t, s));
					r.set(n, e), Xt(o);
				}
			} else I(i, t), Xt(o);
			return !0;
		},
		get(n, i, a) {
			if (i === le) return e;
			var o = r.get(i), c = i in n;
			if (o === void 0 && (!c || d(n, i)?.writable) && (o = l(() => /* @__PURE__ */ F(Qt(c ? n[i] : t), s)), r.set(i, o)), o !== void 0) {
				var u = H(o);
				return u === t ? void 0 : u;
			}
			return Reflect.get(n, i, a);
		},
		getOwnPropertyDescriptor(e, n) {
			var i = Reflect.getOwnPropertyDescriptor(e, n);
			if (i && "value" in i) {
				var a = r.get(n);
				a && (i.value = H(a));
			} else if (i === void 0) {
				var o = r.get(n), s = o?.v;
				if (o !== void 0 && s !== t) return {
					enumerable: !0,
					configurable: !0,
					value: s,
					writable: !0
				};
			}
			return i;
		},
		has(e, n) {
			if (n === le) return !0;
			var i = r.get(n), a = i !== void 0 && i.v !== t || Reflect.has(e, n);
			return (i !== void 0 || V !== null && (!a || d(e, n)?.writable)) && (i === void 0 && (i = l(() => /* @__PURE__ */ F(a ? Qt(e[n]) : t, s)), r.set(n, i)), H(i) === t) ? !1 : a;
		},
		set(e, n, a, c) {
			var u = r.get(n), f = n in e;
			if (i && n === "length") for (var p = a; p < u.v; p += 1) {
				var m = r.get(p + "");
				m === void 0 ? p in e && (m = l(() => /* @__PURE__ */ F(t, s)), r.set(p + "", m)) : I(m, t);
			}
			if (u === void 0) (!f || d(e, n)?.writable) && (u = l(() => /* @__PURE__ */ F(void 0, s)), I(u, Qt(a)), r.set(n, u));
			else {
				f = u.v !== t;
				var h = l(() => Qt(a));
				I(u, h);
			}
			var g = Reflect.getOwnPropertyDescriptor(e, n);
			if (g?.set && g.set.call(c, a), !f) {
				if (i && typeof n == "string") {
					var _ = r.get("length"), v = Number(n);
					Number.isInteger(v) && v >= _.v && I(_, v + 1);
				}
				Xt(o);
			}
			return !0;
		},
		ownKeys(e) {
			H(o);
			var n = Reflect.ownKeys(e).filter((e) => {
				var n = r.get(e);
				return n === void 0 || n.v !== t;
			});
			for (var [i, a] of r) a.v !== t && !(i in e) && n.push(i);
			return n;
		},
		setPrototypeOf() {
			Te();
		}
	});
}
var $t, en, tn, nn;
function rn() {
	if ($t === void 0) {
		$t = window, en = /Firefox/.test(navigator.userAgent);
		var e = Element.prototype, t = Node.prototype, n = Text.prototype;
		tn = d(t, "firstChild").get, nn = d(t, "nextSibling").get, g(e) && (e[fe] = void 0, e[de] = null, e[pe] = void 0, e.__e = void 0), g(n) && (n[me] = void 0);
	}
}
function an(e = "") {
	return document.createTextNode(e);
}
/*@__NO_SIDE_EFFECTS__*/
function on(e) {
	return tn.call(e);
}
/*@__NO_SIDE_EFFECTS__*/
function sn(e) {
	return nn.call(e);
}
function L(e, t) {
	if (!k) return /* @__PURE__ */ on(e);
	var n = /* @__PURE__ */ on(A);
	if (n === null) n = A.appendChild(an());
	else if (t && n.nodeType !== 3) {
		var r = an();
		return n?.before(r), Me(r), r;
	}
	return t && fn(n), Me(n), n;
}
function cn(e, t = !1) {
	if (!k) {
		var n = /* @__PURE__ */ on(e);
		return n instanceof Comment && n.data === "" ? /* @__PURE__ */ sn(n) : n;
	}
	if (t) {
		if (A?.nodeType !== 3) {
			var r = an();
			return A?.before(r), Me(r), r;
		}
		fn(A);
	}
	return A;
}
function R(e, t = 1, n = !1) {
	let r = k ? A : e;
	for (var i; t--;) i = r, r = /* @__PURE__ */ sn(r);
	if (!k) return r;
	if (n) {
		if (r?.nodeType !== 3) {
			var a = an();
			return r === null ? i?.after(a) : r.before(a), Me(a), a;
		}
		fn(r);
	}
	return Me(r), r;
}
function ln(e) {
	e.textContent = "";
}
function un() {
	return !1;
}
function dn(e, t, n) {
	return t == null || t === "http://www.w3.org/1999/xhtml" ? n ? document.createElement(e, { is: n }) : document.createElement(e) : n ? document.createElementNS(t, e, { is: n }) : document.createElementNS(t, e);
}
function fn(e) {
	if (e.nodeValue.length < 65536) return;
	let t = e.nextSibling;
	for (; t !== null && t.nodeType === 3;) t.remove(), e.nodeValue += t.nodeValue, t = e.nextSibling;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/effects.js
function pn(e) {
	V === null && (B === null && O(e), be()), Bn && D(e);
}
function mn(e, t) {
	var n = t.last;
	n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
}
function hn(e, t) {
	var n = V;
	n !== null && n.f & 8192 && (e |= C);
	var r = {
		ctx: Be,
		deps: null,
		nodes: null,
		f: e | x | 512,
		first: null,
		fn: t,
		last: null,
		next: null,
		parent: n,
		b: n && n.b,
		prev: null,
		teardown: null,
		wv: 0,
		ac: null
	};
	N?.register_created_effect(r);
	var i = r;
	if (e & 4) Mt === null ? It.ensure().schedule(r) : Mt.push(r);
	else if (t !== null) {
		try {
			sr(r);
		} catch (e) {
			throw An(r), e;
		}
		i.deps === null && i.teardown === null && i.nodes === null && i.first === i.last && !(i.f & 524288) && (i = i.first, e & 16 && e & 65536 && i !== null && (i.f |= ne));
	}
	if (i !== null && (i.parent = n, n !== null && mn(i, n), B !== null && B.f & 2 && !(e & 64))) {
		var a = B;
		(a.effects ??= []).push(i);
	}
	return r;
}
function gn() {
	return B !== null && !Hn;
}
function _n(e) {
	let t = hn(8, null);
	return Qe(t, b), t.teardown = e, t;
}
function vn(e) {
	pn("$effect");
	var t = V.f;
	if (!B && t & 32 && Be !== null && !Be.i) {
		var n = Be;
		(n.e ??= []).push(e);
	} else return yn(e);
}
function yn(e) {
	return hn(4 | re, e);
}
function bn(e) {
	It.ensure();
	let t = hn(64 | T, e);
	return () => {
		An(t);
	};
}
function xn(e) {
	It.ensure();
	let t = hn(64 | T, e);
	return (e = {}) => new Promise((n) => {
		e.outro ? Nn(t, () => {
			An(t), n(void 0);
		}) : (An(t), n(void 0));
	});
}
function Sn(e) {
	return hn(4, e);
}
function Cn(e) {
	return hn(se | T, e);
}
function wn(e, t = 0) {
	return hn(8 | t, e);
}
function z(e, t = [], n = [], r = []) {
	pt(r, t, n, (t) => {
		hn(8, () => {
			e(...t.map(H));
		});
	});
}
function Tn(e, t = 0) {
	return hn(16 | t, e);
}
function En(e) {
	return hn(32 | T, e);
}
function Dn(e) {
	var t = e.teardown;
	if (t !== null) {
		let e = Bn, n = B;
		Vn(!0), Un(null);
		try {
			t.call(null);
		} finally {
			Vn(e), Un(n);
		}
	}
}
function On(e, t = !1) {
	var n = e.first;
	for (e.first = e.last = null; n !== null;) {
		let e = n.ac;
		e !== null && st(() => {
			e.abort(ge);
		});
		var r = n.next;
		n.f & 64 ? n.parent = null : An(n, t), n = r;
	}
}
function kn(e) {
	for (var t = e.first; t !== null;) {
		var n = t.next;
		t.f & 32 || An(t), t = n;
	}
}
function An(e, t = !0) {
	var n = !1;
	(t || e.f & 262144) && e.nodes !== null && e.nodes.end !== null && (jn(e.nodes.start, e.nodes.end), n = !0), e.f |= te, On(e, t && !n), or(e, 0);
	var r = e.nodes && e.nodes.t;
	if (r !== null) for (let e of r) e.stop();
	Dn(e), e.f ^= te, e.f |= ee;
	var i = e.parent;
	i !== null && i.first !== null && Mn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
}
function jn(e, t) {
	for (; e !== null;) {
		var n = e === t ? null : /* @__PURE__ */ sn(e);
		e.remove(), e = n;
	}
}
function Mn(e) {
	var t = e.parent, n = e.prev, r = e.next;
	n !== null && (n.next = r), r !== null && (r.prev = n), t !== null && (t.first === e && (t.first = r), t.last === e && (t.last = n));
}
function Nn(e, t, n = !0) {
	var r = [];
	Pn(e, r, !0);
	var i = () => {
		n && An(e), t && t();
	}, a = r.length;
	if (a > 0) {
		var o = () => --a || i();
		for (var s of r) s.out(o);
	} else i();
}
function Pn(e, t, n) {
	if (!(e.f & 8192)) {
		e.f ^= C;
		var r = e.nodes && e.nodes.t;
		if (r !== null) for (let e of r) (e.is_global || n) && t.push(e);
		for (var i = e.first; i !== null;) {
			var a = i.next;
			if (!(i.f & 64)) {
				var o = !!(i.f & 65536) || !!(i.f & 32) && !!(e.f & 16);
				Pn(i, t, o ? n : !1);
			}
			i = a;
		}
	}
}
function Fn(e) {
	In(e, !0);
}
function In(e, t) {
	if (e.f & 8192) {
		e.f ^= C, e.f & 1024 || (Qe(e, x), It.ensure().schedule(e));
		for (var n = e.first; n !== null;) {
			var r = n.next, i = !!(n.f & 65536) || !!(n.f & 32);
			In(n, i ? t : !1), n = r;
		}
		var a = e.nodes && e.nodes.t;
		if (a !== null) for (let e of a) (e.is_global || t) && e.in();
	}
}
function Ln(e, t) {
	if (e.nodes) for (var n = e.nodes.start, r = e.nodes.end; n !== null;) {
		var i = n === r ? null : /* @__PURE__ */ sn(n);
		t.append(n), n = i;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/legacy.js
var Rn = null, zn = !1, Bn = !1;
function Vn(e) {
	Bn = e;
}
var B = null, Hn = !1;
function Un(e) {
	B = e;
}
var V = null;
function Wn(e) {
	V = e;
}
var Gn = null;
function Kn(e) {
	B !== null && (Gn ??= /* @__PURE__ */ new Set()).add(e);
}
var qn = null, Jn = 0, Yn = null;
function Xn(e) {
	Yn = e;
}
var Zn = 1, Qn = 0, $n = Qn;
function er(e) {
	$n = e;
}
function tr() {
	return ++Zn;
}
function nr(e) {
	var t = e.f;
	if (t & 2048) return !0;
	if (t & 2 && (e.f &= ~ae), t & 4096) {
		for (var n = e.deps, r = n.length, i = 0; i < r; i++) {
			var a = n[i];
			if (nr(a) && Ct(a), a.wv > e.wv) return !0;
		}
		t & 512 && Ot === null && Qe(e, b);
	}
	return !1;
}
function rr(e, t, n = !0) {
	var r = e.reactions;
	if (r !== null && !(Gn !== null && Gn.has(e))) for (var i = 0; i < r.length; i++) {
		var a = r[i];
		a.f & 2 ? rr(a, t, !1) : t === a && (n ? Qe(a, x) : a.f & 1024 && Qe(a, S), Bt(a));
	}
}
function ir(e) {
	var t = qn, n = Jn, r = Yn, i = B, a = Gn, o = Be, s = Hn, c = $n, l = e.f;
	qn = null, Jn = 0, Yn = null, B = l & 96 ? null : e, Gn = null, Ve(e.ctx), Hn = !1, $n = ++Qn, e.ac !== null && (st(() => {
		e.ac.abort(ge);
	}), e.ac = null);
	try {
		e.f |= oe;
		var u = e.fn, d = u();
		e.f |= w;
		var f = e.deps, p = N?.is_fork;
		if (qn !== null) {
			var m;
			if (p || or(e, Jn), f !== null && Jn > 0) for (f.length = Jn + qn.length, m = 0; m < qn.length; m++) f[Jn + m] = qn[m];
			else e.deps = f = qn;
			if (gn() && e.f & 512) for (m = Jn; m < f.length; m++) (f[m].reactions ??= []).push(e);
		} else !p && f !== null && Jn < f.length && (or(e, Jn), f.length = Jn);
		if (We() && Yn !== null && !Hn && f !== null && !(e.f & 6146)) for (m = 0; m < Yn.length; m++) rr(Yn[m], e);
		if (i !== null && i !== e) {
			if (Qn++, i.deps !== null) for (let e = 0; e < n; e += 1) i.deps[e].rv = Qn;
			if (t !== null) for (let e of t) e.rv = Qn;
			Yn !== null && (r === null ? r = Yn : r.push(...Yn));
		}
		return e.f & 8388608 && (e.f ^= ce), d;
	} catch (e) {
		return Ye(e);
	} finally {
		e.f ^= oe, qn = t, Jn = n, Yn = r, B = i, Gn = a, Ve(o), Hn = s, $n = c;
	}
}
function ar(e, n) {
	let r = n.reactions;
	if (r !== null) {
		var i = o.call(r, e);
		if (i !== -1) {
			var a = r.length - 1;
			a === 0 ? r = n.reactions = null : (r[i] = r[a], r.pop());
		}
	}
	if (r === null && n.f & 2 && (qn === null || !s.call(qn, n))) {
		var c = n;
		c.f & 512 && (c.f ^= 512, c.f &= ~ae), c.v !== t && $e(c), c.ac !== null && st(() => {
			c.ac.abort(ge), c.ac = null, Qe(c, x);
		}), wt(c), or(c, 0);
	}
}
function or(e, t) {
	var n = e.deps;
	if (n !== null) for (var r = t; r < n.length; r++) ar(e, n[r]);
}
function sr(e) {
	var t = e.f;
	if (!(t & 16384)) {
		Qe(e, b);
		var n = V, r = zn;
		V = e, zn = !(t & 96);
		try {
			t & 16777232 ? kn(e) : On(e), Dn(e);
			var i = ir(e);
			e.teardown = typeof i == "function" ? i : null, e.wv = Zn;
		} finally {
			zn = r, V = n;
		}
	}
}
async function cr() {
	await Promise.resolve(), P();
}
function H(e) {
	var t = !!(e.f & 2);
	if (Rn?.add(e), B !== null && !Hn && !(V !== null && V.f & 16384) && (Gn === null || !Gn.has(e))) {
		var n = B.deps;
		if (B.f & 2097152) e.rv < Qn && (e.rv = Qn, qn === null && n !== null && n[Jn] === e ? Jn++ : qn === null ? qn = [e] : qn.push(e));
		else {
			B.deps ??= [], s.call(B.deps, e) || B.deps.push(e);
			var r = e.reactions;
			r === null ? e.reactions = [B] : s.call(r, B) || r.push(B);
		}
	}
	if (Bn && Wt.has(e)) return Wt.get(e);
	if (t) {
		var i = e;
		if (Bn) {
			var a = i.v;
			return (!(i.f & 1024) && i.reactions !== null || ur(i)) && (a = St(i)), Wt.set(i, a), a;
		}
		var o = !(i.f & 512) && !Hn && B !== null && (zn || !!(B.f & 512)), c = (i.f & w) === 0;
		nr(i) && (o && (i.f |= 512), Ct(i)), o && !c && (Tt(i), lr(i));
	}
	if (Ot?.has(e)) return Ot.get(e);
	if (e.f & 8388608) throw e.v;
	return e.v;
}
function lr(e) {
	if (e.f |= 512, e.deps !== null) for (let t of e.deps) (t.reactions ??= []).push(e), t.f & 2 && !(t.f & 512) && (Tt(t), lr(t));
}
function ur(e) {
	if (e.v === t) return !0;
	if (e.deps === null) return !1;
	for (let t of e.deps) if (Wt.has(t) || t.f & 2 && ur(t)) return !0;
	return !1;
}
function dr(e) {
	var t = Hn;
	try {
		return Hn = !0, e();
	} finally {
		Hn = t;
	}
}
function fr(e) {
	if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
		if (le in e) pr(e);
		else if (!Array.isArray(e)) for (let t in e) {
			let n = e[t];
			typeof n == "object" && n && le in n && pr(n);
		}
	}
}
function pr(e, t = /* @__PURE__ */ new Set()) {
	if (typeof e == "object" && e && !(e instanceof EventTarget) && !t.has(e)) {
		t.add(e), e instanceof Date && e.getTime();
		for (let n in e) try {
			pr(e[n], t);
		} catch {}
		let n = h(e);
		if (n !== Object.prototype && n !== Array.prototype && n !== Map.prototype && n !== Set.prototype && n !== Date.prototype) {
			let t = f(n);
			for (let n in t) {
				let r = t[n].get;
				if (r) try {
					r.call(e);
				} catch {}
			}
		}
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/events.js
var mr = Symbol("events"), hr = /* @__PURE__ */ new Set(), gr = /* @__PURE__ */ new Set();
function _r(e, t, n, r = {}) {
	function i(e) {
		if (r.capture || xr.call(t, e), !e.cancelBubble) return st(() => n?.call(this, e));
	}
	return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? qe(() => {
		t.addEventListener(e, i, r);
	}) : t.addEventListener(e, i, r), i;
}
function vr(e, t, n, r, i) {
	var a = {
		capture: r,
		passive: i
	}, o = _r(e, t, n, a);
	(t === document.body || t === window || t === document || t instanceof HTMLMediaElement) && _n(() => {
		t.removeEventListener(e, o, a);
	});
}
function U(e, t, n) {
	(t[mr] ??= {})[e] = n;
}
function yr(e) {
	for (var t = 0; t < e.length; t++) hr.add(e[t]);
	for (var n of gr) n(e);
}
var br = null;
function xr(e) {
	var t = this, n = t.ownerDocument, r = e.type, i = e.composedPath?.() || [], a = i[0] || e.target;
	br = e;
	var o = 0, s = br === e && e[mr];
	if (s) {
		var c = i.indexOf(s);
		if (c !== -1 && (t === document || t === window)) {
			e[mr] = t;
			return;
		}
		var l = i.indexOf(t);
		if (l === -1) return;
		c <= l && (o = c);
	}
	if (a = i[o] || e.target, a !== t) {
		u(e, "currentTarget", {
			configurable: !0,
			get() {
				return a || n;
			}
		});
		var d = B, f = V;
		Un(null), Wn(null);
		try {
			for (var p, m = []; a !== null && a !== t;) {
				try {
					var h = a[mr]?.[r];
					h != null && (!a.disabled || e.target === a) && h.call(a, e);
				} catch (e) {
					p ? m.push(e) : p = e;
				}
				if (e.cancelBubble) break;
				o++, a = o < i.length ? i[o] : null;
			}
			if (p) {
				for (let e of m) queueMicrotask(() => {
					throw e;
				});
				throw p;
			}
		} finally {
			e[mr] = t, delete e.currentTarget, Un(d), Wn(f);
		}
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/reconciler.js
var Sr = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (e) => e });
function Cr(e) {
	return Sr?.createHTML(e) ?? e;
}
function wr(e) {
	var t = dn("template");
	return t.innerHTML = Cr(e.replaceAll("<!>", "<!---->")), t.content;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/template.js
function Tr(e, t) {
	var n = V;
	n.nodes === null && (n.nodes = {
		start: e,
		end: t,
		a: null,
		t: null
	});
}
/*#__NO_SIDE_EFFECTS__*/
function W(e, t) {
	var n = !!(t & 1), r = !!(t & 2), i, a = !e.startsWith("<!>");
	return () => {
		if (k) return Tr(A, null), A;
		i === void 0 && (i = wr(a ? e : "<!>" + e), n || (i = /* @__PURE__ */ on(i)));
		var t = r || en ? document.importNode(i, !0) : i.cloneNode(!0);
		if (n) {
			var o = /* @__PURE__ */ on(t), s = t.lastChild;
			Tr(o, s);
		} else Tr(t, t);
		return t;
	};
}
/*#__NO_SIDE_EFFECTS__*/
function Er(e, t, n = "svg") {
	var r = !e.startsWith("<!>"), i = !!(t & 1), a = `<${n}>${r ? e : "<!>" + e}</${n}>`, o;
	return () => {
		if (k) return Tr(A, null), A;
		if (!o) {
			var e = /* @__PURE__ */ on(wr(a));
			if (i) for (o = document.createDocumentFragment(); /* @__PURE__ */ on(e);) o.appendChild(/* @__PURE__ */ on(e));
			else o = /* @__PURE__ */ on(e);
		}
		var t = o.cloneNode(!0);
		if (i) {
			var n = /* @__PURE__ */ on(t), r = t.lastChild;
			Tr(n, r);
		} else Tr(t, t);
		return t;
	};
}
/*#__NO_SIDE_EFFECTS__*/
function Dr(e, t) {
	return /* @__PURE__ */ Er(e, t, "svg");
}
function Or(e = "") {
	if (!k) {
		var t = an(e + "");
		return Tr(t, t), t;
	}
	var n = A;
	return n.nodeType === 3 ? fn(n) : (n.before(n = an()), Me(n)), Tr(n, n), n;
}
function kr() {
	if (k) return Tr(A, null), A;
	var e = document.createDocumentFragment(), t = document.createComment(""), n = an();
	return e.append(t, n), Tr(t, n), e;
}
function G(e, t) {
	if (k) {
		var n = V;
		(!(n.f & 32768) || n.nodes.end === null) && (n.nodes.end = A), Ne();
		return;
	}
	e !== null && e.before(t);
}
[.../* @__PURE__ */ "allowfullscreen.async.autofocus.autoplay.checked.controls.default.disabled.formnovalidate.indeterminate.inert.ismap.loop.multiple.muted.nomodule.novalidate.open.playsinline.readonly.required.reversed.seamless.selected.webkitdirectory.defer.disablepictureinpicture.disableremoteplayback".split(".")];
var Ar = ["touchstart", "touchmove"];
function jr(e) {
	return Ar.includes(e);
}
function K(e, t) {
	var n = t == null ? "" : typeof t == "object" ? `${t}` : t;
	n !== (e[me] ??= e.nodeValue) && (e[me] = n, e.nodeValue = `${n}`);
}
function Mr(e, t) {
	return Fr(e, t);
}
function Nr(t, n) {
	rn(), n.intro = n.intro ?? !1;
	let r = n.target, i = k, a = A;
	try {
		for (var o = /* @__PURE__ */ on(r); o && (o.nodeType !== 8 || o.data !== "[");) o = /* @__PURE__ */ sn(o);
		if (!o) throw e;
		je(!0), Me(o);
		let i = Fr(t, {
			...n,
			anchor: o
		});
		return je(!1), i;
	} catch (i) {
		if (i instanceof Error && i.message.split("\n").some((e) => e.startsWith("https://svelte.dev/e/"))) throw i;
		return i !== e && console.warn("Failed to hydrate: ", i), n.recover === !1 && Se(), rn(), ln(r), je(!1), Mr(t, n);
	} finally {
		je(i), Me(a);
	}
}
var Pr = /* @__PURE__ */ new Map();
function Fr(t, { target: n, anchor: r, props: i = {}, events: a, context: o, intro: s = !0, transformError: l }) {
	rn();
	var u = void 0, d = xn(() => {
		var s = r ?? n.appendChild(an());
		dt(s, { pending: () => {} }, (n) => {
			He({});
			var r = Be;
			if (o && (r.c = o), a && (i.$$events = a), k && Tr(n, null), u = t(n, i) || {}, k && (V.nodes.end = A, A === null || A.nodeType !== 8 || A.data !== "]")) throw ke(), e;
			Ue();
		}, l);
		var d = /* @__PURE__ */ new Set(), f = (e) => {
			for (var t = 0; t < e.length; t++) {
				var r = e[t];
				if (!d.has(r)) {
					d.add(r);
					var i = jr(r);
					for (let e of [n, document]) {
						var a = Pr.get(e);
						a === void 0 && (a = /* @__PURE__ */ new Map(), Pr.set(e, a));
						var o = a.get(r);
						o === void 0 ? (e.addEventListener(r, xr, { passive: i }), a.set(r, 1)) : a.set(r, o + 1);
					}
				}
			}
		};
		return f(c(hr)), gr.add(f), () => {
			for (var e of d) for (let r of [n, document]) {
				var t = Pr.get(r), i = t.get(e);
				--i == 0 ? (r.removeEventListener(e, xr), t.delete(e), t.size === 0 && Pr.delete(r)) : t.set(e, i);
			}
			gr.delete(f), s !== r && s.parentNode?.removeChild(s);
		};
	});
	return Ir.set(u, d), u;
}
var Ir = /* @__PURE__ */ new WeakMap();
function Lr(e, t) {
	let n = Ir.get(e);
	return n ? (Ir.delete(e), n(t)) : Promise.resolve();
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/branches.js
var Rr = class {
	anchor;
	#e = /* @__PURE__ */ new Map();
	#t = /* @__PURE__ */ new Map();
	#n = /* @__PURE__ */ new Map();
	#r = /* @__PURE__ */ new Set();
	#i = !0;
	constructor(e, t = !0) {
		this.anchor = e, this.#i = t;
	}
	#a = (e) => {
		if (this.#e.has(e)) {
			var t = this.#e.get(e), n = this.#t.get(t);
			if (n) Fn(n), this.#r.delete(t);
			else {
				var r = this.#n.get(t);
				r && (Fn(r.effect), this.#t.set(t, r.effect), this.#n.delete(t), r.fragment.lastChild.remove(), this.anchor.before(r.fragment), n = r.effect);
			}
			for (let [t, n] of this.#e) {
				if (this.#e.delete(t), t === e) break;
				let r = this.#n.get(n);
				r && (An(r.effect), this.#n.delete(n));
			}
			for (let [e, r] of this.#t) {
				if (e === t || this.#r.has(e)) continue;
				let i = () => {
					if (Array.from(this.#e.values()).includes(e)) {
						var t = document.createDocumentFragment();
						Ln(r, t), t.append(an()), this.#n.set(e, {
							effect: r,
							fragment: t
						});
					} else An(r);
					this.#r.delete(e), this.#t.delete(e);
				};
				this.#i || !n ? (this.#r.add(e), Nn(r, i, !1)) : i();
			}
		}
	};
	#o = (e) => {
		this.#e.delete(e);
		let t = Array.from(this.#e.values());
		for (let [e, n] of this.#n) t.includes(e) || (An(n.effect), this.#n.delete(e));
	};
	ensure(e, t) {
		var n = N, r = un();
		if (t && !this.#t.has(e) && !this.#n.has(e)) {
			if (r) {
				var i = document.createDocumentFragment(), a = an();
				i.append(a), this.#n.set(e, {
					effect: En(() => t(a)),
					fragment: i
				});
			} else this.#t.set(e, En(() => t(this.anchor)));
		}
		if (this.#e.set(n, e), r) {
			for (let [t, r] of this.#t) t === e ? n.unskip_effect(r) : n.skip_effect(r);
			for (let [t, r] of this.#n) t === e ? n.unskip_effect(r.effect) : n.skip_effect(r.effect);
			n.oncommit(this.#a), n.ondiscard(this.#o);
		} else k && (this.anchor = A), this.#a(n);
	}
};
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/if.js
function q(e, t, n = !1) {
	var r;
	k && (r = A, Ne());
	var i = new Rr(e), a = n ? ne : 0;
	function o(e, t) {
		if (k) {
			var n = Ie(r);
			if (e !== parseInt(n.substring(1))) {
				var a = Fe();
				Me(a), i.anchor = a, je(!1), i.ensure(e, t), je(!0);
				return;
			}
		}
		i.ensure(e, t);
	}
	Tn(() => {
		var e = !1;
		t((t, n = 0) => {
			e = !0, o(n, t);
		}), e || o(-1, null);
	}, a);
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/each.js
function zr(e, t) {
	return t;
}
function Br(e, t, n) {
	for (var r = [], i = t.length, a, o = t.length, s = 0; s < i; s++) {
		let n = t[s];
		Nn(n, () => {
			if (a) {
				if (a.pending.delete(n), a.done.add(n), a.pending.size === 0) {
					var t = e.outrogroups;
					Vr(e, c(a.done)), t.delete(a), t.size === 0 && (e.outrogroups = null);
				}
			} else --o;
		}, !1);
	}
	if (o === 0) {
		var l = r.length === 0 && n !== null && e.pending.size === 0;
		if (l) {
			var u = n, d = u.parentNode;
			ln(d), d.append(u), e.items.clear();
		}
		Vr(e, t, !l);
	} else a = {
		pending: new Set(t),
		done: /* @__PURE__ */ new Set()
	}, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(a);
}
function Vr(e, t, n = !0) {
	var r;
	if (e.pending.size > 0) {
		r = /* @__PURE__ */ new Set();
		for (let t of e.pending.values()) for (let n of t) r.add(e.items.get(n).e);
	}
	for (var i = 0; i < t.length; i++) {
		var a = t[i];
		r?.has(a) ? (a.f |= ie, Ln(a, document.createDocumentFragment())) : An(t[i], n);
	}
}
var Hr;
function Ur(e, t, n, r, i, o = null) {
	var s = e, l = /* @__PURE__ */ new Map();
	if (t & 4) {
		var u = e;
		s = k ? Me(/* @__PURE__ */ on(u)) : u.appendChild(an());
	}
	k && Ne();
	var d = null, f = /* @__PURE__ */ bt(() => {
		var e = n();
		return a(e) ? e : e == null ? [] : c(e);
	}), p, m = /* @__PURE__ */ new Map(), h = !0;
	function g(e) {
		v.effect.f & 16384 || (v.pending.delete(e), v.fallback = d, Gr(v, p, s, t, r), d !== null && (p.length === 0 ? d.f & 33554432 ? (d.f ^= ie, qr(d, null, s)) : Fn(d) : Nn(d, () => {
			d = null;
		})));
	}
	function _(e) {
		v.pending.delete(e);
	}
	var v = {
		effect: Tn(() => {
			p = H(f);
			var e = p.length;
			let a = !1;
			k && Ie(s) === "[!" != (e === 0) && (s = Fe(), Me(s), je(!1), a = !0);
			for (var c = /* @__PURE__ */ new Set(), u = N, v = un(), y = 0; y < e; y += 1) {
				k && A.nodeType === 8 && A.data === "]" && (s = A, a = !0, je(!1));
				var b = p[y], x = r(b, y), S = h ? null : l.get(x);
				S ? (S.v && Jt(S.v, b), S.i && Jt(S.i, y), v && u.unskip_effect(S.e)) : (S = Kr(l, h ? s : Hr ??= an(), b, x, y, i, t, n), h || (S.e.f |= ie), l.set(x, S)), c.add(x);
			}
			if (e === 0 && o && !d && (h ? d = En(() => o(s)) : (d = En(() => o(Hr ??= an())), d.f |= ie)), e > c.size && ye("", "", ""), k && e > 0 && Me(Fe()), !h) {
				if (m.set(u, c), v) {
					for (let [e, t] of l) c.has(e) || u.skip_effect(t.e);
					u.oncommit(g), u.ondiscard(_);
				} else g(u);
			}
			a && je(!0), H(f);
		}),
		flags: t,
		items: l,
		pending: m,
		outrogroups: null,
		fallback: d
	};
	h = !1, k && (s = A);
}
function Wr(e) {
	for (; e !== null && !(e.f & 32);) e = e.next;
	return e;
}
function Gr(e, t, n, r, i) {
	var a = !!(r & 8), o = t.length, s = e.items, l = Wr(e.effect.first), u, d = null, f, p = [], m = [], h, g, _, v;
	if (a) for (v = 0; v < o; v += 1) h = t[v], g = i(h, v), _ = s.get(g).e, _.f & 33554432 || (_.nodes?.a?.measure(), (f ??= /* @__PURE__ */ new Set()).add(_));
	for (v = 0; v < o; v += 1) {
		if (h = t[v], g = i(h, v), _ = s.get(g).e, e.outrogroups !== null) for (let t of e.outrogroups) t.pending.delete(_), t.done.delete(_);
		if (_.f & 8192 && (Fn(_), a && (_.nodes?.a?.unfix(), (f ??= /* @__PURE__ */ new Set()).delete(_))), _.f & 33554432) {
			if (_.f ^= ie, _ === l) qr(_, null, n);
			else {
				var y = d ? d.next : l;
				_ === e.effect.last && (e.effect.last = _.prev), _.prev && (_.prev.next = _.next), _.next && (_.next.prev = _.prev), Jr(e, d, _), Jr(e, _, y), qr(_, y, n), d = _, p = [], m = [], l = Wr(d.next);
				continue;
			}
		}
		if (_ !== l) {
			if (u !== void 0 && u.has(_)) {
				if (p.length < m.length) {
					var b = m[0], x;
					d = b.prev;
					var S = p[0], C = p[p.length - 1];
					for (x = 0; x < p.length; x += 1) qr(p[x], b, n);
					for (x = 0; x < m.length; x += 1) u.delete(m[x]);
					Jr(e, S.prev, C.next), Jr(e, d, S), Jr(e, C, b), l = b, d = C, --v, p = [], m = [];
				} else u.delete(_), qr(_, l, n), Jr(e, _.prev, _.next), Jr(e, _, d === null ? e.effect.first : d.next), Jr(e, d, _), d = _;
				continue;
			}
			for (p = [], m = []; l !== null && l !== _;) (u ??= /* @__PURE__ */ new Set()).add(l), m.push(l), l = Wr(l.next);
			if (l === null) continue;
		}
		_.f & 33554432 || p.push(_), d = _, l = Wr(_.next);
	}
	if (e.outrogroups !== null) {
		for (let t of e.outrogroups) t.pending.size === 0 && (Vr(e, c(t.done)), e.outrogroups?.delete(t));
		e.outrogroups.size === 0 && (e.outrogroups = null);
	}
	if (l !== null || u !== void 0) {
		var ee = [];
		if (u !== void 0) for (_ of u) _.f & 8192 || ee.push(_);
		for (; l !== null;) !(l.f & 8192) && l !== e.fallback && ee.push(l), l = Wr(l.next);
		var w = ee.length;
		if (w > 0) {
			var te = r & 4 && o === 0 ? n : null;
			if (a) {
				for (v = 0; v < w; v += 1) ee[v].nodes?.a?.measure();
				for (v = 0; v < w; v += 1) ee[v].nodes?.a?.fix();
			}
			Br(e, ee, te);
		}
	}
	a && qe(() => {
		if (f !== void 0) for (_ of f) _.nodes?.a?.apply();
	});
}
function Kr(e, t, n, r, i, a, o, s) {
	var c = o & 1 ? o & 16 ? Kt(n) : /* @__PURE__ */ qt(n, !1, !1) : null, l = o & 2 ? Kt(i) : null;
	return {
		v: c,
		i: l,
		e: En(() => (a(t, c ?? n, l ?? i, s), () => {
			e.delete(r);
		}))
	};
}
function qr(e, t, n) {
	if (e.nodes) for (var r = e.nodes.start, i = e.nodes.end, a = t && !(t.f & 33554432) ? t.nodes.start : n; r !== null;) {
		var o = /* @__PURE__ */ sn(r);
		if (a.before(r), r === i) return;
		r = o;
	}
}
function Jr(e, t, n) {
	t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
}
function Yr(t, n, a = !1, o = !1, s = !1, c = !1) {
	var l = t, u = "";
	if (a) {
		var d = t;
		k && (l = Me(/* @__PURE__ */ on(d)));
	}
	z(() => {
		var t = V;
		if (u === (u = n() ?? "")) {
			k && Ne();
			return;
		}
		if (a && !k) {
			t.nodes = null, d.innerHTML = u, u !== "" && Tr(/* @__PURE__ */ on(d), d.lastChild);
			return;
		}
		if (t.nodes !== null && (jn(t.nodes.start, t.nodes.end), t.nodes = null), u !== "") {
			if (k) {
				for (var c = A.data, f = Ne(), p = f; f !== null && (f.nodeType !== 8 || f.data !== "");) p = f, f = /* @__PURE__ */ sn(f);
				if (f === null) throw ke(), e;
				Tr(A, p), l = Me(f);
				return;
			}
			var m = dn(o ? "svg" : s ? "math" : "template", o ? r : s ? i : void 0);
			m.innerHTML = u;
			var h = o || s ? m : m.content;
			if (Tr(/* @__PURE__ */ on(h), h.lastChild), o || s) for (; /* @__PURE__ */ on(h);) l.before(/* @__PURE__ */ on(h));
			else l.before(h);
		}
	});
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/css.js
function Xr(e, t) {
	Sn(() => {
		var n = e.getRootNode(), r = n.host ? n : n.head ?? n.ownerDocument.head;
		if (!r.querySelector("#" + t.hash)) {
			let e = dn("style");
			e.id = t.hash, e.textContent = t.code, r.appendChild(e);
		}
	});
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/actions.js
function Zr(e, t, n) {
	Sn(() => {
		var r = dr(() => t(e, n?.()) || {});
		if (n && r?.update) {
			var i = !1, a = {};
			wn(() => {
				var e = n();
				fr(e), i && Re(a, e) && (a = e, r.update(e));
			}), i = !0;
		}
		if (r?.destroy) return () => r.destroy();
	});
}
//#endregion
//#region node_modules/clsx/dist/clsx.mjs
function Qr(e) {
	var t, n, r = "";
	if (typeof e == "string" || typeof e == "number") r += e;
	else if (typeof e == "object") {
		if (Array.isArray(e)) {
			var i = e.length;
			for (t = 0; t < i; t++) e[t] && (n = Qr(e[t])) && (r && (r += " "), r += n);
		} else for (n in e) e[n] && (r && (r += " "), r += n);
	}
	return r;
}
function $r() {
	for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Qr(e)) && (r && (r += " "), r += t);
	return r;
}
//#endregion
//#region node_modules/svelte/src/internal/shared/attributes.js
function ei(e) {
	return typeof e == "object" ? $r(e) : e ?? "";
}
var ti = [..." 	\n\r\f\xA0\v﻿"];
function ni(e, t, n) {
	var r = e == null ? "" : "" + e;
	if (t && (r = r ? r + " " + t : t), n) {
		for (var i of Object.keys(n)) if (n[i]) r = r ? r + " " + i : i;
		else if (r.length) for (var a = i.length, o = 0; (o = r.indexOf(i, o)) >= 0;) {
			var s = o + a;
			(o === 0 || ti.includes(r[o - 1])) && (s === r.length || ti.includes(r[s])) ? r = (o === 0 ? "" : r.substring(0, o)) + r.substring(s + 1) : o = s;
		}
	}
	return r === "" ? null : r;
}
function ri(e, t = !1) {
	var n = t ? " !important;" : ";", r = "";
	for (var i of Object.keys(e)) {
		var a = e[i];
		a != null && a !== "" && (r += " " + i + ": " + a + n);
	}
	return r;
}
function ii(e) {
	return e[0] !== "-" || e[1] !== "-" ? e.toLowerCase() : e;
}
function ai(e, t) {
	if (t) {
		var n = "", r, i;
		if (Array.isArray(t) ? (r = t[0], i = t[1]) : r = t, e) {
			e = String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g, "").trim();
			var a = !1, o = 0, s = !1, c = [];
			r && c.push(...Object.keys(r).map(ii)), i && c.push(...Object.keys(i).map(ii));
			var l = 0, u = -1;
			let t = e.length;
			for (var d = 0; d < t; d++) {
				var f = e[d];
				if (s ? f === "/" && e[d - 1] === "*" && (s = !1) : a ? a === f && (a = !1) : f === "/" && e[d + 1] === "*" ? s = !0 : f === "\"" || f === "'" ? a = f : f === "(" ? o++ : f === ")" && o--, !s && a === !1 && o === 0) {
					if (f === ":" && u === -1) u = d;
					else if (f === ";" || d === t - 1) {
						if (u !== -1) {
							var p = ii(e.substring(l, u).trim());
							if (!c.includes(p)) {
								f !== ";" && d++;
								var m = e.substring(l, d).trim();
								n += " " + m + ";";
							}
						}
						l = d + 1, u = -1;
					}
				}
			}
		}
		return r && (n += ri(r)), i && (n += ri(i, !0)), n = n.trim(), n === "" ? null : n;
	}
	return e == null ? null : String(e);
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/class.js
function oi(e, t, n, r, i, a) {
	var o = e[fe];
	if (k || o !== n || o === void 0) {
		var s = ni(n, r, a);
		(!k || s !== e.getAttribute("class")) && (s == null ? e.removeAttribute("class") : t ? e.className = s : e.setAttribute("class", s)), e[fe] = n;
	} else if (a && i !== a) for (var c in a) {
		var l = !!a[c];
		(i == null || l !== !!i[c]) && e.classList.toggle(c, l);
	}
	return a;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/style.js
function si(e, t = {}, n, r) {
	for (var i in n) {
		var a = n[i];
		t[i] !== a && (n[i] == null ? e.style.removeProperty(i) : e.style.setProperty(i, a, r));
	}
}
function ci(e, t, n, r) {
	var i = e[pe];
	if (k || i !== t) {
		var a = ai(t, r);
		(!k || a !== e.getAttribute("style")) && (a == null ? e.removeAttribute("style") : e.style.cssText = a), e[pe] = t;
	} else r && (Array.isArray(r) ? (si(e, n?.[0], r[0]), si(e, n?.[1], r[1], "important")) : si(e, n, r));
	return r;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/attributes.js
var li = Symbol("is custom element"), ui = Symbol("is html"), di = _e ? "link" : "LINK", fi = _e ? "progress" : "PROGRESS";
function pi(e) {
	if (k) {
		var t = !1, n = () => {
			if (!t) {
				if (t = !0, e.hasAttribute("value")) {
					var n = e.value;
					J(e, "value", null), e.value = n;
				}
				if (e.hasAttribute("checked")) {
					var r = e.checked;
					J(e, "checked", null), e.checked = r;
				}
			}
		};
		e[he] = n, qe(n), ot();
	}
}
function mi(e, t) {
	var n = gi(e);
	n.value !== (n.value = t ?? void 0) && (e.value !== t || t === 0 && e.nodeName === fi) && (e.value = t ?? "");
}
function hi(e, t) {
	var n = gi(e);
	n.checked !== (n.checked = t ?? void 0) && (e.checked = t);
}
function J(e, t, n, r) {
	var i = gi(e);
	k && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === di) || i[t] !== (i[t] = n) && (t === "loading" && (e[E] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && vi(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
}
function gi(e) {
	return e[de] ??= {
		[li]: e.nodeName.includes("-"),
		[ui]: e.namespaceURI === n
	};
}
var _i = /* @__PURE__ */ new Map();
function vi(e) {
	var t = e.getAttribute("is") || e.nodeName, n = _i.get(t);
	if (n) return n;
	_i.set(t, n = []);
	for (var r, i = e, a = Element.prototype; a !== i;) {
		for (var o in r = f(i), r) r[o].set && o !== "innerHTML" && o !== "textContent" && o !== "innerText" && n.push(o);
		i = h(i);
	}
	return n;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/input.js
function yi(e, t, n = t) {
	var r = /* @__PURE__ */ new WeakSet();
	ct(e, "input", async (i) => {
		var a = i ? e.defaultValue : e.value;
		if (a = bi(e) ? xi(a) : a, n(a), N !== null && r.add(N), await cr(), a !== (a = t())) {
			var o = e.selectionStart, s = e.selectionEnd, c = e.value.length;
			if (e.value = a ?? "", s !== null) {
				var l = e.value.length;
				o === s && s === c && l > c ? (e.selectionStart = l, e.selectionEnd = l) : (e.selectionStart = o, e.selectionEnd = Math.min(s, l));
			}
		}
	}), (k && e.defaultValue !== e.value || dr(t) == null && e.value) && (n(bi(e) ? xi(e.value) : e.value), N !== null && r.add(N)), wn(() => {
		var n = t();
		if (e === document.activeElement) {
			var i = N;
			if (r.has(i)) return;
		}
		bi(e) && n === xi(e.value) || e.type === "date" && !n && !e.value || n !== e.value && (e.value = n ?? "");
	});
}
function bi(e) {
	var t = e.type;
	return t === "number" || t === "range";
}
function xi(e) {
	return e === "" ? null : +e;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
function Si(e, t) {
	return e === t || e?.[le] === t;
}
function Ci(e = {}, t, n, r) {
	var i = Be.r, a = V;
	return Sn(() => {
		var o, s;
		return wn(() => {
			o = s, s = r?.() || [], dr(() => {
				Si(n(...s), e) || (t(e, ...s), o && Si(n(...o), e) && t(null, ...o));
			});
		}), () => {
			let r = a;
			for (; r !== i && r.parent !== null && r.parent.f & 33554432;) r = r.parent;
			let o = () => {
				s && Si(n(...s), e) && t(null, ...s);
			}, c = r.teardown;
			r.teardown = () => {
				o(), c?.();
			};
		};
	}), e;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/props.js
function Y(e, t, n, r) {
	var i = !0, a = !!(n & 8), o = !!(n & 16), s = r, c = !0, l = void 0, u = () => o && i ? (l ??= /* @__PURE__ */ _t(r), H(l)) : (c && (c = !1, s = o ? dr(r) : r), s);
	let f;
	if (a) {
		var p = le in e || ue in e;
		f = d(e, t)?.set ?? (p && t in e ? (n) => e[t] = n : void 0);
	}
	var m, h = !1;
	a ? [m, h] = rt(() => e[t]) : m = e[t], m === void 0 && r !== void 0 && (m = u(), f && (i && Ce(t), f(m)));
	var g = i ? () => {
		var n = e[t];
		return n === void 0 ? u() : (c = !0, n);
	} : () => {
		var n = e[t];
		return n !== void 0 && (s = void 0), n === void 0 ? s : n;
	};
	if (i && !(n & 4)) return g;
	if (f) {
		var _ = e.$$legacy;
		return (function(e, t) {
			return arguments.length > 0 ? ((!i || !t || _ || h) && f(t ? g() : e), e) : g();
		});
	}
	var v = !1, y = (n & 1 ? _t : bt)(() => (v = !1, g()));
	a && H(y);
	var b = V;
	return (function(e, t) {
		if (arguments.length > 0) {
			let n = t ? H(y) : i && a ? Qt(e) : e;
			return I(y, n), v = !0, s !== void 0 && (s = n), e;
		}
		return Bn && v || b.f & 16384 ? y.v : H(y);
	});
}
//#endregion
//#region node_modules/svelte/src/legacy/legacy-client.js
function wi(e) {
	return new Ti(e);
}
var Ti = class {
	#e;
	#t;
	constructor(e) {
		var t = /* @__PURE__ */ new Map(), n = (e, n) => {
			var r = /* @__PURE__ */ qt(n, !1, !1);
			return t.set(e, r), r;
		};
		let r = new Proxy({
			...e.props || {},
			$$events: {}
		}, {
			get(e, r) {
				return H(t.get(r) ?? n(r, Reflect.get(e, r)));
			},
			has(e, r) {
				return r === ue || (H(t.get(r) ?? n(r, Reflect.get(e, r))), Reflect.has(e, r));
			},
			set(e, r, i) {
				return I(t.get(r) ?? n(r, i), i), Reflect.set(e, r, i);
			}
		});
		this.#t = (e.hydrate ? Nr : Mr)(e.component, {
			target: e.target,
			anchor: e.anchor,
			props: r,
			context: e.context,
			intro: e.intro ?? !1,
			recover: e.recover,
			transformError: e.transformError
		}), (!e?.props?.$$host || e.sync === !1) && P(), this.#e = r.$$events;
		for (let e of Object.keys(this.#t)) e !== "$set" && e !== "$destroy" && e !== "$on" && u(this, e, {
			get() {
				return this.#t[e];
			},
			set(t) {
				this.#t[e] = t;
			},
			enumerable: !0
		});
		this.#t.$set = (e) => {
			Object.assign(r, e);
		}, this.#t.$destroy = () => {
			Lr(this.#t);
		};
	}
	$set(e) {
		this.#t.$set(e);
	}
	$on(e, t) {
		this.#e[e] = this.#e[e] || [];
		let n = (...e) => t.call(this, ...e);
		return this.#e[e].push(n), () => {
			this.#e[e] = this.#e[e].filter((e) => e !== n);
		};
	}
	$destroy() {
		this.#t.$destroy();
	}
}, Ei;
typeof HTMLElement == "function" && (Ei = class extends HTMLElement {
	$$ctor;
	$$s;
	$$c;
	$$cn = !1;
	$$d = {};
	$$r = !1;
	$$p_d = {};
	$$l = {};
	$$l_u = /* @__PURE__ */ new Map();
	$$me;
	$$shadowRoot = null;
	constructor(e, t, n) {
		super(), this.$$ctor = e, this.$$s = t, n && (this.$$shadowRoot = this.attachShadow(n));
	}
	addEventListener(e, t, n) {
		if (this.$$l[e] = this.$$l[e] || [], this.$$l[e].push(t), this.$$c) {
			let n = this.$$c.$on(e, t);
			this.$$l_u.set(t, n);
		}
		super.addEventListener(e, t, n);
	}
	removeEventListener(e, t, n) {
		if (super.removeEventListener(e, t, n), this.$$c) {
			let e = this.$$l_u.get(t);
			e && (e(), this.$$l_u.delete(t));
		}
	}
	async connectedCallback() {
		if (this.$$cn = !0, !this.$$c) {
			if (await Promise.resolve(), !this.$$cn || this.$$c) return;
			function e(e) {
				return (t) => {
					let n = dn("slot");
					e !== "default" && (n.name = e), G(t, n);
				};
			}
			let t = {}, n = Oi(this);
			for (let r of this.$$s) r in n && (r === "default" && !this.$$d.children ? (this.$$d.children = e(r), t.default = !0) : t[r] = e(r));
			for (let e of this.attributes) {
				let t = this.$$g_p(e.name);
				t in this.$$d || (this.$$d[t] = Di(t, e.value, this.$$p_d, "toProp"));
			}
			for (let e in this.$$p_d) !(e in this.$$d) && this[e] !== void 0 && (this.$$d[e] = this[e], delete this[e]);
			this.$$c = wi({
				component: this.$$ctor,
				target: this.$$shadowRoot || this,
				props: {
					...this.$$d,
					$$slots: t,
					$$host: this
				}
			}), this.$$me = bn(() => {
				wn(() => {
					this.$$r = !0;
					for (let e of l(this.$$c)) {
						if (!this.$$p_d[e]?.reflect) continue;
						this.$$d[e] = this.$$c[e];
						let t = Di(e, this.$$d[e], this.$$p_d, "toAttribute");
						t == null ? this.removeAttribute(this.$$p_d[e].attribute || e) : this.setAttribute(this.$$p_d[e].attribute || e, t);
					}
					this.$$r = !1;
				});
			});
			for (let e in this.$$l) for (let t of this.$$l[e]) {
				let n = this.$$c.$on(e, t);
				this.$$l_u.set(t, n);
			}
			this.$$l = {};
		}
	}
	attributeChangedCallback(e, t, n) {
		this.$$r || (e = this.$$g_p(e), this.$$d[e] = Di(e, n, this.$$p_d, "toProp"), this.$$c?.$set({ [e]: this.$$d[e] }));
	}
	disconnectedCallback() {
		this.$$cn = !1, Promise.resolve().then(() => {
			!this.$$cn && this.$$c && (this.$$c.$destroy(), this.$$me(), this.$$c = void 0);
		});
	}
	$$g_p(e) {
		return l(this.$$p_d).find((t) => this.$$p_d[t].attribute === e || !this.$$p_d[t].attribute && t.toLowerCase() === e) || e;
	}
});
function Di(e, t, n, r) {
	let i = n[e]?.type;
	if (t = i === "Boolean" && typeof t != "boolean" ? t != null : t, !r || !n[e]) return t;
	if (r === "toAttribute") switch (i) {
		case "Object":
		case "Array": return t == null ? null : JSON.stringify(t);
		case "Boolean": return t ? "" : null;
		case "Number": return t ?? null;
		default: return t;
	}
	else switch (i) {
		case "Object":
		case "Array": return t && JSON.parse(t);
		case "Boolean": return t;
		case "Number": return t == null ? t : +t;
		default: return t;
	}
}
function Oi(e) {
	let t = {};
	return e.childNodes.forEach((e) => {
		t[e.slot || "default"] = !0;
	}), t;
}
function ki(e, t, n, r, i, a) {
	let o = class extends Ei {
		constructor() {
			super(e, n, i), this.$$p_d = t;
		}
		static get observedAttributes() {
			return l(t).map((e) => (t[e].attribute || e).toLowerCase());
		}
	};
	return l(t).forEach((e) => {
		u(o.prototype, e, {
			get() {
				return this.$$c && e in this.$$c ? this.$$c[e] : this.$$d[e];
			},
			set(n) {
				n = Di(e, n, t), this.$$d[e] = n;
				var r = this.$$c;
				r && (d(r, e)?.get ? r[e] = n : r.$set({ [e]: n }));
			}
		});
	}), r.forEach((e) => {
		u(o.prototype, e, { get() {
			return this.$$c?.[e];
		} });
	}), a && (o = a(o)), e.element = o, o;
}
//#endregion
//#region src/lib/api/client.ts
var Ai = class extends Error {
	status;
	code;
	constructor(e, t, n) {
		super(n), this.status = e, this.code = t;
	}
};
async function ji(e, t, n = fetch) {
	let r = typeof FormData < "u" && t?.body instanceof FormData, i = await n(e, {
		...t,
		headers: r ? t?.headers ?? {} : {
			"Content-Type": "application/json",
			...t?.headers ?? {}
		}
	});
	if (!i.ok) {
		let e = await i.json().catch(() => null);
		throw new Ai(i.status, e?.error?.code ?? "unknown_error", e?.error?.message ?? i.statusText);
	}
	return i;
}
//#endregion
//#region src/lib/api/records.ts
var Mi = { and: [] };
function Ni(e) {
	return "col" in e;
}
function Pi(e) {
	return "and" in e;
}
function Fi(e) {
	return "or" in e;
}
function Ii(e) {
	return Pi(e) ? e.and.length === 0 : Fi(e) ? e.or.length === 0 : !Ni(e);
}
function Li(e, t) {
	return Ii(e) ? t : Ii(t) ? e : { and: [e, t] };
}
function Ri(e) {
	return e.map((e) => e.desc ? `-${e.column}` : e.column).join(",");
}
function zi(e) {
	return JSON.stringify(e);
}
function Bi(e) {
	return JSON.stringify(e);
}
function Vi(e) {
	return e.join(",");
}
async function Hi(e, t = {}, n = fetch) {
	let r = new URLSearchParams();
	t.view && r.set("view", t.view), t.limit && r.set("limit", String(t.limit)), t.offset && r.set("offset", String(t.offset)), t.sort !== void 0 && r.set("sort", Ri(t.sort)), t.where !== void 0 && r.set("where", zi(t.where)), t.groupBy !== void 0 && r.set("group_by", Vi(t.groupBy)), t.summary !== void 0 && r.set("summary", Bi(t.summary));
	let i = r.toString();
	return (await ji(`/api/v1/tables/${e}/records${i ? `?${i}` : ""}`, void 0, n)).json();
}
async function Ui(e, t, n, r = fetch) {
	return (await ji(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}`, {
		method: "PATCH",
		body: JSON.stringify(n)
	}, r)).json();
}
async function Wi(e, t, n, r, i = fetch) {
	await ji(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}/links/${n}`, {
		method: "POST",
		body: JSON.stringify({ target_id: r })
	}, i);
}
async function Gi(e, t, n, r, i = fetch) {
	await ji(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}/links/${n}/${encodeURIComponent(String(r))}`, { method: "DELETE" }, i);
}
//#endregion
//#region src/lib/i18n/locale.svelte.ts
var Ki = ["de", "en"], qi = "illusiondb-locale", Ji = "de", Yi = "illusiondb:locale-change";
function Xi(e) {
	return Ki.includes(e ?? "");
}
function Zi() {
	if (typeof localStorage > "u") return Ji;
	let e = localStorage.getItem(qi);
	return Xi(e) ? e : Ji;
}
function Qi(e) {
	typeof document < "u" && document.documentElement.setAttribute("lang", e);
}
var $i = Qt({ current: Ji });
typeof window < "u" && ($i.current = Zi(), Qi($i.current), window.addEventListener(Yi, (e) => {
	let t = e.detail;
	Xi(t) && ($i.current = t);
}));
//#endregion
//#region src/lib/i18n/translations/de.ts
var ea = {
	common: {
		username: "Benutzername",
		password: "Passwort",
		email: "E-Mail",
		name: "Name",
		role: "Rolle",
		createdAt: "Erstellt am",
		updatedAt: "Aktualisiert am",
		pleaseChoose: "Bitte wählen",
		close: "Schließen",
		cancel: "Abbrechen",
		save: "Speichern",
		saving: "Speichert…",
		edit: "Bearbeiten",
		delete: "Löschen",
		deleting: "Löscht…",
		create: "Anlegen",
		creating: "Anlegen…",
		back: "Zurück",
		next: "Weiter",
		remove: "Entfernen",
		errorLoading: "Fehler beim Laden",
		noResults: "Keine Treffer",
		search: "Suchen…",
		refineSearch: "Weitere Treffer – Suche eingrenzen",
		creatingAlt: "Legt an…",
		allDataSources: "Alle Data Sources",
		rangeOfTotal: "{{from}}–{{to}} von {{total}}",
		rangeEmpty: "0 von 0",
		yes: "Ja",
		no: "Nein"
	},
	auth: {
		login: {
			subtitle: "Bitte melde dich an.",
			submit: "Anmelden",
			submitting: "Anmelden…"
		},
		setup: {
			subtitle: "Willkommen! Lege den ersten Administrator-Account an.",
			passwordRepeat: "Passwort wiederholen",
			passwordMismatch: "Die Passwörter stimmen nicht überein.",
			submit: "Administrator anlegen",
			submitting: "Einrichten…"
		}
	},
	nav: {
		connections: "Verbindungen",
		newSqliteDatabase: "Neue SQLite-Datenbank anlegen",
		loading: "Lädt…",
		noTables: "Keine Tabellen",
		noViews: "Keine Ansichten",
		settings: "Einstellungen",
		logout: "Abmelden",
		openMenu: "Menü öffnen",
		collapseSidebar: "Menüleiste einklappen",
		expandSidebar: "Menüleiste ausklappen",
		expand: "{{name}} aufklappen",
		collapse: "{{name}} zuklappen",
		viewOptionsFor: "Optionen für Ansicht {{name}}",
		viewSettings: "Einstellungen",
		viewSettingsTitle: "View-Einstellungen: {{name}}",
		junctionTableChip: "Admin",
		junctionTableHint: "Nur für Admins sichtbar — Junction-Tabelle eines Links-Felds"
	},
	theme: {
		light: "Hell",
		dark: "Dunkel",
		system: "Systemstandard"
	},
	language: {
		label: "Sprache",
		de: "Deutsch",
		en: "Englisch"
	},
	settings: {
		title: "Einstellungen",
		tabs: {
			dataSources: "Data Sources",
			apiDocs: "API-Dokumentation",
			auditLog: "Audit Log",
			files: "Dateien",
			users: "Benutzer",
			groups: "Gruppen",
			scripts: "Skripte",
			documentTemplates: "Dokumenten-Templates",
			myAccount: "Mein Konto"
		},
		users: {
			subtitle: "Alle Benutzerkonten dieser Instanz",
			newUser: "Neuer Benutzer",
			confirmDelete: "Benutzer \"{{email}}\" wirklich löschen?",
			editUser: "Benutzer bearbeiten",
			resetPassword: "Passwort zurücksetzen",
			newPasswordPlaceholder: "Neues Passwort",
			setting: "Setzt…",
			set: "Setzen",
			loadingGroupMembership: "Lädt Gruppenzugehörigkeit…",
			memberOf: "Mitglied von: {{groups}}",
			managedUnderGroups: "— verwaltet unter Einstellungen → Gruppen"
		},
		account: {
			accountSection: "Konto",
			changeEmail: "E-Mail ändern",
			changePasswordSection: "Passwort ändern",
			passwordChanged: "Passwort erfolgreich geändert.",
			currentPassword: "Aktuelles Passwort",
			newPassword: "Neues Passwort",
			changing: "Ändert…",
			changePassword: "Passwort ändern",
			apiTokens: "API-Tokens",
			tokenCreatedNotice: "Token \"{{name}}\" angelegt — wird nur jetzt angezeigt, danach nicht mehr abrufbar:",
			hide: "Ausblenden",
			tokenNamePlaceholder: "z.B. n8n-Workflow",
			createToken: "Token anlegen",
			noTokens: "Noch keine API-Tokens angelegt.",
			lastUsed: "Zuletzt verwendet",
			confirmDeleteToken: "API-Token \"{{name}}\" wirklich löschen?"
		},
		datasources: {
			subtitle: "Verbundene Datenbanken und ihr Sync-Stand",
			newSqliteDatabase: "Neue SQLite-Datenbank",
			newDataSource: "Neue Data Source",
			noneYet: "Noch keine Data Source angelegt.",
			createFirst: "Erste Verbindung anlegen",
			type: "Typ",
			connection: "Verbindung",
			status: "Status",
			lastSync: "Letzter Sync",
			syncing: "Syncing…",
			sync: "Sync",
			confirmDelete: "Data Source \"{{name}}\" wirklich entfernen? Alle zugehörigen Tabellen, Ansichten, Berechtigungen, Webhooks und Anhänge in IllusionDB werden unwiderruflich mitgelöscht. Die externe Datenbank selbst bleibt unverändert.",
			namePlaceholder: "Produktions-CRM",
			filePath: "Datei-Pfad",
			database: "Datenbank",
			user: "Benutzer",
			sslMode: "SSL-Modus"
		},
		files: {
			subtitle: "Alle hochgeladenen Dateien über alle Data Sources hinweg",
			galleryView: "Galerie",
			listView: "Liste",
			allTables: "Alle Tabellen",
			allColumns: "Alle Spalten",
			allFileTypes: "Alle Dateitypen",
			filenamePlaceholder: "Dateiname…",
			filename: "Dateiname",
			tableColumn: "Tabelle.Spalte",
			size: "Größe",
			uploaded: "Hochgeladen",
			noFiles: "Keine Dateien gefunden.",
			confirmDelete: "Datei \"{{name}}\" wirklich löschen?"
		},
		auditLog: {
			subtitle: "Schema-Änderungen (Tabelle/Spalte anlegen/löschen) über alle Data Sources hinweg",
			allActions: "Alle Aktionen",
			timestamp: "Zeitpunkt",
			action: "Aktion",
			target: "Ziel",
			actor: "Akteur",
			details: "Details",
			noEntries: "Keine Einträge gefunden.",
			actionCreateTable: "Tabelle angelegt",
			actionAddColumn: "Spalte hinzugefügt",
			actionDropColumn: "Spalte gelöscht"
		},
		groups: {
			subtitle: "Tabellen-Berechtigungen als Bündel für mehrere Nutzer auf einmal",
			newGroup: "Neue Gruppe",
			noneYet: "Noch keine Gruppe angelegt.",
			createFirst: "Erste Gruppe anlegen",
			members: "Mitglieder",
			confirmDelete: "Gruppe \"{{name}}\" wirklich löschen?",
			namePlaceholder: "Vertrieb",
			editGroup: "Gruppe bearbeiten",
			noViewers: "Keine Viewer-Konten vorhanden.",
			saveMembers: "Mitglieder speichern"
		},
		scripts: {
			subtitle: "JavaScript-Skripte (goja) für eigene HTTP-Endpunkte und Event-Hooks",
			newScript: "Neues Skript",
			noneYet: "Noch kein Skript angelegt.",
			createFirst: "Erstes Skript anlegen",
			editScript: "Skript bearbeiten",
			confirmDelete: "Skript \"{{name}}\" wirklich löschen? Zugehörige Endpoints/Hooks werden mitgelöscht.",
			namePlaceholder: "z. B. hello-endpoint",
			codePlaceholder: "// Custom Endpoint: request/response verfügbar\n// Hook: event verfügbar\n// Beide: illusiondb.* und log(...)\n// Code läuft in einer Funktion -- return <wert> liefert das Ergebnis,\n// ohne return ist das Ergebnis undefined.\nreturn { ok: true };",
			enabled: "Aktiviert",
			code: "Code",
			endpointsTitle: "Custom Endpoints",
			endpointsSubtitle: "Erreichbar unter /api/v1/scripts/<pfad>, sofort und ohne Neustart",
			newEndpoint: "Neuer Endpoint",
			editEndpoint: "Endpoint bearbeiten",
			noneEndpointsYet: "Noch kein Endpoint registriert.",
			method: "Methode",
			path: "Pfad",
			pathPlaceholder: "/hello oder /users/:id",
			pathHint: ":name fängt ein Segment ein, ein abschließendes * den ganzen Rest. Bei Überlappung gewinnt der spezifischere Pfad (wörtlich > :name > *), bei Gleichstand der zuerst angelegte.",
			authMode: "Auth-Modus",
			authPublic: "Öffentlich",
			authAuthenticated: "Angemeldet",
			confirmDeleteEndpoint: "Endpoint \"{{method}} {{path}}\" wirklich löschen?",
			hooksTitle: "Event-Hooks",
			hooksSubtitle: "Läuft im Hintergrund nach einem Record-Write, blockiert den Request nicht",
			newHook: "Neuer Hook",
			editHook: "Hook bearbeiten",
			noneHooksYet: "Noch kein Hook gebunden.",
			event: "Ereignis",
			table: "Tabelle",
			allTables: "Alle Tabellen",
			position: "Position",
			confirmDeleteHook: "Hook wirklich löschen?",
			script: "Skript",
			selectScript: "Skript wählen…",
			noScriptsForBinding: "Erst ein Skript anlegen, um einen Endpoint/Hook zu binden.",
			testRun: "Testlauf",
			running: "Führt aus…",
			testRunHint: "Führt den aktuellen Code (auch ungespeichert) wirklich aus -- illusiondb.* hat vollen Zugriff, kein Sandbox-Dry-Run.",
			testRunLogs: "Konsole",
			testRunNoLogs: "Keine log(...)-Ausgabe.",
			testRunReturnValue: "Rückgabewert",
			testRunResponse: "Antwort",
			testRunError: "Fehler",
			testRunResultPanel: "Ergebnis",
			showOutput: "Ausgabe einblenden",
			hideOutput: "Ausgabe ausblenden",
			testRunPlaceholder: "Noch kein Testlauf.",
			testRunNoResult: "Kein Rückgabewert, keine Antwort.",
			apiSnippets: "illusiondb.*-API",
			download: "Download",
			import: "Importieren",
			importInvalidFile: "Die Datei konnte nicht gelesen werden.",
			importDropTitle: "Skript importieren",
			importDropHint: "Datei hierher ziehen oder klicken zum Auswählen",
			importDropHintSub: "Nur .js-Dateien"
		},
		documentTemplates: {
			subtitle: "Twig-Templates, die einen Datensatz als PDF/PNG/JPG rendern",
			newTemplate: "Neues Template",
			noneYet: "Noch kein Template angelegt.",
			createFirst: "Erstes Template anlegen",
			noTablesYet: "Erst eine Tabelle anlegen, bevor ein Dokumenten-Template erstellt werden kann.",
			editTemplate: "Template bearbeiten",
			confirmDelete: "Template \"{{name}}\" wirklich löschen?",
			namePlaceholder: "z. B. Rechnung",
			table: "Tabelle",
			visibility: "Sichtbarkeit",
			public: "Öffentlich",
			private: "Geschützt",
			isPublic: "Öffentlich abrufbar (ohne Bearer-Token)",
			isPublicHint: "Geschützte Templates verlangen beim Abruf über den Dokumenten-Endpunkt einen gültigen API-Token (Einstellungen → Mein Konto).",
			content: "Template (HTML/Twig)",
			contentPlaceholder: "<h1>Rechnung fuer {{ name }}</h1>\n<p>Betrag: {{ amount }} EUR</p>",
			fieldTags: "Felder der Tabelle",
			noFieldsYet: "Keine Felder gefunden.",
			testGenerate: "Testlauf",
			testGenerateHint: "Rendert das gespeicherte Template gegen einen ausgewählten Datensatz.",
			sampleRecord: "Datensatz",
			format: "Format",
			generate: "Generieren",
			generating: "Generiert…"
		},
		datasourceDetail: {
			downloadSqlite: "Datenbank herunterladen",
			exportSchema: "Verbindungseinstellungen exportieren",
			importSchema: "Verbindungseinstellungen importieren",
			importSchemaHint: "JSON-Datei wählen, die zuvor über „Verbindungseinstellungen exportieren\" erzeugt wurde. Tabellen/Spalten müssen bereits existieren (per Sync) -- der Import legt keine neuen Datenbank-Spalten an, nur Formeln/Lookups/Rollups/Links/Dateifelder, Anzeige-Einstellungen und gespeicherte Ansichten.",
			importSchemaInvalidJson: "Die Datei enthält kein gültiges JSON.",
			importSchemaJsonOnly: "Nur .json-Dateien",
			importSchemaSummary: "{{matched}} Tabelle(n) zugeordnet, {{skipped}} übersprungen. {{created}} Spalte(n) neu angelegt, {{updated}} aktualisiert. {{viewsCreated}} Ansicht(en) neu angelegt, {{viewsUpdated}} aktualisiert.",
			sqlEditor: "SQL-Terminal",
			importCsv: "CSV importieren",
			importSql: "SQL importieren",
			newTable: "Neue Tabelle",
			noTablesYet: "Noch keine Tabellen bekannt.",
			hintBefore: "Auf der",
			hintLinkText: "Übersicht",
			hintAfter: "einmal „Sync\" ausführen.",
			schema: "Schema",
			table: "Tabelle",
			columns: "Spalten",
			lastSynced: "Zuletzt synchronisiert",
			webhooks: "Webhooks",
			manageWebhooks: "Webhooks verwalten",
			noWebhooks: "Noch kein Webhook für diese Verbindung eingerichtet.",
			webhooksCount: "{{count}} Webhook(s) eingerichtet.",
			createTableTitle: "Neue Tabelle anlegen",
			tableName: "Tabellenname",
			tableNamePlaceholder: "kunden",
			pkHintBefore: "Jede neue Tabelle bekommt automatisch eine UUID-Primärschlüsselspalte",
			pkHintAfter: "— nicht hier angeben.",
			columnNamePlaceholder: "Spaltenname",
			remove: "Entfernen",
			addColumn: "+ Spalte",
			createTable: "Tabelle anlegen"
		}
	},
	formats: {
		fieldType: {
			longText: "Langtext",
			number: "Zahl",
			decimal: "Dezimalzahl",
			boolean: "Wahrheitswert",
			date: "Datum",
			datetime: "Datum & Zeit",
			uuid: "UUID",
			json: "JSON",
			text: "Text",
			links: "Verknüpfung",
			attachment: "Anhang"
		},
		dateFormatName: {
			iso: "ISO",
			de: "Deutsch",
			us: "US",
			gb: "GB",
			long: "Ausgeschrieben"
		},
		timeFormatName: {
			"24h": "24-Stunden",
			"12h": "12-Stunden"
		},
		numberStyleName: {
			plain: "Standard",
			currency: "Währung",
			percent: "Prozent",
			temperature: "Temperatur"
		}
	},
	calendarView: {
		today: "Heute",
		previous: "Zurück",
		next: "Weiter",
		day: "Tag",
		week: "Woche",
		month: "Monat",
		year: "Jahr",
		notConfigured: "Von- und Bis-Feld noch nicht konfiguriert. In den View-Einstellungen einrichten."
	},
	documentsView: {
		noTemplateConfigured: "Kein Dokumenten-Template ausgewählt. In den View-Einstellungen konfigurieren.",
		generateAndDownload: "Generieren & herunterladen",
		generating: "Wird generiert…"
	},
	dataGrid: {
		columnOptionsFor: "Optionen für {{name}}",
		columnOptions: "Spaltenoptionen",
		resizeColumnFor: "Breite von {{name}} ändern",
		addField: "Neues Feld hinzufügen",
		displayColumn: "Anzeigespalte",
		openRecord: "Datensatz öffnen",
		loadingMoreRows: "Lädt weitere Zeilen…",
		endOfList: "– Ende der Liste –",
		defaultValue: "Default: {{value}}",
		automatic: "automatisch",
		newRow: "Neue Zeile",
		editSummaryFor: "Zusammenfassung für {{name}} bearbeiten",
		editSummary: "Zusammenfassung bearbeiten",
		noRows: "Keine Zeilen.",
		summary: "Zusammenfassung",
		column: "Spalte",
		unpinDisplay: "Anzeigefeld entfernen",
		pinDisplay: "Als Anzeigefeld setzen",
		hideInView: "In dieser Ansicht ausblenden",
		editField: "Feld bearbeiten",
		fieldName: "Feldname",
		physicalNameBefore: "Physischer Spaltenname:",
		physicalNameAfter: "-- leer lassen, um den Override zu entfernen.",
		formula: "Formel",
		fieldType: "Feldtyp",
		uiTypeOverrideHint: "Überschreibt die automatisch erkannte Darstellung -- z.B. um bei SQLite (kein natives Datum) trotzdem einen Datums-/Zeit-Picker zu erzwingen, oder um einer Formelspalte eine Zahlenformatierung zu ermöglichen.",
		originalUnformatted: "Original (unformatiert)",
		dateFormat: "Datumsformat",
		timeFormat: "Uhrzeitformat",
		style: "Stil",
		decimals: "Nachkommastellen",
		thousandsSeparator: "Tausendertrennzeichen",
		currency: "Währung",
		unit: "Einheit",
		chooseOtherFormat: "Anderes Format wählen",
		loadingValues: "Werte werden geladen…",
		value: "Wert",
		customColor: "Eigene Farbe",
		chooseCustomColor: "Eigene Farbe wählen",
		removeRow: "Zeile entfernen",
		reorderValue: "Wert verschieben",
		truncatedValues: "Nur die ersten {{count}} Werte übernommen — es gibt weitere.",
		addValue: "+ Wert",
		label: "Beschriftung",
		buttonLabelPlaceholder: "z.B. Rechnung öffnen",
		buttonFormulaHint: "Die Formel liefert das Klickziel (eine URL) -- der Button zeigt immer diesen festen Text, nicht das Formelergebnis.",
		target: "Ziel",
		newTab: "Neuer Tab",
		sameTab: "Gleicher Tab",
		plainText: "Normaler Text",
		labelFormat: "Label (Werte + Farben)",
		tagsFormat: "Tags (kommagetrennt)",
		emailFormat: "E-Mail-Adresse (Link)",
		phoneFormat: "Telefonnummer (Link)",
		urlFormat: "URL (Link)",
		colorFormat: "Farbe (Hexwert)",
		buttonFormat: "Button (feste Beschriftung, Formel als Klickziel)",
		numberFormat: "Zahl",
		dataSizeFormat: "Datengröße",
		durationFormat: "Zeit",
		emptyGroupLabel: "(leer)",
		summaryNone: "Keine",
		summarySum: "Summe",
		summaryCount: "Anzahl",
		summaryAvg: "Durchschnitt",
		summaryMin: "Minimum",
		summaryMax: "Maximum",
		rowCount: {
			one: "Zeile",
			other: "Zeilen"
		},
		linksEntryCount: {
			one: "Eintrag",
			other: "Einträge"
		}
	},
	recordForm: {
		record: "Datensatz",
		noPrimaryKey: "Diese Tabelle hat keinen eindeutigen Primärschlüssel und kann nicht als Formular geöffnet werden.",
		notFound: "Datensatz wurde nicht gefunden -- möglicherweise inzwischen gelöscht.",
		removeLink: "Verknüpfung zu {{label}} entfernen",
		open: "Öffnen",
		editMarkdown: "Markdown bearbeiten…"
	},
	tablePage: {
		tables: "Tabellen",
		columns: "Spalten",
		exportCsv: "CSV exportieren",
		confirmDeleteView: "Ansicht \"{{name}}\" wirklich löschen?",
		confirmDeleteRow: "Diese Zeile wirklich löschen?",
		confirmDropColumn: "Spalte \"{{name}}\" wirklich löschen? Das ändert das Schema der externen Datenbank dauerhaft.",
		readOnlyNoPk: "Diese Tabelle hat keinen oder einen zusammengesetzten Primärschlüssel — Zeilen anlegen, bearbeiten und löschen ist in dieser Version nicht möglich.",
		readOnlyViewer: "Du hast nur Lesezugriff auf diese Tabelle — Zeilen anlegen, bearbeiten und löschen ist nicht möglich.",
		deleteView: "Ansicht löschen",
		deleteViewFor: "Ansicht {{name}} löschen",
		saveViewShort: "+ Ansicht speichern",
		filter: "Filter",
		reset: "Zurücksetzen",
		group: "Gruppieren",
		searchPlaceholder: "Suchen…",
		loadedOfTotal: "{{loaded}} von {{total}} geladen",
		openApiDocs: "API-Dokumentation öffnen",
		openWebhooksForTable: "Webhooks für diese Tabelle öffnen",
		openSqlEditor: "SQL-Terminal öffnen",
		openTableSchema: "SQL-Schema anzeigen",
		createRow: "Zeile anlegen",
		apply: "Anwenden",
		noGroupLevels: "Noch keine Gruppierungsebene gewählt -- Zeilen werden ungruppiert angezeigt.",
		level: "Ebene {{n}}",
		moveLevelUp: "Ebene {{n}} nach oben verschieben",
		moveLevelDown: "Ebene {{n}} nach unten verschieben",
		addLevel: "+ Ebene hinzufügen",
		sort: "Sortieren",
		sortNone: "(keine Sortierung)",
		sortAscending: "Aufsteigend",
		sortDescending: "Absteigend",
		saveViewTitle: "Ansicht speichern",
		saveViewHint: "Speichert den aktuellen Filter, die Sortierung, die Seitengröße und die Zusammenfassungszeile als neue Ansicht.",
		saveViewNamePlaceholder: "z.B. Offene Bestellungen",
		manageColumnsTitle: "Spalten verwalten",
		viewScopeHint: "Sichtbarkeit und Reihenfolge unten gelten nur für die aktive Ansicht",
		moveColumn: "{{name}} verschieben",
		showInView: "{{name}} in dieser Ansicht anzeigen",
		tabPhysical: "Spalte",
		tabFormula: "Formel",
		tabLookup: "Lookup",
		tabRollup: "Rollup",
		tabLinks: "Links",
		tabForeignKey: "Verweis",
		tabAttachment: "Datei",
		tabAutoNumber: "Auto-Nummer",
		columnName: "Spaltenname",
		type: "Typ",
		addColumnHint: "Ändert das Schema der externen Datenbank (neue Spalte ist nullable).",
		autoNumberHint: "Vergibt automatisch fortlaufende Nummern (1, 2, 3, …). Bestehende Zeilen werden beim Anlegen einmalig befüllt.",
		foreignKeyHint: "Legt eine 1:n-Beziehung an (Verweis auf den Primärschlüssel der Zieltabelle) — nicht durch einen echten Datenbank-Constraint erzwungen. Darauf lassen sich anschließend Lookup- und Rollup-Felder aufbauen.",
		adding: "Fügt hinzu…",
		add: "Hinzufügen",
		expression: "Ausdruck",
		formulaPlaceholderExample: "IF(status == \"shipped\", \"Versandt\", \"Offen\")",
		fkColumn: "FK-Spalte",
		choose: "— wählen —",
		noMatchingColumn: "Keine passende Spalte vorhanden.",
		targetColumn: "Zielspalte",
		childTable: "Kind-Tabelle",
		fkBackToTable: "FK zurück auf diese Tabelle",
		columnToAggregate: "Zu aggregierende Spalte",
		function: "Funktion",
		columnNameHere: "Spaltenname (hier)",
		targetTable: "Zieltabelle",
		columnNameOnTarget: "Spaltenname (auf der Zieltabelle)",
		junctionTableLegend: "Junction-Tabelle",
		junctionModeGenerate: "Neu erzeugen",
		junctionModeExisting: "Bestehende verwenden",
		junctionExistingTable: "Junction-Tabelle",
		junctionColumnLocal: "Feld links (lokal)",
		junctionColumnRemote: "Feld rechts (remote)",
		maxFileSize: "Max. Dateigröße (MB, optional)",
		allowedMimeTypes: "Erlaubte Mime-Types (optional, komma-separiert)",
		viewType: "Ansichtstyp",
		viewTypeGrid: "Tabelle",
		viewTypeUnavailable: "Ansichtstyp \"{{type}}\" ist nicht verfügbar.",
		viewTypeUnavailableHint: "Das zugehörige Modul ist nicht geladen. Filter/Sortierung der Ansicht sind trotzdem gespeichert.",
		cmsNoImage: "Kein Bild",
		cmsPageSize: "Einträge pro Seite",
		cmsShowingRange: "{{from}}–{{to}} von {{total}}",
		cmsPrevPage: "Zurück",
		cmsNextPage: "Weiter",
		kanbanNoStatus: "Kein Status",
		kanbanShowMore: "{{n}} weitere anzeigen",
		kanbanDescriptionShowMore: "Mehr anzeigen",
		kanbanDescriptionShowLess: "Weniger anzeigen"
	},
	formulaDocs: {
		button: "Docs",
		title: "Formel-Referenz",
		intro: "Formeln beziehen sich auf Spalten der Tabelle über ihren Namen (kein Präfix, keine Anführungszeichen). Text steht in doppelten Anführungszeichen.",
		operatorsTitle: "Operatoren",
		opArithmetic: "Rechenoperatoren",
		opArithmeticDesc: "+  -  *  /  %  (Modulo)",
		opComparison: "Vergleich",
		opComparisonDesc: "==  !=  <  <=  >  >=",
		opLogical: "Logisch",
		opLogicalDesc: "&&  ||  !   (auch als and / or / not schreibbar)",
		opTernary: "Bedingter Ausdruck",
		opTernaryDesc: "bedingung ? dannWert : sonstWert",
		functionsTitle: "Funktionen",
		fnIfSignature: "IF(bedingung, dann, sonst)",
		fnIfDesc: "Liefert dann, wenn bedingung wahr ist, sonst sonst.",
		fnLenSignature: "LEN(text)",
		fnLenDesc: "Länge eines Textwerts in Zeichen.",
		fnUpperSignature: "UPPER(text)",
		fnUpperDesc: "Wandelt Text in Großbuchstaben um.",
		fnLowerSignature: "LOWER(text)",
		fnLowerDesc: "Wandelt Text in Kleinbuchstaben um."
	},
	tableSchema: {
		title: "SQL-Schema",
		loading: "Lädt…"
	},
	sqlEditor: {
		titlePrefix: "SQL-Terminal",
		warningBefore: "Führt SQL direkt gegen",
		warningAfter: "aus — SELECT, INSERT/UPDATE/DELETE und DDL (CREATE/ALTER/DROP) sind alle möglich. Es gibt kein Undo.",
		running: "Führt aus…",
		run: "Ausführen",
		confirmDestructive: "Dieses Statement verändert Daten oder Schema — wirklich ausführen?",
		confirmRun: "Ja, ausführen",
		executed: "Ausgeführt.",
		rowsAffected: "{{count}} Zeile(n) betroffen.",
		noRows: "0 Zeilen.",
		truncated: "Auf die ersten 1000 Zeilen gekürzt."
	},
	sqlImport: {
		title: "SQL importieren",
		file: "SQL-Datei",
		dropHint: "Datei hierher ziehen oder klicken zum Auswählen",
		dropHintSub: "Nur .sql-Dateien",
		analyzing: "Analysiere Datei…",
		noStatements: "Die Datei enthält keine ausführbaren SQL-Statements.",
		statementsDetected: "{{count}} Statement(s) erkannt.",
		warning: "Jedes Statement wird unabhängig ausgeführt (SELECT, INSERT/UPDATE/DELETE und DDL sind alle möglich, es gibt kein Undo). Schlägt eines fehl, laufen die übrigen trotzdem weiter -- am Ende siehst du eine vollständige Erfolg/Fehler-Liste.",
		unknownKind: "Statement",
		importing: "Importiert…",
		import: "Importieren",
		resultSummary: "{{succeeded}} von {{total}} Statement(s) erfolgreich.",
		statusOk: "OK",
		statusError: "Fehler"
	},
	webhooks: {
		title: "Webhooks",
		filterHintBefore: "Zeigt nur Webhooks, die für",
		filterHintAfter: "feuern (tabellenübergreifende eingeschlossen). Vollständige Verwaltung auf der Data-Source-Seite.",
		noneCount: "Kein Webhook",
		webhookCount: "{{count}} Webhook(s)",
		newWebhook: "Neuer Webhook",
		noneSetUp: "Noch kein passender Webhook eingerichtet.",
		targetUrl: "Ziel-URL",
		tables: "Tabellen",
		events: "Ereignisse",
		status: "Status",
		active: "Aktiv",
		disabledState: "Deaktiviert",
		notTriggeredYet: "noch nicht ausgelöst",
		error: "Fehler",
		allTables: "Alle Tabellen",
		eventCreated: "Datensatz angelegt",
		eventUpdated: "Datensatz geändert",
		eventDeleted: "Datensatz gelöscht",
		noTableSelectionHint: "Keine Auswahl = feuert für alle Tabellen der Verbindung.",
		secret: "Secret (optional)",
		secretPlaceholder: "Signiert den Payload per HMAC-SHA256",
		createWebhook: "Webhook anlegen"
	},
	createSqlite: {
		title: "Neue SQLite-Datenbank",
		namePlaceholder: "Meine neue Datenbank",
		filename: "Dateiname",
		filenamePlaceholder: "meine-datenbank",
		hint: "Wird als leere Datenbank angelegt -- die erste Tabelle legst du danach wie gewohnt über das SQL-Terminal oder CSV-Import an."
	},
	csvImport: {
		title: "CSV importieren",
		csvFile: "CSV-Datei",
		dropHint: "Datei hierher ziehen oder klicken zum Auswählen",
		dropHintSub: "Nur .csv-Dateien",
		analyzing: "Analysiere Datei…",
		rowsDetected: "{{count}} Zeile(n) erkannt, Trennzeichen",
		truncatedPreview: "Vorschau auf die ersten Zeilen gekürzt.",
		raggedRows: "{{count}} Zeile(n) mit abweichender Spaltenzahl (Zeile(n) {{rows}}) — diese schlagen beim Import fehl, sofern sie eine zugeordnete Spalte betreffen.",
		detectedColumns: "Erkannte Spalten",
		mapColumns: "Spalten zuordnen",
		skip: "Überspringen",
		rowsImported: "{{count}} Zeile(n) importiert.",
		rowsImportedInto: "{{count}} Zeile(n) importiert in \"{{schema}}.{{table}}\".",
		newTableFailureHint: "Schlägt eine Zeile fehl, wird der gesamte Import zurückgerollt -- die Tabelle selbst bleibt aber bestehen (leer), da das Anlegen der Tabelle nicht rückgängig gemacht werden kann.",
		existingTableFailureHint: "Schlägt eine Zeile fehl (z.B. Typkonflikt oder abweichende Spaltenzahl), wird der gesamte Import zurückgerollt -- es gibt kein DDL hier, der Import ist also vollständig atomar.",
		importing: "Importiert…",
		import: "Importieren"
	},
	tablePermissions: {
		title: "Tabellen-Berechtigungen",
		noneKnown: "Noch keine Tabellen bekannt.",
		inherit: "wie bisher",
		none: "kein Zugriff",
		read: "lesen",
		write: "schreiben",
		save: "Berechtigungen speichern"
	},
	filterBuilder: {
		and: "UND",
		or: "ODER",
		removeGroup: "Gruppe entfernen",
		removeCondition: "Bedingung entfernen",
		noConditions: "Keine Bedingungen -- diese Gruppe filtert nichts heraus.",
		addCondition: "+ Bedingung",
		addGroup: "+ Gruppe"
	},
	linksSelect: {
		addLink: "Verknüpfung hinzufügen",
		noPrimaryKey: "Zieltabelle hat keine Primärschlüsselspalte – Verknüpfung nicht möglich."
	},
	attachmentCell: {
		deleteFile: "{{name}} löschen",
		uploading: "Datei wird hochgeladen…",
		upload: "Datei hochladen"
	},
	fileDropzone: { changeFile: "Andere Datei wählen" },
	markdownEdit: {
		titlePrefix: "Markdown bearbeiten",
		placeholder: "# Überschrift\n\n**fett**, _kursiv_, - Liste …",
		previewPlaceholder: "Vorschau erscheint hier.",
		showPreview: "Vorschau einblenden",
		hidePreview: "Vorschau ausblenden",
		toolbar: {
			h1: "Überschrift 1",
			h2: "Überschrift 2",
			h3: "Überschrift 3",
			h4: "Überschrift 4",
			h5: "Überschrift 5",
			h6: "Überschrift 6",
			bold: "Fett",
			italic: "Kursiv",
			underline: "Unterstrichen",
			strikethrough: "Durchgestrichen",
			ul: "Aufzählungsliste",
			ol: "Nummerierte Liste",
			checklist: "Checkliste",
			table: "Tabelle einfügen"
		}
	},
	errors: {
		not_found: "Nicht gefunden.",
		invalid_credentials: "Ungültige Zugangsdaten.",
		forbidden: "Diese Aktion ist nicht erlaubt.",
		rate_limited: "Zu viele Versuche -- bitte später erneut versuchen.",
		last_admin: "Der letzte Administrator kann nicht entfernt oder herabgestuft werden.",
		duplicate_name: "Dieser Name ist bereits vergeben.",
		already_exists: "Existiert bereits.",
		cannot_delete_self: "Du kannst dein eigenes Konto nicht löschen.",
		cannot_drop_pk: "Die Primärschlüsselspalte kann nicht gelöscht werden.",
		invalid_body: "Ungültige Anfrage.",
		invalid_field: "Ungültiges Feld.",
		invalid_name: "Ungültiger Name.",
		invalid_expression: "Ungültiger Formel-Ausdruck.",
		circular_reference: "Zirkulärer Verweis erkannt.",
		file_too_large: "Datei ist zu groß.",
		unsupported_mime_type: "Dateityp wird nicht unterstützt.",
		empty_file: "Datei ist leer.",
		invalid_csv: "Ungültige CSV-Datei.",
		missing_field: "Pflichtfeld fehlt.",
		not_authenticated: "Bitte melde dich an.",
		invalid_token: "Sitzung ungültig oder abgelaufen.",
		no_columns: "Mindestens eine Spalte ist erforderlich.",
		not_editable: "Nicht bearbeitbar.",
		view_not_found: "Ansicht nicht gefunden.",
		unsupported_db_type: "Nicht unterstützter Datenbanktyp.",
		multiple_statements: "Nur eine SQL-Anweisung gleichzeitig erlaubt.",
		empty_mapping: "Keine Spalte zugeordnet.",
		column_count_mismatch: "Anzahl der Spalten stimmt nicht überein."
	},
	apiDocs: {
		title: "API-Dokumentation",
		description: "Allgemeine, nicht tabellenspezifische Endpunkte. Für Endpunkte einer konkreten Tabelle (Datensätze lesen/schreiben, Verknüpfungen, Anhänge) öffne die API-Dokumentation direkt in der jeweiligen Tabellenansicht. Alle Beispiele setzen einen gültigen API-Token voraus, siehe",
		myAccountLink: "Mein Konto",
		currentAccessBefore: "Dein aktueller Zugriff auf diese Tabelle:",
		readWrite: "Lesen & Schreiben",
		readOnly: "Nur Lesen",
		tableExamplesHint: "Alle Beispiele setzen einen gültigen API-Token voraus (siehe",
		noSinglePkWarning: "Diese Tabelle hat keinen oder einen zusammengesetzten Primärschlüssel — einzelne Zeilen können über die REST-API nicht gezielt angesprochen werden. Schreiben, Verknüpfungen und Anhänge sind deshalb hier nicht aufgeführt."
	}
}, ta = {
	common: {
		username: "Username",
		password: "Password",
		email: "Email",
		name: "Name",
		role: "Role",
		createdAt: "Created at",
		updatedAt: "Updated at",
		pleaseChoose: "Please choose",
		close: "Close",
		cancel: "Cancel",
		save: "Save",
		saving: "Saving…",
		edit: "Edit",
		delete: "Delete",
		deleting: "Deleting…",
		create: "Create",
		creating: "Creating…",
		back: "Back",
		next: "Next",
		remove: "Remove",
		errorLoading: "Error loading",
		noResults: "No results",
		search: "Search…",
		refineSearch: "More results – refine your search",
		creatingAlt: "Creating…",
		allDataSources: "All data sources",
		rangeOfTotal: "{{from}}–{{to}} of {{total}}",
		rangeEmpty: "0 of 0",
		yes: "Yes",
		no: "No"
	},
	auth: {
		login: {
			subtitle: "Please sign in.",
			submit: "Sign in",
			submitting: "Signing in…"
		},
		setup: {
			subtitle: "Welcome! Create the first administrator account.",
			passwordRepeat: "Repeat password",
			passwordMismatch: "The passwords do not match.",
			submit: "Create administrator",
			submitting: "Setting up…"
		}
	},
	nav: {
		connections: "Connections",
		newSqliteDatabase: "Create new SQLite database",
		loading: "Loading…",
		noTables: "No tables",
		noViews: "No views",
		settings: "Settings",
		logout: "Log out",
		openMenu: "Open menu",
		collapseSidebar: "Collapse sidebar",
		expandSidebar: "Expand sidebar",
		expand: "Expand {{name}}",
		collapse: "Collapse {{name}}",
		viewOptionsFor: "Options for view {{name}}",
		viewSettings: "Settings",
		viewSettingsTitle: "View settings: {{name}}",
		junctionTableChip: "Admin",
		junctionTableHint: "Only visible to admins — junction table for a links field"
	},
	theme: {
		light: "Light",
		dark: "Dark",
		system: "System default"
	},
	language: {
		label: "Language",
		de: "German",
		en: "English"
	},
	settings: {
		title: "Settings",
		tabs: {
			dataSources: "Data Sources",
			apiDocs: "API Documentation",
			auditLog: "Audit Log",
			files: "Files",
			users: "Users",
			groups: "Groups",
			scripts: "Scripts",
			documentTemplates: "Document Templates",
			myAccount: "My Account"
		},
		users: {
			subtitle: "All user accounts on this instance",
			newUser: "New user",
			confirmDelete: "Really delete user \"{{email}}\"?",
			editUser: "Edit user",
			resetPassword: "Reset password",
			newPasswordPlaceholder: "New password",
			setting: "Setting…",
			set: "Set",
			loadingGroupMembership: "Loading group membership…",
			memberOf: "Member of: {{groups}}",
			managedUnderGroups: "— managed under Settings → Groups"
		},
		account: {
			accountSection: "Account",
			changeEmail: "Change email",
			changePasswordSection: "Change password",
			passwordChanged: "Password changed successfully.",
			currentPassword: "Current password",
			newPassword: "New password",
			changing: "Changing…",
			changePassword: "Change password",
			apiTokens: "API tokens",
			tokenCreatedNotice: "Token \"{{name}}\" created — shown only now, not retrievable afterwards:",
			hide: "Hide",
			tokenNamePlaceholder: "e.g. n8n workflow",
			createToken: "Create token",
			noTokens: "No API tokens created yet.",
			lastUsed: "Last used",
			confirmDeleteToken: "Really delete API token \"{{name}}\"?"
		},
		datasources: {
			subtitle: "Connected databases and their sync status",
			newSqliteDatabase: "New SQLite database",
			newDataSource: "New data source",
			noneYet: "No data source created yet.",
			createFirst: "Create first connection",
			type: "Type",
			connection: "Connection",
			status: "Status",
			lastSync: "Last sync",
			syncing: "Syncing…",
			sync: "Sync",
			confirmDelete: "Really remove data source \"{{name}}\"? All associated tables, views, permissions, webhooks and attachments in IllusionDB will be permanently deleted along with it. The external database itself remains unchanged.",
			namePlaceholder: "Production CRM",
			filePath: "File path",
			database: "Database",
			user: "User",
			sslMode: "SSL mode"
		},
		files: {
			subtitle: "All uploaded files across all data sources",
			galleryView: "Gallery",
			listView: "List",
			allTables: "All tables",
			allColumns: "All columns",
			allFileTypes: "All file types",
			filenamePlaceholder: "Filename…",
			filename: "Filename",
			tableColumn: "Table.Column",
			size: "Size",
			uploaded: "Uploaded",
			noFiles: "No files found.",
			confirmDelete: "Really delete file \"{{name}}\"?"
		},
		auditLog: {
			subtitle: "Schema changes (create/delete table/column) across all data sources",
			allActions: "All actions",
			timestamp: "Timestamp",
			action: "Action",
			target: "Target",
			actor: "Actor",
			details: "Details",
			noEntries: "No entries found.",
			actionCreateTable: "Table created",
			actionAddColumn: "Column added",
			actionDropColumn: "Column dropped"
		},
		groups: {
			subtitle: "Table permissions bundled for multiple users at once",
			newGroup: "New group",
			noneYet: "No group created yet.",
			createFirst: "Create first group",
			members: "Members",
			confirmDelete: "Really delete group \"{{name}}\"?",
			namePlaceholder: "Sales",
			editGroup: "Edit group",
			noViewers: "No viewer accounts exist.",
			saveMembers: "Save members"
		},
		scripts: {
			subtitle: "JavaScript scripts (goja) for custom HTTP endpoints and event hooks",
			newScript: "New script",
			noneYet: "No script created yet.",
			createFirst: "Create first script",
			editScript: "Edit script",
			confirmDelete: "Really delete script \"{{name}}\"? Associated endpoints/hooks are deleted with it.",
			namePlaceholder: "e.g. hello-endpoint",
			codePlaceholder: "// Custom endpoint: request/response available\n// Hook: event available\n// Both: illusiondb.* and log(...)\n// Code runs inside a function -- return <value> gives the result,\n// no return means the result is undefined.\nreturn { ok: true };",
			enabled: "Enabled",
			code: "Code",
			endpointsTitle: "Custom Endpoints",
			endpointsSubtitle: "Reachable at /api/v1/scripts/<path>, live, no restart",
			newEndpoint: "New endpoint",
			editEndpoint: "Edit endpoint",
			noneEndpointsYet: "No endpoint registered yet.",
			method: "Method",
			path: "Path",
			pathPlaceholder: "/hello or /users/:id",
			pathHint: ":name captures one segment, a trailing * captures everything remaining. On overlap the more specific path wins (literal > :name > *); ties go to whichever was created first.",
			authMode: "Auth mode",
			authPublic: "Public",
			authAuthenticated: "Authenticated",
			confirmDeleteEndpoint: "Really delete endpoint \"{{method}} {{path}}\"?",
			hooksTitle: "Event Hooks",
			hooksSubtitle: "Runs in the background after a record write, never blocks the request",
			newHook: "New hook",
			editHook: "Edit hook",
			noneHooksYet: "No hook bound yet.",
			event: "Event",
			table: "Table",
			allTables: "All tables",
			position: "Position",
			confirmDeleteHook: "Really delete this hook?",
			script: "Script",
			selectScript: "Select a script…",
			noScriptsForBinding: "Create a script first to bind an endpoint/hook to it.",
			testRun: "Test run",
			running: "Running…",
			testRunHint: "Really runs the current code (even unsaved) -- illusiondb.* has full access, this is not a sandboxed dry run.",
			testRunLogs: "Console",
			testRunNoLogs: "No log(...) output.",
			testRunReturnValue: "Return value",
			testRunResponse: "Response",
			testRunError: "Error",
			testRunResultPanel: "Result",
			showOutput: "Show output",
			hideOutput: "Hide output",
			testRunPlaceholder: "No test run yet.",
			testRunNoResult: "No return value, no response.",
			apiSnippets: "illusiondb.* API",
			download: "Download",
			import: "Import",
			importInvalidFile: "The file could not be read.",
			importDropTitle: "Import script",
			importDropHint: "Drop a file here or click to browse",
			importDropHintSub: "JS files only"
		},
		documentTemplates: {
			subtitle: "Twig templates that render a record as PDF/PNG/JPG",
			newTemplate: "New Template",
			noneYet: "No template created yet.",
			createFirst: "Create first template",
			noTablesYet: "Create a table first before adding a document template.",
			editTemplate: "Edit Template",
			confirmDelete: "Really delete template \"{{name}}\"?",
			namePlaceholder: "e.g. Invoice",
			table: "Table",
			visibility: "Visibility",
			public: "Public",
			private: "Private",
			isPublic: "Publicly accessible (no bearer token required)",
			isPublicHint: "Private templates require a valid API token when fetched through the document endpoint (Settings → My Account).",
			content: "Template (HTML/Twig)",
			contentPlaceholder: "<h1>Invoice for {{ name }}</h1>\n<p>Amount: {{ amount }} EUR</p>",
			fieldTags: "Table fields",
			noFieldsYet: "No fields found.",
			testGenerate: "Test run",
			testGenerateHint: "Renders the saved template against a chosen record.",
			sampleRecord: "Record",
			format: "Format",
			generate: "Generate",
			generating: "Generating…"
		},
		datasourceDetail: {
			downloadSqlite: "Download database",
			exportSchema: "Export connection settings",
			importSchema: "Import connection settings",
			importSchemaHint: "Choose a JSON file previously created via \"Export connection settings\". Tables/columns must already exist (via Sync) -- import never creates new database columns, only formulas/lookups/rollups/links/file fields, display settings, and saved views.",
			importSchemaInvalidJson: "That file is not valid JSON.",
			importSchemaJsonOnly: "JSON files only",
			importSchemaSummary: "{{matched}} table(s) matched, {{skipped}} skipped. {{created}} column(s) created, {{updated}} updated. {{viewsCreated}} view(s) created, {{viewsUpdated}} updated.",
			sqlEditor: "SQL terminal",
			importCsv: "Import CSV",
			importSql: "Import SQL",
			newTable: "New table",
			noTablesYet: "No tables known yet.",
			hintBefore: "Run \"Sync\" once on the",
			hintLinkText: "overview",
			hintAfter: "page.",
			schema: "Schema",
			table: "Table",
			columns: "Columns",
			lastSynced: "Last synced",
			webhooks: "Webhooks",
			manageWebhooks: "Manage webhooks",
			noWebhooks: "No webhook set up for this connection yet.",
			webhooksCount: "{{count}} webhook(s) set up.",
			createTableTitle: "Create new table",
			tableName: "Table name",
			tableNamePlaceholder: "customers",
			pkHintBefore: "Every new table automatically gets a UUID primary key column",
			pkHintAfter: "— do not add it here.",
			columnNamePlaceholder: "Column name",
			remove: "Remove",
			addColumn: "+ Column",
			createTable: "Create table"
		}
	},
	formats: {
		fieldType: {
			longText: "Long text",
			number: "Number",
			decimal: "Decimal",
			boolean: "Boolean",
			date: "Date",
			datetime: "Date & time",
			uuid: "UUID",
			json: "JSON",
			text: "Text",
			links: "Link",
			attachment: "Attachment"
		},
		dateFormatName: {
			iso: "ISO",
			de: "German",
			us: "US",
			gb: "GB",
			long: "Long form"
		},
		timeFormatName: {
			"24h": "24-hour",
			"12h": "12-hour"
		},
		numberStyleName: {
			plain: "Plain",
			currency: "Currency",
			percent: "Percent",
			temperature: "Temperature"
		}
	},
	calendarView: {
		today: "Today",
		previous: "Previous",
		next: "Next",
		day: "Day",
		week: "Week",
		month: "Month",
		year: "Year",
		notConfigured: "Start and end field not configured yet. Set them up in the view settings."
	},
	documentsView: {
		noTemplateConfigured: "No document template selected. Configure it in the view settings.",
		generateAndDownload: "Generate & download",
		generating: "Generating…"
	},
	dataGrid: {
		columnOptionsFor: "Options for {{name}}",
		columnOptions: "Column options",
		resizeColumnFor: "Resize {{name}}",
		addField: "Add new field",
		displayColumn: "Display column",
		openRecord: "Open record",
		loadingMoreRows: "Loading more rows…",
		endOfList: "– End of list –",
		defaultValue: "Default: {{value}}",
		automatic: "automatic",
		newRow: "New row",
		editSummaryFor: "Edit summary for {{name}}",
		editSummary: "Edit summary",
		noRows: "No rows.",
		summary: "Summary",
		column: "Column",
		unpinDisplay: "Remove display field",
		pinDisplay: "Set as display field",
		hideInView: "Hide in this view",
		editField: "Edit field",
		fieldName: "Field name",
		physicalNameBefore: "Physical column name:",
		physicalNameAfter: "-- leave blank to remove the override.",
		formula: "Formula",
		fieldType: "Field type",
		uiTypeOverrideHint: "Overrides the auto-detected rendering -- e.g. to force a date/time picker on SQLite (which has no native date type), or to enable number formatting on a formula column.",
		originalUnformatted: "Original (unformatted)",
		dateFormat: "Date format",
		timeFormat: "Time format",
		style: "Style",
		decimals: "Decimal places",
		thousandsSeparator: "Thousands separator",
		currency: "Currency",
		unit: "Unit",
		chooseOtherFormat: "Choose a different format",
		loadingValues: "Loading values…",
		value: "Value",
		customColor: "Custom color",
		chooseCustomColor: "Choose custom color",
		removeRow: "Remove row",
		reorderValue: "Reorder value",
		truncatedValues: "Only the first {{count}} values were taken over — there are more.",
		addValue: "+ Value",
		label: "Label",
		buttonLabelPlaceholder: "e.g. Open invoice",
		buttonFormulaHint: "The formula supplies the click target (a URL) -- the button always shows this fixed text, not the formula result.",
		target: "Target",
		newTab: "New tab",
		sameTab: "Same tab",
		plainText: "Plain text",
		labelFormat: "Label (values + colors)",
		tagsFormat: "Tags (comma-separated)",
		emailFormat: "Email address (link)",
		phoneFormat: "Phone number (link)",
		urlFormat: "URL (link)",
		colorFormat: "Color (hex value)",
		buttonFormat: "Button (fixed label, formula as click target)",
		numberFormat: "Number",
		dataSizeFormat: "Data size",
		durationFormat: "Duration",
		emptyGroupLabel: "(empty)",
		summaryNone: "None",
		summarySum: "Sum",
		summaryCount: "Count",
		summaryAvg: "Average",
		summaryMin: "Minimum",
		summaryMax: "Maximum",
		rowCount: {
			one: "row",
			other: "rows"
		},
		linksEntryCount: {
			one: "entry",
			other: "entries"
		}
	},
	recordForm: {
		record: "Record",
		noPrimaryKey: "This table has no unique primary key and cannot be opened as a form.",
		notFound: "Record not found -- it may have been deleted since.",
		removeLink: "Remove link to {{label}}",
		open: "Open",
		editMarkdown: "Edit markdown…"
	},
	tablePage: {
		tables: "Tables",
		columns: "Columns",
		exportCsv: "Export CSV",
		confirmDeleteView: "Really delete view \"{{name}}\"?",
		confirmDeleteRow: "Really delete this row?",
		confirmDropColumn: "Really delete column \"{{name}}\"? This permanently changes the external database's schema.",
		readOnlyNoPk: "This table has no primary key or a composite one — creating, editing, and deleting rows is not possible in this version.",
		readOnlyViewer: "You only have read access to this table — creating, editing, and deleting rows is not possible.",
		deleteView: "Delete view",
		deleteViewFor: "Delete view {{name}}",
		saveViewShort: "+ Save view",
		filter: "Filter",
		reset: "Reset",
		group: "Group",
		searchPlaceholder: "Search…",
		loadedOfTotal: "{{loaded}} of {{total}} loaded",
		openApiDocs: "Open API documentation",
		openWebhooksForTable: "Open webhooks for this table",
		openSqlEditor: "Open SQL terminal",
		openTableSchema: "View SQL schema",
		createRow: "Create row",
		apply: "Apply",
		noGroupLevels: "No grouping level chosen yet -- rows are shown ungrouped.",
		level: "Level {{n}}",
		moveLevelUp: "Move level {{n}} up",
		moveLevelDown: "Move level {{n}} down",
		addLevel: "+ Add level",
		sort: "Sort",
		sortNone: "(no sorting)",
		sortAscending: "Ascending",
		sortDescending: "Descending",
		saveViewTitle: "Save view",
		saveViewHint: "Saves the current filter, sort order, page size, and summary row as a new view.",
		saveViewNamePlaceholder: "e.g. Open orders",
		manageColumnsTitle: "Manage columns",
		viewScopeHint: "Visibility and order below apply only to the active view",
		moveColumn: "Move {{name}}",
		showInView: "Show {{name}} in this view",
		tabPhysical: "Column",
		tabFormula: "Formula",
		tabLookup: "Lookup",
		tabRollup: "Rollup",
		tabLinks: "Links",
		tabForeignKey: "Reference",
		tabAttachment: "File",
		tabAutoNumber: "Auto number",
		columnName: "Column name",
		type: "Type",
		addColumnHint: "Changes the external database's schema (the new column is nullable).",
		autoNumberHint: "Automatically assigns sequential numbers (1, 2, 3, …). Existing rows are backfilled once when the column is created.",
		foreignKeyHint: "Creates a 1:n relationship (a reference to the target table's primary key) -- not enforced by a real database constraint. Lookup and rollup fields can be built on top of it afterward.",
		adding: "Adding…",
		add: "Add",
		expression: "Expression",
		formulaPlaceholderExample: "IF(status == \"shipped\", \"Shipped\", \"Open\")",
		fkColumn: "FK column",
		choose: "— choose —",
		noMatchingColumn: "No matching column available.",
		targetColumn: "Target column",
		childTable: "Child table",
		fkBackToTable: "FK back to this table",
		columnToAggregate: "Column to aggregate",
		function: "Function",
		columnNameHere: "Column name (here)",
		targetTable: "Target table",
		columnNameOnTarget: "Column name (on the target table)",
		junctionTableLegend: "Junction table",
		junctionModeGenerate: "Generate new",
		junctionModeExisting: "Use existing",
		junctionExistingTable: "Junction table",
		junctionColumnLocal: "Left field (local)",
		junctionColumnRemote: "Right field (remote)",
		maxFileSize: "Max. file size (MB, optional)",
		allowedMimeTypes: "Allowed MIME types (optional, comma-separated)",
		viewType: "View type",
		viewTypeGrid: "Grid",
		viewTypeUnavailable: "View type \"{{type}}\" is unavailable.",
		viewTypeUnavailableHint: "Its module isn't loaded. The view's filters/sort are still saved.",
		cmsNoImage: "No image",
		cmsPageSize: "Rows per page",
		cmsShowingRange: "{{from}}–{{to}} of {{total}}",
		cmsPrevPage: "Previous",
		cmsNextPage: "Next",
		kanbanNoStatus: "No status",
		kanbanShowMore: "Show {{n}} more",
		kanbanDescriptionShowMore: "Show more",
		kanbanDescriptionShowLess: "Show less"
	},
	formulaDocs: {
		button: "Docs",
		title: "Formula reference",
		intro: "Formulas refer to table columns by their plain name (no prefix, no quotes). Text values are written in double quotes.",
		operatorsTitle: "Operators",
		opArithmetic: "Arithmetic",
		opArithmeticDesc: "+  -  *  /  %  (modulo)",
		opComparison: "Comparison",
		opComparisonDesc: "==  !=  <  <=  >  >=",
		opLogical: "Logical",
		opLogicalDesc: "&&  ||  !   (also spelled and / or / not)",
		opTernary: "Conditional expression",
		opTernaryDesc: "condition ? thenValue : elseValue",
		functionsTitle: "Functions",
		fnIfSignature: "IF(condition, then, else)",
		fnIfDesc: "Returns then when condition is true, otherwise else.",
		fnLenSignature: "LEN(text)",
		fnLenDesc: "Length of a text value in characters.",
		fnUpperSignature: "UPPER(text)",
		fnUpperDesc: "Converts text to uppercase.",
		fnLowerSignature: "LOWER(text)",
		fnLowerDesc: "Converts text to lowercase."
	},
	tableSchema: {
		title: "SQL schema",
		loading: "Loading…"
	},
	sqlEditor: {
		titlePrefix: "SQL terminal",
		warningBefore: "Runs SQL directly against",
		warningAfter: "— SELECT, INSERT/UPDATE/DELETE and DDL (CREATE/ALTER/DROP) are all possible. There is no undo.",
		running: "Running…",
		run: "Run",
		confirmDestructive: "This statement changes data or schema — really run it?",
		confirmRun: "Yes, run it",
		executed: "Executed.",
		rowsAffected: "{{count}} row(s) affected.",
		noRows: "0 rows.",
		truncated: "Truncated to the first 1000 rows."
	},
	sqlImport: {
		title: "Import SQL",
		file: "SQL file",
		dropHint: "Drop a file here or click to browse",
		dropHintSub: "SQL files only",
		analyzing: "Analyzing file…",
		noStatements: "The file contains no executable SQL statements.",
		statementsDetected: "{{count}} statement(s) detected.",
		warning: "Each statement runs independently (SELECT, INSERT/UPDATE/DELETE and DDL are all possible, there is no undo). If one fails, the rest still run -- you get a full success/failure list at the end.",
		unknownKind: "Statement",
		importing: "Importing…",
		import: "Import",
		resultSummary: "{{succeeded}} of {{total}} statement(s) succeeded.",
		statusOk: "OK",
		statusError: "Error"
	},
	webhooks: {
		title: "Webhooks",
		filterHintBefore: "Shows only webhooks that fire for",
		filterHintAfter: "(including cross-table ones). Full management is on the data source page.",
		noneCount: "No webhooks",
		webhookCount: "{{count}} webhook(s)",
		newWebhook: "New webhook",
		noneSetUp: "No matching webhook set up yet.",
		targetUrl: "Target URL",
		tables: "Tables",
		events: "Events",
		status: "Status",
		active: "Active",
		disabledState: "Disabled",
		notTriggeredYet: "not triggered yet",
		error: "Error",
		allTables: "All tables",
		eventCreated: "Record created",
		eventUpdated: "Record updated",
		eventDeleted: "Record deleted",
		noTableSelectionHint: "No selection = fires for every table in the connection.",
		secret: "Secret (optional)",
		secretPlaceholder: "Signs the payload via HMAC-SHA256",
		createWebhook: "Create webhook"
	},
	createSqlite: {
		title: "New SQLite database",
		namePlaceholder: "My new database",
		filename: "Filename",
		filenamePlaceholder: "my-database",
		hint: "Created as an empty database -- create the first table afterwards as usual via the SQL terminal or CSV import."
	},
	csvImport: {
		title: "Import CSV",
		csvFile: "CSV file",
		dropHint: "Drop a file here or click to browse",
		dropHintSub: "CSV files only",
		analyzing: "Analyzing file…",
		rowsDetected: "{{count}} row(s) detected, delimiter",
		truncatedPreview: "Preview truncated to the first few rows.",
		raggedRows: "{{count}} row(s) with a differing column count (row(s) {{rows}}) — these will fail on import if they affect a mapped column.",
		detectedColumns: "Detected columns",
		mapColumns: "Map columns",
		skip: "Skip",
		rowsImported: "{{count}} row(s) imported.",
		rowsImportedInto: "{{count}} row(s) imported into \"{{schema}}.{{table}}\".",
		newTableFailureHint: "If a row fails, the whole import is rolled back -- the table itself remains (empty), since creating the table cannot be undone.",
		existingTableFailureHint: "If a row fails (e.g. a type conflict or differing column count), the whole import is rolled back -- there is no DDL here, so the import is fully atomic.",
		importing: "Importing…",
		import: "Import"
	},
	tablePermissions: {
		title: "Table permissions",
		noneKnown: "No tables known yet.",
		inherit: "as before",
		none: "no access",
		read: "read",
		write: "write",
		save: "Save permissions"
	},
	filterBuilder: {
		and: "AND",
		or: "OR",
		removeGroup: "Remove group",
		removeCondition: "Remove condition",
		noConditions: "No conditions -- this group filters nothing out.",
		addCondition: "+ Condition",
		addGroup: "+ Group"
	},
	linksSelect: {
		addLink: "Add link",
		noPrimaryKey: "Target table has no primary key column – linking is not possible."
	},
	attachmentCell: {
		deleteFile: "Delete {{name}}",
		uploading: "Uploading file…",
		upload: "Upload file"
	},
	fileDropzone: { changeFile: "Choose a different file" },
	markdownEdit: {
		titlePrefix: "Edit markdown",
		placeholder: "# Heading\n\n**bold**, _italic_, - list …",
		previewPlaceholder: "Preview appears here.",
		showPreview: "Show preview",
		hidePreview: "Hide preview",
		toolbar: {
			h1: "Heading 1",
			h2: "Heading 2",
			h3: "Heading 3",
			h4: "Heading 4",
			h5: "Heading 5",
			h6: "Heading 6",
			bold: "Bold",
			italic: "Italic",
			underline: "Underline",
			strikethrough: "Strikethrough",
			ul: "Bullet list",
			ol: "Numbered list",
			checklist: "Checklist",
			table: "Insert table"
		}
	},
	errors: {
		not_found: "Not found.",
		invalid_credentials: "Invalid credentials.",
		forbidden: "This action is not allowed.",
		rate_limited: "Too many attempts -- please try again later.",
		last_admin: "The last administrator cannot be removed or demoted.",
		duplicate_name: "This name is already taken.",
		already_exists: "Already exists.",
		cannot_delete_self: "You cannot delete your own account.",
		cannot_drop_pk: "The primary key column cannot be deleted.",
		invalid_body: "Invalid request.",
		invalid_field: "Invalid field.",
		invalid_name: "Invalid name.",
		invalid_expression: "Invalid formula expression.",
		circular_reference: "Circular reference detected.",
		file_too_large: "File is too large.",
		unsupported_mime_type: "File type not supported.",
		empty_file: "File is empty.",
		invalid_csv: "Invalid CSV file.",
		missing_field: "Required field is missing.",
		not_authenticated: "Please sign in.",
		invalid_token: "Session is invalid or has expired.",
		no_columns: "At least one column is required.",
		not_editable: "Not editable.",
		view_not_found: "View not found.",
		unsupported_db_type: "Unsupported database type.",
		multiple_statements: "Only one SQL statement is allowed at a time.",
		empty_mapping: "No column mapped.",
		column_count_mismatch: "Column count does not match."
	},
	apiDocs: {
		title: "API documentation",
		description: "General, non-table-specific endpoints. For endpoints of a specific table (reading/writing records, links, attachments), open the API documentation directly from that table view. All examples assume a valid API token, see",
		myAccountLink: "My account",
		currentAccessBefore: "Your current access to this table:",
		readWrite: "Read & write",
		readOnly: "Read only",
		tableExamplesHint: "All examples assume a valid API token (see",
		noSinglePkWarning: "This table has no primary key or a composite one — individual rows cannot be targeted via the REST API. Writes, links, and attachments are therefore not listed here."
	}
}, na = {
	de: ea,
	en: ta
};
function ra(e, t) {
	return t.reduce((e, t) => {
		if (!(typeof e != "object" || !e)) return e[t];
	}, e);
}
function ia(e, t) {
	return t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : `{{${n}}}`) : e;
}
function aa(e) {
	return typeof e == "object" && !!e && "one" in e && "other" in e;
}
function oa(e) {
	let t = e.split(".");
	return ra(na[$i.current], t) ?? ra(na.de, t);
}
function X(e, t) {
	let n = oa(e);
	return typeof n == "string" ? ia(n, t) : aa(n) ? ia(n.other, t) : e;
}
//#endregion
//#region src/lib/formatters.ts
function sa() {
	return $i.current === "en" ? "en-US" : "de-DE";
}
function ca(e) {
	return e == null ? "" : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "object" ? JSON.stringify(e) : String(e);
}
function la(e, t) {
	return e._fk_display?.[t.effective_name];
}
function ua(e, t) {
	return e._fk_display_format?.[t.effective_name];
}
function da(e, t) {
	let n = la(e, t);
	if (n === void 0) return;
	let r = ua(e, t);
	return r ? Ea(n, r) : ca(n);
}
var fa = /* @__PURE__ */ new Set(["http:", "https:"]);
function pa(e) {
	if (!e) return e;
	try {
		let t = typeof location < "u" ? location.href : "http://localhost/";
		return fa.has(new URL(e, t).protocol) ? e : "#";
	} catch {
		return "#";
	}
}
function ma(e, t) {
	let n = ca(t);
	return e.display_format === "email" ? `mailto:${n}` : e.display_format === "phone" ? `tel:${n}` : pa(n);
}
function ha(e) {
	if (e === !0 || e === 1) return !0;
	if (typeof e == "string") {
		let t = e.trim().toLowerCase();
		return t === "1" || t === "true";
	}
	return !1;
}
function ga(e) {
	return ca(e).split(",").map((e) => e.trim()).filter((e) => e.length > 0);
}
var _a = {
	de: [
		"Januar",
		"Februar",
		"März",
		"April",
		"Mai",
		"Juni",
		"Juli",
		"August",
		"September",
		"Oktober",
		"November",
		"Dezember"
	],
	en: [
		"January",
		"February",
		"March",
		"April",
		"May",
		"June",
		"July",
		"August",
		"September",
		"October",
		"November",
		"December"
	]
};
function va(e, t, n, r) {
	switch (r) {
		case "de": return `${n}.${t}.${e}`;
		case "us": return `${t}/${n}/${e}`;
		case "gb": return `${n}/${t}/${e}`;
		case "long": return `${parseInt(n, 10)}. ${_a[$i.current][parseInt(t, 10) - 1] ?? t} ${e}`;
		default: return `${e}-${t}-${n}`;
	}
}
function ya(e, t, n) {
	if (n !== "12h") return `${e}:${t}`;
	let r = parseInt(e, 10), i = r < 12 ? "AM" : "PM";
	return `${r % 12 || 12}:${t} ${i}`;
}
function ba(e, t) {
	let n = ca(e);
	if (!n) return n;
	let r = va(n.slice(0, 4), n.slice(5, 7), n.slice(8, 10), t.format_config.date_format ?? "iso");
	return t.ui_type !== "datetime" || !t.format_config.time_format ? r : `${r} ${ya(n.slice(11, 13), n.slice(14, 16), t.format_config.time_format)}`;
}
function xa(e, t) {
	if (e == null || e === "") return ca(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return ca(e);
	let r = t.format_config, i = r.decimals ?? (t.ui_type === "decimal" ? 2 : 0), a = {
		minimumFractionDigits: i,
		maximumFractionDigits: i,
		useGrouping: r.thousands_separator ?? !0
	};
	switch (r.style) {
		case "currency": return new Intl.NumberFormat(sa(), {
			...a,
			style: "currency",
			currency: r.currency ?? "EUR"
		}).format(n);
		case "percent": return `${new Intl.NumberFormat(sa(), a).format(n)} %`;
		case "temperature": return `${new Intl.NumberFormat(sa(), a).format(n)} ${r.temperature_unit === "fahrenheit" ? "°F" : "°C"}`;
		default: return new Intl.NumberFormat(sa(), a).format(n);
	}
}
var Sa = {
	KB: 1024,
	MB: 1024 ** 2,
	GB: 1024 ** 3,
	TB: 1024 ** 4
};
function Ca(e, t) {
	if (e == null || e === "") return ca(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return ca(e);
	let r = t.format_config.unit ?? "MB", i = n / (Sa[r] ?? Sa.MB);
	return `${new Intl.NumberFormat(sa(), {
		minimumFractionDigits: 2,
		maximumFractionDigits: 2
	}).format(i)} ${r}`;
}
var wa = {
	s: 1e3,
	min: 6e4,
	h: 36e5,
	d: 864e5
};
function Ta(e, t) {
	if (e == null || e === "") return ca(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return ca(e);
	let r = t.format_config.unit ?? "s", i = n / (wa[r] ?? wa.s);
	return `${new Intl.NumberFormat(sa(), {
		minimumFractionDigits: 2,
		maximumFractionDigits: 2
	}).format(i)} ${r}`;
}
function Ea(e, t) {
	return t.display_format === "date_format" ? ba(e, t) : t.display_format === "number_format" ? xa(e, t) : t.display_format === "data_size" ? Ca(e, t) : t.display_format === "duration" ? Ta(e, t) : ca(e);
}
function Da(e) {
	switch (e.field_kind) {
		case "formula": return "ƒ";
		case "lookup": return "→";
		case "rollup": return "Σ";
		case "links": return "⇄";
		default: return null;
	}
}
function Oa(e) {
	return Array.isArray(e) ? e : [];
}
function ka(e, t) {
	if (t.is_foreign_key) {
		let n = da(e, t);
		return n === void 0 ? ca(e[t.effective_name]) : n;
	}
	return t.field_kind === "links" ? Oa(e[t.effective_name]).map((e) => ca(e.label)).join(", ") : t.ui_type === "boolean" ? ha(e[t.effective_name]) ? X("common.yes") : X("common.no") : t.display_format === "tags" ? ga(e[t.effective_name]).join(", ") : Ea(e[t.effective_name], t);
}
function Aa(e, t) {
	let n = ca(e);
	return t.ui_type === "date" ? n.slice(0, 10) : t.ui_type === "datetime" ? n.slice(0, 19).replace(" ", "T") : n;
}
//#endregion
//#region src/lib/api/tables.ts
function ja(e) {
	return e === "date" ? { type: "date" } : e === "datetime" ? {
		type: "datetime-local",
		step: "1"
	} : { type: "text" };
}
async function Ma(e, t = fetch) {
	return (await ji(`/api/v1/tables/${e}`, void 0, t)).json();
}
//#endregion
//#region src/lib/api/attachments.ts
function Na(e, t, n, r) {
	return `/api/v1/tables/${e}/records/${t}/attachments/${n}/${r}`;
}
function Pa(e, t, n, r) {
	return Na(e, t, n, r);
}
function Fa(e, t, n, r) {
	return `${Na(e, t, n, r)}/thumbnail`;
}
async function Ia(e, t, n, r) {
	let i = new FormData();
	return i.append("file", r), (await ji(`/api/v1/tables/${e}/records/${t}/attachments/${n}`, {
		method: "POST",
		body: i
	})).json();
}
async function La(e, t, n, r) {
	await ji(Na(e, t, n, r), { method: "DELETE" });
}
//#endregion
//#region src/lib/labelColors.ts
var Ra = {
	gray: "bg-ink-200 text-ink-700",
	red: "bg-red-100 text-red-700",
	orange: "bg-orange-100 text-orange-700",
	amber: "bg-amber-100 text-amber-700",
	yellow: "bg-yellow-100 text-yellow-700",
	green: "bg-green-100 text-green-700",
	teal: "bg-teal-100 text-teal-700",
	blue: "bg-blue-100 text-blue-700",
	indigo: "bg-indigo-100 text-indigo-700",
	purple: "bg-purple-100 text-purple-700",
	pink: "bg-pink-100 text-pink-700"
};
function za(e) {
	return /^#[0-9a-fA-F]{6}$/.test(e);
}
function Ba(e, t) {
	return t && t.length === Object.keys(e).length ? [...t] : Object.keys(e);
}
function Va(e) {
	let t = parseInt(e.slice(1, 3), 16), n = parseInt(e.slice(3, 5), 16), r = parseInt(e.slice(5, 7), 16);
	return (.299 * t + .587 * n + .114 * r) / 255 > .6 ? "#1f2937" : "#ffffff";
}
//#endregion
//#region src/lib/components/Lightbox.svelte
var Ha = /* @__PURE__ */ W("<div class=\"fixed inset-0 z-[9999] grid place-items-center bg-ink-950/80 p-4\"><div class=\"relative max-h-[90vh] max-w-[90vw]\"><img class=\"max-h-[90vh] max-w-[90vw] rounded shadow-2xl\"/> <button type=\"button\" class=\"absolute -top-3 -right-3 flex size-8 items-center justify-center rounded-full bg-surface text-ink-700 shadow hover:bg-ink-100\">×</button></div></div>");
function Ua(e, t) {
	He(t, !0);
	let n = Y(t, "src", 7), r = Y(t, "alt", 7), i = Y(t, "onClose", 7);
	vn(() => {
		function e(e) {
			e.key === "Escape" && i()();
		}
		return document.addEventListener("keydown", e), () => document.removeEventListener("keydown", e);
	});
	var a = {
		get src() {
			return n();
		},
		set src(e) {
			n(e), P();
		},
		get alt() {
			return r();
		},
		set alt(e) {
			r(e), P();
		},
		get onClose() {
			return i();
		},
		set onClose(e) {
			i(e), P();
		}
	}, o = Ha(), s = L(o), c = L(s), l = R(c, 2);
	return j(s), j(o), z((e) => {
		J(c, "src", n()), J(c, "alt", r()), J(l, "aria-label", e);
	}, [() => X("common.close")]), U("click", l, function(...e) {
		i()?.apply(this, e);
	}), G(e, o), Ue(a);
}
yr(["click"]), ki(Ua, {
	src: {},
	alt: {},
	onClose: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/AttachmentCell.svelte
var Wa = /* @__PURE__ */ W("<span class=\"group/file relative inline-flex shrink-0\"><button type=\"button\" class=\"block rounded\"><img loading=\"lazy\" class=\"size-8 rounded border border-ink-200 object-cover\"/></button> <button type=\"button\" class=\"absolute -top-1.5 -right-1.5 hidden size-4 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white group-hover/file:flex disabled:opacity-50\">×</button></span>"), Ga = /* @__PURE__ */ W("<span class=\"badge inline-flex shrink-0 items-center gap-1 bg-ink-100 text-ink-700\"><a target=\"_blank\" rel=\"noopener\" class=\"max-w-[8rem] truncate hover:underline\"> </a> <button type=\"button\" class=\"rounded-full text-ink-400 hover:text-red-600 disabled:opacity-50\">×</button></span>"), Ka = /* @__PURE__ */ Dr("<svg class=\"size-3 animate-spin\" viewBox=\"0 0 24 24\" fill=\"none\"><circle class=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"3\"></circle><path d=\"M21 12a9 9 0 0 0-9-9\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\"></path></svg>"), qa = /* @__PURE__ */ W("<span class=\"flex flex-wrap items-center gap-1.5 overflow-hidden\"><!> <input type=\"file\" class=\"hidden\"/> <button type=\"button\" class=\"badge shrink-0 bg-ink-100 text-ink-500 hover:bg-ink-200 hover:text-ink-700 disabled:opacity-50\"><!></button></span> <!>", 1);
function Ja(e, t) {
	He(t, !0);
	let n = Y(t, "files", 7), r = Y(t, "tableId", 7), i = Y(t, "pk", 7), a = Y(t, "columnId", 7), o = Y(t, "onUpload", 7), s = Y(t, "onDelete", 7), c = /* @__PURE__ */ F(void 0), l = /* @__PURE__ */ F(!1), u = /* @__PURE__ */ F(null), d = /* @__PURE__ */ F(null);
	async function f(e) {
		let t = e.currentTarget, n = t.files?.[0];
		if (t.value = "", n) {
			I(l, !0);
			try {
				await o()(n);
			} finally {
				I(l, !1);
			}
		}
	}
	async function p(e) {
		I(u, e, !0);
		try {
			await s()(e);
		} finally {
			I(u, null);
		}
	}
	function m(e) {
		return e.mime_type.startsWith("image/") && e.has_thumbnail;
	}
	var h = {
		get files() {
			return n();
		},
		set files(e) {
			n(e), P();
		},
		get tableId() {
			return r();
		},
		set tableId(e) {
			r(e), P();
		},
		get pk() {
			return i();
		},
		set pk(e) {
			i(e), P();
		},
		get columnId() {
			return a();
		},
		set columnId(e) {
			a(e), P();
		},
		get onUpload() {
			return o();
		},
		set onUpload(e) {
			o(e), P();
		},
		get onDelete() {
			return s();
		},
		set onDelete(e) {
			s(e), P();
		}
	}, g = qa(), _ = cn(g), v = L(_);
	Ur(v, 17, n, (e) => e.id, (e, t) => {
		var n = kr(), o = cn(n), s = (e) => {
			var n = Wa(), o = L(n), s = L(o);
			j(o);
			var c = R(o, 2);
			j(n), z((e, n) => {
				J(o, "title", H(t).original_filename), J(s, "src", e), J(s, "alt", H(t).original_filename), J(c, "aria-label", n), c.disabled = H(u) === H(t).id;
			}, [() => Fa(r(), i(), a(), H(t).id), () => X("attachmentCell.deleteFile", { name: H(t).original_filename })]), U("click", o, () => I(d, H(t), !0)), U("click", c, () => p(H(t).id)), G(e, n);
		}, c = /* @__PURE__ */ M(() => m(H(t))), l = (e) => {
			var n = Ga(), o = L(n), s = L(o, !0);
			j(o);
			var c = R(o, 2);
			j(n), z((e, n) => {
				J(o, "href", e), J(o, "title", H(t).original_filename), K(s, H(t).original_filename), J(c, "aria-label", n), c.disabled = H(u) === H(t).id;
			}, [() => Pa(r(), i(), a(), H(t).id), () => X("attachmentCell.deleteFile", { name: H(t).original_filename })]), U("click", c, () => p(H(t).id)), G(e, n);
		};
		q(o, (e) => {
			H(c) ? e(s) : e(l, -1);
		}), G(e, n);
	});
	var y = R(v, 2);
	Ci(y, (e) => I(c, e), () => H(c));
	var b = R(y, 2), x = L(b), S = (e) => {
		G(e, Ka());
	}, C = (e) => {
		G(e, Or("+"));
	};
	q(x, (e) => {
		H(l) ? e(S) : e(C, -1);
	}), j(b), j(_);
	var ee = R(_, 2), w = (e) => {
		{
			let t = /* @__PURE__ */ M(() => Pa(r(), i(), a(), H(d).id));
			Ua(e, {
				get src() {
					return H(t);
				},
				get alt() {
					return H(d).original_filename;
				},
				onClose: () => I(d, null)
			});
		}
	};
	return q(ee, (e) => {
		H(d) && e(w);
	}), z((e, t) => {
		y.disabled = H(l), J(b, "aria-label", e), J(b, "title", t), b.disabled = H(l);
	}, [() => H(l) ? X("attachmentCell.uploading") : X("attachmentCell.upload"), () => H(l) ? X("attachmentCell.uploading") : X("attachmentCell.upload")]), U("change", y, f), U("click", b, () => H(c)?.click()), G(e, g), Ue(h);
}
yr(["click", "change"]), ki(Ja, {
	files: {},
	tableId: {},
	pk: {},
	columnId: {},
	onUpload: {},
	onDelete: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/overlayScroll.ts
function Ya(e) {
	let t;
	function n() {
		e.classList.add("is-scrolling"), clearTimeout(t), t = setTimeout(() => e.classList.remove("is-scrolling"), 800);
	}
	return e.addEventListener("scroll", n), { destroy() {
		e.removeEventListener("scroll", n), clearTimeout(t);
	} };
}
//#endregion
//#region src/lib/components/FKSelect.svelte
var Xa = /* @__PURE__ */ W("<input/>"), Za = /* @__PURE__ */ W("<span class=\"badge shrink-0 truncate bg-ink-100 text-ink-700\"> </span>"), Qa = /* @__PURE__ */ W("<span class=\"truncate text-ink-400\"> </span>"), $a = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-ink-400\"> </div>"), eo = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-danger\"> </div>"), to = /* @__PURE__ */ W("<span class=\"truncate\"> </span>"), no = /* @__PURE__ */ W("<button type=\"button\"><!></button>"), ro = /* @__PURE__ */ W("<div class=\"px-3 py-1 text-xs text-ink-400\"> </div>"), io = /* @__PURE__ */ W("<!> <!>", 1), ao = /* @__PURE__ */ W("<div class=\"card fixed z-30 flex max-h-72 flex-col overflow-hidden py-1 shadow-lg\"><input type=\"text\" class=\"mx-2 mb-1 border-b border-ink-200 px-1 py-1 text-sm outline-none\"/> <div class=\"overlay-scroll overflow-y-auto\"><!></div></div>"), oo = /* @__PURE__ */ W("<button type=\"button\"><!> <svg class=\"size-3 shrink-0 text-ink-400\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg></button> <!>", 1);
function so(e, t) {
	He(t, !0);
	let n = Y(t, "value", 15, ""), r = Y(t, "fkTargetTableId", 7), i = Y(t, "fkTargetColumn", 7), a = Y(t, "uiType", 7), o = Y(t, "nullable", 7, !1), s = Y(t, "currentLabel", 7), c = Y(t, "autoOpen", 7, !1), l = Y(t, "onClose", 7), u = Y(t, "onCancel", 7), d = Y(t, "onKeydown", 7), f = Y(t, "emptyLabel", 7, "–"), p = Y(t, "class", 7), m = /* @__PURE__ */ F(!1), h = /* @__PURE__ */ F(null), g = /* @__PURE__ */ F(null), _;
	function v() {
		return _ ||= Ma(r()).then((e) => {
			let t = e.columns.find((e) => e.is_display_column);
			I(h, t && (t.field_kind === "physical" || t.field_kind === "auto_number" || t.field_kind === "formula") ? t.effective_name : null, !0), I(g, e.columns.find((e) => e.name === i())?.effective_name ?? i(), !0);
		}).catch(() => {
			I(h, null);
		}).finally(() => {
			I(m, !0);
		}), _;
	}
	vn(() => {
		v();
	});
	let y = /* @__PURE__ */ F(!1), b = /* @__PURE__ */ F(""), x = /* @__PURE__ */ F(Qt([])), S = /* @__PURE__ */ F(!1), C = /* @__PURE__ */ F(!1), ee = /* @__PURE__ */ F(!1), w = /* @__PURE__ */ F(0), te = /* @__PURE__ */ F(void 0), ne = 0, T, re = /* @__PURE__ */ F(void 0), ie = /* @__PURE__ */ F(void 0), ae = /* @__PURE__ */ F(void 0), oe = /* @__PURE__ */ F(void 0), se = /* @__PURE__ */ F(null), ce = /* @__PURE__ */ M(() => o() ? [{
		rawValue: "",
		label: f()
	}, ...H(x)] : H(x));
	async function le(e) {
		if (!H(h)) return;
		let t = ++ne;
		I(C, !0), I(ee, !1);
		try {
			let n = await Hi(r(), {
				where: e ? {
					col: H(h),
					op: "like",
					val: e
				} : Mi,
				sort: [{
					column: H(h),
					desc: !1
				}],
				limit: 20
			});
			if (t !== ne) return;
			I(x, n.records.map((e) => ({
				rawValue: String(e[H(g) ?? i()] ?? ""),
				label: String(e[H(h)] ?? "")
			})), !0), I(S, n.pageInfo.hasMore, !0);
		} catch {
			if (t !== ne) return;
			I(ee, !0), I(x, [], !0), I(S, !1);
		} finally {
			t === ne && I(C, !1);
		}
	}
	function ue(e) {
		T && clearTimeout(T), T = setTimeout(() => le(e), 250);
	}
	function E() {
		if (!H(re) || !H(h)) return;
		let e = H(re).getBoundingClientRect();
		I(se, {
			top: e.bottom + 2,
			left: e.left,
			width: Math.max(e.width, 240)
		}, !0), I(y, !0), I(b, ""), I(w, 0), le(""), queueMicrotask(() => H(ae)?.focus());
	}
	function de() {
		I(y, !1), I(se, null), T && clearTimeout(T);
	}
	function fe() {
		de(), l()?.();
	}
	function pe(e) {
		n(e.rawValue), I(te, e.rawValue === "" ? void 0 : e.label, !0), de(), l()?.();
	}
	async function me() {
		await v(), H(h) && (H(y) ? fe() : E());
	}
	function he(e) {
		if (!H(y)) {
			if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
				e.preventDefault(), me();
				return;
			}
			d()?.(e);
			return;
		}
	}
	function ge(e) {
		let t = H(ce).length;
		if (e.key === "ArrowDown") e.preventDefault(), t > 0 && I(w, (H(w) + 1) % t);
		else if (e.key === "ArrowUp") e.preventDefault(), t > 0 && I(w, (H(w) - 1 + t) % t);
		else if (e.key === "Enter") {
			e.preventDefault();
			let t = H(ce)[H(w)];
			t && pe(t);
		} else e.key === "Escape" && (e.preventDefault(), de(), u()?.());
	}
	vn(() => {
		c() && v().then(() => {
			H(h) ? (H(re)?.focus(), E()) : H(ie)?.focus();
		});
	}), vn(() => {
		if (!H(y)) return;
		function e(e) {
			let t = e.target;
			H(oe)?.contains(t) || H(re)?.contains(t) || fe();
		}
		return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
	});
	var _e = {
		get value() {
			return n();
		},
		set value(e = "") {
			n(e), P();
		},
		get fkTargetTableId() {
			return r();
		},
		set fkTargetTableId(e) {
			r(e), P();
		},
		get fkTargetColumn() {
			return i();
		},
		set fkTargetColumn(e) {
			i(e), P();
		},
		get uiType() {
			return a();
		},
		set uiType(e) {
			a(e), P();
		},
		get nullable() {
			return o();
		},
		set nullable(e = !1) {
			o(e), P();
		},
		get currentLabel() {
			return s();
		},
		set currentLabel(e) {
			s(e), P();
		},
		get autoOpen() {
			return c();
		},
		set autoOpen(e = !1) {
			c(e), P();
		},
		get onClose() {
			return l();
		},
		set onClose(e) {
			l(e), P();
		},
		get onCancel() {
			return u();
		},
		set onCancel(e) {
			u(e), P();
		},
		get onKeydown() {
			return d();
		},
		set onKeydown(e) {
			d(e), P();
		},
		get emptyLabel() {
			return f();
		},
		set emptyLabel(e = "–") {
			f(e), P();
		},
		get class() {
			return p();
		},
		set class(e) {
			p(e), P();
		}
	}, ve = kr(), ye = cn(ve), D = (e) => {
		var t = Xa();
		pi(t), Ci(t, (e) => I(ie, e), () => H(ie)), z((e, n) => {
			J(t, "type", e), J(t, "step", n), oi(t, 1, ei(p()));
		}, [() => ja(a()).type, () => ja(a()).step]), U("keydown", t, function(...e) {
			d()?.apply(this, e);
		}), vr("blur", t, () => l()?.()), yi(t, n), G(e, t);
	}, be = (e) => {
		var t = oo(), r = cn(t), i = L(r), a = (e) => {
			var t = Za(), r = L(t, !0);
			j(t), z(() => K(r, s() ?? H(te) ?? n())), G(e, t);
		}, o = (e) => {
			var t = Qa(), n = L(t, !0);
			j(t), z(() => K(n, f())), G(e, t);
		};
		q(i, (e) => {
			n() ? e(a) : e(o, -1);
		}), Pe(2), j(r), Ci(r, (e) => I(re, e), () => H(re));
		var c = R(r, 2), l = (e) => {
			var t = ao(), n = L(t);
			pi(n), Ci(n, (e) => I(ae, e), () => H(ae));
			var r = R(n, 2), i = L(r), a = (e) => {
				var t = $a(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
			}, o = (e) => {
				var t = eo(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.errorLoading")]), G(e, t);
			}, s = (e) => {
				var t = $a(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.noResults")]), G(e, t);
			}, c = (e) => {
				var t = io(), n = cn(t);
				Ur(n, 19, () => H(ce), (e, t) => e.rawValue + "::" + t, (e, t, n) => {
					var r = no(), i = L(r), a = (e) => {
						var t = Qa(), n = L(t, !0);
						j(t), z(() => K(n, f())), G(e, t);
					}, o = (e) => {
						var n = to(), r = L(n, !0);
						j(n), z(() => K(r, H(t).label)), G(e, n);
					};
					q(i, (e) => {
						H(t).rawValue === "" ? e(a) : e(o, -1);
					}), j(r), z(() => oi(r, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
								${H(n) === H(w) ? "bg-brand-50" : "hover:bg-ink-100"}`)), U("mousedown", r, (e) => e.preventDefault()), U("click", r, () => pe(H(t))), G(e, r);
				});
				var r = R(n, 2), i = (e) => {
					var t = ro(), n = L(t, !0);
					j(t), z((e) => K(n, e), [() => X("common.refineSearch")]), G(e, t);
				};
				q(r, (e) => {
					H(S) && e(i);
				}), G(e, t);
			};
			q(i, (e) => {
				H(C) ? e(a) : H(ee) ? e(o, 1) : H(ce).length === 0 ? e(s, 2) : e(c, -1);
			}), j(r), Zr(r, (e) => Ya?.(e)), j(t), Ci(t, (e) => I(oe, e), () => H(oe)), z((e) => {
				ci(t, `min-width: ${H(se).width ?? ""}px; top: ${H(se).top ?? ""}px; left: ${H(se).left ?? ""}px`), J(n, "placeholder", e);
			}, [() => X("common.search")]), U("input", n, () => ue(H(b))), U("keydown", n, ge), yi(n, () => H(b), (e) => I(b, e)), G(e, t);
		};
		q(c, (e) => {
			H(y) && H(se) && e(l);
		}), z(() => oi(r, 1, `flex items-center justify-between gap-1 text-left ${p() ?? "" ?? ""}`)), U("click", r, me), U("keydown", r, he), G(e, t);
	};
	return q(ye, (e) => {
		H(m) && !H(h) ? e(D) : e(be, -1);
	}), G(e, ve), Ue(_e);
}
yr([
	"keydown",
	"click",
	"input",
	"mousedown"
]), ki(so, {
	value: {},
	fkTargetTableId: {},
	fkTargetColumn: {},
	uiType: {},
	nullable: {},
	currentLabel: {},
	autoOpen: {},
	onClose: {},
	onCancel: {},
	onKeydown: {},
	emptyLabel: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LabelChip.svelte
var co = /* @__PURE__ */ W("<span class=\"badge\"> </span>"), lo = /* @__PURE__ */ W("<span> </span>");
function uo(e, t) {
	He(t, !0);
	let n = Y(t, "text", 7), r = Y(t, "color", 7);
	var i = {
		get text() {
			return n();
		},
		set text(e) {
			n(e), P();
		},
		get color() {
			return r();
		},
		set color(e) {
			r(e), P();
		}
	}, a = kr(), o = cn(a), s = (e) => {
		var t = co(), i = L(t, !0);
		j(t), z((e) => {
			ci(t, `background-color: ${r() ?? ""}; color: ${e ?? ""}`), K(i, n());
		}, [() => Va(r())]), G(e, t);
	}, c = /* @__PURE__ */ M(() => r() && za(r())), l = (e) => {
		var t = lo(), i = L(t, !0);
		j(t), z(() => {
			oi(t, 1, `badge ${Ra[r()] ?? Ra.gray ?? ""}`), K(i, n());
		}), G(e, t);
	};
	return q(o, (e) => {
		H(c) ? e(s) : e(l, -1);
	}), G(e, a), Ue(i);
}
ki(uo, {
	text: {},
	color: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LabelSelect.svelte
var fo = /* @__PURE__ */ W("<span class=\"truncate text-ink-400\"> </span>"), po = /* @__PURE__ */ W("<button type=\"button\"><!></button>"), mo = /* @__PURE__ */ W("<div class=\"overlay-scroll card fixed z-30 max-h-64 overflow-y-auto py-1 shadow-lg\"></div>"), ho = /* @__PURE__ */ W("<button type=\"button\"><!> <svg class=\"size-3 shrink-0 text-ink-400\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"6 9 12 15 18 9\"></polyline></svg></button> <!>", 1);
function go(e, t) {
	He(t, !0);
	let n = Y(t, "value", 15, ""), r = Y(t, "colors", 7), i = Y(t, "order", 7), a = Y(t, "autoOpen", 7, !1), o = Y(t, "onClose", 7), s = Y(t, "onCancel", 7), c = Y(t, "onKeydown", 7), l = Y(t, "emptyLabel", 7, "–"), u = Y(t, "class", 7), d = /* @__PURE__ */ F(!1), f = /* @__PURE__ */ F(void 0), p = /* @__PURE__ */ F(void 0), m = /* @__PURE__ */ F(null), h = /* @__PURE__ */ F(0), g = /* @__PURE__ */ M(() => ["", ...Ba(r(), i())]);
	function _() {
		if (!H(f)) return;
		let e = H(f).getBoundingClientRect();
		I(m, {
			top: e.bottom + 2,
			left: e.left,
			width: Math.max(e.width, 180)
		}, !0), I(h, Math.max(0, H(g).indexOf(n())), !0), I(d, !0);
	}
	function v() {
		I(d, !1), I(m, null);
	}
	function y() {
		v(), o()?.();
	}
	function b(e) {
		n(e), v(), o()?.();
	}
	function x() {
		H(d) ? y() : _();
	}
	function S(e) {
		if (!H(d)) {
			if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
				e.preventDefault(), _();
				return;
			}
			c()?.(e);
			return;
		}
		e.key === "ArrowDown" ? (e.preventDefault(), I(h, (H(h) + 1) % H(g).length)) : e.key === "ArrowUp" ? (e.preventDefault(), I(h, (H(h) - 1 + H(g).length) % H(g).length)) : e.key === "Enter" ? (e.preventDefault(), b(H(g)[H(h)])) : e.key === "Escape" && (e.preventDefault(), v(), s()?.());
	}
	vn(() => {
		a() && (H(f)?.focus(), _());
	}), vn(() => {
		if (!H(d)) return;
		function e(e) {
			let t = e.target;
			H(p)?.contains(t) || H(f)?.contains(t) || y();
		}
		return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
	});
	var C = {
		get value() {
			return n();
		},
		set value(e = "") {
			n(e), P();
		},
		get colors() {
			return r();
		},
		set colors(e) {
			r(e), P();
		},
		get order() {
			return i();
		},
		set order(e) {
			i(e), P();
		},
		get autoOpen() {
			return a();
		},
		set autoOpen(e = !1) {
			a(e), P();
		},
		get onClose() {
			return o();
		},
		set onClose(e) {
			o(e), P();
		},
		get onCancel() {
			return s();
		},
		set onCancel(e) {
			s(e), P();
		},
		get onKeydown() {
			return c();
		},
		set onKeydown(e) {
			c(e), P();
		},
		get emptyLabel() {
			return l();
		},
		set emptyLabel(e = "–") {
			l(e), P();
		},
		get class() {
			return u();
		},
		set class(e) {
			u(e), P();
		}
	}, ee = ho(), w = cn(ee), te = L(w), ne = (e) => {
		uo(e, {
			get text() {
				return n();
			},
			get color() {
				return r()[n()];
			}
		});
	}, T = (e) => {
		var t = fo(), n = L(t, !0);
		j(t), z(() => K(n, l())), G(e, t);
	};
	q(te, (e) => {
		n() ? e(ne) : e(T, -1);
	}), Pe(2), j(w), Ci(w, (e) => I(f, e), () => H(f));
	var re = R(w, 2), ie = (e) => {
		var t = mo();
		Ur(t, 22, () => H(g), (e) => e, (e, t, n) => {
			var i = po(), a = L(i), o = (e) => {
				uo(e, {
					get text() {
						return t;
					},
					get color() {
						return r()[t];
					}
				});
			}, s = (e) => {
				var t = fo(), n = L(t, !0);
				j(t), z(() => K(n, l())), G(e, t);
			};
			q(a, (e) => {
				t ? e(o) : e(s, -1);
			}), j(i), z(() => oi(i, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
					${H(n) === H(h) ? "bg-brand-50" : "hover:bg-ink-100"}`)), U("mousedown", i, (e) => e.preventDefault()), U("click", i, () => b(t)), G(e, i);
		}), j(t), Ci(t, (e) => I(p, e), () => H(p)), Zr(t, (e) => Ya?.(e)), z(() => ci(t, `min-width: ${H(m).width ?? ""}px; top: ${H(m).top ?? ""}px; left: ${H(m).left ?? ""}px`)), G(e, t);
	};
	return q(re, (e) => {
		H(d) && H(m) && e(ie);
	}), z(() => oi(w, 1, `flex items-center justify-between gap-1 text-left ${u() ?? "" ?? ""}`)), U("click", w, x), U("keydown", w, S), G(e, ee), Ue(C);
}
yr([
	"click",
	"keydown",
	"mousedown"
]), ki(go, {
	value: {},
	colors: {},
	order: {},
	autoOpen: {},
	onClose: {},
	onCancel: {},
	onKeydown: {},
	emptyLabel: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LinksSelect.svelte
var _o = /* @__PURE__ */ W("<div class=\"px-3 py-2 text-sm text-ink-500\"> </div>"), vo = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-ink-400\"> </div>"), yo = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-danger\"> </div>"), bo = /* @__PURE__ */ W("<button type=\"button\"><span class=\"truncate\"> </span></button>"), xo = /* @__PURE__ */ W("<div class=\"px-3 py-1 text-xs text-ink-400\"> </div>"), So = /* @__PURE__ */ W("<!> <!>", 1), Co = /* @__PURE__ */ W("<input type=\"text\" class=\"mx-2 mb-1 border-b border-ink-200 px-1 py-1 text-sm outline-none\"/> <div class=\"overlay-scroll overflow-y-auto\"><!></div>", 1), wo = /* @__PURE__ */ W("<div class=\"card fixed z-30 flex max-h-72 flex-col overflow-hidden py-1 shadow-lg\"><!></div>"), To = /* @__PURE__ */ W("<button type=\"button\">+</button> <!>", 1);
function Eo(e, t) {
	He(t, !0);
	let n = Y(t, "targetTableId", 7), r = Y(t, "excludeIds", 23, () => []), i = Y(t, "onSelect", 7), a = Y(t, "class", 7), o = /* @__PURE__ */ F(null), s = /* @__PURE__ */ F(null), c;
	function l() {
		return c ||= Ma(n()).then((e) => {
			let t = e.columns.find((e) => e.is_display_column);
			I(o, t && (t.field_kind === "physical" || t.field_kind === "auto_number" || t.field_kind === "formula") ? t.effective_name : null, !0), I(s, e.columns.find((e) => e.is_primary_key)?.effective_name ?? null, !0);
		}).catch(() => {
			I(o, null), I(s, null);
		}), c;
	}
	let u = /* @__PURE__ */ M(() => H(o) ?? H(s)), d = /* @__PURE__ */ F(!1), f = /* @__PURE__ */ F(""), p = /* @__PURE__ */ F(Qt([])), m = /* @__PURE__ */ F(!1), h = /* @__PURE__ */ F(!1), g = /* @__PURE__ */ F(!1), _ = /* @__PURE__ */ F(0), v = 0, y, b = /* @__PURE__ */ F(void 0), x = /* @__PURE__ */ F(void 0), S = /* @__PURE__ */ F(void 0), C = /* @__PURE__ */ F(null), ee = /* @__PURE__ */ M(() => new Set(r().map((e) => String(e)))), w = /* @__PURE__ */ M(() => H(p).filter((e) => !H(ee).has(String(e.id))));
	async function te(e) {
		if (!H(u) || !H(s)) return;
		let t = ++v;
		I(h, !0), I(g, !1);
		try {
			let r = await Hi(n(), {
				where: e ? {
					col: H(u),
					op: "like",
					val: e
				} : Mi,
				sort: [{
					column: H(u),
					desc: !1
				}],
				limit: 20
			});
			if (t !== v) return;
			I(p, r.records.map((e) => ({
				id: e[H(s)],
				label: String(e[H(u)] ?? "")
			})), !0), I(m, r.pageInfo.hasMore, !0);
		} catch {
			if (t !== v) return;
			I(g, !0), I(p, [], !0), I(m, !1);
		} finally {
			t === v && I(h, !1);
		}
	}
	function ne(e) {
		y && clearTimeout(y), y = setTimeout(() => te(e), 250);
	}
	function T() {
		if (!H(b)) return;
		let e = H(b).getBoundingClientRect();
		I(C, {
			top: e.bottom + 2,
			left: e.left,
			width: 220
		}, !0), I(d, !0), I(f, ""), I(_, 0), H(u) && H(s) && te(""), queueMicrotask(() => H(x)?.focus());
	}
	function re() {
		I(d, !1), I(C, null), y && clearTimeout(y);
	}
	async function ie() {
		await l(), H(d) ? re() : T();
	}
	function ae(e) {
		i()(e.id);
	}
	function oe(e) {
		let t = H(w).length;
		if (e.key === "ArrowDown") e.preventDefault(), t > 0 && I(_, (H(_) + 1) % t);
		else if (e.key === "ArrowUp") e.preventDefault(), t > 0 && I(_, (H(_) - 1 + t) % t);
		else if (e.key === "Enter") {
			e.preventDefault();
			let t = H(w)[H(_)];
			t && ae(t);
		} else e.key === "Escape" && (e.preventDefault(), re());
	}
	vn(() => {
		if (!H(d)) return;
		function e(e) {
			let t = e.target;
			H(S)?.contains(t) || H(b)?.contains(t) || re();
		}
		return document.addEventListener("mousedown", e, !0), () => document.removeEventListener("mousedown", e, !0);
	});
	var se = {
		get targetTableId() {
			return n();
		},
		set targetTableId(e) {
			n(e), P();
		},
		get excludeIds() {
			return r();
		},
		set excludeIds(e = []) {
			r(e), P();
		},
		get onSelect() {
			return i();
		},
		set onSelect(e) {
			i(e), P();
		},
		get class() {
			return a();
		},
		set class(e) {
			a(e), P();
		}
	}, ce = To(), le = cn(ce);
	Ci(le, (e) => I(b, e), () => H(b));
	var ue = R(le, 2), E = (e) => {
		var t = wo(), n = L(t), r = (e) => {
			var t = _o(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("linksSelect.noPrimaryKey")]), G(e, t);
		}, i = (e) => {
			var t = Co(), n = cn(t);
			pi(n), Ci(n, (e) => I(x, e), () => H(x));
			var r = R(n, 2), i = L(r), a = (e) => {
				var t = vo(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
			}, o = (e) => {
				var t = yo(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.errorLoading")]), G(e, t);
			}, s = (e) => {
				var t = vo(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.noResults")]), G(e, t);
			}, c = (e) => {
				var t = So(), n = cn(t);
				Ur(n, 19, () => H(w), (e) => String(e.id), (e, t, n) => {
					var r = bo(), i = L(r), a = L(i, !0);
					j(i), j(r), z(() => {
						oi(r, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
								${H(n) === H(_) ? "bg-brand-50" : "hover:bg-ink-100"}`), K(a, H(t).label);
					}), U("mousedown", r, (e) => e.preventDefault()), U("click", r, () => ae(H(t))), G(e, r);
				});
				var r = R(n, 2), i = (e) => {
					var t = xo(), n = L(t, !0);
					j(t), z((e) => K(n, e), [() => X("common.refineSearch")]), G(e, t);
				};
				q(r, (e) => {
					H(m) && e(i);
				}), G(e, t);
			};
			q(i, (e) => {
				H(h) ? e(a) : H(g) ? e(o, 1) : H(w).length === 0 ? e(s, 2) : e(c, -1);
			}), j(r), Zr(r, (e) => Ya?.(e)), z((e) => J(n, "placeholder", e), [() => X("common.search")]), U("input", n, () => ne(H(f))), U("keydown", n, oe), yi(n, () => H(f), (e) => I(f, e)), G(e, t);
		};
		q(n, (e) => {
			H(s) ? e(i, -1) : e(r);
		}), j(t), Ci(t, (e) => I(S, e), () => H(S)), z(() => ci(t, `min-width: ${H(C).width ?? ""}px; top: ${H(C).top ?? ""}px; left: ${H(C).left ?? ""}px`)), G(e, t);
	};
	return q(ue, (e) => {
		H(d) && H(C) && e(E);
	}), z((e, t) => {
		oi(le, 1, `badge shrink-0 bg-ink-100 text-ink-500 hover:bg-ink-200 hover:text-ink-700 ${a() ?? "" ?? ""}`), J(le, "aria-label", e), J(le, "title", t);
	}, [() => X("linksSelect.addLink"), () => X("linksSelect.addLink")]), U("click", le, ie), G(e, ce), Ue(se);
}
yr([
	"click",
	"input",
	"keydown",
	"mousedown"
]), ki(Eo, {
	targetTableId: {},
	excludeIds: {},
	onSelect: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region node_modules/marked/lib/marked.esm.js
function Do() {
	return {
		async: !1,
		breaks: !1,
		extensions: null,
		gfm: !0,
		hooks: null,
		pedantic: !1,
		renderer: null,
		silent: !1,
		tokenizer: null,
		walkTokens: null
	};
}
var Oo = Do();
function ko(e) {
	Oo = e;
}
var Ao = { exec: () => null };
function jo(e) {
	let t = [];
	return (n) => {
		let r = Math.max(0, Math.min(3, n - 1)), i = t[r];
		return i || (i = e(r), t[r] = i), i;
	};
}
function Z(e, t = "") {
	let n = typeof e == "string" ? e : e.source, r = {
		replace: (e, t) => {
			let i = typeof t == "string" ? t : t.source;
			return i = i.replace(No.caret, "$1"), n = n.replace(e, i), r;
		},
		getRegex: () => new RegExp(n, t)
	};
	return r;
}
var Mo = ((e = "") => {
	try {
		return !!RegExp("(?<=1)(?<!1)" + e);
	} catch {
		return !1;
	}
})(), No = {
	codeRemoveIndent: /^(?: {1,4}| {0,3}\t)/gm,
	outputLinkReplace: /\\([\[\]])/g,
	indentCodeCompensation: /^(\s+)(?:```)/,
	beginningSpace: /^\s+/,
	endingHash: /#$/,
	startingSpaceChar: /^ /,
	endingSpaceChar: / $/,
	nonSpaceChar: /[^ ]/,
	newLineCharGlobal: /\n/g,
	tabCharGlobal: /\t/g,
	multipleSpaceGlobal: /\s+/g,
	blankLine: /^[ \t]*$/,
	doubleBlankLine: /\n[ \t]*\n[ \t]*$/,
	blockquoteStart: /^ {0,3}>/,
	blockquoteSetextReplace: /\n {0,3}((?:=+|-+) *)(?=\n|$)/g,
	blockquoteSetextReplace2: /^ {0,3}>[ \t]?/gm,
	listReplaceNesting: /^ {1,4}(?=( {4})*[^ ])/g,
	listIsTask: /^\[[ xX]\] +\S/,
	listReplaceTask: /^\[[ xX]\] +/,
	listTaskCheckbox: /\[[ xX]\]/,
	anyLine: /\n.*\n/,
	hrefBrackets: /^<(.*)>$/,
	tableDelimiter: /[:|]/,
	tableAlignChars: /^\||\| *$/g,
	tableRowBlankLine: /\n[ \t]*$/,
	tableAlignRight: /^ *-+: *$/,
	tableAlignCenter: /^ *:-+: *$/,
	tableAlignLeft: /^ *:-+ *$/,
	startATag: /^<a /i,
	endATag: /^<\/a>/i,
	startPreScriptTag: /^<(pre|code|kbd|script)(\s|>)/i,
	endPreScriptTag: /^<\/(pre|code|kbd|script)(\s|>)/i,
	startAngleBracket: /^</,
	endAngleBracket: />$/,
	pedanticHrefTitle: /^([^'"]*[^\s])\s+(['"])(.*)\2/,
	unicodeAlphaNumeric: /[\p{L}\p{N}]/u,
	escapeTest: /[&<>"']/,
	escapeReplace: /[&<>"']/g,
	escapeTestNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,
	escapeReplaceNoEncode: /[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,
	caret: /(^|[^\[])\^/g,
	percentDecode: /%25/g,
	findPipe: /\|/g,
	splitPipe: / \|/,
	slashPipe: /\\\|/g,
	carriageReturn: /\r\n|\r/g,
	spaceLine: /^ +$/gm,
	notSpaceStart: /^\S*/,
	endingNewline: /\n$/,
	listItemRegex: (e) => RegExp(`^( {0,3}${e})((?:[	 ][^\\n]*)?(?:\\n|$))`),
	nextBulletRegex: jo((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`)),
	hrRegex: jo((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
	fencesBeginRegex: jo((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
	headingBeginRegex: jo((e) => RegExp(`^ {0,${e}}#`)),
	htmlBeginRegex: jo((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
	blockquoteBeginRegex: jo((e) => RegExp(`^ {0,${e}}>`))
}, Po = /^(?:[ \t]*(?:\n|$))+/, Fo = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Io = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, Lo = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ro = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, zo = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Bo = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Vo = Z(Bo).replace(/bull/g, zo).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex(), Ho = Z(Bo).replace(/bull/g, zo).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(), Uo = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, Wo = /^[^\n]+/, Go = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ko = Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", Go).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), qo = Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, zo).getRegex(), Jo = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul", Yo = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Xo = Z("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))", "i").replace("comment", Yo).replace("tag", Jo).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), Zo = (e) => Z(Uo).replace("hr", Lo).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", e).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Jo).getRegex(), Qo = Zo(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), $o = Zo(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), es = {
	blockquote: Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", $o).getRegex(),
	code: Fo,
	def: Ko,
	fences: Io,
	heading: Ro,
	hr: Lo,
	html: Xo,
	lheading: Vo,
	list: qo,
	newline: Po,
	paragraph: Qo,
	table: Ao,
	text: Wo
}, ts = Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", Lo).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3}	)[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Jo).getRegex(), ns = {
	...es,
	lheading: Ho,
	table: ts,
	paragraph: Z(Uo).replace("hr", Lo).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ts).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~~~)[^\\n]*\\n").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", Jo).getRegex()
}, rs = {
	...es,
	html: Z("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", Yo).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),
	def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
	heading: /^(#{1,6})(.*)(?:\n+|$)/,
	fences: Ao,
	lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
	paragraph: Z(Uo).replace("hr", Lo).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Vo).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, is = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, as = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, os = /^( {2,}|\\)\n(?!\s*$)/, ss = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, cs = /[\p{P}\p{S}]/u, ls = /[\s\p{P}\p{S}]/u, us = /[^\s\p{P}\p{S}]/u, ds = Z(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, ls).getRegex(), fs = /[\p{Pi}\p{Ps}"']/u, ps = /(?!~)[\p{P}\p{S}]/u, ms = /(?!~)[\s\p{P}\p{S}]/u, hs = /(?:[^\s\p{P}\p{S}]|~)/u, gs = Z(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Mo ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), _s = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, vs = Z(_s, "u").replace(/punct/g, cs).getRegex(), ys = Z(_s, "u").replace(/punct/g, ps).getRegex(), bs = Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, fs).replace(/punct/g, cs).getRegex(), xs = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", Ss = Z(xs, "gu").replace(/notPunctSpace/g, us).replace(/punctSpace/g, ls).replace(/punct/g, cs).getRegex(), Cs = Z(xs, "gu").replace(/notPunctSpace/g, hs).replace(/punctSpace/g, ms).replace(/punct/g, ps).getRegex(), ws = Z("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, us).replace(/punctSpace/g, ls).replace(/punct/g, cs).getRegex(), Ts = Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, us).replace(/punctSpace/g, ls).replace(/punct/g, cs).getRegex(), Es = Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, us).replace(/punctSpace/g, ls).replace(/punct/g, cs).getRegex(), Ds = Z(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, cs).getRegex(), Os = Z("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, us).replace(/punctSpace/g, ls).replace(/punct/g, cs).getRegex(), ks = Z(/\\(punct)/, "gu").replace(/punct/g, cs).getRegex(), As = Z(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(), js = Z(Yo).replace("(?:-->|$)", "-->").getRegex(), Ms = Z("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", js).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Ns = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Ps = Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Ns).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Fs = Z(/^!?\[(label)\]\[(ref)\]/).replace("label", Ns).replace("ref", Go).getRegex(), Is = Z(/^!?\[(ref)\](?:\[\])?/).replace("ref", Go).getRegex(), Ls = Z("reflink|nolink(?!\\()", "g").replace("reflink", Fs).replace("nolink", Is).getRegex(), Rs = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, zs = {
	_backpedal: Ao,
	anyPunctuation: ks,
	autolink: As,
	blockSkip: gs,
	br: os,
	code: as,
	del: Ao,
	delLDelim: Ao,
	delRDelim: Ao,
	emStrongLDelim: vs,
	emStrongRDelimAst: Ss,
	emStrongRDelimUnd: Ts,
	escape: is,
	link: Ps,
	nolink: Is,
	punctuation: ds,
	reflink: Fs,
	reflinkSearch: Ls,
	tag: Ms,
	text: ss,
	url: Ao
}, Bs = {
	...zs,
	emStrongLDelim: bs,
	emStrongRDelimAst: ws,
	emStrongRDelimUnd: Es,
	link: Z(/^!?\[(label)\]\((.*?)\)/).replace("label", Ns).getRegex(),
	reflink: Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Ns).getRegex()
}, Vs = {
	...zs,
	emStrongRDelimAst: Cs,
	emStrongLDelim: ys,
	delLDelim: Ds,
	delRDelim: Os,
	url: Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Rs).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),
	_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
	del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
	text: Z(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol", Rs).getRegex()
}, Hs = {
	...Vs,
	br: Z(os).replace("{2,}", "*").getRegex(),
	text: Z(Vs.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, Us = {
	normal: es,
	gfm: ns,
	pedantic: rs
}, Ws = {
	normal: zs,
	gfm: Vs,
	breaks: Hs,
	pedantic: Bs
}, Gs = {
	"&": "&amp;",
	"<": "&lt;",
	">": "&gt;",
	"\"": "&quot;",
	"'": "&#39;"
}, Ks = (e) => Gs[e];
function qs(e, t) {
	if (t) {
		if (No.escapeTest.test(e)) return e.replace(No.escapeReplace, Ks);
	} else if (No.escapeTestNoEncode.test(e)) return e.replace(No.escapeReplaceNoEncode, Ks);
	return e;
}
function Js(e) {
	try {
		e = encodeURI(e).replace(No.percentDecode, "%");
	} catch {
		return null;
	}
	return e;
}
function Ys(e, t) {
	let n = e.replace(No.findPipe, (e, t, n) => {
		let r = !1, i = t;
		for (; --i >= 0 && n[i] === "\\";) r = !r;
		return r ? "|" : " |";
	}).split(No.splitPipe), r = 0;
	if (n[0].trim() || n.shift(), n.length > 0 && !n.at(-1)?.trim() && n.pop(), t) {
		if (n.length > t) n.splice(t);
		else for (; n.length < t;) n.push("");
	}
	for (; r < n.length; r++) n[r] = n[r].trim().replace(No.slashPipe, "|");
	return n;
}
function Xs(e, t, n) {
	let r = e.length;
	if (r === 0) return "";
	let i = 0;
	for (; i < r;) {
		let a = e.charAt(r - i - 1);
		if (a === t && !n) i++;
		else if (a !== t && n) i++;
		else break;
	}
	return e.slice(0, r - i);
}
function Zs(e) {
	let t = e.split("\n"), n = t.length - 1;
	for (; n >= 0 && No.blankLine.test(t[n]);) n--;
	return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
}
function Qs(e, t) {
	if (e.indexOf(t[1]) === -1) return -1;
	let n = 0;
	for (let r = 0; r < e.length; r++) if (e[r] === "\\") r++;
	else if (e[r] === t[0]) n++;
	else if (e[r] === t[1] && (n--, n < 0)) return r;
	return n > 0 ? -2 : -1;
}
function $s(e, t = 0) {
	let n = t, r = "";
	for (let t of e) if (t === "	") {
		let e = 4 - n % 4;
		r += " ".repeat(e), n += e;
	} else r += t, n++;
	return r;
}
function ec(e, t, n, r, i) {
	let a = t.href, o = t.title || null, s = e[1].replace(i.other.outputLinkReplace, "$1");
	r.state.inLink = !0;
	let c = {
		type: e[0].charAt(0) === "!" ? "image" : "link",
		raw: n,
		href: a,
		title: o,
		text: s,
		tokens: r.inlineTokens(s)
	};
	return r.state.inLink = !1, c;
}
function tc(e, t, n) {
	let r = e.match(n.other.indentCodeCompensation);
	if (r === null) return t;
	let i = r[1];
	return t.split("\n").map((e) => {
		let t = e.match(n.other.beginningSpace);
		if (t === null) return e;
		let [r] = t;
		return r.length >= i.length ? e.slice(i.length) : e;
	}).join("\n");
}
var nc = class {
	options;
	rules;
	lexer;
	constructor(e) {
		this.options = e || Oo;
	}
	space(e) {
		let t = this.rules.block.newline.exec(e);
		if (t && t[0].length > 0) return {
			type: "space",
			raw: t[0]
		};
	}
	code(e) {
		let t = this.rules.block.code.exec(e);
		if (t) {
			let e = this.options.pedantic ? t[0] : Zs(t[0]);
			return {
				type: "code",
				raw: e,
				codeBlockStyle: "indented",
				text: e.replace(this.rules.other.codeRemoveIndent, "")
			};
		}
	}
	fences(e) {
		let t = this.rules.block.fences.exec(e);
		if (t) {
			let e = t[0], n = tc(e, t[3] || "", this.rules);
			return {
				type: "code",
				raw: e,
				lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2],
				text: n
			};
		}
	}
	heading(e) {
		let t = this.rules.block.heading.exec(e);
		if (t) {
			let e = t[2].trim();
			if (this.rules.other.endingHash.test(e)) {
				let t = Xs(e, "#");
				(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
			}
			return {
				type: "heading",
				raw: Xs(t[0], "\n"),
				depth: t[1].length,
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	hr(e) {
		let t = this.rules.block.hr.exec(e);
		if (t) return {
			type: "hr",
			raw: Xs(t[0], "\n")
		};
	}
	blockquote(e) {
		let t = this.rules.block.blockquote.exec(e);
		if (t) {
			let e = Xs(t[0], "\n").split("\n"), n = "", r = "", i = [];
			for (; e.length > 0;) {
				let t = !1, a = [], o;
				for (o = 0; o < e.length; o++) if (this.rules.other.blockquoteStart.test(e[o])) a.push(e[o]), t = !0;
				else if (!t) a.push(e[o]);
				else break;
				e = e.slice(o);
				let s = a.join("\n"), c = s.replace(this.rules.other.blockquoteSetextReplace, "\n    $1").replace(this.rules.other.blockquoteSetextReplace2, "");
				n = n ? `${n}
${s}` : s, r = r ? `${r}
${c}` : c;
				let l = this.lexer.state.top;
				if (this.lexer.state.top = !0, this.lexer.blockTokens(c, i, !0), this.lexer.state.top = l, e.length === 0) break;
				let u = i.at(-1);
				if (u?.type === "code") break;
				if (u?.type === "blockquote") {
					let t = u, a = e.join("\n"), o = t.raw + "\n" + a.replace(this.rules.other.blockquoteSetextReplace2, ""), s = this.blockquote(o);
					i[i.length - 1] = s, n = `${n}
${a}`, r = r.substring(0, r.length - t.text.length) + s.text;
					break;
				}
				if (u?.type === "list") {
					let t = u, a = t.raw + "\n" + e.join("\n"), o = this.list(a);
					i[i.length - 1] = o, n = n.substring(0, n.length - u.raw.length) + o.raw, r = r.substring(0, r.length - t.raw.length) + o.raw, e = a.substring(i.at(-1).raw.length).split("\n");
					continue;
				}
			}
			return {
				type: "blockquote",
				raw: n,
				tokens: i,
				text: r
			};
		}
	}
	list(e) {
		let t = this.rules.block.list.exec(e);
		if (t) {
			let n = t[1].trim(), r = n.length > 1, i = {
				type: "list",
				raw: "",
				ordered: r,
				start: r ? +n.slice(0, -1) : "",
				loose: !1,
				items: []
			};
			n = r ? `\\d{1,9}\\${n.slice(-1)}` : `\\${n}`, this.options.pedantic && (n = r ? n : "[*+-]");
			let a = this.rules.other.listItemRegex(n), o = !1;
			for (; e;) {
				let n = !1, r = "", s = "";
				if (!(t = a.exec(e)) || this.rules.block.hr.test(e)) break;
				r = t[0], e = e.substring(r.length);
				let c = $s(t[2].split("\n", 1)[0], t[1].length), l = e.split("\n", 1)[0], u = !c.trim(), d = 0;
				if (this.options.pedantic ? (d = 2, s = c.trimStart()) : u ? d = t[1].length + 1 : (d = c.search(this.rules.other.nonSpaceChar), d = d > 4 ? 1 : d, s = c.slice(d), d += t[1].length), u && this.rules.other.blankLine.test(l) && (r += l + "\n", e = e.substring(l.length + 1), n = !0), !n) {
					let t = this.rules.other.nextBulletRegex(d), n = this.rules.other.hrRegex(d), i = this.rules.other.fencesBeginRegex(d), a = this.rules.other.headingBeginRegex(d), o = this.rules.other.htmlBeginRegex(d), f = this.rules.other.blockquoteBeginRegex(d);
					for (; e;) {
						let p = e.split("\n", 1)[0], m;
						if (l = p, this.options.pedantic ? (l = l.replace(this.rules.other.listReplaceNesting, "  "), m = l) : m = l.replace(this.rules.other.tabCharGlobal, "    "), i.test(l) || a.test(l) || o.test(l) || f.test(l) || t.test(l) || n.test(l)) break;
						if (m.search(this.rules.other.nonSpaceChar) >= d || !l.trim()) s += "\n" + m.slice(d);
						else {
							if (u || c.replace(this.rules.other.tabCharGlobal, "    ").search(this.rules.other.nonSpaceChar) >= 4 || i.test(c) || a.test(c) || n.test(c)) break;
							s += "\n" + l;
						}
						u = !l.trim(), r += p + "\n", e = e.substring(p.length + 1), c = m.slice(d);
					}
				}
				i.loose || (o ? i.loose = !0 : this.rules.other.doubleBlankLine.test(r) && (o = !0)), i.items.push({
					type: "list_item",
					raw: r,
					task: !!this.options.gfm && this.rules.other.listIsTask.test(s),
					loose: !1,
					text: s,
					tokens: []
				}), i.raw += r;
			}
			let s = i.items.at(-1);
			if (s) s.raw = s.raw.trimEnd(), s.text = s.text.trimEnd();
			else return;
			i.raw = i.raw.trimEnd();
			for (let e of i.items) {
				this.lexer.state.top = !1, e.tokens = this.lexer.blockTokens(e.text, []);
				let t = e.tokens[0];
				if (e.task && (t?.type === "text" || t?.type === "paragraph")) {
					e.text = e.text.replace(this.rules.other.listReplaceTask, ""), t.raw = t.raw.replace(this.rules.other.listReplaceTask, ""), t.text = t.text.replace(this.rules.other.listReplaceTask, "");
					for (let e = this.lexer.inlineQueue.length - 1; e >= 0; e--) if (this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)) {
						this.lexer.inlineQueue[e].src = this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask, "");
						break;
					}
					let n = this.rules.other.listTaskCheckbox.exec(e.raw);
					if (n) {
						let t = {
							type: "checkbox",
							raw: n[0] + " ",
							checked: n[0] !== "[ ]"
						};
						e.checked = t.checked, i.loose ? e.tokens[0] && ["paragraph", "text"].includes(e.tokens[0].type) && "tokens" in e.tokens[0] && e.tokens[0].tokens ? (e.tokens[0].raw = t.raw + e.tokens[0].raw, e.tokens[0].text = t.raw + e.tokens[0].text, e.tokens[0].tokens.unshift(t)) : e.tokens.unshift({
							type: "paragraph",
							raw: t.raw,
							text: t.raw,
							tokens: [t]
						}) : e.tokens.unshift(t);
					}
				} else e.task &&= !1;
				if (!i.loose) {
					let t = e.tokens.filter((e) => e.type === "space");
					i.loose = t.length > 0 && t.some((e) => this.rules.other.anyLine.test(e.raw));
				}
			}
			if (i.loose) for (let e of i.items) {
				e.loose = !0;
				for (let t of e.tokens) t.type === "text" && (t.type = "paragraph");
			}
			return i;
		}
	}
	html(e) {
		let t = this.rules.block.html.exec(e);
		if (t) {
			let e = Zs(t[0]);
			return {
				type: "html",
				block: !0,
				raw: e,
				pre: t[1] === "pre" || t[1] === "script" || t[1] === "style",
				text: e
			};
		}
	}
	def(e) {
		let t = this.rules.block.def.exec(e);
		if (t) {
			let e = t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal, " "), n = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
			return {
				type: "def",
				tag: e,
				raw: Xs(t[0], "\n"),
				href: n,
				title: r
			};
		}
	}
	table(e) {
		let t = this.rules.block.table.exec(e);
		if (!t || !this.rules.other.tableDelimiter.test(t[2])) return;
		let n = Ys(t[1]), r = t[2].replace(this.rules.other.tableAlignChars, "").split("|"), i = t[3]?.trim() ? t[3].replace(this.rules.other.tableRowBlankLine, "").split("\n") : [], a = {
			type: "table",
			raw: Xs(t[0], "\n"),
			header: [],
			align: [],
			rows: []
		};
		if (n.length === r.length) {
			for (let e of r) this.rules.other.tableAlignRight.test(e) ? a.align.push("right") : this.rules.other.tableAlignCenter.test(e) ? a.align.push("center") : this.rules.other.tableAlignLeft.test(e) ? a.align.push("left") : a.align.push(null);
			for (let e = 0; e < n.length; e++) a.header.push({
				text: n[e],
				tokens: this.lexer.inline(n[e]),
				header: !0,
				align: a.align[e]
			});
			for (let e of i) a.rows.push(Ys(e, a.header.length).map((e, t) => ({
				text: e,
				tokens: this.lexer.inline(e),
				header: !1,
				align: a.align[t]
			})));
			return a;
		}
	}
	lheading(e) {
		let t = this.rules.block.lheading.exec(e);
		if (t) {
			let e = t[1].trim();
			return {
				type: "heading",
				raw: Xs(t[0], "\n"),
				depth: t[2].charAt(0) === "=" ? 1 : 2,
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	paragraph(e) {
		let t = this.rules.block.paragraph.exec(e);
		if (t) {
			let e = t[1].charAt(t[1].length - 1) === "\n" ? t[1].slice(0, -1) : t[1];
			return {
				type: "paragraph",
				raw: t[0],
				text: e,
				tokens: this.lexer.inline(e)
			};
		}
	}
	text(e) {
		let t = this.rules.block.text.exec(e);
		if (t) return {
			type: "text",
			raw: t[0],
			text: t[0],
			tokens: this.lexer.inline(t[0])
		};
	}
	escape(e) {
		let t = this.rules.inline.escape.exec(e);
		if (t) return {
			type: "escape",
			raw: t[0],
			text: t[1]
		};
	}
	tag(e) {
		let t = this.rules.inline.tag.exec(e);
		if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = !0 : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = !1), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = !0 : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = !1), {
			type: "html",
			raw: t[0],
			inLink: this.lexer.state.inLink,
			inRawBlock: this.lexer.state.inRawBlock,
			block: !1,
			text: t[0]
		};
	}
	link(e) {
		let t = this.rules.inline.link.exec(e);
		if (t) {
			let e = t[2].trim();
			if (!this.options.pedantic && this.rules.other.startAngleBracket.test(e)) {
				if (!this.rules.other.endAngleBracket.test(e)) return;
				let t = Xs(e.slice(0, -1), "\\");
				if ((e.length - t.length) % 2 == 0) return;
			} else {
				let e = Qs(t[2], "()");
				if (e === -2) return;
				if (e > -1) {
					let n = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + e;
					t[2] = t[2].substring(0, e), t[0] = t[0].substring(0, n).trim(), t[3] = "";
				}
			}
			let n = t[2], r = "";
			if (this.options.pedantic) {
				let e = this.rules.other.pedanticHrefTitle.exec(n);
				e && (n = e[1], r = e[3]);
			} else r = t[3] ? t[3].slice(1, -1) : "";
			return n = n.trim(), this.rules.other.startAngleBracket.test(n) && (n = this.options.pedantic && !this.rules.other.endAngleBracket.test(e) ? n.slice(1) : n.slice(1, -1)), ec(t, {
				href: n && n.replace(this.rules.inline.anyPunctuation, "$1"),
				title: r && r.replace(this.rules.inline.anyPunctuation, "$1")
			}, t[0], this.lexer, this.rules);
		}
	}
	reflink(e, t) {
		let n;
		if ((n = this.rules.inline.reflink.exec(e)) || (n = this.rules.inline.nolink.exec(e))) {
			let e = t[(n[2] || n[1]).replace(this.rules.other.multipleSpaceGlobal, " ").toLowerCase()];
			if (!e) {
				let e = n[0].charAt(0);
				return {
					type: "text",
					raw: e,
					text: e
				};
			}
			return ec(n, e, n[0], this.lexer, this.rules);
		}
	}
	emStrong(e, t, n = "") {
		let r = this.rules.inline.emStrongLDelim.exec(e);
		if (!(!r || !r[1] && !r[2] && !r[3] && !r[4] || r[4] && n.match(this.rules.other.unicodeAlphaNumeric)) && (!(r[1] || r[3]) || !n || this.rules.inline.punctuation.exec(n))) {
			let i = [...r[0]].length - 1, a, o, s = i, c = 0, l = r[0][0], u = n === l, d = l === "*" ? this.rules.inline.emStrongRDelimAst : this.rules.inline.emStrongRDelimUnd;
			for (d.lastIndex = 0, t = t.slice(-1 * e.length + i); (r = d.exec(t)) !== null;) {
				if (a = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !a) continue;
				if (o = [...a].length, r[3] || r[4]) {
					s += o;
					continue;
				}
				if (r[5] || r[6]) {
					if (i % 3 && !((i + o) % 3)) {
						c += o;
						continue;
					}
					if (u) break;
				}
				if (s -= o, s > 0) continue;
				o = Math.min(o, o + s + c);
				let t = [...r[0]][0].length, n = e.slice(0, i + r.index + t + o);
				if (Math.min(i, o) % 2) {
					let e = n.slice(1, -1);
					return {
						type: "em",
						raw: n,
						text: e,
						tokens: this.lexer.inlineTokens(e)
					};
				}
				let l = n.slice(2, -2);
				return {
					type: "strong",
					raw: n,
					text: l,
					tokens: this.lexer.inlineTokens(l)
				};
			}
		}
	}
	codespan(e) {
		let t = this.rules.inline.code.exec(e);
		if (t) {
			let e = t[2].replace(this.rules.other.newLineCharGlobal, " "), n = this.rules.other.nonSpaceChar.test(e), r = this.rules.other.startingSpaceChar.test(e) && this.rules.other.endingSpaceChar.test(e);
			return n && r && (e = e.substring(1, e.length - 1)), {
				type: "codespan",
				raw: t[0],
				text: e
			};
		}
	}
	br(e) {
		let t = this.rules.inline.br.exec(e);
		if (t) return {
			type: "br",
			raw: t[0]
		};
	}
	del(e, t, n = "") {
		let r = this.rules.inline.delLDelim.exec(e);
		if (r && (!r[1] || !n || this.rules.inline.punctuation.exec(n))) {
			let n = [...r[0]].length - 1, i, a, o = n, s = this.rules.inline.delRDelim;
			for (s.lastIndex = 0, t = t.slice(-1 * e.length + n); (r = s.exec(t)) !== null;) {
				if (i = r[1] || r[2] || r[3] || r[4] || r[5] || r[6], !i || (a = [...i].length, a !== n)) continue;
				if (r[3] || r[4]) {
					o += a;
					continue;
				}
				if (o -= a, o > 0) continue;
				a = Math.min(a, a + o);
				let t = [...r[0]][0].length, s = e.slice(0, n + r.index + t + a), c = s.slice(n, -n);
				return {
					type: "del",
					raw: s,
					text: c,
					tokens: this.lexer.inlineTokens(c)
				};
			}
		}
	}
	autolink(e) {
		let t = this.rules.inline.autolink.exec(e);
		if (t) {
			let e, n;
			return t[2] === "@" ? (e = t[1], n = "mailto:" + e) : (e = t[1], n = e), {
				type: "link",
				raw: t[0],
				text: e,
				href: n,
				tokens: [{
					type: "text",
					raw: e,
					text: e
				}]
			};
		}
	}
	url(e) {
		let t;
		if (t = this.rules.inline.url.exec(e)) {
			let e, n;
			if (t[2] === "@") e = t[0], n = "mailto:" + e;
			else {
				let r;
				do
					r = t[0], t[0] = this.rules.inline._backpedal.exec(t[0])?.[0] ?? "";
				while (r !== t[0]);
				e = t[0], n = t[1] === "www." ? "http://" + t[0] : t[0];
			}
			return {
				type: "link",
				raw: t[0],
				text: e,
				href: n,
				tokens: [{
					type: "text",
					raw: e,
					text: e
				}]
			};
		}
	}
	inlineText(e) {
		let t = this.rules.inline.text.exec(e);
		if (t) {
			let e = this.lexer.state.inRawBlock;
			return {
				type: "text",
				raw: t[0],
				text: t[0],
				escaped: e
			};
		}
	}
}, rc = class e {
	tokens;
	options;
	state;
	inlineQueue;
	tokenizer;
	constructor(e) {
		this.tokens = [], this.tokens.links = Object.create(null), this.options = e || Oo, this.options.tokenizer = this.options.tokenizer || new nc(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = {
			inLink: !1,
			inRawBlock: !1,
			top: !0
		};
		let t = {
			other: No,
			block: Us.normal,
			inline: Ws.normal
		};
		this.options.pedantic ? (t.block = Us.pedantic, t.inline = Ws.pedantic) : this.options.gfm && (t.block = Us.gfm, t.inline = this.options.breaks ? Ws.breaks : Ws.gfm), this.tokenizer.rules = t;
	}
	static get rules() {
		return {
			block: Us,
			inline: Ws
		};
	}
	static lex(t, n) {
		return new e(n).lex(t);
	}
	static lexInline(t, n) {
		return new e(n).inlineTokens(t);
	}
	lex(e) {
		e = e.replace(No.carriageReturn, "\n"), this.blockTokens(e, this.tokens);
		for (let e = 0; e < this.inlineQueue.length; e++) {
			let t = this.inlineQueue[e];
			this.inlineTokens(t.src, t.tokens);
		}
		return this.inlineQueue = [], this.tokens;
	}
	blockTokens(e, t = [], n = !1) {
		this.tokenizer.lexer = this, this.options.pedantic && (e = e.replace(No.tabCharGlobal, "    ").replace(No.spaceLine, ""));
		let r = 1 / 0;
		for (; e;) {
			if (e.length < r) r = e.length;
			else {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
			let i;
			if (this.options.extensions?.block?.some((n) => (i = n.call({ lexer: this }, e, t)) ? (e = e.substring(i.raw.length), t.push(i), !0) : !1)) continue;
			if (i = this.tokenizer.space(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				i.raw.length === 1 && n !== void 0 ? n.raw += "\n" : t.push(i);
				continue;
			}
			if (i = this.tokenizer.code(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.at(-1).src = n.text) : t.push(i);
				continue;
			}
			if (i = this.tokenizer.fences(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.heading(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.hr(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.blockquote(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.list(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.html(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.def(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				n?.type === "paragraph" || n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.raw, this.inlineQueue.at(-1).src = n.text) : this.tokens.links[i.tag] || (this.tokens.links[i.tag] = {
					href: i.href,
					title: i.title
				}, t.push(i));
				continue;
			}
			if (i = this.tokenizer.table(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			if (i = this.tokenizer.lheading(e)) {
				e = e.substring(i.raw.length), t.push(i);
				continue;
			}
			let a = e;
			if (this.options.extensions?.startBlock) {
				let t = 1 / 0, n = e.slice(1), r;
				this.options.extensions.startBlock.forEach((e) => {
					r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
				}), t < 1 / 0 && t >= 0 && (a = e.substring(0, t + 1));
			}
			if (this.state.top && (i = this.tokenizer.paragraph(a))) {
				let r = t.at(-1);
				n && r?.type === "paragraph" ? (r.raw += (r.raw.endsWith("\n") ? "" : "\n") + i.raw, r.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = r.text) : t.push(i), n = a.length !== e.length, e = e.substring(i.raw.length);
				continue;
			}
			if (i = this.tokenizer.text(e)) {
				e = e.substring(i.raw.length);
				let n = t.at(-1);
				n?.type === "text" ? (n.raw += (n.raw.endsWith("\n") ? "" : "\n") + i.raw, n.text += "\n" + i.text, this.inlineQueue.pop(), this.inlineQueue.at(-1).src = n.text) : t.push(i);
				continue;
			}
			if (e) {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
		}
		return this.state.top = !0, t;
	}
	inline(e, t = []) {
		return this.inlineQueue.push({
			src: e,
			tokens: t
		}), t;
	}
	inlineTokens(e, t = []) {
		this.tokenizer.lexer = this;
		let n = e;
		if (this.tokens.links) {
			let e = Object.keys(this.tokens.links);
			e.length > 0 && (n = n.replace(this.tokenizer.rules.inline.reflinkSearch, (t) => e.includes(t.slice(t.lastIndexOf("[") + 1, -1)) ? "[" + "a".repeat(t.length - 2) + "]" : t));
		}
		n = n.replace(this.tokenizer.rules.inline.anyPunctuation, "++"), n = n.replace(this.tokenizer.rules.inline.blockSkip, (e, t, n) => {
			let r = n ? n.length : 0;
			return e.slice(0, r) + "[" + "a".repeat(e.length - r - 2) + "]";
		}), n = this.options.hooks?.emStrongMask?.call({ lexer: this }, n) ?? n;
		let r = !1, i = "", a = 1 / 0;
		for (; e;) {
			if (e.length < a) a = e.length;
			else {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
			r || (i = ""), r = !1;
			let o;
			if (this.options.extensions?.inline?.some((n) => (o = n.call({ lexer: this }, e, t)) ? (e = e.substring(o.raw.length), t.push(o), !0) : !1)) continue;
			if (o = this.tokenizer.escape(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.tag(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.link(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.reflink(e, this.tokens.links)) {
				e = e.substring(o.raw.length);
				let n = t.at(-1);
				o.type === "text" && n?.type === "text" ? (n.raw += o.raw, n.text += o.text) : t.push(o);
				continue;
			}
			if (o = this.tokenizer.emStrong(e, n, i)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.codespan(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.br(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.del(e, n, i)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (o = this.tokenizer.autolink(e)) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			if (!this.state.inLink && (o = this.tokenizer.url(e))) {
				e = e.substring(o.raw.length), t.push(o);
				continue;
			}
			let s = e;
			if (this.options.extensions?.startInline) {
				let t = 1 / 0, n = e.slice(1), r;
				this.options.extensions.startInline.forEach((e) => {
					r = e.call({ lexer: this }, n), typeof r == "number" && r >= 0 && (t = Math.min(t, r));
				}), t < 1 / 0 && t >= 0 && (s = e.substring(0, t + 1));
			}
			if (o = this.tokenizer.inlineText(s)) {
				e = e.substring(o.raw.length), o.raw.slice(-1) !== "_" && (i = o.raw.slice(-1)), r = !0;
				let n = t.at(-1);
				n?.type === "text" ? (n.raw += o.raw, n.text += o.text) : t.push(o);
				continue;
			}
			if (e) {
				this.infiniteLoopError(e.charCodeAt(0));
				break;
			}
		}
		return t;
	}
	infiniteLoopError(e) {
		let t = "Infinite loop on byte: " + e;
		if (this.options.silent) console.error(t);
		else throw Error(t);
	}
}, ic = class {
	options;
	parser;
	constructor(e) {
		this.options = e || Oo;
	}
	space(e) {
		return "";
	}
	code({ text: e, lang: t, escaped: n }) {
		let r = (t || "").match(No.notSpaceStart)?.[0], i = e.replace(No.endingNewline, "") + "\n";
		return r ? "<pre><code class=\"language-" + qs(r) + "\">" + (n ? i : qs(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : qs(i, !0)) + "</code></pre>\n";
	}
	blockquote({ tokens: e }) {
		return `<blockquote>
${this.parser.parse(e)}</blockquote>
`;
	}
	html({ text: e }) {
		return e;
	}
	def(e) {
		return "";
	}
	heading({ tokens: e, depth: t }) {
		return `<h${t}>${this.parser.parseInline(e)}</h${t}>
`;
	}
	hr(e) {
		return "<hr>\n";
	}
	list(e) {
		let t = e.ordered, n = e.start, r = "";
		for (let t = 0; t < e.items.length; t++) {
			let n = e.items[t];
			r += this.listitem(n);
		}
		let i = t ? "ol" : "ul", a = t && n !== 1 ? " start=\"" + n + "\"" : "";
		return "<" + i + a + ">\n" + r + "</" + i + ">\n";
	}
	listitem(e) {
		return `<li>${this.parser.parse(e.tokens)}</li>
`;
	}
	checkbox({ checked: e }) {
		return "<input " + (e ? "checked=\"\" " : "") + "disabled=\"\" type=\"checkbox\"> ";
	}
	paragraph({ tokens: e }) {
		return `<p>${this.parser.parseInline(e)}</p>
`;
	}
	table(e) {
		let t = "", n = "";
		for (let t = 0; t < e.header.length; t++) n += this.tablecell(e.header[t]);
		t += this.tablerow({ text: n });
		let r = "";
		for (let t = 0; t < e.rows.length; t++) {
			let i = e.rows[t];
			n = "";
			for (let e = 0; e < i.length; e++) n += this.tablecell(i[e]);
			r += this.tablerow({ text: n });
		}
		return r &&= `<tbody>${r}</tbody>`, "<table>\n<thead>\n" + t + "</thead>\n" + r + "</table>\n";
	}
	tablerow({ text: e }) {
		return `<tr>
${e}</tr>
`;
	}
	tablecell(e) {
		let t = this.parser.parseInline(e.tokens), n = e.header ? "th" : "td";
		return (e.align ? `<${n} align="${e.align}">` : `<${n}>`) + t + `</${n}>
`;
	}
	strong({ tokens: e }) {
		return `<strong>${this.parser.parseInline(e)}</strong>`;
	}
	em({ tokens: e }) {
		return `<em>${this.parser.parseInline(e)}</em>`;
	}
	codespan({ text: e }) {
		return `<code>${qs(e, !0)}</code>`;
	}
	br(e) {
		return "<br>";
	}
	del({ tokens: e }) {
		return `<del>${this.parser.parseInline(e)}</del>`;
	}
	link({ href: e, title: t, tokens: n }) {
		let r = this.parser.parseInline(n), i = Js(e);
		if (i === null) return r;
		e = i;
		let a = "<a href=\"" + e + "\"";
		return t && (a += " title=\"" + qs(t) + "\""), a += ">" + r + "</a>", a;
	}
	image({ href: e, title: t, text: n, tokens: r }) {
		r && (n = this.parser.parseInline(r, this.parser.textRenderer));
		let i = Js(e);
		if (i === null) return qs(n);
		e = i;
		let a = `<img src="${e}" alt="${qs(n)}"`;
		return t && (a += ` title="${qs(t)}"`), a += ">", a;
	}
	text(e) {
		return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : qs(e.text);
	}
}, ac = class {
	strong({ text: e }) {
		return e;
	}
	em({ text: e }) {
		return e;
	}
	codespan({ text: e }) {
		return e;
	}
	del({ text: e }) {
		return e;
	}
	html({ text: e }) {
		return e;
	}
	text({ text: e }) {
		return e;
	}
	link({ text: e }) {
		return "" + e;
	}
	image({ text: e }) {
		return "" + e;
	}
	br() {
		return "";
	}
	checkbox({ raw: e }) {
		return e;
	}
}, oc = class e {
	options;
	renderer;
	textRenderer;
	constructor(e) {
		this.options = e || Oo, this.options.renderer = this.options.renderer || new ic(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new ac();
	}
	static parse(t, n) {
		return new e(n).parse(t);
	}
	static parseInline(t, n) {
		return new e(n).parseInline(t);
	}
	parse(e) {
		this.renderer.parser = this;
		let t = "";
		for (let n = 0; n < e.length; n++) {
			let r = e[n];
			if (this.options.extensions?.renderers?.[r.type]) {
				let e = r, n = this.options.extensions.renderers[e.type].call({ parser: this }, e);
				if (n !== !1 || ![
					"space",
					"hr",
					"heading",
					"code",
					"table",
					"blockquote",
					"list",
					"checkbox",
					"html",
					"def",
					"paragraph",
					"text"
				].includes(e.type)) {
					t += n || "";
					continue;
				}
			}
			let i = r;
			switch (i.type) {
				case "space":
					t += this.renderer.space(i);
					break;
				case "hr":
					t += this.renderer.hr(i);
					break;
				case "heading":
					t += this.renderer.heading(i);
					break;
				case "code":
					t += this.renderer.code(i);
					break;
				case "table":
					t += this.renderer.table(i);
					break;
				case "blockquote":
					t += this.renderer.blockquote(i);
					break;
				case "list":
					t += this.renderer.list(i);
					break;
				case "checkbox":
					t += this.renderer.checkbox(i);
					break;
				case "html":
					t += this.renderer.html(i);
					break;
				case "def":
					t += this.renderer.def(i);
					break;
				case "paragraph":
					t += this.renderer.paragraph(i);
					break;
				case "text":
					t += this.renderer.text(i);
					break;
				default: {
					let e = "Token with \"" + i.type + "\" type was not found.";
					if (this.options.silent) return console.error(e), "";
					throw Error(e);
				}
			}
		}
		return t;
	}
	parseInline(e, t = this.renderer) {
		this.renderer.parser = this;
		let n = "";
		for (let r = 0; r < e.length; r++) {
			let i = e[r];
			if (this.options.extensions?.renderers?.[i.type]) {
				let e = this.options.extensions.renderers[i.type].call({ parser: this }, i);
				if (e !== !1 || ![
					"escape",
					"html",
					"link",
					"image",
					"checkbox",
					"strong",
					"em",
					"codespan",
					"br",
					"del",
					"text"
				].includes(i.type)) {
					n += e || "";
					continue;
				}
			}
			let a = i;
			switch (a.type) {
				case "escape":
					n += t.text(a);
					break;
				case "html":
					n += t.html(a);
					break;
				case "link":
					n += t.link(a);
					break;
				case "image":
					n += t.image(a);
					break;
				case "checkbox":
					n += t.checkbox(a);
					break;
				case "strong":
					n += t.strong(a);
					break;
				case "em":
					n += t.em(a);
					break;
				case "codespan":
					n += t.codespan(a);
					break;
				case "br":
					n += t.br(a);
					break;
				case "del":
					n += t.del(a);
					break;
				case "text":
					n += t.text(a);
					break;
				default: {
					let e = "Token with \"" + a.type + "\" type was not found.";
					if (this.options.silent) return console.error(e), "";
					throw Error(e);
				}
			}
		}
		return n;
	}
}, sc = class {
	options;
	block;
	constructor(e) {
		this.options = e || Oo;
	}
	static passThroughHooks = /* @__PURE__ */ new Set([
		"preprocess",
		"postprocess",
		"processAllTokens",
		"emStrongMask"
	]);
	static passThroughHooksRespectAsync = /* @__PURE__ */ new Set([
		"preprocess",
		"postprocess",
		"processAllTokens"
	]);
	preprocess(e) {
		return e;
	}
	postprocess(e) {
		return e;
	}
	processAllTokens(e) {
		return e;
	}
	emStrongMask(e) {
		return e;
	}
	provideLexer(e = this.block) {
		return e ? rc.lex : rc.lexInline;
	}
	provideParser(e = this.block) {
		return e ? oc.parse : oc.parseInline;
	}
}, cc = new class {
	defaults = Do();
	options = this.setOptions;
	parse = this.parseMarkdown(!0);
	parseInline = this.parseMarkdown(!1);
	Parser = oc;
	Renderer = ic;
	TextRenderer = ac;
	Lexer = rc;
	Tokenizer = nc;
	Hooks = sc;
	constructor(...e) {
		this.use(...e);
	}
	walkTokens(e, t) {
		let n = [];
		for (let r of e) switch (n = n.concat(t.call(this, r)), r.type) {
			case "table": {
				let e = r;
				for (let r of e.header) n = n.concat(this.walkTokens(r.tokens, t));
				for (let r of e.rows) for (let e of r) n = n.concat(this.walkTokens(e.tokens, t));
				break;
			}
			case "list": {
				let e = r;
				n = n.concat(this.walkTokens(e.items, t));
				break;
			}
			default: {
				let e = r;
				this.defaults.extensions?.childTokens?.[e.type] ? this.defaults.extensions.childTokens[e.type].forEach((r) => {
					let i = e[r].flat(1 / 0);
					n = n.concat(this.walkTokens(i, t));
				}) : e.tokens && (n = n.concat(this.walkTokens(e.tokens, t)));
			}
		}
		return n;
	}
	use(...e) {
		let t = this.defaults.extensions || {
			renderers: {},
			childTokens: {}
		};
		return e.forEach((e) => {
			let n = { ...e };
			if (n.async = this.defaults.async || n.async || !1, e.extensions && (e.extensions.forEach((e) => {
				if (!e.name) throw Error("extension name required");
				if ("renderer" in e) {
					let n = t.renderers[e.name];
					n ? t.renderers[e.name] = function(...t) {
						let r = e.renderer.apply(this, t);
						return r === !1 && (r = n.apply(this, t)), r;
					} : t.renderers[e.name] = e.renderer;
				}
				if ("tokenizer" in e) {
					if (!e.level || e.level !== "block" && e.level !== "inline") throw Error("extension level must be 'block' or 'inline'");
					let n = t[e.level];
					n ? n.unshift(e.tokenizer) : t[e.level] = [e.tokenizer], e.start && (e.level === "block" ? t.startBlock ? t.startBlock.push(e.start) : t.startBlock = [e.start] : e.level === "inline" && (t.startInline ? t.startInline.push(e.start) : t.startInline = [e.start]));
				}
				"childTokens" in e && e.childTokens && (t.childTokens[e.name] = e.childTokens);
			}), n.extensions = t), e.renderer) {
				let t = this.defaults.renderer || new ic(this.defaults);
				for (let n in e.renderer) {
					if (!(n in t)) throw Error(`renderer '${n}' does not exist`);
					if (["options", "parser"].includes(n)) continue;
					let r = n, i = e.renderer[r], a = t[r];
					t[r] = (...e) => {
						let n = i.apply(t, e);
						return n === !1 && (n = a.apply(t, e)), n || "";
					};
				}
				n.renderer = t;
			}
			if (e.tokenizer) {
				let t = this.defaults.tokenizer || new nc(this.defaults);
				for (let n in e.tokenizer) {
					if (!(n in t)) throw Error(`tokenizer '${n}' does not exist`);
					if ([
						"options",
						"rules",
						"lexer"
					].includes(n)) continue;
					let r = n, i = e.tokenizer[r], a = t[r];
					t[r] = (...e) => {
						let n = i.apply(t, e);
						return n === !1 && (n = a.apply(t, e)), n;
					};
				}
				n.tokenizer = t;
			}
			if (e.hooks) {
				let t = this.defaults.hooks || new sc();
				for (let n in e.hooks) {
					if (!(n in t)) throw Error(`hook '${n}' does not exist`);
					if (["options", "block"].includes(n)) continue;
					let r = n, i = e.hooks[r], a = t[r];
					t[r] = sc.passThroughHooks.has(n) ? (e) => {
						if (this.defaults.async && sc.passThroughHooksRespectAsync.has(n)) return (async () => {
							let n = await i.call(t, e);
							return a.call(t, n);
						})();
						let r = i.call(t, e);
						return a.call(t, r);
					} : (...e) => {
						if (this.defaults.async) return (async () => {
							let n = await i.apply(t, e);
							return n === !1 && (n = await a.apply(t, e)), n;
						})();
						let n = i.apply(t, e);
						return n === !1 && (n = a.apply(t, e)), n;
					};
				}
				n.hooks = t;
			}
			if (e.walkTokens) {
				let t = this.defaults.walkTokens, r = e.walkTokens;
				n.walkTokens = function(e) {
					let n = [];
					return n.push(r.call(this, e)), t && (n = n.concat(t.call(this, e))), n;
				};
			}
			this.defaults = {
				...this.defaults,
				...n
			};
		}), this;
	}
	setOptions(e) {
		return this.defaults = {
			...this.defaults,
			...e
		}, this;
	}
	lexer(e, t) {
		return rc.lex(e, t ?? this.defaults);
	}
	parser(e, t) {
		return oc.parse(e, t ?? this.defaults);
	}
	parseMarkdown(e) {
		return (t, n) => {
			let r = { ...n }, i = {
				...this.defaults,
				...r
			}, a = this.onError(!!i.silent, !!i.async);
			if (this.defaults.async === !0 && r.async === !1) return a(/* @__PURE__ */ Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));
			if (typeof t > "u" || t === null) return a(/* @__PURE__ */ Error("marked(): input parameter is undefined or null"));
			if (typeof t != "string") return a(/* @__PURE__ */ Error("marked(): input parameter is of type " + Object.prototype.toString.call(t) + ", string expected"));
			if (i.hooks && (i.hooks.options = i, i.hooks.block = e), i.async) return (async () => {
				let n = i.hooks ? await i.hooks.preprocess(t) : t, r = await (i.hooks ? await i.hooks.provideLexer(e) : e ? rc.lex : rc.lexInline)(n, i), a = i.hooks ? await i.hooks.processAllTokens(r) : r;
				i.walkTokens && await Promise.all(this.walkTokens(a, i.walkTokens));
				let o = await (i.hooks ? await i.hooks.provideParser(e) : e ? oc.parse : oc.parseInline)(a, i);
				return i.hooks ? await i.hooks.postprocess(o) : o;
			})().catch(a);
			try {
				i.hooks && (t = i.hooks.preprocess(t));
				let n = (i.hooks ? i.hooks.provideLexer(e) : e ? rc.lex : rc.lexInline)(t, i);
				i.hooks && (n = i.hooks.processAllTokens(n)), i.walkTokens && this.walkTokens(n, i.walkTokens);
				let r = (i.hooks ? i.hooks.provideParser(e) : e ? oc.parse : oc.parseInline)(n, i);
				return i.hooks && (r = i.hooks.postprocess(r)), r;
			} catch (e) {
				return a(e);
			}
		};
	}
	onError(e, t) {
		return (n) => {
			if (n.message += "\nPlease report this to https://github.com/markedjs/marked.", e) {
				let e = "<p>An error occurred:</p><pre>" + qs(n.message + "", !0) + "</pre>";
				return t ? Promise.resolve(e) : e;
			}
			if (t) return Promise.reject(n);
			throw n;
		};
	}
}();
function Q(e, t) {
	return cc.parse(e, t);
}
Q.options = Q.setOptions = function(e) {
	return cc.setOptions(e), Q.defaults = cc.defaults, ko(Q.defaults), Q;
}, Q.getDefaults = Do, Q.defaults = Oo;
function lc(...e) {
	return cc.use(...e), Q.defaults = cc.defaults, ko(Q.defaults), Q;
}
Q.use = lc, Q.walkTokens = function(e, t) {
	return cc.walkTokens(e, t);
}, Q.parseInline = cc.parseInline, Q.Parser = oc, Q.parser = oc.parse, Q.Renderer = ic, Q.TextRenderer = ac, Q.Lexer = rc, Q.lexer = rc.lex, Q.Tokenizer = nc, Q.Hooks = sc, Q.parse = Q, Q.options, Q.setOptions, Q.walkTokens, Q.parseInline, oc.parse, rc.lex;
//#endregion
//#region node_modules/dompurify/dist/purify.es.mjs
function uc(e, t) {
	(t == null || t > e.length) && (t = e.length);
	for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
	return r;
}
function dc(e) {
	if (Array.isArray(e)) return e;
}
function fc(e, t) {
	var n = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
	if (n != null) {
		var r, i, a, o, s = [], c = !0, l = !1;
		try {
			if (a = (n = n.call(e)).next, t !== 0) for (; !(c = (r = a.call(n)).done) && (s.push(r.value), s.length !== t); c = !0);
		} catch (e) {
			l = !0, i = e;
		} finally {
			try {
				if (!c && n.return != null && (o = n.return(), Object(o) !== o)) return;
			} finally {
				if (l) throw i;
			}
		}
		return s;
	}
}
function pc() {
	throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function mc(e, t) {
	return dc(e) || fc(e, t) || hc(e, t) || pc();
}
function hc(e, t) {
	if (e) {
		if (typeof e == "string") return uc(e, t);
		var n = {}.toString.call(e).slice(8, -1);
		return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? uc(e, t) : void 0;
	}
}
var gc = Object.entries, _c = Object.setPrototypeOf, vc = Object.isFrozen, yc = Object.getPrototypeOf, bc = Object.getOwnPropertyDescriptor, xc = Object.freeze, Sc = Object.seal, Cc = Object.create, wc = typeof Reflect < "u" && Reflect, Tc = wc.apply, Ec = wc.construct;
xc ||= function(e) {
	return e;
}, Sc ||= function(e) {
	return e;
}, Tc ||= function(e, t) {
	var n = [...arguments].slice(2);
	return e.apply(t, n);
}, Ec ||= function(e) {
	return new e(...[...arguments].slice(1));
};
var Dc = qc(Array.prototype.forEach), Oc = qc(Array.prototype.lastIndexOf), kc = qc(Array.prototype.pop), Ac = qc(Array.prototype.push), jc = qc(Array.prototype.splice), Mc = Array.isArray, Nc = qc(String.prototype.toLowerCase), Pc = qc(String.prototype.toString), Fc = qc(String.prototype.match), Ic = qc(String.prototype.replace), Lc = qc(String.prototype.indexOf), Rc = qc(String.prototype.trim), zc = qc(Number.prototype.toString), Bc = qc(Boolean.prototype.toString), Vc = typeof BigInt > "u" ? null : qc(BigInt.prototype.toString), Hc = typeof Symbol > "u" ? null : qc(Symbol.prototype.toString), Uc = qc(Object.prototype.hasOwnProperty), Wc = qc(Object.prototype.toString), Gc = qc(RegExp.prototype.test), Kc = Jc(TypeError);
function qc(e) {
	return function(t) {
		t instanceof RegExp && (t.lastIndex = 0);
		var n = [...arguments].slice(1);
		return Tc(e, t, n);
	};
}
function Jc(e) {
	return function() {
		return Ec(e, [...arguments]);
	};
}
function $(e, t) {
	let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Nc;
	if (_c && _c(e, null), !Mc(t)) return e;
	let r = t.length;
	for (; r--;) {
		let i = t[r];
		if (typeof i == "string") {
			let e = n(i);
			e !== i && (vc(t) || (t[r] = e), i = e);
		}
		e[i] = !0;
	}
	return e;
}
function Yc(e) {
	for (let t = 0; t < e.length; t++) Uc(e, t) || (e[t] = null);
	return e;
}
function Xc(e) {
	let t = Cc(null);
	for (let r of gc(e)) {
		var n = mc(r, 2);
		let i = n[0], a = n[1];
		Uc(e, i) && (t[i] = Mc(a) ? Yc(a) : a && typeof a == "object" && a.constructor === Object ? Xc(a) : a);
	}
	return t;
}
function Zc(e) {
	switch (typeof e) {
		case "string": return e;
		case "number": return zc(e);
		case "boolean": return Bc(e);
		case "bigint": return Vc ? Vc(e) : "0";
		case "symbol": return Hc ? Hc(e) : "Symbol()";
		case "undefined": return Wc(e);
		case "function":
		case "object": {
			if (e === null) return Wc(e);
			let t = e, n = Qc(t, "toString");
			if (typeof n == "function") {
				let e = n(t);
				return typeof e == "string" ? e : Wc(e);
			}
			return Wc(e);
		}
		default: return Wc(e);
	}
}
function Qc(e, t) {
	for (; e !== null;) {
		let n = bc(e, t);
		if (n) {
			if (n.get) return qc(n.get);
			if (typeof n.value == "function") return qc(n.value);
		}
		e = yc(e);
	}
	function n() {
		return null;
	}
	return n;
}
function $c(e) {
	try {
		return Gc(e, ""), !0;
	} catch {
		return !1;
	}
}
var el = xc(/* @__PURE__ */ "a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr".split(".")), tl = xc(/* @__PURE__ */ "svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern".split(".")), nl = xc([
	"feBlend",
	"feColorMatrix",
	"feComponentTransfer",
	"feComposite",
	"feConvolveMatrix",
	"feDiffuseLighting",
	"feDisplacementMap",
	"feDistantLight",
	"feDropShadow",
	"feFlood",
	"feFuncA",
	"feFuncB",
	"feFuncG",
	"feFuncR",
	"feGaussianBlur",
	"feImage",
	"feMerge",
	"feMergeNode",
	"feMorphology",
	"feOffset",
	"fePointLight",
	"feSpecularLighting",
	"feSpotLight",
	"feTile",
	"feTurbulence"
]), rl = xc([
	"animate",
	"color-profile",
	"cursor",
	"discard",
	"font-face",
	"font-face-format",
	"font-face-name",
	"font-face-src",
	"font-face-uri",
	"foreignobject",
	"hatch",
	"hatchpath",
	"mesh",
	"meshgradient",
	"meshpatch",
	"meshrow",
	"missing-glyph",
	"script",
	"set",
	"solidcolor",
	"unknown",
	"use"
]), il = xc(/* @__PURE__ */ "math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts".split(".")), al = xc([
	"maction",
	"maligngroup",
	"malignmark",
	"mlongdiv",
	"mscarries",
	"mscarry",
	"msgroup",
	"mstack",
	"msline",
	"msrow",
	"semantics",
	"annotation",
	"annotation-xml",
	"mprescripts",
	"none"
]), ol = xc(["#text"]), sl = xc(/* @__PURE__ */ "accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns".split(".")), cl = xc(/* @__PURE__ */ "accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan".split(".")), ll = xc(/* @__PURE__ */ "accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns".split(".")), ul = xc([
	"xlink:href",
	"xml:id",
	"xlink:title",
	"xml:space",
	"xmlns:xlink"
]), dl = Sc(/{{[\w\W]*|^[\w\W]*}}/g), fl = Sc(/<%[\w\W]*|^[\w\W]*%>/g), pl = Sc(/\${[\w\W]*/g), ml = Sc(/^data-[\-\w.\u00B7-\uFFFF]+$/), hl = Sc(/^aria-[\-\w]+$/), gl = Sc(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), _l = Sc(/^(?:\w+script|data):/i), vl = Sc(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), yl = Sc(/^html$/i), bl = Sc(/^[a-z][.\w]*(-[.\w]+)+$/i), xl = Sc(/<[/\w!]/g), Sl = Sc(/<[/\w]/g), Cl = Sc(/<\/no(script|embed|frames)/i), wl = Sc(/\/>/i), Tl = {
	element: 1,
	attribute: 2,
	text: 3,
	cdataSection: 4,
	entityReference: 5,
	entityNode: 6,
	processingInstruction: 7,
	comment: 8,
	document: 9,
	documentType: 10,
	documentFragment: 11,
	notation: 12
}, El = function() {
	return typeof window > "u" ? null : window;
}, Dl = function(e, t) {
	if (typeof e != "object" || typeof e.createPolicy != "function") return null;
	let n = null, r = "data-tt-policy-suffix";
	t && t.hasAttribute(r) && (n = t.getAttribute(r));
	let i = "dompurify" + (n ? "#" + n : "");
	try {
		return e.createPolicy(i, {
			createHTML(e) {
				return e;
			},
			createScriptURL(e) {
				return e;
			}
		});
	} catch {
		return console.warn("TrustedTypes policy " + i + " could not be created."), null;
	}
}, Ol = function() {
	return {
		afterSanitizeAttributes: [],
		afterSanitizeElements: [],
		afterSanitizeShadowDOM: [],
		beforeSanitizeAttributes: [],
		beforeSanitizeElements: [],
		beforeSanitizeShadowDOM: [],
		uponSanitizeAttribute: [],
		uponSanitizeElement: [],
		uponSanitizeShadowNode: []
	};
}, kl = function(e, t, n, r) {
	return Uc(e, t) && Mc(e[t]) ? $(r.base ? Xc(r.base) : {}, e[t], r.transform) : n;
};
function Al() {
	let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : El(), t = (e) => Al(e);
	if (t.version = "3.4.13", t.removed = [], !e || !e.document || e.document.nodeType !== Tl.document || !e.Element) return t.isSupported = !1, t;
	let n = e.document, r = n, i = r.currentScript;
	e.DocumentFragment;
	let a = e.HTMLTemplateElement, o = e.Node, s = e.Element, c = e.NodeFilter;
	e.NamedNodeMap === void 0 && (e.NamedNodeMap || e.MozNamedAttrMap), e.HTMLFormElement;
	let l = e.DOMParser, u = e.trustedTypes, d = s.prototype, f = Qc(d, "cloneNode"), p = Qc(d, "remove"), m = Qc(d, "nextSibling"), h = Qc(d, "childNodes"), g = Qc(d, "parentNode"), _ = Qc(d, "shadowRoot"), v = Qc(d, "attributes"), y = o && o.prototype ? Qc(o.prototype, "nodeType") : null, b = o && o.prototype ? Qc(o.prototype, "nodeName") : null, x = o && o.prototype ? Qc(o.prototype, "ownerDocument") : null;
	if (typeof a == "function") {
		let e = n.createElement("template");
		e.content && e.content.ownerDocument && (n = e.content.ownerDocument);
	}
	let S, C = "", ee, w = !1, te = 0, ne = function() {
		if (te > 0) throw Kc("A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the \"DOMPurify and Trusted Types\" section of the README.");
	}, T = function(e) {
		ne(), te++;
		try {
			return S.createHTML(e);
		} finally {
			te--;
		}
	}, re = function(e) {
		ne(), te++;
		try {
			return S.createScriptURL(e);
		} finally {
			te--;
		}
	}, ie = function() {
		return w ||= (ee = Dl(u, i), !0), ee;
	}, ae = n, oe = ae.implementation, se = ae.createNodeIterator, ce = ae.createDocumentFragment, le = ae.getElementsByTagName, ue = r.importNode, E = Ol();
	t.isSupported = typeof gc == "function" && typeof g == "function" && oe && oe.createHTMLDocument !== void 0;
	let de = dl, fe = fl, pe = pl, me = ml, he = hl, ge = _l, _e = vl, ve = bl, ye = gl, D = null, be = $({}, [
		...el,
		...tl,
		...nl,
		...il,
		...ol
	]), O = null, xe = $({}, [
		...sl,
		...cl,
		...ll,
		...ul
	]), Se = Object.seal(Cc(null, {
		tagNameCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		},
		attributeNameCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		},
		allowCustomizedBuiltInElements: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: !1
		}
	})), Ce = null, we = null, Te = Object.seal(Cc(null, {
		tagCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		},
		attributeCheck: {
			writable: !0,
			configurable: !1,
			enumerable: !0,
			value: null
		}
	})), Ee = !0, De = !0, Oe = !1, ke = !0, Ae = !1, k = !0, je = !1, A = !1, Me = null, Ne = null, j = !1, Pe = !1, Fe = !1, Ie = !1, Le = !0, Re = !1, ze = "user-content-", Be = !0, Ve = !1, He = {}, Ue = null, We = $({}, /* @__PURE__ */ "annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp".split(".")), Ge = null, Ke = $({}, [
		"audio",
		"video",
		"img",
		"source",
		"image",
		"track"
	]), qe = null, Je = $({}, [
		"alt",
		"class",
		"for",
		"id",
		"label",
		"name",
		"pattern",
		"placeholder",
		"role",
		"summary",
		"title",
		"value",
		"style",
		"xmlns"
	]), Ye = "http://www.w3.org/1998/Math/MathML", Xe = "http://www.w3.org/2000/svg", Ze = "http://www.w3.org/1999/xhtml", Qe = Ze, $e = !1, et = null, tt = $({}, [
		Ye,
		Xe,
		Ze
	], Pc), nt = xc([
		"mi",
		"mo",
		"mn",
		"ms",
		"mtext"
	]), rt = $({}, nt), it = xc(["annotation-xml"]), at = $({}, it), ot = $({}, [
		"title",
		"style",
		"font",
		"a",
		"script"
	]), st = null, ct = ["application/xhtml+xml", "text/html"], lt = null, ut = null, dt = n.createElement("form"), ft = function(e) {
		return e instanceof RegExp || e instanceof Function;
	}, pt = function() {
		let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
		if (ut && ut === e) return;
		(!e || typeof e != "object") && (e = {}), e = Xc(e), st = ct.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, lt = st === "application/xhtml+xml" ? Pc : Nc, D = kl(e, "ALLOWED_TAGS", be, { transform: lt }), O = kl(e, "ALLOWED_ATTR", xe, { transform: lt }), et = kl(e, "ALLOWED_NAMESPACES", tt, { transform: Pc }), qe = kl(e, "ADD_URI_SAFE_ATTR", Je, {
			transform: lt,
			base: Je
		}), Ge = kl(e, "ADD_DATA_URI_TAGS", Ke, {
			transform: lt,
			base: Ke
		}), Ue = kl(e, "FORBID_CONTENTS", We, { transform: lt }), Ce = kl(e, "FORBID_TAGS", Xc({}), { transform: lt }), we = kl(e, "FORBID_ATTR", Xc({}), { transform: lt }), He = Uc(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? Xc(e.USE_PROFILES) : e.USE_PROFILES : !1, Ee = e.ALLOW_ARIA_ATTR !== !1, De = e.ALLOW_DATA_ATTR !== !1, Oe = e.ALLOW_UNKNOWN_PROTOCOLS || !1, ke = e.ALLOW_SELF_CLOSE_IN_ATTR !== !1, Ae = e.SAFE_FOR_TEMPLATES || !1, k = e.SAFE_FOR_XML !== !1, je = e.WHOLE_DOCUMENT || !1, Pe = e.RETURN_DOM || !1, Fe = e.RETURN_DOM_FRAGMENT || !1, Ie = e.RETURN_TRUSTED_TYPE || !1, j = e.FORCE_BODY || !1, Le = e.SANITIZE_DOM !== !1, Re = e.SANITIZE_NAMED_PROPS || !1, Be = e.KEEP_CONTENT !== !1, Ve = e.IN_PLACE || !1, ye = $c(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : gl, Qe = typeof e.NAMESPACE == "string" ? e.NAMESPACE : Ze, rt = Uc(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? Xc(e.MATHML_TEXT_INTEGRATION_POINTS) : $({}, nt), at = Uc(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? Xc(e.HTML_INTEGRATION_POINTS) : $({}, it);
		let t = Uc(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? Xc(e.CUSTOM_ELEMENT_HANDLING) : Cc(null);
		if (Se = Cc(null), Uc(t, "tagNameCheck") && ft(t.tagNameCheck) && (Se.tagNameCheck = t.tagNameCheck), Uc(t, "attributeNameCheck") && ft(t.attributeNameCheck) && (Se.attributeNameCheck = t.attributeNameCheck), Uc(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (Se.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), Sc(Se), Ae && (De = !1), Fe && (Pe = !0), He && (D = $({}, ol), O = Cc(null), He.html === !0 && ($(D, el), $(O, sl)), He.svg === !0 && ($(D, tl), $(O, cl), $(O, ul)), He.svgFilters === !0 && ($(D, nl), $(O, cl), $(O, ul)), He.mathMl === !0 && ($(D, il), $(O, ll), $(O, ul))), Te.tagCheck = null, Te.attributeCheck = null, Uc(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? Te.tagCheck = e.ADD_TAGS : Mc(e.ADD_TAGS) && (D === be && (D = Xc(D)), $(D, e.ADD_TAGS, lt))), Uc(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? Te.attributeCheck = e.ADD_ATTR : Mc(e.ADD_ATTR) && (O === xe && (O = Xc(O)), $(O, e.ADD_ATTR, lt))), Uc(e, "ADD_URI_SAFE_ATTR") && Mc(e.ADD_URI_SAFE_ATTR) && $(qe, e.ADD_URI_SAFE_ATTR, lt), Uc(e, "FORBID_CONTENTS") && Mc(e.FORBID_CONTENTS) && (Ue === We && (Ue = Xc(Ue)), $(Ue, e.FORBID_CONTENTS, lt)), Uc(e, "ADD_FORBID_CONTENTS") && Mc(e.ADD_FORBID_CONTENTS) && (Ue === We && (Ue = Xc(Ue)), $(Ue, e.ADD_FORBID_CONTENTS, lt)), Be && (D["#text"] = !0), je && $(D, [
			"html",
			"head",
			"body"
		]), D.table && ($(D, ["tbody"]), delete Ce.tbody), e.TRUSTED_TYPES_POLICY) {
			if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw Kc("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
			if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw Kc("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
			let t = S;
			S = e.TRUSTED_TYPES_POLICY;
			try {
				C = T("");
			} catch (e) {
				throw S = t, e;
			}
		} else e.TRUSTED_TYPES_POLICY === null ? (S = void 0, C = "") : (S === void 0 && (S = ie()), S && typeof C == "string" && (C = T("")));
		xc && xc(e), ut = e;
	}, mt = $({}, [
		...tl,
		...nl,
		...rl
	]), ht = $({}, [...il, ...al]), gt = function(e, t, n) {
		return t.namespaceURI === Ze ? e === "svg" : t.namespaceURI === Ye ? e === "svg" && (n === "annotation-xml" || rt[n]) : !!mt[e];
	}, _t = function(e, t, n) {
		return t.namespaceURI === Ze ? e === "math" : t.namespaceURI === Xe ? e === "math" && at[n] : !!ht[e];
	}, vt = function(e, t, n) {
		return t.namespaceURI === Xe && !at[n] || t.namespaceURI === Ye && !rt[n] ? !1 : !ht[e] && (ot[e] || !mt[e]);
	}, yt = function(e) {
		let t = g(e);
		(!t || !t.tagName) && (t = {
			namespaceURI: Qe,
			tagName: "template"
		});
		let n = Nc(e.tagName), r = Nc(t.tagName);
		return et[e.namespaceURI] ? e.namespaceURI === Xe ? gt(n, t, r) : e.namespaceURI === Ye ? _t(n, t, r) : e.namespaceURI === Ze ? vt(n, t, r) : !!(st === "application/xhtml+xml" && et[e.namespaceURI]) : !1;
	}, M = function(e) {
		Ac(t.removed, { element: e });
		try {
			g(e).removeChild(e);
		} catch {
			if (p(e), !g(e)) throw Kc("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
		}
	}, bt = function(e) {
		Ct(e);
		let t = h(e);
		if (t) {
			let e = [];
			Dc(t, (t) => {
				Ac(e, t);
			}), Dc(e, (e) => {
				try {
					p(e);
				} catch {}
			});
		}
		let n = v(e);
		if (n) for (let t = n.length - 1; t >= 0; --t) {
			let r = n[t], i = r && r.name;
			if (typeof i == "string") try {
				e.removeAttribute(i);
			} catch {}
		}
	}, xt = function(e, n) {
		try {
			Ac(t.removed, {
				attribute: n.getAttributeNode(e),
				from: n
			});
		} catch {
			Ac(t.removed, {
				attribute: null,
				from: n
			});
		}
		if (n.removeAttribute(e), e === "is") {
			if (Pe || Fe) try {
				M(n);
			} catch {}
			else try {
				n.setAttribute(e, "");
			} catch {}
		}
	}, St = function(e) {
		let t = v(e);
		if (t) for (let n = t.length - 1; n >= 0; --n) {
			let r = t[n], i = r && r.name;
			if (!(typeof i != "string" || O[lt(i)])) try {
				e.removeAttribute(i);
			} catch {}
		}
	}, Ct = function(e) {
		let t = [e];
		for (; t.length > 0;) {
			let e = t.pop();
			(y ? y(e) : e.nodeType) === Tl.element && St(e);
			let n = h(e);
			if (n) for (let e = n.length - 1; e >= 0; --e) t.push(n[e]);
		}
	}, wt = function(e) {
		if (!k) return;
		let t = [e];
		for (; t.length > 0;) {
			let e = t.pop(), n = y ? y(e) : e.nodeType;
			if (n === Tl.processingInstruction || n === Tl.comment && Gc(Sl, e.data)) {
				try {
					p(e);
				} catch {}
				continue;
			}
			if (n === Tl.element) {
				let t = e, n = lt(b ? b(e) : e.nodeName);
				try {
					t.hasAttribute && t.hasAttribute("patchsrc") && t.removeAttribute("patchsrc"), t.hasAttribute && t.hasAttribute("for") && n !== "label" && n !== "output" && t.removeAttribute("for");
				} catch {}
			}
			let r = h(e);
			if (r) for (let e = r.length - 1; e >= 0; --e) t.push(r[e]);
		}
	}, Tt = function(e) {
		let t = null, r = null;
		if (j) e = "<remove></remove>" + e;
		else {
			let t = Fc(e, /^[\r\n\t ]+/);
			r = t && t[0];
		}
		st === "application/xhtml+xml" && Qe === Ze && (e = "<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body>" + e + "</body></html>");
		let i = S ? T(e) : e;
		if (Qe === Ze) try {
			t = new l().parseFromString(i, st);
		} catch {}
		if (!t || !t.documentElement) {
			t = oe.createDocument(Qe, "template", null);
			try {
				t.documentElement.innerHTML = $e ? C : i;
			} catch {}
		}
		let a = t.body || t.documentElement;
		return e && r && a.insertBefore(n.createTextNode(r), a.childNodes[0] || null), Qe === Ze ? le.call(t, je ? "html" : "body")[0] : je ? t.documentElement : a;
	}, Et = function(e) {
		let t = x ? x(e) : e.ownerDocument;
		return se.call(t || e, e, c.SHOW_ELEMENT | c.SHOW_COMMENT | c.SHOW_TEXT | c.SHOW_PROCESSING_INSTRUCTION | c.SHOW_CDATA_SECTION, null);
	}, N = function(e) {
		return e = Ic(e, de, " "), e = Ic(e, fe, " "), e = Ic(e, pe, " "), e;
	}, Dt = function(e) {
		e.normalize();
		let t = x ? x(e) : e.ownerDocument, n = se.call(t || e, e, c.SHOW_TEXT | c.SHOW_COMMENT | c.SHOW_CDATA_SECTION | c.SHOW_PROCESSING_INSTRUCTION, null), r = n.nextNode();
		for (; r;) r.data = N(r.data), r = n.nextNode();
		let i = e.querySelectorAll?.call(e, "template");
		i && Dc(i, (e) => {
			kt(e.content) && Dt(e.content);
		});
	}, Ot = function(e) {
		let t = b ? b(e) : null;
		return typeof t != "string" || lt(t) !== "form" ? !1 : typeof e.nodeName != "string" || typeof e.textContent != "string" || typeof e.removeChild != "function" || e.attributes !== v(e) || typeof e.removeAttribute != "function" || typeof e.setAttribute != "function" || typeof e.namespaceURI != "string" || typeof e.insertBefore != "function" || typeof e.hasChildNodes != "function" || e.nodeType !== y(e) || e.childNodes !== h(e);
	}, kt = function(e) {
		if (!y || typeof e != "object" || !e) return !1;
		try {
			return y(e) === Tl.documentFragment;
		} catch {
			return !1;
		}
	}, At = function(e) {
		if (!y || typeof e != "object" || !e) return !1;
		try {
			return typeof y(e) == "number";
		} catch {
			return !1;
		}
	};
	function jt(e, n, r) {
		e.length !== 0 && Dc(e, (e) => {
			e.call(t, n, r, ut);
		});
	}
	let Mt = function(e, t) {
		return !!(k && e.hasChildNodes() && !At(e.firstElementChild) && Gc(xl, e.textContent) && Gc(xl, e.innerHTML) || k && e.namespaceURI === Ze && t === "style" && At(e.firstElementChild) || e.nodeType === Tl.processingInstruction || k && e.nodeType === Tl.comment && Gc(Sl, e.data));
	}, Nt = function(e, t, n) {
		if (!Ce[t] && Lt(t) && (Se.tagNameCheck instanceof RegExp && Gc(Se.tagNameCheck, t) || Se.tagNameCheck instanceof Function && Se.tagNameCheck(t))) return !1;
		if (Be && !Ue[t]) {
			let t = g(e), r = h(e);
			if (r && t) {
				let i = r.length;
				for (let a = i - 1; a >= 0; --a) {
					let i = e === n ? f(r[a], !0) : r[a];
					t.insertBefore(i, m(e));
				}
			}
		}
		return M(e), !0;
	}, Pt = function(e, t, n, r) {
		return e.length === 0 ? t : t === n || t === r ? Xc(t) : t;
	}, Ft = function(e, n) {
		if (jt(E.beforeSanitizeElements, e, null), e !== n && g(e) === null) return Ve && Ct(e), !0;
		if (Ot(e)) return M(e), !0;
		let r = lt(b ? b(e) : e.nodeName);
		if (D = Pt(E.uponSanitizeElement, D, be, Me), jt(E.uponSanitizeElement, e, {
			tagName: r,
			allowedTags: D
		}), e !== n && g(e) === null) return Ve && Ct(e), !0;
		if (Mt(e, r)) return M(e), !0;
		if (Ce[r] || !(Te.tagCheck instanceof Function && Te.tagCheck(r)) && !D[r]) {
			let t = Nt(e, r, n);
			return t === !1 && jt(E.afterSanitizeElements, e, null), t;
		}
		if ((y ? y(e) : e.nodeType) === Tl.element && !yt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && Gc(Cl, e.innerHTML)) return M(e), !0;
		if (Ae && e.nodeType === Tl.text) {
			let n = N(e.textContent);
			e.textContent !== n && (Ac(t.removed, { element: e.cloneNode() }), e.textContent = n);
		}
		return jt(E.afterSanitizeElements, e, null), !1;
	}, It = function(e, t, r) {
		if (we[t] || k && t === "patchsrc" || k && t === "for" && e !== "label" && e !== "output" || Le && (t === "id" || t === "name") && (r in n || r in dt)) return !1;
		let i = O[t] || Te.attributeCheck instanceof Function && Te.attributeCheck(t, e);
		if (!(De && Gc(me, t)) && !(Ee && Gc(he, t))) {
			if (!i) {
				if (!(Lt(e) && (Se.tagNameCheck instanceof RegExp && Gc(Se.tagNameCheck, e) || Se.tagNameCheck instanceof Function && Se.tagNameCheck(e)) && (Se.attributeNameCheck instanceof RegExp && Gc(Se.attributeNameCheck, t) || Se.attributeNameCheck instanceof Function && Se.attributeNameCheck(t, e)) || t === "is" && Se.allowCustomizedBuiltInElements && (Se.tagNameCheck instanceof RegExp && Gc(Se.tagNameCheck, r) || Se.tagNameCheck instanceof Function && Se.tagNameCheck(r)))) return !1;
			} else if (!qe[t] && !Gc(ye, Ic(r, _e, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Lc(r, "data:") === 0 && Ge[e]) && !(Oe && !Gc(ge, Ic(r, _e, ""))) && r) return !1;
		}
		return !0;
	}, P = $({}, [
		"annotation-xml",
		"color-profile",
		"font-face",
		"font-face-format",
		"font-face-name",
		"font-face-src",
		"font-face-uri",
		"missing-glyph"
	]), Lt = function(e) {
		return !P[Nc(e)] && Gc(ve, e);
	}, Rt = function(e, t, n, r) {
		if (S && typeof u == "object" && typeof u.getAttributeType == "function" && !n) switch (u.getAttributeType(e, t)) {
			case "TrustedHTML": return T(r);
			case "TrustedScriptURL": return re(r);
		}
		return r;
	}, zt = function(e, n, r, i) {
		try {
			r ? e.setAttributeNS(r, n, i) : e.setAttribute(n, i), Ot(e) ? M(e) : kc(t.removed);
		} catch {
			xt(n, e);
		}
	}, Bt = function(e) {
		jt(E.beforeSanitizeAttributes, e, null);
		let t = e.attributes;
		if (!t || Ot(e)) return;
		O = Pt(E.uponSanitizeAttribute, O, xe, Ne);
		let n = {
			attrName: "",
			attrValue: "",
			keepAttr: !0,
			allowedAttributes: O,
			forceKeepAttr: void 0
		}, r = t.length, i = lt(e.nodeName);
		for (; r--;) {
			let a = t[r], o = a.name, s = a.namespaceURI, c = a.value, l = lt(o), u = c, d = o === "value" ? u : Rc(u);
			if (n.attrName = l, n.attrValue = d, n.keepAttr = !0, n.forceKeepAttr = void 0, jt(E.uponSanitizeAttribute, e, n), d = n.attrValue, Re && (l === "id" || l === "name") && Lc(d, ze) !== 0 && (xt(o, e), d = ze + d), k && Gc(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
				xt(o, e);
				continue;
			}
			if (l === "attributename" && Fc(d, "href")) {
				xt(o, e);
				continue;
			}
			if (!n.forceKeepAttr) {
				if (!n.keepAttr) {
					xt(o, e);
					continue;
				}
				if (!ke && Gc(wl, d)) {
					xt(o, e);
					continue;
				}
				if (Ae && (d = N(d)), !It(i, l, d)) {
					xt(o, e);
					continue;
				}
				d = Rt(i, l, s, d), d !== u && zt(e, o, s, d);
			}
		}
		jt(E.afterSanitizeAttributes, e, null);
	}, Vt = function(e) {
		let t = null, n = Et(e);
		for (jt(E.beforeSanitizeShadowDOM, e, null); t = n.nextNode();) if (jt(E.uponSanitizeShadowNode, t, null), Ft(t, e), Bt(t), kt(t.content) && Vt(t.content), (y ? y(t) : t.nodeType) === Tl.element) {
			let e = _(t);
			kt(e) && (Ht(e), Vt(e));
		}
		jt(E.afterSanitizeShadowDOM, e, null);
	}, Ht = function(e) {
		let t = [{
			node: e,
			shadow: null
		}];
		for (; t.length > 0;) {
			let e = t.pop();
			if (e.shadow) {
				Vt(e.shadow);
				continue;
			}
			let n = e.node, r = (y ? y(n) : n.nodeType) === Tl.element, i = h(n);
			if (i) for (let e = i.length - 1; e >= 0; --e) t.push({
				node: i[e],
				shadow: null
			});
			if (r) {
				let e = b ? b(n) : null;
				if (typeof e == "string" && lt(e) === "template") {
					let e = n.content;
					kt(e) && t.push({
						node: e,
						shadow: null
					});
				}
			}
			if (r) {
				let e = _(n);
				kt(e) && t.push({
					node: null,
					shadow: e
				}, {
					node: e,
					shadow: null
				});
			}
		}
	};
	return t.sanitize = function(e) {
		let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, i = null, a = null, o = null, s = null;
		if ($e = !e, $e && (e = "<!-->"), typeof e != "string" && !At(e) && (e = Zc(e), typeof e != "string")) throw Kc("dirty is not a string, aborting");
		if (!t.isSupported) return e;
		A ? (D = Me, O = Ne) : pt(n), (E.uponSanitizeElement.length > 0 || E.uponSanitizeAttribute.length > 0) && (D = Xc(D)), E.uponSanitizeAttribute.length > 0 && (O = Xc(O)), t.removed = [];
		let c = Ve && typeof e != "string" && At(e);
		if (c) {
			wt(e);
			let t = b ? b(e) : e.nodeName;
			if (typeof t == "string") {
				let n = lt(t);
				if (!D[n] || Ce[n]) throw bt(e), Kc("root node is forbidden and cannot be sanitized in-place");
			}
			if (Ot(e)) throw bt(e), Kc("root node is clobbered and cannot be sanitized in-place");
			try {
				Ht(e);
			} catch (t) {
				throw bt(e), t;
			}
		} else if (At(e)) i = Tt("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === Tl.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Ht(a);
		else {
			if (!Pe && !Ae && !je && e.indexOf("<") === -1) return S && Ie ? T(e) : e;
			if (i = Tt(e), !i) return Pe ? null : Ie ? C : "";
		}
		i && j && M(i.firstChild);
		let l = c ? e : i;
		try {
			let e = Et(l);
			for (; o = e.nextNode();) Ft(o, l), Bt(o), kt(o.content) && Vt(o.content);
		} catch (n) {
			throw c && (bt(e), Dc(t.removed, (e) => {
				e.element && Ct(e.element);
			})), n;
		}
		if (c) return Dc(t.removed, (e) => {
			e.element && Ct(e.element);
		}), Ae && Dt(e), e;
		if (Pe) {
			if (Ae && Dt(i), Fe) for (s = ce.call(i.ownerDocument); i.firstChild;) s.appendChild(i.firstChild);
			else s = i;
			return (O.shadowroot || O.shadowrootmode) && (s = ue.call(r, s, !0)), s;
		}
		let u = je ? i.outerHTML : i.innerHTML;
		return je && D["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && Gc(yl, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), Ae && (u = N(u)), S && Ie ? T(u) : u;
	}, t.setConfig = function() {
		let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
		pt(e), A = !0, Me = D, Ne = O;
	}, t.clearConfig = function() {
		ut = null, A = !1, Me = null, Ne = null, S = ee, C = "";
	}, t.isValidAttribute = function(e, t, n) {
		ut || pt({});
		let r = lt(e), i = lt(t);
		return It(r, i, n);
	}, t.addHook = function(e, t) {
		typeof t == "function" && Uc(E, e) && Ac(E[e], t);
	}, t.removeHook = function(e, t) {
		if (Uc(E, e)) {
			if (t !== void 0) {
				let n = Oc(E[e], t);
				return n === -1 ? void 0 : jc(E[e], n, 1)[0];
			}
			return kc(E[e]);
		}
	}, t.removeHooks = function(e) {
		Uc(E, e) && (E[e] = []);
	}, t.removeAllHooks = function() {
		E = Ol();
	}, t;
}
var jl = Al();
//#endregion
//#region src/lib/markdown.ts
Q.setOptions({
	breaks: !0,
	gfm: !0
});
function Ml(e) {
	let t = Q.parse(e, { async: !1 });
	return jl.sanitize(t);
}
//#endregion
//#region src/lib/components/MarkdownEditModal.svelte
var Nl = /* @__PURE__ */ W("<p class=\"text-sm text-ink-400 italic\"> </p>"), Pl = /* @__PURE__ */ W("<div class=\"markdown-body\"></div>"), Fl = /* @__PURE__ */ W("<div class=\"overlay-scroll min-h-0 overflow-y-auto px-4 py-3\"><!></div>"), Il = /* @__PURE__ */ W("<div class=\"fixed inset-0 z-40 grid place-items-center bg-ink-950/40 p-4\"><div class=\"card flex h-[85vh] w-full max-w-6xl flex-col\"><div class=\"flex items-center justify-between border-b border-ink-200 px-5 py-3\"><h2 class=\"text-sm font-semibold text-ink-900\"> </h2> <div class=\"flex items-center gap-2\"><button type=\"button\" class=\"btn btn-ghost btn-xs inline-flex items-center gap-1.5\"><svg class=\"size-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z\"></path><circle cx=\"12\" cy=\"12\" r=\"3\"></circle></svg> </button> <button class=\"btn btn-ghost btn-xs\"> </button></div></div> <div class=\"flex flex-wrap items-center gap-1 border-b border-ink-200 px-3 py-1.5\"><button type=\"button\" class=\"btn btn-ghost btn-xs\">H1</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H2</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H3</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H4</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H5</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">H6</button> <span class=\"mx-1 h-4 w-px bg-ink-200\"></span> <button type=\"button\" class=\"btn btn-ghost btn-xs font-bold\">B</button> <button type=\"button\" class=\"btn btn-ghost btn-xs italic\">I</button> <button type=\"button\" class=\"btn btn-ghost btn-xs underline\">U</button> <button type=\"button\" class=\"btn btn-ghost btn-xs line-through\">S</button> <span class=\"mx-1 h-4 w-px bg-ink-200\"></span> <button type=\"button\" class=\"btn btn-ghost btn-xs\">•</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">1.</button> <button type=\"button\" class=\"btn btn-ghost btn-xs\">☐</button> <span class=\"mx-1 h-4 w-px bg-ink-200\"></span> <button type=\"button\" class=\"btn btn-ghost btn-xs\">⊞</button></div> <div><textarea class=\"terminal-input caret-[#39ff14] min-h-0 resize-none bg-black px-4 py-3 text-sm text-[#39ff14] outline-none placeholder:text-[#1f8f0c] svelte-1uva96y\"></textarea> <!></div> <div class=\"flex justify-end gap-2 border-t border-ink-200 px-5 py-3\"><button type=\"button\" class=\"btn btn-secondary\"> </button> <button type=\"button\" class=\"btn btn-primary\"> </button></div></div></div>"), Ll = {
	hash: "svelte-1uva96y",
	code: "\n	/* Same terminal look as SqlEditorModal/the script editor's code field,\n	   duplicated here since Svelte styles are scoped per-component -- applies\n	   only to the editing textarea, never the preview pane next to it. */.terminal-input.svelte-1uva96y {caret-shape:underscore;font-family:var(--font-terminal);}"
};
function Rl(e, t) {
	He(t, !0), Xr(e, Ll);
	let n = Y(t, "title", 7), r = Y(t, "value", 7), i = Y(t, "onSave", 7), a = Y(t, "onCancel", 7), o = /* @__PURE__ */ F(Qt(dr(() => r()))), s = /* @__PURE__ */ F(!1), c = /* @__PURE__ */ F(!1), l = /* @__PURE__ */ M(() => Ml(H(o))), u = /* @__PURE__ */ F(void 0);
	async function d() {
		if (!H(s)) {
			I(s, !0);
			try {
				await i()(H(o));
			} finally {
				I(s, !1);
			}
		}
	}
	function f(e, t, n) {
		let r = H(u);
		if (!r) return;
		let i = r.selectionStart, a = r.selectionEnd, s = H(o).slice(i, a) || n;
		I(o, H(o).slice(0, i) + e + s + t + H(o).slice(a));
		let c = i + e.length, l = c + s.length;
		requestAnimationFrame(() => {
			r.focus(), r.setSelectionRange(c, l);
		});
	}
	function p(e) {
		let t = H(u);
		if (!t) return;
		let n = t.selectionStart, r = t.selectionEnd, i = H(o).lastIndexOf("\n", n - 1) + 1, a = H(o).indexOf("\n", r);
		a === -1 && (a = H(o).length);
		let s = H(o).slice(i, a), c = s.split("\n").map((t) => t.startsWith(e) ? t.slice(e.length) : e + t).join("\n");
		I(o, H(o).slice(0, i) + c + H(o).slice(a));
		let l = c.length - s.length;
		requestAnimationFrame(() => {
			t.focus(), t.setSelectionRange(i, a + l);
		});
	}
	function m() {
		let e = H(u);
		if (!e) return;
		let t = e.selectionStart, n = e.selectionEnd, r = H(o).lastIndexOf("\n", t - 1) + 1, i = H(o).indexOf("\n", n);
		i === -1 && (i = H(o).length);
		let a = H(o).slice(r, i), s = a.split("\n").map((e) => e.startsWith("- [ ] ") ? "- [x] " + e.slice(6) : e.startsWith("- [x] ") ? e.slice(6) : "- [ ] " + e).join("\n");
		I(o, H(o).slice(0, r) + s + H(o).slice(i));
		let c = s.length - a.length;
		requestAnimationFrame(() => {
			e.focus(), e.setSelectionRange(r, i + c);
		});
	}
	function h() {
		let e = H(u);
		if (!e) return;
		let t = e.selectionStart;
		I(o, H(o).slice(0, t) + "\n| Spalte 1 | Spalte 2 |\n| --- | --- |\n| Wert | Wert |\n" + H(o).slice(t));
		let n = t + 55;
		requestAnimationFrame(() => {
			e.focus(), e.setSelectionRange(n, n);
		});
	}
	var g = {
		get title() {
			return n();
		},
		set title(e) {
			n(e), P();
		},
		get value() {
			return r();
		},
		set value(e) {
			r(e), P();
		},
		get onSave() {
			return i();
		},
		set onSave(e) {
			i(e), P();
		},
		get onCancel() {
			return a();
		},
		set onCancel(e) {
			a(e), P();
		}
	}, _ = Il(), v = L(_), y = L(v), b = L(y), x = L(b);
	j(b);
	var S = R(b, 2), C = L(S), ee = R(L(C));
	j(C);
	var w = R(C, 2), te = L(w, !0);
	j(w), j(S), j(y);
	var ne = R(y, 2), T = L(ne), re = R(T, 2), ie = R(re, 2), ae = R(ie, 2), oe = R(ae, 2), se = R(oe, 2), ce = R(se, 4), le = R(ce, 2), ue = R(le, 2), E = R(ue, 2), de = R(E, 4), fe = R(de, 2), pe = R(fe, 2), me = R(pe, 4);
	j(ne);
	var he = R(ne, 2), ge = L(he);
	it(ge), Ci(ge, (e) => I(u, e), () => H(u));
	var _e = R(ge, 2), ve = (e) => {
		var t = Fl(), n = L(t), r = (e) => {
			var t = Nl(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("markdownEdit.previewPlaceholder")]), G(e, t);
		}, i = /* @__PURE__ */ M(() => H(o).trim() === ""), a = (e) => {
			var t = Pl();
			Yr(t, () => H(l), !0), j(t), G(e, t);
		};
		q(n, (e) => {
			H(i) ? e(r) : e(a, -1);
		}), j(t), Zr(t, (e) => Ya?.(e)), G(e, t);
	};
	q(_e, (e) => {
		H(c) && e(ve);
	}), j(he);
	var ye = R(he, 2), D = L(ye), be = L(D, !0);
	j(D);
	var O = R(D, 2), xe = L(O, !0);
	return j(O), j(ye), j(v), j(_), z((e, t, r, i, a, o, l, u, d, f, p, m, h, g, _, v, y, b, S, C) => {
		K(x, `${e ?? ""} · ${n() ?? ""}`), K(ee, ` ${t ?? ""}`), K(te, r), J(T, "title", i), J(re, "title", a), J(ie, "title", o), J(ae, "title", l), J(oe, "title", u), J(se, "title", d), J(ce, "title", f), J(le, "title", p), J(ue, "title", m), J(E, "title", h), J(de, "title", g), J(fe, "title", _), J(pe, "title", v), J(me, "title", y), oi(he, 1, `grid min-h-0 flex-1 ${H(c) ? "grid-cols-2 divide-x divide-ink-200" : "grid-cols-1"}`), J(ge, "placeholder", b), K(be, S), O.disabled = H(s), K(xe, C);
	}, [
		() => X("markdownEdit.titlePrefix"),
		() => H(c) ? X("markdownEdit.hidePreview") : X("markdownEdit.showPreview"),
		() => X("common.close"),
		() => X("markdownEdit.toolbar.h1"),
		() => X("markdownEdit.toolbar.h2"),
		() => X("markdownEdit.toolbar.h3"),
		() => X("markdownEdit.toolbar.h4"),
		() => X("markdownEdit.toolbar.h5"),
		() => X("markdownEdit.toolbar.h6"),
		() => X("markdownEdit.toolbar.bold"),
		() => X("markdownEdit.toolbar.italic"),
		() => X("markdownEdit.toolbar.underline"),
		() => X("markdownEdit.toolbar.strikethrough"),
		() => X("markdownEdit.toolbar.ul"),
		() => X("markdownEdit.toolbar.ol"),
		() => X("markdownEdit.toolbar.checklist"),
		() => X("markdownEdit.toolbar.table"),
		() => X("markdownEdit.placeholder"),
		() => X("common.cancel"),
		() => H(s) ? X("common.saving") : X("common.save")
	]), U("click", C, () => I(c, !H(c))), U("click", w, function(...e) {
		a()?.apply(this, e);
	}), U("click", T, () => p("# ")), U("click", re, () => p("## ")), U("click", ie, () => p("### ")), U("click", ae, () => p("#### ")), U("click", oe, () => p("##### ")), U("click", se, () => p("###### ")), U("click", ce, () => f("**", "**", X("markdownEdit.toolbar.bold"))), U("click", le, () => f("_", "_", X("markdownEdit.toolbar.italic"))), U("click", ue, () => f("<u>", "</u>", X("markdownEdit.toolbar.underline"))), U("click", E, () => f("~~", "~~", X("markdownEdit.toolbar.strikethrough"))), U("click", de, () => p("- ")), U("click", fe, () => p("1. ")), U("click", pe, m), U("click", me, h), yi(ge, () => H(o), (e) => I(o, e)), U("click", D, function(...e) {
		a()?.apply(this, e);
	}), U("click", O, d), G(e, _), Ue(g);
}
yr(["click"]), ki(Rl, {
	title: {},
	value: {},
	onSave: {},
	onCancel: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/i18n/errors.ts
var zl = {
	de: ea.errors,
	en: ta.errors
};
function Bl(e) {
	return e instanceof Ai ? ((zl[$i.current] ?? zl.de)[e.code] ?? zl.de[e.code]) || e.message : e instanceof Error ? e.message : String(e);
}
//#endregion
//#region src/lib/components/RecordFormModal.svelte
var Vl = /* @__PURE__ */ W("<p class=\"text-xs text-ink-400\"> </p>"), Hl = /* @__PURE__ */ W("<p class=\"py-8 text-center text-sm text-ink-400\"> </p>"), Ul = /* @__PURE__ */ W("<p class=\"alert alert-danger\" role=\"alert\"> </p>"), Wl = /* @__PURE__ */ W("<span class=\"badge bg-ink-100 text-[10px] text-ink-500\"> </span>"), Gl = /* @__PURE__ */ W("<span class=\"badge inline-flex shrink-0 items-center gap-1 bg-ink-100 text-ink-700\"><button type=\"button\" class=\"hover:underline\"> </button> <button type=\"button\" class=\"rounded-full text-ink-400 hover:text-red-600\">×</button></span>"), Kl = /* @__PURE__ */ W("<div class=\"flex flex-wrap items-center gap-1 rounded-md border border-ink-300 bg-surface px-2 py-1.5\"><!> <!></div>"), ql = /* @__PURE__ */ W("<div class=\"rounded-md border border-ink-300 bg-surface px-2 py-1.5\"><!></div>"), Jl = /* @__PURE__ */ W("<a class=\"btn btn-primary btn-xs\"> </a>"), Yl = /* @__PURE__ */ W("<p class=\"input bg-ink-50 text-ink-500\">–</p>"), Xl = /* @__PURE__ */ W("<p class=\"input bg-ink-50 text-ink-500\"> </p>"), Zl = /* @__PURE__ */ W("<input type=\"checkbox\" class=\"size-4 accent-brand-600\"/>"), Ql = /* @__PURE__ */ W("<button type=\"button\" class=\"input flex items-center justify-between gap-2 text-left\"><span class=\"truncate\"> </span> <span class=\"shrink-0 text-xs text-brand-600\">✎</span></button>"), $l = /* @__PURE__ */ W("<a class=\"btn btn-secondary btn-xs shrink-0\"> </a>"), eu = /* @__PURE__ */ W("<div class=\"flex items-center gap-2\"><input class=\"input flex-1\"/> <!></div>"), tu = /* @__PURE__ */ W("<button type=\"button\" class=\"btn btn-secondary btn-xs shrink-0\"> </button>"), nu = /* @__PURE__ */ W("<div class=\"flex items-center gap-2\"><!> <!></div>"), ru = /* @__PURE__ */ W("<div class=\"flex items-center gap-2\"><input type=\"color\" class=\"size-8 shrink-0 cursor-pointer rounded border border-ink-200 bg-transparent p-0\"/> <input class=\"input flex-1\" placeholder=\"#rrggbb\"/></div>"), iu = /* @__PURE__ */ W("<input class=\"input\"/>"), au = /* @__PURE__ */ W("<label class=\"field\"><span class=\"flex items-center gap-2\"> <span class=\"font-normal text-ink-400\"> </span> <!></span> <!></label>"), ou = /* @__PURE__ */ W("<div class=\"space-y-3\"></div>"), su = /* @__PURE__ */ W("<div class=\"flex justify-end gap-2 border-t border-ink-200 px-5 py-3\"><button type=\"button\" class=\"btn btn-secondary\"> </button> <button type=\"button\" class=\"btn btn-primary\"> </button></div>"), cu = /* @__PURE__ */ W("<div class=\"fixed inset-0 grid place-items-center bg-ink-950/40 p-4\"><div class=\"card flex max-h-[85vh] w-full max-w-xl flex-col\"><div class=\"flex items-center justify-between border-b border-ink-200 px-5 py-3\"><div><h2 class=\"text-sm font-semibold text-ink-900\"> </h2> <!></div> <button class=\"btn btn-ghost btn-xs\"> </button></div> <div class=\"overlay-scroll min-h-0 flex-1 overflow-y-auto px-5 py-4\"><!></div> <!></div></div> <!> <!>", 1);
function lu(e, t) {
	He(t, !0);
	let n = Y(t, "tableId", 7), r = Y(t, "pk", 7), i = Y(t, "depth", 7, 0), a = Y(t, "onClose", 7), o = Y(t, "onSaved", 7), s = /* @__PURE__ */ F(null), c = /* @__PURE__ */ F(null), l = /* @__PURE__ */ F(!0), u = /* @__PURE__ */ F(null), d = /* @__PURE__ */ F(!1), f = /* @__PURE__ */ F(Qt({})), p = /* @__PURE__ */ F(Qt({})), m = /* @__PURE__ */ M(() => H(s)?.columns.find((e) => e.is_primary_key) ?? null), h = /* @__PURE__ */ M(() => H(s)?.columns.filter((e) => e.id !== H(m)?.id) ?? []);
	async function g() {
		I(l, !0), I(u, null);
		try {
			let e = await Ma(n());
			I(s, e, !0);
			let t = e.columns.find((e) => e.is_primary_key);
			if (!t) {
				I(u, X("recordForm.noPrimaryKey"), !0);
				return;
			}
			let i = (await Hi(n(), { where: {
				col: t.effective_name,
				op: "eq",
				val: r()
			} })).records[0];
			if (!i) {
				I(u, X("recordForm.notFound"), !0);
				return;
			}
			I(c, i, !0), _(e.columns, i);
		} catch (e) {
			I(u, Bl(e), !0);
		} finally {
			I(l, !1);
		}
	}
	function _(e, t) {
		let n = {}, r = {};
		for (let i of e) i.is_primary_key || i.field_kind !== "physical" || (i.ui_type === "boolean" ? r[i.effective_name] = ha(t[i.effective_name]) : n[i.effective_name] = Aa(t[i.effective_name], i));
		I(f, n, !0), I(p, r, !0);
	}
	vn(() => {
		g();
	});
	function v() {
		if (!H(c)) return {};
		let e = {};
		for (let t of H(h)) if (t.field_kind === "physical") {
			if (t.ui_type === "boolean") H(p)[t.effective_name] !== ha(H(c)[t.effective_name]) && (e[t.effective_name] = H(p)[t.effective_name]);
			else {
				let n = Aa(H(c)[t.effective_name], t);
				H(f)[t.effective_name] !== n && (e[t.effective_name] = H(f)[t.effective_name]);
			}
		}
		return e;
	}
	async function y() {
		if (H(d)) return;
		let e = v();
		if (Object.keys(e).length === 0) {
			a()();
			return;
		}
		I(d, !0), I(u, null);
		try {
			await Ui(n(), r(), e), o()?.(), a()();
		} catch (e) {
			I(u, Bl(e), !0);
		} finally {
			I(d, !1);
		}
	}
	async function b(e, t) {
		try {
			await Wi(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Bl(e), !0);
		}
	}
	async function x(e, t) {
		try {
			await Gi(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Bl(e), !0);
		}
	}
	async function S(e, t) {
		try {
			await Ia(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Bl(e), !0);
		}
	}
	async function C(e, t) {
		try {
			await La(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Bl(e), !0);
		}
	}
	let ee = /* @__PURE__ */ F(null);
	function w(e, t) {
		!e || t == null || I(ee, {
			tableId: e,
			pk: t
		}, !0);
	}
	let te = /* @__PURE__ */ F(null);
	var ne = {
		get tableId() {
			return n();
		},
		set tableId(e) {
			n(e), P();
		},
		get pk() {
			return r();
		},
		set pk(e) {
			r(e), P();
		},
		get depth() {
			return i();
		},
		set depth(e = 0) {
			i(e), P();
		},
		get onClose() {
			return a();
		},
		set onClose(e) {
			a(e), P();
		},
		get onSaved() {
			return o();
		},
		set onSaved(e) {
			o(e), P();
		}
	}, T = cu(), re = cn(T), ie = L(re), ae = L(ie), oe = L(ae), se = L(oe), ce = L(se, !0);
	j(se);
	var le = R(se, 2), ue = (e) => {
		var t = Vl(), n = L(t);
		j(t), z((e) => K(n, `${H(m).effective_name ?? ""}: ${e ?? ""}`), [() => ca(r())]), G(e, t);
	};
	q(le, (e) => {
		H(m) && e(ue);
	}), j(oe);
	var E = R(oe, 2), de = L(E, !0);
	j(E), j(ae);
	var fe = R(ae, 2), pe = L(fe), me = (e) => {
		var t = Hl(), n = L(t, !0);
		j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
	}, he = (e) => {
		var t = Ul(), n = L(t, !0);
		j(t), z(() => K(n, H(u))), G(e, t);
	}, ge = (e) => {
		var t = ou();
		Ur(t, 21, () => H(h), (e) => e.id, (e, t) => {
			var i = au(), a = L(i), o = L(a), s = R(o), l = L(s, !0);
			j(s);
			var u = R(s, 2), d = (e) => {
				var n = Wl(), r = L(n, !0);
				j(n), z((e) => K(r, e), [() => Da(H(t))]), G(e, n);
			}, m = /* @__PURE__ */ M(() => Da(H(t)));
			q(u, (e) => {
				H(m) && e(d);
			}), j(a);
			var h = R(a, 2), g = (e) => {
				var n = Kl(), r = L(n);
				Ur(r, 17, () => Oa(H(c)[H(t).effective_name]), (e) => e.id, (e, n) => {
					var r = Gl(), i = L(r), a = L(i, !0);
					j(i);
					var o = R(i, 2);
					j(r), z((e, t) => {
						K(a, e), J(o, "aria-label", t);
					}, [() => ca(H(n).label), () => X("recordForm.removeLink", { label: ca(H(n).label) })]), U("click", i, () => w(H(t).links_target_table_id, H(n).id)), U("click", o, () => x(H(t), H(n).id)), G(e, r);
				});
				var i = R(r, 2), a = (e) => {
					{
						let n = /* @__PURE__ */ M(() => Oa(H(c)[H(t).effective_name]).map((e) => e.id));
						Eo(e, {
							get targetTableId() {
								return H(t).links_target_table_id;
							},
							get excludeIds() {
								return H(n);
							},
							onSelect: (e) => b(H(t), e)
						});
					}
				};
				q(i, (e) => {
					H(t).links_target_table_id && e(a);
				}), j(n), G(e, n);
			}, _ = (e) => {
				var i = ql(), a = L(i);
				{
					let e = /* @__PURE__ */ M(() => H(c)[H(t).effective_name] ?? []);
					Ja(a, {
						get files() {
							return H(e);
						},
						get tableId() {
							return n();
						},
						get pk() {
							return r();
						},
						get columnId() {
							return H(t).id;
						},
						onUpload: (e) => S(H(t), e),
						onDelete: (e) => C(H(t), e)
					});
				}
				j(i), G(e, i);
			}, v = (e) => {
				var n = kr(), r = cn(n), i = (e) => {
					var n = Jl(), r = L(n, !0);
					j(n), z((e, i) => {
						J(n, "href", e), J(n, "target", H(t).format_config.target ?? "_blank"), J(n, "rel", (H(t).format_config.target ?? "_blank") === "_blank" ? "noopener noreferrer" : void 0), K(r, i);
					}, [() => ma(H(t), H(c)[H(t).effective_name]), () => H(t).format_config.label ?? X("recordForm.open")]), G(e, n);
				}, a = (e) => {
					G(e, Yl());
				};
				q(r, (e) => {
					H(c)[H(t).effective_name] !== null && H(c)[H(t).effective_name] !== void 0 ? e(i) : e(a, -1);
				}), G(e, n);
			}, y = (e) => {
				var n = Xl(), r = L(n, !0);
				j(n), z((e) => K(r, e), [() => da(H(c), H(t)) ?? Ea(H(c)[H(t).effective_name], H(t))]), G(e, n);
			}, ee = (e) => {
				var n = Zl();
				pi(n), z(() => hi(n, H(p)[H(t).effective_name])), U("change", n, (e) => H(p)[H(t).effective_name] = e.currentTarget.checked), G(e, n);
			}, ne = (e) => {
				{
					let n = /* @__PURE__ */ M(() => H(t).format_config.colors ?? {});
					go(e, {
						get colors() {
							return H(n);
						},
						get order() {
							return H(t).format_config.order;
						},
						class: "input",
						get value() {
							return H(f)[H(t).effective_name];
						},
						set value(e) {
							H(f)[H(t).effective_name] = e;
						}
					});
				}
			}, T = (e) => {
				var n = Ql(), r = L(n), i = L(r, !0);
				j(r), Pe(2), j(n), z((e) => K(i, e), [() => H(f)[H(t).effective_name]?.trim() || X("recordForm.editMarkdown")]), U("click", n, () => I(te, H(t), !0)), G(e, n);
			}, re = (e) => {
				var n = eu(), r = L(n);
				pi(r);
				var i = R(r, 2), a = (e) => {
					var n = $l(), r = L(n, !0);
					j(n), z((e, i) => {
						J(n, "href", e), J(n, "target", H(t).format_config.target ?? "_blank"), J(n, "rel", (H(t).format_config.target ?? "_blank") === "_blank" ? "noopener noreferrer" : void 0), K(r, i);
					}, [() => ma(H(t), H(c)[H(t).effective_name]), () => X("recordForm.open")]), G(e, n);
				};
				q(i, (e) => {
					H(c)[H(t).effective_name] !== null && H(c)[H(t).effective_name] !== void 0 && e(a);
				}), j(n), yi(r, () => H(f)[H(t).effective_name], (e) => H(f)[H(t).effective_name] = e), G(e, n);
			}, ie = (e) => {
				var n = nu(), r = L(n);
				{
					let e = /* @__PURE__ */ M(() => da(H(c), H(t)) ?? ca(H(c)[H(t).effective_name]));
					so(r, {
						get fkTargetTableId() {
							return H(t).fk_target_table_id;
						},
						get fkTargetColumn() {
							return H(t).fk_target_column;
						},
						get uiType() {
							return H(t).ui_type;
						},
						get nullable() {
							return H(t).is_nullable;
						},
						get currentLabel() {
							return H(e);
						},
						class: "input flex-1",
						get value() {
							return H(f)[H(t).effective_name];
						},
						set value(e) {
							H(f)[H(t).effective_name] = e;
						}
					});
				}
				var i = R(r, 2), a = (e) => {
					var n = tu(), r = L(n, !0);
					j(n), z((e) => K(r, e), [() => X("recordForm.open")]), U("click", n, () => w(H(t).fk_target_table_id, H(c)?.[H(t).effective_name])), G(e, n);
				};
				q(i, (e) => {
					H(c)[H(t).effective_name] !== null && H(c)[H(t).effective_name] !== void 0 && e(a);
				}), j(n), G(e, n);
			}, ae = (e) => {
				var n = ru(), r = L(n);
				pi(r);
				var i = R(r, 2);
				pi(i), j(n), z((e) => mi(r, e), [() => za(H(f)[H(t).effective_name]) ? H(f)[H(t).effective_name] : "#000000"]), U("change", r, (e) => H(f)[H(t).effective_name] = e.currentTarget.value), yi(i, () => H(f)[H(t).effective_name], (e) => H(f)[H(t).effective_name] = e), G(e, n);
			}, oe = (e) => {
				var n = iu();
				pi(n), z((e, t) => {
					J(n, "type", e), J(n, "step", t);
				}, [() => ja(H(t).ui_type).type, () => ja(H(t).ui_type).step]), yi(n, () => H(f)[H(t).effective_name], (e) => H(f)[H(t).effective_name] = e), G(e, n);
			};
			q(h, (e) => {
				H(t).field_kind === "links" ? e(g) : H(t).field_kind === "attachment" ? e(_, 1) : H(t).display_format === "button" ? e(v, 2) : H(t).field_kind === "physical" ? H(t).ui_type === "boolean" ? e(ee, 4) : H(t).display_format === "label" ? e(ne, 5) : H(t).display_format === "markdown" ? e(T, 6) : H(t).display_format === "email" || H(t).display_format === "phone" || H(t).display_format === "url" ? e(re, 7) : H(t).is_foreign_key && H(t).fk_target_table_id && H(t).fk_target_column ? e(ie, 8) : H(t).display_format === "color" ? e(ae, 9) : e(oe, -1) : e(y, 3);
			}), j(i), z(() => {
				K(o, `${H(t).effective_name ?? ""} `), K(l, H(t).ui_type);
			}), G(e, i);
		}), j(t), G(e, t);
	};
	q(pe, (e) => {
		H(l) ? e(me) : H(u) ? e(he, 1) : H(c) && e(ge, 2);
	}), j(fe), Zr(fe, (e) => Ya?.(e));
	var _e = R(fe, 2), ve = (e) => {
		var t = su(), n = L(t), r = L(n, !0);
		j(n);
		var i = R(n, 2), o = L(i, !0);
		j(i), j(t), z((e, t) => {
			K(r, e), i.disabled = H(d), K(o, t);
		}, [() => X("common.cancel"), () => H(d) ? X("common.saving") : X("common.save")]), U("click", n, function(...e) {
			a()?.apply(this, e);
		}), U("click", i, y), G(e, t);
	};
	q(_e, (e) => {
		!H(l) && !H(u) && e(ve);
	}), j(ie), j(re);
	var ye = R(re, 2), D = (e) => {
		{
			let t = /* @__PURE__ */ M(() => H(f)[H(te).effective_name] ?? "");
			Rl(e, {
				get title() {
					return H(te).effective_name;
				},
				get value() {
					return H(t);
				},
				onSave: (e) => {
					H(te) && (H(f)[H(te).effective_name] = e), I(te, null);
				},
				onCancel: () => I(te, null)
			});
		}
	};
	q(ye, (e) => {
		H(te) && e(D);
	});
	var be = R(ye, 2), O = (e) => {
		{
			let t = /* @__PURE__ */ M(() => i() + 1);
			lu(e, {
				get tableId() {
					return H(ee).tableId;
				},
				get pk() {
					return H(ee).pk;
				},
				get depth() {
					return H(t);
				},
				onClose: () => I(ee, null),
				onSaved: () => {
					g(), o()?.();
				}
			});
		}
	};
	return q(be, (e) => {
		H(ee) && e(O);
	}), z((e, t) => {
		ci(re, `z-index: ${40 + i() * 10}`), K(ce, e), K(de, t);
	}, [() => H(s) ? `${H(s).schema_name}.${H(s).table_name}` : X("recordForm.record"), () => X("common.close")]), U("click", E, function(...e) {
		a()?.apply(this, e);
	}), G(e, T), Ue(ne);
}
yr(["click", "change"]), ki(lu, {
	tableId: {},
	pk: {},
	depth: {},
	onClose: {},
	onSaved: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/viewmodules/calendar/CalendarView.svelte
var uu = /* @__PURE__ */ W("<button type=\"button\"> </button>"), du = /* @__PURE__ */ W("<p class=\"px-4 py-10 text-center text-sm text-ink-500\"> </p>"), fu = /* @__PURE__ */ W("<p class=\"alert alert-danger mb-3\"> </p>"), pu = /* @__PURE__ */ W("<span> </span>"), mu = /* @__PURE__ */ W("<span class=\"absolute bottom-0.5 size-1 rounded-full bg-brand-500\"></span>"), hu = /* @__PURE__ */ W("<div> <!></div>"), gu = /* @__PURE__ */ W("<div class=\"grid grid-cols-7 gap-0.5\"></div>"), _u = /* @__PURE__ */ W("<div class=\"rounded-md border border-ink-200 p-2\"><button type=\"button\" class=\"mb-1 block w-full text-left text-xs font-semibold text-ink-700 hover:text-brand-600\"> </button> <div class=\"grid grid-cols-7 gap-0.5 text-center text-[10px] text-ink-400\"></div> <!></div>"), vu = /* @__PURE__ */ W("<div class=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4\"></div>"), yu = /* @__PURE__ */ W("<div class=\"bg-ink-50 px-2 py-1 text-center font-medium text-ink-500\"> </div>"), bu = /* @__PURE__ */ W("<button type=\"button\" class=\"block w-full truncate rounded bg-brand-50 px-1 py-0.5 text-left text-[11px] text-brand-700 hover:bg-brand-100\"> </button>"), xu = /* @__PURE__ */ W("<div><span> </span> <!></div>"), Su = /* @__PURE__ */ W("<div class=\"grid grid-cols-7 gap-px overflow-hidden rounded-md border border-ink-200 bg-ink-200 text-xs\"><!> <!></div>"), Cu = /* @__PURE__ */ W("<span class=\"shrink-0 font-medium\"> </span>"), wu = /* @__PURE__ */ W("<button type=\"button\" class=\"flex w-full items-baseline gap-1 truncate rounded bg-brand-50 px-1.5 py-1 text-left text-[11px] text-brand-700 hover:bg-brand-100\"><!> <span class=\"truncate\"> </span></button>"), Tu = /* @__PURE__ */ W("<div class=\"min-h-40 space-y-1 bg-surface p-2\"><p> </p> <!></div>"), Eu = /* @__PURE__ */ W("<div class=\"grid grid-cols-7 gap-px overflow-hidden rounded-md border border-ink-200 bg-ink-200 text-xs\"></div>"), Du = /* @__PURE__ */ W("<span class=\"shrink-0 font-medium text-ink-500\"> </span>"), Ou = /* @__PURE__ */ W("<button type=\"button\" class=\"flex w-full items-baseline gap-2 rounded-md border border-ink-200 bg-surface px-3 py-2 text-left text-sm text-ink-800 hover:bg-ink-50\"><!> <span class=\"truncate\"> </span></button>"), ku = /* @__PURE__ */ W("<p class=\"px-2 py-8 text-center text-sm text-ink-400\"> </p>"), Au = /* @__PURE__ */ W("<div class=\"space-y-1.5\"></div>"), ju = /* @__PURE__ */ W("<p class=\"mt-2 text-center text-xs text-ink-400\"> </p>"), Mu = /* @__PURE__ */ W("<div class=\"flex-1 overflow-auto p-3\"><!> <!> <!></div>"), Nu = /* @__PURE__ */ W("<div class=\"flex h-full flex-col bg-surface\"><div class=\"flex flex-wrap items-center justify-between gap-2 border-b border-ink-200 px-4 py-2\"><div class=\"flex items-center gap-2\"><button type=\"button\" class=\"btn btn-secondary btn-xs\"> </button> <button type=\"button\" class=\"grid size-7 place-items-center rounded-md text-ink-500 hover:bg-ink-100\"><svg class=\"size-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"15 18 9 12 15 6\"></polyline></svg></button> <button type=\"button\" class=\"grid size-7 place-items-center rounded-md text-ink-500 hover:bg-ink-100\"><svg class=\"size-4\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"9 18 15 12 9 6\"></polyline></svg></button> <span class=\"text-sm font-semibold text-ink-900\"> </span></div> <div class=\"flex gap-1 rounded-md border border-ink-200 p-0.5\"></div></div> <!></div> <!>", 1);
function Pu(e, t) {
	He(t, !0);
	let n = Y(t, "table", 7), r = Y(t, "moduleConfig", 7), i = Y(t, "viewId", 7), a = Y(t, "where", 7), o = Y(t, "onRecordSaved", 7), s = /* @__PURE__ */ M(() => {
		let e = n().columns.filter((e) => e.is_primary_key);
		return e.length === 1 ? e[0] : null;
	}), c = /* @__PURE__ */ M(() => n().columns.find((e) => e.id === r().start_column_id) ?? null), l = /* @__PURE__ */ M(() => n().columns.find((e) => e.id === r().end_column_id) ?? null), u = /* @__PURE__ */ M(() => n().columns.find((e) => e.id === r().title_column_id) ?? null), d = /* @__PURE__ */ F("month"), f = /* @__PURE__ */ F(Qt(Date.UTC((/* @__PURE__ */ new Date()).getFullYear(), (/* @__PURE__ */ new Date()).getMonth(), (/* @__PURE__ */ new Date()).getDate()))), p = 864e5;
	function m(e) {
		let t = new Date(e);
		return {
			y: t.getUTCFullYear(),
			m: t.getUTCMonth(),
			d: t.getUTCDate()
		};
	}
	function h(e) {
		return (new Date(e).getUTCDay() + 6) % 7;
	}
	function g(e) {
		return e - h(e) * p;
	}
	function _(e) {
		let { y: t, m: n } = m(e);
		return Date.UTC(t, n, 1);
	}
	function v(e) {
		let { y: t } = m(e);
		return Date.UTC(t, 0, 1);
	}
	function y(e, t) {
		let { y: n, m: r, d: i } = m(e);
		return Date.UTC(n, r + t, i);
	}
	function b(e) {
		let t = ca(e);
		if (!t || t.length < 10) return null;
		let n = parseInt(t.slice(0, 4), 10), r = parseInt(t.slice(5, 7), 10), i = parseInt(t.slice(8, 10), 10);
		return !n || !r || !i ? null : Date.UTC(n, r - 1, i);
	}
	function x(e) {
		let { y: t, m: n, d: r } = m(e);
		return `${t}-${String(n + 1).padStart(2, "0")}-${String(r).padStart(2, "0")}`;
	}
	function S(e) {
		let t = ca(e);
		return !t || t.length < 16 ? null : t.slice(11, 16);
	}
	let C = /* @__PURE__ */ M(() => {
		if (H(d) === "day") return {
			start: H(f),
			end: H(f) + p
		};
		if (H(d) === "week") {
			let e = g(H(f));
			return {
				start: e,
				end: e + 7 * p
			};
		}
		if (H(d) === "year") {
			let e = v(H(f));
			return {
				start: e,
				end: Date.UTC(m(e).y + 1, 0, 1)
			};
		}
		let e = _(H(f));
		return {
			start: e,
			end: y(e, 1)
		};
	}), ee = /* @__PURE__ */ M(() => H(d) === "month" ? {
		start: g(H(C).start),
		end: g(H(C).end - 1) + 7 * p
	} : H(C)), w = /* @__PURE__ */ F(Qt([])), te = /* @__PURE__ */ F(!1), ne = /* @__PURE__ */ F(null);
	vn(() => {
		if (!H(c) || !H(l) || !H(s)) {
			I(w, [], !0);
			return;
		}
		let { start: e, end: t } = H(ee), r = { and: [{
			col: H(c).effective_name,
			op: "lt",
			val: x(t)
		}, {
			col: H(l).effective_name,
			op: "gte",
			val: x(e)
		}] }, i = Li(a(), r);
		I(te, !0), I(ne, null), Hi(n().id, {
			where: i,
			limit: 500
		}).then((e) => {
			let t = [];
			for (let n of e.records) {
				let e = b(n[H(c).effective_name]), r = b(n[H(l).effective_name]) ?? e;
				e !== null && r !== null && t.push({
					pk: n[H(s).effective_name],
					title: H(u) ? ka(n, H(u)) : ca(n[H(s).effective_name]),
					start: e,
					end: r,
					startTime: S(n[H(c).effective_name]),
					endTime: S(n[H(l).effective_name])
				});
			}
			I(w, t, !0);
		}).catch((e) => {
			I(w, [], !0), I(ne, e instanceof Error ? e.message : String(e), !0);
		}).finally(() => {
			I(te, !1);
		});
	});
	function T(e) {
		return H(w).filter((t) => e >= t.start && e <= t.end).sort((e, t) => (e.startTime ?? "").localeCompare(t.startTime ?? ""));
	}
	let re = /* @__PURE__ */ F(null);
	function ie(e) {
		I(re, {
			tableId: n().id,
			pk: e
		}, !0);
	}
	function ae() {
		let e = /* @__PURE__ */ new Date();
		I(f, Date.UTC(e.getFullYear(), e.getMonth(), e.getDate()), !0);
	}
	function oe() {
		H(d) === "day" ? I(f, H(f) - p) : H(d) === "week" ? I(f, H(f) - 7 * p) : H(d) === "year" ? I(f, Date.UTC(m(H(f)).y - 1, m(H(f)).m, m(H(f)).d), !0) : I(f, y(H(f), -1), !0);
	}
	function se() {
		H(d) === "day" ? I(f, H(f) + p) : H(d) === "week" ? I(f, H(f) + 7 * p) : H(d) === "year" ? I(f, Date.UTC(m(H(f)).y + 1, m(H(f)).m, m(H(f)).d), !0) : I(f, y(H(f), 1), !0);
	}
	let ce = {
		de: [
			"Januar",
			"Februar",
			"März",
			"April",
			"Mai",
			"Juni",
			"Juli",
			"August",
			"September",
			"Oktober",
			"November",
			"Dezember"
		],
		en: [
			"January",
			"February",
			"March",
			"April",
			"May",
			"June",
			"July",
			"August",
			"September",
			"October",
			"November",
			"December"
		]
	}, le = {
		de: [
			"Mo",
			"Di",
			"Mi",
			"Do",
			"Fr",
			"Sa",
			"So"
		],
		en: [
			"Mon",
			"Tue",
			"Wed",
			"Thu",
			"Fri",
			"Sat",
			"Sun"
		]
	}, ue = /* @__PURE__ */ M(() => {
		let { y: e, m: t, d: n } = m(H(f)), r = ce[$i.current];
		if (H(d) === "year") return String(e);
		if (H(d) === "month") return `${r[t]} ${e}`;
		if (H(d) === "day") return `${n}. ${r[t]} ${e}`;
		let i = m(g(H(f))), a = m(g(H(f)) + 6 * p);
		return `${i.d}. ${r[i.m]} – ${a.d}. ${r[a.m]} ${a.y}`;
	}), E = /* @__PURE__ */ M(() => {
		let e = [];
		for (let t = H(ee).start; t < H(ee).end; t += p) e.push(t);
		return e;
	}), de = /* @__PURE__ */ M(() => {
		let e = [];
		for (let t = 0; t < H(E).length; t += 7) e.push(H(E).slice(t, t + 7));
		return e;
	});
	function fe(e) {
		let t = y(e, 1), n = g(e), r = g(t - 1) + 7 * p, i = [];
		for (let e = n; e < r; e += p) i.push(e);
		let a = [];
		for (let e = 0; e < i.length; e += 7) a.push(i.slice(e, e + 7));
		return a;
	}
	function pe(e) {
		let t = /* @__PURE__ */ new Date();
		return e === Date.UTC(t.getFullYear(), t.getMonth(), t.getDate());
	}
	function me(e) {
		return m(e).m === m(H(f)).m;
	}
	var he = {
		get table() {
			return n();
		},
		set table(e) {
			n(e), P();
		},
		get moduleConfig() {
			return r();
		},
		set moduleConfig(e) {
			r(e), P();
		},
		get viewId() {
			return i();
		},
		set viewId(e) {
			i(e), P();
		},
		get where() {
			return a();
		},
		set where(e) {
			a(e), P();
		},
		get onRecordSaved() {
			return o();
		},
		set onRecordSaved(e) {
			o(e), P();
		}
	}, ge = Nu(), _e = cn(ge), ve = L(_e), ye = L(ve), D = L(ye), be = L(D, !0);
	j(D);
	var O = R(D, 2), xe = R(O, 2), Se = R(xe, 2), Ce = L(Se, !0);
	j(Se), j(ye);
	var we = R(ye, 2);
	Ur(we, 20, () => [
		"day",
		"week",
		"month",
		"year"
	], (e) => e, (e, t) => {
		var n = uu(), r = L(n, !0);
		j(n), z((e) => {
			oi(n, 1, `rounded px-2.5 py-1 text-xs font-medium transition-colors ${H(d) === t ? "bg-brand-600 text-white" : "text-ink-600 hover:bg-ink-100"}`), K(r, e);
		}, [() => X(`calendarView.${t}`)]), U("click", n, () => I(d, t, !0)), G(e, n);
	}), j(we), j(ve);
	var Te = R(ve, 2), Ee = (e) => {
		var t = du(), n = L(t, !0);
		j(t), z((e) => K(n, e), [() => X("calendarView.notConfigured")]), G(e, t);
	}, De = (e) => {
		var t = Mu(), n = L(t), r = (e) => {
			var t = fu(), n = L(t, !0);
			j(t), z(() => K(n, H(ne))), G(e, t);
		};
		q(n, (e) => {
			H(ne) && e(r);
		});
		var i = R(n, 2), a = (e) => {
			var t = vu();
			Ur(t, 20, () => Array.from({ length: 12 }, (e, t) => Date.UTC(m(H(f)).y, t, 1)), (e) => e, (e, t) => {
				var n = _u(), r = L(n), i = L(r, !0);
				j(r);
				var a = R(r, 2);
				Ur(a, 20, () => le[$i.current], (e) => e, (e, t) => {
					var n = pu(), r = L(n, !0);
					j(n), z(() => K(r, t[0])), G(e, n);
				}), j(a), Ur(R(a, 2), 17, () => fe(t), zr, (e, n) => {
					var r = gu();
					Ur(r, 20, () => H(n), (e) => e, (e, n) => {
						let r = /* @__PURE__ */ M(() => T(n));
						var i = hu(), a = L(i), o = R(a), s = (e) => {
							G(e, mu());
						};
						q(o, (e) => {
							H(r).length > 0 && e(s);
						}), j(i), z((e, t, n) => {
							oi(i, 1, `relative grid aspect-square place-items-center rounded text-[10px]
												${e ?? ""}
												${t ?? ""}`), K(a, `${n ?? ""} `);
						}, [
							() => m(n).m === m(t).m ? "text-ink-700" : "text-ink-300",
							() => pe(n) ? "bg-brand-100 font-semibold text-brand-700" : "",
							() => m(n).d
						]), G(e, i);
					}), j(r), G(e, r);
				}), j(n), z((e) => K(i, e), [() => ce[$i.current][m(t).m]]), U("click", r, () => {
					I(f, t, !0), I(d, "month");
				}), G(e, n);
			}), j(t), G(e, t);
		}, o = (e) => {
			var t = Su(), n = L(t);
			Ur(n, 16, () => le[$i.current], (e) => e, (e, t) => {
				var n = yu(), r = L(n, !0);
				j(n), z(() => K(r, t)), G(e, n);
			}), Ur(R(n, 2), 17, () => H(de), zr, (e, t) => {
				var n = kr();
				Ur(cn(n), 16, () => H(t), (e) => e, (e, t) => {
					let n = /* @__PURE__ */ M(() => T(t));
					var r = xu(), i = L(r), a = L(i, !0);
					j(i), Ur(R(i, 2), 17, () => H(n), (e) => e.pk, (e, t) => {
						var n = bu(), r = L(n, !0);
						j(n), z(() => K(r, H(t).title)), U("click", n, () => ie(H(t).pk)), G(e, n);
					}), j(r), z((e, t, n) => {
						oi(r, 1, `min-h-24 space-y-0.5 bg-surface p-1 ${e ?? ""}`), oi(i, 1, `text-[11px] ${t ?? ""}`), K(a, n);
					}, [
						() => me(t) ? "" : "bg-ink-50/60",
						() => pe(t) ? "inline-flex size-5 items-center justify-center rounded-full bg-brand-600 font-semibold text-white" : me(t) ? "text-ink-600" : "text-ink-300",
						() => m(t).d
					]), G(e, r);
				}), G(e, n);
			}), j(t), G(e, t);
		}, s = (e) => {
			var t = Eu();
			Ur(t, 20, () => H(E), (e) => e, (e, t) => {
				let n = /* @__PURE__ */ M(() => T(t));
				var r = Tu(), i = L(r), a = L(i);
				j(i), Ur(R(i, 2), 17, () => H(n), (e) => e.pk, (e, t) => {
					var n = wu(), r = L(n), i = (e) => {
						var n = Cu(), r = L(n, !0);
						j(n), z(() => K(r, H(t).startTime)), G(e, n);
					};
					q(r, (e) => {
						H(t).startTime && e(i);
					});
					var a = R(r, 2), o = L(a, !0);
					j(a), j(n), z(() => K(o, H(t).title)), U("click", n, () => ie(H(t).pk)), G(e, n);
				}), j(r), z((e, t, n) => {
					oi(i, 1, `text-[11px] font-medium ${e ?? ""}`), K(a, `${t ?? ""} ${n ?? ""}`);
				}, [
					() => pe(t) ? "text-brand-700" : "text-ink-500",
					() => le[$i.current][h(t)],
					() => m(t).d
				]), G(e, r);
			}), j(t), G(e, t);
		}, c = (e) => {
			var t = Au();
			Ur(t, 21, () => T(H(f)), (e) => e.pk, (e, t) => {
				var n = Ou(), r = L(n), i = (e) => {
					var n = Du(), r = L(n);
					j(n), z(() => K(r, `${H(t).startTime ?? ""}${H(t).endTime && H(t).endTime !== H(t).startTime ? `–${H(t).endTime}` : ""}`)), G(e, n);
				};
				q(r, (e) => {
					H(t).startTime && e(i);
				});
				var a = R(r, 2), o = L(a, !0);
				j(a), j(n), z(() => K(o, H(t).title)), U("click", n, () => ie(H(t).pk)), G(e, n);
			}, (e) => {
				var t = ku(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("dataGrid.noRows")]), G(e, t);
			}), j(t), G(e, t);
		};
		q(i, (e) => {
			H(d) === "year" ? e(a) : H(d) === "month" ? e(o, 1) : H(d) === "week" ? e(s, 2) : e(c, -1);
		});
		var l = R(i, 2), u = (e) => {
			var t = ju(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
		};
		q(l, (e) => {
			H(te) && e(u);
		}), j(t), G(e, t);
	};
	q(Te, (e) => {
		!H(c) || !H(l) ? e(Ee) : e(De, -1);
	}), j(_e);
	var Oe = R(_e, 2), ke = (e) => {
		lu(e, {
			get tableId() {
				return H(re).tableId;
			},
			get pk() {
				return H(re).pk;
			},
			onClose: () => I(re, null),
			onSaved: () => {
				I(re, null), o()?.();
			}
		});
	};
	return q(Oe, (e) => {
		H(re) && e(ke);
	}), z((e, t, n) => {
		K(be, e), J(O, "aria-label", t), J(xe, "aria-label", n), K(Ce, H(ue));
	}, [
		() => X("calendarView.today"),
		() => X("calendarView.previous"),
		() => X("calendarView.next")
	]), U("click", D, ae), U("click", O, oe), U("click", xe, se), G(e, ge), Ue(he);
}
yr(["click"]), customElements.define("calendar-view", ki(Pu, {
	table: {},
	moduleConfig: {},
	viewId: {},
	where: {},
	onRecordSaved: {}
}, [], []));
//#endregion
export { Pu as default };
