//#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, w = 16384, T = 32768, ee = 1 << 25, te = 65536, ne = 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");
function ve(e) {
	throw Error("https://svelte.dev/e/lifecycle_outside_component");
}
//#endregion
//#region node_modules/svelte/src/internal/client/errors.js
function ye() {
	throw Error("https://svelte.dev/e/async_derived_orphan");
}
function D(e, t, n) {
	throw Error("https://svelte.dev/e/each_key_duplicate");
}
function be(e) {
	throw Error("https://svelte.dev/e/effect_in_teardown");
}
function O() {
	throw Error("https://svelte.dev/e/effect_in_unowned_derived");
}
function xe(e) {
	throw Error("https://svelte.dev/e/effect_orphan");
}
function Se() {
	throw Error("https://svelte.dev/e/effect_update_depth_exceeded");
}
function Ce() {
	throw Error("https://svelte.dev/e/hydration_failed");
}
function we(e) {
	throw Error("https://svelte.dev/e/props_invalid_value");
}
function Te() {
	throw Error("https://svelte.dev/e/state_descriptors_fixed");
}
function Ee() {
	throw Error("https://svelte.dev/e/state_prototype_fixed");
}
function De() {
	throw Error("https://svelte.dev/e/state_unsafe_mutation");
}
function Oe() {
	throw Error("https://svelte.dev/e/svelte_boundary_reset_onerror");
}
function ke() {
	console.warn("https://svelte.dev/e/derived_inert");
}
function Ae(e) {
	console.warn("https://svelte.dev/e/hydration_mismatch");
}
function je() {
	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 Me(e) {
	k = e;
}
var A;
function Ne(t) {
	if (t === null) throw Ae(), e;
	return A = t;
}
function Pe() {
	return Ne(/* @__PURE__ */ cn(A));
}
function j(t) {
	if (k) {
		if (/* @__PURE__ */ cn(A) !== null) throw Ae(), e;
		A = t;
	}
}
function Fe(e = 1) {
	if (k) {
		for (var t = e, n = A; t--;) n = /* @__PURE__ */ cn(n);
		A = n;
	}
}
function Ie(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__ */ cn(n);
		e && n.remove(), n = i;
	}
}
function Le(t) {
	if (!t || t.nodeType !== 8) throw Ae(), e;
	return t.data;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/equality.js
function Re(e) {
	return e === this.v;
}
function ze(e, t) {
	return e == e ? e !== t || typeof e == "object" && !!e || typeof e == "function" : t == t;
}
function Be(e) {
	return !ze(e, this.v);
}
//#endregion
//#region node_modules/svelte/src/internal/client/context.js
var Ve = null;
function He(e) {
	Ve = e;
}
function Ue(e, t = !1, n) {
	Ve = {
		p: Ve,
		i: !1,
		c: null,
		e: null,
		s: e,
		x: null,
		r: V,
		l: null
	};
}
function We(e) {
	var t = Ve, n = t.e;
	if (n !== null) {
		t.e = null;
		for (var r of n) bn(r);
	}
	return e !== void 0 && (t.x = e), t.i = !0, Ve = t.p, e ?? {};
}
function Ge() {
	return !0;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/task.js
var Ke = [];
function qe() {
	var e = Ke;
	Ke = [], v(e);
}
function Je(e) {
	if (Ke.length === 0 && !jt) {
		var t = Ke;
		queueMicrotask(() => {
			t === Ke && qe();
		});
	}
	Ke.push(e);
}
function Ye() {
	for (; Ke.length > 0;) qe();
}
function Xe(e) {
	var t = V;
	if (t === null) return B.f |= ce, e;
	if (!(t.f & 32768) && !(t.f & 4)) throw e;
	Ze(e, t);
}
function Ze(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 Qe = ~(x | S | b);
function $e(e, t) {
	e.f = e.f & Qe | t;
}
function et(e) {
	e.f & 512 || e.deps === null ? $e(e, b) : $e(e, S);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/utils.js
function tt(e) {
	if (e !== null) for (let t of e) !(t.f & 2) || !(t.f & 65536) || (t.f ^= ae, tt(t.deps));
}
function nt(e, t, n) {
	e.f & 2048 ? t.add(e) : e.f & 4096 && n.add(e), tt(e.deps), $e(e, b);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/store.js
var rt = !1;
function it(e) {
	var t = rt;
	try {
		return rt = !1, [e(), rt];
	} finally {
		rt = t;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/misc.js
function at(e) {
	k && /* @__PURE__ */ sn(e) !== null && un(e);
}
var ot = !1;
function st() {
	ot || (ot = !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 ct(e) {
	var t = B, n = V;
	Wn(null), Gn(null);
	try {
		return e();
	} finally {
		Wn(t), Gn(n);
	}
}
function lt(e, t, n, r = n) {
	e.addEventListener(t, () => ct(n));
	let i = e[he];
	e[he] = i ? () => {
		i(), r(!0);
	} : () => r(!0), st();
}
//#endregion
//#region node_modules/svelte/src/reactivity/create-subscriber.js
function ut(e) {
	let t = 0, n = qt(0), r;
	return () => {
		_n() && (H(n), Tn(() => (t === 0 && (r = fr(() => e(() => Zt(n)))), t += 1, () => {
			Je(() => {
				--t, t === 0 && (r?.(), r = void 0, Zt(n));
			});
		})));
	};
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/boundary.js
var dt = te | ne;
function ft(e, t, n, r) {
	new pt(e, t, n, r);
}
var pt = 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 = ut(() => (this.#m = qt(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 = En(() => {
			if (k) {
				let e = this.#t;
				Pe();
				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();
		}, dt), k && (this.#e = A);
	}
	#g() {
		try {
			this.#a = Dn(() => this.#r(this.#e));
		} catch (e) {
			this.error(e);
		}
	}
	#_(e) {
		let t = this.#n.failed, { reset: n, invoke_onerror: r } = this.#v(e);
		Je(r), t && (this.#s = Dn(() => {
			t(this.#e, () => e, () => n);
		}));
	}
	#v(e) {
		var t = !1, n = !1;
		let r = () => {
			if (t) {
				je();
				return;
			}
			t = !0, n && Oe(), this.#s !== null && Pn(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) {
					Ze(e, this.#i && this.#i.parent);
				}
			}
		};
	}
	#y() {
		let e = this.#n.pending;
		e && (this.is_pending = !0, this.#o = Dn(() => e(this.#e)), Je(() => {
			var e = this.#c = document.createDocumentFragment(), t = on();
			e.append(t), this.#a = this.#S(() => Dn(() => this.#r(t))), this.#u === 0 && (this.#e.before(e), this.#c = null, Pn(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 = Dn(() => {
				this.#r(this.#e);
			}), this.#u > 0) {
				var e = this.#c = document.createDocumentFragment();
				Rn(this.#a, e);
				let t = this.#n.pending;
				this.#o = Dn(() => 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) {
		nt(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 = Ve;
		Gn(this.#i), Wn(this.#i), He(this.#i.ctx);
		try {
			return Lt.ensure(), e();
		} catch (e) {
			return Xe(e), null;
		} finally {
			Gn(t), Wn(n), He(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 && Pn(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, Je(() => {
			this.#d = !1, this.#m && Yt(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 &&= (jn(this.#a), null), this.#o &&= (jn(this.#o), null), this.#s &&= (jn(this.#s), null), k && (Ne(this.#t), Fe(), Ne(Ie()));
		let t = this.#n.failed, n = (e) => {
			let { reset: n, invoke_onerror: r } = this.#v(e);
			r(), t && (this.#s = this.#S(() => {
				try {
					return Dn(() => {
						var r = V;
						r.b = this, r.f |= 128, t(this.#e, () => e, () => n);
					});
				} catch (e) {
					return Ze(e, this.#i.parent), null;
				}
			}));
		};
		Je(() => {
			var t;
			try {
				t = this.transform_error(e);
			} catch (e) {
				Ze(e, this.#i && this.#i.parent);
				return;
			}
			typeof t == "object" && t && typeof t.then == "function" ? t.then(n, (e) => Ze(e, this.#i && this.#i.parent)) : n(t);
		});
	}
};
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/async.js
function mt(e, t, n, r) {
	let i = Ge() ? vt : xt;
	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 = ht(), 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) {
				Ze(e, s);
			}
			gt();
		}
	}
	var d = _t();
	if (n.length === 0) {
		l.then(() => u([])).finally(d);
		return;
	}
	function f() {
		Promise.all(n.map((e) => /* @__PURE__ */ bt(e))).then(u).catch((e) => Ze(e, s)).finally(d);
	}
	l ? l.then(() => {
		c(), f(), gt();
	}) : f();
}
function ht() {
	var e = V, t = B, n = Ve, r = N;
	return function(i = !0) {
		Gn(e), Wn(t), He(n), i && !(e.f & 16384) && (r?.activate(), r?.apply());
	};
}
function gt(e = !0) {
	Gn(null), Wn(null), He(null), e && N?.deactivate();
}
function _t() {
	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 vt(e) {
	var n = 2 | x;
	return V !== null && (V.f |= ne), {
		ctx: Ve,
		deps: null,
		effects: null,
		equals: Re,
		f: n,
		fn: e,
		reactions: null,
		rv: 0,
		v: t,
		wv: 0,
		parent: V,
		ac: null
	};
}
var yt = Symbol("obsolete");
/*#__NO_SIDE_EFFECTS__*/
function bt(e, n, r) {
	let i = V;
	i === null && ye();
	var a = void 0, o = qt(t), s = !B, c = /* @__PURE__ */ new Set();
	return wn(() => {
		var t = V, n = y();
		a = n.promise;
		try {
			Promise.resolve(e()).then(n.resolve, (e) => {
				e !== ge && n.reject(e);
			}).finally(gt);
		} catch (e) {
			n.reject(e), gt();
		}
		var r = N;
		if (s) {
			if (t.f & 32768) var l = _t();
			if (i.b?.is_rendered()) r.async_deriveds.get(t)?.reject(yt);
			else for (let e of c.values()) e.reject(yt);
			c.add(n), r.async_deriveds.set(t, n);
		}
		let u = (e, t = void 0) => {
			l?.(), c.delete(n), t !== yt && (r.activate(), t ? (o.f |= ce, Yt(o, t)) : (o.f & 8388608 && (o.f ^= ce), Yt(o, e)), r.deactivate());
		};
		n.promise.then(u, (e) => u(null, e || "unknown"));
	}), vn(() => {
		for (let e of c) e.reject(yt);
	}), 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__ */ vt(e);
	return qn(t), t;
}
/*#__NO_SIDE_EFFECTS__*/
function xt(e) {
	let t = /* @__PURE__ */ vt(e);
	return t.equals = Be, t;
}
function St(e) {
	var t = e.effects;
	if (t !== null) {
		e.effects = null;
		for (var n = 0; n < t.length; n += 1) jn(t[n]);
	}
}
function Ct(e) {
	var n, r = V, i = e.parent;
	if (!Vn && i !== null && e.v !== t && i.f & 24576) return ke(), e.v;
	Gn(i);
	try {
		e.f &= ~ae, St(e), n = ar(e);
	} finally {
		Gn(r);
	}
	return n;
}
function wt(e) {
	var t = Ct(e);
	if (!e.equals(t) && (e.wv = nr(), (!N?.is_fork || e.deps === null) && (N === null ? e.v = t : (N.capture(e, t, !0), Ot?.capture(e, t, !0)), e.deps === null))) {
		$e(e, b);
		return;
	}
	Vn || (kt === null ? et(e) : (_n() || N?.is_fork) && kt.set(e, t));
}
function Tt(e) {
	if (e.effects !== null) for (let t of e.effects) (t.teardown || t.ac) && (t.teardown?.(), t.ac !== null && ct(() => {
		t.ac.abort(ge), t.ac = null;
	}), t.fn !== null && (t.teardown = _), sr(t, 0), kn(t));
}
function Et(e) {
	if (e.effects !== null) for (let t of e.effects) t.teardown && t.fn !== null && cr(t);
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/batch.js
var Dt = null, N = null, Ot = null, kt = null, At = null, jt = !1, Mt = !1, Nt = null, Pt = null, Ft = 0, It = 1, Lt = class e {
	id = It++;
	#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() {
		Dt === null ? Dt = this : (Dt.#n = this, this.#t = Dt), Dt = 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) $e(r, x), t(r);
			for (r of n.m) $e(r, S), t(r);
		}
		this.#p.add(e);
	}
	#g() {
		this.#e = !0, Ft++ > 1e3 && (this.#x(), Rt());
		for (let e of this.#u) this.#d.delete(e), $e(e, x), this.schedule(e);
		for (let e of this.#d) $e(e, S), this.schedule(e);
		let t = this.#c;
		this.#c = [], this.apply();
		var n = Nt = [], r = [], i = Pt = [];
		for (let e of t) try {
			this.#_(e, n, r);
		} catch (t) {
			throw Ut(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 (Nt = null, Pt = null, this.#h()) {
			this.#b(r), this.#b(n);
			for (let [e, t] of this.#f) Ht(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(), Ot = this, Bt(r), Bt(n), Ot = 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) : rr(r) && (i & 16 && this.#d.add(r), cr(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), $e(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) nt(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]), kt?.set(e, n)), this.is_fork || (e.v = n);
	}
	activate() {
		N = this;
	}
	deactivate() {
		N = null, kt = null;
	}
	flush() {
		try {
			Mt = !0, N = this, this.#g();
		} finally {
			Ft = 0, At = null, Nt = null, Pt = null, Mt = !1, N = null, kt = null, Gt.clear();
		}
	}
	discard() {
		for (let e of this.#i) e(this);
		this.#i.clear();
		for (let e of this.async_deriveds.values()) e.reject(yt);
		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, Je(() => {
			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();
			!Mt && !jt && Je(() => {
				t.#e || t.flush();
			});
		}
		return N;
	}
	apply() {
		kt = null;
	}
	schedule(e) {
		if (At = 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 (Nt !== 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 ? Dt = e : t.#t = e, this.linked = !1;
		}
	}
};
function P(e) {
	var t = jt;
	jt = !0;
	try {
		var n;
		for (e && (N !== null && !N.is_fork && N.flush(), n = e());;) {
			if (Ye(), N === null) return n;
			N.flush();
		}
	} finally {
		jt = t;
	}
}
function Rt() {
	try {
		Se();
	} catch (e) {
		Ze(e, At);
	}
}
var zt = null;
function Bt(e) {
	var t = e.length;
	if (t !== 0) {
		for (var n = 0; n < t;) {
			var r = e[n++];
			if (!(r.f & 24576) && rr(r) && (zt = /* @__PURE__ */ new Set(), cr(r), r.deps === null && r.first === null && r.nodes === null && r.teardown === null && r.ac === null && Nn(r), zt?.size > 0)) {
				Gt.clear();
				for (let e of zt) {
					if (e.f & 24576) continue;
					let t = [e], n = e.parent;
					for (; n !== null;) zt.has(n) && (zt.delete(n), t.push(n)), n = n.parent;
					for (let e = t.length - 1; e >= 0; e--) {
						let n = t[e];
						n.f & 24576 || cr(n);
					}
				}
				zt.clear();
			}
		}
		zt = null;
	}
}
function Vt(e) {
	N.schedule(e);
}
function Ht(e, t) {
	if (!(e.f & 32 && e.f & 1024)) {
		e.f & 2048 ? t.d.push(e) : e.f & 4096 && t.m.push(e), $e(e, b);
		for (var n = e.first; n !== null;) Ht(n, t), n = n.next;
	}
}
function Ut(e) {
	$e(e, b);
	for (var t = e.first; t !== null;) Ut(t), t = t.next;
}
//#endregion
//#region node_modules/svelte/src/internal/client/reactivity/sources.js
var Wt = /* @__PURE__ */ new Set(), Gt = /* @__PURE__ */ new Map(), Kt = !1;
function qt(e, t) {
	return {
		f: 0,
		v: e,
		reactions: null,
		equals: Re,
		rv: 0,
		wv: 0
	};
}
/*#__NO_SIDE_EFFECTS__*/
function F(e, t) {
	let n = qt(e, t);
	return qn(n), n;
}
/*#__NO_SIDE_EFFECTS__*/
function Jt(e, t = !1, n = !0) {
	let r = qt(e);
	return t || (r.equals = Be), r;
}
function I(e, t, n = !1) {
	return B !== null && (!Un || B.f & 131072) && Ge() && B.f & 4325394 && (Kn === null || !Kn.has(e)) && De(), Yt(e, n ? $t(t) : t, Pt);
}
function Yt(e, t, n = null) {
	if (!e.equals(t)) {
		Gt.set(e, Vn ? t : e.v);
		var r = Lt.ensure();
		if (r.capture(e, t), e.f & 2) {
			let t = e;
			e.f & 2048 && Ct(t), kt === null && et(t);
		}
		e.wv = nr(), Qt(e, x, n), Ge() && V !== null && V.f & 1024 && !(V.f & 96) && (Xn === null ? Zn([e]) : Xn.push(e)), !r.is_fork && Wt.size > 0 && !Kt && Xt();
	}
	return t;
}
function Xt() {
	Kt = !1;
	for (let e of Wt) {
		e.f & 1024 && $e(e, S);
		let t;
		try {
			t = rr(e);
		} catch {
			t = !0;
		}
		t && cr(e);
	}
	Wt.clear();
}
function Zt(e) {
	I(e, e.v + 1);
}
function Qt(e, t, n) {
	var r = e.reactions;
	if (r !== null) for (var i = Ge(), 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 && $e(s, t), c & 131072) Wt.add(s);
			else if (c & 2) {
				var u = s;
				kt?.delete(u), c & 65536 || (c & 512 && (V === null || !(V.f & 2097152)) && (s.f |= ae), Qt(u, S, n));
			} else if (l) {
				var d = s;
				c & 16 && zt !== null && zt.add(d), n === null ? Vt(d) : n.push(d);
			}
		}
	}
}
function $t(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 = er, l = (e) => {
		if (er === c) return e();
		var t = B, n = er;
		Wn(null), tr(c);
		var r = e();
		return Wn(t), tr(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) && Te();
			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), Zt(o);
				}
			} else I(i, t), Zt(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($t(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 ? $t(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, $t(a)), r.set(n, u));
			else {
				f = u.v !== t;
				var h = l(() => $t(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);
				}
				Zt(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() {
			Ee();
		}
	});
}
var en, tn, nn, rn;
function an() {
	if (en === void 0) {
		en = window, tn = /Firefox/.test(navigator.userAgent);
		var e = Element.prototype, t = Node.prototype, n = Text.prototype;
		nn = d(t, "firstChild").get, rn = 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 on(e = "") {
	return document.createTextNode(e);
}
/*@__NO_SIDE_EFFECTS__*/
function sn(e) {
	return nn.call(e);
}
/*@__NO_SIDE_EFFECTS__*/
function cn(e) {
	return rn.call(e);
}
function L(e, t) {
	if (!k) return /* @__PURE__ */ sn(e);
	var n = /* @__PURE__ */ sn(A);
	if (n === null) n = A.appendChild(on());
	else if (t && n.nodeType !== 3) {
		var r = on();
		return n?.before(r), Ne(r), r;
	}
	return t && pn(n), Ne(n), n;
}
function ln(e, t = !1) {
	if (!k) {
		var n = /* @__PURE__ */ sn(e);
		return n instanceof Comment && n.data === "" ? /* @__PURE__ */ cn(n) : n;
	}
	if (t) {
		if (A?.nodeType !== 3) {
			var r = on();
			return A?.before(r), Ne(r), r;
		}
		pn(A);
	}
	return A;
}
function R(e, t = 1, n = !1) {
	let r = k ? A : e;
	for (var i; t--;) i = r, r = /* @__PURE__ */ cn(r);
	if (!k) return r;
	if (n) {
		if (r?.nodeType !== 3) {
			var a = on();
			return r === null ? i?.after(a) : r.before(a), Ne(a), a;
		}
		pn(r);
	}
	return Ne(r), r;
}
function un(e) {
	e.textContent = "";
}
function dn() {
	return !1;
}
function fn(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 pn(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 mn(e) {
	V === null && (B === null && xe(e), O()), Vn && be(e);
}
function hn(e, t) {
	var n = t.last;
	n === null ? t.last = t.first = e : (n.next = e, e.prev = n, t.last = e);
}
function gn(e, t) {
	var n = V;
	n !== null && n.f & 8192 && (e |= C);
	var r = {
		ctx: Ve,
		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) Nt === null ? Lt.ensure().schedule(r) : Nt.push(r);
	else if (t !== null) {
		try {
			cr(r);
		} catch (e) {
			throw jn(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 |= te));
	}
	if (i !== null && (i.parent = n, n !== null && hn(i, n), B !== null && B.f & 2 && !(e & 64))) {
		var a = B;
		(a.effects ??= []).push(i);
	}
	return r;
}
function _n() {
	return B !== null && !Un;
}
function vn(e) {
	let t = gn(8, null);
	return $e(t, b), t.teardown = e, t;
}
function yn(e) {
	mn("$effect");
	var t = V.f;
	if (!B && t & 32 && Ve !== null && !Ve.i) {
		var n = Ve;
		(n.e ??= []).push(e);
	} else return bn(e);
}
function bn(e) {
	return gn(4 | re, e);
}
function xn(e) {
	Lt.ensure();
	let t = gn(64 | ne, e);
	return () => {
		jn(t);
	};
}
function Sn(e) {
	Lt.ensure();
	let t = gn(64 | ne, e);
	return (e = {}) => new Promise((n) => {
		e.outro ? Pn(t, () => {
			jn(t), n(void 0);
		}) : (jn(t), n(void 0));
	});
}
function Cn(e) {
	return gn(4, e);
}
function wn(e) {
	return gn(se | ne, e);
}
function Tn(e, t = 0) {
	return gn(8 | t, e);
}
function z(e, t = [], n = [], r = []) {
	mt(r, t, n, (t) => {
		gn(8, () => {
			e(...t.map(H));
		});
	});
}
function En(e, t = 0) {
	return gn(16 | t, e);
}
function Dn(e) {
	return gn(32 | ne, e);
}
function On(e) {
	var t = e.teardown;
	if (t !== null) {
		let e = Vn, n = B;
		Hn(!0), Wn(null);
		try {
			t.call(null);
		} finally {
			Hn(e), Wn(n);
		}
	}
}
function kn(e, t = !1) {
	var n = e.first;
	for (e.first = e.last = null; n !== null;) {
		let e = n.ac;
		e !== null && ct(() => {
			e.abort(ge);
		});
		var r = n.next;
		n.f & 64 ? n.parent = null : jn(n, t), n = r;
	}
}
function An(e) {
	for (var t = e.first; t !== null;) {
		var n = t.next;
		t.f & 32 || jn(t), t = n;
	}
}
function jn(e, t = !0) {
	var n = !1;
	(t || e.f & 262144) && e.nodes !== null && e.nodes.end !== null && (Mn(e.nodes.start, e.nodes.end), n = !0), e.f |= ee, kn(e, t && !n), sr(e, 0);
	var r = e.nodes && e.nodes.t;
	if (r !== null) for (let e of r) e.stop();
	On(e), e.f ^= ee, e.f |= w;
	var i = e.parent;
	i !== null && i.first !== null && Nn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.fn = e.nodes = e.ac = e.b = null;
}
function Mn(e, t) {
	for (; e !== null;) {
		var n = e === t ? null : /* @__PURE__ */ cn(e);
		e.remove(), e = n;
	}
}
function Nn(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 Pn(e, t, n = !0) {
	var r = [];
	Fn(e, r, !0);
	var i = () => {
		n && jn(e), t && t();
	}, a = r.length;
	if (a > 0) {
		var o = () => --a || i();
		for (var s of r) s.out(o);
	} else i();
}
function Fn(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);
				Fn(i, t, o ? n : !1);
			}
			i = a;
		}
	}
}
function In(e) {
	Ln(e, !0);
}
function Ln(e, t) {
	if (e.f & 8192) {
		e.f ^= C, e.f & 1024 || ($e(e, x), Lt.ensure().schedule(e));
		for (var n = e.first; n !== null;) {
			var r = n.next, i = !!(n.f & 65536) || !!(n.f & 32);
			Ln(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 Rn(e, t) {
	if (e.nodes) for (var n = e.nodes.start, r = e.nodes.end; n !== null;) {
		var i = n === r ? null : /* @__PURE__ */ cn(n);
		t.append(n), n = i;
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/legacy.js
var zn = null, Bn = !1, Vn = !1;
function Hn(e) {
	Vn = e;
}
var B = null, Un = !1;
function Wn(e) {
	B = e;
}
var V = null;
function Gn(e) {
	V = e;
}
var Kn = null;
function qn(e) {
	B !== null && (Kn ??= /* @__PURE__ */ new Set()).add(e);
}
var Jn = null, Yn = 0, Xn = null;
function Zn(e) {
	Xn = e;
}
var Qn = 1, $n = 0, er = $n;
function tr(e) {
	er = e;
}
function nr() {
	return ++Qn;
}
function rr(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 (rr(a) && wt(a), a.wv > e.wv) return !0;
		}
		t & 512 && kt === null && $e(e, b);
	}
	return !1;
}
function ir(e, t, n = !0) {
	var r = e.reactions;
	if (r !== null && !(Kn !== null && Kn.has(e))) for (var i = 0; i < r.length; i++) {
		var a = r[i];
		a.f & 2 ? ir(a, t, !1) : t === a && (n ? $e(a, x) : a.f & 1024 && $e(a, S), Vt(a));
	}
}
function ar(e) {
	var t = Jn, n = Yn, r = Xn, i = B, a = Kn, o = Ve, s = Un, c = er, l = e.f;
	Jn = null, Yn = 0, Xn = null, B = l & 96 ? null : e, Kn = null, He(e.ctx), Un = !1, er = ++$n, e.ac !== null && (ct(() => {
		e.ac.abort(ge);
	}), e.ac = null);
	try {
		e.f |= oe;
		var u = e.fn, d = u();
		e.f |= T;
		var f = e.deps, p = N?.is_fork;
		if (Jn !== null) {
			var m;
			if (p || sr(e, Yn), f !== null && Yn > 0) for (f.length = Yn + Jn.length, m = 0; m < Jn.length; m++) f[Yn + m] = Jn[m];
			else e.deps = f = Jn;
			if (_n() && e.f & 512) for (m = Yn; m < f.length; m++) (f[m].reactions ??= []).push(e);
		} else !p && f !== null && Yn < f.length && (sr(e, Yn), f.length = Yn);
		if (Ge() && Xn !== null && !Un && f !== null && !(e.f & 6146)) for (m = 0; m < Xn.length; m++) ir(Xn[m], e);
		if (i !== null && i !== e) {
			if ($n++, i.deps !== null) for (let e = 0; e < n; e += 1) i.deps[e].rv = $n;
			if (t !== null) for (let e of t) e.rv = $n;
			Xn !== null && (r === null ? r = Xn : r.push(...Xn));
		}
		return e.f & 8388608 && (e.f ^= ce), d;
	} catch (e) {
		return Xe(e);
	} finally {
		e.f ^= oe, Jn = t, Yn = n, Xn = r, B = i, Kn = a, He(o), Un = s, er = c;
	}
}
function or(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 && (Jn === null || !s.call(Jn, n))) {
		var c = n;
		c.f & 512 && (c.f ^= 512, c.f &= ~ae), c.v !== t && et(c), c.ac !== null && ct(() => {
			c.ac.abort(ge), c.ac = null, $e(c, x);
		}), Tt(c), sr(c, 0);
	}
}
function sr(e, t) {
	var n = e.deps;
	if (n !== null) for (var r = t; r < n.length; r++) or(e, n[r]);
}
function cr(e) {
	var t = e.f;
	if (!(t & 16384)) {
		$e(e, b);
		var n = V, r = Bn;
		V = e, Bn = !(t & 96);
		try {
			t & 16777232 ? An(e) : kn(e), On(e);
			var i = ar(e);
			e.teardown = typeof i == "function" ? i : null, e.wv = Qn;
		} finally {
			Bn = r, V = n;
		}
	}
}
async function lr() {
	await Promise.resolve(), P();
}
function H(e) {
	var t = !!(e.f & 2);
	if (zn?.add(e), B !== null && !Un && !(V !== null && V.f & 16384) && (Kn === null || !Kn.has(e))) {
		var n = B.deps;
		if (B.f & 2097152) e.rv < $n && (e.rv = $n, Jn === null && n !== null && n[Yn] === e ? Yn++ : Jn === null ? Jn = [e] : Jn.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 (Vn && Gt.has(e)) return Gt.get(e);
	if (t) {
		var i = e;
		if (Vn) {
			var a = i.v;
			return (!(i.f & 1024) && i.reactions !== null || dr(i)) && (a = Ct(i)), Gt.set(i, a), a;
		}
		var o = !(i.f & 512) && !Un && B !== null && (Bn || !!(B.f & 512)), c = (i.f & T) === 0;
		rr(i) && (o && (i.f |= 512), wt(i)), o && !c && (Et(i), ur(i));
	}
	if (kt?.has(e)) return kt.get(e);
	if (e.f & 8388608) throw e.v;
	return e.v;
}
function ur(e) {
	if (e.f |= 512, e.deps !== null) for (let t of e.deps) (t.reactions ??= []).push(e), t.f & 2 && !(t.f & 512) && (Et(t), ur(t));
}
function dr(e) {
	if (e.v === t) return !0;
	if (e.deps === null) return !1;
	for (let t of e.deps) if (Gt.has(t) || t.f & 2 && dr(t)) return !0;
	return !1;
}
function fr(e) {
	var t = Un;
	try {
		return Un = !0, e();
	} finally {
		Un = t;
	}
}
function pr(e) {
	if (!(typeof e != "object" || !e || e instanceof EventTarget)) {
		if (le in e) mr(e);
		else if (!Array.isArray(e)) for (let t in e) {
			let n = e[t];
			typeof n == "object" && n && le in n && mr(n);
		}
	}
}
function mr(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 {
			mr(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 hr = Symbol("events"), gr = /* @__PURE__ */ new Set(), _r = /* @__PURE__ */ new Set();
function vr(e, t, n, r = {}) {
	function i(e) {
		if (r.capture || Sr.call(t, e), !e.cancelBubble) return ct(() => n?.call(this, e));
	}
	return e.startsWith("pointer") || e.startsWith("touch") || e === "wheel" ? Je(() => {
		t.addEventListener(e, i, r);
	}) : t.addEventListener(e, i, r), i;
}
function yr(e, t, n, r, i) {
	var a = {
		capture: r,
		passive: i
	}, o = vr(e, t, n, a);
	(t === document.body || t === window || t === document || t instanceof HTMLMediaElement) && vn(() => {
		t.removeEventListener(e, o, a);
	});
}
function U(e, t, n) {
	(t[hr] ??= {})[e] = n;
}
function br(e) {
	for (var t = 0; t < e.length; t++) gr.add(e[t]);
	for (var n of _r) n(e);
}
var xr = null;
function Sr(e) {
	var t = this, n = t.ownerDocument, r = e.type, i = e.composedPath?.() || [], a = i[0] || e.target;
	xr = e;
	var o = 0, s = xr === e && e[hr];
	if (s) {
		var c = i.indexOf(s);
		if (c !== -1 && (t === document || t === window)) {
			e[hr] = 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;
		Wn(null), Gn(null);
		try {
			for (var p, m = []; a !== null && a !== t;) {
				try {
					var h = a[hr]?.[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[hr] = t, delete e.currentTarget, Wn(d), Gn(f);
		}
	}
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/reconciler.js
var Cr = globalThis?.window?.trustedTypes && /* @__PURE__ */ globalThis.window.trustedTypes.createPolicy("svelte-trusted-html", { createHTML: (e) => e });
function wr(e) {
	return Cr?.createHTML(e) ?? e;
}
function Tr(e) {
	var t = fn("template");
	return t.innerHTML = wr(e.replaceAll("<!>", "<!---->")), t.content;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/template.js
function Er(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 Er(A, null), A;
		i === void 0 && (i = Tr(a ? e : "<!>" + e), n || (i = /* @__PURE__ */ sn(i)));
		var t = r || tn ? document.importNode(i, !0) : i.cloneNode(!0);
		if (n) {
			var o = /* @__PURE__ */ sn(t), s = t.lastChild;
			Er(o, s);
		} else Er(t, t);
		return t;
	};
}
/*#__NO_SIDE_EFFECTS__*/
function Dr(e, t, n = "svg") {
	var r = !e.startsWith("<!>"), i = !!(t & 1), a = `<${n}>${r ? e : "<!>" + e}</${n}>`, o;
	return () => {
		if (k) return Er(A, null), A;
		if (!o) {
			var e = /* @__PURE__ */ sn(Tr(a));
			if (i) for (o = document.createDocumentFragment(); /* @__PURE__ */ sn(e);) o.appendChild(/* @__PURE__ */ sn(e));
			else o = /* @__PURE__ */ sn(e);
		}
		var t = o.cloneNode(!0);
		if (i) {
			var n = /* @__PURE__ */ sn(t), r = t.lastChild;
			Er(n, r);
		} else Er(t, t);
		return t;
	};
}
/*#__NO_SIDE_EFFECTS__*/
function Or(e, t) {
	return /* @__PURE__ */ Dr(e, t, "svg");
}
function kr(e = "") {
	if (!k) {
		var t = on(e + "");
		return Er(t, t), t;
	}
	var n = A;
	return n.nodeType === 3 ? pn(n) : (n.before(n = on()), Ne(n)), Er(n, n), n;
}
function Ar() {
	if (k) return Er(A, null), A;
	var e = document.createDocumentFragment(), t = document.createComment(""), n = on();
	return e.append(t, n), Er(t, n), e;
}
function G(e, t) {
	if (k) {
		var n = V;
		(!(n.f & 32768) || n.nodes.end === null) && (n.nodes.end = A), Pe();
		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 jr = ["touchstart", "touchmove"];
function Mr(e) {
	return jr.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 Nr(e, t) {
	return Ir(e, t);
}
function Pr(t, n) {
	an(), n.intro = n.intro ?? !1;
	let r = n.target, i = k, a = A;
	try {
		for (var o = /* @__PURE__ */ sn(r); o && (o.nodeType !== 8 || o.data !== "[");) o = /* @__PURE__ */ cn(o);
		if (!o) throw e;
		Me(!0), Ne(o);
		let i = Ir(t, {
			...n,
			anchor: o
		});
		return Me(!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 && Ce(), an(), un(r), Me(!1), Nr(t, n);
	} finally {
		Me(i), Ne(a);
	}
}
var Fr = /* @__PURE__ */ new Map();
function Ir(t, { target: n, anchor: r, props: i = {}, events: a, context: o, intro: s = !0, transformError: l }) {
	an();
	var u = void 0, d = Sn(() => {
		var s = r ?? n.appendChild(on());
		ft(s, { pending: () => {} }, (n) => {
			Ue({});
			var r = Ve;
			if (o && (r.c = o), a && (i.$$events = a), k && Er(n, null), u = t(n, i) || {}, k && (V.nodes.end = A, A === null || A.nodeType !== 8 || A.data !== "]")) throw Ae(), e;
			We();
		}, 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 = Mr(r);
					for (let e of [n, document]) {
						var a = Fr.get(e);
						a === void 0 && (a = /* @__PURE__ */ new Map(), Fr.set(e, a));
						var o = a.get(r);
						o === void 0 ? (e.addEventListener(r, Sr, { passive: i }), a.set(r, 1)) : a.set(r, o + 1);
					}
				}
			}
		};
		return f(c(gr)), _r.add(f), () => {
			for (var e of d) for (let r of [n, document]) {
				var t = Fr.get(r), i = t.get(e);
				--i == 0 ? (r.removeEventListener(e, Sr), t.delete(e), t.size === 0 && Fr.delete(r)) : t.set(e, i);
			}
			_r.delete(f), s !== r && s.parentNode?.removeChild(s);
		};
	});
	return Lr.set(u, d), u;
}
var Lr = /* @__PURE__ */ new WeakMap();
function Rr(e, t) {
	let n = Lr.get(e);
	return n ? (Lr.delete(e), n(t)) : Promise.resolve();
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/branches.js
var zr = 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) In(n), this.#r.delete(t);
			else {
				var r = this.#n.get(t);
				r && (In(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 && (jn(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();
						Rn(r, t), t.append(on()), this.#n.set(e, {
							effect: r,
							fragment: t
						});
					} else jn(r);
					this.#r.delete(e), this.#t.delete(e);
				};
				this.#i || !n ? (this.#r.add(e), Pn(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) || (jn(n.effect), this.#n.delete(e));
	};
	ensure(e, t) {
		var n = N, r = dn();
		if (t && !this.#t.has(e) && !this.#n.has(e)) {
			if (r) {
				var i = document.createDocumentFragment(), a = on();
				i.append(a), this.#n.set(e, {
					effect: Dn(() => t(a)),
					fragment: i
				});
			} else this.#t.set(e, Dn(() => 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);
	}
};
function Br(e) {
	Ve === null && ve("onMount"), yn(() => {
		let t = fr(e);
		if (typeof t == "function") return t;
	});
}
function Vr(e) {
	Ve === null && ve("onDestroy"), Br(() => () => fr(e));
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/blocks/if.js
function q(e, t, n = !1) {
	var r;
	k && (r = A, Pe());
	var i = new zr(e), a = n ? te : 0;
	function o(e, t) {
		if (k) {
			var n = Le(r);
			if (e !== parseInt(n.substring(1))) {
				var a = Ie();
				Ne(a), i.anchor = a, Me(!1), i.ensure(e, t), Me(!0);
				return;
			}
		}
		i.ensure(e, t);
	}
	En(() => {
		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 Hr(e, t, n) {
	for (var r = [], i = t.length, a, o = t.length, s = 0; s < i; s++) {
		let n = t[s];
		Pn(n, () => {
			if (a) {
				if (a.pending.delete(n), a.done.add(n), a.pending.size === 0) {
					var t = e.outrogroups;
					Ur(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;
			un(d), d.append(u), e.items.clear();
		}
		Ur(e, t, !l);
	} else a = {
		pending: new Set(t),
		done: /* @__PURE__ */ new Set()
	}, (e.outrogroups ??= /* @__PURE__ */ new Set()).add(a);
}
function Ur(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, Rn(a, document.createDocumentFragment())) : jn(t[i], n);
	}
}
var Wr;
function Gr(e, t, n, r, i, o = null) {
	var s = e, l = /* @__PURE__ */ new Map();
	if (t & 4) {
		var u = e;
		s = k ? Ne(/* @__PURE__ */ sn(u)) : u.appendChild(on());
	}
	k && Pe();
	var d = null, f = /* @__PURE__ */ xt(() => {
		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, qr(v, p, s, t, r), d !== null && (p.length === 0 ? d.f & 33554432 ? (d.f ^= ie, Yr(d, null, s)) : In(d) : Pn(d, () => {
			d = null;
		})));
	}
	function _(e) {
		v.pending.delete(e);
	}
	var v = {
		effect: En(() => {
			p = H(f);
			var e = p.length;
			let a = !1;
			k && Le(s) === "[!" != (e === 0) && (s = Ie(), Ne(s), Me(!1), a = !0);
			for (var c = /* @__PURE__ */ new Set(), u = N, v = dn(), y = 0; y < e; y += 1) {
				k && A.nodeType === 8 && A.data === "]" && (s = A, a = !0, Me(!1));
				var b = p[y], x = r(b, y), S = h ? null : l.get(x);
				S ? (S.v && Yt(S.v, b), S.i && Yt(S.i, y), v && u.unskip_effect(S.e)) : (S = Jr(l, h ? s : Wr ??= on(), 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 = Dn(() => o(s)) : (d = Dn(() => o(Wr ??= on())), d.f |= ie)), e > c.size && D("", "", ""), k && e > 0 && Ne(Ie()), !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 && Me(!0), H(f);
		}),
		flags: t,
		items: l,
		pending: m,
		outrogroups: null,
		fallback: d
	};
	h = !1, k && (s = A);
}
function Kr(e) {
	for (; e !== null && !(e.f & 32);) e = e.next;
	return e;
}
function qr(e, t, n, r, i) {
	var a = !!(r & 8), o = t.length, s = e.items, l = Kr(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 && (In(_), a && (_.nodes?.a?.unfix(), (f ??= /* @__PURE__ */ new Set()).delete(_))), _.f & 33554432) {
			if (_.f ^= ie, _ === l) Yr(_, null, n);
			else {
				var y = d ? d.next : l;
				_ === e.effect.last && (e.effect.last = _.prev), _.prev && (_.prev.next = _.next), _.next && (_.next.prev = _.prev), Xr(e, d, _), Xr(e, _, y), Yr(_, y, n), d = _, p = [], m = [], l = Kr(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) Yr(p[x], b, n);
					for (x = 0; x < m.length; x += 1) u.delete(m[x]);
					Xr(e, S.prev, C.next), Xr(e, d, S), Xr(e, C, b), l = b, d = C, --v, p = [], m = [];
				} else u.delete(_), Yr(_, l, n), Xr(e, _.prev, _.next), Xr(e, _, d === null ? e.effect.first : d.next), Xr(e, d, _), d = _;
				continue;
			}
			for (p = [], m = []; l !== null && l !== _;) (u ??= /* @__PURE__ */ new Set()).add(l), m.push(l), l = Kr(l.next);
			if (l === null) continue;
		}
		_.f & 33554432 || p.push(_), d = _, l = Kr(_.next);
	}
	if (e.outrogroups !== null) {
		for (let t of e.outrogroups) t.pending.size === 0 && (Ur(e, c(t.done)), e.outrogroups?.delete(t));
		e.outrogroups.size === 0 && (e.outrogroups = null);
	}
	if (l !== null || u !== void 0) {
		var w = [];
		if (u !== void 0) for (_ of u) _.f & 8192 || w.push(_);
		for (; l !== null;) !(l.f & 8192) && l !== e.fallback && w.push(l), l = Kr(l.next);
		var T = w.length;
		if (T > 0) {
			var ee = r & 4 && o === 0 ? n : null;
			if (a) {
				for (v = 0; v < T; v += 1) w[v].nodes?.a?.measure();
				for (v = 0; v < T; v += 1) w[v].nodes?.a?.fix();
			}
			Hr(e, w, ee);
		}
	}
	a && Je(() => {
		if (f !== void 0) for (_ of f) _.nodes?.a?.apply();
	});
}
function Jr(e, t, n, r, i, a, o, s) {
	var c = o & 1 ? o & 16 ? qt(n) : /* @__PURE__ */ Jt(n, !1, !1) : null, l = o & 2 ? qt(i) : null;
	return {
		v: c,
		i: l,
		e: Dn(() => (a(t, c ?? n, l ?? i, s), () => {
			e.delete(r);
		}))
	};
}
function Yr(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__ */ cn(r);
		if (a.before(r), r === i) return;
		r = o;
	}
}
function Xr(e, t, n) {
	t === null ? e.effect.first = n : t.next = n, n === null ? e.effect.last = t : n.prev = t;
}
function Zr(t, n, a = !1, o = !1, s = !1, c = !1) {
	var l = t, u = "";
	if (a) {
		var d = t;
		k && (l = Ne(/* @__PURE__ */ sn(d)));
	}
	z(() => {
		var t = V;
		if (u === (u = n() ?? "")) {
			k && Pe();
			return;
		}
		if (a && !k) {
			t.nodes = null, d.innerHTML = u, u !== "" && Er(/* @__PURE__ */ sn(d), d.lastChild);
			return;
		}
		if (t.nodes !== null && (Mn(t.nodes.start, t.nodes.end), t.nodes = null), u !== "") {
			if (k) {
				for (var c = A.data, f = Pe(), p = f; f !== null && (f.nodeType !== 8 || f.data !== "");) p = f, f = /* @__PURE__ */ cn(f);
				if (f === null) throw Ae(), e;
				Er(A, p), l = Ne(f);
				return;
			}
			var m = fn(o ? "svg" : s ? "math" : "template", o ? r : s ? i : void 0);
			m.innerHTML = u;
			var h = o || s ? m : m.content;
			if (Er(/* @__PURE__ */ sn(h), h.lastChild), o || s) for (; /* @__PURE__ */ sn(h);) l.before(/* @__PURE__ */ sn(h));
			else l.before(h);
		}
	});
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/css.js
function Qr(e, t) {
	Cn(() => {
		var n = e.getRootNode(), r = n.host ? n : n.head ?? n.ownerDocument.head;
		if (!r.querySelector("#" + t.hash)) {
			let e = fn("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 $r(e, t, n) {
	Cn(() => {
		var r = fr(() => t(e, n?.()) || {});
		if (n && r?.update) {
			var i = !1, a = {};
			Tn(() => {
				var e = n();
				pr(e), i && ze(a, e) && (a = e, r.update(e));
			}), i = !0;
		}
		if (r?.destroy) return () => r.destroy();
	});
}
//#endregion
//#region node_modules/clsx/dist/clsx.mjs
function ei(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 = ei(e[t])) && (r && (r += " "), r += n);
		} else for (n in e) e[n] && (r && (r += " "), r += n);
	}
	return r;
}
function ti() {
	for (var e, t, n = 0, r = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = ei(e)) && (r && (r += " "), r += t);
	return r;
}
//#endregion
//#region node_modules/svelte/src/internal/shared/attributes.js
function ni(e) {
	return typeof e == "object" ? ti(e) : e ?? "";
}
var ri = [..." 	\n\r\f\xA0\v﻿"];
function ii(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 || ri.includes(r[o - 1])) && (s === r.length || ri.includes(r[s])) ? r = (o === 0 ? "" : r.substring(0, o)) + r.substring(s + 1) : o = s;
		}
	}
	return r === "" ? null : r;
}
function ai(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 oi(e) {
	return e[0] !== "-" || e[1] !== "-" ? e.toLowerCase() : e;
}
function si(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(oi)), i && c.push(...Object.keys(i).map(oi));
			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 = oi(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 += ai(r)), i && (n += ai(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 ci(e, t, n, r, i, a) {
	var o = e[fe];
	if (k || o !== n || o === void 0) {
		var s = ii(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 li(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 ui(e, t, n, r) {
	var i = e[pe];
	if (k || i !== t) {
		var a = si(t, r);
		(!k || a !== e.getAttribute("style")) && (a == null ? e.removeAttribute("style") : e.style.cssText = a), e[pe] = t;
	} else r && (Array.isArray(r) ? (li(e, n?.[0], r[0]), li(e, n?.[1], r[1], "important")) : li(e, n, r));
	return r;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/attributes.js
var di = Symbol("is custom element"), fi = Symbol("is html"), pi = _e ? "link" : "LINK", mi = _e ? "progress" : "PROGRESS";
function hi(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, Je(n), st();
	}
}
function gi(e, t) {
	var n = vi(e);
	n.value !== (n.value = t ?? void 0) && (e.value !== t || t === 0 && e.nodeName === mi) && (e.value = t ?? "");
}
function _i(e, t) {
	var n = vi(e);
	n.checked !== (n.checked = t ?? void 0) && (e.checked = t);
}
function J(e, t, n, r) {
	var i = vi(e);
	k && (i[t] = e.getAttribute(t), t === "src" || t === "srcset" || t === "href" && e.nodeName === pi) || i[t] !== (i[t] = n) && (t === "loading" && (e[E] = n), n == null ? e.removeAttribute(t) : typeof n != "string" && bi(e).includes(t) ? e[t] = n : e.setAttribute(t, n));
}
function vi(e) {
	return e[de] ??= {
		[di]: e.nodeName.includes("-"),
		[fi]: e.namespaceURI === n
	};
}
var yi = /* @__PURE__ */ new Map();
function bi(e) {
	var t = e.getAttribute("is") || e.nodeName, n = yi.get(t);
	if (n) return n;
	yi.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 xi(e, t, n = t) {
	var r = /* @__PURE__ */ new WeakSet();
	lt(e, "input", async (i) => {
		var a = i ? e.defaultValue : e.value;
		if (a = Si(e) ? Ci(a) : a, n(a), N !== null && r.add(N), await lr(), 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 || fr(t) == null && e.value) && (n(Si(e) ? Ci(e.value) : e.value), N !== null && r.add(N)), Tn(() => {
		var n = t();
		if (e === document.activeElement) {
			var i = N;
			if (r.has(i)) return;
		}
		Si(e) && n === Ci(e.value) || e.type === "date" && !n && !e.value || n !== e.value && (e.value = n ?? "");
	});
}
function Si(e) {
	var t = e.type;
	return t === "number" || t === "range";
}
function Ci(e) {
	return e === "" ? null : +e;
}
//#endregion
//#region node_modules/svelte/src/internal/client/dom/elements/bindings/this.js
function wi(e, t) {
	return e === t || e?.[le] === t;
}
function Ti(e = {}, t, n, r) {
	var i = Ve.r, a = V;
	return Cn(() => {
		var o, s;
		return Tn(() => {
			o = s, s = r?.() || [], fr(() => {
				wi(n(...s), e) || (t(e, ...s), o && wi(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 && wi(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__ */ vt(r), H(l)) : (c && (c = !1, s = o ? fr(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] = it(() => e[t]) : m = e[t], m === void 0 && r !== void 0 && (m = u(), f && (i && we(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 ? vt : xt)(() => (v = !1, g()));
	a && H(y);
	var b = V;
	return (function(e, t) {
		if (arguments.length > 0) {
			let n = t ? H(y) : i && a ? $t(e) : e;
			return I(y, n), v = !0, s !== void 0 && (s = n), e;
		}
		return Vn && v || b.f & 16384 ? y.v : H(y);
	});
}
//#endregion
//#region node_modules/svelte/src/legacy/legacy-client.js
function Ei(e) {
	return new Di(e);
}
var Di = class {
	#e;
	#t;
	constructor(e) {
		var t = /* @__PURE__ */ new Map(), n = (e, n) => {
			var r = /* @__PURE__ */ Jt(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 ? Pr : Nr)(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 = () => {
			Rr(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();
	}
}, Oi;
typeof HTMLElement == "function" && (Oi = 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 = fn("slot");
					e !== "default" && (n.name = e), G(t, n);
				};
			}
			let t = {}, n = Ai(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] = ki(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 = Ei({
				component: this.$$ctor,
				target: this.$$shadowRoot || this,
				props: {
					...this.$$d,
					$$slots: t,
					$$host: this
				}
			}), this.$$me = xn(() => {
				Tn(() => {
					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 = ki(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] = ki(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 ki(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 Ai(e) {
	let t = {};
	return e.childNodes.forEach((e) => {
		t[e.slot || "default"] = !0;
	}), t;
}
function ji(e, t, n, r, i, a) {
	let o = class extends Oi {
		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 = ki(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 Mi = class extends Error {
	status;
	code;
	constructor(e, t, n) {
		super(n), this.status = e, this.code = t;
	}
};
async function Ni(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 Mi(i.status, e?.error?.code ?? "unknown_error", e?.error?.message ?? i.statusText);
	}
	return i;
}
//#endregion
//#region src/lib/api/records.ts
var Pi = { and: [] };
function Fi(e) {
	return e.map((e) => e.desc ? `-${e.column}` : e.column).join(",");
}
function Ii(e) {
	return JSON.stringify(e);
}
function Li(e) {
	return JSON.stringify(e);
}
function Ri(e) {
	return e.join(",");
}
async function zi(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", Fi(t.sort)), t.where !== void 0 && r.set("where", Ii(t.where)), t.groupBy !== void 0 && r.set("group_by", Ri(t.groupBy)), t.summary !== void 0 && r.set("summary", Li(t.summary));
	let i = r.toString();
	return (await Ni(`/api/v1/tables/${e}/records${i ? `?${i}` : ""}`, void 0, n)).json();
}
async function Bi(e, t, n = fetch) {
	return (await Ni(`/api/v1/tables/${e}/records`, {
		method: "POST",
		body: JSON.stringify(t)
	}, n)).json();
}
async function Vi(e, t, n, r = fetch) {
	return (await Ni(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}`, {
		method: "PATCH",
		body: JSON.stringify(n)
	}, r)).json();
}
async function Hi(e, t, n, r, i = fetch) {
	await Ni(`/api/v1/tables/${e}/records/${encodeURIComponent(String(t))}/links/${n}`, {
		method: "POST",
		body: JSON.stringify({ target_id: r })
	}, i);
}
async function Ui(e, t, n, r, i = fetch) {
	await Ni(`/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 Wi = ["de", "en"], Gi = "illusiondb-locale", Ki = "de", qi = "illusiondb:locale-change";
function Ji(e) {
	return Wi.includes(e ?? "");
}
function Yi() {
	if (typeof localStorage > "u") return Ki;
	let e = localStorage.getItem(Gi);
	return Ji(e) ? e : Ki;
}
function Xi(e) {
	typeof document < "u" && document.documentElement.setAttribute("lang", e);
}
var Zi = $t({ current: Ki });
typeof window < "u" && (Zi.current = Yi(), Xi(Zi.current), window.addEventListener(qi, (e) => {
	let t = e.detail;
	Ji(t) && (Zi.current = t);
}));
//#endregion
//#region src/lib/i18n/translations/de.ts
var Qi = {
	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",
			copyUrlHint: "Klicken, um die vollständige URL zu kopieren",
			copiedToClipboard: "In Zwischenablage kopiert",
			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…",
			publicUrl: "Öffentliche URL für diesen Datensatz",
			publicUrlHint: "Funktioniert ohne Anmeldung -- kann direkt weitergegeben werden (z. B. per E-Mail).",
			publicUrlNeedsPublic: "Nur für öffentliche Templates verfügbar -- oben \"Öffentlich abrufbar\" aktivieren.",
			publicUrlUnsaved: "Noch nicht gespeichert -- die URL funktioniert erst, nachdem \"Öffentlich abrufbar\" gespeichert wurde."
		},
		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",
		wikiSearchPlaceholder: "Seiten durchsuchen…",
		wikiNoPageSelected: "Keine Seite ausgewählt.",
		wikiNewRootPage: "Neue Seite",
		wikiAddChildPage: "Unterseite hinzufügen",
		wikiEditPage: "Bearbeiten",
		wikiNoSearchResults: "Keine Treffer.",
		wikiEmptyTree: "Noch keine Seiten angelegt.",
		wikiUntitledPage: "Ohne Titel",
		wikiDeleteHasChildren: "Diese Seite hat Unterseiten und kann nicht gelöscht werden. Zuerst die Unterseiten verschieben oder löschen.",
		wikiCreatePageFailed: "Seite konnte nicht angelegt werden: {{error}}",
		wikiCyclicPage: "Zyklus erkannt (Elternseite verweist auf eine eigene Unterseite) – wird hier nicht weiter aufgeklappt.",
		wikiExpand: "Aufklappen",
		wikiCollapse: "Zuklappen",
		wikiUnlockTree: "Zum Sortieren entsperren",
		wikiLockTree: "Baum sperren",
		wikiMoveFailed: "Seite konnte nicht verschoben werden: {{error}}"
	},
	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."
	}
}, $i = {
	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",
			copyUrlHint: "Click to copy the full URL",
			copiedToClipboard: "Copied to clipboard",
			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…",
			publicUrl: "Public URL for this record",
			publicUrlHint: "Works without logging in -- can be shared directly (e.g. by email).",
			publicUrlNeedsPublic: "Only available for public templates -- enable \"Publicly accessible\" above.",
			publicUrlUnsaved: "Not saved yet -- this URL will only work once \"Publicly accessible\" has been saved."
		},
		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",
		wikiSearchPlaceholder: "Search pages…",
		wikiNoPageSelected: "No page selected.",
		wikiNewRootPage: "New page",
		wikiAddChildPage: "Add subpage",
		wikiEditPage: "Edit",
		wikiNoSearchResults: "No matches.",
		wikiEmptyTree: "No pages yet.",
		wikiUntitledPage: "Untitled",
		wikiDeleteHasChildren: "This page has subpages and cannot be deleted. Move or delete the subpages first.",
		wikiCreatePageFailed: "Could not create page: {{error}}",
		wikiCyclicPage: "Cycle detected (a parent page points to one of its own subpages) -- not expanded further here.",
		wikiExpand: "Expand",
		wikiCollapse: "Collapse",
		wikiUnlockTree: "Unlock for reordering",
		wikiLockTree: "Lock tree",
		wikiMoveFailed: "Could not move page: {{error}}"
	},
	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."
	}
}, ea = {
	de: Qi,
	en: $i
};
function ta(e, t) {
	return t.reduce((e, t) => {
		if (!(typeof e != "object" || !e)) return e[t];
	}, e);
}
function na(e, t) {
	return t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : `{{${n}}}`) : e;
}
function ra(e) {
	return typeof e == "object" && !!e && "one" in e && "other" in e;
}
function ia(e) {
	let t = e.split(".");
	return ta(ea[Zi.current], t) ?? ta(ea.de, t);
}
function X(e, t) {
	let n = ia(e);
	return typeof n == "string" ? na(n, t) : ra(n) ? na(n.other, t) : e;
}
//#endregion
//#region src/lib/formatters.ts
function aa() {
	return Zi.current === "en" ? "en-US" : "de-DE";
}
function oa(e) {
	return e == null ? "" : typeof e == "boolean" ? e ? "true" : "false" : typeof e == "object" ? JSON.stringify(e) : String(e);
}
function sa(e, t) {
	return e._fk_display?.[t.effective_name];
}
function ca(e, t) {
	return e._fk_display_format?.[t.effective_name];
}
function la(e, t) {
	let n = sa(e, t);
	if (n === void 0) return;
	let r = ca(e, t);
	return r ? wa(n, r) : oa(n);
}
var ua = /* @__PURE__ */ new Set(["http:", "https:"]);
function da(e) {
	if (!e) return e;
	try {
		let t = typeof location < "u" ? location.href : "http://localhost/";
		return ua.has(new URL(e, t).protocol) ? e : "#";
	} catch {
		return "#";
	}
}
function fa(e, t) {
	let n = oa(t);
	return e.display_format === "email" ? `mailto:${n}` : e.display_format === "phone" ? `tel:${n}` : da(n);
}
function pa(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 ma(e) {
	return oa(e).split(",").map((e) => e.trim()).filter((e) => e.length > 0);
}
var ha = {
	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 ga(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)}. ${ha[Zi.current][parseInt(t, 10) - 1] ?? t} ${e}`;
		default: return `${e}-${t}-${n}`;
	}
}
function _a(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 va(e, t) {
	let n = oa(e);
	if (!n) return n;
	let r = ga(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} ${_a(n.slice(11, 13), n.slice(14, 16), t.format_config.time_format)}`;
}
function ya(e, t) {
	if (e == null || e === "") return oa(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return oa(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(aa(), {
			...a,
			style: "currency",
			currency: r.currency ?? "EUR"
		}).format(n);
		case "percent": return `${new Intl.NumberFormat(aa(), a).format(n)} %`;
		case "temperature": return `${new Intl.NumberFormat(aa(), a).format(n)} ${r.temperature_unit === "fahrenheit" ? "°F" : "°C"}`;
		default: return new Intl.NumberFormat(aa(), a).format(n);
	}
}
var ba = {
	KB: 1024,
	MB: 1024 ** 2,
	GB: 1024 ** 3,
	TB: 1024 ** 4
};
function xa(e, t) {
	if (e == null || e === "") return oa(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return oa(e);
	let r = t.format_config.unit ?? "MB", i = n / (ba[r] ?? ba.MB);
	return `${new Intl.NumberFormat(aa(), {
		minimumFractionDigits: 2,
		maximumFractionDigits: 2
	}).format(i)} ${r}`;
}
var Sa = {
	s: 1e3,
	min: 6e4,
	h: 36e5,
	d: 864e5
};
function Ca(e, t) {
	if (e == null || e === "") return oa(e);
	let n = typeof e == "number" ? e : parseFloat(String(e));
	if (Number.isNaN(n)) return oa(e);
	let r = t.format_config.unit ?? "s", i = n / (Sa[r] ?? Sa.s);
	return `${new Intl.NumberFormat(aa(), {
		minimumFractionDigits: 2,
		maximumFractionDigits: 2
	}).format(i)} ${r}`;
}
function wa(e, t) {
	return t.display_format === "date_format" ? va(e, t) : t.display_format === "number_format" ? ya(e, t) : t.display_format === "data_size" ? xa(e, t) : t.display_format === "duration" ? Ca(e, t) : oa(e);
}
function Ta(e) {
	switch (e.field_kind) {
		case "formula": return "ƒ";
		case "lookup": return "→";
		case "rollup": return "Σ";
		case "links": return "⇄";
		default: return null;
	}
}
function Ea(e) {
	return Array.isArray(e) ? e : [];
}
function Da(e, t) {
	if (t.is_foreign_key) {
		let n = la(e, t);
		return n === void 0 ? oa(e[t.effective_name]) : n;
	}
	return t.field_kind === "links" ? Ea(e[t.effective_name]).map((e) => oa(e.label)).join(", ") : t.ui_type === "boolean" ? pa(e[t.effective_name]) ? X("common.yes") : X("common.no") : t.display_format === "tags" ? ma(e[t.effective_name]).join(", ") : wa(e[t.effective_name], t);
}
function Oa(e, t) {
	let n = oa(e);
	return t.ui_type === "date" ? n.slice(0, 10) : t.ui_type === "datetime" ? n.slice(0, 19).replace(" ", "T") : n;
}
//#endregion
//#region node_modules/marked/lib/marked.esm.js
function ka() {
	return {
		async: !1,
		breaks: !1,
		extensions: null,
		gfm: !0,
		hooks: null,
		pedantic: !1,
		renderer: null,
		silent: !1,
		tokenizer: null,
		walkTokens: null
	};
}
var Aa = ka();
function ja(e) {
	Aa = e;
}
var Ma = { exec: () => null };
function Na(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(Fa.caret, "$1"), n = n.replace(e, i), r;
		},
		getRegex: () => new RegExp(n, t)
	};
	return r;
}
var Pa = ((e = "") => {
	try {
		return !!RegExp("(?<=1)(?<!1)" + e);
	} catch {
		return !1;
	}
})(), Fa = {
	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: Na((e) => RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`)),
	hrRegex: Na((e) => RegExp(`^ {0,${e}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`)),
	fencesBeginRegex: Na((e) => RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),
	headingBeginRegex: Na((e) => RegExp(`^ {0,${e}}#`)),
	htmlBeginRegex: Na((e) => RegExp(`^ {0,${e}}<(?:[a-z].*>|!--)`, "i")),
	blockquoteBeginRegex: Na((e) => RegExp(`^ {0,${e}}>`))
}, Ia = /^(?:[ \t]*(?:\n|$))+/, La = /^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/, Ra = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/, za = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/, Ba = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/, Va = / {0,3}(?:[*+-]|\d{1,9}[.)])/, Ha = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/, Ua = Z(Ha).replace(/bull/g, Va).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(), Wa = Z(Ha).replace(/bull/g, Va).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(), Ga = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/, Ka = /^[^\n]+/, qa = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/, Ja = Z(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label", qa).replace("title", /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(), Ya = Z(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, Va).getRegex(), Xa = "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", Za = /<!--(?:-?>|[\s\S]*?(?:-->|$))/, Qa = 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", Za).replace("tag", Xa).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(), $a = (e) => Z(Ga).replace("hr", za).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", Xa).getRegex(), eo = $a(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/), to = $a(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/), no = {
	blockquote: Z(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", to).getRegex(),
	code: La,
	def: Ja,
	fences: Ra,
	heading: Ba,
	hr: za,
	html: Qa,
	lheading: Ua,
	list: Ya,
	newline: Ia,
	paragraph: eo,
	table: Ma,
	text: Ka
}, ro = Z("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", za).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", Xa).getRegex(), io = {
	...no,
	lheading: Wa,
	table: ro,
	paragraph: Z(Ga).replace("hr", za).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ro).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", Xa).getRegex()
}, ao = {
	...no,
	html: Z("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:\"[^\"]*\"|'[^']*'|\\s[^'\"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment", Za).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: Ma,
	lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,
	paragraph: Z(Ga).replace("hr", za).replace("heading", " *#{1,6} *[^\n]").replace("lheading", Ua).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex()
}, oo = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/, so = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/, co = /^( {2,}|\\)\n(?!\s*$)/, lo = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/, uo = /[\p{P}\p{S}]/u, fo = /[\s\p{P}\p{S}]/u, po = /[^\s\p{P}\p{S}]/u, mo = Z(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, fo).getRegex(), ho = /[\p{Pi}\p{Ps}"']/u, go = /(?!~)[\p{P}\p{S}]/u, _o = /(?!~)[\s\p{P}\p{S}]/u, vo = /(?:[^\s\p{P}\p{S}]|~)/u, yo = Z(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", Pa ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex(), bo = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/, xo = Z(bo, "u").replace(/punct/g, uo).getRegex(), So = Z(bo, "u").replace(/punct/g, go).getRegex(), Co = Z(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/, "u").replace(/openQuote/g, ho).replace(/punct/g, uo).getRegex(), wo = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)", To = Z(wo, "gu").replace(/notPunctSpace/g, po).replace(/punctSpace/g, fo).replace(/punct/g, uo).getRegex(), Eo = Z(wo, "gu").replace(/notPunctSpace/g, vo).replace(/punctSpace/g, _o).replace(/punct/g, go).getRegex(), Do = Z("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, po).replace(/punctSpace/g, fo).replace(/punct/g, uo).getRegex(), Oo = Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, po).replace(/punctSpace/g, fo).replace(/punct/g, uo).getRegex(), ko = Z("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, po).replace(/punctSpace/g, fo).replace(/punct/g, uo).getRegex(), Ao = Z(/^~~?(?:((?!~)punct)|[^\s~])/, "u").replace(/punct/g, uo).getRegex(), jo = Z("^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)", "gu").replace(/notPunctSpace/g, po).replace(/punctSpace/g, fo).replace(/punct/g, uo).getRegex(), Mo = Z(/\\(punct)/, "gu").replace(/punct/g, uo).getRegex(), No = 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(), Po = Z(Za).replace("(?:-->|$)", "-->").getRegex(), Fo = 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", Po).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(), Io = /(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/, Lo = Z(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", Io).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(), Ro = Z(/^!?\[(label)\]\[(ref)\]/).replace("label", Io).replace("ref", qa).getRegex(), zo = Z(/^!?\[(ref)\](?:\[\])?/).replace("ref", qa).getRegex(), Bo = Z("reflink|nolink(?!\\()", "g").replace("reflink", Ro).replace("nolink", zo).getRegex(), Vo = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/, Ho = {
	_backpedal: Ma,
	anyPunctuation: Mo,
	autolink: No,
	blockSkip: yo,
	br: co,
	code: so,
	del: Ma,
	delLDelim: Ma,
	delRDelim: Ma,
	emStrongLDelim: xo,
	emStrongRDelimAst: To,
	emStrongRDelimUnd: Oo,
	escape: oo,
	link: Lo,
	nolink: zo,
	punctuation: mo,
	reflink: Ro,
	reflinkSearch: Bo,
	tag: Fo,
	text: lo,
	url: Ma
}, Uo = {
	...Ho,
	emStrongLDelim: Co,
	emStrongRDelimAst: Do,
	emStrongRDelimUnd: ko,
	link: Z(/^!?\[(label)\]\((.*?)\)/).replace("label", Io).getRegex(),
	reflink: Z(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", Io).getRegex()
}, Wo = {
	...Ho,
	emStrongRDelimAst: Eo,
	emStrongLDelim: So,
	delLDelim: Ao,
	delRDelim: jo,
	url: Z(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol", Vo).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", Vo).getRegex()
}, Go = {
	...Wo,
	br: Z(co).replace("{2,}", "*").getRegex(),
	text: Z(Wo.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex()
}, Ko = {
	normal: no,
	gfm: io,
	pedantic: ao
}, qo = {
	normal: Ho,
	gfm: Wo,
	breaks: Go,
	pedantic: Uo
}, Jo = {
	"&": "&amp;",
	"<": "&lt;",
	">": "&gt;",
	"\"": "&quot;",
	"'": "&#39;"
}, Yo = (e) => Jo[e];
function Xo(e, t) {
	if (t) {
		if (Fa.escapeTest.test(e)) return e.replace(Fa.escapeReplace, Yo);
	} else if (Fa.escapeTestNoEncode.test(e)) return e.replace(Fa.escapeReplaceNoEncode, Yo);
	return e;
}
function Zo(e) {
	try {
		e = encodeURI(e).replace(Fa.percentDecode, "%");
	} catch {
		return null;
	}
	return e;
}
function Qo(e, t) {
	let n = e.replace(Fa.findPipe, (e, t, n) => {
		let r = !1, i = t;
		for (; --i >= 0 && n[i] === "\\";) r = !r;
		return r ? "|" : " |";
	}).split(Fa.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(Fa.slashPipe, "|");
	return n;
}
function $o(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 es(e) {
	let t = e.split("\n"), n = t.length - 1;
	for (; n >= 0 && Fa.blankLine.test(t[n]);) n--;
	return t.length - n <= 2 ? e : t.slice(0, n + 1).join("\n");
}
function ts(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 ns(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 rs(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 is(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 as = class {
	options;
	rules;
	lexer;
	constructor(e) {
		this.options = e || Aa;
	}
	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] : es(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 = is(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 = $o(e, "#");
				(this.options.pedantic || !t || this.rules.other.endingSpaceChar.test(t)) && (e = t.trim());
			}
			return {
				type: "heading",
				raw: $o(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: $o(t[0], "\n")
		};
	}
	blockquote(e) {
		let t = this.rules.block.blockquote.exec(e);
		if (t) {
			let e = $o(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 = ns(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 = es(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: $o(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 = Qo(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: $o(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(Qo(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: $o(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 = $o(e.slice(0, -1), "\\");
				if ((e.length - t.length) % 2 == 0) return;
			} else {
				let e = ts(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)), rs(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 rs(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
			};
		}
	}
}, os = class e {
	tokens;
	options;
	state;
	inlineQueue;
	tokenizer;
	constructor(e) {
		this.tokens = [], this.tokens.links = Object.create(null), this.options = e || Aa, this.options.tokenizer = this.options.tokenizer || new as(), 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: Fa,
			block: Ko.normal,
			inline: qo.normal
		};
		this.options.pedantic ? (t.block = Ko.pedantic, t.inline = qo.pedantic) : this.options.gfm && (t.block = Ko.gfm, t.inline = this.options.breaks ? qo.breaks : qo.gfm), this.tokenizer.rules = t;
	}
	static get rules() {
		return {
			block: Ko,
			inline: qo
		};
	}
	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(Fa.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(Fa.tabCharGlobal, "    ").replace(Fa.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);
	}
}, ss = class {
	options;
	parser;
	constructor(e) {
		this.options = e || Aa;
	}
	space(e) {
		return "";
	}
	code({ text: e, lang: t, escaped: n }) {
		let r = (t || "").match(Fa.notSpaceStart)?.[0], i = e.replace(Fa.endingNewline, "") + "\n";
		return r ? "<pre><code class=\"language-" + Xo(r) + "\">" + (n ? i : Xo(i, !0)) + "</code></pre>\n" : "<pre><code>" + (n ? i : Xo(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>${Xo(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 = Zo(e);
		if (i === null) return r;
		e = i;
		let a = "<a href=\"" + e + "\"";
		return t && (a += " title=\"" + Xo(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 = Zo(e);
		if (i === null) return Xo(n);
		e = i;
		let a = `<img src="${e}" alt="${Xo(n)}"`;
		return t && (a += ` title="${Xo(t)}"`), a += ">", a;
	}
	text(e) {
		return "tokens" in e && e.tokens ? this.parser.parseInline(e.tokens) : "escaped" in e && e.escaped ? e.text : Xo(e.text);
	}
}, cs = 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;
	}
}, ls = class e {
	options;
	renderer;
	textRenderer;
	constructor(e) {
		this.options = e || Aa, this.options.renderer = this.options.renderer || new ss(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new cs();
	}
	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;
	}
}, us = class {
	options;
	block;
	constructor(e) {
		this.options = e || Aa;
	}
	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 ? os.lex : os.lexInline;
	}
	provideParser(e = this.block) {
		return e ? ls.parse : ls.parseInline;
	}
}, ds = new class {
	defaults = ka();
	options = this.setOptions;
	parse = this.parseMarkdown(!0);
	parseInline = this.parseMarkdown(!1);
	Parser = ls;
	Renderer = ss;
	TextRenderer = cs;
	Lexer = os;
	Tokenizer = as;
	Hooks = us;
	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 ss(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 as(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 us();
				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] = us.passThroughHooks.has(n) ? (e) => {
						if (this.defaults.async && us.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 os.lex(e, t ?? this.defaults);
	}
	parser(e, t) {
		return ls.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 ? os.lex : os.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 ? ls.parse : ls.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 ? os.lex : os.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 ? ls.parse : ls.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>" + Xo(n.message + "", !0) + "</pre>";
				return t ? Promise.resolve(e) : e;
			}
			if (t) return Promise.reject(n);
			throw n;
		};
	}
}();
function Q(e, t) {
	return ds.parse(e, t);
}
Q.options = Q.setOptions = function(e) {
	return ds.setOptions(e), Q.defaults = ds.defaults, ja(Q.defaults), Q;
}, Q.getDefaults = ka, Q.defaults = Aa;
function fs(...e) {
	return ds.use(...e), Q.defaults = ds.defaults, ja(Q.defaults), Q;
}
Q.use = fs, Q.walkTokens = function(e, t) {
	return ds.walkTokens(e, t);
}, Q.parseInline = ds.parseInline, Q.Parser = ls, Q.parser = ls.parse, Q.Renderer = ss, Q.TextRenderer = cs, Q.Lexer = os, Q.lexer = os.lex, Q.Tokenizer = as, Q.Hooks = us, Q.parse = Q, Q.options, Q.setOptions, Q.walkTokens, Q.parseInline, ls.parse, os.lex;
//#endregion
//#region node_modules/dompurify/dist/purify.es.mjs
function ps(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 ms(e) {
	if (Array.isArray(e)) return e;
}
function hs(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 gs() {
	throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function _s(e, t) {
	return ms(e) || hs(e, t) || vs(e, t) || gs();
}
function vs(e, t) {
	if (e) {
		if (typeof e == "string") return ps(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) ? ps(e, t) : void 0;
	}
}
var ys = Object.entries, bs = Object.setPrototypeOf, xs = Object.isFrozen, Ss = Object.getPrototypeOf, Cs = Object.getOwnPropertyDescriptor, ws = Object.freeze, Ts = Object.seal, Es = Object.create, Ds = typeof Reflect < "u" && Reflect, Os = Ds.apply, ks = Ds.construct;
ws ||= function(e) {
	return e;
}, Ts ||= function(e) {
	return e;
}, Os ||= function(e, t) {
	var n = [...arguments].slice(2);
	return e.apply(t, n);
}, ks ||= function(e) {
	return new e(...[...arguments].slice(1));
};
var As = Xs(Array.prototype.forEach), js = Xs(Array.prototype.lastIndexOf), Ms = Xs(Array.prototype.pop), Ns = Xs(Array.prototype.push), Ps = Xs(Array.prototype.splice), Fs = Array.isArray, Is = Xs(String.prototype.toLowerCase), Ls = Xs(String.prototype.toString), Rs = Xs(String.prototype.match), zs = Xs(String.prototype.replace), Bs = Xs(String.prototype.indexOf), Vs = Xs(String.prototype.trim), Hs = Xs(Number.prototype.toString), Us = Xs(Boolean.prototype.toString), Ws = typeof BigInt > "u" ? null : Xs(BigInt.prototype.toString), Gs = typeof Symbol > "u" ? null : Xs(Symbol.prototype.toString), Ks = Xs(Object.prototype.hasOwnProperty), qs = Xs(Object.prototype.toString), Js = Xs(RegExp.prototype.test), Ys = Zs(TypeError);
function Xs(e) {
	return function(t) {
		t instanceof RegExp && (t.lastIndex = 0);
		var n = [...arguments].slice(1);
		return Os(e, t, n);
	};
}
function Zs(e) {
	return function() {
		return ks(e, [...arguments]);
	};
}
function $(e, t) {
	let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Is;
	if (bs && bs(e, null), !Fs(t)) return e;
	let r = t.length;
	for (; r--;) {
		let i = t[r];
		if (typeof i == "string") {
			let e = n(i);
			e !== i && (xs(t) || (t[r] = e), i = e);
		}
		e[i] = !0;
	}
	return e;
}
function Qs(e) {
	for (let t = 0; t < e.length; t++) Ks(e, t) || (e[t] = null);
	return e;
}
function $s(e) {
	let t = Es(null);
	for (let r of ys(e)) {
		var n = _s(r, 2);
		let i = n[0], a = n[1];
		Ks(e, i) && (t[i] = Fs(a) ? Qs(a) : a && typeof a == "object" && a.constructor === Object ? $s(a) : a);
	}
	return t;
}
function ec(e) {
	switch (typeof e) {
		case "string": return e;
		case "number": return Hs(e);
		case "boolean": return Us(e);
		case "bigint": return Ws ? Ws(e) : "0";
		case "symbol": return Gs ? Gs(e) : "Symbol()";
		case "undefined": return qs(e);
		case "function":
		case "object": {
			if (e === null) return qs(e);
			let t = e, n = tc(t, "toString");
			if (typeof n == "function") {
				let e = n(t);
				return typeof e == "string" ? e : qs(e);
			}
			return qs(e);
		}
		default: return qs(e);
	}
}
function tc(e, t) {
	for (; e !== null;) {
		let n = Cs(e, t);
		if (n) {
			if (n.get) return Xs(n.get);
			if (typeof n.value == "function") return Xs(n.value);
		}
		e = Ss(e);
	}
	function n() {
		return null;
	}
	return n;
}
function nc(e) {
	try {
		return Js(e, ""), !0;
	} catch {
		return !1;
	}
}
var rc = ws(/* @__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(".")), ic = ws(/* @__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(".")), ac = ws([
	"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"
]), oc = ws([
	"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"
]), sc = ws(/* @__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(".")), cc = ws([
	"maction",
	"maligngroup",
	"malignmark",
	"mlongdiv",
	"mscarries",
	"mscarry",
	"msgroup",
	"mstack",
	"msline",
	"msrow",
	"semantics",
	"annotation",
	"annotation-xml",
	"mprescripts",
	"none"
]), lc = ws(["#text"]), uc = ws(/* @__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(".")), dc = ws(/* @__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(".")), fc = ws(/* @__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(".")), pc = ws([
	"xlink:href",
	"xml:id",
	"xlink:title",
	"xml:space",
	"xmlns:xlink"
]), mc = Ts(/{{[\w\W]*|^[\w\W]*}}/g), hc = Ts(/<%[\w\W]*|^[\w\W]*%>/g), gc = Ts(/\${[\w\W]*/g), _c = Ts(/^data-[\-\w.\u00B7-\uFFFF]+$/), vc = Ts(/^aria-[\-\w]+$/), yc = Ts(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i), bc = Ts(/^(?:\w+script|data):/i), xc = Ts(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g), Sc = Ts(/^html$/i), Cc = Ts(/^[a-z][.\w]*(-[.\w]+)+$/i), wc = Ts(/<[/\w!]/g), Tc = Ts(/<[/\w]/g), Ec = Ts(/<\/no(script|embed|frames)/i), Dc = Ts(/\/>/i), Oc = {
	element: 1,
	attribute: 2,
	text: 3,
	cdataSection: 4,
	entityReference: 5,
	entityNode: 6,
	processingInstruction: 7,
	comment: 8,
	document: 9,
	documentType: 10,
	documentFragment: 11,
	notation: 12
}, kc = function() {
	return typeof window > "u" ? null : window;
}, Ac = 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;
	}
}, jc = function() {
	return {
		afterSanitizeAttributes: [],
		afterSanitizeElements: [],
		afterSanitizeShadowDOM: [],
		beforeSanitizeAttributes: [],
		beforeSanitizeElements: [],
		beforeSanitizeShadowDOM: [],
		uponSanitizeAttribute: [],
		uponSanitizeElement: [],
		uponSanitizeShadowNode: []
	};
}, Mc = function(e, t, n, r) {
	return Ks(e, t) && Fs(e[t]) ? $(r.base ? $s(r.base) : {}, e[t], r.transform) : n;
};
function Nc() {
	let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : kc(), t = (e) => Nc(e);
	if (t.version = "3.4.13", t.removed = [], !e || !e.document || e.document.nodeType !== Oc.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 = tc(d, "cloneNode"), p = tc(d, "remove"), m = tc(d, "nextSibling"), h = tc(d, "childNodes"), g = tc(d, "parentNode"), _ = tc(d, "shadowRoot"), v = tc(d, "attributes"), y = o && o.prototype ? tc(o.prototype, "nodeType") : null, b = o && o.prototype ? tc(o.prototype, "nodeName") : null, x = o && o.prototype ? tc(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 = "", w, T = !1, ee = 0, te = function() {
		if (ee > 0) throw Ys("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.");
	}, ne = function(e) {
		te(), ee++;
		try {
			return S.createHTML(e);
		} finally {
			ee--;
		}
	}, re = function(e) {
		te(), ee++;
		try {
			return S.createScriptURL(e);
		} finally {
			ee--;
		}
	}, ie = function() {
		return T ||= (w = Ac(u, i), !0), w;
	}, ae = n, oe = ae.implementation, se = ae.createNodeIterator, ce = ae.createDocumentFragment, le = ae.getElementsByTagName, ue = r.importNode, E = jc();
	t.isSupported = typeof ys == "function" && typeof g == "function" && oe && oe.createHTMLDocument !== void 0;
	let de = mc, fe = hc, pe = gc, me = _c, he = vc, ge = bc, _e = xc, ve = Cc, ye = yc, D = null, be = $({}, [
		...rc,
		...ic,
		...ac,
		...sc,
		...lc
	]), O = null, xe = $({}, [
		...uc,
		...dc,
		...fc,
		...pc
	]), Se = Object.seal(Es(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(Es(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, je = !0, k = !1, Me = !1, A = null, Ne = null, Pe = !1, j = !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
	], Ls), nt = ws([
		"mi",
		"mo",
		"mn",
		"ms",
		"mtext"
	]), rt = $({}, nt), it = ws(["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 = $s(e), st = ct.indexOf(e.PARSER_MEDIA_TYPE) === -1 ? "text/html" : e.PARSER_MEDIA_TYPE, lt = st === "application/xhtml+xml" ? Ls : Is, D = Mc(e, "ALLOWED_TAGS", be, { transform: lt }), O = Mc(e, "ALLOWED_ATTR", xe, { transform: lt }), et = Mc(e, "ALLOWED_NAMESPACES", tt, { transform: Ls }), qe = Mc(e, "ADD_URI_SAFE_ATTR", Je, {
			transform: lt,
			base: Je
		}), Ge = Mc(e, "ADD_DATA_URI_TAGS", Ke, {
			transform: lt,
			base: Ke
		}), Ue = Mc(e, "FORBID_CONTENTS", We, { transform: lt }), Ce = Mc(e, "FORBID_TAGS", $s({}), { transform: lt }), we = Mc(e, "FORBID_ATTR", $s({}), { transform: lt }), He = Ks(e, "USE_PROFILES") ? e.USE_PROFILES && typeof e.USE_PROFILES == "object" ? $s(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, je = e.SAFE_FOR_XML !== !1, k = e.WHOLE_DOCUMENT || !1, j = e.RETURN_DOM || !1, Fe = e.RETURN_DOM_FRAGMENT || !1, Ie = e.RETURN_TRUSTED_TYPE || !1, Pe = 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 = nc(e.ALLOWED_URI_REGEXP) ? e.ALLOWED_URI_REGEXP : yc, Qe = typeof e.NAMESPACE == "string" ? e.NAMESPACE : Ze, rt = Ks(e, "MATHML_TEXT_INTEGRATION_POINTS") && e.MATHML_TEXT_INTEGRATION_POINTS && typeof e.MATHML_TEXT_INTEGRATION_POINTS == "object" ? $s(e.MATHML_TEXT_INTEGRATION_POINTS) : $({}, nt), at = Ks(e, "HTML_INTEGRATION_POINTS") && e.HTML_INTEGRATION_POINTS && typeof e.HTML_INTEGRATION_POINTS == "object" ? $s(e.HTML_INTEGRATION_POINTS) : $({}, it);
		let t = Ks(e, "CUSTOM_ELEMENT_HANDLING") && e.CUSTOM_ELEMENT_HANDLING && typeof e.CUSTOM_ELEMENT_HANDLING == "object" ? $s(e.CUSTOM_ELEMENT_HANDLING) : Es(null);
		if (Se = Es(null), Ks(t, "tagNameCheck") && ft(t.tagNameCheck) && (Se.tagNameCheck = t.tagNameCheck), Ks(t, "attributeNameCheck") && ft(t.attributeNameCheck) && (Se.attributeNameCheck = t.attributeNameCheck), Ks(t, "allowCustomizedBuiltInElements") && typeof t.allowCustomizedBuiltInElements == "boolean" && (Se.allowCustomizedBuiltInElements = t.allowCustomizedBuiltInElements), Ts(Se), Ae && (De = !1), Fe && (j = !0), He && (D = $({}, lc), O = Es(null), He.html === !0 && ($(D, rc), $(O, uc)), He.svg === !0 && ($(D, ic), $(O, dc), $(O, pc)), He.svgFilters === !0 && ($(D, ac), $(O, dc), $(O, pc)), He.mathMl === !0 && ($(D, sc), $(O, fc), $(O, pc))), Te.tagCheck = null, Te.attributeCheck = null, Ks(e, "ADD_TAGS") && (typeof e.ADD_TAGS == "function" ? Te.tagCheck = e.ADD_TAGS : Fs(e.ADD_TAGS) && (D === be && (D = $s(D)), $(D, e.ADD_TAGS, lt))), Ks(e, "ADD_ATTR") && (typeof e.ADD_ATTR == "function" ? Te.attributeCheck = e.ADD_ATTR : Fs(e.ADD_ATTR) && (O === xe && (O = $s(O)), $(O, e.ADD_ATTR, lt))), Ks(e, "ADD_URI_SAFE_ATTR") && Fs(e.ADD_URI_SAFE_ATTR) && $(qe, e.ADD_URI_SAFE_ATTR, lt), Ks(e, "FORBID_CONTENTS") && Fs(e.FORBID_CONTENTS) && (Ue === We && (Ue = $s(Ue)), $(Ue, e.FORBID_CONTENTS, lt)), Ks(e, "ADD_FORBID_CONTENTS") && Fs(e.ADD_FORBID_CONTENTS) && (Ue === We && (Ue = $s(Ue)), $(Ue, e.ADD_FORBID_CONTENTS, lt)), Be && (D["#text"] = !0), k && $(D, [
			"html",
			"head",
			"body"
		]), D.table && ($(D, ["tbody"]), delete Ce.tbody), e.TRUSTED_TYPES_POLICY) {
			if (typeof e.TRUSTED_TYPES_POLICY.createHTML != "function") throw Ys("TRUSTED_TYPES_POLICY configuration option must provide a \"createHTML\" hook.");
			if (typeof e.TRUSTED_TYPES_POLICY.createScriptURL != "function") throw Ys("TRUSTED_TYPES_POLICY configuration option must provide a \"createScriptURL\" hook.");
			let t = S;
			S = e.TRUSTED_TYPES_POLICY;
			try {
				C = ne("");
			} 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 = ne("")));
		ws && ws(e), ut = e;
	}, mt = $({}, [
		...ic,
		...ac,
		...oc
	]), ht = $({}, [...sc, ...cc]), 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 = Is(e.tagName), r = Is(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;
	}, bt = function(e) {
		Ns(t.removed, { element: e });
		try {
			g(e).removeChild(e);
		} catch {
			if (p(e), !g(e)) throw Ys("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place");
		}
	}, M = function(e) {
		Ct(e);
		let t = h(e);
		if (t) {
			let e = [];
			As(t, (t) => {
				Ns(e, t);
			}), As(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 {
			Ns(t.removed, {
				attribute: n.getAttributeNode(e),
				from: n
			});
		} catch {
			Ns(t.removed, {
				attribute: null,
				from: n
			});
		}
		if (n.removeAttribute(e), e === "is") {
			if (j || Fe) try {
				bt(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) === Oc.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 (!je) return;
		let t = [e];
		for (; t.length > 0;) {
			let e = t.pop(), n = y ? y(e) : e.nodeType;
			if (n === Oc.processingInstruction || n === Oc.comment && Js(Tc, e.data)) {
				try {
					p(e);
				} catch {}
				continue;
			}
			if (n === Oc.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 (Pe) e = "<remove></remove>" + e;
		else {
			let t = Rs(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 ? ne(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, k ? "html" : "body")[0] : k ? 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);
	}, Dt = function(e) {
		return e = zs(e, de, " "), e = zs(e, fe, " "), e = zs(e, pe, " "), e;
	}, N = 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 = Dt(r.data), r = n.nextNode();
		let i = e.querySelectorAll?.call(e, "template");
		i && As(i, (e) => {
			kt(e.content) && N(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) === Oc.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 && As(e, (e) => {
			e.call(t, n, r, ut);
		});
	}
	let Mt = function(e, t) {
		return !!(je && e.hasChildNodes() && !At(e.firstElementChild) && Js(wc, e.textContent) && Js(wc, e.innerHTML) || je && e.namespaceURI === Ze && t === "style" && At(e.firstElementChild) || e.nodeType === Oc.processingInstruction || je && e.nodeType === Oc.comment && Js(Tc, e.data));
	}, Nt = function(e, t, n) {
		if (!Ce[t] && P(t) && (Se.tagNameCheck instanceof RegExp && Js(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 bt(e), !0;
	}, Pt = function(e, t, n, r) {
		return e.length === 0 ? t : t === n || t === r ? $s(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 bt(e), !0;
		let r = lt(b ? b(e) : e.nodeName);
		if (D = Pt(E.uponSanitizeElement, D, be, A), jt(E.uponSanitizeElement, e, {
			tagName: r,
			allowedTags: D
		}), e !== n && g(e) === null) return Ve && Ct(e), !0;
		if (Mt(e, r)) return bt(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) === Oc.element && !yt(e) || (r === "noscript" || r === "noembed" || r === "noframes") && Js(Ec, e.innerHTML)) return bt(e), !0;
		if (Ae && e.nodeType === Oc.text) {
			let n = Dt(e.textContent);
			e.textContent !== n && (Ns(t.removed, { element: e.cloneNode() }), e.textContent = n);
		}
		return jt(E.afterSanitizeElements, e, null), !1;
	}, It = function(e, t, r) {
		if (we[t] || je && t === "patchsrc" || je && 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 && Js(me, t)) && !(Ee && Js(he, t))) {
			if (!i) {
				if (!(P(e) && (Se.tagNameCheck instanceof RegExp && Js(Se.tagNameCheck, e) || Se.tagNameCheck instanceof Function && Se.tagNameCheck(e)) && (Se.attributeNameCheck instanceof RegExp && Js(Se.attributeNameCheck, t) || Se.attributeNameCheck instanceof Function && Se.attributeNameCheck(t, e)) || t === "is" && Se.allowCustomizedBuiltInElements && (Se.tagNameCheck instanceof RegExp && Js(Se.tagNameCheck, r) || Se.tagNameCheck instanceof Function && Se.tagNameCheck(r)))) return !1;
			} else if (!qe[t] && !Js(ye, zs(r, _e, "")) && !((t === "src" || t === "xlink:href" || t === "href") && e !== "script" && Bs(r, "data:") === 0 && Ge[e]) && !(Oe && !Js(ge, zs(r, _e, ""))) && r) return !1;
		}
		return !0;
	}, Lt = $({}, [
		"annotation-xml",
		"color-profile",
		"font-face",
		"font-face-format",
		"font-face-name",
		"font-face-src",
		"font-face-uri",
		"missing-glyph"
	]), P = function(e) {
		return !Lt[Is(e)] && Js(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 ne(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) ? bt(e) : Ms(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 : Vs(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") && Bs(d, ze) !== 0 && (xt(o, e), d = ze + d), je && Js(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i, d)) {
				xt(o, e);
				continue;
			}
			if (l === "attributename" && Rs(d, "href")) {
				xt(o, e);
				continue;
			}
			if (!n.forceKeepAttr) {
				if (!n.keepAttr) {
					xt(o, e);
					continue;
				}
				if (!ke && Js(Dc, d)) {
					xt(o, e);
					continue;
				}
				if (Ae && (d = Dt(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) === Oc.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) === Oc.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 = ec(e), typeof e != "string")) throw Ys("dirty is not a string, aborting");
		if (!t.isSupported) return e;
		Me ? (D = A, O = Ne) : pt(n), (E.uponSanitizeElement.length > 0 || E.uponSanitizeAttribute.length > 0) && (D = $s(D)), E.uponSanitizeAttribute.length > 0 && (O = $s(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 M(e), Ys("root node is forbidden and cannot be sanitized in-place");
			}
			if (Ot(e)) throw M(e), Ys("root node is clobbered and cannot be sanitized in-place");
			try {
				Ht(e);
			} catch (t) {
				throw M(e), t;
			}
		} else if (At(e)) i = Tt("<!---->"), a = i.ownerDocument.importNode(e, !0), a.nodeType === Oc.element && a.nodeName === "BODY" || a.nodeName === "HTML" ? i = a : i.appendChild(a), Ht(a);
		else {
			if (!j && !Ae && !k && e.indexOf("<") === -1) return S && Ie ? ne(e) : e;
			if (i = Tt(e), !i) return j ? null : Ie ? C : "";
		}
		i && Pe && bt(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 && (M(e), As(t.removed, (e) => {
				e.element && Ct(e.element);
			})), n;
		}
		if (c) return As(t.removed, (e) => {
			e.element && Ct(e.element);
		}), Ae && N(e), e;
		if (j) {
			if (Ae && N(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 = k ? i.outerHTML : i.innerHTML;
		return k && D["!doctype"] && i.ownerDocument && i.ownerDocument.doctype && i.ownerDocument.doctype.name && Js(Sc, i.ownerDocument.doctype.name) && (u = "<!DOCTYPE " + i.ownerDocument.doctype.name + ">\n" + u), Ae && (u = Dt(u)), S && Ie ? ne(u) : u;
	}, t.setConfig = function() {
		let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
		pt(e), Me = !0, A = D, Ne = O;
	}, t.clearConfig = function() {
		ut = null, Me = !1, A = null, Ne = null, S = w, 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" && Ks(E, e) && Ns(E[e], t);
	}, t.removeHook = function(e, t) {
		if (Ks(E, e)) {
			if (t !== void 0) {
				let n = js(E[e], t);
				return n === -1 ? void 0 : Ps(E[e], n, 1)[0];
			}
			return Ms(E[e]);
		}
	}, t.removeHooks = function(e) {
		Ks(E, e) && (E[e] = []);
	}, t.removeAllHooks = function() {
		E = jc();
	}, t;
}
var Pc = Nc();
//#endregion
//#region src/lib/markdown.ts
Q.setOptions({
	breaks: !0,
	gfm: !0
});
function Fc(e) {
	let t = Q.parse(e, { async: !1 });
	return Pc.sanitize(t);
}
//#endregion
//#region src/lib/overlayScroll.ts
function Ic(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/api/tables.ts
function Lc(e) {
	return e === "date" ? { type: "date" } : e === "datetime" ? {
		type: "datetime-local",
		step: "1"
	} : { type: "text" };
}
async function Rc(e, t = fetch) {
	return (await Ni(`/api/v1/tables/${e}`, void 0, t)).json();
}
//#endregion
//#region src/lib/api/attachments.ts
function zc(e, t, n, r) {
	return `/api/v1/tables/${e}/records/${t}/attachments/${n}/${r}`;
}
function Bc(e, t, n, r) {
	return zc(e, t, n, r);
}
function Vc(e, t, n, r) {
	return `${zc(e, t, n, r)}/thumbnail`;
}
async function Hc(e, t, n, r) {
	let i = new FormData();
	return i.append("file", r), (await Ni(`/api/v1/tables/${e}/records/${t}/attachments/${n}`, {
		method: "POST",
		body: i
	})).json();
}
async function Uc(e, t, n, r) {
	await Ni(zc(e, t, n, r), { method: "DELETE" });
}
//#endregion
//#region src/lib/labelColors.ts
var Wc = {
	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 Gc(e) {
	return /^#[0-9a-fA-F]{6}$/.test(e);
}
function Kc(e, t) {
	return t && t.length === Object.keys(e).length ? [...t] : Object.keys(e);
}
function qc(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 Jc = /* @__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 Yc(e, t) {
	Ue(t, !0);
	let n = Y(t, "src", 7), r = Y(t, "alt", 7), i = Y(t, "onClose", 7);
	yn(() => {
		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 = Jc(), 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), We(a);
}
br(["click"]), ji(Yc, {
	src: {},
	alt: {},
	onClose: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/AttachmentCell.svelte
var Xc = /* @__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>"), Zc = /* @__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>"), Qc = /* @__PURE__ */ Or("<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>"), $c = /* @__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 el(e, t) {
	Ue(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 = $c(), _ = ln(g), v = L(_);
	Gr(v, 17, n, (e) => e.id, (e, t) => {
		var n = Ar(), o = ln(n), s = (e) => {
			var n = Xc(), 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;
			}, [() => Vc(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 = Zc(), 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;
			}, [() => Bc(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);
	Ti(y, (e) => I(c, e), () => H(c));
	var b = R(y, 2), x = L(b), S = (e) => {
		G(e, Qc());
	}, C = (e) => {
		G(e, kr("+"));
	};
	q(x, (e) => {
		H(l) ? e(S) : e(C, -1);
	}), j(b), j(_);
	var w = R(_, 2), T = (e) => {
		{
			let t = /* @__PURE__ */ M(() => Bc(r(), i(), a(), H(d).id));
			Yc(e, {
				get src() {
					return H(t);
				},
				get alt() {
					return H(d).original_filename;
				},
				onClose: () => I(d, null)
			});
		}
	};
	return q(w, (e) => {
		H(d) && e(T);
	}), 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), We(h);
}
br(["click", "change"]), ji(el, {
	files: {},
	tableId: {},
	pk: {},
	columnId: {},
	onUpload: {},
	onDelete: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/FKSelect.svelte
var tl = /* @__PURE__ */ W("<input/>"), nl = /* @__PURE__ */ W("<span class=\"badge shrink-0 truncate bg-ink-100 text-ink-700\"> </span>"), rl = /* @__PURE__ */ W("<span class=\"truncate text-ink-400\"> </span>"), il = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-ink-400\"> </div>"), al = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-danger\"> </div>"), ol = /* @__PURE__ */ W("<span class=\"truncate\"> </span>"), sl = /* @__PURE__ */ W("<button type=\"button\"><!></button>"), cl = /* @__PURE__ */ W("<div class=\"px-3 py-1 text-xs text-ink-400\"> </div>"), ll = /* @__PURE__ */ W("<!> <!>", 1), ul = /* @__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>"), dl = /* @__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 fl(e, t) {
	Ue(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 _ ||= Rc(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);
		}), _;
	}
	yn(() => {
		v();
	});
	let y = /* @__PURE__ */ F(!1), b = /* @__PURE__ */ F(""), x = /* @__PURE__ */ F($t([])), S = /* @__PURE__ */ F(!1), C = /* @__PURE__ */ F(!1), w = /* @__PURE__ */ F(!1), T = /* @__PURE__ */ F(0), ee = /* @__PURE__ */ F(void 0), te = 0, ne, 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 = ++te;
		I(C, !0), I(w, !1);
		try {
			let n = await zi(r(), {
				where: e ? {
					col: H(h),
					op: "like",
					val: e
				} : Pi,
				sort: [{
					column: H(h),
					desc: !1
				}],
				limit: 20
			});
			if (t !== te) 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 !== te) return;
			I(w, !0), I(x, [], !0), I(S, !1);
		} finally {
			t === te && I(C, !1);
		}
	}
	function ue(e) {
		ne && clearTimeout(ne), ne = 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(T, 0), le(""), queueMicrotask(() => H(ae)?.focus());
	}
	function de() {
		I(y, !1), I(se, null), ne && clearTimeout(ne);
	}
	function fe() {
		de(), l()?.();
	}
	function pe(e) {
		n(e.rawValue), I(ee, 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(T, (H(T) + 1) % t);
		else if (e.key === "ArrowUp") e.preventDefault(), t > 0 && I(T, (H(T) - 1 + t) % t);
		else if (e.key === "Enter") {
			e.preventDefault();
			let t = H(ce)[H(T)];
			t && pe(t);
		} else e.key === "Escape" && (e.preventDefault(), de(), u()?.());
	}
	yn(() => {
		c() && v().then(() => {
			H(h) ? (H(re)?.focus(), E()) : H(ie)?.focus();
		});
	}), yn(() => {
		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 = Ar(), ye = ln(ve), D = (e) => {
		var t = tl();
		hi(t), Ti(t, (e) => I(ie, e), () => H(ie)), z((e, n) => {
			J(t, "type", e), J(t, "step", n), ci(t, 1, ni(p()));
		}, [() => Lc(a()).type, () => Lc(a()).step]), U("keydown", t, function(...e) {
			d()?.apply(this, e);
		}), yr("blur", t, () => l()?.()), xi(t, n), G(e, t);
	}, be = (e) => {
		var t = dl(), r = ln(t), i = L(r), a = (e) => {
			var t = nl(), r = L(t, !0);
			j(t), z(() => K(r, s() ?? H(ee) ?? n())), G(e, t);
		}, o = (e) => {
			var t = rl(), n = L(t, !0);
			j(t), z(() => K(n, f())), G(e, t);
		};
		q(i, (e) => {
			n() ? e(a) : e(o, -1);
		}), Fe(2), j(r), Ti(r, (e) => I(re, e), () => H(re));
		var c = R(r, 2), l = (e) => {
			var t = ul(), n = L(t);
			hi(n), Ti(n, (e) => I(ae, e), () => H(ae));
			var r = R(n, 2), i = L(r), a = (e) => {
				var t = il(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
			}, o = (e) => {
				var t = al(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.errorLoading")]), G(e, t);
			}, s = (e) => {
				var t = il(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.noResults")]), G(e, t);
			}, c = (e) => {
				var t = ll(), n = ln(t);
				Gr(n, 19, () => H(ce), (e, t) => e.rawValue + "::" + t, (e, t, n) => {
					var r = sl(), i = L(r), a = (e) => {
						var t = rl(), n = L(t, !0);
						j(t), z(() => K(n, f())), G(e, t);
					}, o = (e) => {
						var n = ol(), 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(() => ci(r, 1, `flex w-full items-center px-3 py-1.5 text-left text-sm
								${H(n) === H(T) ? "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 = cl(), 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(w) ? e(o, 1) : H(ce).length === 0 ? e(s, 2) : e(c, -1);
			}), j(r), $r(r, (e) => Ic?.(e)), j(t), Ti(t, (e) => I(oe, e), () => H(oe)), z((e) => {
				ui(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), xi(n, () => H(b), (e) => I(b, e)), G(e, t);
		};
		q(c, (e) => {
			H(y) && H(se) && e(l);
		}), z(() => ci(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), We(_e);
}
br([
	"keydown",
	"click",
	"input",
	"mousedown"
]), ji(fl, {
	value: {},
	fkTargetTableId: {},
	fkTargetColumn: {},
	uiType: {},
	nullable: {},
	currentLabel: {},
	autoOpen: {},
	onClose: {},
	onCancel: {},
	onKeydown: {},
	emptyLabel: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LabelChip.svelte
var pl = /* @__PURE__ */ W("<span class=\"badge\"> </span>"), ml = /* @__PURE__ */ W("<span> </span>");
function hl(e, t) {
	Ue(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 = Ar(), o = ln(a), s = (e) => {
		var t = pl(), i = L(t, !0);
		j(t), z((e) => {
			ui(t, `background-color: ${r() ?? ""}; color: ${e ?? ""}`), K(i, n());
		}, [() => qc(r())]), G(e, t);
	}, c = /* @__PURE__ */ M(() => r() && Gc(r())), l = (e) => {
		var t = ml(), i = L(t, !0);
		j(t), z(() => {
			ci(t, 1, `badge ${Wc[r()] ?? Wc.gray ?? ""}`), K(i, n());
		}), G(e, t);
	};
	return q(o, (e) => {
		H(c) ? e(s) : e(l, -1);
	}), G(e, a), We(i);
}
ji(hl, {
	text: {},
	color: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LabelSelect.svelte
var gl = /* @__PURE__ */ W("<span class=\"truncate text-ink-400\"> </span>"), _l = /* @__PURE__ */ W("<button type=\"button\"><!></button>"), vl = /* @__PURE__ */ W("<div class=\"overlay-scroll card fixed z-30 max-h-64 overflow-y-auto py-1 shadow-lg\"></div>"), yl = /* @__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 bl(e, t) {
	Ue(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(() => ["", ...Kc(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()?.());
	}
	yn(() => {
		a() && (H(f)?.focus(), _());
	}), yn(() => {
		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();
		}
	}, w = yl(), T = ln(w), ee = L(T), te = (e) => {
		hl(e, {
			get text() {
				return n();
			},
			get color() {
				return r()[n()];
			}
		});
	}, ne = (e) => {
		var t = gl(), n = L(t, !0);
		j(t), z(() => K(n, l())), G(e, t);
	};
	q(ee, (e) => {
		n() ? e(te) : e(ne, -1);
	}), Fe(2), j(T), Ti(T, (e) => I(f, e), () => H(f));
	var re = R(T, 2), ie = (e) => {
		var t = vl();
		Gr(t, 22, () => H(g), (e) => e, (e, t, n) => {
			var i = _l(), a = L(i), o = (e) => {
				hl(e, {
					get text() {
						return t;
					},
					get color() {
						return r()[t];
					}
				});
			}, s = (e) => {
				var t = gl(), 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(() => ci(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), Ti(t, (e) => I(p, e), () => H(p)), $r(t, (e) => Ic?.(e)), z(() => ui(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(() => ci(T, 1, `flex items-center justify-between gap-1 text-left ${u() ?? "" ?? ""}`)), U("click", T, x), U("keydown", T, S), G(e, w), We(C);
}
br([
	"click",
	"keydown",
	"mousedown"
]), ji(bl, {
	value: {},
	colors: {},
	order: {},
	autoOpen: {},
	onClose: {},
	onCancel: {},
	onKeydown: {},
	emptyLabel: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/LinksSelect.svelte
var xl = /* @__PURE__ */ W("<div class=\"px-3 py-2 text-sm text-ink-500\"> </div>"), Sl = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-ink-400\"> </div>"), Cl = /* @__PURE__ */ W("<div class=\"px-3 py-1.5 text-sm text-danger\"> </div>"), wl = /* @__PURE__ */ W("<button type=\"button\"><span class=\"truncate\"> </span></button>"), Tl = /* @__PURE__ */ W("<div class=\"px-3 py-1 text-xs text-ink-400\"> </div>"), El = /* @__PURE__ */ W("<!> <!>", 1), Dl = /* @__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), Ol = /* @__PURE__ */ W("<div class=\"card fixed z-30 flex max-h-72 flex-col overflow-hidden py-1 shadow-lg\"><!></div>"), kl = /* @__PURE__ */ W("<button type=\"button\">+</button> <!>", 1);
function Al(e, t) {
	Ue(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 ||= Rc(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($t([])), 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), w = /* @__PURE__ */ M(() => new Set(r().map((e) => String(e)))), T = /* @__PURE__ */ M(() => H(p).filter((e) => !H(w).has(String(e.id))));
	async function ee(e) {
		if (!H(u) || !H(s)) return;
		let t = ++v;
		I(h, !0), I(g, !1);
		try {
			let r = await zi(n(), {
				where: e ? {
					col: H(u),
					op: "like",
					val: e
				} : Pi,
				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 te(e) {
		y && clearTimeout(y), y = setTimeout(() => ee(e), 250);
	}
	function ne() {
		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) && ee(""), queueMicrotask(() => H(x)?.focus());
	}
	function re() {
		I(d, !1), I(C, null), y && clearTimeout(y);
	}
	async function ie() {
		await l(), H(d) ? re() : ne();
	}
	function ae(e) {
		i()(e.id);
	}
	function oe(e) {
		let t = H(T).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(T)[H(_)];
			t && ae(t);
		} else e.key === "Escape" && (e.preventDefault(), re());
	}
	yn(() => {
		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 = kl(), le = ln(ce);
	Ti(le, (e) => I(b, e), () => H(b));
	var ue = R(le, 2), E = (e) => {
		var t = Ol(), n = L(t), r = (e) => {
			var t = xl(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("linksSelect.noPrimaryKey")]), G(e, t);
		}, i = (e) => {
			var t = Dl(), n = ln(t);
			hi(n), Ti(n, (e) => I(x, e), () => H(x));
			var r = R(n, 2), i = L(r), a = (e) => {
				var t = Sl(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
			}, o = (e) => {
				var t = Cl(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.errorLoading")]), G(e, t);
			}, s = (e) => {
				var t = Sl(), n = L(t, !0);
				j(t), z((e) => K(n, e), [() => X("common.noResults")]), G(e, t);
			}, c = (e) => {
				var t = El(), n = ln(t);
				Gr(n, 19, () => H(T), (e) => String(e.id), (e, t, n) => {
					var r = wl(), i = L(r), a = L(i, !0);
					j(i), j(r), z(() => {
						ci(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 = Tl(), 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(T).length === 0 ? e(s, 2) : e(c, -1);
			}), j(r), $r(r, (e) => Ic?.(e)), z((e) => J(n, "placeholder", e), [() => X("common.search")]), U("input", n, () => te(H(f))), U("keydown", n, oe), xi(n, () => H(f), (e) => I(f, e)), G(e, t);
		};
		q(n, (e) => {
			H(s) ? e(i, -1) : e(r);
		}), j(t), Ti(t, (e) => I(S, e), () => H(S)), z(() => ui(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) => {
		ci(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), We(se);
}
br([
	"click",
	"input",
	"keydown",
	"mousedown"
]), ji(Al, {
	targetTableId: {},
	excludeIds: {},
	onSelect: {},
	class: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/components/MarkdownEditModal.svelte
var jl = /* @__PURE__ */ W("<p class=\"text-sm text-ink-400 italic\"> </p>"), Ml = /* @__PURE__ */ W("<div class=\"markdown-body\"></div>"), Nl = /* @__PURE__ */ W("<div class=\"overlay-scroll min-h-0 overflow-y-auto px-4 py-3\"><!></div>"), Pl = /* @__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>"), Fl = {
	hash: "svelte-1uva96y",
	code: "\r\n	/* Same terminal look as SqlEditorModal/the script editor's code field,\r\n	   duplicated here since Svelte styles are scoped per-component -- applies\r\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 Il(e, t) {
	Ue(t, !0), Qr(e, Fl);
	let n = Y(t, "title", 7), r = Y(t, "value", 7), i = Y(t, "onSave", 7), a = Y(t, "onCancel", 7), o = /* @__PURE__ */ F($t(fr(() => r()))), s = /* @__PURE__ */ F(!1), c = /* @__PURE__ */ F(!1), l = /* @__PURE__ */ M(() => Fc(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();
		}
	}, _ = Pl(), v = L(_), y = L(v), b = L(y), x = L(b);
	j(b);
	var S = R(b, 2), C = L(S), w = R(L(C));
	j(C);
	var T = R(C, 2), ee = L(T, !0);
	j(T), j(S), j(y);
	var te = R(y, 2), ne = L(te), re = R(ne, 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(te);
	var he = R(te, 2), ge = L(he);
	at(ge), Ti(ge, (e) => I(u, e), () => H(u));
	var _e = R(ge, 2), ve = (e) => {
		var t = Nl(), n = L(t), r = (e) => {
			var t = jl(), 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 = Ml();
			Zr(t, () => H(l), !0), j(t), G(e, t);
		};
		q(n, (e) => {
			H(i) ? e(r) : e(a, -1);
		}), j(t), $r(t, (e) => Ic?.(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(w, ` ${t ?? ""}`), K(ee, r), J(ne, "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), ci(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", T, function(...e) {
		a()?.apply(this, e);
	}), U("click", ne, () => 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), xi(ge, () => H(o), (e) => I(o, e)), U("click", D, function(...e) {
		a()?.apply(this, e);
	}), U("click", O, d), G(e, _), We(g);
}
br(["click"]), ji(Il, {
	title: {},
	value: {},
	onSave: {},
	onCancel: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/i18n/errors.ts
var Ll = {
	de: Qi.errors,
	en: $i.errors
};
function Rl(e) {
	return e instanceof Mi ? ((Ll[Zi.current] ?? Ll.de)[e.code] ?? Ll.de[e.code]) || e.message : e instanceof Error ? e.message : String(e);
}
//#endregion
//#region src/lib/components/RecordFormModal.svelte
var zl = /* @__PURE__ */ W("<p class=\"text-xs text-ink-400\"> </p>"), Bl = /* @__PURE__ */ W("<p class=\"py-8 text-center text-sm text-ink-400\"> </p>"), Vl = /* @__PURE__ */ W("<p class=\"alert alert-danger\" role=\"alert\"> </p>"), Hl = /* @__PURE__ */ W("<span class=\"badge bg-ink-100 text-[10px] text-ink-500\"> </span>"), Ul = /* @__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>"), Wl = /* @__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>"), Gl = /* @__PURE__ */ W("<div class=\"rounded-md border border-ink-300 bg-surface px-2 py-1.5\"><!></div>"), Kl = /* @__PURE__ */ W("<a class=\"btn btn-primary btn-xs\"> </a>"), ql = /* @__PURE__ */ W("<p class=\"input bg-ink-50 text-ink-500\">–</p>"), Jl = /* @__PURE__ */ W("<p class=\"input bg-ink-50 text-ink-500\"> </p>"), Yl = /* @__PURE__ */ W("<input type=\"checkbox\" class=\"size-4 accent-brand-600\"/>"), Xl = /* @__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>"), Zl = /* @__PURE__ */ W("<a class=\"btn btn-secondary btn-xs shrink-0\"> </a>"), Ql = /* @__PURE__ */ W("<div class=\"flex items-center gap-2\"><input class=\"input flex-1\"/> <!></div>"), $l = /* @__PURE__ */ W("<button type=\"button\" class=\"btn btn-secondary btn-xs shrink-0\"> </button>"), eu = /* @__PURE__ */ W("<div class=\"flex items-center gap-2\"><!> <!></div>"), tu = /* @__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>"), nu = /* @__PURE__ */ W("<input class=\"input\"/>"), ru = /* @__PURE__ */ W("<label class=\"field\"><span class=\"flex items-center gap-2\"> <span class=\"font-normal text-ink-400\"> </span> <!></span> <!></label>"), iu = /* @__PURE__ */ W("<div class=\"space-y-3\"></div>"), au = /* @__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>"), ou = /* @__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 su(e, t) {
	Ue(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($t({})), p = /* @__PURE__ */ F($t({})), 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 Rc(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 zi(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, Rl(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] = pa(t[i.effective_name]) : n[i.effective_name] = Oa(t[i.effective_name], i));
		I(f, n, !0), I(p, r, !0);
	}
	yn(() => {
		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] !== pa(H(c)[t.effective_name]) && (e[t.effective_name] = H(p)[t.effective_name]);
			else {
				let n = Oa(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 Vi(n(), r(), e), o()?.(), a()();
		} catch (e) {
			I(u, Rl(e), !0);
		} finally {
			I(d, !1);
		}
	}
	async function b(e, t) {
		try {
			await Hi(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Rl(e), !0);
		}
	}
	async function x(e, t) {
		try {
			await Ui(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Rl(e), !0);
		}
	}
	async function S(e, t) {
		try {
			await Hc(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Rl(e), !0);
		}
	}
	async function C(e, t) {
		try {
			await Uc(n(), r(), e.id, t), await g(), o()?.();
		} catch (e) {
			I(u, Rl(e), !0);
		}
	}
	let w = /* @__PURE__ */ F(null);
	function T(e, t) {
		!e || t == null || I(w, {
			tableId: e,
			pk: t
		}, !0);
	}
	let ee = /* @__PURE__ */ F(null);
	var te = {
		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();
		}
	}, ne = ou(), re = ln(ne), 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 = zl(), n = L(t);
		j(t), z((e) => K(n, `${H(m).effective_name ?? ""}: ${e ?? ""}`), [() => oa(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 = Bl(), n = L(t, !0);
		j(t), z((e) => K(n, e), [() => X("nav.loading")]), G(e, t);
	}, he = (e) => {
		var t = Vl(), n = L(t, !0);
		j(t), z(() => K(n, H(u))), G(e, t);
	}, ge = (e) => {
		var t = iu();
		Gr(t, 21, () => H(h), (e) => e.id, (e, t) => {
			var i = ru(), a = L(i), o = L(a), s = R(o), l = L(s, !0);
			j(s);
			var u = R(s, 2), d = (e) => {
				var n = Hl(), r = L(n, !0);
				j(n), z((e) => K(r, e), [() => Ta(H(t))]), G(e, n);
			}, m = /* @__PURE__ */ M(() => Ta(H(t)));
			q(u, (e) => {
				H(m) && e(d);
			}), j(a);
			var h = R(a, 2), g = (e) => {
				var n = Wl(), r = L(n);
				Gr(r, 17, () => Ea(H(c)[H(t).effective_name]), (e) => e.id, (e, n) => {
					var r = Ul(), 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);
					}, [() => oa(H(n).label), () => X("recordForm.removeLink", { label: oa(H(n).label) })]), U("click", i, () => T(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(() => Ea(H(c)[H(t).effective_name]).map((e) => e.id));
						Al(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 = Gl(), a = L(i);
				{
					let e = /* @__PURE__ */ M(() => H(c)[H(t).effective_name] ?? []);
					el(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 = Ar(), r = ln(n), i = (e) => {
					var n = Kl(), 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);
					}, [() => fa(H(t), H(c)[H(t).effective_name]), () => H(t).format_config.label ?? X("recordForm.open")]), G(e, n);
				}, a = (e) => {
					G(e, ql());
				};
				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 = Jl(), r = L(n, !0);
				j(n), z((e) => K(r, e), [() => la(H(c), H(t)) ?? wa(H(c)[H(t).effective_name], H(t))]), G(e, n);
			}, w = (e) => {
				var n = Yl();
				hi(n), z(() => _i(n, H(p)[H(t).effective_name])), U("change", n, (e) => H(p)[H(t).effective_name] = e.currentTarget.checked), G(e, n);
			}, te = (e) => {
				{
					let n = /* @__PURE__ */ M(() => H(t).format_config.colors ?? {});
					bl(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;
						}
					});
				}
			}, ne = (e) => {
				var n = Xl(), r = L(n), i = L(r, !0);
				j(r), Fe(2), j(n), z((e) => K(i, e), [() => H(f)[H(t).effective_name]?.trim() || X("recordForm.editMarkdown")]), U("click", n, () => I(ee, H(t), !0)), G(e, n);
			}, re = (e) => {
				var n = Ql(), r = L(n);
				hi(r);
				var i = R(r, 2), a = (e) => {
					var n = Zl(), 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);
					}, [() => fa(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), xi(r, () => H(f)[H(t).effective_name], (e) => H(f)[H(t).effective_name] = e), G(e, n);
			}, ie = (e) => {
				var n = eu(), r = L(n);
				{
					let e = /* @__PURE__ */ M(() => la(H(c), H(t)) ?? oa(H(c)[H(t).effective_name]));
					fl(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 = $l(), r = L(n, !0);
					j(n), z((e) => K(r, e), [() => X("recordForm.open")]), U("click", n, () => T(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 = tu(), r = L(n);
				hi(r);
				var i = R(r, 2);
				hi(i), j(n), z((e) => gi(r, e), [() => Gc(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), xi(i, () => H(f)[H(t).effective_name], (e) => H(f)[H(t).effective_name] = e), G(e, n);
			}, oe = (e) => {
				var n = nu();
				hi(n), z((e, t) => {
					J(n, "type", e), J(n, "step", t);
				}, [() => Lc(H(t).ui_type).type, () => Lc(H(t).ui_type).step]), xi(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(w, 4) : H(t).display_format === "label" ? e(te, 5) : H(t).display_format === "markdown" ? e(ne, 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), $r(fe, (e) => Ic?.(e));
	var _e = R(fe, 2), ve = (e) => {
		var t = au(), 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(ee).effective_name] ?? "");
			Il(e, {
				get title() {
					return H(ee).effective_name;
				},
				get value() {
					return H(t);
				},
				onSave: (e) => {
					H(ee) && (H(f)[H(ee).effective_name] = e), I(ee, null);
				},
				onCancel: () => I(ee, null)
			});
		}
	};
	q(ye, (e) => {
		H(ee) && e(D);
	});
	var be = R(ye, 2), O = (e) => {
		{
			let t = /* @__PURE__ */ M(() => i() + 1);
			su(e, {
				get tableId() {
					return H(w).tableId;
				},
				get pk() {
					return H(w).pk;
				},
				get depth() {
					return H(t);
				},
				onClose: () => I(w, null),
				onSaved: () => {
					g(), o()?.();
				}
			});
		}
	};
	return q(be, (e) => {
		H(w) && e(O);
	}), z((e, t) => {
		ui(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, ne), We(te);
}
br(["click", "change"]), ji(su, {
	tableId: {},
	pk: {},
	depth: {},
	onClose: {},
	onSaved: {}
}, [], [], { mode: "open" });
//#endregion
//#region src/lib/viewmodules/wiki/WikiView.svelte
var cu = /* @__PURE__ */ W("<button type=\"button\" class=\"grid size-4 shrink-0 place-items-center text-ink-400 hover:text-ink-700\"><svg viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M8 5v14l11-7z\"></path></svg></button>"), lu = /* @__PURE__ */ W("<span class=\"size-4 shrink-0\"></span>"), uu = /* @__PURE__ */ W("<button type=\"button\" class=\"grid size-5 shrink-0 place-items-center rounded text-ink-400 opacity-0 hover:bg-ink-200 hover:text-ink-700 group-hover:opacity-100\"><svg class=\"size-3.5\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"></line><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"></line></svg></button> <button type=\"button\" class=\"grid size-5 shrink-0 place-items-center rounded text-ink-400 opacity-0 hover:bg-ink-200 hover:text-red-600 group-hover:opacity-100\"><svg class=\"size-3.5\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"></polyline><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"></path></svg></button>", 1), du = /* @__PURE__ */ W("<p class=\"pr-2 pb-1 text-xs text-red-600\"> </p>"), fu = /* @__PURE__ */ W("<p class=\"pr-2 pb-1 text-xs text-amber-600\"> </p>"), pu = /* @__PURE__ */ W("<div><div role=\"button\" tabindex=\"-1\"><!> <button type=\"button\" class=\"min-w-0 flex-1 truncate text-left\"> </button> <!></div> <!> <!></div>"), mu = /* @__PURE__ */ W("<p class=\"border-b border-ink-200 px-2 py-1 text-xs text-red-600\"> </p>"), hu = /* @__PURE__ */ W("<div class=\"flex shrink-0 items-center justify-between border-b border-ink-200 px-2 py-1.5\"><button type=\"button\" class=\"btn btn-secondary btn-xs\"> </button></div> <!>", 1), gu = /* @__PURE__ */ W("<p class=\"px-2 py-4 text-center text-xs text-ink-400\"> </p>"), _u = /* @__PURE__ */ W("<p class=\"mt-1 text-xs text-red-600\"> </p>"), vu = /* @__PURE__ */ W("<div class=\"shrink-0 border-t border-ink-200 p-2\"><button type=\"button\" class=\"btn btn-secondary w-full text-sm\"> </button> <!></div>"), yu = /* @__PURE__ */ W("<div class=\"grid h-full place-items-center p-8 text-center text-sm text-ink-500\"> </div>"), bu = /* @__PURE__ */ W("<button type=\"button\" class=\"btn btn-secondary shrink-0\"> </button>"), xu = /* @__PURE__ */ W("<div class=\"flex shrink-0 items-center justify-between gap-3 border-b border-ink-200 px-6 py-4\"><h1 class=\"min-w-0 truncate text-xl font-semibold text-ink-900\"> </h1> <!></div> <div class=\"overlay-scroll flex-1 overflow-y-auto px-6 py-6\"><div class=\"markdown-body\"></div></div>", 1), Su = /* @__PURE__ */ W("<div class=\"flex h-full\"><aside class=\"flex w-72 shrink-0 flex-col border-r border-ink-200 bg-ink-50\"><div class=\"shrink-0 border-b border-ink-200 p-2\"><input type=\"search\" class=\"input w-full text-sm\"/></div> <!> <div class=\"overlay-scroll flex-1 overflow-y-auto p-2\"><!></div> <!></aside> <div class=\"flex min-w-0 flex-1 flex-col bg-surface\"><!></div></div> <!>", 1);
function Cu(e, t) {
	Ue(t, !0);
	let n = (e, t = _, r = _) => {
		let i = /* @__PURE__ */ M(() => H(ne) === null || H(ne).has(t().pk)), a = /* @__PURE__ */ M(() => !H(he) && o() && !!H(h) && !!H(m) && !t().cyclic), l = /* @__PURE__ */ M(() => H(ye) && H(_e) === t().pk);
		var u = Ar(), f = ln(u), p = (e) => {
			var i = pu(), u = L(i), f = L(u), p = (e) => {
				var n = cu(), r = L(n);
				j(n), z((e, t) => {
					J(n, "aria-label", e), ci(r, 0, `size-3 transition-transform ${t ?? ""}`);
				}, [() => H(re).has(t().pk) ? X("tablePage.wikiExpand") : X("tablePage.wikiCollapse"), () => H(te) || !H(re).has(t().pk) ? "rotate-90" : ""]), U("click", n, () => ie(t().pk)), G(e, n);
			}, m = (e) => {
				G(e, lu());
			};
			q(f, (e) => {
				t().children.length > 0 && !t().cyclic ? e(p) : e(m, -1);
			});
			var h = R(f, 2), g = L(h, !0);
			j(h);
			var _ = R(h, 2), v = (e) => {
				var n = uu(), r = ln(n), i = R(r, 2);
				z((e, t, n, a) => {
					J(r, "title", e), J(r, "aria-label", t), r.disabled = H(E), J(i, "title", n), J(i, "aria-label", a);
				}, [
					() => X("tablePage.wikiAddChildPage"),
					() => X("tablePage.wikiAddChildPage"),
					() => X("common.delete"),
					() => X("common.delete")
				]), U("click", r, (e) => {
					e.stopPropagation(), fe(t().row[H(d).effective_name]);
				}), U("click", i, (e) => {
					e.stopPropagation(), me(t());
				}), G(e, n);
			};
			q(_, (e) => {
				o() && !t().cyclic && e(v);
			}), j(u);
			var b = R(u, 2), x = (e) => {
				var t = du(), n = L(t, !0);
				j(t), z((e) => {
					ui(t, `padding-left: ${r() * 14 + 24}px`), K(n, e);
				}, [() => X("tablePage.wikiDeleteHasChildren")]), G(e, t);
			};
			q(b, (e) => {
				H(pe) === t().pk && e(x);
			});
			var S = R(b, 2), C = (e) => {
				var t = fu(), n = L(t, !0);
				j(t), z((e) => {
					ui(t, `padding-left: ${r() * 14 + 24}px`), K(n, e);
				}, [() => X("tablePage.wikiCyclicPage")]), G(e, t);
			}, w = (e) => {
				var i = Ar();
				Gr(ln(i), 17, () => t().children, (e) => e.pk, (e, t) => {
					n(e, () => H(t), () => r() + 1);
				}), G(e, i);
			}, T = /* @__PURE__ */ M(() => t().children.length > 0 && (H(te) || !H(re).has(t().pk)));
			q(S, (e) => {
				t().cyclic ? e(C) : H(T) && e(w, 1);
			}), j(i), z((e, n) => {
				ci(u, 1, `group flex items-center gap-1 rounded-md py-1 pr-1 text-sm hover:bg-ink-100
					${e ?? ""}
					${H(ye) && H(ge) === t().pk ? "opacity-40" : ""}
					${H(l) && H(ve) === "into" ? "bg-brand-100 ring-1 ring-inset ring-brand-400" : ""}
					${H(l) && H(ve) === "before" ? "border-t-2 border-brand-500" : ""}
					${H(l) && H(ve) === "after" ? "border-b-2 border-brand-500" : ""}
					${H(a) ? "cursor-grab" : ""}`), ui(u, `padding-left: ${r() * 14 + 4}px`), J(u, "data-node-pk", t().pk), K(g, n);
			}, [() => String(s()) === t().pk ? "bg-brand-50 font-medium text-brand-700" : "text-ink-700", () => y(t().row)]), U("pointerdown", u, function(...e) {
				(H(a) ? (e) => Se(e, t()) : void 0)?.apply(this, e);
			}), U("click", h, () => {
				H(ye) || c()?.(t().row[H(d).effective_name]);
			}), G(e, i);
		};
		q(f, (e) => {
			H(i) && e(p);
		}), G(e, u);
	}, r = Y(t, "rows", 7), i = Y(t, "table", 7), a = Y(t, "moduleConfig", 7), o = Y(t, "editable", 7), s = Y(t, "activeRecordPk", 7), c = Y(t, "onSelectRecord", 7), l = Y(t, "onDeleteRow", 7), u = Y(t, "onRecordSaved", 7), d = /* @__PURE__ */ M(() => {
		let e = i().columns.filter((e) => e.is_primary_key);
		return e.length === 1 ? e[0] : null;
	}), f = /* @__PURE__ */ M(() => i().columns.find((e) => e.id === a().title_column_id) ?? null), p = /* @__PURE__ */ M(() => i().columns.find((e) => e.id === a().document_column_id) ?? null), m = /* @__PURE__ */ M(() => i().columns.find((e) => e.id === a().parent_column_id) ?? null), h = /* @__PURE__ */ M(() => i().columns.find((e) => e.id === a().order_column_id) ?? null), g = /* @__PURE__ */ M(() => i().columns.filter((e) => e.ui_type === "text" || e.ui_type === "long_text"));
	function v(e) {
		return H(d) ? String(e[H(d).effective_name]) : "";
	}
	function y(e) {
		return (H(f) ? Da(e, H(f)) : v(e)) || X("tablePage.wikiUntitledPage");
	}
	let b = " root";
	function x(e) {
		if (!e || !H(h)) return null;
		let t = e[H(h).effective_name];
		if (t == null || t === "") return null;
		let n = Number(t);
		return Number.isNaN(n) ? null : n;
	}
	function S(e, t) {
		let n = x(e), r = x(t);
		return n !== null && r !== null ? (n + r) / 2 : n === null ? r === null ? 0 : r - 1 : n + 1;
	}
	function C(e) {
		H(h) ? e.sort((e, t) => {
			let n = x(e.row), r = x(t.row);
			return n === null && r === null ? 0 : n === null ? 1 : r === null ? -1 : n - r;
		}) : e.sort((e, t) => y(e.row).localeCompare(y(t.row)));
	}
	let w = /* @__PURE__ */ M(() => {
		if (!H(d)) return [];
		let e = /* @__PURE__ */ new Map();
		for (let t of r()) e.set(v(t), t);
		let t = /* @__PURE__ */ new Map();
		for (let n of r()) {
			let r = H(m) ? n[H(m).effective_name] : null, i = r == null || r === "" ? null : String(r), a = i !== null && e.has(i) ? i : b, o = t.get(a);
			o ? o.push(n) : t.set(a, [n]);
		}
		function n(r, i) {
			let a = e.get(r), o = new Set(i);
			o.add(r);
			let s = t.get(r) ?? [], c = [];
			for (let e of s) {
				let t = v(e);
				i.has(t) || t === r ? c.push({
					pk: t,
					row: e,
					children: [],
					cyclic: !0
				}) : c.push(n(t, o));
			}
			return C(c), {
				pk: r,
				row: a,
				children: c,
				cyclic: !1
			};
		}
		let i = (t.get(b) ?? []).map((e) => n(v(e), /* @__PURE__ */ new Set()));
		return C(i), i;
	}), T = /* @__PURE__ */ M(() => {
		let e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
		function n(r, i) {
			for (let a of r) e.set(a.pk, a), t.set(a.pk, i), a.cyclic || n(a.children, a.pk);
		}
		return n(H(w), null), {
			nodesByPk: e,
			parentPkByPk: t
		};
	}), ee = /* @__PURE__ */ F(""), te = /* @__PURE__ */ M(() => H(ee).trim().length > 0), ne = /* @__PURE__ */ M(() => {
		let e = H(ee).trim().toLowerCase();
		if (!e) return null;
		let t = /* @__PURE__ */ new Map();
		for (let e of r()) t.set(v(e), e);
		function n(t) {
			return H(g).some((n) => String(t[n.effective_name] ?? "").toLowerCase().includes(e));
		}
		let i = /* @__PURE__ */ new Set();
		for (let e of r()) {
			if (!n(e)) continue;
			let r = v(e), a = /* @__PURE__ */ new Set();
			for (; r && !a.has(r);) {
				a.add(r), i.add(r);
				let e = t.get(r);
				if (!e || !H(m)) break;
				let n = e[H(m).effective_name];
				r = n == null || n === "" ? null : String(n);
			}
		}
		return i;
	}), re = /* @__PURE__ */ F($t(/* @__PURE__ */ new Set()));
	function ie(e) {
		H(re).has(e) ? H(re).delete(e) : H(re).add(e);
	}
	let ae = /* @__PURE__ */ M(() => !H(d) || s() == null ? null : r().find((e) => v(e) === String(s())) ?? null), oe = /* @__PURE__ */ M(() => H(ae) ? y(H(ae)) : ""), se = /* @__PURE__ */ M(() => H(ae) && H(p) ? Fc(Da(H(ae), H(p))) : ""), ce = /^#page-(.+)$/;
	function le(e) {
		let t = e.target?.closest?.("a");
		if (!t) return;
		let n = t.getAttribute("href"), r = n ? ce.exec(n) : null;
		r && (e.preventDefault(), c()?.(r[1]));
	}
	let ue = /* @__PURE__ */ F(null), E = /* @__PURE__ */ F(!1), de = /* @__PURE__ */ F(null);
	async function fe(e) {
		if (H(m)) {
			I(E, !0), I(de, null);
			try {
				let t = { [H(m).effective_name]: e };
				if (H(h)) {
					let n = e == null ? H(w) : H(T).nodesByPk.get(String(e))?.children ?? [];
					t[H(h).effective_name] = S(n[n.length - 1]?.row, void 0);
				}
				let n = await Bi(i().id, t);
				if (u()?.(), H(d)) {
					let e = n[H(d).effective_name];
					I(ue, e, !0), c()?.(e);
				}
			} catch (e) {
				I(de, e instanceof Error ? e.message : String(e), !0);
			} finally {
				I(E, !1);
			}
		}
	}
	let pe = /* @__PURE__ */ F(null);
	function me(e) {
		if (e.children.length > 0) {
			I(pe, e.pk, !0), setTimeout(() => {
				H(pe) === e.pk && I(pe, null);
			}, 4e3);
			return;
		}
		l()?.(e.row);
	}
	let he = /* @__PURE__ */ F(!0), ge = /* @__PURE__ */ F(null), _e = /* @__PURE__ */ F(null), ve = /* @__PURE__ */ F(null), ye = /* @__PURE__ */ F(!1), D = /* @__PURE__ */ F(null), be = [0, 0], O = /* @__PURE__ */ new Set();
	function xe(e, t) {
		for (let n of e.children) t.add(n.pk), n.cyclic || xe(n, t);
	}
	function Se(e, t) {
		if (H(he) || !o() || !H(h) || !H(m) || t.cyclic) return;
		I(ge, t.pk, !0), be = [e.clientX, e.clientY], I(ye, !1), I(D, null);
		let n = /* @__PURE__ */ new Set([t.pk]);
		xe(t, n), O = n, window.addEventListener("pointermove", Ce), window.addEventListener("pointerup", we);
	}
	function Ce(e) {
		if (H(ge) === null) return;
		if (!H(ye)) {
			let [t, n] = be;
			if (Math.hypot(e.clientX - t, e.clientY - n) < 4) return;
			I(ye, !0), document.body.style.cursor = "grabbing", document.body.style.userSelect = "none";
		}
		let t = document.elementFromPoint(e.clientX, e.clientY), n = t instanceof Element ? t.closest("[data-node-pk]") : null, r = n?.getAttribute("data-node-pk") ?? null;
		if (!r || O.has(r)) {
			I(_e, null), I(ve, null);
			return;
		}
		let i = n.getBoundingClientRect(), a = (e.clientY - i.top) / i.height;
		I(_e, r, !0), I(ve, a < .25 ? "before" : a > .75 ? "after" : "into", !0);
	}
	async function we() {
		if (window.removeEventListener("pointermove", Ce), window.removeEventListener("pointerup", we), document.body.style.cursor = "", document.body.style.userSelect = "", H(ye) && H(ge) !== null && H(_e) !== null && H(ve) !== null && H(m) && H(h)) {
			let e = H(ge), t = H(T).nodesByPk.get(H(_e));
			if (t) {
				let n, r, a;
				if (H(ve) === "into") n = t.pk, r = t.children.filter((t) => t.pk !== e), a = r.length;
				else {
					n = H(T).parentPkByPk.get(t.pk) ?? null, r = (n === null ? H(w) : H(T).nodesByPk.get(n)?.children ?? []).filter((t) => t.pk !== e);
					let i = r.findIndex((e) => e.pk === t.pk);
					a = H(ve) === "after" ? i + 1 : i;
				}
				let o = S(r[a - 1]?.row, r[a]?.row), s = n === null ? null : H(T).nodesByPk.get(n)?.row[H(d).effective_name] ?? n;
				try {
					await Vi(i().id, e, {
						[H(m).effective_name]: s,
						[H(h).effective_name]: o
					}), u()?.();
				} catch (e) {
					I(D, e instanceof Error ? e.message : String(e), !0);
				}
			}
		}
		I(ge, null), I(_e, null), I(ve, null), O = /* @__PURE__ */ new Set();
	}
	Vr(we);
	var Te = {
		get rows() {
			return r();
		},
		set rows(e) {
			r(e), P();
		},
		get table() {
			return i();
		},
		set table(e) {
			i(e), P();
		},
		get moduleConfig() {
			return a();
		},
		set moduleConfig(e) {
			a(e), P();
		},
		get editable() {
			return o();
		},
		set editable(e) {
			o(e), P();
		},
		get activeRecordPk() {
			return s();
		},
		set activeRecordPk(e) {
			s(e), P();
		},
		get onSelectRecord() {
			return c();
		},
		set onSelectRecord(e) {
			c(e), P();
		},
		get onDeleteRow() {
			return l();
		},
		set onDeleteRow(e) {
			l(e), P();
		},
		get onRecordSaved() {
			return u();
		},
		set onRecordSaved(e) {
			u(e), P();
		}
	}, Ee = Su(), De = ln(Ee), Oe = L(De), ke = L(Oe), Ae = L(ke);
	hi(Ae), j(ke);
	var je = R(ke, 2), k = (e) => {
		var t = hu(), n = ln(t), r = L(n), i = L(r, !0);
		j(r), j(n);
		var a = R(n, 2), o = (e) => {
			var t = mu(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("tablePage.wikiMoveFailed", { error: H(D) })]), G(e, t);
		};
		q(a, (e) => {
			H(D) && e(o);
		}), z((e) => K(i, e), [() => H(he) ? X("tablePage.wikiUnlockTree") : X("tablePage.wikiLockTree")]), U("click", r, () => I(he, !H(he))), G(e, t);
	};
	q(je, (e) => {
		H(h) && o() && e(k);
	});
	var Me = R(je, 2), A = L(Me), Ne = (e) => {
		var t = gu(), n = L(t, !0);
		j(t), z((e) => K(n, e), [() => H(te) ? X("tablePage.wikiNoSearchResults") : X("tablePage.wikiEmptyTree")]), G(e, t);
	}, Pe = (e) => {
		var t = Ar();
		Gr(ln(t), 17, () => H(w), (e) => e.pk, (e, t) => {
			n(e, () => H(t), () => 0);
		}), G(e, t);
	};
	q(A, (e) => {
		H(w).length === 0 ? e(Ne) : e(Pe, -1);
	}), j(Me), $r(Me, (e) => Ic?.(e));
	var Fe = R(Me, 2), Ie = (e) => {
		var t = vu(), n = L(t), r = L(n, !0);
		j(n);
		var i = R(n, 2), a = (e) => {
			var t = _u(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("tablePage.wikiCreatePageFailed", { error: H(de) })]), G(e, t);
		};
		q(i, (e) => {
			H(de) && e(a);
		}), j(t), z((e) => {
			n.disabled = H(E), K(r, e);
		}, [() => X("tablePage.wikiNewRootPage")]), U("click", n, () => fe(null)), G(e, t);
	};
	q(Fe, (e) => {
		o() && e(Ie);
	}), j(Oe);
	var Le = R(Oe, 2), Re = L(Le), ze = (e) => {
		var t = yu(), n = L(t, !0);
		j(t), z((e) => K(n, e), [() => X("tablePage.wikiNoPageSelected")]), G(e, t);
	}, Be = (e) => {
		var t = xu(), n = ln(t), r = L(n), i = L(r, !0);
		j(r);
		var a = R(r, 2), s = (e) => {
			var t = bu(), n = L(t, !0);
			j(t), z((e) => K(n, e), [() => X("tablePage.wikiEditPage")]), U("click", t, () => I(ue, H(d) ? H(ae)[H(d).effective_name] : null, !0)), G(e, t);
		};
		q(a, (e) => {
			o() && e(s);
		}), j(n);
		var c = R(n, 2), l = L(c);
		Zr(l, () => H(se), !0), j(l), j(c), $r(c, (e) => Ic?.(e)), z(() => K(i, H(oe))), U("click", l, le), G(e, t);
	};
	q(Re, (e) => {
		H(ae) ? e(Be, -1) : e(ze);
	}), j(Le), j(De);
	var Ve = R(De, 2), He = (e) => {
		su(e, {
			get tableId() {
				return i().id;
			},
			get pk() {
				return H(ue);
			},
			onClose: () => I(ue, null),
			onSaved: () => {
				I(ue, null), u()?.();
			}
		});
	};
	return q(Ve, (e) => {
		H(ue) != null && e(He);
	}), z((e) => J(Ae, "placeholder", e), [() => X("tablePage.wikiSearchPlaceholder")]), xi(Ae, () => H(ee), (e) => I(ee, e)), G(e, Ee), We(Te);
}
br(["pointerdown", "click"]), customElements.define("wiki-view", ji(Cu, {
	rows: {},
	table: {},
	moduleConfig: {},
	editable: {},
	activeRecordPk: {},
	onSelectRecord: {},
	onDeleteRow: {},
	onRecordSaved: {}
}, [], []));
//#endregion
export { Cu as default };
