@floegence/floe-webapp-core 0.86.49 → 0.86.51

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.
@@ -1,5 +1,7 @@
1
1
  function X(k) {
2
- let L = 0, b = [], C = 0, I = !1, l = [], p = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), R = 1, o = 0, g, O, S = !1, M = 0, W = 0;
2
+ let L = 0, b = [], C = 0, I = !1;
3
+ const a = [];
4
+ let d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), R = 1, o = 0, g, O, S = !1, M = 0, W = 0;
3
5
  const m = /* @__PURE__ */ new Map();
4
6
  function U(e) {
5
7
  let t = 0, n = b.length;
@@ -8,7 +10,7 @@ function X(k) {
8
10
  b[s].start <= e ? t = s + 1 : n = s;
9
11
  }
10
12
  const i = Math.max(0, t - 1);
11
- return b.slice(i).map((s, a) => a === 0 ? s.text.slice(e - s.start) : s.text).join("");
13
+ return b.slice(i).map((s, l) => l === 0 ? s.text.slice(e - s.start) : s.text).join("");
12
14
  }
13
15
  function F(e, t) {
14
16
  W += e.length;
@@ -16,7 +18,7 @@ function X(k) {
16
18
  return n.tokens.links = { ...t }, n.lex(e);
17
19
  }
18
20
  function w(e) {
19
- return { changes: e, links: p, sourceLength: C };
21
+ return { changes: e, links: d, sourceLength: C };
20
22
  }
21
23
  function $(e) {
22
24
  return { id: e.id, start: e.start, token: structuredClone(e.token) };
@@ -51,8 +53,8 @@ function X(k) {
51
53
  if (n.length < t.inline.length) return !0;
52
54
  const i = new k.Lexer({ ...k.defaults });
53
55
  return n.some((s) => {
54
- const a = s.call({ lexer: i }, e);
55
- return typeof a == "number" && a >= 0;
56
+ const l = s.call({ lexer: i }, e);
57
+ return typeof l == "number" && l >= 0;
56
58
  });
57
59
  }
58
60
  function _(e, t = 0) {
@@ -67,11 +69,11 @@ function X(k) {
67
69
  }
68
70
  let s = i >= 0 ? i : Math.max(t, n.length - 1);
69
71
  s > t && n[s]?.type === "text" && !/\s/u.test(n[s].raw) && n[s - 1]?.type === "link" && s--;
70
- const a = n[s];
71
- if (i < 0 && a?.type === "text" && a.raw === a.text) {
72
- const f = a.raw.lastIndexOf(" ");
72
+ const l = n[s];
73
+ if (i < 0 && l?.type === "text" && l.raw === l.text) {
74
+ const f = l.raw.lastIndexOf(" ");
73
75
  if (f > 0) {
74
- const u = a;
76
+ const u = l;
75
77
  n.splice(
76
78
  s,
77
79
  1,
@@ -80,24 +82,24 @@ function X(k) {
80
82
  ), s++;
81
83
  }
82
84
  }
83
- const d = n.slice(s).map((f) => f.raw).join("");
85
+ const p = n.slice(s).map((f) => f.raw).join("");
84
86
  O = {
85
87
  from: s,
86
- source: d,
88
+ source: p,
87
89
  unresolved: i >= 0,
88
- extensionPending: z(d),
89
- lastChar: d.slice(-1)
90
+ extensionPending: z(p),
91
+ lastChar: p.slice(-1)
90
92
  };
91
93
  }
92
94
  function G() {
93
95
  g = void 0, O = void 0, S = !1;
94
- const e = l.at(-1)?.token;
96
+ const e = a.at(-1)?.token;
95
97
  if (e?.type === "paragraph") {
96
98
  _(e);
97
- const a = e.raw.lastIndexOf(`
98
- `) + 1, d = e.raw.slice(a, a + 32);
99
+ const l = e.raw.lastIndexOf(`
100
+ `) + 1, p = e.raw.slice(l, l + 32);
99
101
  S = !e.raw.endsWith(`
100
- `) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(d);
102
+ `) && !/^(?: {0,3}(?:[-+*_]+|[0-9]{1,9}[.)]?)[ \t]*$| {0,3}[[<\x60~#|=])/u.test(p);
101
103
  }
102
104
  if (e?.type !== "code") return;
103
105
  const t = /^(\x60{3,}|~{3,})[^\n]*\n/.exec(e.raw);
@@ -114,48 +116,48 @@ function X(k) {
114
116
  E(i, s) || (g = s);
115
117
  }
116
118
  function N(e = !1) {
117
- const t = l[o]?.start ?? 0, n = l.splice(o);
119
+ const t = a[o]?.start ?? 0, n = a.splice(o);
118
120
  for (const r of n) B(r);
119
- const i = F(U(t), v), s = p;
120
- p = Object.freeze(
121
+ const i = F(U(t), v), s = d;
122
+ d = Object.freeze(
121
123
  Object.fromEntries(
122
124
  Object.entries(i.links).map(([r, c]) => [r, Object.freeze({ ...c })])
123
125
  )
124
126
  );
125
- const a = [];
126
- let d = t;
127
+ const l = [];
128
+ let p = t;
127
129
  for (let r = 0; r < i.length; r++) {
128
130
  const c = i[r], h = n[r], x = {
129
- id: h?.start === d ? h.id : R++,
130
- start: d,
131
+ id: h?.start === p ? h.id : R++,
132
+ start: p,
131
133
  token: c,
132
134
  references: /* @__PURE__ */ new Set()
133
135
  };
134
- l.push(x), q(x), r === i.length - 1 && c.type === "paragraph" && _(c), (!e || !h || JSON.stringify(h.token) !== JSON.stringify(c)) && a.push({ kind: "replace", block: $(x) }), d += c.raw.length;
136
+ a.push(x), q(x), r === i.length - 1 && c.type === "paragraph" && _(c), (!e || !h || JSON.stringify(h.token) !== JSON.stringify(c)) && l.push({ kind: "replace", block: $(x) }), p += c.raw.length;
135
137
  }
136
- const f = new Set(l.slice(o).map((r) => r.id));
138
+ const f = new Set(a.slice(o).map((r) => r.id));
137
139
  for (const r of n)
138
- f.has(r.id) || a.push({ kind: "remove", id: r.id });
140
+ f.has(r.id) || l.push({ kind: "remove", id: r.id });
139
141
  const u = /* @__PURE__ */ new Set();
140
- for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(p)]))
141
- if (!(s[r]?.href === p[r]?.href && s[r]?.title === p[r]?.title))
142
+ for (const r of /* @__PURE__ */ new Set([...Object.keys(s), ...Object.keys(d)]))
143
+ if (!(s[r]?.href === d[r]?.href && s[r]?.title === d[r]?.title))
142
144
  for (const c of m.get(r) ?? [])
143
145
  c.start < t && u.add(c);
144
146
  for (const r of u) {
145
- const c = F(r.token.raw, p);
146
- c.length === 1 && (r.token = c[0], a.push({ kind: "replace", block: $(r) }));
147
+ const c = F(r.token.raw, d);
148
+ c.length === 1 && (r.token = c[0], l.push({ kind: "replace", block: $(r) }));
147
149
  }
148
150
  const P = o;
149
- o = Math.max(0, l.length - 1), l[o]?.token.type === "space" ? o = Math.max(0, o - 1) : o > 0 && !l[o - 1].token.raw.endsWith(`
151
+ o = Math.max(0, a.length - 1), a[o]?.token.type === "space" ? o = Math.max(0, o - 1) : o > 0 && !a[o - 1].token.raw.endsWith(`
150
152
 
151
- `) && (l[o - 1]?.token.type !== "space" ? o-- : /\n[ \t]*\n/u.test(l[o - 1].token.raw) || (o = Math.max(0, o - 2)));
152
- const y = l.at(-1)?.token;
153
- o > 1 && l[o - 1]?.token.type === "space" && l[o - 2]?.token.type === "list" && (y?.type === "list" || y?.type === "paragraph" && /^ {0,3}(?:[0-9]{1,9}[.)]?|[-+*])[ \t]*$/u.test(y.raw)) && (o -= 2);
153
+ `) && (a[o - 1]?.token.type !== "space" ? o-- : /\n[ \t]*\n/u.test(a[o - 1].token.raw) || (o = Math.max(0, o - 2)));
154
+ const y = a.at(-1)?.token;
155
+ o > 1 && a[o - 1]?.token.type === "space" && a[o - 2]?.token.type === "list" && (y?.type === "list" || y?.type === "paragraph" && /^ {0,3}(?:[0-9]{1,9}[.)]?|[-+*])[ \t]*$/u.test(y.raw)) && (o -= 2);
154
156
  for (let r = P; r < o; r++) {
155
- const c = l[r].token;
157
+ const c = a[r].token;
156
158
  c.type === "def" && !v[c.tag] && (v[c.tag] = { href: c.href, title: c.title });
157
159
  }
158
- return G(), w(a);
160
+ return G(), w(l);
159
161
  }
160
162
  function J(e) {
161
163
  const t = I && e.startsWith(`
@@ -167,8 +169,8 @@ function X(k) {
167
169
  if (!e) return w([]);
168
170
  if (C += e.length, e = J(e), !e) return w([]);
169
171
  b.push({ start: L, text: e }), L += e.length;
170
- const t = l.at(-1), n = t?.token;
171
- if (t && o === l.length - 1 && n?.type === "code" && g && !e.includes("\r") && !E(e, g)) {
172
+ const t = a.at(-1), n = t?.token;
173
+ if (t && o === a.length - 1 && n?.type === "code" && g && !e.includes("\r") && !E(e, g)) {
172
174
  const s = (g.pendingNewline ? `
173
175
  ` : "") + (e.endsWith(`
174
176
  `) ? e.slice(0, -1) : e);
@@ -176,10 +178,10 @@ function X(k) {
176
178
  `), n.raw += e, n.text += s, w(s ? [{ kind: "append_text", id: t.id, text: s, code: !0 }] : []);
177
179
  }
178
180
  const i = n?.type === "paragraph" ? n : void 0;
179
- if (t && o === l.length - 1 && i && O && S && !/[\n\r]/u.test(e)) {
180
- const s = O, a = i.tokens.at(-1), d = a?.type === "text" && s.from === i.tokens.length - 1 && !z(e) && !s.extensionPending && !/[\\\x60*_[\]<>~&:/.@;|="'()-]/u.test(e) && !/[\\\x60*_[\]<>~&:/.@;|="'()-]$/u.test(s.lastChar);
181
- if (i.raw += e, i.text += e, d) {
182
- const c = a, h = s.unresolved ? -1 : e.lastIndexOf(" "), x = h > 0 ? e.slice(0, h) : h === 0 ? "" : e, T = [], A = i.tokens.length - 1;
181
+ if (t && o === a.length - 1 && i && O && S && !/[\n\r]/u.test(e)) {
182
+ const s = O, l = i.tokens.at(-1), p = l?.type === "text" && s.from === i.tokens.length - 1 && !z(e) && !s.extensionPending && !/[\\\x60*_[\]<>~&:/.@;|="'()-]/u.test(e) && !/[\\\x60*_[\]<>~&:/.@;|="'()-]$/u.test(s.lastChar);
183
+ if (i.raw += e, i.text += e, p) {
184
+ const c = l, h = s.unresolved ? -1 : e.lastIndexOf(" "), x = h > 0 ? e.slice(0, h) : h === 0 ? "" : e, T = [], A = i.tokens.length - 1;
183
185
  if (x && (c.raw += x, c.text += x, T.push({
184
186
  kind: "append_text",
185
187
  id: t.id,
@@ -206,7 +208,7 @@ function X(k) {
206
208
  return w(T);
207
209
  }
208
210
  const f = new k.Lexer({ ...k.defaults });
209
- f.tokens.links = p;
211
+ f.tokens.links = d;
210
212
  const u = s.source + e;
211
213
  W += u.length;
212
214
  const P = f.inlineTokens(u), y = i.tokens.length - s.from;
@@ -225,19 +227,13 @@ function X(k) {
225
227
  return N();
226
228
  }
227
229
  function K(e = "") {
228
- const t = l.map((s) => ({
229
- kind: "remove",
230
- id: s.id
231
- }));
232
230
  C = e.length, I = !1;
233
- const n = J(e);
234
- L = n.length, b = n ? [{ start: 0, text: n }] : [], l = [], p = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), m.clear(), o = 0, g = void 0, M++;
235
- const i = N();
236
- return { ...i, changes: [...t, ...i.changes] };
231
+ const t = J(e);
232
+ return L = t.length, b = t ? [{ start: 0, text: t }] : [], d = /* @__PURE__ */ Object.create(null), v = /* @__PURE__ */ Object.create(null), m.clear(), o = 0, g = void 0, M++, N(!0);
237
233
  }
238
234
  function Q() {
239
- const e = l.map((t) => structuredClone(t.token));
240
- return e.links = { ...p }, e;
235
+ const e = a.map((t) => structuredClone(t.token));
236
+ return e.links = { ...d }, e;
241
237
  }
242
238
  function V() {
243
239
  return M++, o = 0, v = /* @__PURE__ */ Object.create(null), N(!0);
@@ -250,7 +246,7 @@ function X(k) {
250
246
  get sourceLength() {
251
247
  return C;
252
248
  },
253
- diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks: l.length })
249
+ diagnostics: () => ({ fullParses: M, parsedCharacters: W, blocks: a.length })
254
250
  };
255
251
  }
256
252
  export {
@@ -1,18 +1,18 @@
1
- import { createComponent as r, mergeProps as m, insert as a, effect as f, setAttribute as d, template as h } from "solid-js/web";
2
- import { createMemo as P, createSignal as b } from "solid-js";
3
- import { cn as v } from "../../utils/cn.js";
1
+ import { createComponent as n, mergeProps as s, insert as i, effect as g, setAttribute as u, template as m } from "solid-js/web";
2
+ import { createMemo as d } from "solid-js";
3
+ import { cn as f } from "../../utils/cn.js";
4
4
  import { Button as o } from "./Button.js";
5
- import { Dialog as C } from "./Dialog.js";
6
- import { usePickerNavigation as x, PickerPanel as S, pickerCopy as k } from "./picker/PickerBase.js";
5
+ import { Dialog as h } from "./Dialog.js";
6
+ import { usePickerNavigation as P, PickerPanel as v, pickerCopy as b } from "./picker/PickerBase.js";
7
7
  import { parsePickerPath as w } from "./picker/PickerNavigation.js";
8
- var y = /* @__PURE__ */ h('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">');
9
- function T(e) {
10
- const l = P(() => [...new Set((e.suggestedPaths ?? []).map((t) => w(t)).filter(Boolean))]), [g, s] = b(!0), i = () => l().length > 0 && g(), n = x(e, () => e.open, void 0, () => s(!0)), u = () => {
11
- if (e.disabled || i() || !n.valid()) return;
12
- const t = n.currentPath();
13
- e.onSelect(t), e.onOpenChange(!1);
8
+ var x = /* @__PURE__ */ m('<div class="flex w-full items-center gap-2"><span class="min-w-0 flex-1 truncate text-[11px] text-muted-foreground">');
9
+ function $(e) {
10
+ const a = d(() => [...new Set((e.suggestedPaths ?? []).map((r) => w(r)).filter(Boolean))]), t = P(e, () => e.open, void 0, void 0, () => a().length ? "suggestions" : "browse"), c = () => {
11
+ if (e.disabled || t.view() !== "browse" || !t.valid()) return;
12
+ const r = t.currentPath();
13
+ e.onSelect(r), e.onOpenChange(!1);
14
14
  };
15
- return r(C, {
15
+ return n(h, {
16
16
  get open() {
17
17
  return e.open;
18
18
  },
@@ -23,50 +23,46 @@ function T(e) {
23
23
  return e.title ?? "Select Directory";
24
24
  },
25
25
  get class() {
26
- return v("max-w-lg", e.class);
26
+ return f("max-w-lg", e.class);
27
27
  },
28
28
  get footer() {
29
29
  return (() => {
30
- var t = y(), c = t.firstChild;
31
- return a(c, () => n.currentPath()), a(t, r(o, {
30
+ var r = x(), l = r.firstChild;
31
+ return i(l, () => t.currentPath()), i(r, n(o, {
32
32
  variant: "ghost",
33
33
  size: "sm",
34
34
  onClick: () => e.onOpenChange(!1),
35
35
  get children() {
36
- return e.cancelText ?? k(e).cancel;
36
+ return e.cancelText ?? b(e).cancel;
37
37
  }
38
- }), null), a(t, r(o, {
38
+ }), null), i(r, n(o, {
39
39
  variant: "primary",
40
40
  size: "sm",
41
- onClick: u,
41
+ onClick: c,
42
42
  get disabled() {
43
- return e.disabled || i() || !n.valid();
43
+ return e.disabled || t.view() !== "browse" || !t.valid();
44
44
  },
45
45
  get children() {
46
46
  return e.confirmText ?? "Select";
47
47
  }
48
- }), null), f(() => d(c, "title", n.currentPath())), t;
48
+ }), null), g(() => u(l, "title", t.currentPath())), r;
49
49
  })();
50
50
  },
51
51
  get children() {
52
- return r(S, m(e, {
53
- source: n,
52
+ return n(v, s(e, {
53
+ source: t,
54
54
  suggestions: {
55
55
  get paths() {
56
- return l();
56
+ return a();
57
57
  },
58
58
  get label() {
59
59
  return e.suggestedPathsLabel ?? "Suggested directories";
60
- },
61
- get visible() {
62
- return i();
63
- },
64
- onVisibilityChange: s
60
+ }
65
61
  }
66
62
  }));
67
63
  }
68
64
  });
69
65
  }
70
66
  export {
71
- T as DirectoryPicker
67
+ $ as DirectoryPicker
72
68
  };
@@ -1,4 +1,4 @@
1
- import { createComponent as u, insert as m, mergeProps as z, spread as K, use as L, effect as j, setAttribute as M, className as V, memo as H, template as b, delegateEvents as R } from "solid-js/web";
1
+ import { createComponent as a, insert as c, mergeProps as z, spread as K, use as L, effect as j, setAttribute as M, className as V, memo as H, template as x, delegateEvents as R } from "solid-js/web";
2
2
  import { createSignal as U, mergeProps as Y, createMemo as q, Show as w, For as G } from "solid-js";
3
3
  import { cn as N } from "../../utils/cn.js";
4
4
  import { deferNonBlocking as J } from "../../utils/defer.js";
@@ -6,53 +6,53 @@ import { Check as Q } from "../icons/index.js";
6
6
  import { FileItemIcon as W } from "../file-browser/FileIcons.js";
7
7
  import { Button as D } from "./Button.js";
8
8
  import { Dialog as X } from "./Dialog.js";
9
- import { usePickerNavigation as Z, PickerPanel as ee, normalizePath as k, pickerCopy as v } from "./picker/PickerBase.js";
9
+ import { usePickerNavigation as Z, PickerPanel as ee, normalizePath as k, pickerCopy as b } from "./picker/PickerBase.js";
10
10
  import { pickerParentPath as te } from "./picker/PickerNavigation.js";
11
- var ne = /* @__PURE__ */ b('<div class="flex flex-col gap-2 -mt-1"><div class="flex min-h-[140px] overflow-hidden rounded border border-border"><div>'), ie = /* @__PURE__ */ b('<div class="flex items-center w-full gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), le = /* @__PURE__ */ b('<div class="flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground">'), re = /* @__PURE__ */ b('<span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] text-primary-foreground">'), oe = /* @__PURE__ */ b("<button type=button role=option><span class=truncate>");
12
- function ae(e, o) {
13
- const a = y(o), f = /* @__PURE__ */ new Set(), c = [];
11
+ var ne = /* @__PURE__ */ x('<div class="flex min-h-[140px] overflow-hidden rounded border border-border"><div>'), ie = /* @__PURE__ */ x('<div class="flex flex-col gap-2 -mt-1">'), le = /* @__PURE__ */ x('<div class="flex items-center w-full gap-2"><span class="flex-1 text-[11px] text-muted-foreground truncate">'), re = /* @__PURE__ */ x('<div class="flex h-full items-center justify-center px-4 text-center text-xs text-muted-foreground">'), oe = /* @__PURE__ */ x('<span class="ml-auto flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-[10px] text-primary-foreground">'), ae = /* @__PURE__ */ x("<button type=button role=option><span class=truncate>");
12
+ function ce(e, s) {
13
+ const u = y(s), f = /* @__PURE__ */ new Set(), d = [];
14
14
  for (const g of e ?? []) {
15
- const s = k(g);
16
- if (!(s === "/" || f.has(s)) && (f.add(s), c.push(s), c.length >= a))
15
+ const i = k(g);
16
+ if (!(i === "/" || f.has(i)) && (f.add(i), d.push(i), d.length >= u))
17
17
  break;
18
18
  }
19
- return c;
19
+ return d;
20
20
  }
21
- function ce(e, o, a, f) {
22
- const c = k(o);
23
- if (c === "/") return [...e];
24
- if (a === "single") return [c];
25
- const g = e.indexOf(c);
26
- return g >= 0 ? e.filter((s, h) => h !== g) : e.length >= y(f) ? [...e] : [...e, c];
21
+ function se(e, s, u, f) {
22
+ const d = k(s);
23
+ if (d === "/") return [...e];
24
+ if (u === "single") return [d];
25
+ const g = e.indexOf(d);
26
+ return g >= 0 ? e.filter((i, h) => h !== g) : e.length >= y(f) ? [...e] : [...e, d];
27
27
  }
28
28
  function y(e) {
29
29
  return e == null || !Number.isFinite(e) ? Number.POSITIVE_INFINITY : Math.max(1, Math.floor(e));
30
30
  }
31
31
  function ke(e) {
32
- const o = () => e.selectionMode ?? "single", [a, f] = U([]), c = () => {
32
+ const s = () => e.selectionMode ?? "single", [u, f] = U([]), d = () => {
33
33
  if (e.initialPath) return e.initialPath;
34
34
  const t = e.initialSelectedPaths?.[0];
35
35
  return t ? te(t) : void 0;
36
36
  }, g = Y(e, {
37
37
  get initialPath() {
38
- return c();
38
+ return d();
39
39
  },
40
40
  get scopeKey() {
41
41
  return e.scopeKey;
42
42
  }
43
- }), s = Z(g, () => e.open, void 0, () => {
44
- f(ae(e.initialSelectedPaths, o() === "single" ? 1 : e.maxSelections));
45
- }), h = q(() => s.entries().filter((t) => t.type === "file" && (!e.fileFilter || e.fileFilter(t)))), T = (t) => a().indexOf(k(t)), A = () => o() === "multiple" && a().length >= y(e.maxSelections), B = (t) => {
46
- f((r) => ce(r, t.path, o(), e.maxSelections));
47
- }, P = (t = a()) => {
48
- if (t.length === 0 || !s.valid()) return;
49
- const r = e.onSelect;
50
- e.onOpenChange(!1), J(() => r([...t]));
51
- }, E = (t, r) => {
52
- let i;
53
- t.key === "ArrowDown" && (i = Math.min(r + 1, h().length - 1)), t.key === "ArrowUp" && (i = Math.max(r - 1, 0)), t.key === "Home" && (i = 0), t.key === "End" && (i = h().length - 1), !(i == null || i < 0) && (t.preventDefault(), S[i]?.focus());
54
- }, S = [];
55
- return u(X, {
43
+ }), i = Z(g, () => e.open, void 0, () => {
44
+ f(ce(e.initialSelectedPaths, s() === "single" ? 1 : e.maxSelections));
45
+ }), h = q(() => i.entries().filter((t) => t.type === "file" && (!e.fileFilter || e.fileFilter(t)))), T = (t) => u().indexOf(k(t)), A = () => s() === "multiple" && u().length >= y(e.maxSelections), B = (t) => {
46
+ f((o) => se(o, t.path, s(), e.maxSelections));
47
+ }, P = (t = u()) => {
48
+ if (e.disabled || t.length === 0 || i.view() !== "browse" || !i.valid()) return;
49
+ const o = e.onSelect;
50
+ e.onOpenChange(!1), J(() => o([...t]));
51
+ }, E = (t, o) => {
52
+ let l;
53
+ t.key === "ArrowDown" && (l = Math.min(o + 1, h().length - 1)), t.key === "ArrowUp" && (l = Math.max(o - 1, 0)), t.key === "Home" && (l = 0), t.key === "End" && (l = h().length - 1), !(l == null || l < 0) && (t.preventDefault(), $[l]?.focus());
54
+ }, $ = [];
55
+ return a(X, {
56
56
  get open() {
57
57
  return e.open;
58
58
  },
@@ -67,23 +67,23 @@ function ke(e) {
67
67
  },
68
68
  get footer() {
69
69
  return (() => {
70
- var t = ie(), r = t.firstChild;
71
- return m(r, (() => {
72
- var i = H(() => a().length === 0);
73
- return () => i() ? v(e).noFilesSelected : v(e).selectedCount(a().length);
74
- })()), m(t, u(D, {
70
+ var t = le(), o = t.firstChild;
71
+ return c(o, (() => {
72
+ var l = H(() => u().length === 0);
73
+ return () => l() ? b(e).noFilesSelected : b(e).selectedCount(u().length);
74
+ })()), c(t, a(D, {
75
75
  variant: "ghost",
76
76
  size: "sm",
77
77
  onClick: () => e.onOpenChange(!1),
78
78
  get children() {
79
- return e.cancelText ?? v(e).cancel;
79
+ return e.cancelText ?? b(e).cancel;
80
80
  }
81
- }), null), m(t, u(D, {
81
+ }), null), c(t, a(D, {
82
82
  variant: "primary",
83
83
  size: "sm",
84
84
  onClick: () => P(),
85
85
  get disabled() {
86
- return a().length === 0 || !s.valid();
86
+ return u().length === 0 || i.view() !== "browse" || !i.valid();
87
87
  },
88
88
  get children() {
89
89
  return e.confirmText ?? "Select";
@@ -92,82 +92,90 @@ function ke(e) {
92
92
  })();
93
93
  },
94
94
  get children() {
95
- var t = ne(), r = t.firstChild, i = r.firstChild;
96
- return m(t, u(ee, z(e, {
97
- source: s
98
- })), r), K(i, z(() => e.scrollViewportProps, {
99
- class: "max-h-[200px] min-h-[140px] min-w-0 flex-1 overflow-y-auto",
100
- role: "listbox",
101
- get "aria-multiselectable"() {
102
- return o() === "multiple" ? "true" : void 0;
103
- }
104
- }), !1, !0), m(i, u(w, {
95
+ var t = ie();
96
+ return c(t, a(ee, z(e, {
97
+ source: i
98
+ })), null), c(t, a(w, {
105
99
  get when() {
106
- return h().length > 0;
107
- },
108
- get fallback() {
109
- return (() => {
110
- var d = le();
111
- return m(d, () => e.emptyText ?? v(e).emptyFiles), d;
112
- })();
100
+ return i.view() === "browse";
113
101
  },
114
102
  get children() {
115
- return u(G, {
116
- get each() {
117
- return h();
103
+ var o = ne(), l = o.firstChild;
104
+ return K(l, z(() => e.scrollViewportProps, {
105
+ class: "max-h-[200px] min-h-[140px] min-w-0 flex-1 overflow-y-auto",
106
+ role: "listbox",
107
+ get "aria-multiselectable"() {
108
+ return s() === "multiple" ? "true" : void 0;
109
+ }
110
+ }), !1, !0), c(l, a(w, {
111
+ get when() {
112
+ return h().length > 0;
118
113
  },
119
- children: (d, $) => {
120
- const x = () => T(d.path), F = () => A() && x() < 0;
114
+ get fallback() {
121
115
  return (() => {
122
- var l = oe(), C = l.firstChild;
123
- return l.$$keydown = (n) => E(n, $()), l.$$dblclick = () => {
124
- o() === "single" && P([k(d.path)]);
125
- }, l.$$click = () => B(d), L((n) => {
126
- S[$()] = n;
127
- }, l), m(l, u(W, {
128
- item: d,
129
- size: 16,
130
- class: "w-4 h-4 flex-shrink-0"
131
- }), C), m(C, () => d.name), m(l, u(w, {
132
- get when() {
133
- return x() >= 0;
134
- },
135
- get children() {
136
- var n = re();
137
- return m(n, u(w, {
116
+ var m = re();
117
+ return c(m, () => e.emptyText ?? b(e).emptyFiles), m;
118
+ })();
119
+ },
120
+ get children() {
121
+ return a(G, {
122
+ get each() {
123
+ return h();
124
+ },
125
+ children: (m, S) => {
126
+ const v = () => T(m.path), F = () => A() && v() < 0;
127
+ return (() => {
128
+ var r = ae(), _ = r.firstChild;
129
+ return r.$$keydown = (n) => E(n, S()), r.$$dblclick = () => {
130
+ s() === "single" && P([k(m.path)]);
131
+ }, r.$$click = () => B(m), L((n) => {
132
+ $[S()] = n;
133
+ }, r), c(r, a(W, {
134
+ item: m,
135
+ size: 16,
136
+ class: "w-4 h-4 flex-shrink-0"
137
+ }), _), c(_, () => m.name), c(r, a(w, {
138
138
  get when() {
139
- return o() === "multiple";
140
- },
141
- get fallback() {
142
- return u(Q, {
143
- class: "h-3 w-3"
144
- });
139
+ return v() >= 0;
145
140
  },
146
141
  get children() {
147
- return x() + 1;
142
+ var n = oe();
143
+ return c(n, a(w, {
144
+ get when() {
145
+ return s() === "multiple";
146
+ },
147
+ get fallback() {
148
+ return a(Q, {
149
+ class: "h-3 w-3"
150
+ });
151
+ },
152
+ get children() {
153
+ return v() + 1;
154
+ }
155
+ })), n;
148
156
  }
149
- })), n;
150
- }
151
- }), null), j((n) => {
152
- var _ = x() >= 0, I = F(), O = F() ? v(e).selectionLimit : d.name, p = N("flex min-h-9 w-full cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs", "transition-colors duration-100 hover:bg-accent/60", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-45", x() >= 0 && "bg-accent text-accent-foreground font-medium");
153
- return _ !== n.e && M(l, "aria-selected", n.e = _), I !== n.t && (l.disabled = n.t = I), O !== n.a && M(l, "title", n.a = O), p !== n.o && V(l, n.o = p), n;
154
- }, {
155
- e: void 0,
156
- t: void 0,
157
- a: void 0,
158
- o: void 0
159
- }), l;
160
- })();
157
+ }), null), j((n) => {
158
+ var C = v() >= 0, I = F(), O = F() ? b(e).selectionLimit : m.name, p = N("flex min-h-9 w-full cursor-pointer items-center gap-2 px-2 py-1.5 text-left text-xs", "transition-colors duration-100 hover:bg-accent/60", "focus:outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring", "disabled:cursor-not-allowed disabled:opacity-45", v() >= 0 && "bg-accent text-accent-foreground font-medium");
159
+ return C !== n.e && M(r, "aria-selected", n.e = C), I !== n.t && (r.disabled = n.t = I), O !== n.a && M(r, "title", n.a = O), p !== n.o && V(r, n.o = p), n;
160
+ }, {
161
+ e: void 0,
162
+ t: void 0,
163
+ a: void 0,
164
+ o: void 0
165
+ }), r;
166
+ })();
167
+ }
168
+ });
161
169
  }
162
- });
170
+ })), o;
163
171
  }
164
- })), t;
172
+ }), null), t;
165
173
  }
166
174
  });
167
175
  }
168
176
  R(["click", "dblclick", "keydown"]);
169
177
  export {
170
178
  ke as FileOpenPicker,
171
- ae as normalizeFileOpenSelection,
172
- ce as updateFileOpenSelection
179
+ ce as normalizeFileOpenSelection,
180
+ se as updateFileOpenSelection
173
181
  };