@hadoku/jobplatform 3.42.85 → 3.42.87

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.
@@ -0,0 +1,4346 @@
1
+ import { jsxs as g, jsx as i, Fragment as He } from "react/jsx-runtime";
2
+ import { createRoot as Un } from "react-dom/client";
3
+ import { logger as Yt } from "@wolffm/logger/client";
4
+ import * as p from "react";
5
+ import { useState as E, useRef as Fe, useEffect as Y, useCallback as se, useId as In, useMemo as fe, Suspense as it, lazy as ge, Component as Mn } from "react";
6
+ import { LoadingSkeleton as Bn, AppHeader as Hn } from "@wolffm/task-ui-components";
7
+ import { HadokuThemeRoot as Wn, useHadokuTheme as Jn } from "@wolffm/themes";
8
+ var St = "popstate";
9
+ function Pt(e) {
10
+ return typeof e == "object" && e != null && "pathname" in e && "search" in e && "hash" in e && "state" in e && "key" in e;
11
+ }
12
+ function qn(e = {}) {
13
+ function t(r, o) {
14
+ let {
15
+ pathname: s = "/",
16
+ search: l = "",
17
+ hash: c = ""
18
+ } = Ne(r.location.hash.substring(1));
19
+ return !s.startsWith("/") && !s.startsWith(".") && (s = "/" + s), st(
20
+ "",
21
+ { pathname: s, search: l, hash: c },
22
+ // state defaults to `null` because `window.history.state` does
23
+ o.state && o.state.usr || null,
24
+ o.state && o.state.key || "default"
25
+ );
26
+ }
27
+ function n(r, o) {
28
+ let s = r.document.querySelector("base"), l = "";
29
+ if (s && s.getAttribute("href")) {
30
+ let c = r.location.href, u = c.indexOf("#");
31
+ l = u === -1 ? c : c.slice(0, u);
32
+ }
33
+ return l + "#" + (typeof o == "string" ? o : Oe(o));
34
+ }
35
+ function a(r, o) {
36
+ Z(
37
+ r.pathname.charAt(0) === "/",
38
+ `relative pathnames are not supported in hash history.push(${JSON.stringify(
39
+ o
40
+ )})`
41
+ );
42
+ }
43
+ return Vn(
44
+ t,
45
+ n,
46
+ a,
47
+ e
48
+ );
49
+ }
50
+ function M(e, t) {
51
+ if (e === !1 || e === null || typeof e > "u")
52
+ throw new Error(t);
53
+ }
54
+ function Z(e, t) {
55
+ if (!e) {
56
+ typeof console < "u" && console.warn(t);
57
+ try {
58
+ throw new Error(t);
59
+ } catch {
60
+ }
61
+ }
62
+ }
63
+ function Kn() {
64
+ return Math.random().toString(36).substring(2, 10);
65
+ }
66
+ function xt(e, t) {
67
+ return {
68
+ usr: e.state,
69
+ key: e.key,
70
+ idx: t,
71
+ masked: e.unstable_mask ? {
72
+ pathname: e.pathname,
73
+ search: e.search,
74
+ hash: e.hash
75
+ } : void 0
76
+ };
77
+ }
78
+ function st(e, t, n = null, a, r) {
79
+ return {
80
+ pathname: typeof e == "string" ? e : e.pathname,
81
+ search: "",
82
+ hash: "",
83
+ ...typeof t == "string" ? Ne(t) : t,
84
+ state: n,
85
+ // TODO: This could be cleaned up. push/replace should probably just take
86
+ // full Locations now and avoid the need to run through this flow at all
87
+ // But that's a pretty big refactor to the current test suite so going to
88
+ // keep as is for the time being and just let any incoming keys take precedence
89
+ key: t && t.key || a || Kn(),
90
+ unstable_mask: r
91
+ };
92
+ }
93
+ function Oe({
94
+ pathname: e = "/",
95
+ search: t = "",
96
+ hash: n = ""
97
+ }) {
98
+ return t && t !== "?" && (e += t.charAt(0) === "?" ? t : "?" + t), n && n !== "#" && (e += n.charAt(0) === "#" ? n : "#" + n), e;
99
+ }
100
+ function Ne(e) {
101
+ let t = {};
102
+ if (e) {
103
+ let n = e.indexOf("#");
104
+ n >= 0 && (t.hash = e.substring(n), e = e.substring(0, n));
105
+ let a = e.indexOf("?");
106
+ a >= 0 && (t.search = e.substring(a), e = e.substring(0, a)), e && (t.pathname = e);
107
+ }
108
+ return t;
109
+ }
110
+ function Vn(e, t, n, a = {}) {
111
+ let { window: r = document.defaultView, v5Compat: o = !1 } = a, s = r.history, l = "POP", c = null, u = h();
112
+ u == null && (u = 0, s.replaceState({ ...s.state, idx: u }, ""));
113
+ function h() {
114
+ return (s.state || { idx: null }).idx;
115
+ }
116
+ function d() {
117
+ l = "POP";
118
+ let m = h(), C = m == null ? null : m - u;
119
+ u = m, c && c({ action: l, location: f.location, delta: C });
120
+ }
121
+ function v(m, C) {
122
+ l = "PUSH";
123
+ let w = Pt(m) ? m : st(f.location, m, C);
124
+ n && n(w, m), u = h() + 1;
125
+ let R = xt(w, u), $ = f.createHref(w.unstable_mask || w);
126
+ try {
127
+ s.pushState(R, "", $);
128
+ } catch (x) {
129
+ if (x instanceof DOMException && x.name === "DataCloneError")
130
+ throw x;
131
+ r.location.assign($);
132
+ }
133
+ o && c && c({ action: l, location: f.location, delta: 1 });
134
+ }
135
+ function b(m, C) {
136
+ l = "REPLACE";
137
+ let w = Pt(m) ? m : st(f.location, m, C);
138
+ n && n(w, m), u = h();
139
+ let R = xt(w, u), $ = f.createHref(w.unstable_mask || w);
140
+ s.replaceState(R, "", $), o && c && c({ action: l, location: f.location, delta: 0 });
141
+ }
142
+ function _(m) {
143
+ return Gn(m);
144
+ }
145
+ let f = {
146
+ get action() {
147
+ return l;
148
+ },
149
+ get location() {
150
+ return e(r, s);
151
+ },
152
+ listen(m) {
153
+ if (c)
154
+ throw new Error("A history only accepts one active listener");
155
+ return r.addEventListener(St, d), c = m, () => {
156
+ r.removeEventListener(St, d), c = null;
157
+ };
158
+ },
159
+ createHref(m) {
160
+ return t(r, m);
161
+ },
162
+ createURL: _,
163
+ encodeLocation(m) {
164
+ let C = _(m);
165
+ return {
166
+ pathname: C.pathname,
167
+ search: C.search,
168
+ hash: C.hash
169
+ };
170
+ },
171
+ push: v,
172
+ replace: b,
173
+ go(m) {
174
+ return s.go(m);
175
+ }
176
+ };
177
+ return f;
178
+ }
179
+ function Gn(e, t = !1) {
180
+ let n = "http://localhost";
181
+ typeof window < "u" && (n = window.location.origin !== "null" ? window.location.origin : window.location.href), M(n, "No window.location.(origin|href) available to create URL");
182
+ let a = typeof e == "string" ? e : Oe(e);
183
+ return a = a.replace(/ $/, "%20"), !t && a.startsWith("//") && (a = n + a), new URL(a, n);
184
+ }
185
+ function Qt(e, t, n = "/") {
186
+ return zn(e, t, n, !1);
187
+ }
188
+ function zn(e, t, n, a) {
189
+ let r = typeof t == "string" ? Ne(t) : t, o = de(r.pathname || "/", n);
190
+ if (o == null)
191
+ return null;
192
+ let s = Xt(e);
193
+ Yn(s);
194
+ let l = null;
195
+ for (let c = 0; l == null && c < s.length; ++c) {
196
+ let u = sa(o);
197
+ l = oa(
198
+ s[c],
199
+ u,
200
+ a
201
+ );
202
+ }
203
+ return l;
204
+ }
205
+ function Xt(e, t = [], n = [], a = "", r = !1) {
206
+ let o = (s, l, c = r, u) => {
207
+ let h = {
208
+ relativePath: u === void 0 ? s.path || "" : u,
209
+ caseSensitive: s.caseSensitive === !0,
210
+ childrenIndex: l,
211
+ route: s
212
+ };
213
+ if (h.relativePath.startsWith("/")) {
214
+ if (!h.relativePath.startsWith(a) && c)
215
+ return;
216
+ M(
217
+ h.relativePath.startsWith(a),
218
+ `Absolute route path "${h.relativePath}" nested under path "${a}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
219
+ ), h.relativePath = h.relativePath.slice(a.length);
220
+ }
221
+ let d = oe([a, h.relativePath]), v = n.concat(h);
222
+ s.children && s.children.length > 0 && (M(
223
+ // Our types know better, but runtime JS may not!
224
+ // @ts-expect-error
225
+ s.index !== !0,
226
+ `Index routes must not have child routes. Please remove all child routes from route path "${d}".`
227
+ ), Xt(
228
+ s.children,
229
+ t,
230
+ v,
231
+ d,
232
+ c
233
+ )), !(s.path == null && !s.index) && t.push({
234
+ path: d,
235
+ score: aa(d, s.index),
236
+ routesMeta: v
237
+ });
238
+ };
239
+ return e.forEach((s, l) => {
240
+ if (s.path === "" || !s.path?.includes("?"))
241
+ o(s, l);
242
+ else
243
+ for (let c of Zt(s.path))
244
+ o(s, l, !0, c);
245
+ }), t;
246
+ }
247
+ function Zt(e) {
248
+ let t = e.split("/");
249
+ if (t.length === 0) return [];
250
+ let [n, ...a] = t, r = n.endsWith("?"), o = n.replace(/\?$/, "");
251
+ if (a.length === 0)
252
+ return r ? [o, ""] : [o];
253
+ let s = Zt(a.join("/")), l = [];
254
+ return l.push(
255
+ ...s.map(
256
+ (c) => c === "" ? o : [o, c].join("/")
257
+ )
258
+ ), r && l.push(...s), l.map(
259
+ (c) => e.startsWith("/") && c === "" ? "/" : c
260
+ );
261
+ }
262
+ function Yn(e) {
263
+ e.sort(
264
+ (t, n) => t.score !== n.score ? n.score - t.score : ra(
265
+ t.routesMeta.map((a) => a.childrenIndex),
266
+ n.routesMeta.map((a) => a.childrenIndex)
267
+ )
268
+ );
269
+ }
270
+ var Qn = /^:[\w-]+$/, Xn = 3, Zn = 2, ea = 1, ta = 10, na = -2, Lt = (e) => e === "*";
271
+ function aa(e, t) {
272
+ let n = e.split("/"), a = n.length;
273
+ return n.some(Lt) && (a += na), t && (a += Zn), n.filter((r) => !Lt(r)).reduce(
274
+ (r, o) => r + (Qn.test(o) ? Xn : o === "" ? ea : ta),
275
+ a
276
+ );
277
+ }
278
+ function ra(e, t) {
279
+ return e.length === t.length && e.slice(0, -1).every((a, r) => a === t[r]) ? (
280
+ // If two routes are siblings, we should try to match the earlier sibling
281
+ // first. This allows people to have fine-grained control over the matching
282
+ // behavior by simply putting routes with identical paths in the order they
283
+ // want them tried.
284
+ e[e.length - 1] - t[t.length - 1]
285
+ ) : (
286
+ // Otherwise, it doesn't really make sense to rank non-siblings by index,
287
+ // so they sort equally.
288
+ 0
289
+ );
290
+ }
291
+ function oa(e, t, n = !1) {
292
+ let { routesMeta: a } = e, r = {}, o = "/", s = [];
293
+ for (let l = 0; l < a.length; ++l) {
294
+ let c = a[l], u = l === a.length - 1, h = o === "/" ? t : t.slice(o.length) || "/", d = Ke(
295
+ { path: c.relativePath, caseSensitive: c.caseSensitive, end: u },
296
+ h
297
+ ), v = c.route;
298
+ if (!d && u && n && !a[a.length - 1].route.index && (d = Ke(
299
+ {
300
+ path: c.relativePath,
301
+ caseSensitive: c.caseSensitive,
302
+ end: !1
303
+ },
304
+ h
305
+ )), !d)
306
+ return null;
307
+ Object.assign(r, d.params), s.push({
308
+ // TODO: Can this as be avoided?
309
+ params: r,
310
+ pathname: oe([o, d.pathname]),
311
+ pathnameBase: da(
312
+ oe([o, d.pathnameBase])
313
+ ),
314
+ route: v
315
+ }), d.pathnameBase !== "/" && (o = oe([o, d.pathnameBase]));
316
+ }
317
+ return s;
318
+ }
319
+ function Ke(e, t) {
320
+ typeof e == "string" && (e = { path: e, caseSensitive: !1, end: !0 });
321
+ let [n, a] = ia(
322
+ e.path,
323
+ e.caseSensitive,
324
+ e.end
325
+ ), r = t.match(n);
326
+ if (!r) return null;
327
+ let o = r[0], s = o.replace(/(.)\/+$/, "$1"), l = r.slice(1);
328
+ return {
329
+ params: a.reduce(
330
+ (u, { paramName: h, isOptional: d }, v) => {
331
+ if (h === "*") {
332
+ let _ = l[v] || "";
333
+ s = o.slice(0, o.length - _.length).replace(/(.)\/+$/, "$1");
334
+ }
335
+ const b = l[v];
336
+ return d && !b ? u[h] = void 0 : u[h] = (b || "").replace(/%2F/g, "/"), u;
337
+ },
338
+ {}
339
+ ),
340
+ pathname: o,
341
+ pathnameBase: s,
342
+ pattern: e
343
+ };
344
+ }
345
+ function ia(e, t = !1, n = !0) {
346
+ Z(
347
+ e === "*" || !e.endsWith("*") || e.endsWith("/*"),
348
+ `Route path "${e}" will be treated as if it were "${e.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/, "/*")}".`
349
+ );
350
+ let a = [], r = "^" + e.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
351
+ /\/:([\w-]+)(\?)?/g,
352
+ (s, l, c, u, h) => {
353
+ if (a.push({ paramName: l, isOptional: c != null }), c) {
354
+ let d = h.charAt(u + s.length);
355
+ return d && d !== "/" ? "/([^\\/]*)" : "(?:/([^\\/]*))?";
356
+ }
357
+ return "/([^\\/]+)";
358
+ }
359
+ ).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
360
+ return e.endsWith("*") ? (a.push({ paramName: "*" }), r += e === "*" || e === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$") : n ? r += "\\/*$" : e !== "" && e !== "/" && (r += "(?:(?=\\/|$))"), [new RegExp(r, t ? void 0 : "i"), a];
361
+ }
362
+ function sa(e) {
363
+ try {
364
+ return e.split("/").map((t) => decodeURIComponent(t).replace(/\//g, "%2F")).join("/");
365
+ } catch (t) {
366
+ return Z(
367
+ !1,
368
+ `The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`
369
+ ), e;
370
+ }
371
+ }
372
+ function de(e, t) {
373
+ if (t === "/") return e;
374
+ if (!e.toLowerCase().startsWith(t.toLowerCase()))
375
+ return null;
376
+ let n = t.endsWith("/") ? t.length - 1 : t.length, a = e.charAt(n);
377
+ return a && a !== "/" ? null : e.slice(n) || "/";
378
+ }
379
+ var la = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
380
+ function ca(e, t = "/") {
381
+ let {
382
+ pathname: n,
383
+ search: a = "",
384
+ hash: r = ""
385
+ } = typeof e == "string" ? Ne(e) : e, o;
386
+ return n ? (n = en(n), n.startsWith("/") ? o = $t(n.substring(1), "/") : o = $t(n, t)) : o = t, {
387
+ pathname: o,
388
+ search: pa(a),
389
+ hash: ha(r)
390
+ };
391
+ }
392
+ function $t(e, t) {
393
+ let n = Ve(t).split("/");
394
+ return e.split("/").forEach((r) => {
395
+ r === ".." ? n.length > 1 && n.pop() : r !== "." && n.push(r);
396
+ }), n.length > 1 ? n.join("/") : "/";
397
+ }
398
+ function et(e, t, n, a) {
399
+ return `Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(
400
+ a
401
+ )}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
402
+ }
403
+ function ua(e) {
404
+ return e.filter(
405
+ (t, n) => n === 0 || t.route.path && t.route.path.length > 0
406
+ );
407
+ }
408
+ function yt(e) {
409
+ let t = ua(e);
410
+ return t.map(
411
+ (n, a) => a === t.length - 1 ? n.pathname : n.pathnameBase
412
+ );
413
+ }
414
+ function Ge(e, t, n, a = !1) {
415
+ let r;
416
+ typeof e == "string" ? r = Ne(e) : (r = { ...e }, M(
417
+ !r.pathname || !r.pathname.includes("?"),
418
+ et("?", "pathname", "search", r)
419
+ ), M(
420
+ !r.pathname || !r.pathname.includes("#"),
421
+ et("#", "pathname", "hash", r)
422
+ ), M(
423
+ !r.search || !r.search.includes("#"),
424
+ et("#", "search", "hash", r)
425
+ ));
426
+ let o = e === "" || r.pathname === "", s = o ? "/" : r.pathname, l;
427
+ if (s == null)
428
+ l = n;
429
+ else {
430
+ let d = t.length - 1;
431
+ if (!a && s.startsWith("..")) {
432
+ let v = s.split("/");
433
+ for (; v[0] === ".."; )
434
+ v.shift(), d -= 1;
435
+ r.pathname = v.join("/");
436
+ }
437
+ l = d >= 0 ? t[d] : "/";
438
+ }
439
+ let c = ca(r, l), u = s && s !== "/" && s.endsWith("/"), h = (o || s === ".") && n.endsWith("/");
440
+ return !c.pathname.endsWith("/") && (u || h) && (c.pathname += "/"), c;
441
+ }
442
+ var en = (e) => e.replace(/\/\/+/g, "/"), oe = (e) => en(e.join("/")), Ve = (e) => e.replace(/\/+$/, ""), da = (e) => Ve(e).replace(/^\/*/, "/"), pa = (e) => !e || e === "?" ? "" : e.startsWith("?") ? e : "?" + e, ha = (e) => !e || e === "#" ? "" : e.startsWith("#") ? e : "#" + e, ma = class {
443
+ constructor(e, t, n, a = !1) {
444
+ this.status = e, this.statusText = t || "", this.internal = a, n instanceof Error ? (this.data = n.toString(), this.error = n) : this.data = n;
445
+ }
446
+ };
447
+ function fa(e) {
448
+ return e != null && typeof e.status == "number" && typeof e.statusText == "string" && typeof e.internal == "boolean" && "data" in e;
449
+ }
450
+ function ya(e) {
451
+ let t = e.map((n) => n.route.path).filter(Boolean);
452
+ return oe(t) || "/";
453
+ }
454
+ var tn = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
455
+ function nn(e, t) {
456
+ let n = e;
457
+ if (typeof n != "string" || !la.test(n))
458
+ return {
459
+ absoluteURL: void 0,
460
+ isExternal: !1,
461
+ to: n
462
+ };
463
+ let a = n, r = !1;
464
+ if (tn)
465
+ try {
466
+ let o = new URL(window.location.href), s = n.startsWith("//") ? new URL(o.protocol + n) : new URL(n), l = de(s.pathname, t);
467
+ s.origin === o.origin && l != null ? n = l + s.search + s.hash : r = !0;
468
+ } catch {
469
+ Z(
470
+ !1,
471
+ `<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
472
+ );
473
+ }
474
+ return {
475
+ absoluteURL: a,
476
+ isExternal: r,
477
+ to: n
478
+ };
479
+ }
480
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
481
+ var an = [
482
+ "POST",
483
+ "PUT",
484
+ "PATCH",
485
+ "DELETE"
486
+ ];
487
+ new Set(
488
+ an
489
+ );
490
+ var ga = [
491
+ "GET",
492
+ ...an
493
+ ];
494
+ new Set(ga);
495
+ var Le = p.createContext(null);
496
+ Le.displayName = "DataRouter";
497
+ var ze = p.createContext(null);
498
+ ze.displayName = "DataRouterState";
499
+ var rn = p.createContext(!1);
500
+ function va() {
501
+ return p.useContext(rn);
502
+ }
503
+ var on = p.createContext({
504
+ isTransitioning: !1
505
+ });
506
+ on.displayName = "ViewTransition";
507
+ var ba = p.createContext(
508
+ /* @__PURE__ */ new Map()
509
+ );
510
+ ba.displayName = "Fetchers";
511
+ var wa = p.createContext(null);
512
+ wa.displayName = "Await";
513
+ var ee = p.createContext(
514
+ null
515
+ );
516
+ ee.displayName = "Navigation";
517
+ var Ue = p.createContext(
518
+ null
519
+ );
520
+ Ue.displayName = "Location";
521
+ var ae = p.createContext({
522
+ outlet: null,
523
+ matches: [],
524
+ isDataRoute: !1
525
+ });
526
+ ae.displayName = "Route";
527
+ var gt = p.createContext(null);
528
+ gt.displayName = "RouteError";
529
+ var sn = "REACT_ROUTER_ERROR", _a = "REDIRECT", ka = "ROUTE_ERROR_RESPONSE";
530
+ function Ra(e) {
531
+ if (e.startsWith(`${sn}:${_a}:{`))
532
+ try {
533
+ let t = JSON.parse(e.slice(28));
534
+ if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string" && typeof t.location == "string" && typeof t.reloadDocument == "boolean" && typeof t.replace == "boolean")
535
+ return t;
536
+ } catch {
537
+ }
538
+ }
539
+ function Ea(e) {
540
+ if (e.startsWith(
541
+ `${sn}:${ka}:{`
542
+ ))
543
+ try {
544
+ let t = JSON.parse(e.slice(40));
545
+ if (typeof t == "object" && t && typeof t.status == "number" && typeof t.statusText == "string")
546
+ return new ma(
547
+ t.status,
548
+ t.statusText,
549
+ t.data
550
+ );
551
+ } catch {
552
+ }
553
+ }
554
+ function Na(e, { relative: t } = {}) {
555
+ M(
556
+ $e(),
557
+ // TODO: This error is probably because they somehow have 2 versions of the
558
+ // router loaded. We can help them understand how to avoid that.
559
+ "useHref() may be used only in the context of a <Router> component."
560
+ );
561
+ let { basename: n, navigator: a } = p.useContext(ee), { hash: r, pathname: o, search: s } = Ie(e, { relative: t }), l = o;
562
+ return n !== "/" && (l = o === "/" ? n : oe([n, o])), a.createHref({ pathname: l, search: s, hash: r });
563
+ }
564
+ function $e() {
565
+ return p.useContext(Ue) != null;
566
+ }
567
+ function te() {
568
+ return M(
569
+ $e(),
570
+ // TODO: This error is probably because they somehow have 2 versions of the
571
+ // router loaded. We can help them understand how to avoid that.
572
+ "useLocation() may be used only in the context of a <Router> component."
573
+ ), p.useContext(Ue).location;
574
+ }
575
+ var ln = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
576
+ function cn(e) {
577
+ p.useContext(ee).static || p.useLayoutEffect(e);
578
+ }
579
+ function ve() {
580
+ let { isDataRoute: e } = p.useContext(ae);
581
+ return e ? Ma() : Ca();
582
+ }
583
+ function Ca() {
584
+ M(
585
+ $e(),
586
+ // TODO: This error is probably because they somehow have 2 versions of the
587
+ // router loaded. We can help them understand how to avoid that.
588
+ "useNavigate() may be used only in the context of a <Router> component."
589
+ );
590
+ let e = p.useContext(Le), { basename: t, navigator: n } = p.useContext(ee), { matches: a } = p.useContext(ae), { pathname: r } = te(), o = JSON.stringify(yt(a)), s = p.useRef(!1);
591
+ return cn(() => {
592
+ s.current = !0;
593
+ }), p.useCallback(
594
+ (c, u = {}) => {
595
+ if (Z(s.current, ln), !s.current) return;
596
+ if (typeof c == "number") {
597
+ n.go(c);
598
+ return;
599
+ }
600
+ let h = Ge(
601
+ c,
602
+ JSON.parse(o),
603
+ r,
604
+ u.relative === "path"
605
+ );
606
+ e == null && t !== "/" && (h.pathname = h.pathname === "/" ? t : oe([t, h.pathname])), (u.replace ? n.replace : n.push)(
607
+ h,
608
+ u.state,
609
+ u
610
+ );
611
+ },
612
+ [
613
+ t,
614
+ n,
615
+ o,
616
+ r,
617
+ e
618
+ ]
619
+ );
620
+ }
621
+ var un = p.createContext(null);
622
+ function ja() {
623
+ return p.useContext(un);
624
+ }
625
+ function Sa(e) {
626
+ let t = p.useContext(ae).outlet;
627
+ return p.useMemo(
628
+ () => t && /* @__PURE__ */ p.createElement(un.Provider, { value: e }, t),
629
+ [t, e]
630
+ );
631
+ }
632
+ function dn() {
633
+ let { matches: e } = p.useContext(ae), t = e[e.length - 1];
634
+ return t ? t.params : {};
635
+ }
636
+ function Ie(e, { relative: t } = {}) {
637
+ let { matches: n } = p.useContext(ae), { pathname: a } = te(), r = JSON.stringify(yt(n));
638
+ return p.useMemo(
639
+ () => Ge(
640
+ e,
641
+ JSON.parse(r),
642
+ a,
643
+ t === "path"
644
+ ),
645
+ [e, r, a, t]
646
+ );
647
+ }
648
+ function Pa(e, t) {
649
+ return pn(e, t);
650
+ }
651
+ function pn(e, t, n) {
652
+ M(
653
+ $e(),
654
+ // TODO: This error is probably because they somehow have 2 versions of the
655
+ // router loaded. We can help them understand how to avoid that.
656
+ "useRoutes() may be used only in the context of a <Router> component."
657
+ );
658
+ let { navigator: a } = p.useContext(ee), { matches: r } = p.useContext(ae), o = r[r.length - 1], s = o ? o.params : {}, l = o ? o.pathname : "/", c = o ? o.pathnameBase : "/", u = o && o.route;
659
+ {
660
+ let m = u && u.path || "";
661
+ mn(
662
+ l,
663
+ !u || m.endsWith("*") || m.endsWith("*?"),
664
+ `You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${m}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
665
+
666
+ Please change the parent <Route path="${m}"> to <Route path="${m === "/" ? "*" : `${m}/*`}">.`
667
+ );
668
+ }
669
+ let h = te(), d;
670
+ if (t) {
671
+ let m = typeof t == "string" ? Ne(t) : t;
672
+ M(
673
+ c === "/" || m.pathname?.startsWith(c),
674
+ `When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${c}" but pathname "${m.pathname}" was given in the \`location\` prop.`
675
+ ), d = m;
676
+ } else
677
+ d = h;
678
+ let v = d.pathname || "/", b = v;
679
+ if (c !== "/") {
680
+ let m = c.replace(/^\//, "").split("/");
681
+ b = "/" + v.replace(/^\//, "").split("/").slice(m.length).join("/");
682
+ }
683
+ let _ = Qt(e, { pathname: b });
684
+ Z(
685
+ u || _ != null,
686
+ `No routes matched location "${d.pathname}${d.search}${d.hash}" `
687
+ ), Z(
688
+ _ == null || _[_.length - 1].route.element !== void 0 || _[_.length - 1].route.Component !== void 0 || _[_.length - 1].route.lazy !== void 0,
689
+ `Matched leaf route at location "${d.pathname}${d.search}${d.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
690
+ );
691
+ let f = Aa(
692
+ _ && _.map(
693
+ (m) => Object.assign({}, m, {
694
+ params: Object.assign({}, s, m.params),
695
+ pathname: oe([
696
+ c,
697
+ // Re-encode pathnames that were decoded inside matchRoutes.
698
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
699
+ // `new URL()` internally and we need to prevent it from treating
700
+ // them as separators
701
+ a.encodeLocation ? a.encodeLocation(
702
+ m.pathname.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
703
+ ).pathname : m.pathname
704
+ ]),
705
+ pathnameBase: m.pathnameBase === "/" ? c : oe([
706
+ c,
707
+ // Re-encode pathnames that were decoded inside matchRoutes
708
+ // Pre-encode `%`, `?` and `#` ahead of `encodeLocation` because it uses
709
+ // `new URL()` internally and we need to prevent it from treating
710
+ // them as separators
711
+ a.encodeLocation ? a.encodeLocation(
712
+ m.pathnameBase.replace(/%/g, "%25").replace(/\?/g, "%3F").replace(/#/g, "%23")
713
+ ).pathname : m.pathnameBase
714
+ ])
715
+ })
716
+ ),
717
+ r,
718
+ n
719
+ );
720
+ return t && f ? /* @__PURE__ */ p.createElement(
721
+ Ue.Provider,
722
+ {
723
+ value: {
724
+ location: {
725
+ pathname: "/",
726
+ search: "",
727
+ hash: "",
728
+ state: null,
729
+ key: "default",
730
+ unstable_mask: void 0,
731
+ ...d
732
+ },
733
+ navigationType: "POP"
734
+ /* Pop */
735
+ }
736
+ },
737
+ f
738
+ ) : f;
739
+ }
740
+ function xa() {
741
+ let e = Ia(), t = fa(e) ? `${e.status} ${e.statusText}` : e instanceof Error ? e.message : JSON.stringify(e), n = e instanceof Error ? e.stack : null, a = "rgba(200,200,200, 0.5)", r = { padding: "0.5rem", backgroundColor: a }, o = { padding: "2px 4px", backgroundColor: a }, s = null;
742
+ return console.error(
743
+ "Error handled by React Router default ErrorBoundary:",
744
+ e
745
+ ), s = /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ p.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ p.createElement("code", { style: o }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ p.createElement("code", { style: o }, "errorElement"), " prop on your route.")), /* @__PURE__ */ p.createElement(p.Fragment, null, /* @__PURE__ */ p.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ p.createElement("h3", { style: { fontStyle: "italic" } }, t), n ? /* @__PURE__ */ p.createElement("pre", { style: r }, n) : null, s);
746
+ }
747
+ var La = /* @__PURE__ */ p.createElement(xa, null), hn = class extends p.Component {
748
+ constructor(e) {
749
+ super(e), this.state = {
750
+ location: e.location,
751
+ revalidation: e.revalidation,
752
+ error: e.error
753
+ };
754
+ }
755
+ static getDerivedStateFromError(e) {
756
+ return { error: e };
757
+ }
758
+ static getDerivedStateFromProps(e, t) {
759
+ return t.location !== e.location || t.revalidation !== "idle" && e.revalidation === "idle" ? {
760
+ error: e.error,
761
+ location: e.location,
762
+ revalidation: e.revalidation
763
+ } : {
764
+ error: e.error !== void 0 ? e.error : t.error,
765
+ location: t.location,
766
+ revalidation: e.revalidation || t.revalidation
767
+ };
768
+ }
769
+ componentDidCatch(e, t) {
770
+ this.props.onError ? this.props.onError(e, t) : console.error(
771
+ "React Router caught the following error during render",
772
+ e
773
+ );
774
+ }
775
+ render() {
776
+ let e = this.state.error;
777
+ if (this.context && typeof e == "object" && e && "digest" in e && typeof e.digest == "string") {
778
+ const n = Ea(e.digest);
779
+ n && (e = n);
780
+ }
781
+ let t = e !== void 0 ? /* @__PURE__ */ p.createElement(ae.Provider, { value: this.props.routeContext }, /* @__PURE__ */ p.createElement(
782
+ gt.Provider,
783
+ {
784
+ value: e,
785
+ children: this.props.component
786
+ }
787
+ )) : this.props.children;
788
+ return this.context ? /* @__PURE__ */ p.createElement($a, { error: e }, t) : t;
789
+ }
790
+ };
791
+ hn.contextType = rn;
792
+ var tt = /* @__PURE__ */ new WeakMap();
793
+ function $a({
794
+ children: e,
795
+ error: t
796
+ }) {
797
+ let { basename: n } = p.useContext(ee);
798
+ if (typeof t == "object" && t && "digest" in t && typeof t.digest == "string") {
799
+ let a = Ra(t.digest);
800
+ if (a) {
801
+ let r = tt.get(t);
802
+ if (r) throw r;
803
+ let o = nn(a.location, n);
804
+ if (tn && !tt.get(t))
805
+ if (o.isExternal || a.reloadDocument)
806
+ window.location.href = o.absoluteURL || o.to;
807
+ else {
808
+ const s = Promise.resolve().then(
809
+ () => window.__reactRouterDataRouter.navigate(o.to, {
810
+ replace: a.replace
811
+ })
812
+ );
813
+ throw tt.set(t, s), s;
814
+ }
815
+ return /* @__PURE__ */ p.createElement(
816
+ "meta",
817
+ {
818
+ httpEquiv: "refresh",
819
+ content: `0;url=${o.absoluteURL || o.to}`
820
+ }
821
+ );
822
+ }
823
+ }
824
+ return e;
825
+ }
826
+ function Ta({ routeContext: e, match: t, children: n }) {
827
+ let a = p.useContext(Le);
828
+ return a && a.static && a.staticContext && (t.route.errorElement || t.route.ErrorBoundary) && (a.staticContext._deepestRenderedBoundaryId = t.route.id), /* @__PURE__ */ p.createElement(ae.Provider, { value: e }, n);
829
+ }
830
+ function Aa(e, t = [], n) {
831
+ let a = n?.state;
832
+ if (e == null) {
833
+ if (!a)
834
+ return null;
835
+ if (a.errors)
836
+ e = a.matches;
837
+ else if (t.length === 0 && !a.initialized && a.matches.length > 0)
838
+ e = a.matches;
839
+ else
840
+ return null;
841
+ }
842
+ let r = e, o = a?.errors;
843
+ if (o != null) {
844
+ let h = r.findIndex(
845
+ (d) => d.route.id && o?.[d.route.id] !== void 0
846
+ );
847
+ M(
848
+ h >= 0,
849
+ `Could not find a matching route for errors on route IDs: ${Object.keys(
850
+ o
851
+ ).join(",")}`
852
+ ), r = r.slice(
853
+ 0,
854
+ Math.min(r.length, h + 1)
855
+ );
856
+ }
857
+ let s = !1, l = -1;
858
+ if (n && a) {
859
+ s = a.renderFallback;
860
+ for (let h = 0; h < r.length; h++) {
861
+ let d = r[h];
862
+ if ((d.route.HydrateFallback || d.route.hydrateFallbackElement) && (l = h), d.route.id) {
863
+ let { loaderData: v, errors: b } = a, _ = d.route.loader && !v.hasOwnProperty(d.route.id) && (!b || b[d.route.id] === void 0);
864
+ if (d.route.lazy || _) {
865
+ n.isStatic && (s = !0), l >= 0 ? r = r.slice(0, l + 1) : r = [r[0]];
866
+ break;
867
+ }
868
+ }
869
+ }
870
+ }
871
+ let c = n?.onError, u = a && c ? (h, d) => {
872
+ c(h, {
873
+ location: a.location,
874
+ params: a.matches?.[0]?.params ?? {},
875
+ unstable_pattern: ya(a.matches),
876
+ errorInfo: d
877
+ });
878
+ } : void 0;
879
+ return r.reduceRight(
880
+ (h, d, v) => {
881
+ let b, _ = !1, f = null, m = null;
882
+ a && (b = o && d.route.id ? o[d.route.id] : void 0, f = d.route.errorElement || La, s && (l < 0 && v === 0 ? (mn(
883
+ "route-fallback",
884
+ !1,
885
+ "No `HydrateFallback` element provided to render during initial hydration"
886
+ ), _ = !0, m = null) : l === v && (_ = !0, m = d.route.hydrateFallbackElement || null)));
887
+ let C = t.concat(r.slice(0, v + 1)), w = () => {
888
+ let R;
889
+ return b ? R = f : _ ? R = m : d.route.Component ? R = /* @__PURE__ */ p.createElement(d.route.Component, null) : d.route.element ? R = d.route.element : R = h, /* @__PURE__ */ p.createElement(
890
+ Ta,
891
+ {
892
+ match: d,
893
+ routeContext: {
894
+ outlet: h,
895
+ matches: C,
896
+ isDataRoute: a != null
897
+ },
898
+ children: R
899
+ }
900
+ );
901
+ };
902
+ return a && (d.route.ErrorBoundary || d.route.errorElement || v === 0) ? /* @__PURE__ */ p.createElement(
903
+ hn,
904
+ {
905
+ location: a.location,
906
+ revalidation: a.revalidation,
907
+ component: f,
908
+ error: b,
909
+ children: w(),
910
+ routeContext: { outlet: null, matches: C, isDataRoute: !0 },
911
+ onError: u
912
+ }
913
+ ) : w();
914
+ },
915
+ null
916
+ );
917
+ }
918
+ function vt(e) {
919
+ return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
920
+ }
921
+ function Oa(e) {
922
+ let t = p.useContext(Le);
923
+ return M(t, vt(e)), t;
924
+ }
925
+ function Da(e) {
926
+ let t = p.useContext(ze);
927
+ return M(t, vt(e)), t;
928
+ }
929
+ function Fa(e) {
930
+ let t = p.useContext(ae);
931
+ return M(t, vt(e)), t;
932
+ }
933
+ function bt(e) {
934
+ let t = Fa(e), n = t.matches[t.matches.length - 1];
935
+ return M(
936
+ n.route.id,
937
+ `${e} can only be used on routes that contain a unique "id"`
938
+ ), n.route.id;
939
+ }
940
+ function Ua() {
941
+ return bt(
942
+ "useRouteId"
943
+ /* UseRouteId */
944
+ );
945
+ }
946
+ function Ia() {
947
+ let e = p.useContext(gt), t = Da(
948
+ "useRouteError"
949
+ /* UseRouteError */
950
+ ), n = bt(
951
+ "useRouteError"
952
+ /* UseRouteError */
953
+ );
954
+ return e !== void 0 ? e : t.errors?.[n];
955
+ }
956
+ function Ma() {
957
+ let { router: e } = Oa(
958
+ "useNavigate"
959
+ /* UseNavigateStable */
960
+ ), t = bt(
961
+ "useNavigate"
962
+ /* UseNavigateStable */
963
+ ), n = p.useRef(!1);
964
+ return cn(() => {
965
+ n.current = !0;
966
+ }), p.useCallback(
967
+ async (r, o = {}) => {
968
+ Z(n.current, ln), n.current && (typeof r == "number" ? await e.navigate(r) : await e.navigate(r, { fromRouteId: t, ...o }));
969
+ },
970
+ [e, t]
971
+ );
972
+ }
973
+ var Tt = {};
974
+ function mn(e, t, n) {
975
+ !t && !Tt[e] && (Tt[e] = !0, Z(!1, n));
976
+ }
977
+ p.memo(Ba);
978
+ function Ba({
979
+ routes: e,
980
+ future: t,
981
+ state: n,
982
+ isStatic: a,
983
+ onError: r
984
+ }) {
985
+ return pn(e, void 0, { state: n, isStatic: a, onError: r });
986
+ }
987
+ function fn({
988
+ to: e,
989
+ replace: t,
990
+ state: n,
991
+ relative: a
992
+ }) {
993
+ M(
994
+ $e(),
995
+ // TODO: This error is probably because they somehow have 2 versions of
996
+ // the router loaded. We can help them understand how to avoid that.
997
+ "<Navigate> may be used only in the context of a <Router> component."
998
+ );
999
+ let { static: r } = p.useContext(ee);
1000
+ Z(
1001
+ !r,
1002
+ "<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change."
1003
+ );
1004
+ let { matches: o } = p.useContext(ae), { pathname: s } = te(), l = ve(), c = Ge(
1005
+ e,
1006
+ yt(o),
1007
+ s,
1008
+ a === "path"
1009
+ ), u = JSON.stringify(c);
1010
+ return p.useEffect(() => {
1011
+ l(JSON.parse(u), { replace: t, state: n, relative: a });
1012
+ }, [l, u, a, t, n]), null;
1013
+ }
1014
+ function yn(e) {
1015
+ return Sa(e.context);
1016
+ }
1017
+ function Q(e) {
1018
+ M(
1019
+ !1,
1020
+ "A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>."
1021
+ );
1022
+ }
1023
+ function Ha({
1024
+ basename: e = "/",
1025
+ children: t = null,
1026
+ location: n,
1027
+ navigationType: a = "POP",
1028
+ navigator: r,
1029
+ static: o = !1,
1030
+ unstable_useTransitions: s
1031
+ }) {
1032
+ M(
1033
+ !$e(),
1034
+ "You cannot render a <Router> inside another <Router>. You should never have more than one in your app."
1035
+ );
1036
+ let l = e.replace(/^\/*/, "/"), c = p.useMemo(
1037
+ () => ({
1038
+ basename: l,
1039
+ navigator: r,
1040
+ static: o,
1041
+ unstable_useTransitions: s,
1042
+ future: {}
1043
+ }),
1044
+ [l, r, o, s]
1045
+ );
1046
+ typeof n == "string" && (n = Ne(n));
1047
+ let {
1048
+ pathname: u = "/",
1049
+ search: h = "",
1050
+ hash: d = "",
1051
+ state: v = null,
1052
+ key: b = "default",
1053
+ unstable_mask: _
1054
+ } = n, f = p.useMemo(() => {
1055
+ let m = de(u, l);
1056
+ return m == null ? null : {
1057
+ location: {
1058
+ pathname: m,
1059
+ search: h,
1060
+ hash: d,
1061
+ state: v,
1062
+ key: b,
1063
+ unstable_mask: _
1064
+ },
1065
+ navigationType: a
1066
+ };
1067
+ }, [
1068
+ l,
1069
+ u,
1070
+ h,
1071
+ d,
1072
+ v,
1073
+ b,
1074
+ a,
1075
+ _
1076
+ ]);
1077
+ return Z(
1078
+ f != null,
1079
+ `<Router basename="${l}"> is not able to match the URL "${u}${h}${d}" because it does not start with the basename, so the <Router> won't render anything.`
1080
+ ), f == null ? null : /* @__PURE__ */ p.createElement(ee.Provider, { value: c }, /* @__PURE__ */ p.createElement(Ue.Provider, { children: t, value: f }));
1081
+ }
1082
+ function Wa({
1083
+ children: e,
1084
+ location: t
1085
+ }) {
1086
+ return Pa(lt(e), t);
1087
+ }
1088
+ function lt(e, t = []) {
1089
+ let n = [];
1090
+ return p.Children.forEach(e, (a, r) => {
1091
+ if (!p.isValidElement(a))
1092
+ return;
1093
+ let o = [...t, r];
1094
+ if (a.type === p.Fragment) {
1095
+ n.push.apply(
1096
+ n,
1097
+ lt(a.props.children, o)
1098
+ );
1099
+ return;
1100
+ }
1101
+ M(
1102
+ a.type === Q,
1103
+ `[${typeof a.type == "string" ? a.type : a.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`
1104
+ ), M(
1105
+ !a.props.index || !a.props.children,
1106
+ "An index route cannot have child routes."
1107
+ );
1108
+ let s = {
1109
+ id: a.props.id || o.join("-"),
1110
+ caseSensitive: a.props.caseSensitive,
1111
+ element: a.props.element,
1112
+ Component: a.props.Component,
1113
+ index: a.props.index,
1114
+ path: a.props.path,
1115
+ middleware: a.props.middleware,
1116
+ loader: a.props.loader,
1117
+ action: a.props.action,
1118
+ hydrateFallbackElement: a.props.hydrateFallbackElement,
1119
+ HydrateFallback: a.props.HydrateFallback,
1120
+ errorElement: a.props.errorElement,
1121
+ ErrorBoundary: a.props.ErrorBoundary,
1122
+ hasErrorBoundary: a.props.hasErrorBoundary === !0 || a.props.ErrorBoundary != null || a.props.errorElement != null,
1123
+ shouldRevalidate: a.props.shouldRevalidate,
1124
+ handle: a.props.handle,
1125
+ lazy: a.props.lazy
1126
+ };
1127
+ a.props.children && (s.children = lt(
1128
+ a.props.children,
1129
+ o
1130
+ )), n.push(s);
1131
+ }), n;
1132
+ }
1133
+ var We = "get", Je = "application/x-www-form-urlencoded";
1134
+ function Ye(e) {
1135
+ return typeof HTMLElement < "u" && e instanceof HTMLElement;
1136
+ }
1137
+ function Ja(e) {
1138
+ return Ye(e) && e.tagName.toLowerCase() === "button";
1139
+ }
1140
+ function qa(e) {
1141
+ return Ye(e) && e.tagName.toLowerCase() === "form";
1142
+ }
1143
+ function Ka(e) {
1144
+ return Ye(e) && e.tagName.toLowerCase() === "input";
1145
+ }
1146
+ function Va(e) {
1147
+ return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
1148
+ }
1149
+ function Ga(e, t) {
1150
+ return e.button === 0 && // Ignore everything but left clicks
1151
+ (!t || t === "_self") && // Let browser handle "target=_blank" etc.
1152
+ !Va(e);
1153
+ }
1154
+ function ct(e = "") {
1155
+ return new URLSearchParams(
1156
+ typeof e == "string" || Array.isArray(e) || e instanceof URLSearchParams ? e : Object.keys(e).reduce((t, n) => {
1157
+ let a = e[n];
1158
+ return t.concat(
1159
+ Array.isArray(a) ? a.map((r) => [n, r]) : [[n, a]]
1160
+ );
1161
+ }, [])
1162
+ );
1163
+ }
1164
+ function za(e, t) {
1165
+ let n = ct(e);
1166
+ return t && t.forEach((a, r) => {
1167
+ n.has(r) || t.getAll(r).forEach((o) => {
1168
+ n.append(r, o);
1169
+ });
1170
+ }), n;
1171
+ }
1172
+ var Be = null;
1173
+ function Ya() {
1174
+ if (Be === null)
1175
+ try {
1176
+ new FormData(
1177
+ document.createElement("form"),
1178
+ // @ts-expect-error if FormData supports the submitter parameter, this will throw
1179
+ 0
1180
+ ), Be = !1;
1181
+ } catch {
1182
+ Be = !0;
1183
+ }
1184
+ return Be;
1185
+ }
1186
+ var Qa = /* @__PURE__ */ new Set([
1187
+ "application/x-www-form-urlencoded",
1188
+ "multipart/form-data",
1189
+ "text/plain"
1190
+ ]);
1191
+ function nt(e) {
1192
+ return e != null && !Qa.has(e) ? (Z(
1193
+ !1,
1194
+ `"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${Je}"`
1195
+ ), null) : e;
1196
+ }
1197
+ function Xa(e, t) {
1198
+ let n, a, r, o, s;
1199
+ if (qa(e)) {
1200
+ let l = e.getAttribute("action");
1201
+ a = l ? de(l, t) : null, n = e.getAttribute("method") || We, r = nt(e.getAttribute("enctype")) || Je, o = new FormData(e);
1202
+ } else if (Ja(e) || Ka(e) && (e.type === "submit" || e.type === "image")) {
1203
+ let l = e.form;
1204
+ if (l == null)
1205
+ throw new Error(
1206
+ 'Cannot submit a <button> or <input type="submit"> without a <form>'
1207
+ );
1208
+ let c = e.getAttribute("formaction") || l.getAttribute("action");
1209
+ if (a = c ? de(c, t) : null, n = e.getAttribute("formmethod") || l.getAttribute("method") || We, r = nt(e.getAttribute("formenctype")) || nt(l.getAttribute("enctype")) || Je, o = new FormData(l, e), !Ya()) {
1210
+ let { name: u, type: h, value: d } = e;
1211
+ if (h === "image") {
1212
+ let v = u ? `${u}.` : "";
1213
+ o.append(`${v}x`, "0"), o.append(`${v}y`, "0");
1214
+ } else u && o.append(u, d);
1215
+ }
1216
+ } else {
1217
+ if (Ye(e))
1218
+ throw new Error(
1219
+ 'Cannot submit element that is not <form>, <button>, or <input type="submit|image">'
1220
+ );
1221
+ n = We, a = null, r = Je, s = e;
1222
+ }
1223
+ return o && r === "text/plain" && (s = o, o = void 0), { action: a, method: n.toLowerCase(), encType: r, formData: o, body: s };
1224
+ }
1225
+ Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
1226
+ function wt(e, t) {
1227
+ if (e === !1 || e === null || typeof e > "u")
1228
+ throw new Error(t);
1229
+ }
1230
+ function gn(e, t, n, a) {
1231
+ let r = typeof e == "string" ? new URL(
1232
+ e,
1233
+ // This can be called during the SSR flow via PrefetchPageLinksImpl so
1234
+ // don't assume window is available
1235
+ typeof window > "u" ? "server://singlefetch/" : window.location.origin
1236
+ ) : e;
1237
+ return n ? r.pathname.endsWith("/") ? r.pathname = `${r.pathname}_.${a}` : r.pathname = `${r.pathname}.${a}` : r.pathname === "/" ? r.pathname = `_root.${a}` : t && de(r.pathname, t) === "/" ? r.pathname = `${Ve(t)}/_root.${a}` : r.pathname = `${Ve(r.pathname)}.${a}`, r;
1238
+ }
1239
+ async function Za(e, t) {
1240
+ if (e.id in t)
1241
+ return t[e.id];
1242
+ try {
1243
+ let n = await import(
1244
+ /* @vite-ignore */
1245
+ /* webpackIgnore: true */
1246
+ e.module
1247
+ );
1248
+ return t[e.id] = n, n;
1249
+ } catch (n) {
1250
+ return console.error(
1251
+ `Error loading route module \`${e.module}\`, reloading page...`
1252
+ ), console.error(n), window.__reactRouterContext && window.__reactRouterContext.isSpaMode, window.location.reload(), new Promise(() => {
1253
+ });
1254
+ }
1255
+ }
1256
+ function er(e) {
1257
+ return e == null ? !1 : e.href == null ? e.rel === "preload" && typeof e.imageSrcSet == "string" && typeof e.imageSizes == "string" : typeof e.rel == "string" && typeof e.href == "string";
1258
+ }
1259
+ async function tr(e, t, n) {
1260
+ let a = await Promise.all(
1261
+ e.map(async (r) => {
1262
+ let o = t.routes[r.route.id];
1263
+ if (o) {
1264
+ let s = await Za(o, n);
1265
+ return s.links ? s.links() : [];
1266
+ }
1267
+ return [];
1268
+ })
1269
+ );
1270
+ return or(
1271
+ a.flat(1).filter(er).filter((r) => r.rel === "stylesheet" || r.rel === "preload").map(
1272
+ (r) => r.rel === "stylesheet" ? { ...r, rel: "prefetch", as: "style" } : { ...r, rel: "prefetch" }
1273
+ )
1274
+ );
1275
+ }
1276
+ function At(e, t, n, a, r, o) {
1277
+ let s = (c, u) => n[u] ? c.route.id !== n[u].route.id : !0, l = (c, u) => (
1278
+ // param change, /users/123 -> /users/456
1279
+ n[u].pathname !== c.pathname || // splat param changed, which is not present in match.path
1280
+ // e.g. /files/images/avatar.jpg -> files/finances.xls
1281
+ n[u].route.path?.endsWith("*") && n[u].params["*"] !== c.params["*"]
1282
+ );
1283
+ return o === "assets" ? t.filter(
1284
+ (c, u) => s(c, u) || l(c, u)
1285
+ ) : o === "data" ? t.filter((c, u) => {
1286
+ let h = a.routes[c.route.id];
1287
+ if (!h || !h.hasLoader)
1288
+ return !1;
1289
+ if (s(c, u) || l(c, u))
1290
+ return !0;
1291
+ if (c.route.shouldRevalidate) {
1292
+ let d = c.route.shouldRevalidate({
1293
+ currentUrl: new URL(
1294
+ r.pathname + r.search + r.hash,
1295
+ window.origin
1296
+ ),
1297
+ currentParams: n[0]?.params || {},
1298
+ nextUrl: new URL(e, window.origin),
1299
+ nextParams: c.params,
1300
+ defaultShouldRevalidate: !0
1301
+ });
1302
+ if (typeof d == "boolean")
1303
+ return d;
1304
+ }
1305
+ return !0;
1306
+ }) : [];
1307
+ }
1308
+ function nr(e, t, { includeHydrateFallback: n } = {}) {
1309
+ return ar(
1310
+ e.map((a) => {
1311
+ let r = t.routes[a.route.id];
1312
+ if (!r) return [];
1313
+ let o = [r.module];
1314
+ return r.clientActionModule && (o = o.concat(r.clientActionModule)), r.clientLoaderModule && (o = o.concat(r.clientLoaderModule)), n && r.hydrateFallbackModule && (o = o.concat(r.hydrateFallbackModule)), r.imports && (o = o.concat(r.imports)), o;
1315
+ }).flat(1)
1316
+ );
1317
+ }
1318
+ function ar(e) {
1319
+ return [...new Set(e)];
1320
+ }
1321
+ function rr(e) {
1322
+ let t = {}, n = Object.keys(e).sort();
1323
+ for (let a of n)
1324
+ t[a] = e[a];
1325
+ return t;
1326
+ }
1327
+ function or(e, t) {
1328
+ let n = /* @__PURE__ */ new Set();
1329
+ return new Set(t), e.reduce((a, r) => {
1330
+ let o = JSON.stringify(rr(r));
1331
+ return n.has(o) || (n.add(o), a.push({ key: o, link: r })), a;
1332
+ }, []);
1333
+ }
1334
+ function _t() {
1335
+ let e = p.useContext(Le);
1336
+ return wt(
1337
+ e,
1338
+ "You must render this element inside a <DataRouterContext.Provider> element"
1339
+ ), e;
1340
+ }
1341
+ function ir() {
1342
+ let e = p.useContext(ze);
1343
+ return wt(
1344
+ e,
1345
+ "You must render this element inside a <DataRouterStateContext.Provider> element"
1346
+ ), e;
1347
+ }
1348
+ var kt = p.createContext(void 0);
1349
+ kt.displayName = "FrameworkContext";
1350
+ function Rt() {
1351
+ let e = p.useContext(kt);
1352
+ return wt(
1353
+ e,
1354
+ "You must render this element inside a <HydratedRouter> element"
1355
+ ), e;
1356
+ }
1357
+ function sr(e, t) {
1358
+ let n = p.useContext(kt), [a, r] = p.useState(!1), [o, s] = p.useState(!1), { onFocus: l, onBlur: c, onMouseEnter: u, onMouseLeave: h, onTouchStart: d } = t, v = p.useRef(null);
1359
+ p.useEffect(() => {
1360
+ if (e === "render" && s(!0), e === "viewport") {
1361
+ let f = (C) => {
1362
+ C.forEach((w) => {
1363
+ s(w.isIntersecting);
1364
+ });
1365
+ }, m = new IntersectionObserver(f, { threshold: 0.5 });
1366
+ return v.current && m.observe(v.current), () => {
1367
+ m.disconnect();
1368
+ };
1369
+ }
1370
+ }, [e]), p.useEffect(() => {
1371
+ if (a) {
1372
+ let f = setTimeout(() => {
1373
+ s(!0);
1374
+ }, 100);
1375
+ return () => {
1376
+ clearTimeout(f);
1377
+ };
1378
+ }
1379
+ }, [a]);
1380
+ let b = () => {
1381
+ r(!0);
1382
+ }, _ = () => {
1383
+ r(!1), s(!1);
1384
+ };
1385
+ return n ? e !== "intent" ? [o, v, {}] : [
1386
+ o,
1387
+ v,
1388
+ {
1389
+ onFocus: Ae(l, b),
1390
+ onBlur: Ae(c, _),
1391
+ onMouseEnter: Ae(u, b),
1392
+ onMouseLeave: Ae(h, _),
1393
+ onTouchStart: Ae(d, b)
1394
+ }
1395
+ ] : [!1, v, {}];
1396
+ }
1397
+ function Ae(e, t) {
1398
+ return (n) => {
1399
+ e && e(n), n.defaultPrevented || t(n);
1400
+ };
1401
+ }
1402
+ function lr({ page: e, ...t }) {
1403
+ let n = va(), { router: a } = _t(), r = p.useMemo(
1404
+ () => Qt(a.routes, e, a.basename),
1405
+ [a.routes, e, a.basename]
1406
+ );
1407
+ return r ? n ? /* @__PURE__ */ p.createElement(ur, { page: e, matches: r, ...t }) : /* @__PURE__ */ p.createElement(dr, { page: e, matches: r, ...t }) : null;
1408
+ }
1409
+ function cr(e) {
1410
+ let { manifest: t, routeModules: n } = Rt(), [a, r] = p.useState([]);
1411
+ return p.useEffect(() => {
1412
+ let o = !1;
1413
+ return tr(e, t, n).then(
1414
+ (s) => {
1415
+ o || r(s);
1416
+ }
1417
+ ), () => {
1418
+ o = !0;
1419
+ };
1420
+ }, [e, t, n]), a;
1421
+ }
1422
+ function ur({
1423
+ page: e,
1424
+ matches: t,
1425
+ ...n
1426
+ }) {
1427
+ let a = te(), { future: r } = Rt(), { basename: o } = _t(), s = p.useMemo(() => {
1428
+ if (e === a.pathname + a.search + a.hash)
1429
+ return [];
1430
+ let l = gn(
1431
+ e,
1432
+ o,
1433
+ r.unstable_trailingSlashAwareDataRequests,
1434
+ "rsc"
1435
+ ), c = !1, u = [];
1436
+ for (let h of t)
1437
+ typeof h.route.shouldRevalidate == "function" ? c = !0 : u.push(h.route.id);
1438
+ return c && u.length > 0 && l.searchParams.set("_routes", u.join(",")), [l.pathname + l.search];
1439
+ }, [
1440
+ o,
1441
+ r.unstable_trailingSlashAwareDataRequests,
1442
+ e,
1443
+ a,
1444
+ t
1445
+ ]);
1446
+ return /* @__PURE__ */ p.createElement(p.Fragment, null, s.map((l) => /* @__PURE__ */ p.createElement("link", { key: l, rel: "prefetch", as: "fetch", href: l, ...n })));
1447
+ }
1448
+ function dr({
1449
+ page: e,
1450
+ matches: t,
1451
+ ...n
1452
+ }) {
1453
+ let a = te(), { future: r, manifest: o, routeModules: s } = Rt(), { basename: l } = _t(), { loaderData: c, matches: u } = ir(), h = p.useMemo(
1454
+ () => At(
1455
+ e,
1456
+ t,
1457
+ u,
1458
+ o,
1459
+ a,
1460
+ "data"
1461
+ ),
1462
+ [e, t, u, o, a]
1463
+ ), d = p.useMemo(
1464
+ () => At(
1465
+ e,
1466
+ t,
1467
+ u,
1468
+ o,
1469
+ a,
1470
+ "assets"
1471
+ ),
1472
+ [e, t, u, o, a]
1473
+ ), v = p.useMemo(() => {
1474
+ if (e === a.pathname + a.search + a.hash)
1475
+ return [];
1476
+ let f = /* @__PURE__ */ new Set(), m = !1;
1477
+ if (t.forEach((w) => {
1478
+ let R = o.routes[w.route.id];
1479
+ !R || !R.hasLoader || (!h.some(($) => $.route.id === w.route.id) && w.route.id in c && s[w.route.id]?.shouldRevalidate || R.hasClientLoader ? m = !0 : f.add(w.route.id));
1480
+ }), f.size === 0)
1481
+ return [];
1482
+ let C = gn(
1483
+ e,
1484
+ l,
1485
+ r.unstable_trailingSlashAwareDataRequests,
1486
+ "data"
1487
+ );
1488
+ return m && f.size > 0 && C.searchParams.set(
1489
+ "_routes",
1490
+ t.filter((w) => f.has(w.route.id)).map((w) => w.route.id).join(",")
1491
+ ), [C.pathname + C.search];
1492
+ }, [
1493
+ l,
1494
+ r.unstable_trailingSlashAwareDataRequests,
1495
+ c,
1496
+ a,
1497
+ o,
1498
+ h,
1499
+ t,
1500
+ e,
1501
+ s
1502
+ ]), b = p.useMemo(
1503
+ () => nr(d, o),
1504
+ [d, o]
1505
+ ), _ = cr(d);
1506
+ return /* @__PURE__ */ p.createElement(p.Fragment, null, v.map((f) => /* @__PURE__ */ p.createElement("link", { key: f, rel: "prefetch", as: "fetch", href: f, ...n })), b.map((f) => /* @__PURE__ */ p.createElement("link", { key: f, rel: "modulepreload", href: f, ...n })), _.map(({ key: f, link: m }) => (
1507
+ // these don't spread `linkProps` because they are full link descriptors
1508
+ // already with their own props
1509
+ /* @__PURE__ */ p.createElement(
1510
+ "link",
1511
+ {
1512
+ key: f,
1513
+ nonce: n.nonce,
1514
+ ...m,
1515
+ crossOrigin: m.crossOrigin ?? n.crossOrigin
1516
+ }
1517
+ )
1518
+ )));
1519
+ }
1520
+ function pr(...e) {
1521
+ return (t) => {
1522
+ e.forEach((n) => {
1523
+ typeof n == "function" ? n(t) : n != null && (n.current = t);
1524
+ });
1525
+ };
1526
+ }
1527
+ var hr = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u";
1528
+ try {
1529
+ hr && (window.__reactRouterVersion = // @ts-expect-error
1530
+ "7.14.1");
1531
+ } catch {
1532
+ }
1533
+ function mr({
1534
+ basename: e,
1535
+ children: t,
1536
+ unstable_useTransitions: n,
1537
+ window: a
1538
+ }) {
1539
+ let r = p.useRef();
1540
+ r.current == null && (r.current = qn({ window: a, v5Compat: !0 }));
1541
+ let o = r.current, [s, l] = p.useState({
1542
+ action: o.action,
1543
+ location: o.location
1544
+ }), c = p.useCallback(
1545
+ (u) => {
1546
+ n === !1 ? l(u) : p.startTransition(() => l(u));
1547
+ },
1548
+ [n]
1549
+ );
1550
+ return p.useLayoutEffect(() => o.listen(c), [o, c]), /* @__PURE__ */ p.createElement(
1551
+ Ha,
1552
+ {
1553
+ basename: e,
1554
+ children: t,
1555
+ location: s.location,
1556
+ navigationType: s.action,
1557
+ navigator: o,
1558
+ unstable_useTransitions: n
1559
+ }
1560
+ );
1561
+ }
1562
+ var vn = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i, me = p.forwardRef(
1563
+ function({
1564
+ onClick: t,
1565
+ discover: n = "render",
1566
+ prefetch: a = "none",
1567
+ relative: r,
1568
+ reloadDocument: o,
1569
+ replace: s,
1570
+ unstable_mask: l,
1571
+ state: c,
1572
+ target: u,
1573
+ to: h,
1574
+ preventScrollReset: d,
1575
+ viewTransition: v,
1576
+ unstable_defaultShouldRevalidate: b,
1577
+ ..._
1578
+ }, f) {
1579
+ let { basename: m, navigator: C, unstable_useTransitions: w } = p.useContext(ee), R = typeof h == "string" && vn.test(h), $ = nn(h, m);
1580
+ h = $.to;
1581
+ let x = Na(h, { relative: r }), F = te(), J = null;
1582
+ if (l) {
1583
+ let T = Ge(
1584
+ l,
1585
+ [],
1586
+ F.unstable_mask ? F.unstable_mask.pathname : "/",
1587
+ !0
1588
+ );
1589
+ m !== "/" && (T.pathname = T.pathname === "/" ? m : oe([m, T.pathname])), J = C.createHref(T);
1590
+ }
1591
+ let [H, P, A] = sr(
1592
+ a,
1593
+ _
1594
+ ), B = vr(h, {
1595
+ replace: s,
1596
+ unstable_mask: l,
1597
+ state: c,
1598
+ target: u,
1599
+ preventScrollReset: d,
1600
+ relative: r,
1601
+ viewTransition: v,
1602
+ unstable_defaultShouldRevalidate: b,
1603
+ unstable_useTransitions: w
1604
+ });
1605
+ function k(T) {
1606
+ t && t(T), T.defaultPrevented || B(T);
1607
+ }
1608
+ let U = !($.isExternal || o), W = (
1609
+ // eslint-disable-next-line jsx-a11y/anchor-has-content
1610
+ /* @__PURE__ */ p.createElement(
1611
+ "a",
1612
+ {
1613
+ ..._,
1614
+ ...A,
1615
+ href: (U ? J : void 0) || $.absoluteURL || x,
1616
+ onClick: U ? k : t,
1617
+ ref: pr(f, P),
1618
+ target: u,
1619
+ "data-discover": !R && n === "render" ? "true" : void 0
1620
+ }
1621
+ )
1622
+ );
1623
+ return H && !R ? /* @__PURE__ */ p.createElement(p.Fragment, null, W, /* @__PURE__ */ p.createElement(lr, { page: x })) : W;
1624
+ }
1625
+ );
1626
+ me.displayName = "Link";
1627
+ var fr = p.forwardRef(
1628
+ function({
1629
+ "aria-current": t = "page",
1630
+ caseSensitive: n = !1,
1631
+ className: a = "",
1632
+ end: r = !1,
1633
+ style: o,
1634
+ to: s,
1635
+ viewTransition: l,
1636
+ children: c,
1637
+ ...u
1638
+ }, h) {
1639
+ let d = Ie(s, { relative: u.relative }), v = te(), b = p.useContext(ze), { navigator: _, basename: f } = p.useContext(ee), m = b != null && // Conditional usage is OK here because the usage of a data router is static
1640
+ // eslint-disable-next-line react-hooks/rules-of-hooks
1641
+ Rr(d) && l === !0, C = _.encodeLocation ? _.encodeLocation(d).pathname : d.pathname, w = v.pathname, R = b && b.navigation && b.navigation.location ? b.navigation.location.pathname : null;
1642
+ n || (w = w.toLowerCase(), R = R ? R.toLowerCase() : null, C = C.toLowerCase()), R && f && (R = de(R, f) || R);
1643
+ const $ = C !== "/" && C.endsWith("/") ? C.length - 1 : C.length;
1644
+ let x = w === C || !r && w.startsWith(C) && w.charAt($) === "/", F = R != null && (R === C || !r && R.startsWith(C) && R.charAt(C.length) === "/"), J = {
1645
+ isActive: x,
1646
+ isPending: F,
1647
+ isTransitioning: m
1648
+ }, H = x ? t : void 0, P;
1649
+ typeof a == "function" ? P = a(J) : P = [
1650
+ a,
1651
+ x ? "active" : null,
1652
+ F ? "pending" : null,
1653
+ m ? "transitioning" : null
1654
+ ].filter(Boolean).join(" ");
1655
+ let A = typeof o == "function" ? o(J) : o;
1656
+ return /* @__PURE__ */ p.createElement(
1657
+ me,
1658
+ {
1659
+ ...u,
1660
+ "aria-current": H,
1661
+ className: P,
1662
+ ref: h,
1663
+ style: A,
1664
+ to: s,
1665
+ viewTransition: l
1666
+ },
1667
+ typeof c == "function" ? c(J) : c
1668
+ );
1669
+ }
1670
+ );
1671
+ fr.displayName = "NavLink";
1672
+ var yr = p.forwardRef(
1673
+ ({
1674
+ discover: e = "render",
1675
+ fetcherKey: t,
1676
+ navigate: n,
1677
+ reloadDocument: a,
1678
+ replace: r,
1679
+ state: o,
1680
+ method: s = We,
1681
+ action: l,
1682
+ onSubmit: c,
1683
+ relative: u,
1684
+ preventScrollReset: h,
1685
+ viewTransition: d,
1686
+ unstable_defaultShouldRevalidate: v,
1687
+ ...b
1688
+ }, _) => {
1689
+ let { unstable_useTransitions: f } = p.useContext(ee), m = _r(), C = kr(l, { relative: u }), w = s.toLowerCase() === "get" ? "get" : "post", R = typeof l == "string" && vn.test(l), $ = (x) => {
1690
+ if (c && c(x), x.defaultPrevented) return;
1691
+ x.preventDefault();
1692
+ let F = x.nativeEvent.submitter, J = F?.getAttribute("formmethod") || s, H = () => m(F || x.currentTarget, {
1693
+ fetcherKey: t,
1694
+ method: J,
1695
+ navigate: n,
1696
+ replace: r,
1697
+ state: o,
1698
+ relative: u,
1699
+ preventScrollReset: h,
1700
+ viewTransition: d,
1701
+ unstable_defaultShouldRevalidate: v
1702
+ });
1703
+ f && n !== !1 ? p.startTransition(() => H()) : H();
1704
+ };
1705
+ return /* @__PURE__ */ p.createElement(
1706
+ "form",
1707
+ {
1708
+ ref: _,
1709
+ method: w,
1710
+ action: C,
1711
+ onSubmit: a ? c : $,
1712
+ ...b,
1713
+ "data-discover": !R && e === "render" ? "true" : void 0
1714
+ }
1715
+ );
1716
+ }
1717
+ );
1718
+ yr.displayName = "Form";
1719
+ function gr(e) {
1720
+ return `${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
1721
+ }
1722
+ function bn(e) {
1723
+ let t = p.useContext(Le);
1724
+ return M(t, gr(e)), t;
1725
+ }
1726
+ function vr(e, {
1727
+ target: t,
1728
+ replace: n,
1729
+ unstable_mask: a,
1730
+ state: r,
1731
+ preventScrollReset: o,
1732
+ relative: s,
1733
+ viewTransition: l,
1734
+ unstable_defaultShouldRevalidate: c,
1735
+ unstable_useTransitions: u
1736
+ } = {}) {
1737
+ let h = ve(), d = te(), v = Ie(e, { relative: s });
1738
+ return p.useCallback(
1739
+ (b) => {
1740
+ if (Ga(b, t)) {
1741
+ b.preventDefault();
1742
+ let _ = n !== void 0 ? n : Oe(d) === Oe(v), f = () => h(e, {
1743
+ replace: _,
1744
+ unstable_mask: a,
1745
+ state: r,
1746
+ preventScrollReset: o,
1747
+ relative: s,
1748
+ viewTransition: l,
1749
+ unstable_defaultShouldRevalidate: c
1750
+ });
1751
+ u ? p.startTransition(() => f()) : f();
1752
+ }
1753
+ },
1754
+ [
1755
+ d,
1756
+ h,
1757
+ v,
1758
+ n,
1759
+ a,
1760
+ r,
1761
+ t,
1762
+ e,
1763
+ o,
1764
+ s,
1765
+ l,
1766
+ c,
1767
+ u
1768
+ ]
1769
+ );
1770
+ }
1771
+ function wn(e) {
1772
+ Z(
1773
+ typeof URLSearchParams < "u",
1774
+ "You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params."
1775
+ );
1776
+ let t = p.useRef(ct(e)), n = p.useRef(!1), a = te(), r = p.useMemo(
1777
+ () => (
1778
+ // Only merge in the defaults if we haven't yet called setSearchParams.
1779
+ // Once we call that we want those to take precedence, otherwise you can't
1780
+ // remove a param with setSearchParams({}) if it has an initial value
1781
+ za(
1782
+ a.search,
1783
+ n.current ? null : t.current
1784
+ )
1785
+ ),
1786
+ [a.search]
1787
+ ), o = ve(), s = p.useCallback(
1788
+ (l, c) => {
1789
+ const u = ct(
1790
+ typeof l == "function" ? l(new URLSearchParams(r)) : l
1791
+ );
1792
+ n.current = !0, o("?" + u, c);
1793
+ },
1794
+ [o, r]
1795
+ );
1796
+ return [r, s];
1797
+ }
1798
+ var br = 0, wr = () => `__${String(++br)}__`;
1799
+ function _r() {
1800
+ let { router: e } = bn(
1801
+ "useSubmit"
1802
+ /* UseSubmit */
1803
+ ), { basename: t } = p.useContext(ee), n = Ua(), a = e.fetch, r = e.navigate;
1804
+ return p.useCallback(
1805
+ async (o, s = {}) => {
1806
+ let { action: l, method: c, encType: u, formData: h, body: d } = Xa(
1807
+ o,
1808
+ t
1809
+ );
1810
+ if (s.navigate === !1) {
1811
+ let v = s.fetcherKey || wr();
1812
+ await a(v, n, s.action || l, {
1813
+ unstable_defaultShouldRevalidate: s.unstable_defaultShouldRevalidate,
1814
+ preventScrollReset: s.preventScrollReset,
1815
+ formData: h,
1816
+ body: d,
1817
+ formMethod: s.method || c,
1818
+ formEncType: s.encType || u,
1819
+ flushSync: s.flushSync
1820
+ });
1821
+ } else
1822
+ await r(s.action || l, {
1823
+ unstable_defaultShouldRevalidate: s.unstable_defaultShouldRevalidate,
1824
+ preventScrollReset: s.preventScrollReset,
1825
+ formData: h,
1826
+ body: d,
1827
+ formMethod: s.method || c,
1828
+ formEncType: s.encType || u,
1829
+ replace: s.replace,
1830
+ state: s.state,
1831
+ fromRouteId: n,
1832
+ flushSync: s.flushSync,
1833
+ viewTransition: s.viewTransition
1834
+ });
1835
+ },
1836
+ [a, r, t, n]
1837
+ );
1838
+ }
1839
+ function kr(e, { relative: t } = {}) {
1840
+ let { basename: n } = p.useContext(ee), a = p.useContext(ae);
1841
+ M(a, "useFormAction must be used inside a RouteContext");
1842
+ let [r] = a.matches.slice(-1), o = { ...Ie(e || ".", { relative: t }) }, s = te();
1843
+ if (e == null) {
1844
+ o.search = s.search;
1845
+ let l = new URLSearchParams(o.search), c = l.getAll("index");
1846
+ if (c.some((h) => h === "")) {
1847
+ l.delete("index"), c.filter((d) => d).forEach((d) => l.append("index", d));
1848
+ let h = l.toString();
1849
+ o.search = h ? `?${h}` : "";
1850
+ }
1851
+ }
1852
+ return (!e || e === ".") && r.route.index && (o.search = o.search ? o.search.replace(/^\?/, "?index&") : "?index"), n !== "/" && (o.pathname = o.pathname === "/" ? n : oe([n, o.pathname])), Oe(o);
1853
+ }
1854
+ function Rr(e, { relative: t } = {}) {
1855
+ let n = p.useContext(on);
1856
+ M(
1857
+ n != null,
1858
+ "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
1859
+ );
1860
+ let { basename: a } = bn(
1861
+ "useViewTransitionState"
1862
+ /* useViewTransitionState */
1863
+ ), r = Ie(e, { relative: t });
1864
+ if (!n.isTransitioning)
1865
+ return !1;
1866
+ let o = de(n.currentLocation.pathname, a) || n.currentLocation.pathname, s = de(n.nextLocation.pathname, a) || n.nextLocation.pathname;
1867
+ return Ke(r.pathname, s) != null || Ke(r.pathname, o) != null;
1868
+ }
1869
+ const ut = 25, Er = 200, Nr = 5e3, Cr = [
1870
+ "[data-telemetry]",
1871
+ "button",
1872
+ "a[href]",
1873
+ "summary",
1874
+ "label",
1875
+ '[role="button"]',
1876
+ '[role="tab"]',
1877
+ '[role="menuitem"]',
1878
+ '[role="option"]',
1879
+ '[role="switch"]',
1880
+ '[role="checkbox"]',
1881
+ '[role="link"]',
1882
+ 'input[type="checkbox"]',
1883
+ 'input[type="radio"]',
1884
+ 'input[type="submit"]',
1885
+ 'input[type="button"]'
1886
+ ].join(",");
1887
+ let _n = "/jobplatform/api/telemetry", kn = "jobplatform", dt = "", Re = [], Ot, Dt = !1;
1888
+ function Me(e) {
1889
+ return e.replace(/\s+/g, " ").trim().slice(0, Er);
1890
+ }
1891
+ function jr() {
1892
+ const e = new Uint8Array(12);
1893
+ return crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
1894
+ }
1895
+ function Sr() {
1896
+ return Me(location.hash || location.pathname);
1897
+ }
1898
+ function ye(e, t = {}, n = "info") {
1899
+ const a = { route: Sr() };
1900
+ for (const [r, o] of Object.entries(t))
1901
+ o !== void 0 && (a[r] = typeof o == "string" ? Me(o) : o);
1902
+ Re.push({ event: e, level: n, at: Date.now(), props: a }), Re.length >= ut && xe();
1903
+ }
1904
+ function xe() {
1905
+ if (!dt || Re.length === 0) return;
1906
+ const e = Re.slice(0, ut);
1907
+ Re = Re.slice(ut), fetch(_n, {
1908
+ method: "POST",
1909
+ credentials: "include",
1910
+ keepalive: !0,
1911
+ headers: { "Content-Type": "application/json" },
1912
+ body: JSON.stringify({ app: kn, session: dt, events: e })
1913
+ }).then((t) => {
1914
+ t.ok || Ft(`relay answered ${t.status}`);
1915
+ }).catch((t) => Ft(t instanceof Error ? t.message : String(t))), Re.length > 0 && xe();
1916
+ }
1917
+ function Ft(e) {
1918
+ Dt || (Dt = !0, console.warn(`[telemetry] events not delivered: ${e}`));
1919
+ }
1920
+ function Et(e) {
1921
+ const t = e.getAttribute("data-telemetry") ?? e.getAttribute("aria-label") ?? e.getAttribute("title") ?? (e instanceof HTMLInputElement ? e.labels?.[0]?.textContent ?? e.name : null) ?? e.innerText ?? e.textContent ?? "";
1922
+ return Me(t) || e.tagName.toLowerCase();
1923
+ }
1924
+ function Pr(e) {
1925
+ const t = e.getAttribute("role");
1926
+ return t || (e instanceof HTMLInputElement ? `input:${e.type}` : e.tagName.toLowerCase());
1927
+ }
1928
+ function Ut(e) {
1929
+ const t = e.target instanceof Element ? e.target.closest(Cr) : null;
1930
+ if (!t || t.tagName === "LABEL" && t.control) return;
1931
+ const n = {
1932
+ label: Et(t),
1933
+ kind: Pr(t),
1934
+ disabled: t.matches(":disabled") || t.getAttribute("aria-disabled") === "true"
1935
+ };
1936
+ if (t instanceof HTMLAnchorElement) {
1937
+ const a = new URL(t.href, location.href);
1938
+ n.href = a.origin === location.origin ? a.pathname + a.hash : a.origin + a.pathname;
1939
+ }
1940
+ t instanceof HTMLInputElement && (t.type === "checkbox" || t.type === "radio") && (n.checked = t.checked), ye("ui.click", n);
1941
+ }
1942
+ function It(e) {
1943
+ const t = e.target;
1944
+ t instanceof HTMLSelectElement && ye("ui.change", {
1945
+ label: Et(t),
1946
+ kind: "select",
1947
+ value: t.selectedOptions[0]?.textContent ?? t.value
1948
+ });
1949
+ }
1950
+ function Mt(e) {
1951
+ const t = e.target instanceof HTMLFormElement ? e.target : null;
1952
+ t && ye("ui.submit", {
1953
+ label: Me(
1954
+ t.getAttribute("data-telemetry") ?? t.getAttribute("aria-label") ?? t.name ?? ""
1955
+ ),
1956
+ submitter: e.submitter ? Et(e.submitter) : void 0
1957
+ });
1958
+ }
1959
+ function Bt() {
1960
+ document.visibilityState === "hidden" && xe();
1961
+ }
1962
+ function xr(e, t) {
1963
+ return kn = t.app, t.endpoint && (_n = t.endpoint), dt = jr(), e.addEventListener("click", Ut, !0), e.addEventListener("change", It, !0), e.addEventListener("submit", Mt, !0), document.addEventListener("visibilitychange", Bt), Ot = setInterval(xe, Nr), ye("app.mounted", { path: location.pathname }), () => {
1964
+ e.removeEventListener("click", Ut, !0), e.removeEventListener("change", It, !0), e.removeEventListener("submit", Mt, !0), document.removeEventListener("visibilitychange", Bt), clearInterval(Ot), ye("app.unmounted"), xe();
1965
+ };
1966
+ }
1967
+ async function O(e, t) {
1968
+ const n = performance.now(), a = Me(e.split("?")[0]), r = t?.method ?? "GET";
1969
+ try {
1970
+ const o = await fetch(e, t);
1971
+ return o.ok || ye(
1972
+ "api.error",
1973
+ { method: r, path: a, status: o.status, ms: Math.round(performance.now() - n) },
1974
+ o.status >= 500 ? "error" : "warn"
1975
+ ), o;
1976
+ } catch (o) {
1977
+ throw ye(
1978
+ "api.error",
1979
+ {
1980
+ method: r,
1981
+ path: a,
1982
+ status: 0,
1983
+ ms: Math.round(performance.now() - n),
1984
+ message: o instanceof Error ? o.message : String(o)
1985
+ },
1986
+ "error"
1987
+ ), o;
1988
+ }
1989
+ }
1990
+ function D(e, t = !1) {
1991
+ const n = { Accept: "application/json" };
1992
+ return t && (n["Content-Type"] = "application/json"), n;
1993
+ }
1994
+ const Ce = "/jobplatform/api", Ht = ["junior", "mid", "senior", "staff", "principal", "fellow"], Wt = ["manager", "senior_manager", "director", "vp", "cxo"], Lr = {
1995
+ junior: "Junior",
1996
+ mid: "Mid",
1997
+ senior: "Senior",
1998
+ staff: "Staff",
1999
+ principal: "Principal",
2000
+ fellow: "Distinguished / Fellow",
2001
+ manager: "Manager",
2002
+ senior_manager: "Senior Manager",
2003
+ director: "Director",
2004
+ vp: "VP / Head of",
2005
+ cxo: "C-level"
2006
+ };
2007
+ class Ee extends Error {
2008
+ constructor(t, n) {
2009
+ super(t), this.status = n, this.name = "ProfilesApiError";
2010
+ }
2011
+ }
2012
+ async function je(e) {
2013
+ const t = await e.json();
2014
+ if (!e.ok || !t.success || !t.data)
2015
+ throw new Ee(
2016
+ t.message ?? t.error ?? `HTTP ${e.status}`,
2017
+ e.status
2018
+ );
2019
+ return t.data;
2020
+ }
2021
+ async function $r(e) {
2022
+ const t = await O(`${Ce}/profiles`, {
2023
+ method: "GET",
2024
+ headers: D(),
2025
+ credentials: "include"
2026
+ });
2027
+ return (await je(t)).profiles;
2028
+ }
2029
+ async function Tr(e, t) {
2030
+ const n = await O(`${Ce}/profiles`, {
2031
+ method: "POST",
2032
+ headers: D(t, !0),
2033
+ credentials: "include",
2034
+ body: JSON.stringify(e)
2035
+ });
2036
+ return (await je(n)).profile;
2037
+ }
2038
+ async function Ar(e, t, n) {
2039
+ const a = await O(`${Ce}/profiles/${encodeURIComponent(e)}`, {
2040
+ method: "PUT",
2041
+ headers: D(n, !0),
2042
+ credentials: "include",
2043
+ body: JSON.stringify(t)
2044
+ });
2045
+ return (await je(a)).profile;
2046
+ }
2047
+ async function Or(e, t) {
2048
+ const n = await O(`${Ce}/profiles/${encodeURIComponent(e)}`, {
2049
+ method: "DELETE",
2050
+ headers: D(),
2051
+ credentials: "include"
2052
+ });
2053
+ await je(n);
2054
+ }
2055
+ async function Dr(e, t) {
2056
+ const n = await O(
2057
+ `${Ce}/profiles/${encodeURIComponent(e)}/companies`,
2058
+ {
2059
+ method: "GET",
2060
+ headers: D(),
2061
+ credentials: "include"
2062
+ }
2063
+ );
2064
+ return (await je(n)).companies;
2065
+ }
2066
+ async function Fr(e, t, n) {
2067
+ const a = await O(
2068
+ `${Ce}/profiles/${encodeURIComponent(e)}/companies`,
2069
+ {
2070
+ method: "POST",
2071
+ headers: D(n, !0),
2072
+ credentials: "include",
2073
+ body: JSON.stringify(t)
2074
+ }
2075
+ );
2076
+ return je(a);
2077
+ }
2078
+ async function Ur(e, t, n) {
2079
+ const a = await O(
2080
+ `${Ce}/profiles/${encodeURIComponent(e)}/companies/${encodeURIComponent(t)}`,
2081
+ { method: "DELETE", headers: D(), credentials: "include" }
2082
+ );
2083
+ await je(a);
2084
+ }
2085
+ const X = /* @__PURE__ */ new Map(), Ir = 120;
2086
+ function Mr() {
2087
+ for (; X.size > Ir; ) {
2088
+ const e = X.keys().next();
2089
+ if (e.done) return;
2090
+ X.delete(e.value);
2091
+ }
2092
+ }
2093
+ const Br = 3e4;
2094
+ function qe(e, t, { onStale: n, maxAgeMs: a = Br } = {}) {
2095
+ const r = X.get(e);
2096
+ if (r && "value" in r) {
2097
+ const s = Date.now() - r.at < a;
2098
+ if (n?.(r.value, s), s) return Promise.resolve(r.value);
2099
+ }
2100
+ if (r?.inflight) return r.inflight;
2101
+ const o = t().then((s) => (X.delete(e), X.set(e, { value: s, at: Date.now() }), Mr(), s)).catch((s) => {
2102
+ const l = X.get(e);
2103
+ throw l ? X.set(e, { value: l.value, at: l.at }) : X.delete(e), s;
2104
+ });
2105
+ return X.set(e, r ? { ...r, inflight: o } : { inflight: o }), o;
2106
+ }
2107
+ function Jt(e) {
2108
+ const t = X.get(e);
2109
+ return t && "value" in t ? t.value : void 0;
2110
+ }
2111
+ function De(e) {
2112
+ for (const t of [...X.keys()])
2113
+ t.startsWith(e) && X.delete(t);
2114
+ }
2115
+ function Qe(e, t, { enabled: n = !0, maxAgeMs: a } = {}) {
2116
+ const [r, o] = E(
2117
+ () => n ? Jt(e) : void 0
2118
+ ), [s, l] = E(!1), [c, u] = E(null), [h, d] = E(0), v = Fe(t);
2119
+ return v.current = t, Y(() => {
2120
+ if (!n) {
2121
+ l(!1);
2122
+ return;
2123
+ }
2124
+ let b = !1;
2125
+ u(null);
2126
+ const _ = Jt(e);
2127
+ return _ !== void 0 && o(_), l(!0), qe(e, () => v.current(), {
2128
+ maxAgeMs: a,
2129
+ onStale: (f, m) => {
2130
+ b || (o(f), m && l(!1));
2131
+ }
2132
+ }).then((f) => {
2133
+ b || o(f);
2134
+ }).catch((f) => {
2135
+ b || u(f);
2136
+ }).finally(() => {
2137
+ b || l(!1);
2138
+ }), () => {
2139
+ b = !0;
2140
+ };
2141
+ }, [e, n, a, h]), {
2142
+ data: r,
2143
+ loading: n && r === void 0 && c === null,
2144
+ refreshing: s,
2145
+ error: c,
2146
+ reload: () => d((b) => b + 1)
2147
+ };
2148
+ }
2149
+ function Hr() {
2150
+ const e = window.location.pathname + window.location.search + window.location.hash;
2151
+ return `/auth?return=${encodeURIComponent(e)}`;
2152
+ }
2153
+ function Wr({
2154
+ auth: e,
2155
+ selectedId: t,
2156
+ onSelect: n,
2157
+ onNew: a,
2158
+ onEdit: r,
2159
+ reloadKey: o,
2160
+ onResolved: s
2161
+ }) {
2162
+ const [l, c] = E(null), u = e.signedIn, {
2163
+ data: h,
2164
+ loading: d,
2165
+ error: v,
2166
+ reload: b
2167
+ } = Qe(`profiles:${o ?? 0}`, () => $r(), { enabled: u }), _ = h ?? [], f = l ?? (v ? v instanceof Ee ? v.message : "Failed to load profiles" : null), m = !u || !d;
2168
+ Y(() => {
2169
+ m && s?.(_.length);
2170
+ }, [m, _.length, s]), Y(() => {
2171
+ if (!d) {
2172
+ if (_.length === 0) {
2173
+ t !== null && n(null);
2174
+ return;
2175
+ }
2176
+ _.find((w) => w.id === t) || n(_[0].id);
2177
+ }
2178
+ }, [d, _, t, n]);
2179
+ const C = async (w) => {
2180
+ const R = w.is_default ? "Hide the default profile? It won’t come back (your edits/deletion are remembered)." : "Delete this profile?";
2181
+ if (window.confirm(R)) {
2182
+ c(null);
2183
+ try {
2184
+ await Or(w.id, e), De("profiles:"), b();
2185
+ } catch ($) {
2186
+ c($ instanceof Ee ? $.message : "Failed to delete profile");
2187
+ }
2188
+ }
2189
+ };
2190
+ return u ? /* @__PURE__ */ g("aside", { className: "jp-sidebar", children: [
2191
+ /* @__PURE__ */ g("div", { className: "jp-sidebar__header", children: [
2192
+ /* @__PURE__ */ i("h2", { children: "Profiles" }),
2193
+ /* @__PURE__ */ i("button", { type: "button", className: "jp-sidebar__new", onClick: a, children: "+ New" })
2194
+ ] }),
2195
+ f && /* @__PURE__ */ i("p", { className: "jp-error", children: f }),
2196
+ d ? /* @__PURE__ */ i("p", { className: "jp-muted", children: "Loading…" }) : _.length === 0 ? /* @__PURE__ */ i("p", { className: "jp-muted", children: "No profiles yet. Create one to start scoring jobs." }) : /* @__PURE__ */ i("ul", { className: "jp-sidebar__list", children: _.map((w) => {
2197
+ const R = w.id === t;
2198
+ return /* @__PURE__ */ g(
2199
+ "li",
2200
+ {
2201
+ className: R ? "jp-sidebar__item jp-sidebar__item--active" : "jp-sidebar__item",
2202
+ children: [
2203
+ /* @__PURE__ */ g(
2204
+ "button",
2205
+ {
2206
+ type: "button",
2207
+ className: "jp-sidebar__item-main",
2208
+ onClick: () => n(w.id),
2209
+ children: [
2210
+ /* @__PURE__ */ g("span", { className: "jp-sidebar__item-name", children: [
2211
+ w.name,
2212
+ w.is_default && /* @__PURE__ */ i("span", { className: "jp-sidebar__badge", children: "default" })
2213
+ ] }),
2214
+ /* @__PURE__ */ g("span", { className: "jp-sidebar__item-meta", children: [
2215
+ w.keywords.length,
2216
+ " kw · ",
2217
+ w.remote_pref
2218
+ ] })
2219
+ ]
2220
+ }
2221
+ ),
2222
+ /* @__PURE__ */ g("div", { className: "jp-sidebar__item-actions", children: [
2223
+ /* @__PURE__ */ i(
2224
+ "button",
2225
+ {
2226
+ type: "button",
2227
+ className: "jp-sidebar__item-edit",
2228
+ onClick: () => r(w),
2229
+ "aria-label": `Edit ${w.name}`,
2230
+ children: "✎"
2231
+ }
2232
+ ),
2233
+ /* @__PURE__ */ i(
2234
+ "button",
2235
+ {
2236
+ type: "button",
2237
+ className: "jp-sidebar__item-remove",
2238
+ onClick: () => {
2239
+ C(w);
2240
+ },
2241
+ "aria-label": w.is_default ? `Hide ${w.name}` : `Delete ${w.name}`,
2242
+ children: "×"
2243
+ }
2244
+ )
2245
+ ] })
2246
+ ]
2247
+ },
2248
+ w.id
2249
+ );
2250
+ }) })
2251
+ ] }) : /* @__PURE__ */ g("aside", { className: "jp-sidebar", children: [
2252
+ /* @__PURE__ */ i("div", { className: "jp-sidebar__header", children: /* @__PURE__ */ i("h2", { children: "Profiles" }) }),
2253
+ /* @__PURE__ */ i("p", { className: "jp-muted", children: "The feed to the right is the whole public corpus, newest first. Sign in to rank it against your own profile — keywords, IC or manager track, level and remote preference — and to track which jobs you’ve looked at." }),
2254
+ /* @__PURE__ */ i("a", { className: "jp-sidebar__signin", href: Hr(), children: "Sign in" })
2255
+ ] });
2256
+ }
2257
+ const K = "/jobplatform/api";
2258
+ class re extends Error {
2259
+ constructor(t, n) {
2260
+ super(t), this.status = n, this.name = "JobsApiError";
2261
+ }
2262
+ }
2263
+ async function V(e) {
2264
+ const t = await e.json();
2265
+ if (!e.ok || !t.success || !t.data)
2266
+ throw new re(t.message ?? t.error ?? `HTTP ${e.status}`, e.status);
2267
+ return t.data;
2268
+ }
2269
+ async function Jr(e, t) {
2270
+ const n = new URLSearchParams();
2271
+ e.profile_id && n.set("profile_id", e.profile_id), e.state && n.set("state", e.state), e.hide_dismissed && n.set("hide_dismissed", "true"), e.hide_queued && n.set("hide_queued", "true"), e.page && n.set("page", String(e.page)), e.limit && n.set("limit", String(e.limit)), e.sort && n.set("sort", e.sort), e.min_score !== void 0 && n.set("min_score", String(e.min_score)), e.min_salary !== void 0 && n.set("min_salary", String(e.min_salary)), e.workplace && n.set("workplace", e.workplace), e.near && (n.set("near", e.near), e.radius_miles && n.set("radius_miles", String(e.radius_miles)), e.include_remote === !1 && n.set("include_remote", "false"));
2272
+ const a = `${K}/jobs${n.toString() ? `?${n}` : ""}`, r = await O(a, {
2273
+ method: "GET",
2274
+ headers: D(),
2275
+ credentials: "include"
2276
+ });
2277
+ return V(r);
2278
+ }
2279
+ async function at(e, t) {
2280
+ const n = new URLSearchParams();
2281
+ e.keyword && n.set("keyword", e.keyword), e.track && n.set("track", e.track), e.level && n.set("level", e.level);
2282
+ const a = await O(`${K}/jobs/preflight?${n}`, {
2283
+ method: "GET",
2284
+ headers: D(),
2285
+ credentials: "include"
2286
+ });
2287
+ return (await V(a)).count;
2288
+ }
2289
+ async function qr(e, t, n) {
2290
+ const a = t ? `?profile_id=${encodeURIComponent(t)}` : "", r = await O(`${K}/jobs/${encodeURIComponent(e)}${a}`, {
2291
+ method: "GET",
2292
+ headers: D(),
2293
+ credentials: "include"
2294
+ });
2295
+ return (await V(r)).job;
2296
+ }
2297
+ async function Kr(e, t, n, a) {
2298
+ const r = await O(`${K}/jobs/${encodeURIComponent(e)}/state`, {
2299
+ method: "PUT",
2300
+ headers: D(n, !0),
2301
+ credentials: "include",
2302
+ body: JSON.stringify(a ? { state: t, variant_slug: a } : { state: t })
2303
+ });
2304
+ return V(r);
2305
+ }
2306
+ async function qt(e, t, n, a) {
2307
+ const r = await O(`${K}/jobs/${encodeURIComponent(e)}/feedback`, {
2308
+ method: "PUT",
2309
+ headers: D(a, !0),
2310
+ credentials: "include",
2311
+ body: JSON.stringify({ vote: t, reasons: n })
2312
+ });
2313
+ return V(r);
2314
+ }
2315
+ async function Vr(e, t) {
2316
+ const n = await O(`${K}/jobs/${encodeURIComponent(e)}/feedback`, {
2317
+ method: "DELETE",
2318
+ headers: D(),
2319
+ credentials: "include"
2320
+ });
2321
+ return V(n);
2322
+ }
2323
+ async function Gr(e, t, n) {
2324
+ const a = await O(`${K}/jobs/${encodeURIComponent(e)}/resume`, {
2325
+ method: "POST",
2326
+ headers: D(t, !0),
2327
+ credentials: "include",
2328
+ body: JSON.stringify({})
2329
+ });
2330
+ return V(a);
2331
+ }
2332
+ async function zr(e, t, n) {
2333
+ const a = await O(`${K}/jobs/${encodeURIComponent(e)}/cover-letter`, {
2334
+ method: "POST",
2335
+ headers: D(t, !0),
2336
+ credentials: "include",
2337
+ body: JSON.stringify({})
2338
+ });
2339
+ return V(a);
2340
+ }
2341
+ async function Rn(e, t, n) {
2342
+ const a = await O(`${K}/jobs/${encodeURIComponent(e)}/packet-link`, {
2343
+ method: "POST",
2344
+ headers: D(n, !0),
2345
+ credentials: "include",
2346
+ body: JSON.stringify(t)
2347
+ });
2348
+ return V(a);
2349
+ }
2350
+ async function En(e, t, n) {
2351
+ const a = await O(
2352
+ `${K}/jobs/${encodeURIComponent(e)}/application-extras`,
2353
+ {
2354
+ method: "POST",
2355
+ headers: D(n, !0),
2356
+ credentials: "include",
2357
+ body: JSON.stringify(t)
2358
+ }
2359
+ );
2360
+ return V(a);
2361
+ }
2362
+ async function ni(e) {
2363
+ const t = await O(`${K}/jobs/packets`, {
2364
+ method: "GET",
2365
+ headers: D(),
2366
+ credentials: "include"
2367
+ });
2368
+ return (await V(t)).packets;
2369
+ }
2370
+ async function Nn(e, t = "review", n) {
2371
+ const a = await O(`${K}/jobs/${encodeURIComponent(e)}/apply`, {
2372
+ method: "POST",
2373
+ headers: { "Content-Type": "application/json", ...D() },
2374
+ credentials: "include",
2375
+ body: JSON.stringify({ mode: t })
2376
+ });
2377
+ return (await V(a)).application;
2378
+ }
2379
+ async function ai(e, t) {
2380
+ const a = await O(`${K}/applications`, {
2381
+ method: "GET",
2382
+ headers: D(),
2383
+ credentials: "include"
2384
+ });
2385
+ return (await V(a)).applications;
2386
+ }
2387
+ async function ri(e, t) {
2388
+ const n = await O(
2389
+ `${K}/applications/${encodeURIComponent(e)}/approve`,
2390
+ {
2391
+ method: "POST",
2392
+ headers: D(),
2393
+ credentials: "include"
2394
+ }
2395
+ );
2396
+ return (await V(n)).application;
2397
+ }
2398
+ async function oi(e) {
2399
+ const t = await O(`${K}/unanswered-questions`, {
2400
+ method: "GET",
2401
+ headers: D(),
2402
+ credentials: "include"
2403
+ });
2404
+ return (await V(t)).questions;
2405
+ }
2406
+ async function ii(e) {
2407
+ const t = await O(`${K}/application-answers`, {
2408
+ method: "GET",
2409
+ headers: D(),
2410
+ credentials: "include"
2411
+ });
2412
+ return (await V(t)).answers;
2413
+ }
2414
+ async function si(e, t, n) {
2415
+ const a = await O(`${K}/application-answers`, {
2416
+ method: "PUT",
2417
+ headers: { ...D(), "Content-Type": "application/json" },
2418
+ credentials: "include",
2419
+ body: JSON.stringify({ question: e, answer: t })
2420
+ });
2421
+ return (await V(a)).answer;
2422
+ }
2423
+ async function li(e, t) {
2424
+ const n = await O(
2425
+ `${K}/application-answers/${encodeURIComponent(e)}`,
2426
+ { method: "DELETE", headers: D(), credentials: "include" }
2427
+ );
2428
+ return (await V(n)).answers;
2429
+ }
2430
+ async function ci(e) {
2431
+ const t = await O(`${K}/verification-codes`, {
2432
+ method: "GET",
2433
+ headers: D(),
2434
+ credentials: "include"
2435
+ });
2436
+ return (await V(t)).codes;
2437
+ }
2438
+ const Yr = "/jobplatform/api";
2439
+ class pt extends Error {
2440
+ constructor(t, n) {
2441
+ super(t), this.status = n, this.name = "CompaniesApiError";
2442
+ }
2443
+ }
2444
+ async function Qr(e) {
2445
+ const t = await e.json();
2446
+ if (!e.ok || !t.success || !t.data)
2447
+ throw new pt(
2448
+ t.message ?? t.error ?? `HTTP ${e.status}`,
2449
+ e.status
2450
+ );
2451
+ return t.data;
2452
+ }
2453
+ async function Xr(e, t) {
2454
+ const n = await O(`${Yr}/companies/match`, {
2455
+ method: "POST",
2456
+ headers: D(t, !0),
2457
+ credentials: "include",
2458
+ body: JSON.stringify({ names: e })
2459
+ });
2460
+ return (await Qr(n)).results;
2461
+ }
2462
+ function Kt(e) {
2463
+ const t = /* @__PURE__ */ new Set(), n = [];
2464
+ for (const a of e.split(/[,\n]+/)) {
2465
+ const r = a.trim();
2466
+ r && !t.has(r.toLowerCase()) && (t.add(r.toLowerCase()), n.push(r));
2467
+ }
2468
+ return n;
2469
+ }
2470
+ function Zr(e) {
2471
+ return e ? `https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64` : null;
2472
+ }
2473
+ function eo({ auth: e, profileId: t, onCompaniesChanged: n }) {
2474
+ const [a, r] = E(null), [o, s] = E(""), [l, c] = E(!1), [u, h] = E(null), [d, v] = E(null), [b, _] = E(null), {
2475
+ data: f,
2476
+ loading: m,
2477
+ error: C,
2478
+ reload: w
2479
+ } = Qe(
2480
+ `profile-companies:${t ?? ""}`,
2481
+ () => Dr(t ?? ""),
2482
+ { enabled: !!t }
2483
+ ), R = t ? f ?? [] : [], $ = a ?? (C ? C instanceof Ee ? C.message : "Failed to load companies" : null), x = se(() => {
2484
+ De(`profile-companies:${t ?? ""}`), w();
2485
+ }, [t, w]);
2486
+ Y(() => {
2487
+ h(null);
2488
+ }, [t]);
2489
+ const F = (k, U) => `${k}:${U}`, J = new Set(R.map((k) => F(k.ats, k.slug))), H = async (k, U, W) => {
2490
+ if (!(!t || b)) {
2491
+ r(null), v(null);
2492
+ try {
2493
+ await Fr(
2494
+ t,
2495
+ { ats: k, slug: U, display_name: W.trim() || U },
2496
+ e
2497
+ ), x(), n?.();
2498
+ } catch (T) {
2499
+ const G = T instanceof pt || T instanceof Ee ? T.message : "Failed to add company";
2500
+ throw v(G), T;
2501
+ }
2502
+ }
2503
+ }, P = async (k) => {
2504
+ k.preventDefault();
2505
+ const U = Kt(o);
2506
+ if (!(U.length === 0 || l)) {
2507
+ c(!0), v(null), h(null);
2508
+ try {
2509
+ h(await Xr(U, e));
2510
+ } catch (W) {
2511
+ v(W instanceof pt ? W.message : "Failed to look up company");
2512
+ } finally {
2513
+ c(!1);
2514
+ }
2515
+ }
2516
+ }, A = async (k) => {
2517
+ if (!k.matched || !k.ats || !k.slug) return;
2518
+ const U = F(k.ats, k.slug);
2519
+ _(U);
2520
+ try {
2521
+ await H(k.ats, k.slug, k.company_name ?? k.query);
2522
+ } catch {
2523
+ } finally {
2524
+ _(null);
2525
+ }
2526
+ }, B = async (k) => {
2527
+ if (t) {
2528
+ r(null);
2529
+ try {
2530
+ await Ur(t, k, e), x(), n?.();
2531
+ } catch (U) {
2532
+ r(U instanceof Ee ? U.message : "Failed to remove company");
2533
+ }
2534
+ }
2535
+ };
2536
+ return t ? /* @__PURE__ */ g("div", { className: "job-platform__companies", children: [
2537
+ /* @__PURE__ */ g("form", { className: "job-platform__companies-form", onSubmit: (k) => {
2538
+ P(k);
2539
+ }, children: [
2540
+ /* @__PURE__ */ i(
2541
+ "input",
2542
+ {
2543
+ type: "text",
2544
+ placeholder: "Add a company by name (e.g. Scale AI, OpenAI, Ramp)",
2545
+ value: o,
2546
+ onChange: (k) => s(k.target.value),
2547
+ disabled: l,
2548
+ "aria-label": "Company name"
2549
+ }
2550
+ ),
2551
+ /* @__PURE__ */ i("button", { type: "submit", disabled: l || Kt(o).length === 0, children: l ? "Finding…" : "Find" })
2552
+ ] }),
2553
+ d && /* @__PURE__ */ i("p", { className: "job-platform__companies-error", children: d }),
2554
+ u && /* @__PURE__ */ i("div", { className: "job-platform__match-results", children: u.map((k) => {
2555
+ const U = k.ats && k.slug ? F(k.ats, k.slug) : k.query, W = k.ats && k.slug ? J.has(U) : !1, T = Zr(k.domain), G = k.matched && k.n_jobs === 0;
2556
+ return k.matched ? /* @__PURE__ */ g(
2557
+ "div",
2558
+ {
2559
+ className: G ? "job-platform__match-card job-platform__match-card--warn" : "job-platform__match-card",
2560
+ children: [
2561
+ /* @__PURE__ */ g("div", { className: "job-platform__match-head", children: [
2562
+ T && /* @__PURE__ */ i(
2563
+ "img",
2564
+ {
2565
+ className: "job-platform__match-favicon",
2566
+ src: T,
2567
+ alt: "",
2568
+ width: 20,
2569
+ height: 20,
2570
+ onError: (z) => {
2571
+ z.currentTarget.style.display = "none";
2572
+ }
2573
+ }
2574
+ ),
2575
+ /* @__PURE__ */ i("strong", { className: "job-platform__match-name", children: k.company_name }),
2576
+ /* @__PURE__ */ i("span", { className: "job-platform__probe-ats", children: k.ats }),
2577
+ /* @__PURE__ */ g("span", { className: "job-platform__match-meta", children: [
2578
+ k.slug,
2579
+ " · ",
2580
+ k.n_jobs,
2581
+ " job",
2582
+ k.n_jobs === 1 ? "" : "s"
2583
+ ] })
2584
+ ] }),
2585
+ k.sample_titles.length > 0 && /* @__PURE__ */ i("p", { className: "job-platform__probe-titles", children: k.sample_titles.slice(0, 5).join(" · ") }),
2586
+ G && /* @__PURE__ */ g("p", { className: "job-platform__match-warn", children: [
2587
+ "⚠ 0 open roles — can’t confirm this is the right company (the board may be stale or a different one on ",
2588
+ k.ats,
2589
+ "). Add anyway if you’re sure."
2590
+ ] }),
2591
+ /* @__PURE__ */ i(
2592
+ "button",
2593
+ {
2594
+ type: "button",
2595
+ className: "job-platform__match-confirm",
2596
+ onClick: () => {
2597
+ A(k);
2598
+ },
2599
+ disabled: W || b !== null,
2600
+ children: W ? "Added ✓" : b === U ? "Adding…" : G ? "Add anyway" : "Confirm & add"
2601
+ }
2602
+ )
2603
+ ]
2604
+ },
2605
+ U
2606
+ ) : /* @__PURE__ */ g(
2607
+ "div",
2608
+ {
2609
+ className: "job-platform__match-card job-platform__match-card--empty",
2610
+ children: [
2611
+ "No board found for ",
2612
+ /* @__PURE__ */ i("strong", { children: k.query }),
2613
+ " on greenhouse, lever, or ashby — it may use an ATS we don’t scrape yet (e.g. Workday) or a different slug."
2614
+ ]
2615
+ },
2616
+ k.query
2617
+ );
2618
+ }) }),
2619
+ m ? /* @__PURE__ */ i("p", { className: "job-platform__companies-empty", children: "Loading…" }) : R.length === 0 ? /* @__PURE__ */ i("p", { className: "job-platform__companies-empty", children: "No companies yet. This profile scores the whole corpus until you add some." }) : /* @__PURE__ */ i("ul", { className: "job-platform__companies-list", children: R.map((k) => /* @__PURE__ */ g("li", { className: "job-platform__companies-item", children: [
2620
+ /* @__PURE__ */ g("div", { className: "job-platform__companies-item-main", children: [
2621
+ /* @__PURE__ */ i("strong", { children: k.display_name }),
2622
+ /* @__PURE__ */ g("span", { className: "job-platform__companies-item-meta", children: [
2623
+ k.ats,
2624
+ " · ",
2625
+ k.slug
2626
+ ] })
2627
+ ] }),
2628
+ /* @__PURE__ */ i(
2629
+ "button",
2630
+ {
2631
+ type: "button",
2632
+ className: "job-platform__companies-item-remove",
2633
+ onClick: () => {
2634
+ B(k.id);
2635
+ },
2636
+ "aria-label": `Remove ${k.display_name}`,
2637
+ children: "Remove"
2638
+ }
2639
+ )
2640
+ ] }, k.id)) }),
2641
+ $ && /* @__PURE__ */ i("p", { className: "job-platform__companies-error", children: $ })
2642
+ ] }) : /* @__PURE__ */ i("p", { className: "job-platform__companies-empty", children: "Save the profile first, then add the companies it should track." });
2643
+ }
2644
+ const rt = 15 * 6e4, to = [
2645
+ { value: "either", label: "Either", hint: "No constraint — both tracks in the feed" },
2646
+ { value: "ic", label: "IC", hint: "No direct reports" },
2647
+ { value: "manager", label: "Manager", hint: "Has direct reports" }
2648
+ ];
2649
+ function Vt(e) {
2650
+ return e === "ic" ? Ht : e === "manager" ? Wt : [...Ht, ...Wt];
2651
+ }
2652
+ function ot({ count: e }) {
2653
+ return e === null ? null : e === "loading" ? /* @__PURE__ */ i("span", { className: "jp-editor__count jp-editor__count--loading", children: "…" }) : /* @__PURE__ */ g("span", { className: e === 0 ? "jp-editor__count jp-editor__count--zero" : "jp-editor__count", children: [
2654
+ e,
2655
+ " job",
2656
+ e === 1 ? "" : "s"
2657
+ ] });
2658
+ }
2659
+ function no({ auth: e, initial: t, onClose: n, onSaved: a, onCompaniesChanged: r }) {
2660
+ const [o, s] = E(t?.id ?? null), [l, c] = E(t?.name ?? ""), [u, h] = E(t?.keywords ?? []), [d, v] = E(""), [b, _] = E(t?.track ?? "either"), [f, m] = E(t?.levels ?? []), [C, w] = E(t?.remote_pref ?? "any"), [R, $] = E(!1), [x, F] = E(null), [J, H] = E(!1), [P, A] = E({}), [B, k] = E({}), [U, W] = E(null), T = se(
2661
+ async (y) => {
2662
+ A((N) => ({ ...N, [y]: "loading" }));
2663
+ try {
2664
+ const N = await qe(
2665
+ `preflight:kw:${y}`,
2666
+ () => at({ keyword: y }, e),
2667
+ { maxAgeMs: rt }
2668
+ );
2669
+ A((I) => ({ ...I, [y]: N }));
2670
+ } catch {
2671
+ A((N) => ({ ...N, [y]: null }));
2672
+ }
2673
+ },
2674
+ [e]
2675
+ ), G = se(
2676
+ async (y) => {
2677
+ k((N) => ({ ...N, [y]: "loading" }));
2678
+ try {
2679
+ const N = await qe(
2680
+ `preflight:level:${y}`,
2681
+ () => at({ level: y }, e),
2682
+ { maxAgeMs: rt }
2683
+ );
2684
+ k((I) => ({ ...I, [y]: N }));
2685
+ } catch {
2686
+ k((N) => ({ ...N, [y]: null }));
2687
+ }
2688
+ },
2689
+ [e]
2690
+ ), z = Fe(!1);
2691
+ Y(() => {
2692
+ if (!z.current) {
2693
+ z.current = !0;
2694
+ for (const y of u) T(y);
2695
+ for (const y of f) G(y);
2696
+ }
2697
+ }, [u, f, T, G]), Y(() => {
2698
+ if (b === "either") {
2699
+ W(null);
2700
+ return;
2701
+ }
2702
+ let y = !1;
2703
+ return W("loading"), qe(`preflight:track:${b}`, () => at({ track: b }), {
2704
+ maxAgeMs: rt
2705
+ }).then((N) => !y && W(N)).catch(() => !y && W(null)), () => {
2706
+ y = !0;
2707
+ };
2708
+ }, [b, e]), Y(() => {
2709
+ const y = (N) => {
2710
+ N.key === "Escape" && n();
2711
+ };
2712
+ return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
2713
+ }, [n]);
2714
+ const ie = (y) => {
2715
+ const N = y.split(",").map((I) => I.trim()).filter(Boolean);
2716
+ N.length && (h((I) => {
2717
+ const pe = new Set(I.map((he) => he.toLowerCase())), Te = [...I];
2718
+ for (const he of N)
2719
+ pe.has(he.toLowerCase()) || (pe.add(he.toLowerCase()), Te.push(he), T(he));
2720
+ return Te;
2721
+ }), v(""));
2722
+ }, le = (y) => {
2723
+ y.key === "Enter" || y.key === "," ? (y.preventDefault(), ie(d)) : y.key === "Backspace" && !d && u.length && h((N) => N.slice(0, -1));
2724
+ }, be = (y) => h((N) => N.filter((I) => I !== y)), we = (y) => m((N) => N.includes(y) ? N.filter((I) => I !== y) : (B[y] === void 0 && G(y), [...N, y])), Pe = (y) => {
2725
+ _(y);
2726
+ const N = Vt(y);
2727
+ m((I) => I.filter((pe) => N.includes(pe)));
2728
+ }, _e = () => {
2729
+ const y = d.trim() ? [
2730
+ ...u,
2731
+ ...d.split(",").map((N) => N.trim()).filter(Boolean)
2732
+ ] : u;
2733
+ return {
2734
+ name: l.trim(),
2735
+ keywords: y,
2736
+ track: b,
2737
+ levels: f,
2738
+ remote_pref: C
2739
+ };
2740
+ }, ce = async () => {
2741
+ if (!(!l.trim() || R)) {
2742
+ $(!0), F(null);
2743
+ try {
2744
+ const y = _e();
2745
+ if (o) {
2746
+ const N = await Ar(o, y, e);
2747
+ a(N), n();
2748
+ } else {
2749
+ const N = await Tr(y, e);
2750
+ s(N.id), h(N.keywords), a(N), H(!0);
2751
+ }
2752
+ } catch (y) {
2753
+ F(y instanceof Ee ? y.message : "Failed to save profile");
2754
+ } finally {
2755
+ $(!1);
2756
+ }
2757
+ }
2758
+ };
2759
+ return /* @__PURE__ */ i(
2760
+ "div",
2761
+ {
2762
+ className: "jp-editor-backdrop",
2763
+ "data-telemetry": "Close profile editor (backdrop)",
2764
+ onClick: (y) => {
2765
+ y.target === y.currentTarget && n();
2766
+ },
2767
+ children: /* @__PURE__ */ g(
2768
+ "div",
2769
+ {
2770
+ className: "jp-editor",
2771
+ role: "dialog",
2772
+ "aria-modal": "true",
2773
+ "aria-label": o ? "Edit profile" : "New profile",
2774
+ children: [
2775
+ /* @__PURE__ */ g("div", { className: "jp-editor__header", children: [
2776
+ /* @__PURE__ */ i("h2", { className: "jp-editor__title", children: t ? "Edit profile" : "New profile" }),
2777
+ /* @__PURE__ */ i(
2778
+ "button",
2779
+ {
2780
+ type: "button",
2781
+ className: "jp-editor__close",
2782
+ onClick: n,
2783
+ "aria-label": "Close editor",
2784
+ children: "×"
2785
+ }
2786
+ )
2787
+ ] }),
2788
+ /* @__PURE__ */ g("div", { className: "jp-editor__body", children: [
2789
+ /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2790
+ /* @__PURE__ */ i("label", { className: "jp-editor__field-label", htmlFor: "jp-editor-name", children: "Name" }),
2791
+ /* @__PURE__ */ i(
2792
+ "input",
2793
+ {
2794
+ id: "jp-editor-name",
2795
+ type: "text",
2796
+ className: "jp-editor__text",
2797
+ value: l,
2798
+ onChange: (y) => c(y.target.value),
2799
+ placeholder: "Senior SWE — AI/ML"
2800
+ }
2801
+ )
2802
+ ] }),
2803
+ /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2804
+ /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2805
+ /* @__PURE__ */ i("span", { className: "jp-editor__field-label", children: "Keywords" }),
2806
+ /* @__PURE__ */ i("span", { className: "jp-editor__hint", children: "Each keyword is scraped and scored — the count is live corpus matches." })
2807
+ ] }),
2808
+ /* @__PURE__ */ g("div", { className: "jp-chips", children: [
2809
+ u.map((y) => /* @__PURE__ */ g("span", { className: "jp-chip", children: [
2810
+ y,
2811
+ /* @__PURE__ */ i(ot, { count: P[y] ?? null }),
2812
+ /* @__PURE__ */ i("button", { type: "button", onClick: () => be(y), "aria-label": `Remove ${y}`, children: "×" })
2813
+ ] }, y)),
2814
+ /* @__PURE__ */ i(
2815
+ "input",
2816
+ {
2817
+ className: "jp-chips__input",
2818
+ value: d,
2819
+ onChange: (y) => v(y.target.value),
2820
+ onKeyDown: le,
2821
+ onBlur: () => ie(d),
2822
+ placeholder: u.length ? "Add…" : "python, llm, distributed systems"
2823
+ }
2824
+ )
2825
+ ] })
2826
+ ] }),
2827
+ /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2828
+ /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2829
+ /* @__PURE__ */ i("span", { className: "jp-editor__field-label", children: "Track" }),
2830
+ /* @__PURE__ */ i("span", { className: "jp-editor__hint", children: "Does the role have direct reports? A hard filter — jobs on the other track don’t appear in this profile’s feed at all." })
2831
+ ] }),
2832
+ /* @__PURE__ */ i("div", { className: "jp-role-picker", role: "radiogroup", "aria-label": "Track", children: to.map((y) => {
2833
+ const N = b === y.value;
2834
+ return /* @__PURE__ */ g(
2835
+ "button",
2836
+ {
2837
+ type: "button",
2838
+ role: "radio",
2839
+ "aria-checked": N,
2840
+ title: y.hint,
2841
+ className: N ? "jp-role-opt jp-role-opt--on" : "jp-role-opt",
2842
+ onClick: () => Pe(y.value),
2843
+ children: [
2844
+ y.label,
2845
+ N && y.value !== "either" && /* @__PURE__ */ i(ot, { count: U })
2846
+ ]
2847
+ },
2848
+ y.value
2849
+ );
2850
+ }) })
2851
+ ] }),
2852
+ /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2853
+ /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2854
+ /* @__PURE__ */ i("span", { className: "jp-editor__field-label", children: "Levels" }),
2855
+ /* @__PURE__ */ i("span", { className: "jp-editor__hint", children: "Rungs on the ladder. Scored by distance — one rung off still counts, two doesn’t. Pick none to ignore level entirely." })
2856
+ ] }),
2857
+ /* @__PURE__ */ i("div", { className: "jp-role-picker", children: Vt(b).map((y) => {
2858
+ const N = f.includes(y);
2859
+ return /* @__PURE__ */ g(
2860
+ "button",
2861
+ {
2862
+ type: "button",
2863
+ className: N ? "jp-role-opt jp-role-opt--on" : "jp-role-opt",
2864
+ onClick: () => we(y),
2865
+ "aria-pressed": N,
2866
+ children: [
2867
+ Lr[y],
2868
+ N && /* @__PURE__ */ i(ot, { count: B[y] ?? null })
2869
+ ]
2870
+ },
2871
+ y
2872
+ );
2873
+ }) })
2874
+ ] }),
2875
+ /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2876
+ /* @__PURE__ */ i("label", { className: "jp-editor__field-label", htmlFor: "jp-editor-remote", children: "Remote preference" }),
2877
+ /* @__PURE__ */ g(
2878
+ "select",
2879
+ {
2880
+ id: "jp-editor-remote",
2881
+ className: "jp-editor__text",
2882
+ value: C,
2883
+ onChange: (y) => w(y.target.value),
2884
+ children: [
2885
+ /* @__PURE__ */ i("option", { value: "any", children: "Any" }),
2886
+ /* @__PURE__ */ i("option", { value: "remote", children: "Remote" }),
2887
+ /* @__PURE__ */ i("option", { value: "hybrid", children: "Hybrid" }),
2888
+ /* @__PURE__ */ i("option", { value: "onsite", children: "Onsite" })
2889
+ ]
2890
+ }
2891
+ )
2892
+ ] }),
2893
+ /* @__PURE__ */ g("section", { className: "jp-editor__section", children: [
2894
+ /* @__PURE__ */ g("div", { className: "jp-editor__section-head", children: [
2895
+ /* @__PURE__ */ i("span", { className: "jp-editor__field-label", children: "Companies" }),
2896
+ /* @__PURE__ */ i("span", { className: "jp-editor__hint", children: "Optional. Empty = score the whole corpus; add companies to scope the feed." })
2897
+ ] }),
2898
+ o ? /* @__PURE__ */ i(
2899
+ eo,
2900
+ {
2901
+ auth: e,
2902
+ profileId: o,
2903
+ onCompaniesChanged: r
2904
+ }
2905
+ ) : /* @__PURE__ */ i("p", { className: "job-platform__companies-empty", children: "Create the profile first (below), then add the companies it should track." })
2906
+ ] })
2907
+ ] }),
2908
+ x && /* @__PURE__ */ i("p", { className: "jp-editor__error", children: x }),
2909
+ /* @__PURE__ */ g("div", { className: "jp-editor__footer", children: [
2910
+ J && !x && /* @__PURE__ */ i("span", { className: "jp-editor__saved", children: "Saved — add companies above, or close." }),
2911
+ /* @__PURE__ */ i("button", { type: "button", className: "jp-editor__cancel", onClick: n, children: o ? "Close" : "Cancel" }),
2912
+ /* @__PURE__ */ i(
2913
+ "button",
2914
+ {
2915
+ type: "button",
2916
+ className: "jp-editor__save",
2917
+ onClick: () => {
2918
+ ce();
2919
+ },
2920
+ disabled: R || !l.trim(),
2921
+ children: R ? "Saving…" : o ? "Save changes" : "Create profile"
2922
+ }
2923
+ )
2924
+ ] })
2925
+ ]
2926
+ }
2927
+ )
2928
+ }
2929
+ );
2930
+ }
2931
+ const ao = "/jobplatform/api";
2932
+ async function Se(e, t, n = {}, a = !1) {
2933
+ const r = await O(`${ao}${e}`, {
2934
+ ...n,
2935
+ headers: D(t, a),
2936
+ credentials: "include"
2937
+ }), o = await r.json();
2938
+ if (!r.ok || !o.success || !o.data)
2939
+ throw new re(o.message ?? o.error ?? `HTTP ${r.status}`, r.status);
2940
+ return o.data;
2941
+ }
2942
+ function Cn(e, t) {
2943
+ return { method: e, body: JSON.stringify(t) };
2944
+ }
2945
+ async function ui(e) {
2946
+ return (await Se("/applicant-profile", e)).profile;
2947
+ }
2948
+ async function di(e, t) {
2949
+ return (await Se(
2950
+ "/applicant-profile",
2951
+ t,
2952
+ Cn("PUT", { profile: e }),
2953
+ !0
2954
+ )).updated_at;
2955
+ }
2956
+ async function pi(e) {
2957
+ return (await Se("/blocked-companies", e)).companies;
2958
+ }
2959
+ async function ro(e, t) {
2960
+ return (await Se(
2961
+ "/blocked-companies",
2962
+ t,
2963
+ Cn("PUT", { company: e }),
2964
+ !0
2965
+ )).company;
2966
+ }
2967
+ async function hi(e, t) {
2968
+ await Se(
2969
+ `/blocked-companies?company=${encodeURIComponent(e)}`,
2970
+ t,
2971
+ { method: "DELETE" }
2972
+ );
2973
+ }
2974
+ async function oo(e, t) {
2975
+ return (await Se(
2976
+ `/locations?q=${encodeURIComponent(e)}&limit=8`,
2977
+ t
2978
+ )).locations;
2979
+ }
2980
+ async function mi(e) {
2981
+ return Se("/insights", e);
2982
+ }
2983
+ const io = [10, 25, 50, 100], ht = "jobplatform:near";
2984
+ function so() {
2985
+ try {
2986
+ const e = window.localStorage.getItem(ht);
2987
+ if (!e) return null;
2988
+ const t = JSON.parse(e);
2989
+ return t.place?.key && t.place.label && typeof t.radius == "number" ? { place: t.place, radius: t.radius, includeRemote: t.includeRemote !== !1 } : null;
2990
+ } catch {
2991
+ return null;
2992
+ }
2993
+ }
2994
+ function lo(e) {
2995
+ try {
2996
+ e ? window.localStorage.setItem(ht, JSON.stringify(e)) : window.localStorage.removeItem(ht);
2997
+ } catch {
2998
+ }
2999
+ }
3000
+ function co({
3001
+ auth: e,
3002
+ value: t,
3003
+ onChange: n
3004
+ }) {
3005
+ const a = In(), [r, o] = E(""), [s, l] = E([]), c = (u) => {
3006
+ lo(u), n(u);
3007
+ };
3008
+ return Y(() => {
3009
+ const u = r.trim();
3010
+ if (u.length < 2) {
3011
+ l([]);
3012
+ return;
3013
+ }
3014
+ let h = !1;
3015
+ const d = setTimeout(() => {
3016
+ oo(u, e).then(
3017
+ (v) => {
3018
+ h || l(v);
3019
+ },
3020
+ () => {
3021
+ }
3022
+ );
3023
+ }, 200);
3024
+ return () => {
3025
+ h = !0, clearTimeout(d);
3026
+ };
3027
+ }, [r, e]), t ? /* @__PURE__ */ g("div", { className: "jp-near", "data-testid": "near-filter", children: [
3028
+ /* @__PURE__ */ g("span", { className: "jp-near__chip", children: [
3029
+ "Near ",
3030
+ t.place.label,
3031
+ /* @__PURE__ */ i(
3032
+ "button",
3033
+ {
3034
+ type: "button",
3035
+ className: "jp-near__clear",
3036
+ "aria-label": `Stop filtering near ${t.place.label}`,
3037
+ onClick: () => c(null),
3038
+ children: "×"
3039
+ }
3040
+ )
3041
+ ] }),
3042
+ /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3043
+ "Within",
3044
+ /* @__PURE__ */ i(
3045
+ "select",
3046
+ {
3047
+ value: t.radius,
3048
+ onChange: (u) => c({ ...t, radius: Number(u.target.value) }),
3049
+ children: io.map((u) => /* @__PURE__ */ g("option", { value: u, children: [
3050
+ u,
3051
+ " mi"
3052
+ ] }, u))
3053
+ }
3054
+ )
3055
+ ] }),
3056
+ /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3057
+ /* @__PURE__ */ i(
3058
+ "input",
3059
+ {
3060
+ type: "checkbox",
3061
+ checked: t.includeRemote,
3062
+ onChange: (u) => c({ ...t, includeRemote: u.target.checked })
3063
+ }
3064
+ ),
3065
+ "Include remote"
3066
+ ] })
3067
+ ] }) : /* @__PURE__ */ g("label", { className: "jp-jobs__filter", "data-testid": "near-filter", children: [
3068
+ "Near",
3069
+ /* @__PURE__ */ i(
3070
+ "input",
3071
+ {
3072
+ type: "search",
3073
+ className: "jp-near__input",
3074
+ list: a,
3075
+ value: r,
3076
+ placeholder: "City",
3077
+ onChange: (u) => {
3078
+ const h = u.target.value, d = s.find((v) => v.label === h);
3079
+ d ? (o(""), c({ place: d, radius: 25, includeRemote: !0 })) : o(h);
3080
+ }
3081
+ }
3082
+ ),
3083
+ /* @__PURE__ */ i("datalist", { id: a, children: s.map((u) => /* @__PURE__ */ i("option", { value: u.label }, u.key)) })
3084
+ ] });
3085
+ }
3086
+ async function uo(e, t, n) {
3087
+ const a = await Gr(e, t);
3088
+ let r = "";
3089
+ try {
3090
+ r = (await En(
3091
+ e,
3092
+ { resume_markdown: a.resume_markdown },
3093
+ t
3094
+ )).cover_letter_markdown || (await zr(e, t)).cover_letter_markdown;
3095
+ } catch {
3096
+ }
3097
+ const { url: o, slug: s } = await Rn(
3098
+ e,
3099
+ {
3100
+ resume_markdown: a.resume_markdown,
3101
+ ...r ? { cover_letter_markdown: r } : {}
3102
+ },
3103
+ t
3104
+ );
3105
+ return { slug: s, url: o, resume: a.resume_markdown, coverLetter: r };
3106
+ }
3107
+ async function po(e, t, n) {
3108
+ n({ phase: "queueing" });
3109
+ try {
3110
+ await Nn(e, "review", t), n({ phase: "queued" });
3111
+ } catch (a) {
3112
+ n({
3113
+ phase: "error",
3114
+ error: a instanceof re || a instanceof Error ? a.message : "Failed to hand this to the runner"
3115
+ });
3116
+ }
3117
+ }
3118
+ const ho = [
3119
+ { reason: "pay", label: "Pay too low" },
3120
+ { reason: "location", label: "Wrong location" },
3121
+ { reason: "stack", label: "Wrong stack" },
3122
+ { reason: "domain", label: "Boring domain" },
3123
+ { reason: "level", label: "Wrong level" },
3124
+ { reason: "company", label: "Company" },
3125
+ { reason: "other", label: "Other" }
3126
+ ], mo = [
3127
+ { reason: "domain", label: "Exciting domain" },
3128
+ { reason: "comp", label: "Great comp" },
3129
+ { reason: "fit", label: "Great fit" },
3130
+ { reason: "company", label: "Dream company" },
3131
+ { reason: "other", label: "Other" }
3132
+ ];
3133
+ function jn({
3134
+ jobId: e,
3135
+ auth: t,
3136
+ vote: n,
3137
+ reasons: a,
3138
+ onVoteChange: r,
3139
+ disabled: o,
3140
+ align: s = "end"
3141
+ }) {
3142
+ const [l, c] = E(null), u = Fe(null), h = (f) => {
3143
+ if (n === f) {
3144
+ const w = a;
3145
+ c(null), r(e, null, []), Vr(e).catch(() => r(e, f, w));
3146
+ return;
3147
+ }
3148
+ const m = n, C = a;
3149
+ r(e, f, []), qt(e, f, [], t).catch(() => r(e, m, C)), c(f);
3150
+ }, d = (f, m) => {
3151
+ const C = a, w = C.includes(m) ? C.filter((R) => R !== m) : [...C, m];
3152
+ r(e, f, w), qt(e, f, w, t).catch(() => r(e, f, C));
3153
+ };
3154
+ return /* @__PURE__ */ g(
3155
+ "div",
3156
+ {
3157
+ ref: u,
3158
+ className: `jp-vote${s === "start" ? " jp-vote--start" : ""}`,
3159
+ onBlur: (f) => {
3160
+ u.current?.contains(f.relatedTarget) || c(null);
3161
+ },
3162
+ onKeyDown: (f) => {
3163
+ f.key === "Escape" && l !== null && (f.stopPropagation(), c(null));
3164
+ },
3165
+ onClick: (f) => f.stopPropagation(),
3166
+ children: [
3167
+ /* @__PURE__ */ i(
3168
+ "button",
3169
+ {
3170
+ type: "button",
3171
+ className: `jp-vote__thumb jp-vote__thumb--up${n === 1 ? " jp-vote__thumb--active" : ""}`,
3172
+ disabled: o,
3173
+ onClick: () => h(1),
3174
+ "aria-pressed": n === 1,
3175
+ "aria-label": n === 1 ? "Clear upvote" : "Upvote",
3176
+ title: n === 1 ? "Clear upvote" : "Upvote",
3177
+ "data-testid": "vote-up",
3178
+ children: "👍"
3179
+ }
3180
+ ),
3181
+ /* @__PURE__ */ i(
3182
+ "button",
3183
+ {
3184
+ type: "button",
3185
+ className: `jp-vote__thumb jp-vote__thumb--down${n === -1 ? " jp-vote__thumb--active" : ""}`,
3186
+ disabled: o,
3187
+ onClick: () => h(-1),
3188
+ "aria-pressed": n === -1,
3189
+ "aria-label": n === -1 ? "Clear downvote" : "Downvote",
3190
+ title: n === -1 ? "Clear downvote" : "Downvote",
3191
+ "data-testid": "vote-down",
3192
+ children: "👎"
3193
+ }
3194
+ ),
3195
+ l !== null && /* @__PURE__ */ i("div", { className: "jp-vote__reasons", role: "menu", "aria-label": "Why?", "data-testid": "vote-reasons", children: (l === -1 ? ho : mo).map(({ reason: f, label: m }) => /* @__PURE__ */ i(
3196
+ "button",
3197
+ {
3198
+ type: "button",
3199
+ role: "menuitemcheckbox",
3200
+ "aria-checked": a.includes(f),
3201
+ className: `jp-vote__reason${a.includes(f) ? " jp-vote__reason--active" : ""}`,
3202
+ onClick: () => d(l, f),
3203
+ "data-testid": `vote-reason-${f}`,
3204
+ children: m
3205
+ },
3206
+ f
3207
+ )) })
3208
+ ]
3209
+ }
3210
+ );
3211
+ }
3212
+ function fo(e, t) {
3213
+ if (e === null && t === null) return null;
3214
+ const n = (a) => a >= 1e3 ? `$${Math.round(a / 1e3)}k` : `$${a}`;
3215
+ return e && t ? `${n(e)}–${n(t)}` : n(e ?? t);
3216
+ }
3217
+ function yo(e) {
3218
+ if (!e) return null;
3219
+ const t = new Date(e), n = Math.floor((Date.now() - t.getTime()) / 864e5);
3220
+ return n === 0 ? "today" : n === 1 ? "yesterday" : n < 30 ? `${n}d ago` : t.toLocaleDateString();
3221
+ }
3222
+ const go = {
3223
+ queued: "Queued",
3224
+ filled: "Filled",
3225
+ approved: "Approved",
3226
+ submitted: "Submitted",
3227
+ needs_manual: "Needs you",
3228
+ failed: "Failed",
3229
+ job_closed: "Closed"
3230
+ }, vo = {
3231
+ idle: "Apply",
3232
+ waiting: "…",
3233
+ preparing: "…",
3234
+ queueing: "…",
3235
+ queued: "Queued",
3236
+ error: "Retry"
3237
+ };
3238
+ function bo(e) {
3239
+ return e >= 0.75 ? "high" : e >= 0.5 ? "mid" : "low";
3240
+ }
3241
+ function wo({
3242
+ job: e,
3243
+ showScore: t,
3244
+ auth: n,
3245
+ vote: a,
3246
+ voteReasons: r,
3247
+ onClick: o,
3248
+ onVote: s,
3249
+ onApply: l,
3250
+ applyStatus: c
3251
+ }) {
3252
+ const u = fo(e.salary_min, e.salary_max), h = yo(e.posted_date ?? e.scraped_at), d = t ? bo(e.score) : null, v = e.state && e.state !== "new", b = e.state !== null && e.state !== void 0, _ = b, f = e.application_status ? "queued" : c?.phase ?? "idle", m = f === "waiting" || f === "preparing" || f === "queueing", C = ["jp-jobcard"];
3253
+ d && C.push(`jp-jobcard--score-${d}`), v && C.push(`jp-jobcard--state-${e.state}`), a === -1 && C.push("jp-jobcard--downvoted");
3254
+ const w = d ? `jp-jobcard__score jp-jobcard__score--${d}` : "jp-jobcard__score";
3255
+ return (
3256
+ // Not a <button>: the vote thumbs live inside the card, and buttons can't
3257
+ // nest. role+tabIndex+keydown keep it clickable and keyboard-activatable.
3258
+ /* @__PURE__ */ g(
3259
+ "div",
3260
+ {
3261
+ role: "button",
3262
+ tabIndex: 0,
3263
+ className: C.join(" "),
3264
+ onClick: o,
3265
+ onKeyDown: (R) => {
3266
+ R.target === R.currentTarget && (R.key === "Enter" || R.key === " ") && (R.preventDefault(), o());
3267
+ },
3268
+ children: [
3269
+ /* @__PURE__ */ g("div", { className: "jp-jobcard__top", children: [
3270
+ /* @__PURE__ */ i("span", { className: "jp-jobcard__title", children: e.title }),
3271
+ /* @__PURE__ */ g("div", { className: "jp-jobcard__top-right", children: [
3272
+ v && /* @__PURE__ */ i(
3273
+ "span",
3274
+ {
3275
+ className: `jp-jobcard__state jp-jobcard__state--${e.state}`,
3276
+ "data-testid": "card-state-badge",
3277
+ children: e.state
3278
+ }
3279
+ ),
3280
+ t && /* @__PURE__ */ i("span", { className: w, children: e.score.toFixed(2) }),
3281
+ b && /* @__PURE__ */ i(
3282
+ jn,
3283
+ {
3284
+ jobId: e.id,
3285
+ auth: n,
3286
+ vote: a,
3287
+ reasons: r,
3288
+ onVoteChange: s
3289
+ }
3290
+ )
3291
+ ] })
3292
+ ] }),
3293
+ /* @__PURE__ */ g("div", { className: "jp-jobcard__meta", children: [
3294
+ /* @__PURE__ */ i("span", { className: "jp-jobcard__company", children: e.company }),
3295
+ /* @__PURE__ */ i("span", { className: "jp-jobcard__sep", children: "·" }),
3296
+ /* @__PURE__ */ i("span", { children: e.location || "location unknown" }),
3297
+ e.workplace_type && e.workplace_type !== "unknown" && /* @__PURE__ */ g(He, { children: [
3298
+ /* @__PURE__ */ i("span", { className: "jp-jobcard__sep", children: "·" }),
3299
+ /* @__PURE__ */ i("span", { children: e.workplace_type })
3300
+ ] })
3301
+ ] }),
3302
+ /* @__PURE__ */ g("div", { className: "jp-jobcard__footer", children: [
3303
+ u && /* @__PURE__ */ i("span", { className: "jp-jobcard__salary", children: u }),
3304
+ e.url ? /* @__PURE__ */ g(
3305
+ "a",
3306
+ {
3307
+ className: "jp-jobcard__source jp-jobcard__source--link",
3308
+ href: e.url,
3309
+ target: "_blank",
3310
+ rel: "noopener noreferrer",
3311
+ onClick: (R) => R.stopPropagation(),
3312
+ title: "Open the original posting",
3313
+ children: [
3314
+ e.source_site,
3315
+ " ↗"
3316
+ ]
3317
+ }
3318
+ ) : /* @__PURE__ */ i("span", { className: "jp-jobcard__source", children: "added by hand" }),
3319
+ h && /* @__PURE__ */ i("span", { children: h }),
3320
+ /* @__PURE__ */ i(
3321
+ "button",
3322
+ {
3323
+ type: "button",
3324
+ className: `jp-jobcard__apply jp-jobcard__apply--${f}`,
3325
+ "data-testid": "card-apply",
3326
+ disabled: !_ || m || f === "queued",
3327
+ title: _ ? "Build the application packet and hand it to the form runner" : "Sign in to hand postings to the runner",
3328
+ onClick: (R) => {
3329
+ R.stopPropagation(), _ && l(e.id);
3330
+ },
3331
+ children: e.application_status ? go[e.application_status] : vo[f]
3332
+ }
3333
+ )
3334
+ ] })
3335
+ ]
3336
+ }
3337
+ )
3338
+ );
3339
+ }
3340
+ const _o = [
3341
+ { value: "", label: "All" },
3342
+ { value: "new", label: "New" },
3343
+ { value: "interested", label: "Interested" },
3344
+ { value: "saved", label: "Saved" },
3345
+ { value: "applied", label: "Applied" },
3346
+ { value: "interviewing", label: "Interviewing" },
3347
+ { value: "offered", label: "Offered" },
3348
+ { value: "rejected", label: "Rejected" },
3349
+ { value: "dismissed", label: "Dismissed" }
3350
+ ];
3351
+ function ko({
3352
+ auth: e,
3353
+ profileId: t,
3354
+ onSelect: n,
3355
+ refreshKey: a,
3356
+ voteOverrides: r,
3357
+ onVote: o,
3358
+ stateOverrides: s,
3359
+ awaitingProfile: l
3360
+ }) {
3361
+ const [c, u] = E(1), [h, d] = E({}), [v, b] = E("score"), [_, f] = E(""), [m, C] = E(""), [w, R] = E(!0), [$, x] = E(""), [F, J] = E(so), H = 25, P = w && m === "", A = !t && v === "score" ? "date" : v, B = fe(
3362
+ () => ({
3363
+ profile_id: t ?? void 0,
3364
+ state: m || void 0,
3365
+ page: c,
3366
+ limit: H,
3367
+ sort: A,
3368
+ workplace: $ || void 0,
3369
+ near: F?.place.key,
3370
+ radius_miles: F?.radius,
3371
+ include_remote: F?.includeRemote,
3372
+ // A posting handed to the runner belongs under Applications and Packets
3373
+ // from that point on. Leaving it in the feed offered an Apply button that
3374
+ // would queue it a second time.
3375
+ hide_queued: !0
3376
+ }),
3377
+ [t, m, c, H, A, $, F]
3378
+ ), {
3379
+ data: k,
3380
+ loading: U,
3381
+ refreshing: W,
3382
+ error: T
3383
+ } = Qe(`jobs:${a ?? 0}:${JSON.stringify(B)}`, () => Jr(B), {
3384
+ enabled: !l
3385
+ }), G = fe(() => k?.jobs ?? [], [k]), z = k?.total ?? 0, ie = T ? T instanceof re ? T.message : "Failed to load jobs" : null;
3386
+ Y(() => {
3387
+ u(1);
3388
+ }, [t, A, m, $, F]);
3389
+ const le = fe(
3390
+ () => G.map((j) => s[j.id] ? { ...j, state: s[j.id] } : j),
3391
+ [G, s]
3392
+ ), be = fe(() => {
3393
+ const j = new Set(
3394
+ Object.entries(h).filter(([, N]) => N.phase === "queued").map(([N]) => N)
3395
+ );
3396
+ let y = P ? le.filter((N) => N.state !== "dismissed") : le;
3397
+ if (y = y.filter((N) => !j.has(N.id) && !N.application_status), _.trim()) {
3398
+ const N = _.toLowerCase();
3399
+ y = y.filter(
3400
+ (I) => I.title.toLowerCase().includes(N) || I.company.toLowerCase().includes(N) || I.location.toLowerCase().includes(N)
3401
+ );
3402
+ }
3403
+ return y;
3404
+ }, [le, _, P, h]), we = se(
3405
+ (j) => {
3406
+ po(
3407
+ j,
3408
+ e,
3409
+ (y) => d((N) => ({ ...N, [j]: y }))
3410
+ );
3411
+ },
3412
+ [e]
3413
+ ), Pe = fe(() => {
3414
+ const j = Object.values(h).filter((y) => y.phase === "error");
3415
+ return j.length === 0 ? null : /* @__PURE__ */ i("p", { className: "jp-error", children: j.length === 1 ? j[0].error : `${j.length} postings failed — press Retry.` });
3416
+ }, [h]), _e = Math.max(1, Math.ceil(z / H)), ce = le.some((j) => j.state !== null && j.state !== void 0);
3417
+ return /* @__PURE__ */ g("div", { className: "jp-jobs", children: [
3418
+ /* @__PURE__ */ g("div", { className: "jp-jobs__filters", children: [
3419
+ /* @__PURE__ */ i(
3420
+ "input",
3421
+ {
3422
+ type: "search",
3423
+ placeholder: "Search title / company / location",
3424
+ value: _,
3425
+ onChange: (j) => f(j.target.value),
3426
+ className: "jp-jobs__search"
3427
+ }
3428
+ ),
3429
+ /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3430
+ "Sort",
3431
+ /* @__PURE__ */ g("select", { value: A, onChange: (j) => b(j.target.value), children: [
3432
+ t && /* @__PURE__ */ i("option", { value: "score", children: "Score" }),
3433
+ t && /* @__PURE__ */ i("option", { value: "comp", children: "Comp lens" }),
3434
+ t && /* @__PURE__ */ i("option", { value: "interest", children: "Interest lens" }),
3435
+ t && /* @__PURE__ */ i("option", { value: "relevance", children: "Relevance lens" }),
3436
+ /* @__PURE__ */ i("option", { value: "date", children: "Date" }),
3437
+ /* @__PURE__ */ i("option", { value: "salary", children: "Salary" })
3438
+ ] })
3439
+ ] }),
3440
+ /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3441
+ "Workplace",
3442
+ /* @__PURE__ */ g(
3443
+ "select",
3444
+ {
3445
+ value: $,
3446
+ onChange: (j) => x(j.target.value),
3447
+ children: [
3448
+ /* @__PURE__ */ i("option", { value: "", children: "All" }),
3449
+ /* @__PURE__ */ i("option", { value: "remote", children: "Remote" }),
3450
+ /* @__PURE__ */ i("option", { value: "hybrid", children: "Hybrid" }),
3451
+ /* @__PURE__ */ i("option", { value: "onsite", children: "Onsite" })
3452
+ ]
3453
+ }
3454
+ )
3455
+ ] }),
3456
+ /* @__PURE__ */ i(co, { auth: e, value: F, onChange: J }),
3457
+ ce && /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3458
+ "State",
3459
+ /* @__PURE__ */ i(
3460
+ "select",
3461
+ {
3462
+ value: m,
3463
+ onChange: (j) => C(j.target.value),
3464
+ children: _o.map((j) => /* @__PURE__ */ i("option", { value: j.value, children: j.label }, j.value || "all"))
3465
+ }
3466
+ )
3467
+ ] }),
3468
+ ce && m === "" && /* @__PURE__ */ g("label", { className: "jp-jobs__filter", children: [
3469
+ /* @__PURE__ */ i(
3470
+ "input",
3471
+ {
3472
+ type: "checkbox",
3473
+ checked: w,
3474
+ onChange: (j) => R(j.target.checked)
3475
+ }
3476
+ ),
3477
+ "Hide dismissed"
3478
+ ] })
3479
+ ] }),
3480
+ !t && /* @__PURE__ */ i("p", { className: "jp-muted", children: e.signedIn ? "No profile selected. Showing all jobs, unscored. Pick or create a profile to see its companies’ jobs, scored and ranked." : "Showing every job in the corpus, newest first. Scoring and ranking need a profile, which needs an account." }),
3481
+ ie && /* @__PURE__ */ i("p", { className: "jp-error", children: ie }),
3482
+ Pe,
3483
+ U ? /* @__PURE__ */ i("p", { className: "jp-muted", children: "Loading jobs…" }) : be.length === 0 ? /* @__PURE__ */ i("p", { className: "jp-muted", children: z === 0 ? "No jobs match your filters." : "No matches for the current search." }) : /* @__PURE__ */ i("ul", { className: "jp-jobs__list", "data-refreshing": W ? "true" : void 0, children: be.map((j) => {
3484
+ const y = r[j.id], N = y ? y.vote : j.vote ?? null, I = y ? y.reasons : j.vote_reasons ?? [];
3485
+ return /* @__PURE__ */ i("li", { children: /* @__PURE__ */ i(
3486
+ wo,
3487
+ {
3488
+ job: j,
3489
+ showScore: !!t,
3490
+ auth: e,
3491
+ vote: N,
3492
+ voteReasons: I,
3493
+ onClick: () => n(j.id, N),
3494
+ onVote: o,
3495
+ onApply: we,
3496
+ applyStatus: h[j.id]
3497
+ }
3498
+ ) }, j.id);
3499
+ }) }),
3500
+ z > H && /* @__PURE__ */ g("div", { className: "jp-jobs__pagination", children: [
3501
+ /* @__PURE__ */ i("button", { type: "button", disabled: c <= 1, onClick: () => u((j) => j - 1), children: "← Prev" }),
3502
+ /* @__PURE__ */ g("span", { children: [
3503
+ "Page ",
3504
+ c,
3505
+ " / ",
3506
+ _e,
3507
+ " · ",
3508
+ z,
3509
+ " total"
3510
+ ] }),
3511
+ /* @__PURE__ */ i("button", { type: "button", disabled: c >= _e, onClick: () => u((j) => j + 1), children: "Next →" })
3512
+ ] })
3513
+ ] });
3514
+ }
3515
+ const Ro = /* @__PURE__ */ new Set([
3516
+ "a",
3517
+ "b",
3518
+ "blockquote",
3519
+ "br",
3520
+ "code",
3521
+ "div",
3522
+ "em",
3523
+ "h1",
3524
+ "h2",
3525
+ "h3",
3526
+ "h4",
3527
+ "h5",
3528
+ "h6",
3529
+ "hr",
3530
+ "i",
3531
+ "li",
3532
+ "ol",
3533
+ "p",
3534
+ "pre",
3535
+ "span",
3536
+ "strong",
3537
+ "sub",
3538
+ "sup",
3539
+ "table",
3540
+ "tbody",
3541
+ "td",
3542
+ "th",
3543
+ "thead",
3544
+ "tr",
3545
+ "u",
3546
+ "ul"
3547
+ ]), Eo = /* @__PURE__ */ new Set([
3548
+ "script",
3549
+ "style",
3550
+ "iframe",
3551
+ "object",
3552
+ "embed",
3553
+ "noscript",
3554
+ "template",
3555
+ "svg",
3556
+ "math",
3557
+ "head",
3558
+ "title",
3559
+ "form",
3560
+ "select",
3561
+ "textarea",
3562
+ "button"
3563
+ ]);
3564
+ function No(e) {
3565
+ if (!e) return null;
3566
+ try {
3567
+ const t = new URL(e, "https://invalid.example/");
3568
+ return t.origin === "https://invalid.example" ? null : t.protocol === "https:" || t.protocol === "http:" ? t.href : null;
3569
+ } catch {
3570
+ return null;
3571
+ }
3572
+ }
3573
+ function mt(e, t, n) {
3574
+ for (const a of Array.from(e.childNodes)) {
3575
+ if (a.nodeType === Node.TEXT_NODE) {
3576
+ t.appendChild(n.createTextNode(a.textContent ?? ""));
3577
+ continue;
3578
+ }
3579
+ if (a.nodeType !== Node.ELEMENT_NODE) continue;
3580
+ const r = a, o = r.tagName.toLowerCase();
3581
+ if (Eo.has(o)) continue;
3582
+ if (!Ro.has(o)) {
3583
+ mt(r, t, n);
3584
+ continue;
3585
+ }
3586
+ const s = n.createElement(o);
3587
+ if (o === "a") {
3588
+ const l = No(r.getAttribute("href"));
3589
+ l && (s.setAttribute("href", l), s.setAttribute("target", "_blank"), s.setAttribute("rel", "noopener noreferrer nofollow"));
3590
+ }
3591
+ mt(r, s, n), t.appendChild(s);
3592
+ }
3593
+ }
3594
+ function Co(e) {
3595
+ const t = new DOMParser().parseFromString(e, "text/html"), n = document.implementation.createHTMLDocument(""), a = n.createElement("div");
3596
+ return mt(t.body, a, n), a.innerHTML;
3597
+ }
3598
+ const jo = ge(
3599
+ () => import("./ApplicationTracking-DV0cuiL2.js").then((e) => ({ default: e.ApplicationTracking }))
3600
+ ), So = ge(
3601
+ () => import("./ClipboardPalette-CzMDCmCp.js").then((e) => ({ default: e.ClipboardPalette }))
3602
+ ), Gt = {
3603
+ relevance: "Relevance",
3604
+ level_match: "Level",
3605
+ geo_fit: "Geo/Remote",
3606
+ comp_fit: "Comp",
3607
+ stack_fit: "Stack",
3608
+ domain_interest: "Interest",
3609
+ discipline_factor: "Discipline"
3610
+ }, Po = [
3611
+ [
3612
+ { state: "interested", label: "Interested", verb: "Mark interested" },
3613
+ { state: "saved", label: "Saved", verb: "Save" },
3614
+ { state: "dismissed", label: "Dismissed", verb: "Dismiss" }
3615
+ ],
3616
+ [
3617
+ { state: "applied", label: "Applied", verb: "Mark applied" },
3618
+ { state: "interviewing", label: "Interviewing", verb: "Interviewing" },
3619
+ { state: "offered", label: "Offered", verb: "Offer" },
3620
+ { state: "rejected", label: "Rejected", verb: "Rejected" }
3621
+ ]
3622
+ ];
3623
+ function xo({ text: e }) {
3624
+ return e ? /<(p|br|div|li|ul|ol|h[1-6])\b/i.test(e) ? /* @__PURE__ */ i(
3625
+ "div",
3626
+ {
3627
+ className: "jp-drawer__description",
3628
+ dangerouslySetInnerHTML: { __html: Co(e) }
3629
+ }
3630
+ ) : /* @__PURE__ */ i("div", { className: "jp-drawer__description jp-drawer__description--plain", children: e }) : /* @__PURE__ */ i("p", { className: "jp-drawer__description jp-muted", children: /* @__PURE__ */ i("em", { children: "No description" }) });
3631
+ }
3632
+ function ue({
3633
+ label: e,
3634
+ value: t,
3635
+ rows: n = 4,
3636
+ hint: a
3637
+ }) {
3638
+ const [r, o] = E(!1), s = Fe(null);
3639
+ return Y(
3640
+ () => () => {
3641
+ s.current && clearTimeout(s.current);
3642
+ },
3643
+ []
3644
+ ), /* @__PURE__ */ g("div", { className: "jp-drawer__kit-field", children: [
3645
+ /* @__PURE__ */ g("div", { className: "jp-drawer__kit-field-head", children: [
3646
+ /* @__PURE__ */ i("span", { className: "jp-drawer__kit-field-label", children: e }),
3647
+ a && /* @__PURE__ */ i("span", { className: "jp-muted jp-drawer__kit-field-hint", children: a }),
3648
+ /* @__PURE__ */ i("button", { type: "button", className: "jp-drawer__kit-copy", onClick: () => {
3649
+ navigator.clipboard?.writeText(t).then(() => {
3650
+ o(!0), s.current && clearTimeout(s.current), s.current = setTimeout(() => o(!1), 2e3);
3651
+ });
3652
+ }, children: r ? "Copied ✓" : "Copy" })
3653
+ ] }),
3654
+ /* @__PURE__ */ i(
3655
+ "textarea",
3656
+ {
3657
+ className: "jp-drawer__packet-text",
3658
+ readOnly: !0,
3659
+ rows: n,
3660
+ value: t,
3661
+ onFocus: (c) => c.currentTarget.select()
3662
+ }
3663
+ )
3664
+ ] });
3665
+ }
3666
+ function Lo({ tier: e, verified: t }) {
3667
+ if (t)
3668
+ return /* @__PURE__ */ i("p", { className: "jp-apply-tier jp-apply-tier--verified", children: "Auto-apply verified — the runner has filled a form on this board before." });
3669
+ const a = {
3670
+ supported: "The runner should be able to fill this form; it has not driven this board yet.",
3671
+ embedded: "This employer hosts its own careers page, but the form underneath is one the runner knows. Not tried on this board yet.",
3672
+ unsupported: "No adapter for this ATS — this one is by hand.",
3673
+ unknown: null
3674
+ }[e];
3675
+ return a ? /* @__PURE__ */ i("p", { className: `jp-apply-tier jp-apply-tier--${e}`, children: a }) : null;
3676
+ }
3677
+ function $o({
3678
+ auth: e,
3679
+ jobId: t,
3680
+ profileId: n,
3681
+ initialVote: a,
3682
+ onClose: r,
3683
+ onStateChange: o,
3684
+ onVoteChange: s,
3685
+ onTrackingChange: l,
3686
+ onCompanyBlocked: c
3687
+ }) {
3688
+ const [u, h] = E(null), [d, v] = E(null), [b, _] = E(null), [f, m] = E(a ?? null), [C, w] = E([]), [R, $] = E(!1), [x, F] = E(null), [J, H] = E(null), [P, A] = E(null), [B, k] = E(null), [U, W] = E(!1), [T, G] = E(null), [z, ie] = E(null), [le, be] = E(!1), [we, Pe] = E(!1), [_e, ce] = E(null), [j, y] = E(null), [N, I] = E(!1), [pe, Te] = E(!1), [he, Nt] = E(!1), {
3689
+ data: L,
3690
+ loading: Sn,
3691
+ error: Xe
3692
+ } = Qe(
3693
+ `job:${t}:${n ?? ""}`,
3694
+ () => qr(t, n ?? void 0)
3695
+ ), Ct = u ?? (Xe ? Xe instanceof re ? Xe.message : "Failed to load job" : null);
3696
+ Y(() => {
3697
+ h(null), v(null), m(a ?? null), F(null), H(null), A(null), k(null), G(null), ie(null), Pe(!1), ce(null), y(null), I(!1), Nt(!1);
3698
+ }, [t, n, a]), Y(() => {
3699
+ L && v(L.state);
3700
+ }, [L]), Y(() => {
3701
+ const S = (q) => {
3702
+ q.key === "Escape" && r();
3703
+ };
3704
+ return window.addEventListener("keydown", S), () => window.removeEventListener("keydown", S);
3705
+ }, [r]);
3706
+ const Pn = async (S) => {
3707
+ if (!b) {
3708
+ _(S), h(null);
3709
+ try {
3710
+ const ne = await Kr(t, S, e, S === "applied" ? z ?? void 0 : void 0);
3711
+ v(ne.state), De(`job:${t}:`), o?.(t, ne.state);
3712
+ } catch (q) {
3713
+ h(q instanceof re ? q.message : "Failed to update state");
3714
+ } finally {
3715
+ _(null);
3716
+ }
3717
+ }
3718
+ }, jt = async () => {
3719
+ if (R) return null;
3720
+ $(!0), H(null), k(null), A(null), G(null), ie(null), y(null), I(!1);
3721
+ try {
3722
+ const S = await uo(t, e, () => {
3723
+ });
3724
+ F({ resume: S.resume, coverLetter: S.coverLetter }), G(S.url), ie(S.slug);
3725
+ try {
3726
+ const q = await En(t, { resume_markdown: S.resume }, e);
3727
+ A(q);
3728
+ } catch (q) {
3729
+ k(
3730
+ q instanceof re ? q.message : "Failed to generate the application kit"
3731
+ );
3732
+ }
3733
+ return S.slug;
3734
+ } catch (S) {
3735
+ return H(S instanceof re ? S.message : "Failed to generate résumé"), null;
3736
+ } finally {
3737
+ $(!1);
3738
+ }
3739
+ }, xn = () => {
3740
+ jt();
3741
+ }, Ln = async () => {
3742
+ if (!(!x || U)) {
3743
+ W(!0), y(null);
3744
+ try {
3745
+ const { url: S, slug: q } = await Rn(
3746
+ t,
3747
+ { resume_markdown: x.resume, cover_letter_markdown: x.coverLetter },
3748
+ e
3749
+ );
3750
+ G(S), ie(q);
3751
+ } catch (S) {
3752
+ y(S instanceof re ? S.message : "Failed to create link");
3753
+ } finally {
3754
+ W(!1);
3755
+ }
3756
+ }
3757
+ };
3758
+ async function $n() {
3759
+ be(!0), ce(null);
3760
+ try {
3761
+ if (!(z ?? await jt())) {
3762
+ ce(
3763
+ "The application packet could not be built, so there is nothing to queue — see the error above."
3764
+ );
3765
+ return;
3766
+ }
3767
+ await Nn(t, "review", e), Pe(!0);
3768
+ } catch (S) {
3769
+ ce(S instanceof re ? S.message : "Failed to queue the application");
3770
+ } finally {
3771
+ be(!1);
3772
+ }
3773
+ }
3774
+ const Tn = async () => {
3775
+ if (!(!L || pe)) {
3776
+ Te(!0), h(null);
3777
+ try {
3778
+ await ro(L.company, e), Nt(!0), De("blocked-companies"), c?.(L.company);
3779
+ } catch (S) {
3780
+ h(S instanceof re ? S.message : "Failed to hide the company");
3781
+ } finally {
3782
+ Te(!1);
3783
+ }
3784
+ }
3785
+ }, An = () => {
3786
+ T && navigator.clipboard?.writeText(T).then(
3787
+ () => {
3788
+ I(!0), setTimeout(() => I(!1), 2e3);
3789
+ },
3790
+ () => y("Copy failed — select the link and copy manually")
3791
+ );
3792
+ }, ke = d !== null;
3793
+ return /* @__PURE__ */ g(He, { children: [
3794
+ /* @__PURE__ */ i(
3795
+ "div",
3796
+ {
3797
+ className: "jp-drawer-backdrop",
3798
+ "data-telemetry": "Close drawer (backdrop)",
3799
+ onClick: r
3800
+ }
3801
+ ),
3802
+ /* @__PURE__ */ g("aside", { className: "jp-drawer", role: "dialog", "aria-labelledby": "jp-drawer-title", children: [
3803
+ /* @__PURE__ */ i("div", { className: "jp-drawer__header", children: /* @__PURE__ */ i("button", { type: "button", className: "jp-drawer__close", onClick: r, "aria-label": "Close", children: "×" }) }),
3804
+ Sn && /* @__PURE__ */ i("p", { className: "jp-muted", children: "Loading…" }),
3805
+ Ct && /* @__PURE__ */ i("p", { className: "jp-error", children: Ct }),
3806
+ L && /* @__PURE__ */ g(He, { children: [
3807
+ /* @__PURE__ */ i("h2", { id: "jp-drawer-title", className: "jp-drawer__title", children: L.title }),
3808
+ /* @__PURE__ */ g("p", { className: "jp-drawer__company", children: [
3809
+ L.company,
3810
+ " · ",
3811
+ L.location || "location unknown",
3812
+ L.workplace_type && L.workplace_type !== "unknown" && ` · ${L.workplace_type}`
3813
+ ] }),
3814
+ /* @__PURE__ */ g("div", { className: "jp-drawer__facts", children: [
3815
+ /* @__PURE__ */ i("span", { children: L.source_site }),
3816
+ L.job_type && L.job_type !== "unknown" && /* @__PURE__ */ i("span", { children: L.job_type }),
3817
+ (L.salary_min || L.salary_max) && /* @__PURE__ */ g("span", { children: [
3818
+ "$",
3819
+ L.salary_min ?? "?",
3820
+ " – $",
3821
+ L.salary_max ?? "?"
3822
+ ] }),
3823
+ L.posted_date && /* @__PURE__ */ g("span", { children: [
3824
+ "Posted ",
3825
+ L.posted_date
3826
+ ] }),
3827
+ d && d !== "new" && /* @__PURE__ */ i(
3828
+ "span",
3829
+ {
3830
+ className: `jp-drawer__facts-state jp-drawer__facts-state--${d}`,
3831
+ "data-testid": "drawer-state-badge",
3832
+ children: d
3833
+ }
3834
+ )
3835
+ ] }),
3836
+ n && /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3837
+ /* @__PURE__ */ i("h3", { children: "Score breakdown" }),
3838
+ /* @__PURE__ */ g("div", { className: "jp-drawer__score-total", children: [
3839
+ "Total: ",
3840
+ /* @__PURE__ */ i("strong", { children: L.score.toFixed(2) })
3841
+ ] }),
3842
+ /* @__PURE__ */ i("ul", { className: "jp-drawer__breakdown", children: Object.keys(Gt).map((S) => /* @__PURE__ */ g("li", { children: [
3843
+ /* @__PURE__ */ i("span", { className: "jp-drawer__breakdown-label", children: Gt[S] }),
3844
+ /* @__PURE__ */ i("div", { className: "jp-drawer__breakdown-bar", children: /* @__PURE__ */ i(
3845
+ "div",
3846
+ {
3847
+ className: "jp-drawer__breakdown-fill",
3848
+ style: { width: `${Math.min(100, L.score_breakdown[S] * 100)}%` }
3849
+ }
3850
+ ) }),
3851
+ /* @__PURE__ */ i("span", { className: "jp-drawer__breakdown-value", children: L.score_breakdown[S].toFixed(2) })
3852
+ ] }, S)) })
3853
+ ] }),
3854
+ /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3855
+ /* @__PURE__ */ i("h3", { children: "Description" }),
3856
+ /* @__PURE__ */ i(xo, { text: L.description })
3857
+ ] }),
3858
+ /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3859
+ /* @__PURE__ */ i("h3", { children: "Triage" }),
3860
+ !ke && /* @__PURE__ */ i("p", { className: "jp-muted", children: "Sign in to track your interest in this job." }),
3861
+ /* @__PURE__ */ i("div", { className: "jp-drawer__vote", children: /* @__PURE__ */ i(
3862
+ jn,
3863
+ {
3864
+ jobId: t,
3865
+ auth: e,
3866
+ vote: f,
3867
+ reasons: C,
3868
+ disabled: !ke,
3869
+ align: "start",
3870
+ onVoteChange: (S, q, ne) => {
3871
+ m(q), w(ne), s?.(S, q, ne);
3872
+ }
3873
+ }
3874
+ ) }),
3875
+ Po.map((S, q) => /* @__PURE__ */ i("div", { className: "jp-drawer__actions jp-drawer__actions--states", children: S.map(({ state: ne, label: On, verb: Dn }) => {
3876
+ const Ze = d === ne, Fn = b === ne;
3877
+ return /* @__PURE__ */ i(
3878
+ "button",
3879
+ {
3880
+ type: "button",
3881
+ className: `jp-drawer__cta jp-drawer__cta--state-${ne}${Ze ? " jp-drawer__cta--active" : ""}`,
3882
+ disabled: !ke || b !== null,
3883
+ onClick: () => {
3884
+ Pn(ne);
3885
+ },
3886
+ "aria-pressed": Ze,
3887
+ "data-testid": `state-action-${ne}`,
3888
+ children: Fn ? "…" : Ze ? On : Dn
3889
+ },
3890
+ ne
3891
+ );
3892
+ }) }, q)),
3893
+ ke && /* @__PURE__ */ i("p", { className: "jp-drawer__block", children: he ? /* @__PURE__ */ g("span", { "data-testid": "company-blocked", children: [
3894
+ L.company,
3895
+ " is hidden from your feed. Undo it on the Profile tab."
3896
+ ] }) : /* @__PURE__ */ i(
3897
+ "button",
3898
+ {
3899
+ type: "button",
3900
+ className: "jp-drawer__link",
3901
+ onClick: () => {
3902
+ Tn();
3903
+ },
3904
+ disabled: pe,
3905
+ "data-testid": "block-company",
3906
+ children: pe ? "Hiding…" : `Hide every ${L.company} posting from my feed`
3907
+ }
3908
+ ) })
3909
+ ] }),
3910
+ d && d !== "new" && /* @__PURE__ */ i(it, { fallback: /* @__PURE__ */ i("p", { className: "jp-muted", children: "Loading tracking…" }), children: /* @__PURE__ */ i(
3911
+ jo,
3912
+ {
3913
+ auth: e,
3914
+ jobId: t,
3915
+ state: d,
3916
+ tracking: L.tracking,
3917
+ onChanged: () => l?.()
3918
+ },
3919
+ t
3920
+ ) }),
3921
+ /* @__PURE__ */ g("section", { className: "jp-drawer__section", children: [
3922
+ /* @__PURE__ */ i("h3", { children: "Apply" }),
3923
+ /* @__PURE__ */ i(Lo, { tier: L.apply_tier, verified: L.apply_verified }),
3924
+ ke && /* @__PURE__ */ i(it, { fallback: null, children: /* @__PURE__ */ i(So, { auth: e }) }),
3925
+ /* @__PURE__ */ g("div", { className: "jp-drawer__actions", children: [
3926
+ (L.application_url ?? L.url) && /* @__PURE__ */ g(
3927
+ "a",
3928
+ {
3929
+ className: "jp-drawer__cta jp-drawer__cta--primary",
3930
+ href: L.application_url ?? L.url ?? void 0,
3931
+ target: "_blank",
3932
+ rel: "noopener noreferrer",
3933
+ children: [
3934
+ "Apply on ",
3935
+ L.source_site
3936
+ ]
3937
+ }
3938
+ ),
3939
+ /* @__PURE__ */ i(
3940
+ "button",
3941
+ {
3942
+ type: "button",
3943
+ className: "jp-drawer__cta",
3944
+ onClick: xn,
3945
+ disabled: !ke || R,
3946
+ "data-testid": "prepare-application",
3947
+ children: R ? "Preparing…" : x ? "Regenerate application" : "Prepare application"
3948
+ }
3949
+ )
3950
+ ] }),
3951
+ J && /* @__PURE__ */ i("p", { className: "jp-error", children: J }),
3952
+ /* @__PURE__ */ g("div", { className: "jp-drawer__apply", children: [
3953
+ /* @__PURE__ */ i(
3954
+ "button",
3955
+ {
3956
+ type: "button",
3957
+ className: "jp-drawer__cta jp-drawer__cta--primary",
3958
+ onClick: () => {
3959
+ $n();
3960
+ },
3961
+ disabled: !ke || le || we || R,
3962
+ "data-testid": "queue-application",
3963
+ title: z ? "Queue this application for the form runner" : "Builds the application packet, then queues it for the form runner",
3964
+ children: we ? "Queued ✓" : le ? z ? "Queueing…" : "Preparing, then queueing…" : "Hand to runner"
3965
+ }
3966
+ ),
3967
+ /* @__PURE__ */ i("span", { className: "jp-muted", children: we ? "Fills, then waits for your approval." : "Review mode — nothing is sent without your approval." })
3968
+ ] }),
3969
+ _e && /* @__PURE__ */ i("p", { className: "jp-error", children: _e }),
3970
+ x && /* @__PURE__ */ g("div", { className: "jp-drawer__packet", children: [
3971
+ /* @__PURE__ */ i(ue, { label: "Tailored résumé", value: x.resume, rows: 12 }),
3972
+ x.coverLetter && /* @__PURE__ */ i(ue, { label: "Cover letter", value: x.coverLetter, rows: 12 }),
3973
+ /* @__PURE__ */ i("div", { className: "jp-drawer__packet-link", children: T ? /* @__PURE__ */ g(He, { children: [
3974
+ /* @__PURE__ */ i(
3975
+ "input",
3976
+ {
3977
+ className: "jp-drawer__packet-link-input",
3978
+ readOnly: !0,
3979
+ value: T,
3980
+ onFocus: (S) => S.currentTarget.select(),
3981
+ "aria-label": "Shareable packet link"
3982
+ }
3983
+ ),
3984
+ /* @__PURE__ */ i("button", { type: "button", className: "jp-drawer__cta", onClick: An, children: N ? "Copied ✓" : "Copy" }),
3985
+ /* @__PURE__ */ i(
3986
+ "a",
3987
+ {
3988
+ className: "jp-drawer__cta",
3989
+ href: T,
3990
+ target: "_blank",
3991
+ rel: "noopener noreferrer",
3992
+ children: "Open"
3993
+ }
3994
+ )
3995
+ ] }) : /* @__PURE__ */ i(
3996
+ "button",
3997
+ {
3998
+ type: "button",
3999
+ className: "jp-drawer__cta jp-drawer__cta--primary",
4000
+ onClick: () => {
4001
+ Ln();
4002
+ },
4003
+ disabled: U || !x.coverLetter,
4004
+ children: U ? "Creating link…" : "Create shareable link"
4005
+ }
4006
+ ) }),
4007
+ j && /* @__PURE__ */ i("p", { className: "jp-error", children: j }),
4008
+ R && !P && /* @__PURE__ */ i("p", { className: "jp-muted", children: "Preparing the rest of the kit…" }),
4009
+ B && /* @__PURE__ */ i("p", { className: "jp-error", children: B }),
4010
+ P && /* @__PURE__ */ g("div", { className: "jp-drawer__kit", children: [
4011
+ /* @__PURE__ */ i(ue, { label: "Intro email", value: P.intro_email, rows: 8 }),
4012
+ /* @__PURE__ */ i(ue, { label: "Why this role", value: P.why_hook, rows: 3 }),
4013
+ P.screening_answers.map((S, q) => /* @__PURE__ */ i(ue, { label: S.q, value: S.a, rows: 4 }, q)),
4014
+ /* @__PURE__ */ i(
4015
+ ue,
4016
+ {
4017
+ label: "Expected compensation",
4018
+ value: P.salary_line,
4019
+ rows: 2
4020
+ }
4021
+ ),
4022
+ /* @__PURE__ */ i(
4023
+ ue,
4024
+ {
4025
+ label: "LinkedIn note",
4026
+ value: P.linkedin_note,
4027
+ rows: 3,
4028
+ hint: `${P.linkedin_note.length}/300`
4029
+ }
4030
+ ),
4031
+ /* @__PURE__ */ i(
4032
+ ue,
4033
+ {
4034
+ label: "Phone-screen talking points",
4035
+ value: P.talking_points.map((S) => `• ${S}`).join(`
4036
+ `),
4037
+ rows: Math.max(3, P.talking_points.length)
4038
+ }
4039
+ ),
4040
+ /* @__PURE__ */ i(
4041
+ ue,
4042
+ {
4043
+ label: "Standard fields",
4044
+ value: P.standard_fields,
4045
+ rows: 8,
4046
+ hint: "name · contact · work auth"
4047
+ }
4048
+ )
4049
+ ] })
4050
+ ] })
4051
+ ] })
4052
+ ] })
4053
+ ] })
4054
+ ] });
4055
+ }
4056
+ const To = ge(
4057
+ () => import("./ApplicationsList-CHMuz8-r.js").then((e) => ({ default: e.ApplicationsList }))
4058
+ ), Ao = ge(
4059
+ () => import("./PacketsList-D8yefRip.js").then((e) => ({ default: e.PacketsList }))
4060
+ ), Oo = ge(
4061
+ () => import("./PacketDetail-DgtC60z5.js").then((e) => ({ default: e.PacketDetail }))
4062
+ ), Do = ge(
4063
+ () => import("./PipelineBoard-DdxFEviC.js").then((e) => ({ default: e.PipelineBoard }))
4064
+ ), Fo = ge(
4065
+ () => import("./InsightsPage-DbVHXS5R.js").then((e) => ({ default: e.InsightsPage }))
4066
+ ), Uo = ge(
4067
+ () => import("./ProfilePage-BMkG7wxF.js").then((e) => ({ default: e.ProfilePage }))
4068
+ ), Io = /* @__PURE__ */ i("p", { className: "jp-muted", children: "Loading…" });
4069
+ function Mo(e = {}) {
4070
+ const t = Fe(null);
4071
+ return /* @__PURE__ */ i(Wn, { theme: e.theme, containerRef: t, children: /* @__PURE__ */ i(Bo, { ...e, containerRef: t }) });
4072
+ }
4073
+ function Bo(e) {
4074
+ const { containerRef: t } = e, n = !!e.userType && e.userType !== "public", a = fe(() => ({ signedIn: n }), [n]), [r] = E(() => window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)").matches : !1), { theme: o, isDarkTheme: s, isThemeReady: l, isInitialThemeLoad: c } = Jn();
4075
+ return c && !l ? /* @__PURE__ */ i(Bn, { isDarkTheme: r }) : /* @__PURE__ */ i(
4076
+ "main",
4077
+ {
4078
+ ref: t,
4079
+ className: "job-platform-container",
4080
+ "data-theme": o,
4081
+ "data-dark-theme": s ? "true" : "false",
4082
+ children: /* @__PURE__ */ i(mr, { children: /* @__PURE__ */ g("div", { className: "job-platform", children: [
4083
+ /* @__PURE__ */ i(Hn, { title: e.appName ?? "Job Platform" }),
4084
+ /* @__PURE__ */ i(Ho, {}),
4085
+ /* @__PURE__ */ i(it, { fallback: Io, children: /* @__PURE__ */ g(Wa, { children: [
4086
+ /* @__PURE__ */ g(Q, { element: /* @__PURE__ */ i(Go, { auth: a }), children: [
4087
+ /* @__PURE__ */ i(Q, { index: !0, element: null }),
4088
+ /* @__PURE__ */ i(Q, { path: "jobs/:jobId", element: /* @__PURE__ */ i(zt, { auth: a, base: "/" }) })
4089
+ ] }),
4090
+ /* @__PURE__ */ g(Q, { path: "pipeline", element: /* @__PURE__ */ i(Wo, { auth: a }), children: [
4091
+ /* @__PURE__ */ i(Q, { index: !0, element: null }),
4092
+ /* @__PURE__ */ i(
4093
+ Q,
4094
+ {
4095
+ path: "jobs/:jobId",
4096
+ element: /* @__PURE__ */ i(zt, { auth: a, base: "/pipeline" })
4097
+ }
4098
+ )
4099
+ ] }),
4100
+ /* @__PURE__ */ i(Q, { path: "applications", element: /* @__PURE__ */ i(Jo, { auth: a }) }),
4101
+ /* @__PURE__ */ i(Q, { path: "packets", element: /* @__PURE__ */ i(qo, { auth: a }) }),
4102
+ /* @__PURE__ */ i(
4103
+ Q,
4104
+ {
4105
+ path: "insights",
4106
+ element: /* @__PURE__ */ i("section", { className: "jp-main", children: /* @__PURE__ */ i(Fo, { auth: a }) })
4107
+ }
4108
+ ),
4109
+ /* @__PURE__ */ i(
4110
+ Q,
4111
+ {
4112
+ path: "profile",
4113
+ element: /* @__PURE__ */ i("section", { className: "jp-main", children: /* @__PURE__ */ i(Uo, { auth: a }) })
4114
+ }
4115
+ ),
4116
+ /* @__PURE__ */ i(Q, { path: "packets/:jobId/:slug", element: /* @__PURE__ */ i(Ko, { auth: a }) }),
4117
+ /* @__PURE__ */ i(Q, { path: "*", element: /* @__PURE__ */ i(fn, { to: "/", replace: !0 }) })
4118
+ ] }) })
4119
+ ] }) })
4120
+ }
4121
+ );
4122
+ }
4123
+ function Ho() {
4124
+ const { pathname: e } = te(), t = e.startsWith("/packets") ? "packets" : e.startsWith("/applications") ? "applications" : e.startsWith("/pipeline") ? "pipeline" : e.startsWith("/insights") ? "insights" : e.startsWith("/profile") ? "profile" : "feed";
4125
+ return /* @__PURE__ */ g("nav", { className: "job-platform__nav", children: [
4126
+ /* @__PURE__ */ i(me, { to: "/", className: t === "feed" ? "active" : void 0, children: "Feed" }),
4127
+ /* @__PURE__ */ i(me, { to: "/pipeline", className: t === "pipeline" ? "active" : void 0, children: "Pipeline" }),
4128
+ /* @__PURE__ */ i(me, { to: "/applications", className: t === "applications" ? "active" : void 0, children: "Applications" }),
4129
+ /* @__PURE__ */ i(me, { to: "/packets", className: t === "packets" ? "active" : void 0, children: "Packets" }),
4130
+ /* @__PURE__ */ i(me, { to: "/insights", className: t === "insights" ? "active" : void 0, children: "Insights" }),
4131
+ /* @__PURE__ */ i(me, { to: "/profile", className: t === "profile" ? "active" : void 0, children: "Profile" })
4132
+ ] });
4133
+ }
4134
+ function Wo({ auth: e }) {
4135
+ const t = ve(), [n, a] = E(0), r = se(() => a((s) => s + 1), []), o = fe(
4136
+ () => ({ onJobStateChanged: r, onTrackingChanged: r }),
4137
+ [r]
4138
+ );
4139
+ return /* @__PURE__ */ g("section", { className: "jp-main", children: [
4140
+ /* @__PURE__ */ i(
4141
+ Do,
4142
+ {
4143
+ auth: e,
4144
+ reloadKey: n,
4145
+ onSelect: (s) => {
4146
+ t(`/pipeline/jobs/${encodeURIComponent(s)}`);
4147
+ }
4148
+ }
4149
+ ),
4150
+ /* @__PURE__ */ i(yn, { context: o })
4151
+ ] });
4152
+ }
4153
+ function Jo({ auth: e }) {
4154
+ return /* @__PURE__ */ i("section", { className: "jp-main", children: /* @__PURE__ */ i(To, { auth: e }) });
4155
+ }
4156
+ function qo({ auth: e }) {
4157
+ const t = ve();
4158
+ return /* @__PURE__ */ i("section", { className: "jp-main", children: /* @__PURE__ */ i(
4159
+ Ao,
4160
+ {
4161
+ auth: e,
4162
+ onSelect: (n) => {
4163
+ t(
4164
+ `/packets/${encodeURIComponent(n.job_id)}/${encodeURIComponent(n.variant_slug)}`
4165
+ );
4166
+ }
4167
+ }
4168
+ ) });
4169
+ }
4170
+ function Ko({ auth: e }) {
4171
+ const { jobId: t, slug: n } = dn(), a = ve();
4172
+ return !t || !n ? /* @__PURE__ */ i(fn, { to: "/packets", replace: !0 }) : /* @__PURE__ */ i(Oo, { auth: e, jobId: t, slug: n, onClose: () => {
4173
+ a("/packets");
4174
+ } });
4175
+ }
4176
+ const ft = "jobplatform:last-profile";
4177
+ function Vo() {
4178
+ try {
4179
+ return window.localStorage.getItem(ft);
4180
+ } catch {
4181
+ return null;
4182
+ }
4183
+ }
4184
+ function Go({ auth: e }) {
4185
+ const [t, n] = wn(), a = ve(), r = se(
4186
+ (P) => {
4187
+ try {
4188
+ P ? window.localStorage.setItem(ft, P) : window.localStorage.removeItem(ft);
4189
+ } catch {
4190
+ }
4191
+ n(
4192
+ (A) => {
4193
+ const B = new URLSearchParams(A);
4194
+ return P ? B.set("profile", P) : B.delete("profile"), B;
4195
+ },
4196
+ { replace: !0 }
4197
+ );
4198
+ },
4199
+ [n]
4200
+ ), [o] = E(() => t.get("profile") ? null : Vo());
4201
+ Y(() => {
4202
+ o && !t.get("profile") && r(o);
4203
+ }, [o, t, r]);
4204
+ const s = t.get("profile") ?? o, [l, c] = E(!1), u = se((P) => c(P === 0), []), h = e.signedIn && !s && !l, [d, v] = E(0), b = se(() => {
4205
+ De("jobs:"), v((P) => P + 1);
4206
+ }, []), [_, f] = E({}), m = se(
4207
+ (P, A) => f((B) => ({ ...B, [P]: A })),
4208
+ []
4209
+ ), [C, w] = E({}), R = se(
4210
+ (P, A, B) => {
4211
+ w((k) => ({ ...k, [P]: { vote: A, reasons: B } }));
4212
+ },
4213
+ []
4214
+ ), [$, x] = E(null), [F, J] = E(0), H = fe(
4215
+ () => ({ onJobStateChanged: m, onJobVoted: R, onCompanyBlocked: b }),
4216
+ [m, R, b]
4217
+ );
4218
+ return /* @__PURE__ */ g("div", { className: "jp-dashboard", children: [
4219
+ /* @__PURE__ */ i(
4220
+ Wr,
4221
+ {
4222
+ auth: e,
4223
+ selectedId: s,
4224
+ onSelect: r,
4225
+ onNew: () => x({ mode: "new" }),
4226
+ onEdit: (P) => x({ mode: "edit", profile: P }),
4227
+ reloadKey: F,
4228
+ onResolved: u
4229
+ }
4230
+ ),
4231
+ /* @__PURE__ */ i("section", { className: "jp-main", children: /* @__PURE__ */ i(
4232
+ ko,
4233
+ {
4234
+ auth: e,
4235
+ profileId: s,
4236
+ refreshKey: d,
4237
+ voteOverrides: C,
4238
+ onVote: R,
4239
+ stateOverrides: _,
4240
+ awaitingProfile: h,
4241
+ onSelect: (P, A) => {
4242
+ const B = s ? `?profile=${encodeURIComponent(s)}` : "";
4243
+ a(`/jobs/${encodeURIComponent(P)}${B}`, { state: { vote: A } });
4244
+ }
4245
+ }
4246
+ ) }),
4247
+ /* @__PURE__ */ i(yn, { context: H }),
4248
+ $ && /* @__PURE__ */ i(
4249
+ no,
4250
+ {
4251
+ auth: e,
4252
+ initial: $.mode === "edit" ? $.profile : null,
4253
+ onClose: () => x(null),
4254
+ onSaved: (P) => {
4255
+ J((A) => A + 1), r(P.id), b();
4256
+ },
4257
+ onCompaniesChanged: b
4258
+ }
4259
+ )
4260
+ ] });
4261
+ }
4262
+ function zt({ auth: e, base: t }) {
4263
+ const { jobId: n } = dn(), [a] = wn(), r = a.get("profile"), o = ve(), s = te(), l = ja();
4264
+ if (!n) return null;
4265
+ const c = s.state?.vote ?? null;
4266
+ return /* @__PURE__ */ i(
4267
+ $o,
4268
+ {
4269
+ auth: e,
4270
+ jobId: n,
4271
+ profileId: r,
4272
+ initialVote: c,
4273
+ onClose: () => {
4274
+ const h = r ? `?profile=${encodeURIComponent(r)}` : "";
4275
+ o(`${t}${h}`);
4276
+ },
4277
+ onStateChange: (h, d) => l.onJobStateChanged(h, d),
4278
+ onVoteChange: l.onJobVoted,
4279
+ onTrackingChange: l.onTrackingChanged,
4280
+ onCompanyBlocked: l.onCompanyBlocked
4281
+ }
4282
+ );
4283
+ }
4284
+ class zo extends Mn {
4285
+ state = { error: null };
4286
+ static getDerivedStateFromError(t) {
4287
+ return { error: t };
4288
+ }
4289
+ componentDidCatch(t, n) {
4290
+ ye(
4291
+ "ui.error",
4292
+ {
4293
+ message: t.message,
4294
+ name: t.name,
4295
+ component: n.componentStack?.trim().split(`
4296
+ `)[0] ?? null
4297
+ },
4298
+ "error"
4299
+ ), xe();
4300
+ }
4301
+ render() {
4302
+ return this.state.error ? /* @__PURE__ */ g("div", { className: "jp-crash", role: "alert", children: [
4303
+ /* @__PURE__ */ g("p", { children: [
4304
+ "Something broke while showing this page: ",
4305
+ this.state.error.message
4306
+ ] }),
4307
+ /* @__PURE__ */ i("button", { type: "button", onClick: () => location.reload(), children: "Reload" })
4308
+ ] }) : this.props.children;
4309
+ }
4310
+ }
4311
+ function fi(e, t = {}) {
4312
+ const n = Un(e);
4313
+ n.render(
4314
+ /* @__PURE__ */ i(zo, { children: /* @__PURE__ */ i(Mo, { ...t }) })
4315
+ ), e.__root = n, e.__stopTelemetry = xr(e, { app: "jobplatform" }), Yt.info("[job-platform] Mounted successfully", { theme: t.theme });
4316
+ }
4317
+ function yi(e) {
4318
+ e.__stopTelemetry?.(), e.__root?.unmount(), Yt.info("[job-platform] Unmounted successfully");
4319
+ }
4320
+ export {
4321
+ xo as D,
4322
+ re as J,
4323
+ ii as a,
4324
+ ci as b,
4325
+ ai as c,
4326
+ ri as d,
4327
+ ni as e,
4328
+ li as f,
4329
+ qr as g,
4330
+ Kr as h,
4331
+ De as i,
4332
+ mi as j,
4333
+ ui as k,
4334
+ oi as l,
4335
+ pi as m,
4336
+ di as n,
4337
+ ro as o,
4338
+ hi as p,
4339
+ Se as q,
4340
+ Cn as r,
4341
+ si as s,
4342
+ O as t,
4343
+ Qe as u,
4344
+ fi as v,
4345
+ yi as w
4346
+ };