@inertiaui/notifications-react 1.0.1 → 1.0.2
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.
- package/dist/inertiaui-notifications.js +714 -705
- package/package.json +1 -1
|
@@ -97,32 +97,37 @@ function ne(e) {
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
function U(e) {
|
|
100
|
-
|
|
100
|
+
let t = new URL(window.location.href), n = new URL(e.url, t);
|
|
101
|
+
for (let e of [t, n]) e.hash = "", e.searchParams.sort();
|
|
102
|
+
return n.href === t.href;
|
|
101
103
|
}
|
|
102
104
|
function re(e) {
|
|
105
|
+
return e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey;
|
|
106
|
+
}
|
|
107
|
+
function ie(e) {
|
|
103
108
|
let t = e.target;
|
|
104
109
|
return typeof t?.closest == "function" && t.closest("a[href]") !== null;
|
|
105
110
|
}
|
|
106
|
-
function
|
|
107
|
-
return !e.onClick &&
|
|
111
|
+
function ae(e, t, n) {
|
|
112
|
+
return !e.onClick && ie(n) && (re(n) || e.external || e.newTab || !ne(t));
|
|
108
113
|
}
|
|
109
|
-
var
|
|
110
|
-
function
|
|
114
|
+
var oe = 1500;
|
|
115
|
+
function se(e, t) {
|
|
111
116
|
let n, r = () => {
|
|
112
117
|
n !== void 0 && (clearTimeout(n), n = void 0, window.location.assign(t));
|
|
113
118
|
};
|
|
114
|
-
n = setTimeout(r,
|
|
119
|
+
n = setTimeout(r, oe), e.then(r, r);
|
|
115
120
|
}
|
|
116
|
-
function
|
|
121
|
+
function W(e, t, n, r, i) {
|
|
117
122
|
r();
|
|
118
123
|
let a = i?.();
|
|
119
|
-
a && !
|
|
124
|
+
a && !re(n) && !t.newTab && (n.preventDefault(), se(a, e));
|
|
120
125
|
}
|
|
121
|
-
var
|
|
122
|
-
function
|
|
126
|
+
var ce = (e) => typeof e?.then == "function";
|
|
127
|
+
function le(e, t, n, r, i) {
|
|
123
128
|
e.event && window.dispatchEvent(new CustomEvent(e.event, { detail: e.payload }));
|
|
124
129
|
let a = e.onClick?.(t);
|
|
125
|
-
if (
|
|
130
|
+
if (ce(a)) return a.then(() => {
|
|
126
131
|
i?.(), r(!0);
|
|
127
132
|
}, () => r(!1)), "pending";
|
|
128
133
|
let o = L(e.href);
|
|
@@ -132,7 +137,7 @@ function ce(e, t, n, r, i) {
|
|
|
132
137
|
if (e.newTab) window.open(o, "_blank", "noopener"), i?.();
|
|
133
138
|
else {
|
|
134
139
|
let e = i?.();
|
|
135
|
-
e ?
|
|
140
|
+
e ? se(e, o) : window.location.assign(o);
|
|
136
141
|
}
|
|
137
142
|
return "done";
|
|
138
143
|
}
|
|
@@ -141,6 +146,10 @@ function ce(e, t, n, r, i) {
|
|
|
141
146
|
return n.visit(o, {
|
|
142
147
|
method: s,
|
|
143
148
|
data: e.data,
|
|
149
|
+
...s === "get" ? {} : {
|
|
150
|
+
preserveState: U,
|
|
151
|
+
preserveScroll: U
|
|
152
|
+
},
|
|
144
153
|
...e.visit,
|
|
145
154
|
onSuccess: () => void (c = !0),
|
|
146
155
|
onFinish: () => {
|
|
@@ -149,48 +158,48 @@ function ce(e, t, n, r, i) {
|
|
|
149
158
|
}), "pending";
|
|
150
159
|
}
|
|
151
160
|
// ../js/cn.ts
|
|
152
|
-
var
|
|
161
|
+
var ue = h({ extend: { theme: { radius: ["iui-toast", "iui-inbox"] } } });
|
|
153
162
|
function G(...e) {
|
|
154
|
-
return
|
|
163
|
+
return ue(e.filter(Boolean).join(" "));
|
|
155
164
|
}
|
|
156
165
|
// ../js/icons.ts
|
|
157
|
-
var K = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0,
|
|
166
|
+
var K = (e, t) => Object.hasOwn(e, t) ? e[t] : void 0, de = {
|
|
158
167
|
success: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z",
|
|
159
168
|
info: "M18 10a8 8 0 1 1-16 0 8 8 0 0 1 16 0Zm-7-4a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM9 9a.75.75 0 0 0 0 1.5h.253a.25.25 0 0 1 .244.304l-.459 2.066A1.75 1.75 0 0 0 10.747 15H11a.75.75 0 0 0 0-1.5h-.253a.25.25 0 0 1-.244-.304l.459-2.066A1.75 1.75 0 0 0 9.253 9H9Z",
|
|
160
169
|
warning: "M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495ZM10 5a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 10 5Zm0 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z",
|
|
161
170
|
error: "M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM8.28 7.22a.75.75 0 0 0-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 1 0 1.06 1.06L10 11.06l1.72 1.72a.75.75 0 1 0 1.06-1.06L11.06 10l1.72-1.72a.75.75 0 0 0-1.06-1.06L10 8.94 8.28 7.22Z"
|
|
162
|
-
},
|
|
163
|
-
dismiss: [
|
|
164
|
-
bell:
|
|
165
|
-
notification:
|
|
171
|
+
}, q = "M6.28 5.22a.75.75 0 0 0-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 1 0 1.06 1.06L10 11.06l3.72 3.72a.75.75 0 1 0 1.06-1.06L11.06 10l3.72-3.72a.75.75 0 0 0-1.06-1.06L10 8.94 6.28 5.22Z", fe = "M10 3a7 7 0 0 1 7 7", pe = ["M10 2a6 6 0 0 0-6 6c0 1.887-.454 3.665-1.257 5.234a.75.75 0 0 0 .515 1.076 32.91 32.91 0 0 0 3.256.508 3.5 3.5 0 0 0 6.972 0 32.903 32.903 0 0 0 3.256-.508.75.75 0 0 0 .515-1.076A11.448 11.448 0 0 1 16 8a6 6 0 0 0-6-6ZM8.05 14.943a33.54 33.54 0 0 0 3.9 0 2 2 0 0 1-3.9 0Z"], me = ["M4 8c0-.26.017-.517.049-.77l7.722 7.723a33.56 33.56 0 0 1-3.722-.01 2 2 0 0 0 3.862.15l1.134 1.134a3.5 3.5 0 0 1-6.53-1.409 32.91 32.91 0 0 1-3.257-.508.75.75 0 0 1-.515-1.076A11.448 11.448 0 0 0 4 8ZM17.266 13.9a.756.756 0 0 1-.068.116L6.389 3.207A6 6 0 0 1 16 8c.001 1.887.455 3.665 1.258 5.234a.75.75 0 0 1 .01.666ZM3.28 2.22a.75.75 0 0 0-1.06 1.06l14.5 14.5a.75.75 0 1 0 1.06-1.06L3.28 2.22Z"], he = ["M1 11.27c0-.246.033-.492.099-.73l1.523-5.521A2.75 2.75 0 0 1 5.273 3h9.454a2.75 2.75 0 0 1 2.651 2.019l1.523 5.52c.066.239.099.485.099.732V15a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-3.73Zm3.068-5.852A1.25 1.25 0 0 1 5.273 4.5h9.454a1.25 1.25 0 0 1 1.205.918l1.523 5.52c.006.02.01.041.015.062H14a1 1 0 0 0-.86.49l-.606 1.02a1 1 0 0 1-.86.49H8.236a1 1 0 0 1-.894-.553l-.448-.894A1 1 0 0 0 6 11H2.53l.015-.062 1.523-5.52Z"], ge = {
|
|
172
|
+
dismiss: [q],
|
|
173
|
+
bell: pe,
|
|
174
|
+
notification: pe,
|
|
166
175
|
read: ["M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z"],
|
|
167
176
|
unread: ["M3 4a2 2 0 0 0-2 2v1.161l8.441 4.221a1.25 1.25 0 0 0 1.118 0L19 7.162V6a2 2 0 0 0-2-2H3Z", "m19 8.839-7.77 3.885a2.75 2.75 0 0 1-2.46 0L1 8.839V14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8.839Z"],
|
|
168
177
|
archive: ["M2 3a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1h16a1 1 0 0 0 1-1V4a1 1 0 0 0-1-1H2Z", "M2 7.5h16l-.811 7.71a2 2 0 0 1-1.99 1.79H4.802a2 2 0 0 1-1.99-1.79L2 7.5ZM7 11a1 1 0 0 1 1-1h4a1 1 0 1 1 0 2H8a1 1 0 0 1-1-1Z"],
|
|
169
|
-
unarchive:
|
|
178
|
+
unarchive: he,
|
|
170
179
|
snooze: ["M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm.75-13a.75.75 0 0 0-1.5 0v5c0 .414.336.75.75.75h4a.75.75 0 0 0 0-1.5h-3.25V5Z"],
|
|
171
|
-
unsnooze:
|
|
172
|
-
mute:
|
|
173
|
-
unmute:
|
|
180
|
+
unsnooze: he,
|
|
181
|
+
mute: me,
|
|
182
|
+
unmute: pe,
|
|
174
183
|
pause: ["M2 10a8 8 0 1 1 16 0 8 8 0 0 1-16 0Zm5-2.25A.75.75 0 0 1 7.75 7h.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1-.75-.75v-4.5Zm4 0a.75.75 0 0 1 .75-.75h.5a.75.75 0 0 1 .75.75v4.5a.75.75 0 0 1-.75.75h-.5a.75.75 0 0 1-.75-.75v-4.5Z"],
|
|
175
|
-
paused:
|
|
184
|
+
paused: me,
|
|
176
185
|
more: ["M3 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM8.5 10a1.5 1.5 0 1 1 3 0 1.5 1.5 0 0 1-3 0ZM15.5 8.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z"],
|
|
177
186
|
delete: ["M8.75 1A2.75 2.75 0 0 0 6 3.75v.443c-.795.077-1.584.176-2.365.298a.75.75 0 1 0 .23 1.482l.149-.022.841 10.518A2.75 2.75 0 0 0 7.596 19h4.807a2.75 2.75 0 0 0 2.742-2.53l.841-10.52.149.023a.75.75 0 0 0 .23-1.482A41.03 41.03 0 0 0 14 4.193V3.75A2.75 2.75 0 0 0 11.25 1h-2.5ZM10 4c.84 0 1.673.025 2.5.075V3.75c0-.69-.56-1.25-1.25-1.25h-2.5c-.69 0-1.25.56-1.25 1.25v.325C8.327 4.025 9.16 4 10 4ZM8.58 7.72a.75.75 0 0 0-1.5.06l.3 7.5a.75.75 0 1 0 1.5-.06l-.3-7.5Zm4.34.06a.75.75 0 1 0-1.5-.06l-.3 7.5a.75.75 0 1 0 1.5.06l.3-7.5Z"],
|
|
178
|
-
empty:
|
|
187
|
+
empty: he,
|
|
179
188
|
result: ["M10 18a8 8 0 1 0 0-16 8 8 0 0 0 0 16Zm3.857-9.809a.75.75 0 0 0-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 1 0-1.06 1.061l2.5 2.5a.75.75 0 0 0 1.137-.089l4-5.5Z"],
|
|
180
189
|
announcement: ["M13.92 3.845a19.362 19.362 0 0 1-6.3 1.98C6.765 5.942 5.89 6 5 6a4 4 0 0 0-.504 7.969 15.97 15.97 0 0 0 1.271 3.34c.397.771 1.342 1 2.05.59l.867-.5c.726-.419.94-1.32.588-2.02-.166-.331-.315-.666-.448-1.004 1.8.357 3.511.963 5.096 1.78A17.964 17.964 0 0 0 15 10c0-2.162-.381-4.235-1.08-6.155ZM15.243 3.097A19.456 19.456 0 0 1 16.5 10c0 2.43-.445 4.758-1.257 6.904l-.03.077a.75.75 0 0 0 1.401.537 20.903 20.903 0 0 0 1.312-5.745 2 2 0 0 0 0-3.546 20.902 20.902 0 0 0-1.312-5.745.75.75 0 0 0-1.4.537l.029.078Z"]
|
|
181
|
-
},
|
|
182
|
-
function
|
|
183
|
-
|
|
190
|
+
}, J = null;
|
|
191
|
+
function _e(e) {
|
|
192
|
+
J = e;
|
|
184
193
|
}
|
|
185
|
-
function
|
|
186
|
-
return
|
|
194
|
+
function ve(e, t = {}) {
|
|
195
|
+
return J?.(e, t) ?? null;
|
|
187
196
|
}
|
|
188
|
-
function
|
|
189
|
-
let i = K(n, e) ?? (r ? r(e, t) :
|
|
197
|
+
function ye(e, t, n = {}, r) {
|
|
198
|
+
let i = K(n, e) ?? (r ? r(e, t) : ve(e, t));
|
|
190
199
|
return i == null || i === !1 ? void 0 : i;
|
|
191
200
|
}
|
|
192
201
|
// ../js/translations.ts
|
|
193
|
-
var
|
|
202
|
+
var be = {
|
|
194
203
|
toaster_label: "Notifications",
|
|
195
204
|
toaster_label_with_hotkey: ":label (:hotkey)",
|
|
196
205
|
toaster_hotkey_alt: "Alt",
|
|
@@ -329,28 +338,28 @@ var ye = {
|
|
|
329
338
|
preferences_retry: "Try again",
|
|
330
339
|
preferences_save_failed: "Your preferences could not be saved.",
|
|
331
340
|
preferences_push_device_remove_failed: "The device could not be removed."
|
|
332
|
-
},
|
|
333
|
-
function
|
|
334
|
-
for (let [t, n] of Object.entries(e)) n !== void 0 && (
|
|
341
|
+
}, xe = Object.assign(Object.create(null), be);
|
|
342
|
+
function Se(e) {
|
|
343
|
+
for (let [t, n] of Object.entries(e)) n !== void 0 && (xe[t] = n);
|
|
335
344
|
}
|
|
336
|
-
var
|
|
337
|
-
function
|
|
345
|
+
var Ce = (e) => Object.hasOwn(xe, e) ? xe[e] : void 0;
|
|
346
|
+
function we(e, t = {}) {
|
|
338
347
|
return typeof e == "function" ? e(t) : T(e, t);
|
|
339
348
|
}
|
|
340
|
-
function
|
|
341
|
-
let n =
|
|
342
|
-
return n === void 0 ? e :
|
|
349
|
+
function Te(e, t = {}) {
|
|
350
|
+
let n = Ce(e);
|
|
351
|
+
return n === void 0 ? e : we(n, t);
|
|
343
352
|
}
|
|
344
|
-
var
|
|
345
|
-
function
|
|
346
|
-
return Object.fromEntries(t.map((t) => [t,
|
|
353
|
+
var Ee = (e, t) => e + t.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);
|
|
354
|
+
function De(e, t) {
|
|
355
|
+
return Object.fromEntries(t.map((t) => [t, be[Ee(e, t)]]));
|
|
347
356
|
}
|
|
348
|
-
function
|
|
357
|
+
function Oe(e, t, n) {
|
|
349
358
|
let r = (e) => n && Object.hasOwn(n, e) ? n[e] : void 0;
|
|
350
|
-
return Object.fromEntries(t.map((t) => [t, r(t) ??
|
|
359
|
+
return Object.fromEntries(t.map((t) => [t, r(t) ?? Ce(Ee(e, t)) ?? Ee(e, t)]));
|
|
351
360
|
}
|
|
352
361
|
// ../js/inbox.ts
|
|
353
|
-
var
|
|
362
|
+
var ke = [
|
|
354
363
|
"read",
|
|
355
364
|
"unread",
|
|
356
365
|
"seen",
|
|
@@ -359,41 +368,41 @@ var Oe = [
|
|
|
359
368
|
"snooze",
|
|
360
369
|
"unsnooze",
|
|
361
370
|
"delete"
|
|
362
|
-
],
|
|
371
|
+
], Ae = [
|
|
363
372
|
"snooze",
|
|
364
373
|
"archive",
|
|
365
374
|
"mute",
|
|
366
375
|
"delete"
|
|
367
|
-
],
|
|
376
|
+
], je = [
|
|
368
377
|
"snooze",
|
|
369
378
|
"archive",
|
|
370
379
|
"mute"
|
|
371
|
-
],
|
|
380
|
+
], Me = {
|
|
372
381
|
archive: "archive",
|
|
373
382
|
unarchive: "archive",
|
|
374
383
|
snooze: "snooze",
|
|
375
384
|
unsnooze: "snooze",
|
|
376
385
|
delete: "delete"
|
|
377
|
-
},
|
|
386
|
+
}, Ne = (e, t) => (e !== "snoozed" || t.includes("snooze")) && (e !== "archived" || t.includes("archive")), Pe = 100, Fe = "inertiauiInbox", Y = (e) => e ? Date.parse(e) : NaN, Ie = ({ counts: e, category: t, categoryCounts: n }) => t === null ? e.unread : n[t] ?? 0, Le = (e) => e.expiresAt !== null && Y(e.expiresAt) <= Date.now(), Re = (e, t = Date.now()) => e.snoozedUntil !== null && Y(e.snoozedUntil) > t, ze = (e, t, n) => {
|
|
378
387
|
if (t === null || n === 0) return e;
|
|
379
388
|
let { [t]: r = 0, ...i } = e, a = Math.max(0, r + n);
|
|
380
389
|
return a === 0 ? i : {
|
|
381
390
|
...i,
|
|
382
391
|
[t]: a
|
|
383
392
|
};
|
|
384
|
-
},
|
|
393
|
+
}, Be = (e, t) => Y(e.createdAt) > Y(t.createdAt) || Y(e.createdAt) === Y(t.createdAt) && e.total > t.total, Ve = (e, t) => {
|
|
385
394
|
let n = new Map(t.map((e) => [e.id, e])), r = e.filter((e) => {
|
|
386
395
|
let t = n.get(e.id);
|
|
387
|
-
return t === void 0 ||
|
|
396
|
+
return t === void 0 || Be(e, t);
|
|
388
397
|
}), i = new Set(r.map((e) => e.id));
|
|
389
398
|
return [...r, ...t.filter((e) => !i.has(e.id))];
|
|
390
|
-
},
|
|
399
|
+
}, He = (e, { latest: t, latestIds: n }) => t !== null && (Y(e.createdAt) < Y(t) || Y(e.createdAt) === Y(t) && n.includes(e.id)), Ue = (e) => N(e) ? {
|
|
391
400
|
name: P(e.name) ?? void 0,
|
|
392
401
|
avatar: L(e.avatar)
|
|
393
402
|
} : null;
|
|
394
|
-
function
|
|
403
|
+
function We(e) {
|
|
395
404
|
if (!N(e) || typeof e.id != "string" || typeof e.title != "string" || typeof e.createdAt != "string") return;
|
|
396
|
-
let t =
|
|
405
|
+
let t = Ue(e.actor), n = (Array.isArray(e.actors) ? e.actors.map(Ue) : [t]).filter((e) => e !== null);
|
|
397
406
|
return {
|
|
398
407
|
id: e.id,
|
|
399
408
|
type: P(e.type) ?? "",
|
|
@@ -424,8 +433,8 @@ function Ue(e) {
|
|
|
424
433
|
expiresAt: P(e.expiresAt)
|
|
425
434
|
};
|
|
426
435
|
}
|
|
427
|
-
var
|
|
428
|
-
let t = N(e) ?
|
|
436
|
+
var Ge = (e) => Array.isArray(e) ? {} : N(e) ? Object.fromEntries(Object.entries(e).filter((e) => typeof e[1] == "number")) : void 0, Ke = (e) => {
|
|
437
|
+
let t = N(e) ? Ge(e.categories) : void 0;
|
|
429
438
|
return N(e) && typeof e.unread == "number" && typeof e.unseen == "number" && typeof e.revision == "number" && (e.latest === null || typeof e.latest == "string") && Array.isArray(e.latestIds) && t !== void 0 ? {
|
|
430
439
|
unread: e.unread,
|
|
431
440
|
unseen: e.unseen,
|
|
@@ -437,7 +446,7 @@ var We = (e) => Array.isArray(e) ? {} : N(e) ? Object.fromEntries(Object.entries
|
|
|
437
446
|
},
|
|
438
447
|
context: P(e.context)
|
|
439
448
|
} : void 0;
|
|
440
|
-
},
|
|
449
|
+
}, qe = (e) => N(e) ? Object.fromEntries(Object.entries(e).filter((e) => typeof e[1] == "string")) : {}, Je = (e) => Array.isArray(e) ? e.filter((e) => e === "tomorrow" || typeof e == "number" && Number.isInteger(e) && e > 0) : dt, Ye = (e) => N(e) ? Object.fromEntries(Object.entries(e).filter((e) => N(e[1])).map(([e, t]) => [e, {
|
|
441
450
|
label: P(t.label) ?? e,
|
|
442
451
|
category: P(t.category),
|
|
443
452
|
data: N(t.data) ? Object.fromEntries(Object.entries(t.data).filter((e) => [
|
|
@@ -445,8 +454,8 @@ var We = (e) => Array.isArray(e) ? {} : N(e) ? Object.fromEntries(Object.entries
|
|
|
445
454
|
"number",
|
|
446
455
|
"boolean"
|
|
447
456
|
].includes(typeof e[1]))) : {}
|
|
448
|
-
}])) : {},
|
|
449
|
-
function
|
|
457
|
+
}])) : {}, Xe = (e, t) => t !== void 0 && (t.category === null || e.category === t.category) && Object.entries(t.data).every(([t, n]) => e.data[t] === n);
|
|
458
|
+
function Ze(e) {
|
|
450
459
|
if (!N(e)) return;
|
|
451
460
|
if (e.kind === "item") return typeof e.id == "string" ? {
|
|
452
461
|
kind: "item",
|
|
@@ -462,7 +471,7 @@ function Xe(e) {
|
|
|
462
471
|
ids: e.ids.filter((e) => typeof e == "string")
|
|
463
472
|
} : void 0;
|
|
464
473
|
if (e.kind === "update") {
|
|
465
|
-
let t =
|
|
474
|
+
let t = We(e.item);
|
|
466
475
|
return t === void 0 ? void 0 : {
|
|
467
476
|
kind: "update",
|
|
468
477
|
item: t
|
|
@@ -478,7 +487,7 @@ function Xe(e) {
|
|
|
478
487
|
until: e.until
|
|
479
488
|
} : void 0;
|
|
480
489
|
if (e.kind === "items") {
|
|
481
|
-
let t =
|
|
490
|
+
let t = ke.find((t) => t === e.action);
|
|
482
491
|
if (t === void 0 || t === "delete" || !Array.isArray(e.ids) || typeof e.at != "string" || t === "snooze" && typeof e.until != "string") return;
|
|
483
492
|
let n = e.ids.filter((e) => typeof e == "string");
|
|
484
493
|
return t === "snooze" ? {
|
|
@@ -509,25 +518,25 @@ function Xe(e) {
|
|
|
509
518
|
category: n
|
|
510
519
|
} : void 0;
|
|
511
520
|
}
|
|
512
|
-
var
|
|
521
|
+
var Qe = (e, t) => t.split(".").reduce((e, t) => N(e) ? e[t] : void 0, e), $e = () => ({
|
|
513
522
|
unread: 0,
|
|
514
523
|
unseen: 0,
|
|
515
524
|
categories: {}
|
|
516
|
-
}),
|
|
525
|
+
}), et = 2147483647, tt = (e, { before: t, ids: n, category: r }) => {
|
|
517
526
|
if (r !== null && e.category !== r) return !1;
|
|
518
527
|
let i = Y(e.createdAt);
|
|
519
528
|
return i < Y(t) || i === Y(t) && (n === null || n.includes(e.id));
|
|
520
|
-
},
|
|
529
|
+
}, nt = (e, t, n) => tt(e, t) ? t.kind === "archive" ? e.archivedAt === null && (!t.onlyRead || e.readAt !== null) ? {
|
|
521
530
|
...e,
|
|
522
531
|
archivedAt: n
|
|
523
532
|
} : e : t.kind === "seen" ? e.seenAt === null ? {
|
|
524
533
|
...e,
|
|
525
534
|
seenAt: n
|
|
526
|
-
} : e : e.readAt === null && e.archivedAt === null && !
|
|
535
|
+
} : e : e.readAt === null && e.archivedAt === null && !Re(e) ? {
|
|
527
536
|
...e,
|
|
528
537
|
readAt: n,
|
|
529
538
|
seenAt: e.seenAt ?? n
|
|
530
|
-
} : e : e,
|
|
539
|
+
} : e : e, rt = (e, { action: t, ids: n, at: r, until: i }) => n.includes(e.id) ? t === "read" ? e.readAt === null ? {
|
|
531
540
|
...e,
|
|
532
541
|
readAt: r,
|
|
533
542
|
seenAt: e.seenAt ?? r
|
|
@@ -549,21 +558,21 @@ var Ze = (e, t) => t.split(".").reduce((e, t) => N(e) ? e[t] : void 0, e), Qe =
|
|
|
549
558
|
} : t === "unsnooze" ? e.snoozedUntil === null ? e : {
|
|
550
559
|
...e,
|
|
551
560
|
snoozedUntil: null
|
|
552
|
-
} : e : e,
|
|
561
|
+
} : e : e, it = (e, t, n) => t.kind === "items" ? rt(e, t) : nt(e, t, n), at = ({ readAt: e, seenAt: t, archivedAt: n, snoozedUntil: r, result: i }) => ({
|
|
553
562
|
readAt: e,
|
|
554
563
|
seenAt: t,
|
|
555
564
|
archivedAt: n,
|
|
556
565
|
snoozedUntil: r,
|
|
557
566
|
result: i
|
|
558
567
|
});
|
|
559
|
-
function
|
|
560
|
-
let e, t =
|
|
568
|
+
function ot() {
|
|
569
|
+
let e, t = Fe, n, r = 0, i, a, o = null, s = null, c = je, l = !0, u = {}, d = dt, f = {}, p = null, m, h, g = {
|
|
561
570
|
unread: 0,
|
|
562
571
|
unseen: 0
|
|
563
572
|
}, _ = {}, v = [], y = [], b = "all", x = null, S = "idle", C = !1, w = !1, T = null, E = 0, D, O = {}, k = 0, A = 0, j = /* @__PURE__ */ new Set(), M = /* @__PURE__ */ new Map(), F = [], I = [], R = /* @__PURE__ */ new Set(), z = /* @__PURE__ */ new Set(), B = /* @__PURE__ */ new Map(), ee = /* @__PURE__ */ new Map(), V = !1, te = {
|
|
564
573
|
until: null,
|
|
565
574
|
revision: -Infinity
|
|
566
|
-
},
|
|
575
|
+
}, U = null, ie, oe = null, se = /* @__PURE__ */ new Set(), ce = /* @__PURE__ */ new Set(), ue = /* @__PURE__ */ new Set(), G = /* @__PURE__ */ new Set(), K, de = (e, t, n) => {
|
|
567
576
|
let r = M.get(e);
|
|
568
577
|
(!r || n > r.revision) && M.set(e, {
|
|
569
578
|
state: t,
|
|
@@ -582,8 +591,8 @@ function at() {
|
|
|
582
591
|
...r,
|
|
583
592
|
...a.state
|
|
584
593
|
}, n = a.revision);
|
|
585
|
-
for (let e of F) e.revision > n && (r =
|
|
586
|
-
for (let t of I) t.kind === "bulk" ? r =
|
|
594
|
+
for (let e of F) e.revision > n && (r = it(r, e.change, e.at));
|
|
595
|
+
for (let t of I) t.kind === "bulk" ? r = it(r, t.change, t.at) : t.kind === "mute" && t.group === r.group ? r = {
|
|
587
596
|
...r,
|
|
588
597
|
muted: t.muted
|
|
589
598
|
} : t.kind === "item" && t.id === e.id && (t.createdAt === null || Y(e.createdAt) <= Y(t.createdAt)) && (r = {
|
|
@@ -591,13 +600,13 @@ function at() {
|
|
|
591
600
|
...t.state
|
|
592
601
|
});
|
|
593
602
|
return r;
|
|
594
|
-
}, fe = (e) => z.has(e) || I.some((t) => t.kind === "delete" && t.ids.includes(e)), pe = (e, t, n = null) => fe(e.id) ||
|
|
603
|
+
}, fe = (e) => z.has(e) || I.some((t) => t.kind === "delete" && t.ids.includes(e)), pe = (e, t, n = null) => fe(e.id) || Le(e) || n !== null && e.category !== n ? !1 : t === "archived" || e.archivedAt !== null ? t === "archived" && e.archivedAt !== null : Re(e) === (t === "snoozed") ? t === "unread" ? e.readAt === null || R.has(e.id) : t === "all" || t === "snoozed" || Xe(e, Object.hasOwn(f, t) ? f[t] : void 0) : !1, me = () => {
|
|
595
604
|
let e = I.reduce((e, t) => t.kind === "pause" ? t.until : e, void 0), t = e === void 0 ? te.until : e;
|
|
596
605
|
return V && t !== null && Y(t) > Date.now() ? t : null;
|
|
597
606
|
}, he = (e) => {
|
|
598
|
-
e !== oe && (clearTimeout(
|
|
607
|
+
e !== oe && (clearTimeout(ie), ie = void 0, oe = e, e !== null && (ie = setTimeout(() => {
|
|
599
608
|
oe = null, me() === null ? J() : he(e);
|
|
600
|
-
}, Math.min(Y(e) - Date.now(),
|
|
609
|
+
}, Math.min(Y(e) - Date.now(), et))));
|
|
601
610
|
}, ge = (e, t) => {
|
|
602
611
|
t > te.revision && (te = {
|
|
603
612
|
until: e,
|
|
@@ -605,7 +614,7 @@ function at() {
|
|
|
605
614
|
});
|
|
606
615
|
}, J = () => {
|
|
607
616
|
let e = me();
|
|
608
|
-
he(e),
|
|
617
|
+
he(e), K = {
|
|
609
618
|
url: a,
|
|
610
619
|
user: i,
|
|
611
620
|
channel: o,
|
|
@@ -615,7 +624,7 @@ function at() {
|
|
|
615
624
|
categoryFilter: u,
|
|
616
625
|
tabs: f,
|
|
617
626
|
counts: g,
|
|
618
|
-
items:
|
|
627
|
+
items: Ve(y, v).map(q).filter((e) => pe(e, b, x)),
|
|
619
628
|
arrived: y,
|
|
620
629
|
filter: b,
|
|
621
630
|
category: x,
|
|
@@ -628,18 +637,18 @@ function at() {
|
|
|
628
637
|
pausedUntil: e,
|
|
629
638
|
canPause: V,
|
|
630
639
|
pausePresets: d
|
|
631
|
-
},
|
|
640
|
+
}, se.forEach((e) => e());
|
|
632
641
|
};
|
|
633
642
|
J();
|
|
634
|
-
let _e =
|
|
643
|
+
let _e = K, ve = (e) => {
|
|
635
644
|
for (let t of e) {
|
|
636
645
|
let e = Y(t.createdAt);
|
|
637
646
|
D === void 0 || e > Y(D.at) ? D = {
|
|
638
647
|
at: t.createdAt,
|
|
639
648
|
ids: /* @__PURE__ */ new Set([t.id])
|
|
640
|
-
} : e === Y(D.at) && D.ids.add(t.id), t.revision !== null && de(t.id,
|
|
649
|
+
} : e === Y(D.at) && D.ids.add(t.id), t.revision !== null && de(t.id, at(t), t.revision);
|
|
641
650
|
}
|
|
642
|
-
}, ye = () => (/* @__PURE__ */ new Date()).toISOString(), be = () => h !== void 0 && h.counted.latest !== null && (D === void 0 || Y(h.counted.latest) > Y(D.at)), xe = (e) => e.archivedAt === null && !
|
|
651
|
+
}, ye = () => (/* @__PURE__ */ new Date()).toISOString(), be = () => h !== void 0 && h.counted.latest !== null && (D === void 0 || Y(h.counted.latest) > Y(D.at)), xe = (e) => e.archivedAt === null && !Re(e), Se = (e) => xe(e) ? {
|
|
643
652
|
unread: +(e.readAt === null),
|
|
644
653
|
unseen: +(e.seenAt === null)
|
|
645
654
|
} : {
|
|
@@ -650,8 +659,8 @@ function at() {
|
|
|
650
659
|
g = {
|
|
651
660
|
unread: g.unread + t,
|
|
652
661
|
unseen: g.unseen + n
|
|
653
|
-
}, _ =
|
|
654
|
-
}, we = (e) => h === void 0 || !
|
|
662
|
+
}, _ = ze(_, e.category, t);
|
|
663
|
+
}, we = (e) => h === void 0 || !He(e, h.counted), Te = () => {
|
|
655
664
|
if (!(h === void 0 || I.length > 0)) {
|
|
656
665
|
g = {
|
|
657
666
|
unread: h.unread,
|
|
@@ -660,24 +669,24 @@ function at() {
|
|
|
660
669
|
for (let e of y) we(e) && Ce(q(e));
|
|
661
670
|
}
|
|
662
671
|
}, Ee = (e) => {
|
|
663
|
-
let t =
|
|
672
|
+
let t = Ke(N(e) ? e.counts : void 0);
|
|
664
673
|
!t || t.context !== p || h !== void 0 && t.revision < h.revision || (h = t, Te());
|
|
665
674
|
}, De = ({ unread: e, unseen: t, categories: n }, r) => {
|
|
666
675
|
g = {
|
|
667
676
|
unread: Math.max(0, g.unread + r * e),
|
|
668
677
|
unseen: Math.max(0, g.unseen + r * t)
|
|
669
|
-
}, _ = Object.entries(n).reduce((e, [t, n]) =>
|
|
678
|
+
}, _ = Object.entries(n).reduce((e, [t, n]) => ze(e, t, r * n), _);
|
|
670
679
|
}, Oe = (e, t) => {
|
|
671
680
|
if (e.kind === "item") {
|
|
672
681
|
let { kind: n, id: r, ...i } = e;
|
|
673
682
|
de(r, i, t);
|
|
674
|
-
} else if (e.kind === "delete")
|
|
683
|
+
} else if (e.kind === "delete") ke(e.ids);
|
|
675
684
|
else if (e.kind === "update") {
|
|
676
685
|
let n = {
|
|
677
686
|
...e.item,
|
|
678
687
|
revision: e.item.revision ?? t
|
|
679
688
|
}, r = B.get(n.id);
|
|
680
|
-
(r === void 0 || (r.revision ?? 0) < n.revision) && B.set(n.id, n), de(n.id,
|
|
689
|
+
(r === void 0 || (r.revision ?? 0) < n.revision) && B.set(n.id, n), de(n.id, at(n), n.revision);
|
|
681
690
|
} else if (e.kind === "mute") {
|
|
682
691
|
let n = ee.get(e.group);
|
|
683
692
|
(n === void 0 || n.revision < t) && ee.set(e.group, {
|
|
@@ -689,35 +698,35 @@ function at() {
|
|
|
689
698
|
at: ye(),
|
|
690
699
|
revision: t
|
|
691
700
|
}];
|
|
692
|
-
},
|
|
701
|
+
}, ke = (e) => {
|
|
693
702
|
e.forEach((e) => z.add(e)), y = y.filter((e) => !z.has(e.id)), v = v.filter((e) => !z.has(e.id));
|
|
694
|
-
},
|
|
695
|
-
r++, E++, i = void 0, a = void 0, o = null, s = null, c =
|
|
703
|
+
}, Ie = () => {
|
|
704
|
+
r++, E++, i = void 0, a = void 0, o = null, s = null, c = je, l = !0, u = {}, d = dt, f = {}, p = null, m = void 0, h = void 0, g = {
|
|
696
705
|
unread: 0,
|
|
697
706
|
unseen: 0
|
|
698
707
|
}, _ = {}, v = [], y = [], b = "all", x = null, S = "idle", C = !1, w = !1, T = null, D = void 0, O = {}, M.clear(), F = [], I = [], R.clear(), z.clear(), B.clear(), ee.clear(), V = !1, te = {
|
|
699
708
|
until: null,
|
|
700
709
|
revision: -Infinity
|
|
701
|
-
},
|
|
702
|
-
},
|
|
710
|
+
}, U = null;
|
|
711
|
+
}, Ue = async (t) => {
|
|
703
712
|
let n = new URLSearchParams({ filter: b });
|
|
704
713
|
x !== null && n.set("category", x), t && n.set("cursor", t);
|
|
705
714
|
let r = await e.request("get", `${a}?${n.toString()}`);
|
|
706
715
|
return {
|
|
707
|
-
items: N(r) && Array.isArray(r.items) ? r.items.map(
|
|
716
|
+
items: N(r) && Array.isArray(r.items) ? r.items.map(We).filter((e) => e !== void 0) : [],
|
|
708
717
|
cursor: N(r) && typeof r.nextCursor == "string" ? r.nextCursor : null,
|
|
709
718
|
body: r
|
|
710
719
|
};
|
|
711
|
-
},
|
|
720
|
+
}, Ge = async (t, i, o) => {
|
|
712
721
|
if (!e || a === void 0) return;
|
|
713
722
|
let s = r;
|
|
714
723
|
I = [...I, t], De(t.delta, 1), J();
|
|
715
724
|
try {
|
|
716
725
|
let n = await e.request("post", `${a}/${i}`, o);
|
|
717
726
|
if (s !== r) return;
|
|
718
|
-
let c = N(n) ? n : {}, l =
|
|
727
|
+
let c = N(n) ? n : {}, l = Ze(c.change), u = Ke(c.counts)?.revision;
|
|
719
728
|
if (!l || u === void 0) throw Error("The inbox endpoint answered without the change and the counts.");
|
|
720
|
-
I = I.filter((e) => e !== t), Oe(l, u), Ee(c),
|
|
729
|
+
I = I.filter((e) => e !== t), Oe(l, u), Ee(c), G.forEach((e) => e({
|
|
721
730
|
change: l,
|
|
722
731
|
counts: c.counts
|
|
723
732
|
}));
|
|
@@ -734,11 +743,11 @@ function at() {
|
|
|
734
743
|
return {
|
|
735
744
|
unread: e.unread + a,
|
|
736
745
|
unseen: e.unseen + i.unseen - r.unseen,
|
|
737
|
-
categories: t.category === null || a === 0 ? e.categories :
|
|
746
|
+
categories: t.category === null || a === 0 ? e.categories : ze(e.categories, t.category, a)
|
|
738
747
|
};
|
|
739
|
-
},
|
|
748
|
+
}, $e()), nt = (e, t, n) => {
|
|
740
749
|
let r = t.map((e) => e.id);
|
|
741
|
-
if (e === "delete") return
|
|
750
|
+
if (e === "delete") return Ge({
|
|
742
751
|
kind: "delete",
|
|
743
752
|
ids: r,
|
|
744
753
|
delta: tt(t.map((e) => ({
|
|
@@ -757,14 +766,14 @@ function at() {
|
|
|
757
766
|
...n === void 0 ? {} : { until: n }
|
|
758
767
|
}, a = tt(t.map((e) => ({
|
|
759
768
|
before: e,
|
|
760
|
-
after:
|
|
769
|
+
after: rt(e, i)
|
|
761
770
|
})));
|
|
762
|
-
return e === "seen" ?
|
|
771
|
+
return e === "seen" ? Ge({
|
|
763
772
|
kind: "bulk",
|
|
764
773
|
change: i,
|
|
765
774
|
at: i.at,
|
|
766
775
|
delta: a
|
|
767
|
-
}, "seen/items", { ids: r }) :
|
|
776
|
+
}, "seen/items", { ids: r }) : Ge({
|
|
768
777
|
kind: "bulk",
|
|
769
778
|
change: i,
|
|
770
779
|
at: i.at,
|
|
@@ -779,7 +788,7 @@ function at() {
|
|
|
779
788
|
...e,
|
|
780
789
|
...t
|
|
781
790
|
}), o = a.unread - i.unread;
|
|
782
|
-
return
|
|
791
|
+
return Ge({
|
|
783
792
|
kind: "item",
|
|
784
793
|
id: e.id,
|
|
785
794
|
state: t,
|
|
@@ -790,11 +799,11 @@ function at() {
|
|
|
790
799
|
categories: e.category === null ? {} : { [e.category]: o }
|
|
791
800
|
}
|
|
792
801
|
}, `${encodeURIComponent(e.id)}/${n}`, r);
|
|
793
|
-
}, st = (e, t, n) =>
|
|
802
|
+
}, st = (e, t, n) => Ge({
|
|
794
803
|
kind: "mute",
|
|
795
804
|
group: t,
|
|
796
805
|
muted: n,
|
|
797
|
-
delta:
|
|
806
|
+
delta: $e()
|
|
798
807
|
}, `${encodeURIComponent(e.id)}/${n ? "mute" : "unmute"}`), ct = (e, t, n, r, i) => {
|
|
799
808
|
let a = D ? {
|
|
800
809
|
before: D.at,
|
|
@@ -807,7 +816,7 @@ function at() {
|
|
|
807
816
|
...t === null ? {} : { category: t },
|
|
808
817
|
...i
|
|
809
818
|
};
|
|
810
|
-
return
|
|
819
|
+
return Ge({
|
|
811
820
|
kind: "bulk",
|
|
812
821
|
change: {
|
|
813
822
|
...e,
|
|
@@ -831,28 +840,28 @@ function at() {
|
|
|
831
840
|
unseen: -g.unseen,
|
|
832
841
|
categories: e ? Object.fromEntries(Object.entries(_).map(([e, t]) => [e, -t])) : {}
|
|
833
842
|
};
|
|
834
|
-
},
|
|
843
|
+
}, ut = (e) => {
|
|
835
844
|
let t = y.find((t) => t.id === e) ?? v.find((t) => t.id === e);
|
|
836
845
|
return t && q(t);
|
|
837
846
|
}, ft = (e) => {
|
|
838
|
-
let t = typeof e == "string" ? e : e.id, n = typeof e == "string" ?
|
|
839
|
-
return n === void 0 ?
|
|
847
|
+
let t = typeof e == "string" ? e : e.id, n = typeof e == "string" ? ut(e) : q(e), r = ye();
|
|
848
|
+
return n === void 0 ? Ge({
|
|
840
849
|
kind: "item",
|
|
841
850
|
id: t,
|
|
842
851
|
state: { readAt: r },
|
|
843
|
-
delta:
|
|
852
|
+
delta: $e(),
|
|
844
853
|
createdAt: null
|
|
845
854
|
}, `${encodeURIComponent(t)}/read`) : n.readAt === null ? (R.add(t), ot(n, {
|
|
846
855
|
readAt: r,
|
|
847
856
|
seenAt: n.seenAt ?? r
|
|
848
857
|
}, "read")) : Promise.resolve();
|
|
849
858
|
}, pt = (e, t) => {
|
|
850
|
-
let n = typeof e == "string" ? e : e.id, r = typeof e == "string" ?
|
|
851
|
-
if (r === void 0) return
|
|
859
|
+
let n = typeof e == "string" ? e : e.id, r = typeof e == "string" ? ut(e) : q(e), i = `${encodeURIComponent(n)}/complete`;
|
|
860
|
+
if (r === void 0) return Ge({
|
|
852
861
|
kind: "item",
|
|
853
862
|
id: n,
|
|
854
863
|
state: {},
|
|
855
|
-
delta:
|
|
864
|
+
delta: $e(),
|
|
856
865
|
createdAt: null
|
|
857
866
|
}, i, { action: t });
|
|
858
867
|
let a = r.actions[t]?.result;
|
|
@@ -860,38 +869,38 @@ function at() {
|
|
|
860
869
|
}, mt = (e, t) => {
|
|
861
870
|
let n = r;
|
|
862
871
|
return () => n === r ? pt(e, t) : Promise.resolve();
|
|
863
|
-
},
|
|
872
|
+
}, ht = (e) => c.includes(e), X = {
|
|
864
873
|
subscribe(e) {
|
|
865
|
-
return
|
|
874
|
+
return se.add(e), () => se.delete(e);
|
|
866
875
|
},
|
|
867
|
-
getSnapshot: () =>
|
|
876
|
+
getSnapshot: () => K,
|
|
868
877
|
getServerSnapshot: () => _e,
|
|
869
878
|
connect(r, i = {}) {
|
|
870
879
|
e = r, t = i.prop ?? t, n = i.onFailure ?? n;
|
|
871
880
|
},
|
|
872
881
|
sync(e, n) {
|
|
873
|
-
let r =
|
|
882
|
+
let r = Qe(e, t), h = n === "history" || n === "cached";
|
|
874
883
|
if (!N(r)) {
|
|
875
|
-
r === null && !h && a !== void 0 && (
|
|
884
|
+
r === null && !h && a !== void 0 && (Ie(), J());
|
|
876
885
|
return;
|
|
877
886
|
}
|
|
878
887
|
let g = P(r.user) ?? void 0;
|
|
879
888
|
if (g !== i) {
|
|
880
889
|
if (h) return;
|
|
881
|
-
|
|
890
|
+
Ie(), i = g;
|
|
882
891
|
}
|
|
883
|
-
if (a = P(r.url) ?? a, o = P(r.channel), s = P(r.announcementsChannel), f =
|
|
892
|
+
if (a = P(r.url) ?? a, o = P(r.channel), s = P(r.announcementsChannel), f = Ye(r.tabs), p = P(r.context), V = N(r.pause), !h) {
|
|
884
893
|
let e = r.allowedActions;
|
|
885
|
-
c = Array.isArray(e) ?
|
|
894
|
+
c = Array.isArray(e) ? Ae.filter((t) => e.includes(t)) : je, l = r.selectable !== !1, u = qe(r.categoryFilter), d = Je(N(r.pause) ? r.pause.presets : void 0);
|
|
886
895
|
}
|
|
887
|
-
|
|
896
|
+
Ne(b, c) || (b = "all", S !== "idle" && X.load()), !h && r !== m && (R.clear(), Ee({ counts: r }), U = r.push ?? null, N(r.pause) && ge(P(r.pause.until), typeof r.revision == "number" ? r.revision : 0)), m = r, J();
|
|
888
897
|
},
|
|
889
898
|
async load(t, n) {
|
|
890
899
|
if (!e || a === void 0) return;
|
|
891
900
|
let i = r, o = ++E;
|
|
892
|
-
x = n === void 0 ? t === void 0 ? x : null : n, b = t ?? b, b =
|
|
901
|
+
x = n === void 0 ? t === void 0 ? x : null : n, b = t ?? b, b = Ne(b, c) ? b : "all", S = "loading", C = !1, w = !1, R.clear(), J();
|
|
893
902
|
try {
|
|
894
|
-
let e = await
|
|
903
|
+
let e = await Ue(null);
|
|
895
904
|
i === r && o === E && (v = e.items, T = e.cursor, S = "ready", ve(e.items), Ee(e.body));
|
|
896
905
|
} catch {
|
|
897
906
|
i === r && o === E && (S = "error");
|
|
@@ -902,7 +911,7 @@ function at() {
|
|
|
902
911
|
if (!e || a === void 0 || T === null || C || S !== "ready" || w && !t) return;
|
|
903
912
|
let n = r, i = E;
|
|
904
913
|
C = !0, w = !1, J();
|
|
905
|
-
let o = await
|
|
914
|
+
let o = await Ue(T).catch(() => void 0);
|
|
906
915
|
if (n === r && i === E) {
|
|
907
916
|
if (o === void 0) w = !0;
|
|
908
917
|
else {
|
|
@@ -925,34 +934,34 @@ function at() {
|
|
|
925
934
|
let i = r;
|
|
926
935
|
try {
|
|
927
936
|
let n = await e.request("get", `${a}/${encodeURIComponent(t)}`);
|
|
928
|
-
return i === r && N(n) ?
|
|
937
|
+
return i === r && N(n) ? X.receive(n.item, n.counts) : void 0;
|
|
929
938
|
} catch {
|
|
930
939
|
return;
|
|
931
940
|
}
|
|
932
941
|
},
|
|
933
942
|
receive(e, t) {
|
|
934
|
-
let n =
|
|
935
|
-
if (!n || a === void 0 || z.has(n.id) || y.some((e) => e.id === n.id && !
|
|
943
|
+
let n = We(e);
|
|
944
|
+
if (!n || a === void 0 || z.has(n.id) || y.some((e) => e.id === n.id && !Be(n, e))) return;
|
|
936
945
|
let r = N(e) ? P(e.context) : null;
|
|
937
946
|
if (p !== null && r !== null && r !== p) return;
|
|
938
947
|
y = [n, ...y.filter((e) => e.id !== n.id)].sort((e, t) => Y(t.createdAt) - Y(e.createdAt)), ve([n]);
|
|
939
948
|
let i = q(n);
|
|
940
|
-
return Ee({ counts: t }), I.length > 0 || h === void 0 ? we(n) && Ce(i) : Te(), J(), k > 0 && S === "ready" && pe(i, b, x) && i.seenAt === null &&
|
|
949
|
+
return Ee({ counts: t }), I.length > 0 || h === void 0 ? we(n) && Ce(i) : Te(), J(), k > 0 && S === "ready" && pe(i, b, x) && i.seenAt === null && X.markAllAsSeen(), ce.forEach((e) => e(n)), n;
|
|
941
950
|
},
|
|
942
951
|
onArrival(e) {
|
|
943
|
-
return
|
|
952
|
+
return ce.add(e), () => ce.delete(e);
|
|
944
953
|
},
|
|
945
954
|
receiveChange(e) {
|
|
946
|
-
let t = N(e) ? e.change : void 0, n =
|
|
955
|
+
let t = N(e) ? e.change : void 0, n = Ze(t), r = Ke(N(e) ? e.counts : void 0);
|
|
947
956
|
if (!n || r === void 0 || a === void 0) return;
|
|
948
957
|
let { revision: i } = r;
|
|
949
|
-
(r.context === p || n.kind !== "read" && n.kind !== "seen" && n.kind !== "archive") && (n.kind === "item" && N(t) && N(t.item) &&
|
|
958
|
+
(r.context === p || n.kind !== "read" && n.kind !== "seen" && n.kind !== "archive") && (n.kind === "item" && N(t) && N(t.item) && X.receive({
|
|
950
959
|
...t.item,
|
|
951
960
|
revision: t.item.revision ?? i
|
|
952
|
-
}), Oe(n, i), Ee(e), J(),
|
|
961
|
+
}), Oe(n, i), Ee(e), J(), ue.forEach((e) => e(n)));
|
|
953
962
|
},
|
|
954
963
|
onChange(e) {
|
|
955
|
-
return
|
|
964
|
+
return ue.add(e), () => ue.delete(e);
|
|
956
965
|
},
|
|
957
966
|
apply: q,
|
|
958
967
|
belongs: pe,
|
|
@@ -960,10 +969,10 @@ function at() {
|
|
|
960
969
|
markAsRead: ft,
|
|
961
970
|
complete: pt,
|
|
962
971
|
completer: mt,
|
|
963
|
-
pushSettings: () =>
|
|
972
|
+
pushSettings: () => U,
|
|
964
973
|
context: () => p,
|
|
965
974
|
onSaved(e) {
|
|
966
|
-
return
|
|
975
|
+
return G.add(e), () => G.delete(e);
|
|
967
976
|
},
|
|
968
977
|
markAsUnread(e) {
|
|
969
978
|
let t = q(e);
|
|
@@ -971,56 +980,56 @@ function at() {
|
|
|
971
980
|
},
|
|
972
981
|
archive(e) {
|
|
973
982
|
let t = q(e);
|
|
974
|
-
return !
|
|
983
|
+
return !ht("archive") || t.archivedAt !== null ? Promise.resolve() : ot(t, { archivedAt: ye() }, "archive");
|
|
975
984
|
},
|
|
976
985
|
unarchive(e) {
|
|
977
986
|
let t = q(e);
|
|
978
|
-
return !
|
|
987
|
+
return !ht("archive") || t.archivedAt === null ? Promise.resolve() : ot(t, { archivedAt: null }, "unarchive");
|
|
979
988
|
},
|
|
980
989
|
snooze(e, t) {
|
|
981
|
-
if (!
|
|
990
|
+
if (!ht("snooze")) return Promise.resolve();
|
|
982
991
|
let n = q(e), r = new Date(t).toISOString();
|
|
983
992
|
return ot(n, { snoozedUntil: r }, "snooze", { until: r });
|
|
984
993
|
},
|
|
985
994
|
unsnooze(e) {
|
|
986
995
|
let t = q(e);
|
|
987
|
-
return !
|
|
996
|
+
return !ht("snooze") || t.snoozedUntil === null ? Promise.resolve() : ot(t, { snoozedUntil: null }, "unsnooze");
|
|
988
997
|
},
|
|
989
998
|
mute(e) {
|
|
990
999
|
let t = q(e);
|
|
991
|
-
return !
|
|
1000
|
+
return !ht("mute") || t.group === null || t.muted ? Promise.resolve() : st(t, t.group, !0);
|
|
992
1001
|
},
|
|
993
1002
|
unmute(e) {
|
|
994
1003
|
let t = q(e);
|
|
995
|
-
return !
|
|
1004
|
+
return !ht("mute") || t.group === null || !t.muted ? Promise.resolve() : st(t, t.group, !1);
|
|
996
1005
|
},
|
|
997
1006
|
pause(e) {
|
|
998
1007
|
let t = new Date(e).toISOString();
|
|
999
|
-
return V ?
|
|
1008
|
+
return V ? Ge({
|
|
1000
1009
|
kind: "pause",
|
|
1001
1010
|
until: t,
|
|
1002
|
-
delta:
|
|
1011
|
+
delta: $e()
|
|
1003
1012
|
}, "pause", { until: t }) : Promise.resolve();
|
|
1004
1013
|
},
|
|
1005
1014
|
resume() {
|
|
1006
|
-
return me() === null ? Promise.resolve() :
|
|
1015
|
+
return me() === null ? Promise.resolve() : Ge({
|
|
1007
1016
|
kind: "pause",
|
|
1008
1017
|
until: null,
|
|
1009
|
-
delta:
|
|
1018
|
+
delta: $e()
|
|
1010
1019
|
}, "resume");
|
|
1011
1020
|
},
|
|
1012
1021
|
batch(e, t, n) {
|
|
1013
|
-
let r =
|
|
1014
|
-
if (e !== "seen" && !l || r !== void 0 && !
|
|
1022
|
+
let r = Me[e];
|
|
1023
|
+
if (e !== "seen" && !l || r !== void 0 && !ht(r)) return Promise.resolve();
|
|
1015
1024
|
if (e === "snooze" && n === void 0) return Promise.reject(/* @__PURE__ */ TypeError("Snoozing notifications needs the time to snooze them until."));
|
|
1016
1025
|
let i = t.map(q), a = e === "snooze" && n !== void 0 ? new Date(n).toISOString() : void 0, o = [];
|
|
1017
|
-
for (let t = 0; t < i.length; t +=
|
|
1026
|
+
for (let t = 0; t < i.length; t += Pe) o.push(nt(e, i.slice(t, t + Pe), a));
|
|
1018
1027
|
return Promise.all(o).then(() => void 0);
|
|
1019
1028
|
},
|
|
1020
1029
|
delete(e) {
|
|
1021
|
-
if (!
|
|
1030
|
+
if (!ht("delete")) return Promise.resolve();
|
|
1022
1031
|
let t = q(e), { unread: n, unseen: r } = Se(t);
|
|
1023
|
-
return
|
|
1032
|
+
return Ge({
|
|
1024
1033
|
kind: "delete",
|
|
1025
1034
|
ids: [t.id],
|
|
1026
1035
|
delta: {
|
|
@@ -1037,8 +1046,8 @@ function at() {
|
|
|
1037
1046
|
return g.unseen === 0 ? Promise.resolve() : ct({ kind: "seen" }, null, lt(!1), "seen");
|
|
1038
1047
|
},
|
|
1039
1048
|
archiveAll({ onlyRead: e = !1, category: t = x } = {}) {
|
|
1040
|
-
if (!
|
|
1041
|
-
let n = e ?
|
|
1049
|
+
if (!ht("archive")) return Promise.resolve();
|
|
1050
|
+
let n = e ? $e() : lt(!0, t);
|
|
1042
1051
|
return ct({
|
|
1043
1052
|
kind: "archive",
|
|
1044
1053
|
onlyRead: e
|
|
@@ -1047,7 +1056,7 @@ function at() {
|
|
|
1047
1056
|
async opened(e, { markAllAsSeen: t = !0, categories: n } = {}) {
|
|
1048
1057
|
t && k++, A++, j.forEach((e) => e());
|
|
1049
1058
|
let r = t ? g.unseen > 0 : be(), i = e !== void 0 && !e.includes(b) ? e[0] ?? b : b, a = n !== void 0 && x !== null && !n.includes(x) ? null : x;
|
|
1050
|
-
i !== b || a !== x ? await
|
|
1059
|
+
i !== b || a !== x ? await X.load(i, a) : (S !== "ready" || r) && await X.load(), t && S === "ready" && await X.markAllAsSeen();
|
|
1051
1060
|
},
|
|
1052
1061
|
closed({ markAllAsSeen: e = !0 } = {}) {
|
|
1053
1062
|
e && (k = Math.max(0, k - 1)), A = Math.max(0, A - 1);
|
|
@@ -1060,20 +1069,20 @@ function at() {
|
|
|
1060
1069
|
if (n?.defaultPrevented) return;
|
|
1061
1070
|
ft(t);
|
|
1062
1071
|
let r = L(t.url);
|
|
1063
|
-
r === void 0 || n &&
|
|
1072
|
+
r === void 0 || n && re(n) || (n?.preventDefault(), !ne(r) || !e ? window.location.assign(r) : e.visit(r, {}));
|
|
1064
1073
|
},
|
|
1065
1074
|
runAction(t, n, i) {
|
|
1066
1075
|
let a = t.actions[n];
|
|
1067
1076
|
if (!a || i?.defaultPrevented) return;
|
|
1068
1077
|
let o = H(a);
|
|
1069
|
-
if (i && o !== void 0 &&
|
|
1070
|
-
a.event && !
|
|
1078
|
+
if (i && o !== void 0 && ae(a, o, i)) {
|
|
1079
|
+
a.event && !re(i) && window.dispatchEvent(new CustomEvent(a.event, { detail: a.payload })), W(o, a, i, () => void ft(t), a.result === void 0 ? void 0 : () => pt(t, n));
|
|
1071
1080
|
return;
|
|
1072
1081
|
}
|
|
1073
1082
|
if (i?.preventDefault(), O[t.id] !== void 0) return;
|
|
1074
1083
|
ft(t);
|
|
1075
1084
|
let s = r, c = a.result === void 0 ? void 0 : mt(t, n);
|
|
1076
|
-
|
|
1085
|
+
le(a, t, e, () => {
|
|
1077
1086
|
if (s !== r) return;
|
|
1078
1087
|
let { [t.id]: e, ...n } = O;
|
|
1079
1088
|
O = n, J();
|
|
@@ -1083,12 +1092,12 @@ function at() {
|
|
|
1083
1092
|
}, J());
|
|
1084
1093
|
}
|
|
1085
1094
|
};
|
|
1086
|
-
return
|
|
1095
|
+
return X;
|
|
1087
1096
|
}
|
|
1088
|
-
function
|
|
1089
|
-
return
|
|
1097
|
+
function st(e, t, n, r = null) {
|
|
1098
|
+
return Ve(e.getSnapshot().arrived, t).map((t) => e.apply(t)).filter((t) => e.belongs(t, n, r));
|
|
1090
1099
|
}
|
|
1091
|
-
function
|
|
1100
|
+
function ct(e, t = !0) {
|
|
1092
1101
|
let n = [], r = /* @__PURE__ */ new Map();
|
|
1093
1102
|
for (let i of e) {
|
|
1094
1103
|
let e = t ? i.group : null, a = e === null ? void 0 : r.get(e);
|
|
@@ -1104,8 +1113,8 @@ function st(e, t = !0) {
|
|
|
1104
1113
|
}
|
|
1105
1114
|
return n;
|
|
1106
1115
|
}
|
|
1107
|
-
function
|
|
1108
|
-
let n =
|
|
1116
|
+
function lt(e = {}, t = /* @__PURE__ */ new Date()) {
|
|
1117
|
+
let n = Tt(e), r = (e) => {
|
|
1109
1118
|
let n = new Date(t);
|
|
1110
1119
|
return n.setDate(t.getDate() + e), n.setHours(9, 0, 0, 0), n;
|
|
1111
1120
|
}, i = new Date(t.getTime() + 108e5), a = i.getDate() === t.getDate() ? [{
|
|
@@ -1124,7 +1133,7 @@ function ct(e = {}, t = /* @__PURE__ */ new Date()) {
|
|
|
1124
1133
|
}] : []
|
|
1125
1134
|
];
|
|
1126
1135
|
}
|
|
1127
|
-
function
|
|
1136
|
+
function ut(e, t, n) {
|
|
1128
1137
|
let r = new Date(e), i = new Date(t).toDateString() === r.toDateString();
|
|
1129
1138
|
return r.toLocaleString(n, i ? {
|
|
1130
1139
|
hour: "numeric",
|
|
@@ -1135,18 +1144,18 @@ function lt(e, t, n) {
|
|
|
1135
1144
|
minute: "2-digit"
|
|
1136
1145
|
});
|
|
1137
1146
|
}
|
|
1138
|
-
var
|
|
1147
|
+
var dt = [
|
|
1139
1148
|
30,
|
|
1140
1149
|
60,
|
|
1141
1150
|
120,
|
|
1142
1151
|
"tomorrow"
|
|
1143
1152
|
];
|
|
1144
|
-
function
|
|
1153
|
+
function ft(e, t = /* @__PURE__ */ new Date()) {
|
|
1145
1154
|
if (e !== "tomorrow") return new Date(t.getTime() + e * 6e4);
|
|
1146
1155
|
let n = new Date(t);
|
|
1147
1156
|
return n.setDate(t.getDate() + 1), n.setHours(8, 0, 0, 0), n;
|
|
1148
1157
|
}
|
|
1149
|
-
function
|
|
1158
|
+
function pt(e, t, n) {
|
|
1150
1159
|
return e.filter((e) => e === "tomorrow" || Number.isFinite(e) && e > 0).map((e) => {
|
|
1151
1160
|
if (e === "tomorrow") return {
|
|
1152
1161
|
label: Z(t.pauseTomorrow),
|
|
@@ -1166,16 +1175,16 @@ function ft(e, t, n) {
|
|
|
1166
1175
|
};
|
|
1167
1176
|
});
|
|
1168
1177
|
}
|
|
1169
|
-
function
|
|
1178
|
+
function mt(e, t, n) {
|
|
1170
1179
|
let r = new Date(e);
|
|
1171
|
-
return r.getTime() - t < 5184e5 ?
|
|
1180
|
+
return r.getTime() - t < 5184e5 ? ut(r, t, n) : r.toLocaleString(n, {
|
|
1172
1181
|
month: "short",
|
|
1173
1182
|
day: "numeric",
|
|
1174
1183
|
hour: "numeric",
|
|
1175
1184
|
minute: "2-digit"
|
|
1176
1185
|
});
|
|
1177
1186
|
}
|
|
1178
|
-
var
|
|
1187
|
+
var ht = ot(), X = ht, gt = {
|
|
1179
1188
|
load: X.load,
|
|
1180
1189
|
loadMore: X.loadMore,
|
|
1181
1190
|
refresh: X.refresh,
|
|
@@ -1202,11 +1211,11 @@ var mt = at(), X = mt, ht = {
|
|
|
1202
1211
|
open: X.open,
|
|
1203
1212
|
runAction: X.runAction
|
|
1204
1213
|
};
|
|
1205
|
-
function
|
|
1214
|
+
function _t(e) {
|
|
1206
1215
|
X.getSnapshot().url === void 0 && X.sync(e, "initial");
|
|
1207
1216
|
}
|
|
1208
|
-
var
|
|
1209
|
-
function
|
|
1217
|
+
var vt = ht;
|
|
1218
|
+
function yt(e = 6e4) {
|
|
1210
1219
|
let t = /* @__PURE__ */ new Set(), n = Date.now(), r, i = () => {
|
|
1211
1220
|
n = Date.now(), t.forEach((e) => e());
|
|
1212
1221
|
};
|
|
@@ -1219,8 +1228,8 @@ function vt(e = 6e4) {
|
|
|
1219
1228
|
getSnapshot: () => n
|
|
1220
1229
|
};
|
|
1221
1230
|
}
|
|
1222
|
-
var
|
|
1223
|
-
function
|
|
1231
|
+
var bt = yt();
|
|
1232
|
+
function xt(e, t, n) {
|
|
1224
1233
|
let r = (Y(e) - t) / 1e3, i = new Intl.RelativeTimeFormat(n, { numeric: "auto" });
|
|
1225
1234
|
for (let [e, t] of [
|
|
1226
1235
|
["year", 31536e3],
|
|
@@ -1232,12 +1241,12 @@ function bt(e, t, n) {
|
|
|
1232
1241
|
]) if (Math.abs(r) >= t) return i.format(Math.round(r / t), e);
|
|
1233
1242
|
return i.format(0, "second");
|
|
1234
1243
|
}
|
|
1235
|
-
function
|
|
1244
|
+
function St(e, t, n) {
|
|
1236
1245
|
let r = new Intl.NumberFormat(n);
|
|
1237
1246
|
return e > t ? `${r.format(t)}+` : r.format(e);
|
|
1238
1247
|
}
|
|
1239
|
-
var
|
|
1240
|
-
function
|
|
1248
|
+
var Ct = /* @__PURE__ */ "title.bell.bellNew.bellPaused.all.unread.archived.snoozed.markAllAsRead.archiveAll.moreActions.itemControl.markAsRead.markAsUnread.archive.unarchive.snooze.unsnooze.mute.unmute.muted.delete.select.selectAll.selected.selection.readSelected.unreadSelected.snoozeSelected.unsnoozeSelected.archiveSelected.unarchiveSelected.deleteSelected.clearSelection.showNew.snoozeUntil.snoozedUntil.snoozeLaterToday.snoozeTomorrow.snoozeNextWeek.pause.pauseFor.pauseTomorrow.pausedUntil.resume.showMore.showLess.unreadState.actorsAndOther.actorsAndOthers.empty.emptyUnread.emptyArchived.emptySnoozed.error.retry.categories.allCategories.loading.loadMore.viewAll.announcement".split("."), wt = De("inbox_", Ct), Tt = (e) => Oe("inbox_", Ct, e), Z = we, Et = (e) => e.actors.slice(0, 3);
|
|
1249
|
+
function Dt(e, t) {
|
|
1241
1250
|
let [n, r] = t.actors;
|
|
1242
1251
|
if (!(t.actorCount < 2 || !n?.name)) return t.actorCount > 2 ? Z(e.actorsAndOthers, {
|
|
1243
1252
|
name: n.name,
|
|
@@ -1248,8 +1257,8 @@ function Et(e, t) {
|
|
|
1248
1257
|
}) : void 0;
|
|
1249
1258
|
}
|
|
1250
1259
|
// ../js/realtime.ts
|
|
1251
|
-
var
|
|
1252
|
-
function
|
|
1260
|
+
var Ot = ".inertiaui.inbox.arrived", kt = ".inertiaui.inbox.changed", At = ".inertiaui.announcement.published", jt = 1e3, Mt = "inertiaui-inbox";
|
|
1261
|
+
function Nt(e, t, n) {
|
|
1253
1262
|
let r, i = !1, a, o, s = /* @__PURE__ */ new Set(), c = !1, l, u = () => {
|
|
1254
1263
|
try {
|
|
1255
1264
|
return r?.();
|
|
@@ -1270,7 +1279,7 @@ function Mt(e, t, n) {
|
|
|
1270
1279
|
if (!N(t) || typeof t.id != "string") return;
|
|
1271
1280
|
let { id: r } = t, i = typeof t.context == "string" ? t.context : null, a = setTimeout(() => {
|
|
1272
1281
|
s.delete(a), e.loadArrival(r, i).then((e) => e && n(e));
|
|
1273
|
-
}, Math.random() *
|
|
1282
|
+
}, Math.random() * jt);
|
|
1274
1283
|
s.add(a);
|
|
1275
1284
|
}, m = () => {
|
|
1276
1285
|
let { announcementsChannel: t } = e.getSnapshot();
|
|
@@ -1279,10 +1288,10 @@ function Mt(e, t, n) {
|
|
|
1279
1288
|
let n = t === null ? void 0 : u();
|
|
1280
1289
|
if (!n || t === null || !r) return;
|
|
1281
1290
|
let i = n.private(t);
|
|
1282
|
-
i.listen(
|
|
1291
|
+
i.listen(At, p), o = {
|
|
1283
1292
|
channel: t,
|
|
1284
1293
|
resolve: r,
|
|
1285
|
-
stop: () => i.stopListening(
|
|
1294
|
+
stop: () => i.stopListening(At, p)
|
|
1286
1295
|
};
|
|
1287
1296
|
}, h = () => {
|
|
1288
1297
|
g(), m();
|
|
@@ -1293,7 +1302,7 @@ function Mt(e, t, n) {
|
|
|
1293
1302
|
let n = t === null ? void 0 : u();
|
|
1294
1303
|
if (!n || t === null || !r) return;
|
|
1295
1304
|
let i = n.private(t);
|
|
1296
|
-
i.listen(
|
|
1305
|
+
i.listen(Ot, d), i.listen(kt, f);
|
|
1297
1306
|
let o = !1, s = n.connector?.onConnectionChange?.((t) => {
|
|
1298
1307
|
t === "connected" && o && e.refresh(), o = t !== "connected";
|
|
1299
1308
|
});
|
|
@@ -1301,7 +1310,7 @@ function Mt(e, t, n) {
|
|
|
1301
1310
|
channel: t,
|
|
1302
1311
|
resolve: r,
|
|
1303
1312
|
stop() {
|
|
1304
|
-
i.stopListening(
|
|
1313
|
+
i.stopListening(Ot, d), i.stopListening(kt, f), typeof s == "function" && s();
|
|
1305
1314
|
}
|
|
1306
1315
|
};
|
|
1307
1316
|
}, _ = () => typeof document < "u" && document.visibilityState === "hidden", v = () => {
|
|
@@ -1310,7 +1319,7 @@ function Mt(e, t, n) {
|
|
|
1310
1319
|
c && !_() && e.refresh(), v();
|
|
1311
1320
|
};
|
|
1312
1321
|
typeof document < "u" && document.addEventListener("visibilitychange", y);
|
|
1313
|
-
let b = typeof BroadcastChannel == "function" ? new BroadcastChannel(
|
|
1322
|
+
let b = typeof BroadcastChannel == "function" ? new BroadcastChannel(Mt) : void 0;
|
|
1314
1323
|
b?.addEventListener("message", (t) => {
|
|
1315
1324
|
let { url: n, user: r, channel: i } = e.getSnapshot(), a = t.data;
|
|
1316
1325
|
N(a) && n !== void 0 && a.url === n && a.user === r && a.channel === i && e.receiveChange(a);
|
|
@@ -1338,21 +1347,21 @@ function Mt(e, t, n) {
|
|
|
1338
1347
|
}
|
|
1339
1348
|
};
|
|
1340
1349
|
}
|
|
1341
|
-
var
|
|
1342
|
-
function
|
|
1350
|
+
var Pt = "inertiaui-inbox-", Ft = (e) => `${Pt}${e}`, It = (e) => e.startsWith(Pt) ? e.slice(16) : void 0;
|
|
1351
|
+
function Lt(e, t, n) {
|
|
1343
1352
|
let r = t === "none" || e.announcement || e.quiet === !0 || e.readAt !== null || e.archivedAt !== null ? null : e.toast ?? (t === "all" ? "default" : null);
|
|
1344
1353
|
if (r === null) return;
|
|
1345
|
-
let { title: i, ...a } =
|
|
1354
|
+
let { title: i, ...a } = Rt(e, n);
|
|
1346
1355
|
return {
|
|
1347
1356
|
title: i,
|
|
1348
1357
|
options: {
|
|
1349
|
-
id:
|
|
1358
|
+
id: Ft(e.id),
|
|
1350
1359
|
type: r,
|
|
1351
1360
|
...a
|
|
1352
1361
|
}
|
|
1353
1362
|
};
|
|
1354
1363
|
}
|
|
1355
|
-
function
|
|
1364
|
+
function Rt(e, t) {
|
|
1356
1365
|
let n = e.actions.length > 0 || e.url === null ? e.actions.map(({ onClick: e, ...t }) => t) : [{
|
|
1357
1366
|
...t,
|
|
1358
1367
|
href: e.url
|
|
@@ -1366,8 +1375,8 @@ function Lt(e, t) {
|
|
|
1366
1375
|
};
|
|
1367
1376
|
}
|
|
1368
1377
|
// ../js/browserAlerts.ts
|
|
1369
|
-
var
|
|
1370
|
-
function
|
|
1378
|
+
var zt = "inertiaui-notifications";
|
|
1379
|
+
function Bt(e) {
|
|
1371
1380
|
let t = document, n = navigator.locks;
|
|
1372
1381
|
if (!n) return {
|
|
1373
1382
|
elected: () => t.visibilityState === "visible",
|
|
@@ -1393,25 +1402,25 @@ function zt(e) {
|
|
|
1393
1402
|
}
|
|
1394
1403
|
};
|
|
1395
1404
|
}
|
|
1396
|
-
async function
|
|
1405
|
+
async function Vt() {
|
|
1397
1406
|
return typeof Notification == "function" ? Notification.requestPermission() : "denied";
|
|
1398
1407
|
}
|
|
1399
|
-
var
|
|
1400
|
-
function
|
|
1408
|
+
var Ht;
|
|
1409
|
+
function Ut() {
|
|
1401
1410
|
if (typeof AudioContext != "function") return;
|
|
1402
|
-
|
|
1403
|
-
let e =
|
|
1411
|
+
Ht ??= new AudioContext();
|
|
1412
|
+
let e = Ht;
|
|
1404
1413
|
for (let [t, n] of [880, 1320].entries()) {
|
|
1405
1414
|
let r = e.currentTime + t * .15, i = e.createOscillator(), a = e.createGain();
|
|
1406
1415
|
i.frequency.value = n, a.gain.setValueAtTime(.2, r), a.gain.exponentialRampToValueAtTime(.001, r + .4), i.connect(a).connect(e.destination), i.start(r), i.stop(r + .4);
|
|
1407
1416
|
}
|
|
1408
1417
|
}
|
|
1409
|
-
function
|
|
1418
|
+
function Wt(e) {
|
|
1410
1419
|
let t = !1, n = "", r, i, a, o = !1, s, c = !1, l = !1, u, d, f = () => {
|
|
1411
1420
|
let a = document.title !== i;
|
|
1412
1421
|
a && (n = document.title);
|
|
1413
|
-
let { unread: o } = e.getSnapshot().counts, s = t && o > 0 ?
|
|
1414
|
-
count:
|
|
1422
|
+
let { unread: o } = e.getSnapshot().counts, s = t && o > 0 ? Te("inbox_title_count", {
|
|
1423
|
+
count: St(o, 99),
|
|
1415
1424
|
number: o,
|
|
1416
1425
|
title: n
|
|
1417
1426
|
}) : n;
|
|
@@ -1429,7 +1438,7 @@ function Ut(e) {
|
|
|
1429
1438
|
e !== o && (o = e, m());
|
|
1430
1439
|
}, g = () => {
|
|
1431
1440
|
let e = c || l !== !1;
|
|
1432
|
-
e && !d && (d = zt
|
|
1441
|
+
e && !d && (d = Bt(zt)), !e && d && (d.stop(), d = void 0);
|
|
1433
1442
|
}, _ = (t) => {
|
|
1434
1443
|
if (typeof Notification != "function" || Notification.permission !== "granted") return;
|
|
1435
1444
|
let n;
|
|
@@ -1437,7 +1446,7 @@ function Ut(e) {
|
|
|
1437
1446
|
n = new Notification(t.title, {
|
|
1438
1447
|
body: t.body ?? void 0,
|
|
1439
1448
|
icon: t.actor?.avatar,
|
|
1440
|
-
tag:
|
|
1449
|
+
tag: Ft(t.id)
|
|
1441
1450
|
});
|
|
1442
1451
|
} catch {
|
|
1443
1452
|
return;
|
|
@@ -1446,7 +1455,7 @@ function Ut(e) {
|
|
|
1446
1455
|
window.focus(), n.close(), e.open(t);
|
|
1447
1456
|
});
|
|
1448
1457
|
}, v = (e) => {
|
|
1449
|
-
navigator.userActivation?.hasBeenActive !== !1 && (e === !0 ?
|
|
1458
|
+
navigator.userActivation?.hasBeenActive !== !1 && (e === !0 ? Ut() : (u?.getAttribute("src") !== e && (u = new Audio(e)), u.currentTime = 0, u.play().catch(() => {})));
|
|
1450
1459
|
};
|
|
1451
1460
|
return e.onArrival((e) => {
|
|
1452
1461
|
d?.elected() && e.quiet !== !0 && e.readAt === null && e.archivedAt === null && (c && document.visibilityState === "hidden" && _(e), l !== !1 && v(l));
|
|
@@ -1457,12 +1466,12 @@ function Ut(e) {
|
|
|
1457
1466
|
} };
|
|
1458
1467
|
}
|
|
1459
1468
|
// ../js/preferences.ts
|
|
1460
|
-
var
|
|
1469
|
+
var Gt = [
|
|
1461
1470
|
"instant",
|
|
1462
1471
|
"hourly",
|
|
1463
1472
|
"daily",
|
|
1464
1473
|
"weekly"
|
|
1465
|
-
],
|
|
1474
|
+
], Kt = [
|
|
1466
1475
|
"monday",
|
|
1467
1476
|
"tuesday",
|
|
1468
1477
|
"wednesday",
|
|
@@ -1470,29 +1479,29 @@ var Wt = [
|
|
|
1470
1479
|
"friday",
|
|
1471
1480
|
"saturday",
|
|
1472
1481
|
"sunday"
|
|
1473
|
-
],
|
|
1482
|
+
], qt = {
|
|
1474
1483
|
status: "idle",
|
|
1475
1484
|
channels: [],
|
|
1476
1485
|
groups: [],
|
|
1477
1486
|
categories: [],
|
|
1478
1487
|
notificationHours: null,
|
|
1479
|
-
frequencies:
|
|
1480
|
-
},
|
|
1488
|
+
frequencies: Gt
|
|
1489
|
+
}, Jt = (e, t) => typeof e == "string" ? e : t, Yt = (e) => Gt.includes(e), Xt = (e) => typeof e == "string" && /^([01]\d|2[0-3]):[0-5]\d-([01]\d|2[0-3]):[0-5]\d$/.test(e), Zt = (e) => [...e].sort(), Qt = (e) => {
|
|
1481
1490
|
if (!N(e) || !N(e.days)) return null;
|
|
1482
1491
|
let t = e.days;
|
|
1483
1492
|
return {
|
|
1484
1493
|
enabled: e.enabled === !0,
|
|
1485
|
-
days: Object.fromEntries(
|
|
1494
|
+
days: Object.fromEntries(Kt.map((e) => [e, Zt(Array.isArray(t[e]) ? t[e].filter(Xt) : [])]))
|
|
1486
1495
|
};
|
|
1487
|
-
},
|
|
1488
|
-
let t = Array.isArray(e) ?
|
|
1489
|
-
return t.length > 0 ? t :
|
|
1496
|
+
}, $t = (e) => {
|
|
1497
|
+
let t = Array.isArray(e) ? Gt.filter((t) => e.includes(t)) : [];
|
|
1498
|
+
return t.length > 0 ? t : Gt;
|
|
1490
1499
|
};
|
|
1491
|
-
function
|
|
1500
|
+
function en(e) {
|
|
1492
1501
|
if (N(e) && Array.isArray(e.channels) && Array.isArray(e.categories)) return {
|
|
1493
1502
|
channels: e.channels.filter(N).flatMap((e) => typeof e.key == "string" ? [{
|
|
1494
1503
|
key: e.key,
|
|
1495
|
-
label:
|
|
1504
|
+
label: Jt(e.label, e.key),
|
|
1496
1505
|
globalSwitch: e.globalSwitch === !0,
|
|
1497
1506
|
enabled: e.enabled !== !1,
|
|
1498
1507
|
digest: e.digest === !0,
|
|
@@ -1501,23 +1510,23 @@ function $t(e) {
|
|
|
1501
1510
|
}] : []),
|
|
1502
1511
|
groups: (Array.isArray(e.groups) ? e.groups : []).filter(N).flatMap((e) => typeof e.key == "string" ? [{
|
|
1503
1512
|
key: e.key,
|
|
1504
|
-
label:
|
|
1513
|
+
label: Jt(e.label, e.key),
|
|
1505
1514
|
description: P(e.description)
|
|
1506
1515
|
}] : []),
|
|
1507
1516
|
categories: e.categories.filter(N).flatMap((e) => typeof e.key == "string" ? [{
|
|
1508
1517
|
key: e.key,
|
|
1509
|
-
label:
|
|
1518
|
+
label: Jt(e.label, e.key),
|
|
1510
1519
|
description: P(e.description),
|
|
1511
1520
|
group: P(e.group),
|
|
1512
1521
|
locked: e.locked === !0,
|
|
1513
1522
|
channels: Object.fromEntries(Object.entries(N(e.channels) ? e.channels : {}).filter((e) => typeof e[1] == "boolean")),
|
|
1514
|
-
frequency:
|
|
1523
|
+
frequency: Yt(e.frequency) ? e.frequency : null
|
|
1515
1524
|
}] : []),
|
|
1516
|
-
notificationHours:
|
|
1517
|
-
frequencies:
|
|
1525
|
+
notificationHours: Qt(e.notificationHours),
|
|
1526
|
+
frequencies: $t(e.frequencies)
|
|
1518
1527
|
};
|
|
1519
1528
|
}
|
|
1520
|
-
function
|
|
1529
|
+
function tn(e) {
|
|
1521
1530
|
let t = new Set(e.groups.map(({ key: e }) => e)), n = e.categories.filter(({ group: e }) => e === null || !t.has(e)), r = e.groups.map((t) => ({
|
|
1522
1531
|
group: t,
|
|
1523
1532
|
categories: e.categories.filter((e) => e.group === t.key)
|
|
@@ -1527,47 +1536,47 @@ function en(e) {
|
|
|
1527
1536
|
categories: n
|
|
1528
1537
|
}] : [], ...r.filter(({ categories: e }) => e.length > 0)];
|
|
1529
1538
|
}
|
|
1530
|
-
var
|
|
1539
|
+
var nn = (e, t) => e.locked || t.enabled && e.channels[t.key] === !0, rn = (e, t, n) => {
|
|
1531
1540
|
let r = n.find((e) => e.inbox);
|
|
1532
|
-
return !t.push || r === void 0 || r.key === t.key || e.channels[r.key] === void 0 ||
|
|
1533
|
-
},
|
|
1541
|
+
return !t.push || r === void 0 || r.key === t.key || e.channels[r.key] === void 0 || nn(e, r);
|
|
1542
|
+
}, an = (e, t, n) => nn(e, t) && rn(e, t, n), on = (e, t, n) => e.locked || !t.enabled || !rn(e, t, n), sn = (e, t) => e.frequency !== null && t.some((n) => n.digest && e.channels[n.key] !== void 0 && an(e, n, t)), cn = (e, t) => new Intl.DateTimeFormat(t, {
|
|
1534
1543
|
weekday: "long",
|
|
1535
1544
|
timeZone: "UTC"
|
|
1536
|
-
}).format(Date.UTC(2024, 0, 1 +
|
|
1545
|
+
}).format(Date.UTC(2024, 0, 1 + Kt.indexOf(e))), ln = (e) => {
|
|
1537
1546
|
let [t = "", n = ""] = e.split("-");
|
|
1538
1547
|
return [t, n];
|
|
1539
|
-
},
|
|
1540
|
-
function
|
|
1541
|
-
let n =
|
|
1542
|
-
for (let t = 1; t <
|
|
1543
|
-
let [r] = e.days[
|
|
1548
|
+
}, un = (e, t) => e.days[t].length > 0 && Kt.every((n) => n === t || e.days[n].length === 0);
|
|
1549
|
+
function dn(e, t) {
|
|
1550
|
+
let n = Kt.indexOf(t);
|
|
1551
|
+
for (let t = 1; t < Kt.length; t++) {
|
|
1552
|
+
let [r] = e.days[Kt[(n + Kt.length - t) % Kt.length]];
|
|
1544
1553
|
if (r !== void 0) return r;
|
|
1545
1554
|
}
|
|
1546
1555
|
return "09:00-17:00";
|
|
1547
1556
|
}
|
|
1548
|
-
var
|
|
1549
|
-
function
|
|
1550
|
-
let t = e.map((e) =>
|
|
1557
|
+
var fn = 1440, pn = (e) => Number(e.slice(0, 2)) * 60 + Number(e.slice(3)), mn = (e) => [Math.floor(e / 60) % 24, e % 60].map((e) => String(e).padStart(2, "0")).join(":");
|
|
1558
|
+
function hn(e) {
|
|
1559
|
+
let t = e.map((e) => ln(e).map(pn));
|
|
1551
1560
|
if (t.length === 0 || t.some(([e, t]) => t <= e)) return;
|
|
1552
1561
|
let n = Math.max(...t.map(([, e]) => e));
|
|
1553
|
-
return n + 120 <=
|
|
1562
|
+
return n + 120 <= fn ? `${mn(n + 60)}-${mn(n + 120)}` : void 0;
|
|
1554
1563
|
}
|
|
1555
|
-
var
|
|
1564
|
+
var gn = (e, t, n) => t?.day === n ? t.ranges : e?.days[n] ?? [], _n = (e, t, n) => e === null ? [] : Kt.map((r) => ({
|
|
1556
1565
|
day: r,
|
|
1557
|
-
name:
|
|
1558
|
-
ranges:
|
|
1559
|
-
locked: !e.enabled ||
|
|
1560
|
-
canAdd: e.enabled &&
|
|
1566
|
+
name: cn(r, n),
|
|
1567
|
+
ranges: gn(e, t, r).map(ln),
|
|
1568
|
+
locked: !e.enabled || un(e, r),
|
|
1569
|
+
canAdd: e.enabled && hn(e.days[r]) !== void 0
|
|
1561
1570
|
}));
|
|
1562
|
-
function
|
|
1563
|
-
let { day: r } = n, i =
|
|
1571
|
+
function vn(e, t, n) {
|
|
1572
|
+
let { day: r } = n, i = gn(e, t, r), a;
|
|
1564
1573
|
switch (n.kind) {
|
|
1565
1574
|
case "toggle":
|
|
1566
|
-
if (!e?.enabled ||
|
|
1567
|
-
a = e.days[r].length > 0 ? [] : [
|
|
1575
|
+
if (!e?.enabled || un(e, r)) return;
|
|
1576
|
+
a = e.days[r].length > 0 ? [] : [dn(e, r)];
|
|
1568
1577
|
break;
|
|
1569
1578
|
case "time": {
|
|
1570
|
-
let [e, t] =
|
|
1579
|
+
let [e, t] = ln(i[n.index] ?? ""), o = n.field === "start" ? `${n.time}-${t}` : `${e}-${n.time}`;
|
|
1571
1580
|
return a = i.map((e, t) => t === n.index ? o : e), {
|
|
1572
1581
|
ranges: a,
|
|
1573
1582
|
editing: () => ({
|
|
@@ -1580,7 +1589,7 @@ function _n(e, t, n) {
|
|
|
1580
1589
|
a = i.filter((e, t) => t !== n.index);
|
|
1581
1590
|
break;
|
|
1582
1591
|
case "add": {
|
|
1583
|
-
let t =
|
|
1592
|
+
let t = hn(i);
|
|
1584
1593
|
if (!e?.enabled || t === void 0) return;
|
|
1585
1594
|
a = [...i, t];
|
|
1586
1595
|
}
|
|
@@ -1593,23 +1602,23 @@ function _n(e, t, n) {
|
|
|
1593
1602
|
} : e
|
|
1594
1603
|
};
|
|
1595
1604
|
}
|
|
1596
|
-
var
|
|
1605
|
+
var yn = () => {
|
|
1597
1606
|
try {
|
|
1598
1607
|
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1599
1608
|
} catch {
|
|
1600
1609
|
return;
|
|
1601
1610
|
}
|
|
1602
|
-
},
|
|
1603
|
-
function
|
|
1611
|
+
}, bn = (e, t) => e.enabled === t.enabled && Kt.every((n) => e.days[n].join() === t.days[n].join()), xn = (e, t) => typeof e == "object" && typeof t == "object" ? bn(e, t) : e === t, Sn = "*", Cn = "*";
|
|
1612
|
+
function wn() {
|
|
1604
1613
|
let e, t, n, r = 0, i = 0, a = 0, o = {
|
|
1605
1614
|
channels: [],
|
|
1606
1615
|
categories: [],
|
|
1607
1616
|
notificationHours: null
|
|
1608
|
-
}, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u =
|
|
1609
|
-
if (t === null) return n ===
|
|
1617
|
+
}, s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = qt, d = /* @__PURE__ */ new Set(), f = ({ category: e, channel: t }) => JSON.stringify([e, t]), p = (e, { category: t, channel: n }) => {
|
|
1618
|
+
if (t === null) return n === Cn ? e.notificationHours ?? void 0 : e.channels.find(({ key: e }) => e === n)?.enabled;
|
|
1610
1619
|
let r = e.categories.find(({ key: e }) => e === t);
|
|
1611
|
-
return n ===
|
|
1612
|
-
}, m = (e, t, n) => t ===
|
|
1620
|
+
return n === Sn ? r?.frequency ?? void 0 : r?.channels[n];
|
|
1621
|
+
}, m = (e, t, n) => t === Sn ? e.frequency !== null && Yt(n) ? {
|
|
1613
1622
|
...e,
|
|
1614
1623
|
frequency: n
|
|
1615
1624
|
} : e : e.channels[t] !== void 0 && typeof n == "boolean" ? {
|
|
@@ -1618,7 +1627,7 @@ function Cn() {
|
|
|
1618
1627
|
...e.channels,
|
|
1619
1628
|
[t]: n
|
|
1620
1629
|
}
|
|
1621
|
-
} : e, h = (e, { category: t, channel: n }, r) => t === null ? n ===
|
|
1630
|
+
} : e, h = (e, { category: t, channel: n }, r) => t === null ? n === Cn ? e.notificationHours !== null && typeof r == "object" ? {
|
|
1622
1631
|
...e,
|
|
1623
1632
|
notificationHours: r
|
|
1624
1633
|
} : e : typeof r == "boolean" ? {
|
|
@@ -1630,12 +1639,12 @@ function Cn() {
|
|
|
1630
1639
|
} : e : {
|
|
1631
1640
|
...e,
|
|
1632
1641
|
categories: e.categories.map((e) => e.key === t ? m(e, n, r) : e)
|
|
1633
|
-
}, g = ({ category: e, channel: t }, n) => e === null ? t ===
|
|
1642
|
+
}, g = ({ category: e, channel: t }, n) => e === null ? t === Cn ? {
|
|
1634
1643
|
notificationHours: n,
|
|
1635
|
-
timezone:
|
|
1636
|
-
} : { channels: { [t]: n } } : t ===
|
|
1644
|
+
timezone: yn()
|
|
1645
|
+
} : { channels: { [t]: n } } : t === Sn ? {
|
|
1637
1646
|
frequencies: { [e]: n },
|
|
1638
|
-
timezone:
|
|
1647
|
+
timezone: yn()
|
|
1639
1648
|
} : { preferences: { [e]: { [t]: n } } }, _ = (e) => {
|
|
1640
1649
|
u = {
|
|
1641
1650
|
...u,
|
|
@@ -1647,7 +1656,7 @@ function Cn() {
|
|
|
1647
1656
|
}), y = async (i, c) => {
|
|
1648
1657
|
let u = r, d = s.get(c).value;
|
|
1649
1658
|
try {
|
|
1650
|
-
let t =
|
|
1659
|
+
let t = en(await e.request("post", `${n}/preferences`, g(i, d)));
|
|
1651
1660
|
if (u !== r) return;
|
|
1652
1661
|
o = h(o, i, (t && p(t, i)) ?? d), l.set(c, {
|
|
1653
1662
|
cell: i,
|
|
@@ -1657,7 +1666,7 @@ function Cn() {
|
|
|
1657
1666
|
if (u !== r) return;
|
|
1658
1667
|
t?.(e);
|
|
1659
1668
|
}
|
|
1660
|
-
(
|
|
1669
|
+
(xn(s.get(c)?.value, d) || xn(s.get(c)?.value, p(o, i))) && s.delete(c), v(), s.has(c) && await y(i, c);
|
|
1661
1670
|
}, b = (e, t, n) => {
|
|
1662
1671
|
let i = {
|
|
1663
1672
|
category: e,
|
|
@@ -1687,7 +1696,7 @@ function Cn() {
|
|
|
1687
1696
|
else {
|
|
1688
1697
|
_({ status: "loading" });
|
|
1689
1698
|
try {
|
|
1690
|
-
let t =
|
|
1699
|
+
let t = en(await e.request("get", `${n}/preferences`));
|
|
1691
1700
|
if (s !== r || c !== i) return;
|
|
1692
1701
|
if (!t) {
|
|
1693
1702
|
_({ status: "error" });
|
|
@@ -1717,36 +1726,36 @@ function Cn() {
|
|
|
1717
1726
|
},
|
|
1718
1727
|
setFrequency(t, r) {
|
|
1719
1728
|
let i = u.categories.find(({ key: e }) => e === t);
|
|
1720
|
-
return !e || n === void 0 || !i || i.frequency === null || i.frequency === r || !u.frequencies.includes(r) ? Promise.resolve() : b(t,
|
|
1729
|
+
return !e || n === void 0 || !i || i.frequency === null || i.frequency === r || !u.frequencies.includes(r) ? Promise.resolve() : b(t, Sn, r);
|
|
1721
1730
|
},
|
|
1722
1731
|
setNotificationHours(t) {
|
|
1723
1732
|
let r = u.notificationHours;
|
|
1724
1733
|
if (!e || n === void 0 || r === null) return Promise.resolve();
|
|
1725
|
-
let i =
|
|
1726
|
-
if (!i.every(([, e]) => Array.isArray(e) && e.every(
|
|
1734
|
+
let i = Kt.map((e) => [e, t.days?.[e] ?? r.days[e]]);
|
|
1735
|
+
if (!i.every(([, e]) => Array.isArray(e) && e.every(Xt)) || i.every(([, e]) => e.length === 0)) return Promise.resolve();
|
|
1727
1736
|
let a = {
|
|
1728
1737
|
enabled: t.enabled ?? r.enabled,
|
|
1729
|
-
days: Object.fromEntries(i.map(([e, t]) => [e,
|
|
1738
|
+
days: Object.fromEntries(i.map(([e, t]) => [e, Zt(t)]))
|
|
1730
1739
|
};
|
|
1731
|
-
return
|
|
1740
|
+
return xn(a, r) ? Promise.resolve() : b(null, Cn, a);
|
|
1732
1741
|
},
|
|
1733
1742
|
reset(e) {
|
|
1734
1743
|
r++, i++, o = {
|
|
1735
1744
|
channels: [],
|
|
1736
1745
|
categories: [],
|
|
1737
1746
|
notificationHours: null
|
|
1738
|
-
}, s.clear(), c.clear(), l.clear(), n = e, _(
|
|
1747
|
+
}, s.clear(), c.clear(), l.clear(), n = e, _(qt), d.size > 0 && e !== void 0 && x.load(e);
|
|
1739
1748
|
}
|
|
1740
1749
|
};
|
|
1741
1750
|
return x;
|
|
1742
1751
|
}
|
|
1743
|
-
var
|
|
1752
|
+
var Tn = /* @__PURE__ */ "title.category.toggle.locked.global.globalDescription.frequency.frequencyLabel.frequencyInstant.frequencyHourly.frequencyDaily.frequencyWeekly.pushDevice.pushOff.pushOn.pushTurnOn.pushTurnOff.pushTurningOn.pushTurningOff.pushBlocked.pushHomeScreen.pushInsecure.pushBrave.pushFailed.pushFailedOff.pushRetry.pushDevices.pushDeviceName.pushDeviceUnknown.pushDeviceActive.pushDeviceRemove.pushDeviceRemoveLabel.notificationHours.notificationHoursDescription.notificationHoursStart.notificationHoursEnd.notificationHoursDay.notificationHoursOff.notificationHoursAdd.notificationHoursAddLabel.notificationHoursRemove.notificationHoursRemoveLabel.empty.loading.error.retry".split("."), En = De("preferences_", Tn), Dn = {
|
|
1744
1753
|
instant: "frequencyInstant",
|
|
1745
1754
|
hourly: "frequencyHourly",
|
|
1746
1755
|
daily: "frequencyDaily",
|
|
1747
1756
|
weekly: "frequencyWeekly"
|
|
1748
|
-
},
|
|
1749
|
-
function
|
|
1757
|
+
}, On = (e) => Oe("preferences_", Tn, e), kn = wn();
|
|
1758
|
+
function An(e, t, n, r) {
|
|
1750
1759
|
let i = t.some(({ frequency: e }) => e !== null);
|
|
1751
1760
|
return {
|
|
1752
1761
|
hasGlobalSwitches: e.some(({ globalSwitch: e }) => e),
|
|
@@ -1754,15 +1763,15 @@ function kn(e, t, n, r) {
|
|
|
1754
1763
|
columns: e.length + (i ? 2 : 1),
|
|
1755
1764
|
frequencyOptions: n.map((e) => ({
|
|
1756
1765
|
value: e,
|
|
1757
|
-
label:
|
|
1766
|
+
label: we(r[Dn[e]])
|
|
1758
1767
|
}))
|
|
1759
1768
|
};
|
|
1760
1769
|
}
|
|
1761
|
-
function
|
|
1762
|
-
|
|
1770
|
+
function jn(e, t, n) {
|
|
1771
|
+
on(e, t, n) || kn.set(e.key, t.key, !e.channels[t.key]);
|
|
1763
1772
|
}
|
|
1764
1773
|
// ../js/push.ts
|
|
1765
|
-
var
|
|
1774
|
+
var Mn = {
|
|
1766
1775
|
available: !1,
|
|
1767
1776
|
supported: !1,
|
|
1768
1777
|
permission: "default",
|
|
@@ -1772,11 +1781,11 @@ var jn = {
|
|
|
1772
1781
|
request: null,
|
|
1773
1782
|
devices: null
|
|
1774
1783
|
};
|
|
1775
|
-
function
|
|
1784
|
+
function Nn(e) {
|
|
1776
1785
|
return !e.available || e.reason === "unsupported" ? null : e.busy ? "busy" : e.reason ?? (e.subscribed ? "on" : "off");
|
|
1777
1786
|
}
|
|
1778
|
-
function
|
|
1779
|
-
let t =
|
|
1787
|
+
function Pn(e) {
|
|
1788
|
+
let t = Nn(e), n = e.request?.action ?? "subscribe", r = n === "unsubscribe";
|
|
1780
1789
|
switch (t) {
|
|
1781
1790
|
case null: return null;
|
|
1782
1791
|
case "off": return {
|
|
@@ -1849,39 +1858,39 @@ function Nn(e) {
|
|
|
1849
1858
|
};
|
|
1850
1859
|
}
|
|
1851
1860
|
}
|
|
1852
|
-
function
|
|
1861
|
+
function Fn(e) {
|
|
1853
1862
|
return !N(e) || typeof e.publicKey != "string" || e.publicKey === "" || typeof e.worker != "string" || e.worker === "" ? null : {
|
|
1854
1863
|
publicKey: e.publicKey,
|
|
1855
1864
|
worker: e.worker,
|
|
1856
1865
|
subscribed: e.subscribed === !0
|
|
1857
1866
|
};
|
|
1858
1867
|
}
|
|
1859
|
-
var
|
|
1860
|
-
function
|
|
1868
|
+
var In = (e) => typeof e == "string" && e !== "" ? e : null;
|
|
1869
|
+
function Ln(e) {
|
|
1861
1870
|
if (N(e) && Array.isArray(e.devices)) return e.devices.flatMap((e) => N(e) && typeof e.id == "number" && typeof e.activeAt == "string" ? [{
|
|
1862
1871
|
id: e.id,
|
|
1863
|
-
browser:
|
|
1864
|
-
platform:
|
|
1872
|
+
browser: In(e.browser),
|
|
1873
|
+
platform: In(e.platform),
|
|
1865
1874
|
activeAt: e.activeAt,
|
|
1866
1875
|
current: e.current === !0
|
|
1867
1876
|
}] : []);
|
|
1868
1877
|
}
|
|
1869
|
-
function
|
|
1878
|
+
function Rn(e) {
|
|
1870
1879
|
let t = e.replaceAll("-", "+").replaceAll("_", "/"), n = atob(t.padEnd(t.length + (4 - t.length % 4) % 4, "="));
|
|
1871
1880
|
return Uint8Array.from(n, (e) => e.charCodeAt(0));
|
|
1872
1881
|
}
|
|
1873
|
-
function
|
|
1882
|
+
function zn(e, t) {
|
|
1874
1883
|
let n = e.options?.applicationServerKey;
|
|
1875
1884
|
if (!n) return !0;
|
|
1876
1885
|
let r = new Uint8Array(n);
|
|
1877
1886
|
return r.length === t.length && r.every((e, n) => e === t[n]);
|
|
1878
1887
|
}
|
|
1879
|
-
var
|
|
1880
|
-
function
|
|
1881
|
-
return window.isSecureContext ? navigator.serviceWorker !== void 0 && "PushManager" in window && typeof Notification == "function" ? null :
|
|
1888
|
+
var Bn = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.userAgent.includes("Macintosh") && navigator.maxTouchPoints > 1, Vn = () => navigator.standalone === !0 || window.matchMedia?.("(display-mode: standalone)").matches === !0;
|
|
1889
|
+
function Hn() {
|
|
1890
|
+
return window.isSecureContext ? navigator.serviceWorker !== void 0 && "PushManager" in window && typeof Notification == "function" ? null : Bn() && !Vn() ? "home-screen" : "unsupported" : "insecure";
|
|
1882
1891
|
}
|
|
1883
|
-
var
|
|
1884
|
-
function
|
|
1892
|
+
var Un = () => "brave" in navigator, Wn = () => typeof Notification == "function" ? Notification.permission : "default", Gn = (e) => new URL("./", new URL(e, window.location.href)).href;
|
|
1893
|
+
function Kn(e) {
|
|
1885
1894
|
let t = e.installing ?? e.waiting;
|
|
1886
1895
|
return e.active || !t ? e.active ? Promise.resolve(e) : Promise.reject(/* @__PURE__ */ Error("The service worker did not install.")) : new Promise((n, r) => {
|
|
1887
1896
|
let i = () => {
|
|
@@ -1890,8 +1899,8 @@ function Gn(e) {
|
|
|
1890
1899
|
t.addEventListener("statechange", i);
|
|
1891
1900
|
});
|
|
1892
1901
|
}
|
|
1893
|
-
function
|
|
1894
|
-
let e, t, n, r, i, a = 0, o = null, s = null, c = "unsupported", l = "default", u = !1, d, f = null, p = !1, m = Promise.resolve(), h = null, g = /* @__PURE__ */ new Set(), _ = null, v = 0, y =
|
|
1902
|
+
function qn() {
|
|
1903
|
+
let e, t, n, r, i, a = 0, o = null, s = null, c = "unsupported", l = "default", u = !1, d, f = null, p = !1, m = Promise.resolve(), h = null, g = /* @__PURE__ */ new Set(), _ = null, v = 0, y = Mn, b = /* @__PURE__ */ new Set(), x = () => f?.status === "pending", S = () => {
|
|
1895
1904
|
let e = s !== null, t = c === null, n = {
|
|
1896
1905
|
available: e,
|
|
1897
1906
|
supported: t,
|
|
@@ -1907,11 +1916,11 @@ function Kn() {
|
|
|
1907
1916
|
let t = m.then(e);
|
|
1908
1917
|
return m = t.catch(() => {}), t;
|
|
1909
1918
|
}, w = () => t?.getSnapshot().url, T = async (e) => {
|
|
1910
|
-
let t =
|
|
1919
|
+
let t = Gn(e.worker), n = await navigator.serviceWorker.getRegistration(t);
|
|
1911
1920
|
return n?.scope === t ? n : void 0;
|
|
1912
1921
|
}, E = async (e, t) => {
|
|
1913
1922
|
let n = new URL(e.worker, window.location.href).href;
|
|
1914
|
-
return
|
|
1923
|
+
return Kn(t?.active?.scriptURL === n ? t : await navigator.serviceWorker.register(n, { scope: Gn(e.worker) }));
|
|
1915
1924
|
}, D = (t, n, r) => t === a ? e.request("post", `${w()}/${n}`, r) : Promise.reject(/* @__PURE__ */ Error("Another user signed in.")), O = async (e, t, n = !1) => {
|
|
1916
1925
|
let r = await D(e, "push/subscribe", {
|
|
1917
1926
|
...t.toJSON(),
|
|
@@ -1921,14 +1930,14 @@ function Kn() {
|
|
|
1921
1930
|
if (!N(r) || r.subscribed !== !0) throw Error("The push endpoint did not save the subscription.");
|
|
1922
1931
|
return !0;
|
|
1923
1932
|
}, k = async (e, t, n, r = !1) => {
|
|
1924
|
-
let i =
|
|
1933
|
+
let i = Rn(n.publicKey), a, o;
|
|
1925
1934
|
try {
|
|
1926
|
-
a = await t.pushManager.getSubscription(), a && !
|
|
1935
|
+
a = await t.pushManager.getSubscription(), a && !zn(a, i) && (await a.unsubscribe(), a = null), a ??= o = await t.pushManager.subscribe({
|
|
1927
1936
|
userVisibleOnly: !0,
|
|
1928
1937
|
applicationServerKey: i
|
|
1929
1938
|
});
|
|
1930
1939
|
} catch (e) {
|
|
1931
|
-
throw
|
|
1940
|
+
throw Un() ? Object.assign(/* @__PURE__ */ Error("Brave could not subscribe."), {
|
|
1932
1941
|
brave: !0,
|
|
1933
1942
|
cause: e
|
|
1934
1943
|
}) : e;
|
|
@@ -1952,7 +1961,7 @@ function Kn() {
|
|
|
1952
1961
|
};
|
|
1953
1962
|
try {
|
|
1954
1963
|
let i = await E(n, e), a = await i.pushManager.getSubscription();
|
|
1955
|
-
if (a &&
|
|
1964
|
+
if (a && zn(a, Rn(n.publicKey))) {
|
|
1956
1965
|
n.subscribed && !await O(t, a, !0).catch(() => !0) && (await a.unsubscribe().catch(() => {}), r());
|
|
1957
1966
|
return;
|
|
1958
1967
|
}
|
|
@@ -1970,7 +1979,7 @@ function Kn() {
|
|
|
1970
1979
|
if (s === null || !e) return;
|
|
1971
1980
|
let t = a, n = ++v;
|
|
1972
1981
|
try {
|
|
1973
|
-
let r =
|
|
1982
|
+
let r = Ln(await e.request("get", `${w()}/push/devices`));
|
|
1974
1983
|
t === a && n === v && r && (h = r, M());
|
|
1975
1984
|
} catch {}
|
|
1976
1985
|
}, F = () => {
|
|
@@ -1981,14 +1990,14 @@ function Kn() {
|
|
|
1981
1990
|
let e = t.getSnapshot(), n = e.url === void 0 ? void 0 : e.user ?? "";
|
|
1982
1991
|
n !== i && (i = n, I());
|
|
1983
1992
|
let r = t.pushSettings();
|
|
1984
|
-
r !== o && (o = r, s =
|
|
1993
|
+
r !== o && (o = r, s = Fn(r), s === null ? (u = !1, d = void 0, f = x() ? f : null) : s.subscribed !== d && (u = d = s.subscribed)), l = Wn(), S(), j();
|
|
1985
1994
|
}, z = () => {
|
|
1986
|
-
l =
|
|
1995
|
+
l = Wn(), S(), j();
|
|
1987
1996
|
}, B = (t) => {
|
|
1988
1997
|
let r = t.data;
|
|
1989
1998
|
if (N(r) && r.type === "inertiaui-notifications:shown") {
|
|
1990
|
-
let e = typeof r.tag == "string" ?
|
|
1991
|
-
e !== void 0 && n?.(e) && ee([
|
|
1999
|
+
let e = typeof r.tag == "string" ? It(r.tag) : void 0;
|
|
2000
|
+
e !== void 0 && n?.(e) && ee([Ft(e)]);
|
|
1992
2001
|
return;
|
|
1993
2002
|
}
|
|
1994
2003
|
if (!N(r) || r.type !== "inertiaui-notifications:visit") return;
|
|
@@ -2002,13 +2011,13 @@ function Kn() {
|
|
|
2002
2011
|
let t = N(e.data) ? e.data.context : void 0;
|
|
2003
2012
|
return n === null || t === void 0 || t === n;
|
|
2004
2013
|
};
|
|
2005
|
-
(e === null ? (await r.getNotifications()).filter((e) =>
|
|
2014
|
+
(e === null ? (await r.getNotifications()).filter((e) => It(e.tag) !== void 0 && i(e) && a(e)) : (await Promise.all(e.map((e) => r.getNotifications({ tag: e })))).flat()).forEach((e) => e.close());
|
|
2006
2015
|
} catch {}
|
|
2007
2016
|
}, V = (e) => {
|
|
2008
2017
|
switch (e.kind) {
|
|
2009
|
-
case "item": return e.readAt !== null || e.archivedAt !== null ? ee([
|
|
2010
|
-
case "items": return e.action === "read" || e.action === "archive" ? ee(e.ids.map(
|
|
2011
|
-
case "delete": return ee(e.ids.map(
|
|
2018
|
+
case "item": return e.readAt !== null || e.archivedAt !== null ? ee([Ft(e.id)]) : Promise.resolve();
|
|
2019
|
+
case "items": return e.action === "read" || e.action === "archive" ? ee(e.ids.map(Ft)) : Promise.resolve();
|
|
2020
|
+
case "delete": return ee(e.ids.map(Ft));
|
|
2012
2021
|
case "read":
|
|
2013
2022
|
case "archive": return e.category === null && !(e.kind === "archive" && e.onlyRead) ? ee(null, Date.parse(e.before), t?.context() ?? null) : Promise.resolve();
|
|
2014
2023
|
default: return Promise.resolve();
|
|
@@ -2021,7 +2030,7 @@ function Kn() {
|
|
|
2021
2030
|
getSnapshot: () => y,
|
|
2022
2031
|
connect(i, a, o, s) {
|
|
2023
2032
|
if (e = i, t) return;
|
|
2024
|
-
t = a, n = o, r = s, c =
|
|
2033
|
+
t = a, n = o, r = s, c = Hn(), c === null && (navigator.serviceWorker.addEventListener("message", B), navigator.serviceWorker.startMessages(), navigator.permissions?.query({ name: "notifications" }).then((e) => e.addEventListener("change", z)).catch(() => {}), document.addEventListener("visibilitychange", z));
|
|
2025
2034
|
let l = (e) => void V(e);
|
|
2026
2035
|
a.onChange(l), a.onSaved(({ change: e }) => l(e)), a.subscribe(R), R();
|
|
2027
2036
|
},
|
|
@@ -2031,7 +2040,7 @@ function Kn() {
|
|
|
2031
2040
|
f = {
|
|
2032
2041
|
action: "subscribe",
|
|
2033
2042
|
status: "pending"
|
|
2034
|
-
}, S(), l = Notification.permission === "default" ? await Notification.requestPermission().catch(
|
|
2043
|
+
}, S(), l = Notification.permission === "default" ? await Notification.requestPermission().catch(Wn) : Notification.permission, t === a && (l === "granted" && (p = !0, await C(async () => {
|
|
2035
2044
|
if (t === a) try {
|
|
2036
2045
|
await k(t, await E(n, await T(n)), n), t === a && (u = !0, F());
|
|
2037
2046
|
} catch (e) {
|
|
@@ -2074,41 +2083,41 @@ function Kn() {
|
|
|
2074
2083
|
}
|
|
2075
2084
|
g.delete(e), M();
|
|
2076
2085
|
},
|
|
2077
|
-
close: (e) => ee(e.map(
|
|
2086
|
+
close: (e) => ee(e.map(Ft))
|
|
2078
2087
|
};
|
|
2079
2088
|
}
|
|
2080
|
-
var
|
|
2081
|
-
function
|
|
2089
|
+
var Jn = qn();
|
|
2090
|
+
function Yn(e, t, n, r) {
|
|
2082
2091
|
return (e ?? []).filter((e) => !e.current).map((e) => {
|
|
2083
|
-
let i = e.browser ??
|
|
2092
|
+
let i = e.browser ?? we(t.pushDeviceUnknown), a = e.platform === null ? i : we(t.pushDeviceName, {
|
|
2084
2093
|
browser: i,
|
|
2085
2094
|
platform: e.platform
|
|
2086
2095
|
});
|
|
2087
2096
|
return {
|
|
2088
2097
|
id: e.id,
|
|
2089
2098
|
name: a,
|
|
2090
|
-
active:
|
|
2091
|
-
removeLabel:
|
|
2099
|
+
active: we(t.pushDeviceActive, { time: xt(e.activeAt, n, r) }),
|
|
2100
|
+
removeLabel: we(t.pushDeviceRemoveLabel, { device: a })
|
|
2092
2101
|
};
|
|
2093
2102
|
});
|
|
2094
2103
|
}
|
|
2095
|
-
function
|
|
2104
|
+
function Xn(e) {
|
|
2096
2105
|
let t = e?.button;
|
|
2097
|
-
t && e?.state !== "busy" && (t.action === "subscribe" ?
|
|
2106
|
+
t && e?.state !== "busy" && (t.action === "subscribe" ? Jn.enable() : Jn.disable());
|
|
2098
2107
|
}
|
|
2099
2108
|
// ../js/toastStore.ts
|
|
2100
|
-
var
|
|
2101
|
-
function
|
|
2109
|
+
var Zn = 1e3;
|
|
2110
|
+
function Qn({ title: e, description: t }) {
|
|
2102
2111
|
let n = e.length + (t?.length ?? 0);
|
|
2103
2112
|
return Math.min(Math.max(2e3 + 60 * n, 5e3), 12e3);
|
|
2104
2113
|
}
|
|
2105
|
-
function
|
|
2106
|
-
return typeof t.duration == "function" ? t.duration(e) : e.type === "loading" || e.actions?.some((e) => !e.altText) || e.type === "error" && t.persistentErrors !== !1 ? null : typeof t.duration == "number" ? t.duration : e.type === "warning" ? Math.max(
|
|
2114
|
+
function $n(e, t = {}) {
|
|
2115
|
+
return typeof t.duration == "function" ? t.duration(e) : e.type === "loading" || e.actions?.some((e) => !e.altText) || e.type === "error" && t.persistentErrors !== !1 ? null : typeof t.duration == "number" ? t.duration : e.type === "warning" ? Math.max(Qn(e), 8e3) : Qn(e);
|
|
2107
2116
|
}
|
|
2108
|
-
function
|
|
2117
|
+
function er(e) {
|
|
2109
2118
|
return (e.type === "error" ? 0 : e.type === "warning" ? 2 : 4) + (e.actions.length > 0 ? 0 : 1);
|
|
2110
2119
|
}
|
|
2111
|
-
var
|
|
2120
|
+
var tr = (e) => e === void 0 || Number.isNaN(e) ? void 0 : Math.min(Math.max(e, 0), 1), nr = (e) => [...e.action ? [e.action] : [], ...e.actions ?? []], rr = {
|
|
2112
2121
|
duration: !0,
|
|
2113
2122
|
persistentErrors: !0,
|
|
2114
2123
|
durationScale: !0,
|
|
@@ -2118,7 +2127,7 @@ var er = (e) => e === void 0 || Number.isNaN(e) ? void 0 : Math.min(Math.max(e,
|
|
|
2118
2127
|
dedupe: !0,
|
|
2119
2128
|
removeDelay: !0
|
|
2120
2129
|
};
|
|
2121
|
-
function
|
|
2130
|
+
function ir(e = {}) {
|
|
2122
2131
|
let t = {}, n = 0, r = 0, i = [], a = !1, o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = [], d = () => {
|
|
2123
2132
|
a && (a = !1, i = Array.from(o.values(), (e) => e.toast));
|
|
2124
2133
|
for (let e of l) e();
|
|
@@ -2127,7 +2136,7 @@ function rr(e = {}) {
|
|
|
2127
2136
|
}, f = (e, t) => {
|
|
2128
2137
|
e.toast = t, a = !0;
|
|
2129
2138
|
}, p = (e, n) => {
|
|
2130
|
-
let r = n === void 0 ?
|
|
2139
|
+
let r = n === void 0 ? $n(e, t) : n;
|
|
2131
2140
|
return r === null || t.autoDismiss === !1 ? null : Math.round(r * (t.durationScale ?? 1));
|
|
2132
2141
|
}, m = (e) => {
|
|
2133
2142
|
e.handle !== void 0 && (clearTimeout(e.handle), e.handle = void 0, e.remaining -= Date.now() - e.startedAt);
|
|
@@ -2135,7 +2144,7 @@ function rr(e = {}) {
|
|
|
2135
2144
|
let { timer: t } = e;
|
|
2136
2145
|
if (!t) return;
|
|
2137
2146
|
let n = (c.get(e.toast.toaster ?? "") ?? 0) > 0, r = e.toast.state === "visible" && s.size === 0 && e.holds.size === 0 && e.toast.pendingAction === void 0 && n;
|
|
2138
|
-
r && t.handle === void 0 ? (t.remaining = Math.max(t.remaining, Math.min(
|
|
2147
|
+
r && t.handle === void 0 ? (t.remaining = Math.max(t.remaining, Math.min(Zn, t.duration)), t.startedAt = Date.now(), t.handle = setTimeout(() => E(e.toast.id, "timeout"), t.remaining)) : r || m(t);
|
|
2139
2148
|
}, g = (e) => {
|
|
2140
2149
|
e.timer && m(e.timer);
|
|
2141
2150
|
let { duration: t } = e.toast;
|
|
@@ -2163,7 +2172,7 @@ function rr(e = {}) {
|
|
|
2163
2172
|
let e = t.overflow === "hide" ? -1 : 1;
|
|
2164
2173
|
for (let t of o.values()) {
|
|
2165
2174
|
if (t.toast.state !== "queued") continue;
|
|
2166
|
-
let n = _(t), r = n.filter((e) => e.toast.state === "visible").length, i = n.filter((e) => e.toast.state === "queued").sort((t, n) =>
|
|
2175
|
+
let n = _(t), r = n.filter((e) => e.toast.state === "visible").length, i = n.filter((e) => e.toast.state === "queued").sort((t, n) => er(t.toast) - er(n.toast) || e * (t.sequence - n.sequence));
|
|
2167
2176
|
for (let e of i) {
|
|
2168
2177
|
if (r >= v()) break;
|
|
2169
2178
|
r++, f(e, {
|
|
@@ -2176,7 +2185,7 @@ function rr(e = {}) {
|
|
|
2176
2185
|
let n = _(e).filter((t) => t !== e && t.toast.state === "visible");
|
|
2177
2186
|
if (n.length < v()) return "visible";
|
|
2178
2187
|
if (t.overflow !== "drop-oldest" && t.overflow !== "hide") return "queued";
|
|
2179
|
-
let r = n.reduce((e, t) =>
|
|
2188
|
+
let r = n.reduce((e, t) => er(t.toast) > er(e.toast) ? t : e);
|
|
2180
2189
|
return t.overflow === "hide" ? (f(r, {
|
|
2181
2190
|
...r.toast,
|
|
2182
2191
|
state: "queued"
|
|
@@ -2186,7 +2195,7 @@ function rr(e = {}) {
|
|
|
2186
2195
|
type: n.type ?? "default",
|
|
2187
2196
|
title: t,
|
|
2188
2197
|
description: n.description,
|
|
2189
|
-
actions:
|
|
2198
|
+
actions: nr(n)
|
|
2190
2199
|
};
|
|
2191
2200
|
return {
|
|
2192
2201
|
id: e,
|
|
@@ -2199,14 +2208,14 @@ function rr(e = {}) {
|
|
|
2199
2208
|
toaster: n.toaster,
|
|
2200
2209
|
politeness: n.politeness,
|
|
2201
2210
|
data: n.data,
|
|
2202
|
-
progress:
|
|
2211
|
+
progress: tr(n.progress),
|
|
2203
2212
|
onClose: n.onClose,
|
|
2204
2213
|
onRemove: n.onRemove,
|
|
2205
2214
|
...i
|
|
2206
2215
|
};
|
|
2207
2216
|
}, w = (e, n) => {
|
|
2208
2217
|
let r = n.type ?? "default";
|
|
2209
|
-
if (!(t.dedupe === !1 || n.id !== void 0 || r === "loading" ||
|
|
2218
|
+
if (!(t.dedupe === !1 || n.id !== void 0 || r === "loading" || nr(n).length > 0 || n.data !== void 0)) return [...o.values()].find(({ toast: t }) => t.state !== "closing" && t.actions.length === 0 && t.data === void 0 && t.toaster === n.toaster && t.type === r && t.title === e && t.description === n.description);
|
|
2210
2219
|
};
|
|
2211
2220
|
function T(e, t = {}) {
|
|
2212
2221
|
let i = t.id === void 0 ? void 0 : o.get(t.id);
|
|
@@ -2264,7 +2273,7 @@ function rr(e = {}) {
|
|
|
2264
2273
|
...c,
|
|
2265
2274
|
title: r ?? n.toast.title
|
|
2266
2275
|
};
|
|
2267
|
-
"description" in t && (u.description = t.description), t.progress !== void 0 && (u.progress =
|
|
2276
|
+
"description" in t && (u.description = t.description), t.progress !== void 0 && (u.progress = tr(t.progress)), (i !== void 0 || a !== void 0) && (u.actions = nr({
|
|
2268
2277
|
action: i,
|
|
2269
2278
|
actions: a
|
|
2270
2279
|
})), "duration" in t && (n.requested = t.duration), l && (u.duration = p(u, n.requested), u.revision++);
|
|
@@ -2323,7 +2332,7 @@ function rr(e = {}) {
|
|
|
2323
2332
|
};
|
|
2324
2333
|
},
|
|
2325
2334
|
configure(e) {
|
|
2326
|
-
let n = Object.entries(e).filter(([e, t]) => t !== void 0 && e in
|
|
2335
|
+
let n = Object.entries(e).filter(([e, t]) => t !== void 0 && e in rr);
|
|
2327
2336
|
t = {
|
|
2328
2337
|
...t,
|
|
2329
2338
|
...Object.fromEntries(n)
|
|
@@ -2333,11 +2342,11 @@ function rr(e = {}) {
|
|
|
2333
2342
|
return O.configure(e), O;
|
|
2334
2343
|
}
|
|
2335
2344
|
// ../js/toast.ts
|
|
2336
|
-
var Q =
|
|
2337
|
-
Q.subscribe(() =>
|
|
2338
|
-
var
|
|
2339
|
-
function
|
|
2340
|
-
let e = `scope-${++
|
|
2345
|
+
var Q = ir(), ar = 0;
|
|
2346
|
+
Q.subscribe(() => ar++);
|
|
2347
|
+
var or = () => ar, sr = 0;
|
|
2348
|
+
function cr() {
|
|
2349
|
+
let e = `scope-${++sr}:`, t = /* @__PURE__ */ new Map();
|
|
2341
2350
|
return {
|
|
2342
2351
|
pause(n = "manual", r) {
|
|
2343
2352
|
t.set(JSON.stringify([n, r ?? null]), [n, r]), Q.pause(e + n, r);
|
|
@@ -2350,22 +2359,22 @@ function sr() {
|
|
|
2350
2359
|
}
|
|
2351
2360
|
};
|
|
2352
2361
|
}
|
|
2353
|
-
var
|
|
2354
|
-
let n = t.id === void 0 ? void 0 :
|
|
2355
|
-
n !== void 0 &&
|
|
2356
|
-
}),
|
|
2362
|
+
var lr = j, ur, dr = "requested", fr, pr, mr, hr = B((e, t) => {
|
|
2363
|
+
let n = t.id === void 0 ? void 0 : It(t.id);
|
|
2364
|
+
n !== void 0 && vt.panelOpen() ? vt.loadArrival(n).then((e) => e && Er(e)) : Q.add(e, t);
|
|
2365
|
+
}), gr = (e) => hr(ee(e, lr)), _r = typeof window < "u", vr, yr = [
|
|
2357
2366
|
403,
|
|
2358
2367
|
419,
|
|
2359
2368
|
429,
|
|
2360
2369
|
"5xx",
|
|
2361
2370
|
"network"
|
|
2362
2371
|
];
|
|
2363
|
-
function
|
|
2372
|
+
function br(e) {
|
|
2364
2373
|
let t = (t) => {
|
|
2365
2374
|
let n = e(t);
|
|
2366
|
-
return n === void 0 ? "" :
|
|
2375
|
+
return n === void 0 ? "" : we(n);
|
|
2367
2376
|
};
|
|
2368
|
-
return Object.fromEntries(
|
|
2377
|
+
return Object.fromEntries(yr.map((e) => {
|
|
2369
2378
|
let n = t(`error_toast_${e}`), r = t(`error_toast_${e}_description`);
|
|
2370
2379
|
return [e, r === "" ? { title: n } : {
|
|
2371
2380
|
title: n,
|
|
@@ -2373,122 +2382,122 @@ function yr(e) {
|
|
|
2373
2382
|
}];
|
|
2374
2383
|
}));
|
|
2375
2384
|
}
|
|
2376
|
-
var
|
|
2377
|
-
...
|
|
2378
|
-
...
|
|
2385
|
+
var xr = br((e) => be[e]), Sr = () => ur && {
|
|
2386
|
+
...br(Ce),
|
|
2387
|
+
...ur
|
|
2379
2388
|
};
|
|
2380
|
-
function
|
|
2389
|
+
function Cr(e, t) {
|
|
2381
2390
|
return (t[e] ?? (e >= 500 ? t["5xx"] : void 0)) || void 0;
|
|
2382
2391
|
}
|
|
2383
|
-
function
|
|
2392
|
+
function wr(e, t) {
|
|
2384
2393
|
let { code: n, response: r } = e ?? {};
|
|
2385
2394
|
if (n === "ERR_NETWORK") return t.network || void 0;
|
|
2386
2395
|
if (n !== "ERR_HTTP_RESPONSE" || r?.status === void 0) return;
|
|
2387
2396
|
let { status: i, headers: a } = r;
|
|
2388
|
-
if (!(a["x-inertia"] || a["x-inertia-location"] || i === 409 && a["x-inertia-redirect"] || a["x-inertiaui-toasts"])) return
|
|
2397
|
+
if (!(a["x-inertia"] || a["x-inertia-location"] || i === 409 && a["x-inertia-redirect"] || a["x-inertiaui-toasts"])) return Cr(i, t);
|
|
2389
2398
|
}
|
|
2390
|
-
var
|
|
2391
|
-
label:
|
|
2392
|
-
altText:
|
|
2393
|
-
}),
|
|
2394
|
-
let t =
|
|
2395
|
-
t && (typeof document < "u" && document.visibilityState === "visible" &&
|
|
2396
|
-
},
|
|
2397
|
-
e.kind === "delete" ? e.ids.forEach((e) => Q.dismiss(
|
|
2398
|
-
},
|
|
2399
|
-
let t =
|
|
2399
|
+
var Tr = () => ({
|
|
2400
|
+
label: Te("inbox_toast_view"),
|
|
2401
|
+
altText: Te("inbox_toast_view_alt")
|
|
2402
|
+
}), Er = (e) => {
|
|
2403
|
+
let t = Lt(e, dr, Tr());
|
|
2404
|
+
t && (typeof document < "u" && document.visibilityState === "visible" && Jn.close([e.id]), vt.panelOpen() || Q.getSnapshot().some((e) => e.id === t.options.id && e.state !== "closing") || Q.add(t.title, t.options));
|
|
2405
|
+
}, Dr = (e) => document.visibilityState === "visible" && Q.getSnapshot().some((t) => t.id === Ft(e) && t.state !== "closing"), Or = () => Q.getSnapshot().filter((e) => It(e.id) !== void 0 && e.pendingAction === void 0).forEach((e) => Q.dismiss(e.id)), kr = (e) => {
|
|
2406
|
+
e.kind === "delete" ? e.ids.forEach((e) => Q.dismiss(Ft(e))) : e.kind === "update" && Q.update(Ft(e.item.id), Rt(e.item, Tr()));
|
|
2407
|
+
}, Ar = (e) => {
|
|
2408
|
+
let t = It(e);
|
|
2400
2409
|
t !== void 0 && X.markAsRead(t);
|
|
2401
|
-
},
|
|
2402
|
-
let r =
|
|
2403
|
-
return r === void 0 || n.result === void 0 ? void 0 :
|
|
2410
|
+
}, jr = (e, t, n) => {
|
|
2411
|
+
let r = It(e);
|
|
2412
|
+
return r === void 0 || n.result === void 0 ? void 0 : vt.completer(r, t);
|
|
2404
2413
|
};
|
|
2405
|
-
function
|
|
2406
|
-
if (
|
|
2407
|
-
if (!
|
|
2408
|
-
|
|
2414
|
+
function Mr(e, t = {}) {
|
|
2415
|
+
if (lr = t.flashKey ?? lr, Q.configure(t), dr = t.inbox?.arrivalToasts ?? dr, fr = t.inbox?.onArrival ?? fr, t.errorToasts !== void 0 && (ur = t.errorToasts === !1 ? void 0 : t.errorToasts === !0 ? {} : t.errorToasts), _r) {
|
|
2416
|
+
if (!vr) {
|
|
2417
|
+
vr = e;
|
|
2409
2418
|
let t = (e) => (t) => {
|
|
2410
|
-
let n =
|
|
2411
|
-
n &&
|
|
2419
|
+
let n = Sr();
|
|
2420
|
+
n && wr(t, n) || Q.add(e(), { type: "error" });
|
|
2412
2421
|
};
|
|
2413
|
-
X.connect(e, { onFailure: t(() =>
|
|
2422
|
+
X.connect(e, { onFailure: t(() => Te("inbox_update_failed")) }), kn.connect(e, { onFailure: t(() => Te("preferences_save_failed")) });
|
|
2414
2423
|
let n = ({ url: e, user: t }) => e === void 0 ? void 0 : t ?? "", r = n(X.getSnapshot()), i = r !== void 0;
|
|
2415
2424
|
X.subscribe(() => {
|
|
2416
2425
|
let e = n(X.getSnapshot());
|
|
2417
|
-
e !== r && (i &&
|
|
2418
|
-
}),
|
|
2426
|
+
e !== r && (i && kn.reset(X.getSnapshot().url), i ||= e !== void 0, r = e);
|
|
2427
|
+
}), Nr(e), X.onArrival((e) => fr?.(e)), X.onChange(kr), vt.onPanelOpened(Or), pr = Nt(vt, e, Er), mr = Wt(X), Jn.connect(e, vt, Dr, t(() => Te("preferences_push_device_remove_failed")));
|
|
2419
2428
|
}
|
|
2420
|
-
X.connect(
|
|
2429
|
+
X.connect(vr, { prop: t.inbox?.prop }), pr?.configure({
|
|
2421
2430
|
echo: t.inbox?.echo,
|
|
2422
2431
|
poll: t.inbox?.poll
|
|
2423
|
-
}),
|
|
2432
|
+
}), mr?.configure(t.inbox ?? {});
|
|
2424
2433
|
}
|
|
2425
2434
|
}
|
|
2426
|
-
function
|
|
2427
|
-
e.onFlash(
|
|
2435
|
+
function Nr(e) {
|
|
2436
|
+
e.onFlash(gr), e.onNavigate((e, t) => X.sync(e, t)), e.onRequest((e) => ne(e.url) ? {
|
|
2428
2437
|
...e.headers,
|
|
2429
2438
|
[M]: "1"
|
|
2430
2439
|
} : e.headers), e.onResponse((e) => {
|
|
2431
|
-
|
|
2440
|
+
gr(te(e)), hr(V(e.headers));
|
|
2432
2441
|
}), e.onError((e) => {
|
|
2433
2442
|
let t = e?.response;
|
|
2434
|
-
t?.headers &&
|
|
2435
|
-
let n =
|
|
2443
|
+
t?.headers && hr(V(t.headers));
|
|
2444
|
+
let n = Sr(), r = n && wr(e, n);
|
|
2436
2445
|
r && Q.add(r.title, {
|
|
2437
2446
|
type: "error",
|
|
2438
2447
|
description: r.description
|
|
2439
2448
|
});
|
|
2440
2449
|
}), e.onHttpException((e) => {
|
|
2441
|
-
let t =
|
|
2442
|
-
return t && e.status !== void 0 && !e.headers["x-inertia"] &&
|
|
2450
|
+
let t = Sr();
|
|
2451
|
+
return t && e.status !== void 0 && !e.headers["x-inertia"] && Cr(e.status, t) ? !1 : void 0;
|
|
2443
2452
|
});
|
|
2444
2453
|
let t = () => document.visibilityState === "hidden" ? Q.pause("hidden") : Q.resume("hidden");
|
|
2445
2454
|
document.addEventListener("visibilitychange", t), t(), window.addEventListener("blur", () => Q.pause("blur")), window.addEventListener("focus", () => Q.resume("blur"));
|
|
2446
2455
|
}
|
|
2447
|
-
var
|
|
2448
|
-
function
|
|
2456
|
+
var Pr = /* @__PURE__ */ new Map();
|
|
2457
|
+
function Fr(e, t) {
|
|
2449
2458
|
let n = Q.getSnapshot().find((t) => t.id === e), r = n?.actions[t];
|
|
2450
2459
|
if (!n || !r || n.state === "closing" || n.pendingAction !== void 0) return;
|
|
2451
|
-
|
|
2452
|
-
let i =
|
|
2460
|
+
Ar(e);
|
|
2461
|
+
let i = jr(e, t, r), a = {}, o = () => {
|
|
2453
2462
|
r.keepOpen ? Q.setPendingAction(e, void 0) : Q.dismiss(e, "action");
|
|
2454
|
-
}, s =
|
|
2455
|
-
|
|
2463
|
+
}, s = le(r, n, vr, (n) => {
|
|
2464
|
+
Pr.get(e) === a && (Pr.delete(e), Q.getSnapshot().find((t) => t.id === e)?.pendingAction === t && (n ? o() : Q.setPendingAction(e, void 0)));
|
|
2456
2465
|
}, i);
|
|
2457
|
-
s === "pending" ? (
|
|
2466
|
+
s === "pending" ? (Pr.set(e, a), Q.setPendingAction(e, t)) : s === "done" && o();
|
|
2458
2467
|
}
|
|
2459
|
-
function
|
|
2468
|
+
function Ir(e, t, n) {
|
|
2460
2469
|
let r = Q.getSnapshot().find((t) => t.id === e)?.actions[t];
|
|
2461
2470
|
if (!r) return;
|
|
2462
|
-
let i = H(r), a =
|
|
2463
|
-
if (i !== void 0 &&
|
|
2464
|
-
if (
|
|
2471
|
+
let i = H(r), a = jr(e, t, r);
|
|
2472
|
+
if (i !== void 0 && ae(r, i, n)) {
|
|
2473
|
+
if (W(i, r, n, () => Ar(e), a), re(n)) return;
|
|
2465
2474
|
r.event && window.dispatchEvent(new CustomEvent(r.event, { detail: r.payload })), r.keepOpen || Q.dismiss(e, "action");
|
|
2466
|
-
} else n.preventDefault(),
|
|
2475
|
+
} else n.preventDefault(), Fr(e, t);
|
|
2467
2476
|
}
|
|
2468
|
-
var
|
|
2477
|
+
var Lr = (e, t) => _r ? Q.add(e, t) : t?.id ?? "", Rr = (e) => (t, n) => Lr(t, {
|
|
2469
2478
|
...n,
|
|
2470
2479
|
type: e
|
|
2471
|
-
}),
|
|
2480
|
+
}), zr = (e, t, n, r) => {
|
|
2472
2481
|
let { title: i, ...a } = typeof r == "string" ? { title: r } : r;
|
|
2473
|
-
return
|
|
2482
|
+
return Lr(i, {
|
|
2474
2483
|
...n,
|
|
2475
2484
|
type: t,
|
|
2476
2485
|
...a,
|
|
2477
2486
|
id: e
|
|
2478
2487
|
});
|
|
2479
|
-
},
|
|
2480
|
-
r === void 0 ? Q.getSnapshot().some((t) => t.id === e && t.type === "loading") && Q.dismiss(e) :
|
|
2481
|
-
},
|
|
2482
|
-
success:
|
|
2483
|
-
info:
|
|
2484
|
-
warning:
|
|
2485
|
-
error:
|
|
2486
|
-
loading:
|
|
2488
|
+
}, Br = (e, t, n, r, i) => {
|
|
2489
|
+
r === void 0 ? Q.getSnapshot().some((t) => t.id === e && t.type === "loading") && Q.dismiss(e) : zr(e, t, n, typeof r == "function" ? r(i) : r);
|
|
2490
|
+
}, Vr = 0, Hr = Object.assign(Lr, {
|
|
2491
|
+
success: Rr("success"),
|
|
2492
|
+
info: Rr("info"),
|
|
2493
|
+
warning: Rr("warning"),
|
|
2494
|
+
error: Rr("error"),
|
|
2495
|
+
loading: Rr("loading"),
|
|
2487
2496
|
update: (e, t) => Q.update(e, t),
|
|
2488
2497
|
dismiss: (e) => Q.dismiss(e),
|
|
2489
2498
|
promise(e, { loading: t, success: n, error: r, ...i }) {
|
|
2490
|
-
let a =
|
|
2491
|
-
throw
|
|
2499
|
+
let a = zr(i.id ?? `iui-promise-${++Vr}`, "loading", i, t), o = (typeof e == "function" ? e() : e).then((e) => (typeof Response < "u" && e instanceof Response && !e.ok ? Br(a, "error", i, r, e) : Br(a, "success", i, n, e), e), (e) => {
|
|
2500
|
+
throw Br(a, "error", i, r, e), e;
|
|
2492
2501
|
});
|
|
2493
2502
|
return o.catch(() => {}), {
|
|
2494
2503
|
id: a,
|
|
@@ -2496,21 +2505,21 @@ var Ir = (e, t) => gr ? Q.add(e, t) : t?.id ?? "", Lr = (e) => (t, n) => Ir(t, {
|
|
|
2496
2505
|
};
|
|
2497
2506
|
},
|
|
2498
2507
|
track({ loading: e, success: t, error: n, ...r }, i) {
|
|
2499
|
-
let a = i ?? {}, o = r.id ?? `iui-track-${++
|
|
2508
|
+
let a = i ?? {}, o = r.id ?? `iui-track-${++Vr}`, s = !1;
|
|
2500
2509
|
return {
|
|
2501
2510
|
...i,
|
|
2502
2511
|
onStart(t) {
|
|
2503
|
-
s = !1, e !== void 0 &&
|
|
2512
|
+
s = !1, e !== void 0 && zr(o, "loading", r, e), a.onStart?.(t);
|
|
2504
2513
|
},
|
|
2505
2514
|
onProgress(t) {
|
|
2506
2515
|
let n = t?.progress;
|
|
2507
2516
|
e !== void 0 && n !== void 0 && Q.update(o, { progress: n }), a.onProgress?.(t);
|
|
2508
2517
|
},
|
|
2509
2518
|
onSuccess(e) {
|
|
2510
|
-
s = !0,
|
|
2519
|
+
s = !0, Br(o, "success", r, t, e), a.onSuccess?.(e);
|
|
2511
2520
|
},
|
|
2512
2521
|
onError(e) {
|
|
2513
|
-
s = !0,
|
|
2522
|
+
s = !0, Br(o, "error", r, n, e), a.onError?.(e);
|
|
2514
2523
|
},
|
|
2515
2524
|
onFinish(e) {
|
|
2516
2525
|
s || Q.dismiss(o), a.onFinish?.(e);
|
|
@@ -2519,19 +2528,19 @@ var Ir = (e, t) => gr ? Q.add(e, t) : t?.id ?? "", Lr = (e) => (t, n) => Ir(t, {
|
|
|
2519
2528
|
},
|
|
2520
2529
|
fromHeaders(e) {
|
|
2521
2530
|
let t = e instanceof Headers ? e.get(M) : e["x-inertiaui-toasts"] ?? e["X-InertiaUI-Toasts"];
|
|
2522
|
-
|
|
2531
|
+
_r && t && hr(V({ [M]: t }));
|
|
2523
2532
|
}
|
|
2524
|
-
}),
|
|
2533
|
+
}), Ur = ["F8"], Wr = [
|
|
2525
2534
|
"altKey",
|
|
2526
2535
|
"ctrlKey",
|
|
2527
2536
|
"metaKey",
|
|
2528
2537
|
"shiftKey"
|
|
2529
|
-
],
|
|
2538
|
+
], Gr = {
|
|
2530
2539
|
altKey: "toaster_hotkey_alt",
|
|
2531
2540
|
ctrlKey: "toaster_hotkey_ctrl",
|
|
2532
2541
|
metaKey: "toaster_hotkey_meta",
|
|
2533
2542
|
shiftKey: "toaster_hotkey_shift"
|
|
2534
|
-
},
|
|
2543
|
+
}, Kr = {
|
|
2535
2544
|
width: "0",
|
|
2536
2545
|
height: "0",
|
|
2537
2546
|
margin: "0",
|
|
@@ -2541,31 +2550,31 @@ var Ir = (e, t) => gr ? Q.add(e, t) : t?.id ?? "", Lr = (e) => (t, n) => Ir(t, {
|
|
|
2541
2550
|
background: "none",
|
|
2542
2551
|
color: "inherit",
|
|
2543
2552
|
"pointer-events": "auto"
|
|
2544
|
-
},
|
|
2545
|
-
function
|
|
2546
|
-
return e.map((e) => Object.hasOwn(
|
|
2553
|
+
}, qr = 45, Jr = .11;
|
|
2554
|
+
function Yr(e) {
|
|
2555
|
+
return e.map((e) => Object.hasOwn(Gr, e) ? Te(Gr[e]) : e.replace(/^(Key|Digit)/, "")).join(Te("toaster_hotkey_separator"));
|
|
2547
2556
|
}
|
|
2548
|
-
function
|
|
2549
|
-
let n = e ??
|
|
2550
|
-
return t.length > 0 ?
|
|
2557
|
+
function Xr(e, t) {
|
|
2558
|
+
let n = e ?? Te("toaster_label");
|
|
2559
|
+
return t.length > 0 ? Te("toaster_label_with_hotkey", {
|
|
2551
2560
|
label: n,
|
|
2552
|
-
hotkey:
|
|
2561
|
+
hotkey: Yr(t)
|
|
2553
2562
|
}) : n;
|
|
2554
2563
|
}
|
|
2555
|
-
function
|
|
2556
|
-
return e === void 0 ?
|
|
2557
|
-
}
|
|
2558
|
-
function Zr(e, t = {}) {
|
|
2559
|
-
let n = K(t, e) ?? Se(`toast_type_${e}`);
|
|
2560
|
-
return n === void 0 ? "" : Ce(n);
|
|
2564
|
+
function Zr(e, t) {
|
|
2565
|
+
return e === void 0 ? Te("toast_dismiss", { title: t.title }) : we(e, { title: t.title });
|
|
2561
2566
|
}
|
|
2562
2567
|
function Qr(e, t = {}) {
|
|
2563
|
-
let n =
|
|
2568
|
+
let n = K(t, e) ?? Ce(`toast_type_${e}`);
|
|
2569
|
+
return n === void 0 ? "" : we(n);
|
|
2570
|
+
}
|
|
2571
|
+
function $r(e, t = {}) {
|
|
2572
|
+
let n = Qr(e.type, t), r = n ? `${n}: ${e.title}` : e.title, i = [/[.!?…]$/.test(r) ? r : `${r}.`];
|
|
2564
2573
|
e.description && i.push(e.description);
|
|
2565
2574
|
for (let t of e.actions) t.altText && i.push(t.altText);
|
|
2566
2575
|
return i.join(" ");
|
|
2567
2576
|
}
|
|
2568
|
-
function
|
|
2577
|
+
function ei(e, t) {
|
|
2569
2578
|
let n = /* @__PURE__ */ new Map();
|
|
2570
2579
|
for (let r of [...e].reverse()) if (r.state !== "queued") {
|
|
2571
2580
|
let e = r.position ?? t;
|
|
@@ -2573,12 +2582,12 @@ function $r(e, t) {
|
|
|
2573
2582
|
}
|
|
2574
2583
|
return k.filter((e) => n.has(e)).map((e) => [e, n.get(e)]);
|
|
2575
2584
|
}
|
|
2576
|
-
var
|
|
2577
|
-
function
|
|
2585
|
+
var ti = 0;
|
|
2586
|
+
function ni(e, t, n) {
|
|
2578
2587
|
let { region: r, host: i } = t, a = y({
|
|
2579
2588
|
polite: t.polite,
|
|
2580
2589
|
assertive: t.assertive
|
|
2581
|
-
}), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = ++
|
|
2590
|
+
}), o = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = ++ti, u = {
|
|
2582
2591
|
hover: `hover-${l}`,
|
|
2583
2592
|
focus: `focus-${l}`,
|
|
2584
2593
|
swipe: `swipe-${l}`
|
|
@@ -2683,7 +2692,7 @@ function ti(e, t, n) {
|
|
|
2683
2692
|
}, ie = (e) => {
|
|
2684
2693
|
if (!g || e.pointerId !== g.pointerId) return;
|
|
2685
2694
|
let t = Math.abs(g.dx) / Math.max(1, Date.now() - g.time), n = (window.getSelection?.()?.toString() ?? "") !== "";
|
|
2686
|
-
re(!n && H(g.item, g.dx) && (Math.abs(g.dx) >=
|
|
2695
|
+
re(!n && H(g.item, g.dx) && (Math.abs(g.dx) >= qr || t > Jr));
|
|
2687
2696
|
}, ae = (e) => {
|
|
2688
2697
|
e.pointerId === g?.pointerId && re(!1);
|
|
2689
2698
|
}, oe = (e) => {
|
|
@@ -2692,12 +2701,12 @@ function ti(e, t, n) {
|
|
|
2692
2701
|
};
|
|
2693
2702
|
ce && window.addEventListener("focusout", t, !0), e.focus(), window.removeEventListener("focusout", t, !0);
|
|
2694
2703
|
}, se = (e) => {
|
|
2695
|
-
let { hotkey: t } = n(), i = t.length > 0 && t.every((t) =>
|
|
2704
|
+
let { hotkey: t } = n(), i = t.length > 0 && t.every((t) => Wr.includes(t) ? e[t] : e.code === t), a = E()[0];
|
|
2696
2705
|
i && a && (e.preventDefault(), h = "keyboard", document.activeElement instanceof HTMLElement && document.activeElement !== document.body && !r.contains(document.activeElement) && (m = document.activeElement), oe(a));
|
|
2697
|
-
}, W = [], ce = !1, le = (e) => e.isConnected && (e instanceof HTMLDialogElement ? e.open && e.matches(":modal") : ce && e.matches(":popover-open")),
|
|
2706
|
+
}, W = [], ce = !1, le = (e) => e.isConnected && (e instanceof HTMLDialogElement ? e.open && e.matches(":modal") : ce && e.matches(":popover-open")), ue = (e) => e instanceof HTMLElement && e !== i && e.hasAttribute("popover") && /^(alert)?dialog$/.test(e.getAttribute("role") ?? ""), G = (e) => {
|
|
2698
2707
|
let t = W.indexOf(e);
|
|
2699
2708
|
t !== -1 && W.splice(t, 1);
|
|
2700
|
-
},
|
|
2709
|
+
}, K = (e) => {
|
|
2701
2710
|
let t = Array.from(i?.querySelectorAll("[data-toast-id]") ?? []);
|
|
2702
2711
|
t.forEach((e) => e.style.transition = "none"), e(), i?.offsetWidth, t.forEach((e) => e.style.removeProperty("transition"));
|
|
2703
2712
|
}, de = () => !!i?.isConnected && ce && !i.matches(":popover-open"), q = () => {
|
|
@@ -2707,22 +2716,22 @@ function ti(e, t, n) {
|
|
|
2707
2716
|
i.showPopover();
|
|
2708
2717
|
} catch {
|
|
2709
2718
|
requestAnimationFrame(() => {
|
|
2710
|
-
de() &&
|
|
2719
|
+
de() && K(() => i.showPopover());
|
|
2711
2720
|
});
|
|
2712
2721
|
}
|
|
2713
2722
|
}
|
|
2714
2723
|
}, fe = () => {
|
|
2715
2724
|
if (!i) return;
|
|
2716
2725
|
let e = [...W].reverse().find(le) ?? document.body;
|
|
2717
|
-
i.parentElement === e ? de() && q() :
|
|
2726
|
+
i.parentElement === e ? de() && q() : K(() => {
|
|
2718
2727
|
e.append(i), q();
|
|
2719
2728
|
});
|
|
2720
2729
|
}, pe = (e) => {
|
|
2721
|
-
|
|
2730
|
+
G(e), e.open && e.matches(":modal") && W.push(e);
|
|
2722
2731
|
}, me = (e) => {
|
|
2723
|
-
|
|
2732
|
+
ue(e.target) && e.newState === "closed" && (G(e.target), fe());
|
|
2724
2733
|
}, he = (e) => {
|
|
2725
|
-
|
|
2734
|
+
ue(e.target) && e.newState === "open" && (G(e.target), W.push(e.target), fe());
|
|
2726
2735
|
}, ge = (e) => e.stopPropagation(), J = (e) => {
|
|
2727
2736
|
e.relatedTarget instanceof Node && r.contains(e.relatedTarget) && e.stopPropagation();
|
|
2728
2737
|
}, _e = (e) => {
|
|
@@ -2736,9 +2745,9 @@ function ti(e, t, n) {
|
|
|
2736
2745
|
let t = e && typeof i?.showPopover == "function";
|
|
2737
2746
|
if (i && t !== ce) {
|
|
2738
2747
|
if (ce = t, t) {
|
|
2739
|
-
ve(i), i.setAttribute("aria-live", "off"), i.setAttribute("popover", "manual"), Object.entries(
|
|
2740
|
-
for (let e of document.querySelectorAll("[popover]"))
|
|
2741
|
-
} else ye(i), i.matches(":popover-open") && i.hidePopover(), i.removeAttribute("popover"), i.removeAttribute("aria-live"), Object.keys(
|
|
2748
|
+
ve(i), i.setAttribute("aria-live", "off"), i.setAttribute("popover", "manual"), Object.entries(Kr).forEach(([e, t]) => i.style.setProperty(e, t));
|
|
2749
|
+
for (let e of document.querySelectorAll("[popover]")) ue(e) && le(e) && W.push(e);
|
|
2750
|
+
} else ye(i), i.matches(":popover-open") && i.hidePopover(), i.removeAttribute("popover"), i.removeAttribute("aria-live"), Object.keys(Kr).forEach((e) => i.style.removeProperty(e)), W.splice(0, W.length, ...W.filter((e) => e instanceof HTMLDialogElement));
|
|
2742
2751
|
fe();
|
|
2743
2752
|
}
|
|
2744
2753
|
}, xe = i && typeof MutationObserver == "function" ? new MutationObserver((e) => {
|
|
@@ -2756,7 +2765,7 @@ function ti(e, t, n) {
|
|
|
2756
2765
|
let t = b(), { typeLabels: r } = n(), i = !w();
|
|
2757
2766
|
for (let e of t) {
|
|
2758
2767
|
if (e.state === "closing") continue;
|
|
2759
|
-
o.get(e.id) !== e.revision && (o.set(e.id, e.revision), a.announce(
|
|
2768
|
+
o.get(e.id) !== e.revision && (o.set(e.id, e.revision), a.announce($r(e, r), e.politeness ?? (e.type === "error" ? "assertive" : "polite")));
|
|
2760
2769
|
let t = S(e.id);
|
|
2761
2770
|
t && i && e.count > (s.get(e.id) ?? e.count) && typeof t.animate == "function" && t.animate([
|
|
2762
2771
|
{ scale: "1" },
|
|
@@ -2778,20 +2787,20 @@ function ti(e, t, n) {
|
|
|
2778
2787
|
};
|
|
2779
2788
|
}
|
|
2780
2789
|
// src/classes.ts
|
|
2781
|
-
var
|
|
2790
|
+
var ri = "iui-toast rounded-iui-toast border-iui-toast-border bg-iui-toast-surface text-iui-toast-foreground focus-visible:ring-iui-toast-ring border shadow-lg focus-visible:ring-2 focus-visible:outline-hidden", ii = "flex items-start gap-3 p-4", ai = {
|
|
2782
2791
|
default: "text-iui-toast-default",
|
|
2783
2792
|
info: "text-iui-toast-info",
|
|
2784
2793
|
success: "text-iui-toast-success",
|
|
2785
2794
|
warning: "text-iui-toast-warning",
|
|
2786
2795
|
error: "text-iui-toast-error",
|
|
2787
2796
|
loading: "text-iui-toast-loading"
|
|
2788
|
-
},
|
|
2789
|
-
`${
|
|
2790
|
-
var
|
|
2791
|
-
`${
|
|
2792
|
-
var
|
|
2797
|
+
}, oi = "bg-iui-toast-default size-2 rounded-full", si = "size-5 rounded-full object-cover", ci = "size-5 motion-safe:animate-spin", li = "text-sm font-medium wrap-break-word", ui = "rounded-iui-toast focus-visible:ring-iui-toast-ring inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden aria-disabled:cursor-default aria-disabled:opacity-60";
|
|
2798
|
+
`${ui}`, `${ui}`;
|
|
2799
|
+
var di = "rounded-iui-inbox text-iui-inbox-icon hover:bg-iui-inbox-control-hover hover:text-iui-inbox-icon-hover focus-visible:ring-iui-inbox-ring aria-expanded:bg-iui-inbox-control-hover aria-expanded:text-iui-inbox-icon-hover relative inline-flex size-9 items-center justify-center focus-visible:ring-2 focus-visible:outline-hidden", fi = "iui-inbox-panel border-iui-inbox-border bg-iui-inbox-surface text-iui-inbox-foreground shadow-xl focus-visible:outline-hidden", pi = "iui-inbox-panel-body flex min-h-0 flex-1 flex-col", mi = "-me-1.5 flex items-center gap-1", hi = "inline-flex", gi = "text-iui-inbox-accent tabular-nums", _i = "min-h-0 flex-1 overflow-y-auto overscroll-contain", vi = "sticky top-0 z-20 flex h-0 justify-center", yi = "divide-iui-inbox-border divide-y", bi = "focus-visible:ring-iui-inbox-ring focus-visible:ring-2 focus-visible:ring-inset focus-visible:outline-hidden", xi = "group/item hover:bg-iui-inbox-control-hover/60 data-[selected=true]:bg-iui-inbox-control-hover/60 has-[[data-inbox-link]:focus-visible]:ring-iui-inbox-ring relative flex flex-wrap gap-3 px-4 py-3 has-[[data-inbox-link]:focus-visible]:ring-2 has-[[data-inbox-link]:focus-visible]:ring-inset", Si = "relative flex shrink-0 self-start", Ci = "bg-iui-inbox-control-hover text-iui-inbox-icon-hover flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-full text-sm font-medium", wi = "text-iui-inbox-foreground text-sm wrap-break-word group-data-[read=false]/item:font-semibold", Ti = "after:absolute after:inset-0 focus-visible:outline-hidden", Ei = "text-iui-inbox-muted-foreground mt-1 block text-xs", Di = "text-iui-inbox-muted-foreground mt-1 flex items-center gap-1 text-xs", Oi = "rounded-md focus-visible:ring-iui-inbox-ring inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden aria-disabled:cursor-default aria-disabled:opacity-60";
|
|
2800
|
+
`${Oi}`;
|
|
2801
|
+
var ki = `${Oi} border-iui-inbox-border bg-iui-inbox-surface hover:bg-iui-inbox-control-hover border`, Ai = "iui-inbox-controls border-iui-inbox-border z-10 flex shrink-0 items-center gap-0.5 rounded-md opacity-0 group-focus-within/item:opacity-100 group-hover/item:opacity-100 [@media(hover:none)]:opacity-100", ji = "border-iui-inbox-border flex shrink-0 items-center justify-between gap-3 border-t px-4 py-1.5", Mi = "text-iui-inbox-foreground flex items-center gap-2 text-sm font-medium", Ni = "accent-iui-inbox-accent size-4 cursor-pointer", Pi = "text-iui-inbox-icon hover:bg-iui-inbox-control-hover hover:text-iui-inbox-icon-hover focus-visible:ring-iui-inbox-ring rounded-md p-1.5 focus-visible:ring-2 focus-visible:outline-hidden [@media(hover:hover)]:p-1", Fi = "text-iui-inbox-muted-foreground flex flex-col items-center gap-3 px-6 py-12 text-center text-sm", Ii = "text-iui-inbox-icon size-8", Li = "text-iui-inbox-muted-foreground flex justify-center py-3", Ri = "overflow-x-auto", zi = "w-full border-collapse text-sm", Bi = "text-iui-inbox-muted-foreground px-4 py-2.5 text-start text-xs font-medium", Vi = "text-iui-inbox-muted-foreground w-20 px-2 py-2.5 text-center text-xs font-medium sm:w-24", Hi = "border-iui-inbox-border border-t", Ui = "min-w-36 px-4 py-3 text-start align-top font-normal", Wi = "text-iui-inbox-foreground me-2 font-medium", Gi = "px-2 py-3 text-center align-middle";
|
|
2793
2802
|
// ../js/inertia.ts
|
|
2794
|
-
function
|
|
2803
|
+
function Ki(e, t, n) {
|
|
2795
2804
|
return {
|
|
2796
2805
|
onFlash: (t) => void e.on("flash", (e) => t(e.detail.flash)),
|
|
2797
2806
|
onRequest: (e) => void t.onRequest((t) => ({
|
|
@@ -2827,11 +2836,11 @@ function Gi(e, t, n) {
|
|
|
2827
2836
|
};
|
|
2828
2837
|
}
|
|
2829
2838
|
// src/notifications.ts
|
|
2830
|
-
function
|
|
2831
|
-
|
|
2839
|
+
function qi(e) {
|
|
2840
|
+
Mr(Ki(r, n, i), e);
|
|
2832
2841
|
}
|
|
2833
2842
|
// src/parts.tsx
|
|
2834
|
-
function
|
|
2843
|
+
function Ji({ className: e }) {
|
|
2835
2844
|
return /* @__PURE__ */ O("svg", {
|
|
2836
2845
|
viewBox: "0 0 20 20",
|
|
2837
2846
|
fill: "none",
|
|
@@ -2845,47 +2854,47 @@ function qi({ className: e }) {
|
|
|
2845
2854
|
r: "7",
|
|
2846
2855
|
opacity: "0.25"
|
|
2847
2856
|
}), /* @__PURE__ */ D("path", {
|
|
2848
|
-
d:
|
|
2857
|
+
d: fe,
|
|
2849
2858
|
strokeLinecap: "round"
|
|
2850
2859
|
})]
|
|
2851
2860
|
});
|
|
2852
2861
|
}
|
|
2853
|
-
var
|
|
2854
|
-
function
|
|
2855
|
-
return
|
|
2862
|
+
var Yi = (e) => typeof e == "function" || typeof e == "object" && !!e && "$$typeof" in e && !o(e);
|
|
2863
|
+
function Xi(e, t) {
|
|
2864
|
+
return Yi(e) ? /* @__PURE__ */ D(e, {
|
|
2856
2865
|
className: t,
|
|
2857
2866
|
"aria-hidden": "true"
|
|
2858
2867
|
}) : e;
|
|
2859
2868
|
}
|
|
2860
2869
|
function $({ name: e, context: t, icons: n, resolver: r, className: i }) {
|
|
2861
|
-
let a =
|
|
2862
|
-
return a === void 0 ? e === "spinner" ? /* @__PURE__ */ D(
|
|
2870
|
+
let a = ye(e, t, n, r);
|
|
2871
|
+
return a === void 0 ? e === "spinner" ? /* @__PURE__ */ D(Ji, { className: i }) : /* @__PURE__ */ D("svg", {
|
|
2863
2872
|
viewBox: "0 0 20 20",
|
|
2864
2873
|
fill: "currentColor",
|
|
2865
2874
|
"aria-hidden": "true",
|
|
2866
2875
|
className: i,
|
|
2867
|
-
children: K(
|
|
2876
|
+
children: K(ge, e)?.map((e) => /* @__PURE__ */ D("path", {
|
|
2868
2877
|
fillRule: "evenodd",
|
|
2869
2878
|
clipRule: "evenodd",
|
|
2870
2879
|
d: e
|
|
2871
2880
|
}, e))
|
|
2872
|
-
}) :
|
|
2881
|
+
}) : Xi(a, i);
|
|
2873
2882
|
}
|
|
2874
2883
|
// src/Toaster.tsx
|
|
2875
|
-
var
|
|
2876
|
-
function
|
|
2884
|
+
var Zi = [], Qi = () => () => {};
|
|
2885
|
+
function $i({ toast: e, icons: t, resolver: n }) {
|
|
2877
2886
|
if (e.image !== void 0) return /* @__PURE__ */ D("img", {
|
|
2878
2887
|
src: e.image,
|
|
2879
2888
|
alt: "",
|
|
2880
|
-
className:
|
|
2889
|
+
className: si
|
|
2881
2890
|
});
|
|
2882
2891
|
if (o(e.icon)) return e.icon;
|
|
2883
|
-
let r = (r, i) =>
|
|
2892
|
+
let r = (r, i) => ye(r, {
|
|
2884
2893
|
component: "Toaster",
|
|
2885
2894
|
part: i,
|
|
2886
2895
|
toast: e
|
|
2887
2896
|
}, t, n), i = (typeof e.icon == "string" ? r(e.icon, "icon") : void 0) ?? r(e.type, "type");
|
|
2888
|
-
if (i !== void 0) return
|
|
2897
|
+
if (i !== void 0) return Xi(i, "size-5");
|
|
2889
2898
|
if (e.type === "loading") return /* @__PURE__ */ D($, {
|
|
2890
2899
|
name: "spinner",
|
|
2891
2900
|
context: {
|
|
@@ -2895,10 +2904,10 @@ function Qi({ toast: e, icons: t, resolver: n }) {
|
|
|
2895
2904
|
},
|
|
2896
2905
|
icons: t,
|
|
2897
2906
|
resolver: n,
|
|
2898
|
-
className:
|
|
2907
|
+
className: ci
|
|
2899
2908
|
});
|
|
2900
|
-
let a = K(
|
|
2901
|
-
return a === void 0 ? /* @__PURE__ */ D("span", { className:
|
|
2909
|
+
let a = K(de, e.type);
|
|
2910
|
+
return a === void 0 ? /* @__PURE__ */ D("span", { className: oi }) : /* @__PURE__ */ D("svg", {
|
|
2902
2911
|
viewBox: "0 0 20 20",
|
|
2903
2912
|
fill: "currentColor",
|
|
2904
2913
|
className: "size-5",
|
|
@@ -2909,8 +2918,8 @@ function Qi({ toast: e, icons: t, resolver: n }) {
|
|
|
2909
2918
|
})
|
|
2910
2919
|
});
|
|
2911
2920
|
}
|
|
2912
|
-
function
|
|
2913
|
-
let { flash: S } = a(), C = p(Q.subscribe, Q.getSnapshot, () =>
|
|
2921
|
+
function ea({ position: e = "bottom-right", name: t, label: n, dismissLabel: r, hotkey: i = Ur, typeLabels: o = {}, visibleToasts: s = 3, expand: c = !1, progress: u = !1, icons: h = {}, iconResolver: g, classes: _ = {}, renderToast: v, renderIcon: y, components: b = {}, aboveModals: x = !0 }) {
|
|
2922
|
+
let { flash: S } = a(), C = p(Q.subscribe, Q.getSnapshot, () => Zi), w = p(Qi, () => !0, () => !1), [T] = f(() => typeof document > "u" ? null : Object.assign(document.createElement("div"), { className: "iui-toaster-host" })), k = d(null), A = d(null), j = d(null), M = d(null), N = d({
|
|
2914
2923
|
name: t,
|
|
2915
2924
|
hotkey: i,
|
|
2916
2925
|
typeLabels: o,
|
|
@@ -2928,11 +2937,11 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
2928
2937
|
aboveModals: x
|
|
2929
2938
|
};
|
|
2930
2939
|
}), l(() => {
|
|
2931
|
-
|
|
2940
|
+
qi(), gr(S);
|
|
2932
2941
|
}, []), l(() => {
|
|
2933
2942
|
if (!T || !w) return;
|
|
2934
2943
|
document.body.append(T);
|
|
2935
|
-
let e =
|
|
2944
|
+
let e = ni(Q, {
|
|
2936
2945
|
region: k.current,
|
|
2937
2946
|
host: T,
|
|
2938
2947
|
polite: A.current,
|
|
@@ -2942,8 +2951,8 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
2942
2951
|
e.destroy(), M.current = null, T.remove();
|
|
2943
2952
|
};
|
|
2944
2953
|
}, [T, w]), l(() => M.current?.update()), !T || !w) return null;
|
|
2945
|
-
let P =
|
|
2946
|
-
let t = () => Q.dismiss(e.id, "user"), n = (t, n) =>
|
|
2954
|
+
let P = ei(C.filter((e) => e.toaster === t), e), F = (e) => {
|
|
2955
|
+
let t = () => Q.dismiss(e.id, "user"), n = (t, n) => Ir(e.id, t, n.nativeEvent), i = K(b, e.type);
|
|
2947
2956
|
if (i) return /* @__PURE__ */ D(i, {
|
|
2948
2957
|
toast: e,
|
|
2949
2958
|
dismiss: t,
|
|
@@ -2953,12 +2962,12 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
2953
2962
|
dismiss: t,
|
|
2954
2963
|
runAction: n
|
|
2955
2964
|
});
|
|
2956
|
-
let a =
|
|
2965
|
+
let a = Qr(e.type, o);
|
|
2957
2966
|
return /* @__PURE__ */ O(E, { children: [
|
|
2958
2967
|
e.icon !== !1 && /* @__PURE__ */ D("span", {
|
|
2959
2968
|
"aria-hidden": "true",
|
|
2960
|
-
className: G("flex size-5 shrink-0 items-center justify-center", K(
|
|
2961
|
-
children: y ? y(e) : /* @__PURE__ */ D(
|
|
2969
|
+
className: G("flex size-5 shrink-0 items-center justify-center", K(ai, e.type) ?? ai.default, _.icon),
|
|
2970
|
+
children: y ? y(e) : /* @__PURE__ */ D($i, {
|
|
2962
2971
|
toast: e,
|
|
2963
2972
|
icons: h,
|
|
2964
2973
|
resolver: g
|
|
@@ -2968,7 +2977,7 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
2968
2977
|
className: "min-w-0 flex-1",
|
|
2969
2978
|
children: [
|
|
2970
2979
|
/* @__PURE__ */ O("p", {
|
|
2971
|
-
className: G(
|
|
2980
|
+
className: G(li, _.title),
|
|
2972
2981
|
children: [
|
|
2973
2982
|
a && /* @__PURE__ */ O("span", {
|
|
2974
2983
|
className: "sr-only",
|
|
@@ -2979,7 +2988,7 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
2979
2988
|
"data-toast-count": !0,
|
|
2980
2989
|
"aria-hidden": "true",
|
|
2981
2990
|
className: "bg-iui-toast-control-hover text-iui-toast-muted-foreground ms-1.5 inline-block rounded-full px-1.5 text-xs font-medium tabular-nums",
|
|
2982
|
-
children:
|
|
2991
|
+
children: Te("toast_count", { count: e.count })
|
|
2983
2992
|
})
|
|
2984
2993
|
]
|
|
2985
2994
|
}),
|
|
@@ -2996,7 +3005,7 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
2996
3005
|
"data-toast-progressbar": "",
|
|
2997
3006
|
className: "bg-iui-toast-control-hover mt-2 h-1.5 overflow-hidden rounded-full",
|
|
2998
3007
|
children: /* @__PURE__ */ D("div", {
|
|
2999
|
-
className: G("h-full rounded-full bg-current transition-[width] duration-300 motion-reduce:transition-none", K(
|
|
3008
|
+
className: G("h-full rounded-full bg-current transition-[width] duration-300 motion-reduce:transition-none", K(ai, e.type) ?? ai.default),
|
|
3000
3009
|
style: { width: `${e.progress * 100}%` }
|
|
3001
3010
|
})
|
|
3002
3011
|
}),
|
|
@@ -3038,7 +3047,7 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
3038
3047
|
}),
|
|
3039
3048
|
e.dismissible && /* @__PURE__ */ D("button", {
|
|
3040
3049
|
type: "button",
|
|
3041
|
-
"aria-label":
|
|
3050
|
+
"aria-label": Zr(r, e),
|
|
3042
3051
|
className: G("rounded-iui-toast text-iui-toast-icon hover:bg-iui-toast-control-hover hover:text-iui-toast-icon-hover focus-visible:ring-iui-toast-ring -m-1 shrink-0 p-1 focus-visible:ring-2 focus-visible:outline-hidden", _.dismiss),
|
|
3043
3052
|
onClick: t,
|
|
3044
3053
|
children: /* @__PURE__ */ D($, {
|
|
@@ -3057,7 +3066,7 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
3057
3066
|
};
|
|
3058
3067
|
return m(/* @__PURE__ */ O("section", {
|
|
3059
3068
|
ref: k,
|
|
3060
|
-
"aria-label":
|
|
3069
|
+
"aria-label": Xr(n, i),
|
|
3061
3070
|
tabIndex: -1,
|
|
3062
3071
|
className: "iui-toaster outline-none",
|
|
3063
3072
|
"data-toaster": t,
|
|
@@ -3074,15 +3083,15 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
3074
3083
|
"data-dismissible": String(e.dismissible),
|
|
3075
3084
|
"aria-busy": e.type === "loading" || void 0,
|
|
3076
3085
|
tabIndex: 0,
|
|
3077
|
-
className: G(
|
|
3086
|
+
className: G(ri, _.toast),
|
|
3078
3087
|
children: [/* @__PURE__ */ D("div", {
|
|
3079
3088
|
"data-toast-body": "",
|
|
3080
|
-
className:
|
|
3089
|
+
className: ii,
|
|
3081
3090
|
children: F(e)
|
|
3082
3091
|
}), u && e.duration !== null && /* @__PURE__ */ D("div", {
|
|
3083
3092
|
"data-toast-progress": "",
|
|
3084
3093
|
"aria-hidden": "true",
|
|
3085
|
-
className: G("iui-toast-progress", K(
|
|
3094
|
+
className: G("iui-toast-progress", K(ai, e.type) ?? ai.default, _.progress)
|
|
3086
3095
|
})]
|
|
3087
3096
|
}, e.id))
|
|
3088
3097
|
}, e)),
|
|
@@ -3103,52 +3112,52 @@ function $i({ position: e = "bottom-right", name: t, label: n, dismissLabel: r,
|
|
|
3103
3112
|
}), T);
|
|
3104
3113
|
}
|
|
3105
3114
|
// ../js/notificationCenter.ts
|
|
3106
|
-
var
|
|
3115
|
+
var ta = [
|
|
3107
3116
|
"all",
|
|
3108
3117
|
"unread",
|
|
3109
3118
|
"snoozed",
|
|
3110
3119
|
"archived"
|
|
3111
|
-
],
|
|
3120
|
+
], na = {
|
|
3112
3121
|
all: "empty",
|
|
3113
3122
|
unread: "emptyUnread",
|
|
3114
3123
|
snoozed: "emptySnoozed",
|
|
3115
3124
|
archived: "emptyArchived"
|
|
3116
|
-
},
|
|
3117
|
-
function
|
|
3118
|
-
return Object.hasOwn(
|
|
3125
|
+
}, ra = (e) => [...ta, ...Object.keys(e)], ia = (e) => ra(e.tabs).filter((t) => Ne(t, e.allowedActions));
|
|
3126
|
+
function aa(e, t, n) {
|
|
3127
|
+
return Object.hasOwn(na, e) ? Z(t[e]) : Object.hasOwn(n, e) ? n[e].label : e;
|
|
3119
3128
|
}
|
|
3120
|
-
var
|
|
3129
|
+
var oa = (e, t) => Z(t[Object.hasOwn(na, e) ? na[e] : "empty"]), sa = (e, t, n) => e.map((e) => ({
|
|
3121
3130
|
filter: e,
|
|
3122
|
-
label:
|
|
3131
|
+
label: aa(e, n, t.tabs),
|
|
3123
3132
|
selected: t.filter === e,
|
|
3124
3133
|
count: e === "unread" ? t.counts.unread : null
|
|
3125
|
-
})),
|
|
3126
|
-
function
|
|
3134
|
+
})), ca = (e, t) => t.length > 0 ? e.filter((e) => !t.includes(e.id)) : e;
|
|
3135
|
+
function la(e, t) {
|
|
3127
3136
|
return e.status === "idle" || e.status === "loading" && t === 0 ? "loading" : e.status === "error" ? "error" : t === 0 ? "empty" : "items";
|
|
3128
3137
|
}
|
|
3129
|
-
function
|
|
3130
|
-
|
|
3138
|
+
function ua(e, t = e.category) {
|
|
3139
|
+
Ie({
|
|
3131
3140
|
...e,
|
|
3132
3141
|
category: t
|
|
3133
3142
|
}) > 0 && X.markAllAsRead({ category: t });
|
|
3134
3143
|
}
|
|
3135
|
-
var
|
|
3136
|
-
function
|
|
3144
|
+
var da = (e) => e.filter === "all" && e.allowedActions.includes("archive");
|
|
3145
|
+
function fa(e, t) {
|
|
3137
3146
|
e.length > 0 && X.archiveAll({ category: t });
|
|
3138
3147
|
}
|
|
3139
|
-
function
|
|
3148
|
+
function pa(e, t, n, r) {
|
|
3140
3149
|
let i = new URL(e, "http://localhost"), a = i.searchParams;
|
|
3141
3150
|
return a.delete("filter"), a.delete("category"), r !== void 0 && a.delete(r), t !== "all" && a.set("filter", t), n !== null && a.set("category", n), `${i.pathname}${i.search}`;
|
|
3142
3151
|
}
|
|
3143
|
-
function
|
|
3152
|
+
function ma(e, t, n, r) {
|
|
3144
3153
|
let i = new URL(e, "http://localhost").searchParams, a = i.get("filter");
|
|
3145
3154
|
return {
|
|
3146
|
-
filter: n ?? (a !== null &&
|
|
3155
|
+
filter: n ?? (a !== null && ia(t).includes(a) ? a : "all"),
|
|
3147
3156
|
category: r === void 0 ? i.get("category") || null : r
|
|
3148
3157
|
};
|
|
3149
3158
|
}
|
|
3150
|
-
var
|
|
3151
|
-
function
|
|
3159
|
+
var ha = (e, t, n, r) => Z(e.pausedUntil, { time: mt(t, n, r) }), ga = (e, t, n) => mt(ft(e.preset, new Date(t)), t, n);
|
|
3160
|
+
function _a(e, t) {
|
|
3152
3161
|
let n = !t.includes("snooze") || e === "archived" ? [] : [e === "snoozed" ? {
|
|
3153
3162
|
action: "unsnooze",
|
|
3154
3163
|
icon: "unsnooze",
|
|
@@ -3186,12 +3195,12 @@ function ga(e, t) {
|
|
|
3186
3195
|
...i
|
|
3187
3196
|
];
|
|
3188
3197
|
}
|
|
3189
|
-
var
|
|
3190
|
-
function
|
|
3198
|
+
var va = (e, t, n = /* @__PURE__ */ new Date()) => e ? e(n) : lt(t, n);
|
|
3199
|
+
function ya(e, t, n) {
|
|
3191
3200
|
let r = e.filter((e) => e !== t);
|
|
3192
3201
|
return n ? [...r, t] : r;
|
|
3193
3202
|
}
|
|
3194
|
-
function
|
|
3203
|
+
function ba(e, t, { scroller: n, listed: r }) {
|
|
3195
3204
|
let i = [], a = (e) => {
|
|
3196
3205
|
i = e, t(e);
|
|
3197
3206
|
}, o = n ?? window, s = () => n ? n.scrollTop > 0 : e.getBoundingClientRect().top < 0, c = X.onArrival((t) => {
|
|
@@ -3215,8 +3224,8 @@ function ya(e, t, { scroller: n, listed: r }) {
|
|
|
3215
3224
|
}
|
|
3216
3225
|
};
|
|
3217
3226
|
}
|
|
3218
|
-
var
|
|
3219
|
-
function
|
|
3227
|
+
var xa = 1e3, Sa = 250;
|
|
3228
|
+
function Ca(e, t, n = e) {
|
|
3220
3229
|
let r = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), a = [], o, s = () => {
|
|
3221
3230
|
o = void 0;
|
|
3222
3231
|
let e = a, n = t().filter((t) => e.includes(t.id));
|
|
@@ -3226,11 +3235,11 @@ function Sa(e, t, n = e) {
|
|
|
3226
3235
|
}, l = (e) => {
|
|
3227
3236
|
r.delete(e);
|
|
3228
3237
|
let t = e.dataset.inboxId;
|
|
3229
|
-
t !== void 0 && e.dataset.seen === "false" && e.isConnected && (u.unobserve(e), i.delete(e), a.push(t), o ??= setTimeout(s,
|
|
3238
|
+
t !== void 0 && e.dataset.seen === "false" && e.isConnected && (u.unobserve(e), i.delete(e), a.push(t), o ??= setTimeout(s, Sa));
|
|
3230
3239
|
}, u = new IntersectionObserver((e) => {
|
|
3231
3240
|
for (let t of e) {
|
|
3232
3241
|
let e = t.target, n = t.rootBounds !== null && t.intersectionRect.height >= t.rootBounds.height / 2;
|
|
3233
|
-
t.isIntersecting && (t.intersectionRatio >= .5 || n) ? r.set(e, r.get(e) ?? setTimeout(() => l(e),
|
|
3242
|
+
t.isIntersecting && (t.intersectionRatio >= .5 || n) ? r.set(e, r.get(e) ?? setTimeout(() => l(e), xa)) : c(e);
|
|
3234
3243
|
}
|
|
3235
3244
|
}, {
|
|
3236
3245
|
root: n,
|
|
@@ -3252,7 +3261,7 @@ function Sa(e, t, n = e) {
|
|
|
3252
3261
|
f.disconnect(), u.disconnect(), r.forEach((e) => clearTimeout(e)), o !== void 0 && (clearTimeout(o), s());
|
|
3253
3262
|
} };
|
|
3254
3263
|
}
|
|
3255
|
-
function
|
|
3264
|
+
function wa(e, t) {
|
|
3256
3265
|
let n = (e.target instanceof Element ? e.target : null)?.closest("[data-inbox-link], [data-inbox-action]"), r = n?.closest("[data-inbox-item]")?.dataset.inboxId, i = r === void 0 ? void 0 : t.find((e) => e.id === r);
|
|
3257
3266
|
if (!n || !i) return;
|
|
3258
3267
|
if (!n.hasAttribute("data-inbox-action")) return { item: i };
|
|
@@ -3262,7 +3271,7 @@ function Ca(e, t) {
|
|
|
3262
3271
|
action: o
|
|
3263
3272
|
} : void 0;
|
|
3264
3273
|
}
|
|
3265
|
-
var
|
|
3274
|
+
var Ta = 160, Ea = [
|
|
3266
3275
|
"position",
|
|
3267
3276
|
"box-sizing",
|
|
3268
3277
|
"inset",
|
|
@@ -3278,7 +3287,7 @@ var wa = 160, Ta = [
|
|
|
3278
3287
|
"overflow-y",
|
|
3279
3288
|
"overscroll-behavior"
|
|
3280
3289
|
];
|
|
3281
|
-
function
|
|
3290
|
+
function Da(e, t, n) {
|
|
3282
3291
|
let r, i = null, a, o = t.querySelector("[data-inbox-scroller]"), s = o !== null && typeof ResizeObserver == "function" ? new ResizeObserver(() => {
|
|
3283
3292
|
o.offsetHeight > 0 && o.querySelector(":scope > [role=\"status\"]") === null && t.style.setProperty("--inbox-list-height", `${o.offsetHeight}px`);
|
|
3284
3293
|
}) : void 0;
|
|
@@ -3289,7 +3298,7 @@ function Ea(e, t, n) {
|
|
|
3289
3298
|
}, l = () => {
|
|
3290
3299
|
if (!t.matches(":popover-open")) return;
|
|
3291
3300
|
if (getComputedStyle(t).getPropertyValue("--inbox-layout").trim() === "sheet") {
|
|
3292
|
-
a?.(), a = void 0,
|
|
3301
|
+
a?.(), a = void 0, Ea.forEach((e) => t.style.removeProperty(e)), delete t.dataset.side;
|
|
3293
3302
|
return;
|
|
3294
3303
|
}
|
|
3295
3304
|
let { placement: r } = C(e, t, {
|
|
@@ -3315,7 +3324,7 @@ function Ea(e, t, n) {
|
|
|
3315
3324
|
e.some((e) => e.isIntersecting) && n.onEndReached();
|
|
3316
3325
|
}, {
|
|
3317
3326
|
root: t,
|
|
3318
|
-
rootMargin: `0px 0px ${
|
|
3327
|
+
rootMargin: `0px 0px ${Ta}px 0px`
|
|
3319
3328
|
}) : void 0), r?.disconnect(), e && r?.observe(e);
|
|
3320
3329
|
},
|
|
3321
3330
|
place: l,
|
|
@@ -3327,7 +3336,7 @@ function Ea(e, t, n) {
|
|
|
3327
3336
|
}
|
|
3328
3337
|
};
|
|
3329
3338
|
}
|
|
3330
|
-
var
|
|
3339
|
+
var Oa = {
|
|
3331
3340
|
j: "next",
|
|
3332
3341
|
arrowdown: "next",
|
|
3333
3342
|
k: "previous",
|
|
@@ -3337,15 +3346,15 @@ var Da = {
|
|
|
3337
3346
|
h: "snooze",
|
|
3338
3347
|
x: "select",
|
|
3339
3348
|
enter: "open"
|
|
3340
|
-
},
|
|
3349
|
+
}, ka = {
|
|
3341
3350
|
read: "[data-inbox-toggle-read]",
|
|
3342
3351
|
archive: "[data-inbox-toggle-archive]",
|
|
3343
3352
|
snooze: "[data-inbox-snooze]",
|
|
3344
3353
|
select: "[data-inbox-select]",
|
|
3345
3354
|
open: "[data-inbox-link]"
|
|
3346
3355
|
};
|
|
3347
|
-
function
|
|
3348
|
-
let n =
|
|
3356
|
+
function Aa(e, t) {
|
|
3357
|
+
let n = Oa[e.key.toLowerCase()], r = e.target instanceof HTMLElement ? e.target : null;
|
|
3349
3358
|
if (!n || !r || e.defaultPrevented || e.ctrlKey || e.metaKey || e.altKey || r.closest("input:not([type=\"checkbox\"]), textarea, select, [contenteditable]:not([contenteditable=\"false\"]), [role=\"tab\"]")) return;
|
|
3350
3359
|
let i = [...t.querySelectorAll("[data-inbox-item]")], a = r.closest("[data-inbox-item]"), o = a ? i.indexOf(a) : -1;
|
|
3351
3360
|
if ((n === "open" || e.key.startsWith("Arrow")) && r !== a && r !== t) return;
|
|
@@ -3354,10 +3363,10 @@ function ka(e, t) {
|
|
|
3354
3363
|
t && (e.preventDefault(), t.focus());
|
|
3355
3364
|
return;
|
|
3356
3365
|
}
|
|
3357
|
-
let s = a?.querySelector(
|
|
3366
|
+
let s = a?.querySelector(ka[n]);
|
|
3358
3367
|
a && s && (e.preventDefault(), s.click());
|
|
3359
3368
|
}
|
|
3360
|
-
function
|
|
3369
|
+
function ja(e, t = () => e) {
|
|
3361
3370
|
let n, r = (t) => e.querySelector(`[data-inbox-item][data-inbox-id="${CSS.escape(t)}"]`), i = () => Array.from(e.querySelectorAll("[data-inbox-item]"), (e) => e.dataset.inboxId ?? ""), a = () => {
|
|
3362
3371
|
let t = document.activeElement, r = t instanceof HTMLElement && e.contains(t) ? t.closest("[data-inbox-item]")?.dataset.inboxId : void 0;
|
|
3363
3372
|
n = r === void 0 ? void 0 : {
|
|
@@ -3388,17 +3397,17 @@ function Aa(e, t = () => e) {
|
|
|
3388
3397
|
e.removeEventListener("focusin", a), e.removeEventListener("focusout", o), s?.disconnect();
|
|
3389
3398
|
};
|
|
3390
3399
|
}
|
|
3391
|
-
function
|
|
3400
|
+
function Ma(e, t, n, r, i = !1) {
|
|
3392
3401
|
let a = t > 0 ? Z(e.bellNew, {
|
|
3393
|
-
count:
|
|
3402
|
+
count: St(t, n, r),
|
|
3394
3403
|
number: t
|
|
3395
3404
|
}) : Z(e.bell);
|
|
3396
3405
|
return i ? Z(e.bellPaused, { label: a }) : a;
|
|
3397
3406
|
}
|
|
3398
|
-
function
|
|
3407
|
+
function Na(e) {
|
|
3399
3408
|
return e.trim().split(/\s+/).slice(0, 2).map((e) => Array.from(e)[0]?.toLocaleUpperCase() ?? "").join("");
|
|
3400
3409
|
}
|
|
3401
|
-
function
|
|
3410
|
+
function Pa(e, t, n, r = !1) {
|
|
3402
3411
|
let i = n.indexOf(t), a = {
|
|
3403
3412
|
ArrowRight: r ? -1 : 1,
|
|
3404
3413
|
ArrowLeft: r ? 1 : -1
|
|
@@ -3406,10 +3415,10 @@ function Na(e, t, n, r = !1) {
|
|
|
3406
3415
|
return a === void 0 ? e === "Home" ? n[0] : e === "End" ? n.at(-1) : void 0 : n[(i + a + n.length) % n.length];
|
|
3407
3416
|
}
|
|
3408
3417
|
// ../js/overlay.ts
|
|
3409
|
-
var
|
|
3410
|
-
function
|
|
3418
|
+
var Fa = () => typeof HTMLElement < "u" && "showPopover" in HTMLElement.prototype, Ia = null;
|
|
3419
|
+
function La(e) {
|
|
3411
3420
|
let t = null, n = (n) => {
|
|
3412
|
-
n &&
|
|
3421
|
+
n && Ia !== t ? (Ia?.hide(), Ia = t) : !n && Ia === t && (Ia = null), e.onOpenChange(n);
|
|
3413
3422
|
}, r = (t) => {
|
|
3414
3423
|
let n = e.tooltip();
|
|
3415
3424
|
if (n) return v(n), w() ? void 0 : g(n, t ? [{ opacity: 0 }, { opacity: 1 }] : [{ opacity: 1 }, { opacity: 0 }], {
|
|
@@ -3423,7 +3432,7 @@ function Ia(e) {
|
|
|
3423
3432
|
transition: r
|
|
3424
3433
|
});
|
|
3425
3434
|
return {
|
|
3426
|
-
native:
|
|
3435
|
+
native: Fa(),
|
|
3427
3436
|
onPointerEnter: (e) => {
|
|
3428
3437
|
e.pointerType !== "touch" && i().onMouseEnter();
|
|
3429
3438
|
},
|
|
@@ -3435,13 +3444,13 @@ function Ia(e) {
|
|
|
3435
3444
|
onFocusOut: (e) => t?.onFocusOut(e),
|
|
3436
3445
|
mount: () => t?.mount(),
|
|
3437
3446
|
cleanup: () => {
|
|
3438
|
-
t?.cleanup(),
|
|
3447
|
+
t?.cleanup(), Ia === t && (Ia = null);
|
|
3439
3448
|
}
|
|
3440
3449
|
};
|
|
3441
3450
|
}
|
|
3442
3451
|
// src/Tooltip.tsx
|
|
3443
|
-
function
|
|
3444
|
-
let [r, i] = f(!1), a = d(null), o = d(null), s = d(null), c = () => s.current ??=
|
|
3452
|
+
function Ra({ text: e, shortcut: t, children: n }) {
|
|
3453
|
+
let [r, i] = f(!1), a = d(null), o = d(null), s = d(null), c = () => s.current ??= La({
|
|
3445
3454
|
reference: () => a.current,
|
|
3446
3455
|
tooltip: () => o.current,
|
|
3447
3456
|
onOpenChange: i
|
|
@@ -3450,7 +3459,7 @@ function La({ text: e, shortcut: t, children: n }) {
|
|
|
3450
3459
|
r && s.current?.mount();
|
|
3451
3460
|
}, [r]), /* @__PURE__ */ O("span", {
|
|
3452
3461
|
ref: a,
|
|
3453
|
-
className:
|
|
3462
|
+
className: hi,
|
|
3454
3463
|
onPointerEnter: (e) => c().onPointerEnter(e.nativeEvent),
|
|
3455
3464
|
onPointerLeave: () => c().onPointerLeave(),
|
|
3456
3465
|
onPointerDown: () => c().onPointerDown(),
|
|
@@ -3459,7 +3468,7 @@ function La({ text: e, shortcut: t, children: n }) {
|
|
|
3459
3468
|
children: [n, r && /* @__PURE__ */ O("span", {
|
|
3460
3469
|
ref: o,
|
|
3461
3470
|
role: "tooltip",
|
|
3462
|
-
popover:
|
|
3471
|
+
popover: Fa() ? "manual" : void 0,
|
|
3463
3472
|
"data-inbox-tooltip": "",
|
|
3464
3473
|
className: "bg-iui-inbox-tooltip text-iui-inbox-tooltip-foreground pointer-events-none m-0 flex w-max max-w-xs items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium shadow-md",
|
|
3465
3474
|
children: [e, t && /* @__PURE__ */ D("kbd", {
|
|
@@ -3470,17 +3479,17 @@ function La({ text: e, shortcut: t, children: n }) {
|
|
|
3470
3479
|
});
|
|
3471
3480
|
}
|
|
3472
3481
|
// src/InboxHeader.tsx
|
|
3473
|
-
function
|
|
3474
|
-
let T = c(), k = c(), A = (e) => Z(o[e]), j =
|
|
3482
|
+
function za({ component: e, state: n, filter: r, category: i, items: a, labels: o, icons: u, iconResolver: p, classes: m, locale: h, maxCount: g = 99, now: _, panel: v, href: y, open: x = !0, renderHeader: C, renderTab: w }) {
|
|
3483
|
+
let T = c(), k = c(), A = (e) => Z(o[e]), j = ia(n), M = [[null, A("allCategories")], ...Object.entries(n.categoryFilter)], N = M.length > 1, P = Ie({
|
|
3475
3484
|
...n,
|
|
3476
3485
|
category: i
|
|
3477
|
-
}), F =
|
|
3486
|
+
}), F = da({
|
|
3478
3487
|
filter: r,
|
|
3479
3488
|
allowedActions: n.allowedActions
|
|
3480
3489
|
}), I = r === "all" || r === "unread", L = F || n.canPause, R = I || L, z = (t) => ({
|
|
3481
3490
|
component: e,
|
|
3482
3491
|
part: t
|
|
3483
|
-
}), B = d(null), ee = d(null), [V, te] = f(!1), H =
|
|
3492
|
+
}), B = d(null), ee = d(null), [V, te] = f(!1), H = pt(n.pausePresets, o, h), ne = d(null), U = () => ne.current ??= b({
|
|
3484
3493
|
reference: () => B.current,
|
|
3485
3494
|
popover: () => ee.current,
|
|
3486
3495
|
position: {
|
|
@@ -3494,22 +3503,22 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3494
3503
|
let e = ne.current;
|
|
3495
3504
|
if (V && e) return e.mount(), () => e.cleanup();
|
|
3496
3505
|
}, [V]), s(() => ne.current?.close(!1), [x]);
|
|
3497
|
-
let re = (e) => void X.pause(
|
|
3506
|
+
let re = (e) => void X.pause(ft(e.preset)), ie = (e) => {
|
|
3498
3507
|
let t = e.currentTarget.closest("[data-inbox-panel], [data-inbox-list]");
|
|
3499
3508
|
X.resume(), (B.current ?? t)?.focus();
|
|
3500
|
-
}, ae = () =>
|
|
3501
|
-
let t = S(e.currentTarget), n =
|
|
3509
|
+
}, ae = () => ua(n, i), oe = () => fa(a, i), se = (e, t) => void X.load(e, t), W = (e) => {
|
|
3510
|
+
let t = S(e.currentTarget), n = Pa(e.key, r, j, t);
|
|
3502
3511
|
n !== void 0 && v && (e.preventDefault(), se(n, i), document.getElementById(v.tabId(n))?.focus());
|
|
3503
3512
|
}, ce = (e) => w ? w(e) : /* @__PURE__ */ O(E, { children: [
|
|
3504
3513
|
e.label,
|
|
3505
3514
|
" ",
|
|
3506
3515
|
e.count !== null && e.count > 0 && /* @__PURE__ */ D("span", {
|
|
3507
3516
|
className: "bg-iui-inbox-accent-subtle text-iui-inbox-accent rounded-full px-1.5 text-xs/5 tabular-nums",
|
|
3508
|
-
children:
|
|
3517
|
+
children: St(e.count, g, h)
|
|
3509
3518
|
})
|
|
3510
3519
|
] }), le = (e) => j.length > 1 && y && /* @__PURE__ */ D("div", {
|
|
3511
3520
|
className: e,
|
|
3512
|
-
children:
|
|
3521
|
+
children: sa(j, {
|
|
3513
3522
|
...n,
|
|
3514
3523
|
filter: r
|
|
3515
3524
|
}, o).map((e) => /* @__PURE__ */ D(t, {
|
|
@@ -3519,12 +3528,12 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3519
3528
|
className: "text-iui-inbox-muted-foreground hover:text-iui-inbox-foreground focus-visible:ring-iui-inbox-ring aria-selected:border-iui-inbox-accent aria-selected:text-iui-inbox-accent aria-[current=page]:border-iui-inbox-accent aria-[current=page]:text-iui-inbox-accent -mb-px inline-flex items-center gap-1.5 rounded-t-md border-b-2 border-transparent px-1.5 py-2 text-sm font-medium focus-visible:ring-2 focus-visible:outline-hidden focus-visible:ring-inset",
|
|
3520
3529
|
children: ce(e)
|
|
3521
3530
|
}, e.filter))
|
|
3522
|
-
}),
|
|
3531
|
+
}), ue = (e, t) => /* @__PURE__ */ O(E, { children: [
|
|
3523
3532
|
t,
|
|
3524
3533
|
" ",
|
|
3525
3534
|
e !== null && n.categoryCounts[e] ? /* @__PURE__ */ D("span", {
|
|
3526
|
-
className:
|
|
3527
|
-
children:
|
|
3535
|
+
className: gi,
|
|
3536
|
+
children: St(n.categoryCounts[e], g, h)
|
|
3528
3537
|
}) : null
|
|
3529
3538
|
] });
|
|
3530
3539
|
return /* @__PURE__ */ O(E, { children: [
|
|
@@ -3564,7 +3573,7 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3564
3573
|
className: "text-iui-inbox-muted-foreground hover:text-iui-inbox-foreground focus-visible:ring-iui-inbox-ring rounded-md px-1.5 py-1 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
3565
3574
|
onClick: ae,
|
|
3566
3575
|
children: A("markAllAsRead")
|
|
3567
|
-
}), L && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(
|
|
3576
|
+
}), L && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D(Ra, {
|
|
3568
3577
|
text: A("moreActions"),
|
|
3569
3578
|
children: /* @__PURE__ */ D("button", {
|
|
3570
3579
|
ref: B,
|
|
@@ -3592,7 +3601,7 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3592
3601
|
ref: ee,
|
|
3593
3602
|
role: "menu",
|
|
3594
3603
|
"aria-label": A("moreActions"),
|
|
3595
|
-
popover:
|
|
3604
|
+
popover: Fa() ? "auto" : void 0,
|
|
3596
3605
|
"data-inbox-menu": "",
|
|
3597
3606
|
className: "border-iui-inbox-border bg-iui-inbox-surface text-iui-inbox-foreground rounded-iui-inbox m-0 w-max min-w-48 border p-1 shadow-lg",
|
|
3598
3607
|
children: [
|
|
@@ -3639,7 +3648,7 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3639
3648
|
" ",
|
|
3640
3649
|
/* @__PURE__ */ D("span", {
|
|
3641
3650
|
className: "text-iui-inbox-muted-foreground ms-auto ps-6 tabular-nums",
|
|
3642
|
-
children:
|
|
3651
|
+
children: ga(e, _, h)
|
|
3643
3652
|
})
|
|
3644
3653
|
]
|
|
3645
3654
|
}, e.label))]
|
|
@@ -3664,7 +3673,7 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3664
3673
|
}),
|
|
3665
3674
|
/* @__PURE__ */ D("span", {
|
|
3666
3675
|
className: "min-w-0 flex-1",
|
|
3667
|
-
children:
|
|
3676
|
+
children: ha(o, n.pausedUntil, _, h)
|
|
3668
3677
|
}),
|
|
3669
3678
|
/* @__PURE__ */ D("button", {
|
|
3670
3679
|
type: "button",
|
|
@@ -3682,7 +3691,7 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3682
3691
|
"aria-labelledby": v.titleId,
|
|
3683
3692
|
className: "iui-inbox-fade border-iui-inbox-border flex shrink-0 gap-1 overflow-x-auto border-b ps-2.5 pe-8 scrollbar-none",
|
|
3684
3693
|
onKeyDown: W,
|
|
3685
|
-
children:
|
|
3694
|
+
children: sa(j, {
|
|
3686
3695
|
...n,
|
|
3687
3696
|
filter: r
|
|
3688
3697
|
}, o).map((e) => /* @__PURE__ */ D("button", {
|
|
@@ -3707,26 +3716,26 @@ function Ra({ component: e, state: n, filter: r, category: i, items: a, labels:
|
|
|
3707
3716
|
"data-inbox-category": e ?? "",
|
|
3708
3717
|
"aria-current": i === e ? "page" : void 0,
|
|
3709
3718
|
className: "border-iui-inbox-border text-iui-inbox-muted-foreground hover:bg-iui-inbox-control-hover hover:text-iui-inbox-foreground focus-visible:ring-iui-inbox-ring aria-pressed:border-iui-inbox-accent aria-pressed:bg-iui-inbox-accent-subtle aria-pressed:text-iui-inbox-accent aria-[current=page]:border-iui-inbox-accent aria-[current=page]:bg-iui-inbox-accent-subtle aria-[current=page]:text-iui-inbox-accent inline-flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden",
|
|
3710
|
-
children:
|
|
3719
|
+
children: ue(e, n)
|
|
3711
3720
|
}, e ?? "") : /* @__PURE__ */ D("button", {
|
|
3712
3721
|
type: "button",
|
|
3713
3722
|
"data-inbox-category": e ?? "",
|
|
3714
3723
|
"aria-pressed": i === e,
|
|
3715
3724
|
className: "border-iui-inbox-border text-iui-inbox-muted-foreground hover:bg-iui-inbox-control-hover hover:text-iui-inbox-foreground focus-visible:ring-iui-inbox-ring aria-pressed:border-iui-inbox-accent aria-pressed:bg-iui-inbox-accent-subtle aria-pressed:text-iui-inbox-accent aria-[current=page]:border-iui-inbox-accent aria-[current=page]:bg-iui-inbox-accent-subtle aria-[current=page]:text-iui-inbox-accent inline-flex shrink-0 items-center gap-1 rounded-full border px-2.5 py-1 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden",
|
|
3716
3725
|
onClick: () => se(r, e),
|
|
3717
|
-
children:
|
|
3726
|
+
children: ue(e, n)
|
|
3718
3727
|
}, e ?? ""))
|
|
3719
3728
|
})
|
|
3720
3729
|
] });
|
|
3721
3730
|
}
|
|
3722
3731
|
// src/NotificationItem.tsx
|
|
3723
|
-
var
|
|
3732
|
+
var Ba = [
|
|
3724
3733
|
"snooze",
|
|
3725
3734
|
"archive",
|
|
3726
3735
|
"mute"
|
|
3727
3736
|
];
|
|
3728
|
-
function
|
|
3729
|
-
let g = e.readAt === null, _ = e.archivedAt !== null, v =
|
|
3737
|
+
function Va({ item: e, now: t, labels: n = Tt(), icons: r = {}, iconResolver: i, classes: a = {}, locale: o, pendingAction: l, snooze: u, allowedActions: p = Ba, selected: m = !1, onSelectedChange: h }) {
|
|
3738
|
+
let g = e.readAt === null, _ = e.archivedAt !== null, v = Re(e, t), y = Dt(n, e), b = Et(e), x = (e) => p.includes(e), S = (t) => Z(n.itemControl, {
|
|
3730
3739
|
action: Z(t),
|
|
3731
3740
|
title: e.title
|
|
3732
3741
|
}), C = x("snooze"), w = c(), [T, k] = f(null), A = d(null);
|
|
@@ -3738,13 +3747,13 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3738
3747
|
else if (T) k(null);
|
|
3739
3748
|
else {
|
|
3740
3749
|
let e = /* @__PURE__ */ new Date();
|
|
3741
|
-
k(u ? u(e) :
|
|
3750
|
+
k(u ? u(e) : lt(n, e));
|
|
3742
3751
|
}
|
|
3743
3752
|
}, M = (t) => ({
|
|
3744
3753
|
component: "NotificationItem",
|
|
3745
3754
|
part: t,
|
|
3746
3755
|
item: e
|
|
3747
|
-
}), N = e.icon ?
|
|
3756
|
+
}), N = e.icon ? ye(e.icon, M("media"), r, i) : void 0, P = new Date(e.createdAt).toLocaleString(o, {
|
|
3748
3757
|
dateStyle: "medium",
|
|
3749
3758
|
timeStyle: "short"
|
|
3750
3759
|
}), F = /* @__PURE__ */ D($, {
|
|
@@ -3758,20 +3767,20 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3758
3767
|
src: e.actor.avatar,
|
|
3759
3768
|
alt: "",
|
|
3760
3769
|
className: "size-full object-cover"
|
|
3761
|
-
}) : N === void 0 ? e.actor?.name && (F =
|
|
3770
|
+
}) : N === void 0 ? e.actor?.name && (F = Na(e.actor.name)) : F = Xi(N, "size-5");
|
|
3762
3771
|
let I = h ? "label" : "span";
|
|
3763
3772
|
return /* @__PURE__ */ O("div", {
|
|
3764
3773
|
"data-read": String(!g),
|
|
3765
3774
|
"data-archived": String(_),
|
|
3766
3775
|
"data-selected": h ? String(m) : void 0,
|
|
3767
|
-
className: G(
|
|
3776
|
+
className: G(xi, a.item),
|
|
3768
3777
|
children: [
|
|
3769
3778
|
/* @__PURE__ */ O(I, {
|
|
3770
|
-
className: G(
|
|
3779
|
+
className: G(Si, h && "z-10 cursor-pointer"),
|
|
3771
3780
|
children: [
|
|
3772
3781
|
/* @__PURE__ */ D("span", {
|
|
3773
3782
|
"aria-hidden": "true",
|
|
3774
|
-
className: G(
|
|
3783
|
+
className: G(Ci, a.media),
|
|
3775
3784
|
children: F
|
|
3776
3785
|
}),
|
|
3777
3786
|
h && /* @__PURE__ */ D("span", {
|
|
@@ -3796,7 +3805,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3796
3805
|
className: "min-w-0 flex-1",
|
|
3797
3806
|
children: [
|
|
3798
3807
|
/* @__PURE__ */ O("p", {
|
|
3799
|
-
className: G(
|
|
3808
|
+
className: G(wi, a.title),
|
|
3800
3809
|
children: [
|
|
3801
3810
|
g && /* @__PURE__ */ O("span", {
|
|
3802
3811
|
className: "sr-only",
|
|
@@ -3809,7 +3818,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3809
3818
|
e.url ? /* @__PURE__ */ D("a", {
|
|
3810
3819
|
"data-inbox-link": "",
|
|
3811
3820
|
href: e.url,
|
|
3812
|
-
className:
|
|
3821
|
+
className: Ti,
|
|
3813
3822
|
onClick: (t) => X.open(e, t.nativeEvent),
|
|
3814
3823
|
children: e.title
|
|
3815
3824
|
}) : e.title
|
|
@@ -3837,27 +3846,27 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3837
3846
|
src: e.avatar,
|
|
3838
3847
|
alt: "",
|
|
3839
3848
|
className: "size-full object-cover"
|
|
3840
|
-
}) : e.name &&
|
|
3849
|
+
}) : e.name && Na(e.name)
|
|
3841
3850
|
}, t))
|
|
3842
3851
|
}), y]
|
|
3843
3852
|
}),
|
|
3844
3853
|
v && e.snoozedUntil ? /* @__PURE__ */ O("p", {
|
|
3845
3854
|
"data-inbox-snoozed-until": "",
|
|
3846
3855
|
suppressHydrationWarning: !0,
|
|
3847
|
-
className: G(
|
|
3856
|
+
className: G(Di, a.time),
|
|
3848
3857
|
children: [/* @__PURE__ */ D($, {
|
|
3849
3858
|
name: "snooze",
|
|
3850
3859
|
context: M("snoozed-until"),
|
|
3851
3860
|
icons: r,
|
|
3852
3861
|
resolver: i,
|
|
3853
3862
|
className: "size-3.5"
|
|
3854
|
-
}), Z(n.snoozedUntil, { time:
|
|
3863
|
+
}), Z(n.snoozedUntil, { time: ut(e.snoozedUntil, t, o) })]
|
|
3855
3864
|
}) : /* @__PURE__ */ D("time", {
|
|
3856
3865
|
dateTime: e.createdAt,
|
|
3857
3866
|
title: P,
|
|
3858
3867
|
suppressHydrationWarning: !0,
|
|
3859
|
-
className: G(
|
|
3860
|
-
children:
|
|
3868
|
+
className: G(Ei, a.time),
|
|
3869
|
+
children: xt(e.createdAt, t, o)
|
|
3861
3870
|
}),
|
|
3862
3871
|
e.muted && /* @__PURE__ */ O("p", {
|
|
3863
3872
|
"data-inbox-muted": "",
|
|
@@ -3932,7 +3941,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3932
3941
|
" ",
|
|
3933
3942
|
/* @__PURE__ */ D("span", {
|
|
3934
3943
|
className: "text-iui-inbox-muted-foreground font-normal",
|
|
3935
|
-
children:
|
|
3944
|
+
children: ut(n.until, t, o)
|
|
3936
3945
|
})
|
|
3937
3946
|
]
|
|
3938
3947
|
}, n.label))
|
|
@@ -3940,9 +3949,9 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3940
3949
|
]
|
|
3941
3950
|
}),
|
|
3942
3951
|
/* @__PURE__ */ O("div", {
|
|
3943
|
-
className:
|
|
3952
|
+
className: Ai,
|
|
3944
3953
|
children: [
|
|
3945
|
-
/* @__PURE__ */ D(
|
|
3954
|
+
/* @__PURE__ */ D(Ra, {
|
|
3946
3955
|
text: Z(g ? n.markAsRead : n.markAsUnread),
|
|
3947
3956
|
shortcut: "U",
|
|
3948
3957
|
children: /* @__PURE__ */ D("button", {
|
|
@@ -3950,7 +3959,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3950
3959
|
"data-inbox-toggle-read": "",
|
|
3951
3960
|
"aria-keyshortcuts": "U",
|
|
3952
3961
|
"aria-label": S(g ? n.markAsRead : n.markAsUnread),
|
|
3953
|
-
className: G(
|
|
3962
|
+
className: G(Pi, a.control),
|
|
3954
3963
|
onClick: () => void (g ? X.markAsRead(e) : X.markAsUnread(e)),
|
|
3955
3964
|
children: /* @__PURE__ */ D($, {
|
|
3956
3965
|
name: g ? "read" : "unread",
|
|
@@ -3961,7 +3970,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3961
3970
|
})
|
|
3962
3971
|
})
|
|
3963
3972
|
}),
|
|
3964
|
-
C && !_ && /* @__PURE__ */ D(
|
|
3973
|
+
C && !_ && /* @__PURE__ */ D(Ra, {
|
|
3965
3974
|
text: Z(v ? n.unsnooze : n.snooze),
|
|
3966
3975
|
shortcut: "H",
|
|
3967
3976
|
children: /* @__PURE__ */ D("button", {
|
|
@@ -3982,7 +3991,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3982
3991
|
})
|
|
3983
3992
|
})
|
|
3984
3993
|
}),
|
|
3985
|
-
e.group !== null && x("mute") && /* @__PURE__ */ D(
|
|
3994
|
+
e.group !== null && x("mute") && /* @__PURE__ */ D(Ra, {
|
|
3986
3995
|
text: Z(e.muted ? n.unmute : n.mute),
|
|
3987
3996
|
children: /* @__PURE__ */ D("button", {
|
|
3988
3997
|
type: "button",
|
|
@@ -3999,7 +4008,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
3999
4008
|
})
|
|
4000
4009
|
})
|
|
4001
4010
|
}),
|
|
4002
|
-
x("archive") && /* @__PURE__ */ D(
|
|
4011
|
+
x("archive") && /* @__PURE__ */ D(Ra, {
|
|
4003
4012
|
text: Z(_ ? n.unarchive : n.archive),
|
|
4004
4013
|
shortcut: "E",
|
|
4005
4014
|
children: /* @__PURE__ */ D("button", {
|
|
@@ -4018,7 +4027,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
4018
4027
|
})
|
|
4019
4028
|
})
|
|
4020
4029
|
}),
|
|
4021
|
-
x("delete") && /* @__PURE__ */ D(
|
|
4030
|
+
x("delete") && /* @__PURE__ */ D(Ra, {
|
|
4022
4031
|
text: Z(n.delete),
|
|
4023
4032
|
children: /* @__PURE__ */ D("button", {
|
|
4024
4033
|
type: "button",
|
|
@@ -4041,7 +4050,7 @@ function Ba({ item: e, now: t, labels: n = wt(), icons: r = {}, iconResolver: i,
|
|
|
4041
4050
|
});
|
|
4042
4051
|
}
|
|
4043
4052
|
// src/ItemGroup.tsx
|
|
4044
|
-
function
|
|
4053
|
+
function Ha({ group: e, now: t, labels: n, icons: r, iconResolver: i, classes: a, locale: o, pendingActions: s, snooze: l, allowedActions: u, selected: d, select: p, renderItem: m }) {
|
|
4045
4054
|
let [h, g] = f(!1), _ = c();
|
|
4046
4055
|
h && e.others.length === 0 && g(!1);
|
|
4047
4056
|
let v = (e, c) => {
|
|
@@ -4067,8 +4076,8 @@ function Va({ group: e, now: t, labels: n, icons: r, iconResolver: i, classes: a
|
|
|
4067
4076
|
"data-seen": String(e.seenAt !== null),
|
|
4068
4077
|
"data-archived": String(e.archivedAt !== null),
|
|
4069
4078
|
"data-announcement": e.announcement ? "true" : void 0,
|
|
4070
|
-
className:
|
|
4071
|
-
children: [m ? m(e, t, f) : /* @__PURE__ */ D(
|
|
4079
|
+
className: bi,
|
|
4080
|
+
children: [m ? m(e, t, f) : /* @__PURE__ */ D(Va, { ...f }), c]
|
|
4072
4081
|
}, e.id);
|
|
4073
4082
|
};
|
|
4074
4083
|
return v(e.item, e.others.length > 0 && /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("button", {
|
|
@@ -4087,7 +4096,7 @@ function Va({ group: e, now: t, labels: n, icons: r, iconResolver: i, classes: a
|
|
|
4087
4096
|
})] }));
|
|
4088
4097
|
}
|
|
4089
4098
|
// src/SelectionBar.tsx
|
|
4090
|
-
function
|
|
4099
|
+
function Ua({ component: e, items: t, selected: n, onSelectedChange: r, filter: i, allowedActions: a, now: o, labels: l, icons: u, iconResolver: p, classes: m, locale: h, snooze: g }) {
|
|
4091
4100
|
let _ = c(), v = (e) => Z(l[e]), y = t.filter((e) => n.includes(e.id)), b = y.length === t.length, x = d(null), [S, C] = f(null);
|
|
4092
4101
|
S !== null && y.length === 0 && C(null), s(() => {
|
|
4093
4102
|
S && x.current?.querySelector("button")?.focus();
|
|
@@ -4099,9 +4108,9 @@ function Ha({ component: e, items: t, selected: n, onSelectedChange: r, filter:
|
|
|
4099
4108
|
role: "group",
|
|
4100
4109
|
"aria-label": v("selection"),
|
|
4101
4110
|
"data-inbox-selection": "",
|
|
4102
|
-
className:
|
|
4111
|
+
className: ji,
|
|
4103
4112
|
children: [/* @__PURE__ */ O("div", {
|
|
4104
|
-
className:
|
|
4113
|
+
className: Mi,
|
|
4105
4114
|
children: [/* @__PURE__ */ D("input", {
|
|
4106
4115
|
type: "checkbox",
|
|
4107
4116
|
"data-inbox-select-all": "",
|
|
@@ -4110,23 +4119,23 @@ function Ha({ component: e, items: t, selected: n, onSelectedChange: r, filter:
|
|
|
4110
4119
|
},
|
|
4111
4120
|
checked: b,
|
|
4112
4121
|
"aria-label": v("selectAll"),
|
|
4113
|
-
className:
|
|
4122
|
+
className: Ni,
|
|
4114
4123
|
onChange: () => r(b ? [] : t.map((e) => e.id))
|
|
4115
4124
|
}), /* @__PURE__ */ D("span", {
|
|
4116
4125
|
"aria-live": "polite",
|
|
4117
4126
|
children: Z(l.selected, { count: y.length })
|
|
4118
4127
|
})]
|
|
4119
4128
|
}), /* @__PURE__ */ O("div", {
|
|
4120
|
-
className:
|
|
4121
|
-
children: [
|
|
4129
|
+
className: mi,
|
|
4130
|
+
children: [_a(i, a).map((t) => /* @__PURE__ */ D("button", {
|
|
4122
4131
|
type: "button",
|
|
4123
4132
|
"data-inbox-batch": t.action,
|
|
4124
4133
|
"aria-label": v(t.label),
|
|
4125
4134
|
title: v(t.label),
|
|
4126
4135
|
"aria-expanded": t.action === "snooze" ? S !== null : void 0,
|
|
4127
4136
|
"aria-controls": t.action === "snooze" && S ? _ : void 0,
|
|
4128
|
-
className: G(
|
|
4129
|
-
onClick: () => t.action === "snooze" ? C(S ? null :
|
|
4137
|
+
className: G(Pi, m.control),
|
|
4138
|
+
onClick: () => t.action === "snooze" ? C(S ? null : va(g, l)) : w(t.action),
|
|
4130
4139
|
children: /* @__PURE__ */ D($, {
|
|
4131
4140
|
name: t.icon,
|
|
4132
4141
|
context: {
|
|
@@ -4143,7 +4152,7 @@ function Ha({ component: e, items: t, selected: n, onSelectedChange: r, filter:
|
|
|
4143
4152
|
"data-inbox-clear-selection": "",
|
|
4144
4153
|
"aria-label": v("clearSelection"),
|
|
4145
4154
|
title: v("clearSelection"),
|
|
4146
|
-
className: G(
|
|
4155
|
+
className: G(Pi, m.control),
|
|
4147
4156
|
onClick: () => r([]),
|
|
4148
4157
|
children: /* @__PURE__ */ D($, {
|
|
4149
4158
|
name: "dismiss",
|
|
@@ -4176,29 +4185,29 @@ function Ha({ component: e, items: t, selected: n, onSelectedChange: r, filter:
|
|
|
4176
4185
|
" ",
|
|
4177
4186
|
/* @__PURE__ */ D("span", {
|
|
4178
4187
|
className: "text-iui-inbox-muted-foreground font-normal",
|
|
4179
|
-
children:
|
|
4188
|
+
children: ut(e.until, o, h)
|
|
4180
4189
|
})
|
|
4181
4190
|
]
|
|
4182
4191
|
}, e.label))
|
|
4183
4192
|
})] });
|
|
4184
4193
|
}
|
|
4185
4194
|
// src/NotificationCenter.tsx
|
|
4186
|
-
var
|
|
4187
|
-
function
|
|
4195
|
+
var Wa = () => () => {};
|
|
4196
|
+
function Ga({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o = 99, href: s, icons: u = {}, iconResolver: m, classes: h = {}, locale: g, renderItem: _, renderEmpty: v, group: y = !0, snooze: b, placement: x = "bottom-end", open: S, onOpenChange: C, onItemClick: w, onAction: T, renderTrigger: k, renderBadge: A, renderHeader: j, renderTab: M, renderLoading: N, renderError: P, renderFooter: F }) {
|
|
4188
4197
|
let { props: I } = a(), L = c(), R = {
|
|
4189
4198
|
panel: `${L}-panel`,
|
|
4190
4199
|
title: `${L}-title`,
|
|
4191
4200
|
list: `${L}-list`,
|
|
4192
4201
|
tab: (e) => `${L}-tab-${e}`
|
|
4193
|
-
}, z = p(X.subscribe, X.getSnapshot, X.getServerSnapshot), [B, ee] = f(!1), [V] = f(Date.now), te = p(B ?
|
|
4202
|
+
}, z = p(X.subscribe, X.getSnapshot, X.getServerSnapshot), [B, ee] = f(!1), [V] = f(Date.now), te = p(B ? bt.subscribe : Wa, bt.getSnapshot, () => V), H = Tt(e), ne = (e) => Z(H[e]), U = z.counts[i], re = oa(z.filter, H), ie = ia(z), ae = z.categoryFilter, [oe, se] = f([]), W = ca(z.items, oe), ce = ct(W, y), le = ie.length > 1, ue = d(null), K = d(null), de = d(null), q = d(null), fe = d(null), pe = d(null), me = d(ie), he = d(ae), ge = d(x), J = d(C);
|
|
4194
4203
|
l(() => {
|
|
4195
|
-
|
|
4196
|
-
let e, t = !1, n =
|
|
4204
|
+
qi(), _t(I);
|
|
4205
|
+
let e, t = !1, n = ja(K.current), i = ba(q.current, se, {
|
|
4197
4206
|
scroller: q.current,
|
|
4198
4207
|
listed: (e) => X.getSnapshot().items.some((t) => t.id === e)
|
|
4199
4208
|
});
|
|
4200
4209
|
fe.current = i;
|
|
4201
|
-
let a =
|
|
4210
|
+
let a = Ca(q.current, () => X.getSnapshot().items), o = Da(ue.current, K.current, {
|
|
4202
4211
|
onToggle(n) {
|
|
4203
4212
|
ee(n), t = n, J.current?.(n), n ? (e = window.location.href, X.opened(me.current, {
|
|
4204
4213
|
markAllAsSeen: !1,
|
|
@@ -4222,8 +4231,8 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4222
4231
|
]), l(() => {
|
|
4223
4232
|
J.current = C, me.current = ie, he.current = ae;
|
|
4224
4233
|
}), l(() => {
|
|
4225
|
-
let e =
|
|
4226
|
-
S === !0 && !e ?
|
|
4234
|
+
let e = K.current?.matches(":popover-open") ?? !1;
|
|
4235
|
+
S === !0 && !e ? K.current?.showPopover() : S === !1 && e && pe.current?.close();
|
|
4227
4236
|
}, [S]), l(() => {
|
|
4228
4237
|
ge.current = x, pe.current?.place();
|
|
4229
4238
|
}, [x]), l(() => {
|
|
@@ -4236,8 +4245,8 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4236
4245
|
xe !== ve && (Se(ve), be([]));
|
|
4237
4246
|
let Ce = W.some((e) => ye.includes(e.id));
|
|
4238
4247
|
l(() => fe.current?.release(), [ve]);
|
|
4239
|
-
let we = (e, t) => be((n) =>
|
|
4240
|
-
let t =
|
|
4248
|
+
let we = (e, t) => be((n) => ya(n, e, t)), Te = (e) => {
|
|
4249
|
+
let t = wa(e.nativeEvent, z.items);
|
|
4241
4250
|
t?.action ? T?.(t.item, t.action, e) : t && w?.(t.item, e);
|
|
4242
4251
|
}, Ee = (e) => /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("p", {
|
|
4243
4252
|
role: "alert",
|
|
@@ -4245,13 +4254,13 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4245
4254
|
}), /* @__PURE__ */ D("button", {
|
|
4246
4255
|
type: "button",
|
|
4247
4256
|
"data-inbox-retry": "",
|
|
4248
|
-
className:
|
|
4257
|
+
className: ki,
|
|
4249
4258
|
onClick: e,
|
|
4250
4259
|
children: ne("retry")
|
|
4251
|
-
})] }), De =
|
|
4260
|
+
})] }), De = la(z, W.length), Oe;
|
|
4252
4261
|
return Oe = De === "loading" ? /* @__PURE__ */ D("div", {
|
|
4253
4262
|
role: "status",
|
|
4254
|
-
className:
|
|
4263
|
+
className: Fi,
|
|
4255
4264
|
children: N ? N() : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D($, {
|
|
4256
4265
|
name: "spinner",
|
|
4257
4266
|
context: {
|
|
@@ -4260,21 +4269,21 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4260
4269
|
},
|
|
4261
4270
|
icons: u,
|
|
4262
4271
|
resolver: m,
|
|
4263
|
-
className: G(
|
|
4272
|
+
className: G(Ii, "motion-safe:animate-spin")
|
|
4264
4273
|
}), /* @__PURE__ */ D("span", {
|
|
4265
4274
|
className: "sr-only",
|
|
4266
4275
|
children: ne("loading")
|
|
4267
4276
|
})] })
|
|
4268
4277
|
}) : De === "error" ? /* @__PURE__ */ D("div", {
|
|
4269
4278
|
"data-inbox-error": "",
|
|
4270
|
-
className:
|
|
4279
|
+
className: Fi,
|
|
4271
4280
|
children: (P ?? (({ retry: e }) => Ee(e)))({
|
|
4272
4281
|
more: !1,
|
|
4273
4282
|
retry: () => void X.load()
|
|
4274
4283
|
})
|
|
4275
4284
|
}) : De === "empty" ? /* @__PURE__ */ D("div", {
|
|
4276
4285
|
"data-inbox-empty": "",
|
|
4277
|
-
className:
|
|
4286
|
+
className: Fi,
|
|
4278
4287
|
children: v ? v(z.filter) : /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D($, {
|
|
4279
4288
|
name: "empty",
|
|
4280
4289
|
context: {
|
|
@@ -4284,14 +4293,14 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4284
4293
|
},
|
|
4285
4294
|
icons: u,
|
|
4286
4295
|
resolver: m,
|
|
4287
|
-
className:
|
|
4296
|
+
className: Ii
|
|
4288
4297
|
}), /* @__PURE__ */ D("p", { children: re })] })
|
|
4289
4298
|
}) : /* @__PURE__ */ O(E, { children: [
|
|
4290
4299
|
/* @__PURE__ */ D("ul", {
|
|
4291
4300
|
role: "list",
|
|
4292
4301
|
"data-inbox-selecting": Ce || void 0,
|
|
4293
|
-
className: G(
|
|
4294
|
-
children: ce.map((e) => /* @__PURE__ */ D(
|
|
4302
|
+
className: G(yi, h.list),
|
|
4303
|
+
children: ce.map((e) => /* @__PURE__ */ D(Ha, {
|
|
4295
4304
|
group: e,
|
|
4296
4305
|
now: te,
|
|
4297
4306
|
labels: H,
|
|
@@ -4334,16 +4343,16 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4334
4343
|
"data-inbox": "",
|
|
4335
4344
|
className: "inline-flex",
|
|
4336
4345
|
children: [/* @__PURE__ */ D("button", {
|
|
4337
|
-
ref:
|
|
4346
|
+
ref: ue,
|
|
4338
4347
|
type: "button",
|
|
4339
4348
|
popoverTarget: R.panel,
|
|
4340
4349
|
"aria-haspopup": "dialog",
|
|
4341
4350
|
"aria-expanded": B,
|
|
4342
4351
|
"aria-controls": R.panel,
|
|
4343
|
-
"aria-label":
|
|
4352
|
+
"aria-label": Ma(H, U, o, g, z.pausedUntil !== null),
|
|
4344
4353
|
"data-inbox-bell": "",
|
|
4345
4354
|
"data-paused": z.pausedUntil === null ? void 0 : "true",
|
|
4346
|
-
className: G(
|
|
4355
|
+
className: G(di, h.bell),
|
|
4347
4356
|
children: k ? k({
|
|
4348
4357
|
open: B,
|
|
4349
4358
|
count: U,
|
|
@@ -4361,13 +4370,13 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4361
4370
|
}),
|
|
4362
4371
|
n !== "none" && U > 0 && A && A({
|
|
4363
4372
|
count: U,
|
|
4364
|
-
text:
|
|
4373
|
+
text: St(U, o, g)
|
|
4365
4374
|
}),
|
|
4366
4375
|
n === "count" && U > 0 && !A && /* @__PURE__ */ D("span", {
|
|
4367
4376
|
"data-inbox-badge": "",
|
|
4368
4377
|
"aria-hidden": "true",
|
|
4369
4378
|
className: G("bg-iui-inbox-badge text-iui-inbox-badge-foreground absolute -inset-e-0.5 -top-0.5 flex h-4.5 min-w-4.5 items-center justify-center rounded-full px-1 text-[0.6875rem] leading-none font-semibold tabular-nums", h.badge),
|
|
4370
|
-
children:
|
|
4379
|
+
children: St(U, o, g)
|
|
4371
4380
|
}),
|
|
4372
4381
|
n === "dot" && U > 0 && !A && /* @__PURE__ */ D("span", {
|
|
4373
4382
|
"data-inbox-badge": "",
|
|
@@ -4377,19 +4386,19 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4377
4386
|
] })
|
|
4378
4387
|
}), /* @__PURE__ */ D("div", {
|
|
4379
4388
|
id: R.panel,
|
|
4380
|
-
ref:
|
|
4389
|
+
ref: K,
|
|
4381
4390
|
popover: "auto",
|
|
4382
4391
|
role: "dialog",
|
|
4383
4392
|
"aria-labelledby": R.title,
|
|
4384
4393
|
tabIndex: -1,
|
|
4385
4394
|
"data-inbox-panel": "",
|
|
4386
|
-
className: G(
|
|
4387
|
-
onKeyDown: (e) =>
|
|
4395
|
+
className: G(fi, h.panel),
|
|
4396
|
+
onKeyDown: (e) => Aa(e.nativeEvent, K.current),
|
|
4388
4397
|
onClickCapture: Te,
|
|
4389
4398
|
children: /* @__PURE__ */ O("div", {
|
|
4390
|
-
className:
|
|
4399
|
+
className: pi,
|
|
4391
4400
|
children: [
|
|
4392
|
-
/* @__PURE__ */ D(
|
|
4401
|
+
/* @__PURE__ */ D(za, {
|
|
4393
4402
|
component: "NotificationCenter",
|
|
4394
4403
|
state: z,
|
|
4395
4404
|
filter: z.filter,
|
|
@@ -4420,10 +4429,10 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4420
4429
|
role: le ? "tabpanel" : void 0,
|
|
4421
4430
|
"aria-labelledby": le ? R.tab(z.filter) : void 0,
|
|
4422
4431
|
"aria-busy": z.status === "loading" || z.loadingMore || void 0,
|
|
4423
|
-
className:
|
|
4432
|
+
className: _i,
|
|
4424
4433
|
children: [/* @__PURE__ */ D("div", {
|
|
4425
4434
|
"aria-live": "polite",
|
|
4426
|
-
className:
|
|
4435
|
+
className: vi,
|
|
4427
4436
|
children: oe.length > 0 && /* @__PURE__ */ D("button", {
|
|
4428
4437
|
type: "button",
|
|
4429
4438
|
"data-inbox-show-new": "",
|
|
@@ -4433,7 +4442,7 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4433
4442
|
})
|
|
4434
4443
|
}), Oe]
|
|
4435
4444
|
}),
|
|
4436
|
-
/* @__PURE__ */ D(
|
|
4445
|
+
/* @__PURE__ */ D(Ua, {
|
|
4437
4446
|
component: "NotificationCenter",
|
|
4438
4447
|
items: W,
|
|
4439
4448
|
selected: ye,
|
|
@@ -4463,13 +4472,13 @@ function Wa({ labels: e, badge: n = "count", count: i = "unseen", maxCount: o =
|
|
|
4463
4472
|
});
|
|
4464
4473
|
}
|
|
4465
4474
|
// src/NotificationList.tsx
|
|
4466
|
-
function
|
|
4467
|
-
let A = a(), j = p(X.subscribe, X.getSnapshot, X.getServerSnapshot), [M] = f(Date.now), N = p(
|
|
4475
|
+
function Ka({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, classes: s = {}, locale: c, buffer: m = 250, manual: h = !1, preserveUrl: g = !1, renderItem: _, renderEmpty: v, category: y, group: b = !0, snooze: x, maxCount: S = 99, renderHeader: C, renderTab: w, onItemClick: T, onAction: k }) {
|
|
4476
|
+
let A = a(), j = p(X.subscribe, X.getSnapshot, X.getServerSnapshot), [M] = f(Date.now), N = p(bt.subscribe, bt.getSnapshot, () => M), { filter: P, category: F } = ma(A.url, j, n, y), I = Tt(r), L = oa(P, I), R = d(null), z = A.props[t]?.data, B = u(() => Array.isArray(z) ? z.map(We).filter((e) => e !== void 0) : [], [z]), ee = u(() => st(X, B, P, F), [
|
|
4468
4477
|
B,
|
|
4469
4478
|
P,
|
|
4470
4479
|
F,
|
|
4471
4480
|
j
|
|
4472
|
-
]), [V, te] = f([]), H =
|
|
4481
|
+
]), [V, te] = f([]), H = ca(ee, V), ne = ct(H, b), U = !!A.scrollProps?.[t]?.nextPage, re = d(null), ie = d(H), ae = d({
|
|
4473
4482
|
loaded: B,
|
|
4474
4483
|
filter: P,
|
|
4475
4484
|
category: F
|
|
@@ -4481,17 +4490,17 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4481
4490
|
category: F
|
|
4482
4491
|
};
|
|
4483
4492
|
});
|
|
4484
|
-
let oe = (e, n) =>
|
|
4485
|
-
le !== se && (
|
|
4486
|
-
let
|
|
4493
|
+
let oe = (e, n) => pa(A.url, e, n, A.scrollProps?.[t]?.pageName), se = `${P}|${F}|${j.selectable}`, [W, ce] = f([]), [le, ue] = f(se);
|
|
4494
|
+
le !== se && (ue(se), ce([]));
|
|
4495
|
+
let K = H.some((e) => W.includes(e.id));
|
|
4487
4496
|
l(() => re.current?.release(), [se]);
|
|
4488
|
-
let de = (e, t) => ce((n) =>
|
|
4497
|
+
let de = (e, t) => ce((n) => ya(n, e, t));
|
|
4489
4498
|
return l(() => {
|
|
4490
|
-
|
|
4491
|
-
}, []), l(() => X.remember(B), [B]), l(() =>
|
|
4492
|
-
let e =
|
|
4499
|
+
qi(), _t(A.props);
|
|
4500
|
+
}, []), l(() => X.remember(B), [B]), l(() => ja(R.current), []), l(() => {
|
|
4501
|
+
let e = ba(R.current, te, { listed: (e) => st(X, ae.current.loaded, ae.current.filter, ae.current.category).some((t) => t.id === e) });
|
|
4493
4502
|
re.current = e;
|
|
4494
|
-
let t =
|
|
4503
|
+
let t = Ca(R.current, () => ie.current, null);
|
|
4495
4504
|
return () => {
|
|
4496
4505
|
e.destroy(), t.destroy(), re.current = null;
|
|
4497
4506
|
};
|
|
@@ -4499,13 +4508,13 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4499
4508
|
ref: R,
|
|
4500
4509
|
"data-inbox-list": "",
|
|
4501
4510
|
tabIndex: -1,
|
|
4502
|
-
onKeyDown: (e) =>
|
|
4511
|
+
onKeyDown: (e) => Aa(e.nativeEvent, R.current),
|
|
4503
4512
|
onClickCapture: (e) => {
|
|
4504
|
-
let t =
|
|
4513
|
+
let t = wa(e.nativeEvent, H);
|
|
4505
4514
|
t?.action ? k?.(t.item, t.action, e) : t && T?.(t.item, e);
|
|
4506
4515
|
},
|
|
4507
4516
|
children: [
|
|
4508
|
-
/* @__PURE__ */ D(
|
|
4517
|
+
/* @__PURE__ */ D(za, {
|
|
4509
4518
|
component: "NotificationList",
|
|
4510
4519
|
state: j,
|
|
4511
4520
|
filter: P,
|
|
@@ -4524,7 +4533,7 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4524
4533
|
}),
|
|
4525
4534
|
/* @__PURE__ */ D("div", {
|
|
4526
4535
|
"aria-live": "polite",
|
|
4527
|
-
className:
|
|
4536
|
+
className: vi,
|
|
4528
4537
|
children: V.length > 0 && /* @__PURE__ */ D("button", {
|
|
4529
4538
|
type: "button",
|
|
4530
4539
|
"data-inbox-show-new": "",
|
|
@@ -4541,11 +4550,11 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4541
4550
|
as: "ul",
|
|
4542
4551
|
role: "list",
|
|
4543
4552
|
hidden: H.length === 0 || void 0,
|
|
4544
|
-
"data-inbox-selecting":
|
|
4545
|
-
className: G(
|
|
4553
|
+
"data-inbox-selecting": K || void 0,
|
|
4554
|
+
className: G(yi, s.list),
|
|
4546
4555
|
loading: /* @__PURE__ */ O("div", {
|
|
4547
4556
|
role: "status",
|
|
4548
|
-
className:
|
|
4557
|
+
className: Li,
|
|
4549
4558
|
children: [/* @__PURE__ */ D($, {
|
|
4550
4559
|
name: "spinner",
|
|
4551
4560
|
context: {
|
|
@@ -4554,7 +4563,7 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4554
4563
|
},
|
|
4555
4564
|
icons: i,
|
|
4556
4565
|
resolver: o,
|
|
4557
|
-
className:
|
|
4566
|
+
className: ci
|
|
4558
4567
|
}), /* @__PURE__ */ D("span", {
|
|
4559
4568
|
className: "sr-only",
|
|
4560
4569
|
children: Z(I.loading)
|
|
@@ -4571,7 +4580,7 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4571
4580
|
children: Z(I.loadMore)
|
|
4572
4581
|
})
|
|
4573
4582
|
}) : void 0,
|
|
4574
|
-
children: ne.map((e) => /* @__PURE__ */ D(
|
|
4583
|
+
children: ne.map((e) => /* @__PURE__ */ D(Ha, {
|
|
4575
4584
|
group: e,
|
|
4576
4585
|
now: N,
|
|
4577
4586
|
labels: I,
|
|
@@ -4602,9 +4611,9 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4602
4611
|
className: "text-iui-inbox-icon size-8"
|
|
4603
4612
|
}), /* @__PURE__ */ D("p", { children: L })] })
|
|
4604
4613
|
}),
|
|
4605
|
-
|
|
4614
|
+
K && /* @__PURE__ */ D("div", {
|
|
4606
4615
|
className: "bg-iui-inbox-surface sticky bottom-0 z-20",
|
|
4607
|
-
children: /* @__PURE__ */ D(
|
|
4616
|
+
children: /* @__PURE__ */ D(Ua, {
|
|
4608
4617
|
component: "NotificationList",
|
|
4609
4618
|
items: H,
|
|
4610
4619
|
selected: W,
|
|
@@ -4624,57 +4633,57 @@ function Ga({ data: t, filter: n, labels: r, icons: i = {}, iconResolver: o, cla
|
|
|
4624
4633
|
});
|
|
4625
4634
|
}
|
|
4626
4635
|
// src/usePreferences.ts
|
|
4627
|
-
var
|
|
4628
|
-
function
|
|
4629
|
-
let { props: e } = a(), t = p(
|
|
4636
|
+
var qa = () => kn.load(X.getSnapshot().url);
|
|
4637
|
+
function Ja() {
|
|
4638
|
+
let { props: e } = a(), t = p(kn.subscribe, kn.getSnapshot, () => qt), n = u(() => tn(t), [t]);
|
|
4630
4639
|
return l(() => {
|
|
4631
|
-
|
|
4640
|
+
qi(), _t(e), qa();
|
|
4632
4641
|
}, []), {
|
|
4633
4642
|
...t,
|
|
4634
4643
|
sections: n,
|
|
4635
|
-
load:
|
|
4636
|
-
set:
|
|
4637
|
-
setChannel:
|
|
4638
|
-
setFrequency:
|
|
4639
|
-
setNotificationHours:
|
|
4640
|
-
receives: (e, n) =>
|
|
4641
|
-
frequencyApplies:
|
|
4642
|
-
isDisabled: (e, n) =>
|
|
4644
|
+
load: qa,
|
|
4645
|
+
set: kn.set,
|
|
4646
|
+
setChannel: kn.setChannel,
|
|
4647
|
+
setFrequency: kn.setFrequency,
|
|
4648
|
+
setNotificationHours: kn.setNotificationHours,
|
|
4649
|
+
receives: (e, n) => an(e, n, t.channels),
|
|
4650
|
+
frequencyApplies: sn,
|
|
4651
|
+
isDisabled: (e, n) => on(e, n, t.channels)
|
|
4643
4652
|
};
|
|
4644
4653
|
}
|
|
4645
4654
|
// src/usePush.ts
|
|
4646
|
-
var
|
|
4647
|
-
function
|
|
4648
|
-
let { props: e } = a(), t = p(
|
|
4655
|
+
var Ya = () => Mn;
|
|
4656
|
+
function Xa() {
|
|
4657
|
+
let { props: e } = a(), t = p(Jn.subscribe, Jn.getSnapshot, Ya);
|
|
4649
4658
|
return l(() => {
|
|
4650
|
-
|
|
4659
|
+
qi(), _t(e);
|
|
4651
4660
|
}, []), {
|
|
4652
4661
|
...t,
|
|
4653
|
-
deviceState:
|
|
4654
|
-
subscribe:
|
|
4655
|
-
unsubscribe:
|
|
4656
|
-
loadDevices:
|
|
4657
|
-
removeDevice:
|
|
4662
|
+
deviceState: Nn(t),
|
|
4663
|
+
subscribe: Jn.enable,
|
|
4664
|
+
unsubscribe: Jn.disable,
|
|
4665
|
+
loadDevices: Jn.loadDevices,
|
|
4666
|
+
removeDevice: Jn.removeDevice
|
|
4658
4667
|
};
|
|
4659
4668
|
}
|
|
4660
4669
|
// src/NotificationPreferences.tsx
|
|
4661
|
-
function
|
|
4662
|
-
let { status: l, channels: u, categories: d, sections: m, notificationHours: h, frequencies: g, load: _, setChannel: v, setFrequency: y, setNotificationHours: b, receives: x, frequencyApplies: S, isDisabled: C } =
|
|
4670
|
+
function Za({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGroup: i, renderChannel: a, renderEmpty: o }) {
|
|
4671
|
+
let { status: l, channels: u, categories: d, sections: m, notificationHours: h, frequencies: g, load: _, setChannel: v, setFrequency: y, setNotificationHours: b, receives: x, frequencyApplies: S, isDisabled: C } = Ja(), w = Xa(), [T, k] = f(null), A = On(e), j = (e) => Z(A[e]), M = An(u, d, g, A), N = u.some((e) => e.push) ? Pn(w) : null, [P] = f(Date.now), F = p(bt.subscribe, bt.getSnapshot, () => P), I = Yn(w.devices, A, F, n), L = c(), R = N !== null;
|
|
4663
4672
|
s(() => {
|
|
4664
|
-
R &&
|
|
4673
|
+
R && Jn.loadDevices();
|
|
4665
4674
|
}, [R]);
|
|
4666
4675
|
let z = (e) => {
|
|
4667
|
-
let t =
|
|
4676
|
+
let t = vn(h, T, e);
|
|
4668
4677
|
t && (k(t.editing), b({ days: { [e.day]: t.ranges } }));
|
|
4669
4678
|
};
|
|
4670
4679
|
return l === "error" ? /* @__PURE__ */ D("div", {
|
|
4671
4680
|
"data-inbox-preferences": "",
|
|
4672
4681
|
children: /* @__PURE__ */ O("div", {
|
|
4673
4682
|
"data-inbox-preferences-error": "",
|
|
4674
|
-
className:
|
|
4683
|
+
className: Fi,
|
|
4675
4684
|
children: [/* @__PURE__ */ D("p", { children: j("error") }), /* @__PURE__ */ D("button", {
|
|
4676
4685
|
type: "button",
|
|
4677
|
-
className:
|
|
4686
|
+
className: ki,
|
|
4678
4687
|
onClick: () => void _(),
|
|
4679
4688
|
children: j("retry")
|
|
4680
4689
|
})]
|
|
@@ -4683,18 +4692,18 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4683
4692
|
"data-inbox-preferences": "",
|
|
4684
4693
|
children: l === "ready" ? /* @__PURE__ */ D("div", {
|
|
4685
4694
|
"data-inbox-preferences-empty": "",
|
|
4686
|
-
className:
|
|
4695
|
+
className: Fi,
|
|
4687
4696
|
children: o ? o() : /* @__PURE__ */ D("p", { children: j("empty") })
|
|
4688
4697
|
}) : /* @__PURE__ */ O("div", {
|
|
4689
4698
|
role: "status",
|
|
4690
|
-
className:
|
|
4699
|
+
className: Fi,
|
|
4691
4700
|
children: [/* @__PURE__ */ D($, {
|
|
4692
4701
|
name: "spinner",
|
|
4693
4702
|
context: {
|
|
4694
4703
|
component: "NotificationPreferences",
|
|
4695
4704
|
part: "loading"
|
|
4696
4705
|
},
|
|
4697
|
-
className:
|
|
4706
|
+
className: ci
|
|
4698
4707
|
}), /* @__PURE__ */ D("span", {
|
|
4699
4708
|
className: "sr-only",
|
|
4700
4709
|
children: j("loading")
|
|
@@ -4704,9 +4713,9 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4704
4713
|
"data-inbox-preferences": "",
|
|
4705
4714
|
children: [
|
|
4706
4715
|
/* @__PURE__ */ D("div", {
|
|
4707
|
-
className:
|
|
4716
|
+
className: Ri,
|
|
4708
4717
|
children: /* @__PURE__ */ O("table", {
|
|
4709
|
-
className: G(
|
|
4718
|
+
className: G(zi, t.table),
|
|
4710
4719
|
children: [
|
|
4711
4720
|
/* @__PURE__ */ D("caption", {
|
|
4712
4721
|
className: "sr-only",
|
|
@@ -4715,12 +4724,12 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4715
4724
|
/* @__PURE__ */ D("thead", { children: /* @__PURE__ */ O("tr", { children: [
|
|
4716
4725
|
/* @__PURE__ */ D("th", {
|
|
4717
4726
|
scope: "col",
|
|
4718
|
-
className: G(
|
|
4727
|
+
className: G(Bi, t.head),
|
|
4719
4728
|
children: j("category")
|
|
4720
4729
|
}),
|
|
4721
4730
|
u.map((e) => /* @__PURE__ */ D("th", {
|
|
4722
4731
|
scope: "col",
|
|
4723
|
-
className: G(
|
|
4732
|
+
className: G(Vi, t.head),
|
|
4724
4733
|
children: a ? a(e) : e.label
|
|
4725
4734
|
}, e.key)),
|
|
4726
4735
|
M.hasFrequencies && /* @__PURE__ */ D("th", {
|
|
@@ -4786,14 +4795,14 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4786
4795
|
})
|
|
4787
4796
|
}), e.categories.map((e) => /* @__PURE__ */ O("tr", {
|
|
4788
4797
|
"data-inbox-preference-category": e.key,
|
|
4789
|
-
className: G(
|
|
4798
|
+
className: G(Hi, t.row),
|
|
4790
4799
|
children: [
|
|
4791
4800
|
/* @__PURE__ */ D("th", {
|
|
4792
4801
|
scope: "row",
|
|
4793
|
-
className:
|
|
4802
|
+
className: Ui,
|
|
4794
4803
|
children: r ? r(e) : /* @__PURE__ */ O(E, { children: [
|
|
4795
4804
|
/* @__PURE__ */ D("span", {
|
|
4796
|
-
className: G(
|
|
4805
|
+
className: G(Wi, t.label),
|
|
4797
4806
|
children: e.label
|
|
4798
4807
|
}),
|
|
4799
4808
|
e.locked && /* @__PURE__ */ D("span", {
|
|
@@ -4807,7 +4816,7 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4807
4816
|
] })
|
|
4808
4817
|
}),
|
|
4809
4818
|
u.map((n) => /* @__PURE__ */ D("td", {
|
|
4810
|
-
className:
|
|
4819
|
+
className: Gi,
|
|
4811
4820
|
children: e.channels[n.key] !== void 0 && /* @__PURE__ */ D("button", {
|
|
4812
4821
|
type: "button",
|
|
4813
4822
|
role: "switch",
|
|
@@ -4819,7 +4828,7 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4819
4828
|
}),
|
|
4820
4829
|
"data-inbox-preference": `${e.key}.${n.key}`,
|
|
4821
4830
|
className: G("group/switch bg-iui-inbox-icon aria-checked:bg-iui-inbox-accent focus-visible:ring-iui-inbox-ring focus-visible:ring-offset-iui-inbox-surface relative inline-flex h-5 w-9 shrink-0 items-center rounded-full focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden aria-disabled:cursor-default aria-disabled:opacity-50 forced-colors:border motion-safe:transition-colors", t.switch),
|
|
4822
|
-
onClick: () =>
|
|
4831
|
+
onClick: () => jn(e, n, u),
|
|
4823
4832
|
children: /* @__PURE__ */ D("span", {
|
|
4824
4833
|
"aria-hidden": "true",
|
|
4825
4834
|
className: "bg-iui-inbox-surface ms-0.5 size-4 rounded-full shadow-sm forced-color-adjust-none group-aria-checked/switch:translate-x-4 forced-colors:bg-[ButtonText] forced-colors:group-aria-checked/switch:bg-[Highlight] motion-safe:transition-transform rtl:group-aria-checked/switch:-translate-x-4"
|
|
@@ -4875,7 +4884,7 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4875
4884
|
"aria-disabled": N.state === "busy" || void 0,
|
|
4876
4885
|
"data-inbox-push-device-button": "",
|
|
4877
4886
|
className: G(N.button.primary ? "rounded-md focus-visible:ring-iui-inbox-ring inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden aria-disabled:cursor-default aria-disabled:opacity-60 border-iui-inbox-accent text-iui-inbox-accent hover:bg-iui-inbox-accent-subtle border" : "rounded-md focus-visible:ring-iui-inbox-ring inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden aria-disabled:cursor-default aria-disabled:opacity-60 border-iui-inbox-border bg-iui-inbox-surface hover:bg-iui-inbox-control-hover border", "shrink-0 whitespace-nowrap"),
|
|
4878
|
-
onClick: () =>
|
|
4887
|
+
onClick: () => Xn(N),
|
|
4879
4888
|
children: [N.state === "busy" && /* @__PURE__ */ D($, {
|
|
4880
4889
|
name: "spinner",
|
|
4881
4890
|
context: {
|
|
@@ -4912,7 +4921,7 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4912
4921
|
"aria-label": e.removeLabel,
|
|
4913
4922
|
"data-inbox-push-other-device-remove": "",
|
|
4914
4923
|
className: G("rounded-md focus-visible:ring-iui-inbox-ring inline-flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium focus-visible:ring-2 focus-visible:outline-hidden aria-disabled:cursor-default aria-disabled:opacity-60 border-iui-inbox-border bg-iui-inbox-surface hover:bg-iui-inbox-control-hover border", "shrink-0 whitespace-nowrap"),
|
|
4915
|
-
onClick: () => void
|
|
4924
|
+
onClick: () => void Jn.removeDevice(e.id),
|
|
4916
4925
|
children: j("pushDeviceRemove")
|
|
4917
4926
|
})]
|
|
4918
4927
|
}, e.id))
|
|
@@ -4945,7 +4954,7 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
4945
4954
|
})] })]
|
|
4946
4955
|
}), /* @__PURE__ */ D("div", {
|
|
4947
4956
|
className: "mt-3 flex flex-col gap-3 sm:gap-2",
|
|
4948
|
-
children:
|
|
4957
|
+
children: _n(h, T, n).map(({ day: e, name: n, ranges: r, locked: i, canAdd: a }) => /* @__PURE__ */ O("div", {
|
|
4949
4958
|
role: "group",
|
|
4950
4959
|
"aria-label": n,
|
|
4951
4960
|
"data-inbox-notification-hours-day": e,
|
|
@@ -5066,33 +5075,33 @@ function Xa({ labels: e, classes: t = {}, locale: n, renderCategory: r, renderGr
|
|
|
5066
5075
|
});
|
|
5067
5076
|
}
|
|
5068
5077
|
// src/useNotifications.ts
|
|
5069
|
-
function
|
|
5078
|
+
function Qa() {
|
|
5070
5079
|
let { props: e } = a(), t = p(X.subscribe, X.getSnapshot, X.getServerSnapshot);
|
|
5071
5080
|
return l(() => {
|
|
5072
|
-
|
|
5081
|
+
qi(), _t(e);
|
|
5073
5082
|
}, []), {
|
|
5074
5083
|
...t,
|
|
5075
|
-
...
|
|
5076
|
-
toast:
|
|
5084
|
+
...gt,
|
|
5085
|
+
toast: Hr
|
|
5077
5086
|
};
|
|
5078
5087
|
}
|
|
5079
5088
|
// src/useToasts.ts
|
|
5080
|
-
var
|
|
5081
|
-
function
|
|
5082
|
-
let { flash: t } = a(), n = p(Q.subscribe, Q.getSnapshot, () =>
|
|
5083
|
-
p(Q.subscribe,
|
|
5084
|
-
let r = u(() => n.filter((t) => t.toaster === e), [n, e]), [i] = f(
|
|
5085
|
-
return l(() => Q.attach(e), [e]), l(() => (
|
|
5089
|
+
var $a = [], eo = (e, t, n) => n ? Ir(e, t, n.nativeEvent) : Fr(e, t);
|
|
5090
|
+
function to(e) {
|
|
5091
|
+
let { flash: t } = a(), n = p(Q.subscribe, Q.getSnapshot, () => $a);
|
|
5092
|
+
p(Q.subscribe, or, () => 0);
|
|
5093
|
+
let r = u(() => n.filter((t) => t.toaster === e), [n, e]), [i] = f(cr);
|
|
5094
|
+
return l(() => Q.attach(e), [e]), l(() => (qi(), gr(t), i.release), []), {
|
|
5086
5095
|
toasts: r,
|
|
5087
|
-
toast:
|
|
5096
|
+
toast: Hr,
|
|
5088
5097
|
update: Q.update,
|
|
5089
5098
|
dismiss: Q.dismiss,
|
|
5090
5099
|
pause: i.pause,
|
|
5091
5100
|
resume: i.resume,
|
|
5092
5101
|
timer: Q.timer,
|
|
5093
|
-
runAction:
|
|
5102
|
+
runAction: eo
|
|
5094
5103
|
};
|
|
5095
5104
|
}
|
|
5096
5105
|
// src/iconResolver.ts
|
|
5097
|
-
var
|
|
5098
|
-
export {
|
|
5106
|
+
var no = _e, ro = ve;
|
|
5107
|
+
export { xr as DEFAULT_ERROR_MESSAGES, wt as DEFAULT_INBOX_LABELS, En as DEFAULT_PREFERENCES_LABELS, Ga as NotificationCenter, Va as NotificationItem, Ka as NotificationList, Za as NotificationPreferences, ea as Toaster, ct as groupItems, X as inboxStore, qi as initNotifications, Re as isSnoozed, ft as pauseEnd, mt as pauseTime, kn as preferencesStore, xt as relativeTime, Vt as requestNotificationPermission, ro as resolveIcon, no as setIconResolver, Se as setTranslations, lt as snoozeOptions, Hr as toast, Te as trans, Qa as useNotifications, Ja as usePreferences, Xa as usePush, to as useToasts };
|