@popcorn245/cornfield-components 0.52.0 → 0.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/around-BcnegEdS.js +99 -0
  3. package/dist/chunks/connection-KDiWvV19.js +23 -0
  4. package/dist/chunks/{engine-HIgX35hE.js → engine-xmHJvQY9.js} +1360 -1343
  5. package/dist/chunks/{layers-n1mJVJs8.js → layers-ho10a2y7.js} +68 -68
  6. package/dist/chunks/{map-CeP9M2_w.js → map-DbfPgQRe.js} +736 -705
  7. package/dist/chunks/node-panel-CC8UrSzJ.js +410 -0
  8. package/dist/chunks/panel-review-ih7RlfkH.js +884 -0
  9. package/dist/chunks/review-pieces-DtRxCDMr.js +2523 -0
  10. package/dist/chunks/{review-source-DWisOXyR.js → review-source-CmbwaPCM.js} +1 -1
  11. package/dist/chunks/scope-2m2VmJXn.js +185 -0
  12. package/dist/chunks/scope-proposal-T06ndbin.js +116 -0
  13. package/dist/chunks/sheets-BWANwtZP.js +209 -0
  14. package/dist/chunks/source-address-DXanAREm.js +57 -0
  15. package/dist/chunks/{status-CsFpnQxw.js → status-DM-iIEsg.js} +57 -56
  16. package/dist/corn-changes.js +43 -0
  17. package/dist/corn-decision.js +52 -0
  18. package/dist/corn-layers.js +275 -1
  19. package/dist/corn-map.js +125 -1
  20. package/dist/corn-node-panel.js +42 -1
  21. package/dist/corn-proposal.js +50 -0
  22. package/dist/corn-review.js +425 -1
  23. package/dist/corn-scope.js +33 -9
  24. package/dist/corn-search.js +484 -1
  25. package/dist/index.js +11 -8
  26. package/dist/manifest.json +95 -70
  27. package/dist/tokens.css +6 -0
  28. package/dist/types/components.d.ts +111 -5
  29. package/dist/types/corn-changes.d.ts +2 -0
  30. package/dist/types/corn-decision.d.ts +2 -0
  31. package/dist/types/corn-proposal.d.ts +2 -0
  32. package/dist/types/index.d.ts +3 -0
  33. package/dist/version.json +1 -1
  34. package/package.json +17 -5
  35. package/dist/chunks/around-D7aqHejs.js +0 -78
  36. package/dist/chunks/corn-layers-g9AprK6G.js +0 -275
  37. package/dist/chunks/corn-map-DE-pg-A0.js +0 -125
  38. package/dist/chunks/corn-node-panel-CdtFb9IZ.js +0 -42
  39. package/dist/chunks/corn-review-9krtLSPK.js +0 -2900
  40. package/dist/chunks/corn-search-BY1Po63S.js +0 -484
  41. package/dist/chunks/node-panel-CY5xnuKC.js +0 -1291
  42. package/dist/chunks/scope-CUhp8mkf.js +0 -137
  43. package/dist/chunks/sheets-TFCL_dIn.js +0 -204
  44. package/dist/chunks/source-address-C70zNPIj.js +0 -79
@@ -1,4 +1,4 @@
1
- import { n as e, t } from "./status-CsFpnQxw.js";
1
+ import { n as e, t } from "./status-DM-iIEsg.js";
2
2
  // ../explorer/pieces/review-source.js
3
3
  function n(n, r) {
4
4
  let { root: i, stage: a, parsed: o } = r, s = i.nodeType === 11 ? i.host : i, c = !!r.useTheme, l = r.theme, u = !1, d = !1, f = e(n, {
@@ -0,0 +1,185 @@
1
+ import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
+ import { Bt as t, Gt as n, Ht as r, Mn as i, Vt as a } from "./engine-xmHJvQY9.js";
3
+ import { n as o, t as s } from "./status-DM-iIEsg.js";
4
+ import { n as c, r as l } from "./source-address-DXanAREm.js";
5
+ import { o as u } from "./layers-ho10a2y7.js";
6
+ // ../explorer/pieces/scope.js
7
+ var d = /* @__PURE__ */ e({ mountScope: () => p }), f = [
8
+ "light",
9
+ "dark",
10
+ "auto"
11
+ ];
12
+ function p(e, d = {}) {
13
+ let p = {
14
+ src: d.src,
15
+ theme: d.theme,
16
+ useTheme: !!d.useTheme,
17
+ topology: d.topology,
18
+ config: d.config,
19
+ strings: d.strings,
20
+ proposal: d.proposal ?? null,
21
+ source: d.source ?? null,
22
+ view: d.view ?? null
23
+ }, h = d.pageUrl || (() => ""), g = /* @__PURE__ */ new Set(), _ = null, v = null, y = null, b = !1, x = !1, S = null, C = !1, w = (e) => {
24
+ if (x || !_ || !e.detail || typeof e.detail.claim != "function") return;
25
+ e.stopPropagation();
26
+ let t = {
27
+ el: e.detail.el,
28
+ inst: _,
29
+ scope: M,
30
+ release: () => g.delete(t)
31
+ };
32
+ g.add(t), e.detail.claim(t);
33
+ };
34
+ e.addEventListener(a, w);
35
+ function T() {
36
+ let n = new Set(m(e));
37
+ for (let e of [...g]) g.delete(e), e.el && n.add(e.el);
38
+ for (let e of n) e.isConnected !== !1 && e.dispatchEvent(new Event(t));
39
+ }
40
+ function E() {
41
+ y && y.follow();
42
+ }
43
+ function D() {
44
+ let n = p.src === void 0 || p.src === null || p.src === "" ? null : c(p.src);
45
+ _ = i({
46
+ root: e,
47
+ base: n && n.ok ? n.base : ""
48
+ }), u(_, null);
49
+ let a = r(_);
50
+ a.host = e, a.theme = f.includes(p.theme) ? p.theme : "auto";
51
+ let m = _, g = o(_, {
52
+ host: e,
53
+ tokens: d.tokens,
54
+ version: d.version,
55
+ pageUrl: h,
56
+ theme: () => f.includes(p.theme) ? p.theme : "auto",
57
+ useTheme: () => p.useTheme,
58
+ onReady: () => {
59
+ !b && _ === m && (b = !0, d.onReady && d.onReady());
60
+ },
61
+ onAuth: (e) => {
62
+ d.onAuth && d.onAuth(e);
63
+ },
64
+ onError: (e) => {
65
+ d.onError && d.onError(e);
66
+ },
67
+ onMode: () => m.emit("scope:theme")
68
+ });
69
+ y = g, a.serverTheme = g.theme, _.own(() => g.destroy()), v = g.source, a.source = v, a.mountStatus = s, a.signIn = () => m.base ? l(m.base, h()) : "", b = !1;
70
+ let w = [];
71
+ _.on("piece:refused", (e) => {
72
+ e.host && !w.includes(e.host) && w.push(e.host), d.onError && d.onError({
73
+ kind: e.reason,
74
+ message: e.message
75
+ });
76
+ }), _.on("attach:released", () => {
77
+ Promise.resolve().then(() => {
78
+ if (!(x || _ !== m)) for (; w.length;) {
79
+ let e = w.shift();
80
+ if (e.isConnected) {
81
+ e.dispatchEvent(new Event(t));
82
+ return;
83
+ }
84
+ }
85
+ });
86
+ }), n && !n.ok && v.say({
87
+ state: "address",
88
+ problem: n.problem
89
+ }), v.provide({
90
+ topology: p.topology || void 0,
91
+ config: p.config || void 0,
92
+ strings: p.strings || void 0
93
+ }), n && n.ok && v.load(), S = null, C = !1, A();
94
+ }
95
+ let O = null;
96
+ function k(e) {
97
+ O ? Object.assign(O, e) : (O = { ...e }, queueMicrotask(() => {
98
+ let e = O;
99
+ O = null, x || (S ? S.update(e) : A());
100
+ }));
101
+ }
102
+ function A() {
103
+ if (x || S || C || p.proposal === null || p.proposal === void 0 || p.proposal === "") return;
104
+ C = !0;
105
+ let e = _, t = p.src !== void 0 && p.src !== null && p.src !== "" && !c(p.src).ok;
106
+ import("./scope-proposal-T06ndbin.js").then(({ holdProposal: n }) => {
107
+ C = !1, x || _ !== e || S || (S = n(e, {
108
+ proposal: p.proposal,
109
+ source: p.source,
110
+ view: p.view,
111
+ blocked: t,
112
+ pageUrl: h,
113
+ onNavigate: (e) => {
114
+ d.onNavigate && d.onNavigate(e);
115
+ },
116
+ onDecision: (e) => {
117
+ d.onDecision && d.onDecision(e);
118
+ },
119
+ onAuth: (e) => {
120
+ d.onAuth && d.onAuth(e);
121
+ },
122
+ onError: (e) => {
123
+ d.onError && d.onError(e);
124
+ }
125
+ }));
126
+ }, (e) => {
127
+ C = !1, !x && d.onError && d.onError({
128
+ kind: "offline",
129
+ message: `the scope's proposal loader did not load: ${e && e.message ? e.message : e}`
130
+ });
131
+ });
132
+ }
133
+ function j() {
134
+ T(), _ && _.destroy(), _ = null, v = null, y = null;
135
+ }
136
+ let M = {
137
+ update(e = {}) {
138
+ if (x) return;
139
+ let t = !1;
140
+ if ("src" in e && e.src !== p.src && (p.src = e.src, t = !0), "theme" in e && e.theme !== p.theme && (p.theme = e.theme, r(_).theme = f.includes(p.theme) ? p.theme : "auto", E()), "useTheme" in e && !!e.useTheme !== p.useTheme && (p.useTheme = !!e.useTheme, y.setUseTheme(p.useTheme)), t) {
141
+ let e = _;
142
+ y.destroy(), D(), T(), e.destroy();
143
+ return;
144
+ }
145
+ let n = {};
146
+ for (let t of [
147
+ "topology",
148
+ "config",
149
+ "strings"
150
+ ]) t in e && e[t] !== p[t] && (p[t] = e[t], n[t] = e[t] === void 0 ? null : e[t]);
151
+ Object.keys(n).length && v.provide(n);
152
+ let i = {};
153
+ for (let t of [
154
+ "proposal",
155
+ "source",
156
+ "view"
157
+ ]) t in e && (e[t] ?? null) !== p[t] && (p[t] = e[t] ?? null, i[t] = p[t]);
158
+ Object.keys(i).length && k(i);
159
+ },
160
+ destroy() {
161
+ x || (e.removeEventListener(a, w), j(), x = !0, g.clear());
162
+ },
163
+ get instance() {
164
+ return _;
165
+ },
166
+ get source() {
167
+ return v;
168
+ }
169
+ };
170
+ return d.tokens && n(e.getRootNode(), d.tokens), D(), T(), M;
171
+ }
172
+ function m(e) {
173
+ let t = [], n = (e) => {
174
+ for (let r of e.children || []) {
175
+ let e = r.localName || "";
176
+ if (e.startsWith("corn-")) {
177
+ if (e === "corn-scope") continue;
178
+ t.push(r);
179
+ }
180
+ r.shadowRoot && n(r.shadowRoot), n(r);
181
+ }
182
+ };
183
+ return n(e), t;
184
+ }
185
+ export { d as n, p as t };
@@ -0,0 +1,116 @@
1
+ import { c as e, d as t, f as n, l as r, m as i, p as a, u as o } from "./review-pieces-DtRxCDMr.js";
2
+ import { Dn as s } from "./engine-xmHJvQY9.js";
3
+ import { r as c } from "./source-address-DXanAREm.js";
4
+ import { _ as l, w as u, x as d } from "./panel-review-ih7RlfkH.js";
5
+ // ../explorer/pieces/scope-proposal.js
6
+ function f(f, p = {}) {
7
+ let { state: m } = f, h = s(f), g = !1, _ = {
8
+ proposal: null,
9
+ source: null,
10
+ view: null,
11
+ shown: null
12
+ }, v = () => !!f.map && m.nodes.length > 0, y = !!p.blocked, b = () => !f.base;
13
+ function x() {
14
+ if (g) return;
15
+ let e = _.proposal;
16
+ if (e == null || e === "") {
17
+ _.shown = null, m.proposal && f.map && r(f);
18
+ return;
19
+ }
20
+ if (!v()) return;
21
+ let t = _.view;
22
+ if (typeof e == "string" && y) return;
23
+ if (typeof e == "string" && b()) {
24
+ let t = `${e}\u0000${_.source || ""}`;
25
+ if (_.shown === t) return;
26
+ _.shown = t;
27
+ let r = d(e) ? `${e} cannot be opened here: there is no cornfield server to read it from (the scope has no src).` : u(e);
28
+ n(f, r, !0, []), f.emit("proposal:failed", {
29
+ slug: e,
30
+ source: _.source,
31
+ status: 0,
32
+ notFound: !1,
33
+ message: r
34
+ });
35
+ return;
36
+ }
37
+ if (typeof e == "string") {
38
+ if (m.proposal && m.proposalSlug === e && (!_.source || _.source === m.proposalSource)) {
39
+ _.shown = `${e}\u0000${_.source || ""}`, l.includes(t) && m.proposalView !== t && a(f, t, { quiet: !0 });
40
+ return;
41
+ }
42
+ let n = `${e}\u0000${_.source || ""}`;
43
+ return _.shown === n ? void 0 : (_.shown = n, o(f, e, _.source).then((e) => (e && !g && _.shown === n && l.includes(t) && m.proposalView !== t && a(f, t, { quiet: !0 }), e)));
44
+ }
45
+ if (_.shown === e && m.proposal) return;
46
+ _.shown = e;
47
+ let s = _.source || null;
48
+ i(f, e, {
49
+ slug: null,
50
+ source: s,
51
+ pinSource: !!s,
52
+ view: l.includes(t) ? t : "diff",
53
+ sha256: null
54
+ });
55
+ }
56
+ h.on("proposal:specs-list", () => !1);
57
+ let S = () => {}, C = () => {
58
+ S(), S = f.map && m.canvas ? e(f, (e, t, n) => h.listen(e, t, n)) : () => {};
59
+ };
60
+ h.own(() => S()), h.on("map:ready", () => {
61
+ C(), x();
62
+ }), h.on("map:canvas", C), h.on("map:gone", () => {
63
+ S(), S = () => {};
64
+ }), h.on("map:topology", () => {
65
+ m.proposal && f.map && t(f, void 0, { fit: !0 }), x();
66
+ }), h.on("proposal", ({ change: e, slug: t, source: n, pinSource: r, view: i }) => {
67
+ e === "closed" ? (_.proposal = null, _.shown = null) : e === "opened" && t && (_.proposal = t, r && (_.source = n), _.shown = `${t}\u0000${_.source || ""}`), i && (_.view = i), p.onNavigate && p.onNavigate({
68
+ proposal: t,
69
+ source: r ? n : null,
70
+ view: e === "closed" ? null : i,
71
+ change: e
72
+ });
73
+ });
74
+ let w = () => f.base ? c(f.base, typeof p.pageUrl == "function" ? p.pageUrl() : "") : "", T = "";
75
+ h.on("auth", ({ status: e, during: t }) => {
76
+ if (t === "facts") {
77
+ if (T === `${e}`) return;
78
+ T = `${e}`;
79
+ } else T = "";
80
+ p.onAuth && p.onAuth({
81
+ status: e,
82
+ signIn: w(),
83
+ during: t
84
+ });
85
+ }), h.on("decision", ({ outcome: e, review: t, slug: n, source: r, open: i }) => {
86
+ T = "", p.onDecision && p.onDecision({
87
+ outcome: e,
88
+ proposal: n,
89
+ source: r,
90
+ open: i,
91
+ review: t
92
+ });
93
+ }), h.on("proposal:failed", ({ message: e }) => {
94
+ p.onError && p.onError({
95
+ kind: "proposal",
96
+ message: e
97
+ });
98
+ });
99
+ let E = {
100
+ update(e = {}) {
101
+ if (g) return;
102
+ let t = !1;
103
+ return "source" in e && (e.source || null) !== _.source && (_.source = e.source || null, t = !0), "proposal" in e && (e.proposal ?? null) !== _.proposal && (_.proposal = e.proposal ?? null, _.shown = null, t = !0), "view" in e && l.includes(e.view) && e.view !== _.view && (_.view = e.view, m.proposal && !t && a(f, e.view, { quiet: !0 })), t ? x() : void 0;
104
+ },
105
+ sync: x,
106
+ destroy() {
107
+ g || (g = !0, h.destroy());
108
+ }
109
+ };
110
+ return E.update({
111
+ proposal: p.proposal,
112
+ source: p.source,
113
+ view: p.view
114
+ }), C(), x(), E;
115
+ }
116
+ export { f as holdProposal };
@@ -0,0 +1,209 @@
1
+ import { dn as e, fn as t, gn as n, mn as r, pn as i, un as a } from "./engine-xmHJvQY9.js";
2
+ // ../explorer/engine/sheets.js
3
+ var o = 20;
4
+ function s(e, t) {
5
+ i(e).box = t || null;
6
+ }
7
+ function c(t, n) {
8
+ let { box: r } = i(t), o = t.win && t.win.ResizeObserver;
9
+ if (r && typeof o == "function") {
10
+ let i = e(t), a = new o(() => {
11
+ let r = e(t);
12
+ r !== i && (i = r, n());
13
+ });
14
+ a.observe(r);
15
+ let s = () => {
16
+ a.disconnect(), t.release(s);
17
+ };
18
+ return t.own(s), s;
19
+ }
20
+ if (t.win && typeof t.win.matchMedia == "function") {
21
+ let e = t.win.matchMedia(a);
22
+ if (e && e.addEventListener) return t.listen(e, "change", () => n());
23
+ }
24
+ return () => {};
25
+ }
26
+ function l(e, t) {
27
+ let n = i(e);
28
+ return n.listeners.add(t), () => n.listeners.delete(t);
29
+ }
30
+ function u(a) {
31
+ let o = i(a), { model: s } = o;
32
+ f(a);
33
+ for (let [e, t] of o.elements) {
34
+ let n = s.isExpanded(e), r = s.stateOf(e);
35
+ t.dataset.sheetState = r === "hidden" ? "peek" : r;
36
+ let i = [...t.children].find((e) => e.classList.contains("hx-sheet-handle"));
37
+ i && (i.setAttribute("aria-expanded", String(n)), i.setAttribute("aria-label", n ? "Collapse this panel" : "Expand this panel")), m(a, e, t, r === "stub");
38
+ }
39
+ let c = r(a, o);
40
+ c && (c.dataset.sheetOpen = s.expanded() || ""), o.dock && e(a) && o.dock.style.setProperty("--hx-sheet-cap", `${n((o.box ? o.box.clientHeight : a.win.innerHeight) || 0, s.stubs())}px`), g(a), t(a), o.listeners.forEach((e) => e());
41
+ }
42
+ function d(e, t) {
43
+ return e === "forge" ? t.classList.contains("forge-open") : e === "drawer" ? t.classList.contains("drawer-open") : !t.hidden && t.isConnected;
44
+ }
45
+ function f(t) {
46
+ let n = i(t), { model: r } = n;
47
+ if (e(t)) {
48
+ for (let [e, i] of n.elements) {
49
+ let a = d(e, i) && !n.away.has(e);
50
+ if (!a && !d(e, i) && n.away.delete(e), a && !r.isShown(e)) for (let n of r.show(e)) p(t, n);
51
+ else !a && r.isShown(e) && r.hide(e);
52
+ }
53
+ for (let [e, t] of n.elements) {
54
+ let r = n.away.has(e), i = t.hasAttribute("data-sheet-away");
55
+ t.toggleAttribute("data-sheet-away", r), r && !t.inert ? t.inert = !0 : !r && i && d(e, t) && (t.inert = !1);
56
+ }
57
+ } else {
58
+ n.away.clear();
59
+ for (let e of n.elements.values()) e.removeAttribute("data-sheet-away");
60
+ }
61
+ }
62
+ function p(e, t) {
63
+ let n = i(e);
64
+ if (!n.elements.get(t)) return;
65
+ n.away.add(t);
66
+ let r = n.options.get(t);
67
+ r && r.away && r.away();
68
+ }
69
+ function m(t, n, r, a) {
70
+ let o = i(t), s = [...r.children].find((e) => e.classList.contains("hx-sheet-stub"));
71
+ if (!s) {
72
+ if (!a) return;
73
+ s = t.doc.createElement("button"), s.type = "button", s.className = "hx-sheet-stub", s.dataset.corn = "sheet-stub", s.setAttribute("part", "sheet-stub"), s.addEventListener("click", (i) => {
74
+ i.stopPropagation(), i.preventDefault(), y(t, n);
75
+ let a = [...r.children].find((e) => e.classList.contains("hx-sheet-handle"));
76
+ a && e(t) && a.focus();
77
+ }), r.append(s);
78
+ }
79
+ if (s.hidden = !a, !a) return;
80
+ let c = o.options.get(n), l = (c && c.stub ? c.stub() : null) || { title: r.getAttribute("aria-label") || n }, u = String(l.title || ""), d = l.badge ? String(l.badge) : "", f = `${u}\u0000${d}\u0000${l.label || ""}`;
81
+ if (s.dataset.key === f) return;
82
+ s.dataset.key = f, s.replaceChildren();
83
+ let p = t.doc.createElement("span");
84
+ if (p.className = "hx-sheet-stub-title", p.textContent = u, s.append(p), d) {
85
+ let e = t.doc.createElement("span");
86
+ e.className = "hx-waiting-badge", e.dataset.corn = "waiting-badge", e.setAttribute("part", "waiting-badge"), e.setAttribute("aria-hidden", "true"), e.textContent = d, s.append(e);
87
+ }
88
+ s.setAttribute("aria-label", l.label || (d ? `${u}, ${d}` : u));
89
+ }
90
+ function h(e, t) {
91
+ let n = i(e);
92
+ n.elements.has(t) && (n.away.delete(t), u(e));
93
+ }
94
+ function g(e) {
95
+ let { dock: t } = i(e);
96
+ if (!t) return;
97
+ let n = null;
98
+ for (let e of t.children) {
99
+ e.removeAttribute("data-sheet-last");
100
+ let t = e.classList.contains("hx-drawer") && !e.classList.contains("drawer-open") || e.classList.contains("hx-forge") && !e.classList.contains("forge-open");
101
+ !e.hidden && !t && (n = e);
102
+ }
103
+ n && n.setAttribute("data-sheet-last", "");
104
+ }
105
+ function _(e, t, n, r = {}) {
106
+ if (!n) return;
107
+ let a = i(e);
108
+ v(e, t, !1), a.model.add(t), a.elements.set(t, n), a.options.set(t, r), n.classList.add("hx-sheet");
109
+ let o = [...n.children].find((e) => e.classList.contains("hx-sheet-handle"));
110
+ o || (o = e.doc.createElement("button"), o.type = "button", o.className = "hx-sheet-handle", o.dataset.corn = "sheet-handle", o.setAttribute("part", "sheet-handle"), o.innerHTML = "<span data-corn=\"sheet-grip\" part=\"sheet-grip\"></span>", n.prepend(o)), a.offs.set(t, [...C(e, t, o), e.listen(n, "click", (n) => w(e, t, n), !0)]), u(e);
111
+ }
112
+ function v(e, t, n = !0) {
113
+ let r = i(e);
114
+ r.model.has(t) && ((r.offs.get(t) || []).forEach((e) => e()), r.offs.delete(t), r.model.remove(t), r.elements.delete(t), r.options.delete(t), r.away.delete(t), n && u(e));
115
+ }
116
+ function y(e, t) {
117
+ f(e), i(e).model.expand(t) && u(e);
118
+ }
119
+ function b(e, t) {
120
+ i(e).model.collapse(t) && u(e);
121
+ }
122
+ function x(e) {
123
+ i(e).model.collapseAll() && u(e);
124
+ }
125
+ function S(e, t) {
126
+ f(e), i(e).model.toggle(t) && u(e);
127
+ }
128
+ function C(e, t, n) {
129
+ let r = null, i = !1, a = [];
130
+ return a.push(e.listen(n, "pointerdown", (e) => {
131
+ if (r = e.clientY, i = !1, n.setPointerCapture && e.pointerId !== void 0) try {
132
+ n.setPointerCapture(e.pointerId);
133
+ } catch {}
134
+ })), a.push(e.listen(n, "pointerup", (n) => {
135
+ if (r === null) return;
136
+ let a = n.clientY - r;
137
+ r = null, Math.abs(a) < o || (i = !0, a < 0 ? y(e, t) : b(e, t));
138
+ })), a.push(e.listen(n, "pointercancel", () => {
139
+ r = null;
140
+ })), a.push(e.listen(n, "click", (n) => {
141
+ n.stopPropagation(), i ? i = !1 : S(e, t);
142
+ })), a;
143
+ }
144
+ function w(t, n, r) {
145
+ if (!e(t) || i(t).model.isExpanded(n)) return;
146
+ let a = r.target;
147
+ if (a.closest && a.closest(".hx-sheet-handle, .hx-sheet-stub") || a.closest && a.closest("select, input, textarea, [data-peek-ok]")) return;
148
+ let o = a.closest && a.closest("[data-action]");
149
+ o && /close/.test(o.dataset.action) || (r.preventDefault(), r.stopPropagation(), y(t, n));
150
+ }
151
+ function T(t, n) {
152
+ n.target === t.state.canvas && e(t) && x(t);
153
+ }
154
+ function E(t, n) {
155
+ if (n.key !== "Escape" || n.defaultPrevented || !e(t)) return;
156
+ let r = i(t), a = r.model.expanded(), o = a && r.elements.get(a);
157
+ if (!o || !o.contains(n.target) || n.target.closest && n.target.closest("select, input, textarea")) return;
158
+ n.preventDefault(), n.stopPropagation(), b(t, a);
159
+ let s = [...o.children].find((e) => e.classList.contains("hx-sheet-handle"));
160
+ s && s.focus();
161
+ }
162
+ function D(t, n) {
163
+ e(t) && (n.stopPropagation(), x(t));
164
+ }
165
+ function O(e) {
166
+ let n = i(e), r = e.el("sheet-dock");
167
+ if (r) {
168
+ if (r !== n.dock && (n.observers.forEach((e) => e.disconnect()), n.observers = [], n.model.ids().forEach((e) => n.model.remove(e)), n.elements.clear(), n.options.clear(), n.away.clear(), n.lastCovered = 0, n.dock = r), n.wiredDock !== n.dock) {
169
+ n.wiredDock = n.dock;
170
+ let r = e.win;
171
+ if (r && typeof r.MutationObserver == "function") {
172
+ let i = new r.MutationObserver(() => {
173
+ g(e), t(e);
174
+ });
175
+ i.observe(n.dock, {
176
+ childList: !0,
177
+ subtree: !0,
178
+ attributes: !0,
179
+ attributeFilter: ["hidden", "class"]
180
+ }), n.observers.push(i), e.own(() => i.disconnect());
181
+ }
182
+ if (r && typeof r.ResizeObserver == "function") {
183
+ let i = new r.ResizeObserver(() => t(e));
184
+ i.observe(n.dock), n.observers.push(i), e.own(() => i.disconnect());
185
+ }
186
+ }
187
+ if (!n.documentWired) {
188
+ n.documentWired = !0, e.on("player:seat", (e) => {
189
+ let t = n.dock;
190
+ if (!t || !t.isConnected) return;
191
+ let r = [...t.children].find((e) => e.classList.contains("hx-drawer"));
192
+ return r ? t.insertBefore(e, r) : t.appendChild(e), !0;
193
+ });
194
+ for (let t of [
195
+ "pointerdown",
196
+ "touchstart",
197
+ "mousedown"
198
+ ]) e.listen(e.root, t, (t) => T(e, t), {
199
+ passive: !0,
200
+ capture: !0
201
+ });
202
+ e.listen(e.root, "keydown", (t) => E(e, t), !0), c(e, () => {
203
+ x(e), t(e);
204
+ });
205
+ }
206
+ u(e);
207
+ }
208
+ }
209
+ export { D as a, _ as c, v as d, O as i, s as l, b as n, l as o, y as r, c as s, x as t, h as u };
@@ -0,0 +1,57 @@
1
+ // ../explorer/engine/source-address.js
2
+ var e = /[\u0000- \u007f\\]/;
3
+ function t(t) {
4
+ if (typeof t != "string" || !t.trim()) return {
5
+ ok: !1,
6
+ problem: "is empty"
7
+ };
8
+ let n = t.trim();
9
+ if (e.test(n)) return {
10
+ ok: !1,
11
+ problem: "has a space, a control character or a backslash"
12
+ };
13
+ let r;
14
+ try {
15
+ r = new URL(n);
16
+ } catch {
17
+ return {
18
+ ok: !1,
19
+ problem: "is not an address (an http or https address, as the server is opened in a browser)"
20
+ };
21
+ }
22
+ return r.protocol !== "https:" && r.protocol !== "http:" ? {
23
+ ok: !1,
24
+ problem: "is not http or https"
25
+ } : /^https?:\/\/[^/?#]/i.test(n) ? r.username || r.password ? {
26
+ ok: !1,
27
+ problem: "has a user name or password"
28
+ } : n.includes("?") || n.includes("#") ? {
29
+ ok: !1,
30
+ problem: "has a query or a fragment"
31
+ } : {
32
+ ok: !0,
33
+ base: r.origin + r.pathname.replace(/\/+$/, ""),
34
+ origin: r.origin
35
+ } : {
36
+ ok: !1,
37
+ problem: "has no host"
38
+ };
39
+ }
40
+ function n(e, t) {
41
+ let n = "";
42
+ if (typeof t == "string" && /^https?:\/\//i.test(t)) try {
43
+ let e = new URL(t);
44
+ e.username = "", e.password = "", n = `?returnTo=${encodeURIComponent(e.href)}`;
45
+ } catch {
46
+ n = "";
47
+ }
48
+ return `${e}/auth/start${n}`;
49
+ }
50
+ function r(e) {
51
+ try {
52
+ return /^https?:/i.test(e) ? new URL(e).origin : "";
53
+ } catch {
54
+ return "";
55
+ }
56
+ }
57
+ export { t as n, n as r, r as t };