@cloudlet/toast 1.0.0-rc.3 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +84 -16
- package/README.md +7 -5
- package/dist/contracts/controller.d.ts +7 -2
- package/dist/contracts/controller.d.ts.map +1 -1
- package/dist/contracts/events.d.ts +1 -1
- package/dist/contracts/events.d.ts.map +1 -1
- package/dist/contracts/internal.d.ts +23 -0
- package/dist/contracts/internal.d.ts.map +1 -1
- package/dist/contracts/notifications.d.ts +38 -6
- package/dist/contracts/notifications.d.ts.map +1 -1
- package/dist/contracts/snapshots.d.ts +3 -1
- package/dist/contracts/snapshots.d.ts.map +1 -1
- package/dist/core/bridge.d.ts +5 -0
- package/dist/core/bridge.d.ts.map +1 -0
- package/dist/core/bridge.js +345 -0
- package/dist/core/bridge.js.map +1 -0
- package/dist/core/controller.d.ts +122 -3
- package/dist/core/controller.d.ts.map +1 -1
- package/dist/core/controller.js +400 -541
- package/dist/core/controller.js.map +1 -1
- package/dist/core/validation.d.ts.map +1 -1
- package/dist/core/validation.js +181 -89
- package/dist/core/validation.js.map +1 -1
- package/dist/react/announcer.d.ts.map +1 -1
- package/dist/react/announcer.js +29 -23
- package/dist/react/announcer.js.map +1 -1
- package/dist/react/bindings.d.ts +9 -0
- package/dist/react/bindings.d.ts.map +1 -1
- package/dist/react/bindings.js +32 -69
- package/dist/react/bindings.js.map +1 -1
- package/dist/react/card.d.ts +5 -3
- package/dist/react/card.d.ts.map +1 -1
- package/dist/react/card.js +146 -34
- package/dist/react/card.js.map +1 -1
- package/dist/react/generators.d.ts +2 -2
- package/dist/react/generators.js.map +1 -1
- package/dist/react/gestures.js.map +1 -1
- package/dist/react/host.d.ts.map +1 -1
- package/dist/react/host.js +9 -5
- package/dist/react/host.js.map +1 -1
- package/dist/react/motion.d.ts +3 -3
- package/dist/react/motion.js.map +1 -1
- package/dist/react/plan.d.ts +1 -1
- package/dist/react/plan.d.ts.map +1 -1
- package/dist/react/plan.js +1 -0
- package/dist/react/plan.js.map +1 -1
- package/dist/react/renderer.d.ts +7 -0
- package/dist/react/renderer.d.ts.map +1 -0
- package/dist/react/renderer.js +62 -0
- package/dist/react/renderer.js.map +1 -0
- package/dist/react.d.ts +7 -5
- package/dist/react.d.ts.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +4 -2
- package/src/contracts/controller.ts +7 -2
- package/src/contracts/events.ts +2 -1
- package/src/contracts/internal.ts +20 -0
- package/src/contracts/notifications.ts +45 -6
- package/src/contracts/snapshots.ts +3 -0
- package/src/core/bridge.ts +336 -0
- package/src/core/controller.ts +118 -271
- package/src/core/validation.ts +49 -4
- package/src/react/announcer.ts +9 -0
- package/src/react/bindings.tsx +28 -72
- package/src/react/card.tsx +92 -9
- package/src/react/generators.ts +2 -2
- package/src/react/gestures.ts +1 -1
- package/src/react/host.tsx +22 -7
- package/src/react/motion.ts +4 -4
- package/src/react/plan.ts +4 -3
- package/src/react/renderer.tsx +77 -0
- package/src/react.ts +7 -5
package/dist/core/controller.js
CHANGED
|
@@ -1,84 +1,89 @@
|
|
|
1
|
-
import { copyContent as e, patchContent as t,
|
|
2
|
-
|
|
3
|
-
var c = 600, l = Object.freeze, u = /* @__PURE__ */ new WeakSet(), ee = /* @__PURE__ */ new WeakMap(), d = 0, f = l([]), te = l({
|
|
1
|
+
import { copyContent as e, patchContent as t, validateContent as n, validateOptions as r, validatePatch as i, validateSpec as a, validateTrackOptions as o } from "./validation.js";
|
|
2
|
+
var s = Object.freeze, c = /* @__PURE__ */ new WeakSet(), l = /* @__PURE__ */ new WeakMap(), u = 0, d = s([]), f = s({
|
|
4
3
|
open: !1,
|
|
5
4
|
reason: null,
|
|
6
5
|
current: null
|
|
7
|
-
}), p =
|
|
6
|
+
}), p = s({
|
|
8
7
|
controller: null,
|
|
9
8
|
revision: 0,
|
|
10
9
|
disposed: !1,
|
|
11
|
-
notifications:
|
|
12
|
-
stack:
|
|
13
|
-
island:
|
|
14
|
-
overflow:
|
|
10
|
+
notifications: d,
|
|
11
|
+
stack: d,
|
|
12
|
+
island: f,
|
|
13
|
+
overflow: s({
|
|
15
14
|
count: 0,
|
|
16
15
|
pending: !1
|
|
17
16
|
})
|
|
18
|
-
}), m =
|
|
17
|
+
}), m = s({
|
|
19
18
|
...p,
|
|
20
19
|
presentation: null,
|
|
21
20
|
focusRequest: null,
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
forms: d,
|
|
22
|
+
announcements: s({
|
|
23
|
+
notifications: d,
|
|
24
24
|
overflowCount: 0
|
|
25
25
|
})
|
|
26
|
-
}), h =
|
|
26
|
+
}), h = s({ status: "idle" }), g = s({
|
|
27
|
+
form: null,
|
|
28
|
+
fields: s({})
|
|
29
|
+
}), _ = s({ status: "applied" }), v = s({ status: "unchanged" }), y = (e) => ({
|
|
27
30
|
status: "rejected",
|
|
28
31
|
reason: e
|
|
29
32
|
});
|
|
30
|
-
function
|
|
31
|
-
let t =
|
|
33
|
+
function b(e) {
|
|
34
|
+
let t = l.get(e);
|
|
32
35
|
if (!t) throw TypeError("Controller was not created by this Cloudlet package instance");
|
|
33
36
|
return t;
|
|
34
37
|
}
|
|
35
|
-
function
|
|
36
|
-
let b =
|
|
37
|
-
if (!
|
|
38
|
-
let x =
|
|
39
|
-
if (typeof
|
|
40
|
-
let S = `cloudlet-${++
|
|
38
|
+
function x(d, m) {
|
|
39
|
+
let b = r(d);
|
|
40
|
+
if (!m?.clock || typeof m.clock.now != "function" || typeof m.clock.schedule != "function") throw TypeError("Cloudlet requires a monotonic clock");
|
|
41
|
+
let x = m.clock;
|
|
42
|
+
if (typeof m.createCancellation != "function") throw TypeError("Cloudlet requires a cancellation source factory");
|
|
43
|
+
let S = `cloudlet-${++u}`, C = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set(), T = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map(), D = /* @__PURE__ */ new Set(), O = [], k = null, A = null, j = null, M = null, N = 0, ee = 0, P = 0, te = 0, F = null, I = null, L, R, z = null, B = null, ne = 0, V = 0, H = 0, U = !1, re = !1, ie = null, ae = 0, oe, se, W = () => `${S}:${++N}`, ce = () => [...C.values()].reverse(), le = () => ce()[0] ?? null, ue = (e) => {
|
|
41
44
|
let t = e.operation?.getSnapshot();
|
|
42
45
|
return !!t?.canRetry && t.status !== "fulfilled";
|
|
43
|
-
},
|
|
46
|
+
}, de = (e) => !!e.content.action || ue(e) || e.content.attention === "open", fe = (e) => {
|
|
44
47
|
let t = e.content.attention ?? "auto";
|
|
45
|
-
return t === "open" || t === "auto" && (
|
|
46
|
-
},
|
|
47
|
-
let t = e
|
|
48
|
+
return t === "open" || t === "auto" && (de(e) || !!e.content.description);
|
|
49
|
+
}, pe = (e) => {
|
|
50
|
+
let t = e.content.action;
|
|
51
|
+
return t?.kind === "form" ? (e.form?.action !== t && (e.form = {
|
|
52
|
+
action: t,
|
|
53
|
+
errors: g,
|
|
54
|
+
values: s(Object.fromEntries(t.fields.map((e) => [e.name, e.defaultValue ?? ""])))
|
|
55
|
+
}), e.form) : e.form = null;
|
|
56
|
+
}, me = (e) => {
|
|
57
|
+
let t = pe(e);
|
|
58
|
+
return !!t && t.action.fields.some((e) => t.values[e.name] !== (e.defaultValue ?? ""));
|
|
59
|
+
}, he = () => D.has("hover") || D.has("focus") || [...C.values()].some((e) => e.pauses.has("gesture")) || !!F && me(F.current), ge = (e) => {
|
|
60
|
+
let t = e === I;
|
|
48
61
|
return [
|
|
49
62
|
...t ? [] : ["inactive"],
|
|
50
63
|
...j === null ? ["no-host"] : [],
|
|
51
64
|
...t && !e.readable ? ["presentation-pending"] : [],
|
|
52
|
-
...t &&
|
|
65
|
+
...t && F && (F.reason === "user" || de(e)) ? ["island"] : [],
|
|
53
66
|
...e.action.status === "pending" ? ["action-pending"] : [],
|
|
67
|
+
...me(e) ? ["draft"] : [],
|
|
54
68
|
...D,
|
|
55
69
|
...e.pauses
|
|
56
70
|
];
|
|
57
|
-
},
|
|
58
|
-
if (
|
|
59
|
-
if (typeof e != "object" || !e || !
|
|
71
|
+
}, _e = (e) => {
|
|
72
|
+
if (U) return "disposed";
|
|
73
|
+
if (typeof e != "object" || !e || !c.has(e)) return "invalid-handle";
|
|
60
74
|
if (e.controller !== S) return "foreign-controller";
|
|
61
75
|
if (C.get(e.id)?.handle !== e) return "stale-handle";
|
|
62
|
-
}
|
|
63
|
-
function
|
|
76
|
+
};
|
|
77
|
+
function ve(e) {
|
|
64
78
|
return (t, ...n) => {
|
|
65
|
-
let r =
|
|
66
|
-
return r ?
|
|
79
|
+
let r = _e(t);
|
|
80
|
+
return r ? y(r) : e(C.get(t.id), ...n);
|
|
67
81
|
};
|
|
68
82
|
}
|
|
69
|
-
function xe(e) {
|
|
70
|
-
return W((t, ...n) => t === P ? e(t, ...n) : v("not-current"));
|
|
71
|
-
}
|
|
72
|
-
function Se(e) {
|
|
73
|
-
return W((t, n, ...r) => {
|
|
74
|
-
let i = t.operation;
|
|
75
|
-
return i ? i.getSnapshot().token === n ? e(i, ...r) : v("stale-operation-token") : v("no-operation");
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
83
|
function G(e) {
|
|
79
84
|
q([{
|
|
80
85
|
type: "diagnostic",
|
|
81
|
-
diagnostic:
|
|
86
|
+
diagnostic: s({ ...e })
|
|
82
87
|
}]);
|
|
83
88
|
}
|
|
84
89
|
function K(e, t, n, r) {
|
|
@@ -90,7 +95,7 @@ function b(f, y) {
|
|
|
90
95
|
...r ? { handle: r } : {}
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
|
-
function
|
|
98
|
+
function ye(e, t) {
|
|
94
99
|
for (let n of [...e]) if (e.has(n)) try {
|
|
95
100
|
n();
|
|
96
101
|
} catch (e) {
|
|
@@ -99,7 +104,7 @@ function b(f, y) {
|
|
|
99
104
|
}
|
|
100
105
|
function q(e, t = !1, n = x.now(), r = !1, i = !1) {
|
|
101
106
|
if (O.push(() => {
|
|
102
|
-
t &&
|
|
107
|
+
t && ye(w, "subscribe");
|
|
103
108
|
for (let t of e) {
|
|
104
109
|
if ("callback" in t) {
|
|
105
110
|
try {
|
|
@@ -109,10 +114,10 @@ function b(f, y) {
|
|
|
109
114
|
}
|
|
110
115
|
continue;
|
|
111
116
|
}
|
|
112
|
-
let e =
|
|
117
|
+
let e = s({
|
|
113
118
|
...t,
|
|
114
119
|
controller: S,
|
|
115
|
-
sequence: ++
|
|
120
|
+
sequence: ++te,
|
|
116
121
|
at: i ? x.now() : n
|
|
117
122
|
});
|
|
118
123
|
for (let t of [...T]) if (T.has(t)) try {
|
|
@@ -129,13 +134,13 @@ function b(f, y) {
|
|
|
129
134
|
for (let e of E.keys()) e.clear();
|
|
130
135
|
E.clear();
|
|
131
136
|
}
|
|
132
|
-
}), !
|
|
133
|
-
|
|
137
|
+
}), !re) {
|
|
138
|
+
re = !0;
|
|
134
139
|
try {
|
|
135
140
|
let e;
|
|
136
141
|
for (; e = O.shift();) e();
|
|
137
142
|
} finally {
|
|
138
|
-
|
|
143
|
+
re = !1;
|
|
139
144
|
}
|
|
140
145
|
}
|
|
141
146
|
}
|
|
@@ -144,132 +149,141 @@ function b(f, y) {
|
|
|
144
149
|
for (let t of C.values()) t.activeSince !== null && t.remaining !== null && (t.remaining = Math.max(0, t.remaining - Math.max(0, e - t.activeSince)), t.activeSince = e);
|
|
145
150
|
return e;
|
|
146
151
|
}
|
|
147
|
-
function
|
|
148
|
-
++
|
|
152
|
+
function be() {
|
|
153
|
+
++ae, ie?.(), ie = null;
|
|
149
154
|
}
|
|
150
|
-
function
|
|
151
|
-
|
|
155
|
+
function xe(e) {
|
|
156
|
+
be();
|
|
152
157
|
let t = Infinity;
|
|
153
158
|
for (let n of C.values()) {
|
|
154
|
-
let r = n.remaining !== null &&
|
|
159
|
+
let r = n.remaining !== null && ge(n).length === 0 && !U;
|
|
155
160
|
n.activeSince = r ? e : null, r && (t = Math.min(t, e + n.remaining));
|
|
156
161
|
}
|
|
157
162
|
if (!Number.isFinite(t)) return;
|
|
158
|
-
let n =
|
|
159
|
-
|
|
160
|
-
if (
|
|
163
|
+
let n = ae;
|
|
164
|
+
ie = x.schedule(t, () => {
|
|
165
|
+
if (U || n !== ae) return;
|
|
161
166
|
let e = J(), t = [...C.values()].filter((e) => e.activeSince !== null && e.remaining === 0), r = [];
|
|
162
|
-
for (let e of t)
|
|
163
|
-
t.length ? Y(r, e) :
|
|
167
|
+
for (let e of t) $(e, "timeout", r);
|
|
168
|
+
t.length ? Y(r, e) : xe(e);
|
|
164
169
|
});
|
|
165
170
|
}
|
|
166
|
-
function
|
|
167
|
-
let e = [...C.values()], t =
|
|
171
|
+
function Se() {
|
|
172
|
+
let e = [...C.values()], t = s(e.map((e) => s({
|
|
168
173
|
handle: e.handle,
|
|
169
174
|
kind: e.kind,
|
|
170
175
|
content: e.content,
|
|
171
176
|
priority: e.priority,
|
|
172
177
|
occurrences: e.occurrences,
|
|
173
|
-
location: e ===
|
|
178
|
+
location: e === I ? "current" : "stack",
|
|
174
179
|
remainingMs: e.remaining,
|
|
175
|
-
pauseReasons:
|
|
180
|
+
pauseReasons: s(ge(e)),
|
|
176
181
|
operation: e.operation?.getSnapshot() ?? null,
|
|
177
|
-
action: e.action
|
|
182
|
+
action: e.action,
|
|
183
|
+
draft: me(e)
|
|
178
184
|
})));
|
|
179
|
-
|
|
185
|
+
oe = s({
|
|
180
186
|
controller: S,
|
|
181
|
-
revision:
|
|
182
|
-
disposed:
|
|
187
|
+
revision: P,
|
|
188
|
+
disposed: U,
|
|
183
189
|
notifications: t,
|
|
184
|
-
stack:
|
|
185
|
-
island:
|
|
190
|
+
stack: s(ce().map((e) => e.handle)),
|
|
191
|
+
island: F ? s({
|
|
186
192
|
open: !0,
|
|
187
|
-
reason:
|
|
188
|
-
current:
|
|
189
|
-
}) :
|
|
190
|
-
overflow:
|
|
191
|
-
count:
|
|
192
|
-
pending:
|
|
193
|
+
reason: F.reason,
|
|
194
|
+
current: F.current.handle
|
|
195
|
+
}) : f,
|
|
196
|
+
overflow: s({
|
|
197
|
+
count: V,
|
|
198
|
+
pending: V > 0
|
|
193
199
|
})
|
|
194
|
-
}),
|
|
195
|
-
...
|
|
196
|
-
presentation:
|
|
197
|
-
handle:
|
|
198
|
-
token:
|
|
199
|
-
readable:
|
|
200
|
+
}), se = s({
|
|
201
|
+
...oe,
|
|
202
|
+
presentation: I ? s({
|
|
203
|
+
handle: I.handle,
|
|
204
|
+
token: I.presentation,
|
|
205
|
+
readable: I.readable
|
|
200
206
|
}) : null,
|
|
201
207
|
focusRequest: A,
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
forms: s(e.flatMap((e) => {
|
|
209
|
+
let t = pe(e);
|
|
210
|
+
return t ? [s({
|
|
211
|
+
handle: e.handle,
|
|
212
|
+
values: t.values,
|
|
213
|
+
errors: t.errors
|
|
214
|
+
})] : [];
|
|
215
|
+
})),
|
|
216
|
+
announcements: s({
|
|
217
|
+
overflowCount: H,
|
|
218
|
+
notifications: s(e.map((e) => s({
|
|
205
219
|
handle: e.handle,
|
|
206
220
|
queued: e.queuedAnnounced,
|
|
207
221
|
firstPresentation: e.firstAnnounced,
|
|
208
222
|
occurrences: e.occurrencesAnnounced,
|
|
209
223
|
action: e.actionAnnounced ?? null,
|
|
210
|
-
operation: e.operation ?
|
|
224
|
+
operation: e.operation ? s({
|
|
211
225
|
token: e.operation.getSnapshot().token,
|
|
212
|
-
phases:
|
|
226
|
+
phases: s([...e.operationAnnounced])
|
|
213
227
|
}) : null
|
|
214
228
|
})))
|
|
215
229
|
})
|
|
216
230
|
});
|
|
217
231
|
}
|
|
218
232
|
function Y(e = [], t = x.now(), n = !1) {
|
|
219
|
-
|
|
233
|
+
Te(), xe(t), Oe(t), ++P, Se(), q(e, !0, t, n);
|
|
220
234
|
}
|
|
221
235
|
function X(e, t = !1) {
|
|
222
236
|
let n = J(), r = [];
|
|
223
|
-
return e(r), Y(r, n, t),
|
|
237
|
+
return e(r), Y(r, n, t), _;
|
|
224
238
|
}
|
|
225
|
-
function
|
|
226
|
-
e.readable = !1, e.presentation = j === null ? null :
|
|
239
|
+
function Ce(e) {
|
|
240
|
+
e.readable = !1, e.presentation = j === null ? null : W();
|
|
227
241
|
}
|
|
228
|
-
function
|
|
242
|
+
function we(e) {
|
|
229
243
|
e.presentation = null, e.readable = !1, e.pauses.clear(), k === e.handle && (k = null), A?.target.kind === "notification" && A.target.handle === e.handle && (A = null);
|
|
230
244
|
}
|
|
231
|
-
function
|
|
232
|
-
let e =
|
|
233
|
-
e !==
|
|
245
|
+
function Te() {
|
|
246
|
+
let e = F ? F.current : le();
|
|
247
|
+
e !== I && (I && we(I), I = e, e && Ce(e));
|
|
234
248
|
}
|
|
235
|
-
function
|
|
236
|
-
++
|
|
249
|
+
function Ee() {
|
|
250
|
+
++ne, B?.(), B = null;
|
|
237
251
|
}
|
|
238
|
-
function
|
|
239
|
-
|
|
252
|
+
function De(e, t) {
|
|
253
|
+
fe(e) && (z = {
|
|
240
254
|
record: e,
|
|
241
|
-
due: t + (
|
|
255
|
+
due: t + (L ?? b.attentionDelay ?? 600),
|
|
242
256
|
waiting: !1
|
|
243
257
|
});
|
|
244
258
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
247
|
-
let t =
|
|
248
|
-
if (!t ||
|
|
259
|
+
function Oe(e) {
|
|
260
|
+
Ee();
|
|
261
|
+
let t = z;
|
|
262
|
+
if (!t || U) return;
|
|
249
263
|
if (j === null) {
|
|
250
264
|
t.waiting = !0;
|
|
251
265
|
return;
|
|
252
266
|
}
|
|
253
267
|
if (t.waiting) {
|
|
254
|
-
if (
|
|
255
|
-
t.waiting = !1, t.due = e + (
|
|
268
|
+
if (he()) return;
|
|
269
|
+
t.waiting = !1, t.due = e + (L ?? b.attentionDelay ?? 600);
|
|
256
270
|
}
|
|
257
|
-
let n =
|
|
258
|
-
|
|
259
|
-
if (
|
|
271
|
+
let n = ne;
|
|
272
|
+
B = x.schedule(t.due, () => {
|
|
273
|
+
if (U || n !== ne || z !== t) return;
|
|
260
274
|
let e = x.now();
|
|
261
275
|
if (e < t.due) {
|
|
262
|
-
|
|
276
|
+
Oe(e);
|
|
263
277
|
return;
|
|
264
278
|
}
|
|
265
|
-
if (
|
|
279
|
+
if (B = null, he()) {
|
|
266
280
|
t.waiting = !0;
|
|
267
281
|
return;
|
|
268
282
|
}
|
|
269
|
-
|
|
283
|
+
z = null;
|
|
270
284
|
let r = t.record;
|
|
271
|
-
|
|
272
|
-
|
|
285
|
+
fe(r) && F?.current !== r && X(() => {
|
|
286
|
+
F ? F.current = r : F = {
|
|
273
287
|
reason: "attention",
|
|
274
288
|
current: r
|
|
275
289
|
};
|
|
@@ -277,24 +291,24 @@ function b(f, y) {
|
|
|
277
291
|
});
|
|
278
292
|
}
|
|
279
293
|
let Z = (e) => (e ?? b.autoDismiss) !== !1;
|
|
280
|
-
function
|
|
281
|
-
let t = Z(e) !== Z(
|
|
282
|
-
if (
|
|
294
|
+
function ke(e) {
|
|
295
|
+
let t = Z(e) !== Z(R);
|
|
296
|
+
if (R = e, t) for (let e of C.values()) e.remaining = Q(e);
|
|
283
297
|
}
|
|
284
298
|
function Q(e) {
|
|
285
|
-
return Z(
|
|
299
|
+
return Z(R) ? e.content.duration === void 0 ? (e.kind === "info" || e.kind === "success") && !e.content.action ? 6e3 : null : e.content.duration : null;
|
|
286
300
|
}
|
|
287
|
-
function
|
|
288
|
-
if (
|
|
289
|
-
let t =
|
|
290
|
-
r ?
|
|
301
|
+
function $(e, t, n) {
|
|
302
|
+
if (F?.current === e) {
|
|
303
|
+
let t = ce(), n = t.indexOf(e), r = t[n + 1] ?? t[n - 1];
|
|
304
|
+
r ? F.current = r : F = null;
|
|
291
305
|
}
|
|
292
|
-
if (
|
|
306
|
+
if (z?.record === e && (z = null), C.delete(e.handle.id), e.operation && n.push(e.operation.detach()), n.push({
|
|
293
307
|
type: "closed",
|
|
294
308
|
handle: e.handle,
|
|
295
309
|
reason: t
|
|
296
310
|
}), e.onClose) {
|
|
297
|
-
let r = e.onClose, i =
|
|
311
|
+
let r = e.onClose, i = s({
|
|
298
312
|
handle: e.handle,
|
|
299
313
|
reason: t
|
|
300
314
|
});
|
|
@@ -305,35 +319,35 @@ function b(f, y) {
|
|
|
305
319
|
});
|
|
306
320
|
}
|
|
307
321
|
}
|
|
308
|
-
let
|
|
309
|
-
function
|
|
310
|
-
return
|
|
322
|
+
let Ae = ve((e, t) => X((n) => $(e, t, n)));
|
|
323
|
+
function je() {
|
|
324
|
+
return U ? y("disposed") : V ? X((e) => {
|
|
311
325
|
e.push({
|
|
312
326
|
type: "overflow-acknowledged",
|
|
313
|
-
count:
|
|
314
|
-
}),
|
|
315
|
-
}) :
|
|
327
|
+
count: V
|
|
328
|
+
}), V = H = 0, A?.target.kind === "overflow" && (A = null);
|
|
329
|
+
}) : v;
|
|
316
330
|
}
|
|
317
|
-
function
|
|
331
|
+
function Me(e, t) {
|
|
318
332
|
if (typeof t != "function") throw TypeError("Listener must be a function");
|
|
319
|
-
return
|
|
333
|
+
return U ? () => {} : (e.add(t), () => {
|
|
320
334
|
e.delete(t);
|
|
321
335
|
});
|
|
322
336
|
}
|
|
323
|
-
function
|
|
324
|
-
if (
|
|
325
|
-
let t =
|
|
337
|
+
function Ne(e) {
|
|
338
|
+
if (U) return y("disposed");
|
|
339
|
+
let t = a(e);
|
|
326
340
|
return t.length ? (G({
|
|
327
341
|
code: "invalid-input",
|
|
328
342
|
source: "show",
|
|
329
343
|
message: "Invalid notification specification"
|
|
330
344
|
}), {
|
|
331
|
-
...
|
|
345
|
+
...y("invalid-input"),
|
|
332
346
|
issues: t
|
|
333
|
-
}) :
|
|
347
|
+
}) : Pe(e);
|
|
334
348
|
}
|
|
335
|
-
function
|
|
336
|
-
if (t.id !== void 0 && C.has(t.id)) return
|
|
349
|
+
function Pe(t, n) {
|
|
350
|
+
if (t.id !== void 0 && C.has(t.id)) return y("id-conflict");
|
|
337
351
|
let r = t.dedupeKey === void 0 ? void 0 : [...C.values()].find((e) => e.dedupeKey === t.dedupeKey);
|
|
338
352
|
if (r) {
|
|
339
353
|
let e = r.occurrences;
|
|
@@ -350,30 +364,30 @@ function b(f, y) {
|
|
|
350
364
|
};
|
|
351
365
|
}
|
|
352
366
|
if (C.size >= 100) return X((e) => {
|
|
353
|
-
|
|
354
|
-
let t =
|
|
355
|
-
count:
|
|
367
|
+
V = Math.min(2 ** 53 - 1, V + 1);
|
|
368
|
+
let t = s({
|
|
369
|
+
count: V,
|
|
356
370
|
pending: !0
|
|
357
371
|
});
|
|
358
372
|
e.push({
|
|
359
373
|
type: "overflow",
|
|
360
|
-
count:
|
|
374
|
+
count: V
|
|
361
375
|
}), b.onOverflow && e.push({
|
|
362
376
|
callback: () => b.onOverflow(t),
|
|
363
377
|
source: "onOverflow"
|
|
364
378
|
});
|
|
365
|
-
}),
|
|
379
|
+
}), y("capacity");
|
|
366
380
|
let i = J(), a = t.id;
|
|
367
381
|
if (a === void 0) do
|
|
368
|
-
a = `${S}:notification-${++
|
|
382
|
+
a = `${S}:notification-${++ee}`;
|
|
369
383
|
while (C.has(a));
|
|
370
|
-
let o =
|
|
384
|
+
let o = s({
|
|
371
385
|
id: a,
|
|
372
386
|
controller: S,
|
|
373
|
-
generation:
|
|
387
|
+
generation: W()
|
|
374
388
|
});
|
|
375
|
-
|
|
376
|
-
let
|
|
389
|
+
c.add(o);
|
|
390
|
+
let l = {
|
|
377
391
|
handle: o,
|
|
378
392
|
dedupeKey: t.dedupeKey,
|
|
379
393
|
onClose: t.onClose,
|
|
@@ -392,52 +406,53 @@ function b(f, y) {
|
|
|
392
406
|
occurrencesAnnounced: 0,
|
|
393
407
|
operation: null,
|
|
394
408
|
operationAnnounced: /* @__PURE__ */ new Set(),
|
|
395
|
-
action: h
|
|
409
|
+
action: h,
|
|
410
|
+
form: null
|
|
396
411
|
};
|
|
397
|
-
|
|
398
|
-
let
|
|
412
|
+
l.remaining = Q(l), C.set(a, l), n?.(l), De(l, i);
|
|
413
|
+
let u = [{
|
|
399
414
|
type: "admitted",
|
|
400
415
|
handle: o
|
|
401
416
|
}];
|
|
402
|
-
if (
|
|
403
|
-
let e =
|
|
404
|
-
|
|
417
|
+
if (l.operation) {
|
|
418
|
+
let e = l.operation.getSnapshot();
|
|
419
|
+
u.push({
|
|
405
420
|
type: "operation-started",
|
|
406
421
|
handle: o,
|
|
407
422
|
token: e.token,
|
|
408
423
|
attempt: e.attempt
|
|
409
424
|
});
|
|
410
425
|
}
|
|
411
|
-
return Y(
|
|
426
|
+
return Y(u, i), {
|
|
412
427
|
status: "created",
|
|
413
428
|
handle: o
|
|
414
429
|
};
|
|
415
430
|
}
|
|
416
|
-
function
|
|
417
|
-
|
|
431
|
+
function Fe(e) {
|
|
432
|
+
U || q(e);
|
|
418
433
|
}
|
|
419
|
-
function
|
|
420
|
-
e.content = t, e.kind = n, e.remaining = n === "loading" ? null : Q(e), e.action = h, e ===
|
|
434
|
+
function Ie(e, t, n) {
|
|
435
|
+
e.content = t, e.kind = n, e.remaining = n === "loading" ? null : Q(e), e.action = h, e === I && Ce(e), De(e, x.now()), A?.target.kind === "notification" && A.target.handle === e.handle && A.target.control === "action" && !t.action && (A = null);
|
|
421
436
|
}
|
|
422
|
-
function
|
|
423
|
-
let a = typeof
|
|
424
|
-
if (!a && (typeof
|
|
425
|
-
let
|
|
437
|
+
function Le(r, i) {
|
|
438
|
+
let a = typeof r == "function" ? r : null, c;
|
|
439
|
+
if (!a && (typeof r != "object" || !r || typeof (c = r.then) != "function")) throw TypeError("Operation source must be a factory or thenable");
|
|
440
|
+
let l = o(i, a !== null), u = (e) => i && typeof i == "object" ? Object.getOwnPropertyDescriptor(i, e)?.value : void 0, d = u("cancel"), f = !a && typeof d == "function" ? d : null, p = u("isCancellation"), h = typeof p == "function" ? p : null, g = l.length ? null : s({
|
|
426
441
|
...i,
|
|
427
442
|
pending: e(i.pending),
|
|
428
443
|
success: typeof i.success == "function" ? i.success : e(i.success),
|
|
429
444
|
error: typeof i.error == "function" ? i.error : e(i.error),
|
|
430
445
|
...i.cancelled === void 0 ? {} : { cancelled: typeof i.cancelled == "function" ? i.cancelled : e(i.cancelled) }
|
|
431
|
-
}),
|
|
432
|
-
function
|
|
433
|
-
let e =
|
|
446
|
+
}), _ = /* @__PURE__ */ new Set(), v = null, x = !1, S, w = 0;
|
|
447
|
+
function T() {
|
|
448
|
+
let e = m.createCancellation(), t = s({
|
|
434
449
|
signal: e.signal,
|
|
435
|
-
token:
|
|
436
|
-
attempt: ++
|
|
450
|
+
token: W(),
|
|
451
|
+
attempt: ++w
|
|
437
452
|
}), n, r, i = new Promise((e, t) => {
|
|
438
453
|
n = e, r = t;
|
|
439
454
|
}), a = {
|
|
440
|
-
public:
|
|
455
|
+
public: s({
|
|
441
456
|
token: t.token,
|
|
442
457
|
attempt: t.attempt,
|
|
443
458
|
result: i
|
|
@@ -449,506 +464,350 @@ function b(f, y) {
|
|
|
449
464
|
status: "pending",
|
|
450
465
|
cancelRequested: !1
|
|
451
466
|
};
|
|
452
|
-
return i.then((e) =>
|
|
453
|
-
|
|
467
|
+
return i.then((e) => ee(a, "fulfilled", e), (e) => ee(a, "rejected", e)).catch((e) => {
|
|
468
|
+
U || K("callback-error", "operation-settlement", e);
|
|
454
469
|
}), a;
|
|
455
470
|
}
|
|
456
|
-
let
|
|
457
|
-
function
|
|
471
|
+
let D = T(), O = D;
|
|
472
|
+
function k() {
|
|
458
473
|
let e = {
|
|
459
|
-
token:
|
|
460
|
-
attempt:
|
|
461
|
-
status:
|
|
462
|
-
cancelRequested:
|
|
463
|
-
canCancel: !
|
|
464
|
-
canRetry: !
|
|
465
|
-
notification:
|
|
474
|
+
token: O.context.token,
|
|
475
|
+
attempt: O.context.attempt,
|
|
476
|
+
status: O.status,
|
|
477
|
+
cancelRequested: O.cancelRequested,
|
|
478
|
+
canCancel: !U && O.status === "pending" && !O.cancelRequested && (!!a || !!f),
|
|
479
|
+
canRetry: !U && !!a && O.status !== "pending",
|
|
480
|
+
notification: x && !U ? v : null
|
|
466
481
|
};
|
|
467
|
-
return (!
|
|
482
|
+
return (!S || Object.keys(e).some((t) => e[t] !== S[t])) && (S = s(e)), S;
|
|
468
483
|
}
|
|
469
|
-
let
|
|
484
|
+
let A = {
|
|
470
485
|
source: "operation.subscribe",
|
|
471
|
-
callback: () =>
|
|
486
|
+
callback: () => ye(_, "operation.subscribe")
|
|
472
487
|
};
|
|
473
|
-
function
|
|
474
|
-
if (
|
|
475
|
-
let t = C.get(
|
|
476
|
-
return t?.handle ===
|
|
488
|
+
function j(e) {
|
|
489
|
+
if (U || O !== e || !x || !v) return;
|
|
490
|
+
let t = C.get(v.id);
|
|
491
|
+
return t?.handle === v && t.operation === L ? t : void 0;
|
|
477
492
|
}
|
|
478
|
-
function
|
|
493
|
+
function M(e) {
|
|
479
494
|
try {
|
|
480
|
-
e.resolve(a ? a(e.context) : { then:
|
|
495
|
+
e.resolve(a ? a(e.context) : { then: c.bind(r) });
|
|
481
496
|
} catch (t) {
|
|
482
497
|
e.reject(t);
|
|
483
498
|
}
|
|
484
499
|
}
|
|
485
|
-
function
|
|
500
|
+
function N(e, t) {
|
|
486
501
|
if (t) {
|
|
487
502
|
let n = J();
|
|
488
503
|
t(), Y(e, n);
|
|
489
|
-
} else
|
|
504
|
+
} else Fe(e);
|
|
490
505
|
}
|
|
491
|
-
function
|
|
492
|
-
if (t.status =
|
|
493
|
-
(
|
|
506
|
+
function ee(t, r, i) {
|
|
507
|
+
if (t.status = r, r === "rejected") try {
|
|
508
|
+
(h ? h(i, t.context) === !0 : t.cancelRequested && typeof i == "object" && i && "name" in i && i.name === "AbortError") && (t.status = "cancelled");
|
|
494
509
|
} catch (e) {
|
|
495
|
-
|
|
510
|
+
U || K("cancellation-error", "isCancellation", e);
|
|
496
511
|
}
|
|
497
512
|
let a;
|
|
498
|
-
if (
|
|
499
|
-
let
|
|
513
|
+
if (j(t) && g) {
|
|
514
|
+
let r = t.status, o = r === "fulfilled" ? b.messages?.operationSuccess ?? "Completed" : r === "cancelled" ? b.messages?.operationCancelled ?? "Cancelled" : b.messages?.operationError ?? "Something went wrong";
|
|
500
515
|
try {
|
|
501
|
-
let t =
|
|
502
|
-
if (
|
|
516
|
+
let t = r === "fulfilled" ? g.success : r === "cancelled" ? g.cancelled : g.error, s = typeof t == "function" ? t(i) : t ?? { title: o };
|
|
517
|
+
if (n(s).length) throw TypeError("Invalid terminal notification content");
|
|
503
518
|
a = e(s);
|
|
504
519
|
} catch (e) {
|
|
505
|
-
a =
|
|
520
|
+
a = s({
|
|
506
521
|
title: o,
|
|
507
522
|
announcementPriority: "polite"
|
|
508
|
-
}),
|
|
523
|
+
}), U || K("mapper-error", `track.${r}`, e, v ?? void 0);
|
|
509
524
|
}
|
|
510
525
|
}
|
|
511
|
-
let o =
|
|
512
|
-
|
|
526
|
+
let o = j(t), c = !!o && !!a;
|
|
527
|
+
N([...O === t ? [A] : [], {
|
|
513
528
|
type: "operation-settled",
|
|
514
|
-
handle:
|
|
529
|
+
handle: v,
|
|
515
530
|
token: t.context.token,
|
|
516
531
|
status: t.status,
|
|
517
|
-
uiApplied:
|
|
518
|
-
}], o && a ? () =>
|
|
532
|
+
uiApplied: c
|
|
533
|
+
}], o && a ? () => Ie(o, a, t.status === "fulfilled" ? "success" : t.status === "cancelled" ? "warning" : "error") : void 0);
|
|
519
534
|
}
|
|
520
|
-
function
|
|
535
|
+
function P(e, n) {
|
|
521
536
|
e.cancelRequested = !0;
|
|
522
|
-
let r =
|
|
523
|
-
|
|
537
|
+
let r = j(e);
|
|
538
|
+
N([A, {
|
|
524
539
|
type: "cancellation-requested",
|
|
525
|
-
handle:
|
|
540
|
+
handle: v,
|
|
526
541
|
token: e.context.token
|
|
527
542
|
}], r ? () => {
|
|
528
543
|
r.content = t(r.content, { title: b.messages?.cancellationRequested ?? "Cancellation requested" });
|
|
529
544
|
} : void 0);
|
|
530
545
|
try {
|
|
531
|
-
e.abort(n),
|
|
546
|
+
e.abort(n), f?.(n);
|
|
532
547
|
} catch (e) {
|
|
533
|
-
|
|
548
|
+
U || K("cancellation-error", "cancel", e, v ?? void 0);
|
|
534
549
|
}
|
|
535
550
|
}
|
|
536
|
-
function
|
|
551
|
+
function te() {
|
|
537
552
|
let e = /* @__PURE__ */ Error("Cancellation requested");
|
|
538
553
|
return e.name = "AbortError", e;
|
|
539
554
|
}
|
|
540
|
-
function
|
|
541
|
-
return
|
|
555
|
+
function F(e = te()) {
|
|
556
|
+
return U ? y("disposed") : O.status === "pending" ? !a && !f ? y("not-cancellable") : O.cancelRequested ? {
|
|
542
557
|
status: "unchanged",
|
|
543
558
|
reason: "already-requested"
|
|
544
|
-
} : (
|
|
559
|
+
} : (P(O, e), { status: "requested" }) : {
|
|
545
560
|
status: "unchanged",
|
|
546
561
|
reason: "settled"
|
|
547
562
|
};
|
|
548
563
|
}
|
|
549
|
-
function
|
|
550
|
-
if (
|
|
551
|
-
if (!a) return
|
|
552
|
-
if (
|
|
553
|
-
let t =
|
|
554
|
-
|
|
555
|
-
let r =
|
|
556
|
-
return
|
|
564
|
+
function I(e) {
|
|
565
|
+
if (U) return y("disposed");
|
|
566
|
+
if (!a) return y("not-retryable");
|
|
567
|
+
if (O.status === "pending" && !e) return y("already-pending");
|
|
568
|
+
let t = O, n = T();
|
|
569
|
+
O = n;
|
|
570
|
+
let r = j(n);
|
|
571
|
+
return N([A, {
|
|
557
572
|
type: "operation-started",
|
|
558
|
-
handle:
|
|
573
|
+
handle: v,
|
|
559
574
|
token: n.context.token,
|
|
560
575
|
attempt: n.context.attempt
|
|
561
|
-
}], r &&
|
|
562
|
-
r.operationAnnounced.clear(),
|
|
563
|
-
} : void 0), t.status === "pending" && !t.cancelRequested &&
|
|
576
|
+
}], r && g ? () => {
|
|
577
|
+
r.operationAnnounced.clear(), Ie(r, g.pending, "loading");
|
|
578
|
+
} : void 0), t.status === "pending" && !t.cancelRequested && P(t, te()), M(n), {
|
|
564
579
|
status: "started",
|
|
565
580
|
attempt: n.public
|
|
566
581
|
};
|
|
567
582
|
}
|
|
568
|
-
let
|
|
569
|
-
getSnapshot:
|
|
570
|
-
retry: () =>
|
|
571
|
-
cancel:
|
|
572
|
-
detach: () => (
|
|
573
|
-
},
|
|
574
|
-
if (
|
|
575
|
-
else if (!
|
|
576
|
-
...
|
|
577
|
-
issues:
|
|
583
|
+
let L = {
|
|
584
|
+
getSnapshot: k,
|
|
585
|
+
retry: () => I(!1),
|
|
586
|
+
cancel: F,
|
|
587
|
+
detach: () => (x = !1, A)
|
|
588
|
+
}, R;
|
|
589
|
+
if (U) R = y("disposed");
|
|
590
|
+
else if (!g) R = {
|
|
591
|
+
...y("invalid-input"),
|
|
592
|
+
issues: l
|
|
578
593
|
}, G({
|
|
579
594
|
code: "invalid-input",
|
|
580
595
|
source: "track",
|
|
581
596
|
message: "Invalid operation options"
|
|
582
597
|
});
|
|
583
598
|
else {
|
|
584
|
-
let e =
|
|
585
|
-
...
|
|
586
|
-
...
|
|
599
|
+
let e = Pe({
|
|
600
|
+
...g.pending,
|
|
601
|
+
...g,
|
|
587
602
|
kind: "loading"
|
|
588
603
|
}, (e) => {
|
|
589
|
-
|
|
604
|
+
v = e.handle, x = !0, e.operation = L;
|
|
590
605
|
});
|
|
591
606
|
if (e.status === "deduplicated") throw Error("Tracked operation cannot be deduplicated");
|
|
592
|
-
|
|
607
|
+
R = e;
|
|
593
608
|
}
|
|
594
|
-
return
|
|
609
|
+
return R.status === "rejected" && Fe([{
|
|
595
610
|
type: "operation-started",
|
|
596
611
|
handle: null,
|
|
597
|
-
token:
|
|
612
|
+
token: D.context.token,
|
|
598
613
|
attempt: 1
|
|
599
|
-
}]),
|
|
600
|
-
...
|
|
601
|
-
admission:
|
|
602
|
-
getSnapshot:
|
|
614
|
+
}]), M(D), s({
|
|
615
|
+
...D.public,
|
|
616
|
+
admission: s(R),
|
|
617
|
+
getSnapshot: k,
|
|
603
618
|
subscribe(e) {
|
|
604
|
-
let t =
|
|
605
|
-
return
|
|
606
|
-
t(),
|
|
619
|
+
let t = Me(_, e);
|
|
620
|
+
return _.size && E.set(_, A), () => {
|
|
621
|
+
t(), _.size || E.delete(_);
|
|
607
622
|
};
|
|
608
623
|
},
|
|
609
|
-
cancel:
|
|
610
|
-
retry: () =>
|
|
611
|
-
restart: () =>
|
|
624
|
+
cancel: F,
|
|
625
|
+
retry: () => I(!1),
|
|
626
|
+
restart: () => I(!0)
|
|
612
627
|
});
|
|
613
628
|
}
|
|
614
|
-
let
|
|
615
|
-
show: (e) =>
|
|
616
|
-
track:
|
|
617
|
-
update:
|
|
618
|
-
let r = e.handle,
|
|
619
|
-
if (
|
|
629
|
+
let Re = s({
|
|
630
|
+
show: (e) => Ne(e),
|
|
631
|
+
track: Le,
|
|
632
|
+
update: ve((e, n) => {
|
|
633
|
+
let r = e.handle, a = i(n);
|
|
634
|
+
if (a.length) return G({
|
|
620
635
|
code: "invalid-input",
|
|
621
636
|
source: "update",
|
|
622
637
|
message: "Invalid notification patch",
|
|
623
638
|
handle: r
|
|
624
639
|
}), {
|
|
625
|
-
...
|
|
626
|
-
issues:
|
|
640
|
+
...y("invalid-input"),
|
|
641
|
+
issues: a
|
|
627
642
|
};
|
|
628
|
-
if (e.action.status === "pending" && Object.prototype.hasOwnProperty.call(n, "action")) return
|
|
629
|
-
if (e.operation && (Object.prototype.hasOwnProperty.call(n, "kind") || e.operation.getSnapshot().status === "pending" && Object.prototype.hasOwnProperty.call(n, "duration"))) return
|
|
643
|
+
if (e.action.status === "pending" && Object.prototype.hasOwnProperty.call(n, "action")) return y("action-pending");
|
|
644
|
+
if (e.operation && (Object.prototype.hasOwnProperty.call(n, "kind") || e.operation.getSnapshot().status === "pending" && Object.prototype.hasOwnProperty.call(n, "duration"))) return y("operation-owned");
|
|
630
645
|
let o = t(e.content, n), s = n.kind ?? e.kind, c = n.priority ?? e.priority, l = Object.prototype.hasOwnProperty.call(n, "duration");
|
|
631
|
-
return o === e.content && s === e.kind && c === e.priority && !l && !(Object.prototype.hasOwnProperty.call(n, "action") && e.action.status === "failed") ?
|
|
646
|
+
return o === e.content && s === e.kind && c === e.priority && !l && !(Object.prototype.hasOwnProperty.call(n, "action") && e.action.status === "failed") ? v : X((t) => {
|
|
632
647
|
let i = Q(e);
|
|
633
648
|
e.content = o, Object.prototype.hasOwnProperty.call(n, "action") && (e.action = h), e.kind = s, e.priority = c;
|
|
634
649
|
let a = Q(e);
|
|
635
|
-
(l || i !== a) && (e.remaining = a), A?.target.kind === "notification" && A.target.handle === r && A.target.control === "action" && !o.action && (A = null),
|
|
650
|
+
(l || i !== a) && (e.remaining = a), A?.target.kind === "notification" && A.target.handle === r && A.target.control === "action" && !o.action && (A = null), z?.record === e && !fe(e) && (z = null), t.push({
|
|
636
651
|
type: "updated",
|
|
637
652
|
handle: r
|
|
638
653
|
});
|
|
639
654
|
});
|
|
640
655
|
}),
|
|
641
|
-
getHandle: (e) => !
|
|
642
|
-
dismiss: (e) =>
|
|
656
|
+
getHandle: (e) => !U && typeof e == "string" ? C.get(e)?.handle : void 0,
|
|
657
|
+
dismiss: (e) => Ae(e, "programmatic"),
|
|
643
658
|
clear() {
|
|
644
|
-
if (
|
|
659
|
+
if (U) return y("disposed");
|
|
645
660
|
let e = C.size;
|
|
646
661
|
return e && X((e) => {
|
|
647
|
-
for (let t of C.values())
|
|
662
|
+
for (let t of C.values()) $(t, "clear", e);
|
|
648
663
|
}), {
|
|
649
664
|
status: "cleared",
|
|
650
665
|
count: e
|
|
651
666
|
};
|
|
652
667
|
},
|
|
653
668
|
requestFocus(e = { kind: "anchor" }) {
|
|
654
|
-
if (
|
|
669
|
+
if (U) return y("disposed");
|
|
655
670
|
if (e?.kind === "notification") {
|
|
656
|
-
let t =
|
|
657
|
-
if (t) return
|
|
671
|
+
let t = _e(e.handle);
|
|
672
|
+
if (t) return y(t);
|
|
658
673
|
}
|
|
659
|
-
if (!j) return
|
|
674
|
+
if (!j) return y("no-host");
|
|
660
675
|
if (!e || ![
|
|
661
676
|
"anchor",
|
|
662
677
|
"notification",
|
|
663
678
|
"overflow"
|
|
664
|
-
].includes(e.kind)) return
|
|
679
|
+
].includes(e.kind)) return y("unavailable");
|
|
665
680
|
if (e.kind === "notification") {
|
|
666
681
|
let t = C.get(e.handle.id);
|
|
667
|
-
if (t !==
|
|
668
|
-
if (e.control !== void 0 && !["action", "close"].includes(e.control) || e.control === "action" && !t.content.action) return
|
|
669
|
-
if (e.control !== void 0 && !
|
|
682
|
+
if (t !== I) return y("not-visible");
|
|
683
|
+
if (e.control !== void 0 && !["action", "close"].includes(e.control) || e.control === "action" && !t.content.action) return y("unavailable");
|
|
684
|
+
if (e.control !== void 0 && !F) return y("not-visible");
|
|
670
685
|
}
|
|
671
|
-
return e.kind === "overflow" && !
|
|
672
|
-
let t = e.kind === "notification" ?
|
|
686
|
+
return e.kind === "overflow" && !V ? y("unavailable") : (X(() => {
|
|
687
|
+
let t = e.kind === "notification" ? s({
|
|
673
688
|
kind: e.kind,
|
|
674
689
|
handle: e.handle,
|
|
675
690
|
...e.control ? { control: e.control } : {}
|
|
676
|
-
}) :
|
|
677
|
-
A =
|
|
678
|
-
token:
|
|
691
|
+
}) : s({ kind: e.kind });
|
|
692
|
+
A = s({
|
|
693
|
+
token: W(),
|
|
679
694
|
target: t
|
|
680
695
|
});
|
|
681
696
|
}), { status: "requested" });
|
|
682
697
|
},
|
|
683
|
-
acknowledgeOverflow:
|
|
684
|
-
getSnapshot: () =>
|
|
698
|
+
acknowledgeOverflow: je,
|
|
699
|
+
getSnapshot: () => oe,
|
|
685
700
|
getServerSnapshot: () => p,
|
|
686
|
-
subscribe: (e) =>
|
|
687
|
-
onEvent: (e) =>
|
|
701
|
+
subscribe: (e) => Me(w, e),
|
|
702
|
+
onEvent: (e) => Me(T, e),
|
|
688
703
|
dispose() {
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
for (let t of C.values())
|
|
704
|
+
U || X((e) => {
|
|
705
|
+
U = !0;
|
|
706
|
+
for (let t of C.values()) $(t, "dispose", e);
|
|
692
707
|
for (let t of E.values()) e.includes(t) || e.push(t);
|
|
693
|
-
j = M = null,
|
|
708
|
+
j = M = null, F = null, z = null, Ee(), A = null, D.clear(), V = H = 0;
|
|
694
709
|
}, !0);
|
|
695
710
|
}
|
|
696
711
|
});
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
let Ge = l({
|
|
707
|
-
renderError: b.messages?.renderError ?? "Content unavailable",
|
|
708
|
-
reportInvalidContainer(e, t) {
|
|
709
|
-
V || G({
|
|
710
|
-
code: "invalid-container",
|
|
711
|
-
source: "Toaster.container",
|
|
712
|
-
message: e,
|
|
713
|
-
...t === void 0 ? {} : { error: t }
|
|
714
|
-
});
|
|
712
|
+
return Se(), l.set(Re, s({
|
|
713
|
+
options: b,
|
|
714
|
+
clock: x,
|
|
715
|
+
records: C,
|
|
716
|
+
globalPauses: D,
|
|
717
|
+
subscribe: Re.subscribe,
|
|
718
|
+
onEvent: Re.onEvent,
|
|
719
|
+
get disposed() {
|
|
720
|
+
return U;
|
|
715
721
|
},
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (j !== null) return G({
|
|
719
|
-
code: "second-host",
|
|
720
|
-
source: "attach",
|
|
721
|
-
message: "A renderer is already attached"
|
|
722
|
-
}), v("host-exists");
|
|
723
|
-
if (!We(e)) return v("invalid-input");
|
|
724
|
-
let t = H();
|
|
725
|
-
return X(() => {
|
|
726
|
-
j = M = t, F = e?.attentionDelay, P && De(P);
|
|
727
|
-
}), {
|
|
728
|
-
status: "attached",
|
|
729
|
-
lease: t
|
|
730
|
-
};
|
|
722
|
+
get presented() {
|
|
723
|
+
return I;
|
|
731
724
|
},
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
if (j === null && M !== null && e === M) return _;
|
|
735
|
-
let t = ye(e);
|
|
736
|
-
return t ? v(t) : X(() => {
|
|
737
|
-
j = null, F = void 0, Ne(void 0), A = null, k = null, D.clear();
|
|
738
|
-
for (let e of C.values()) e.pauses.clear(), e.readable = !1, e.presentation = null;
|
|
739
|
-
});
|
|
725
|
+
get rendererSnapshot() {
|
|
726
|
+
return se;
|
|
740
727
|
},
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
return
|
|
788
|
-
|
|
728
|
+
get overflow() {
|
|
729
|
+
return V;
|
|
730
|
+
},
|
|
731
|
+
get lease() {
|
|
732
|
+
return j;
|
|
733
|
+
},
|
|
734
|
+
set lease(e) {
|
|
735
|
+
j = e;
|
|
736
|
+
},
|
|
737
|
+
get lastLease() {
|
|
738
|
+
return M;
|
|
739
|
+
},
|
|
740
|
+
set lastLease(e) {
|
|
741
|
+
M = e;
|
|
742
|
+
},
|
|
743
|
+
get hostDelay() {
|
|
744
|
+
return L;
|
|
745
|
+
},
|
|
746
|
+
set hostDelay(e) {
|
|
747
|
+
L = e;
|
|
748
|
+
},
|
|
749
|
+
get hostAutoDismiss() {
|
|
750
|
+
return R;
|
|
751
|
+
},
|
|
752
|
+
set hostAutoDismiss(e) {
|
|
753
|
+
R = e;
|
|
754
|
+
},
|
|
755
|
+
get island() {
|
|
756
|
+
return F;
|
|
757
|
+
},
|
|
758
|
+
set island(e) {
|
|
759
|
+
F = e;
|
|
760
|
+
},
|
|
761
|
+
get attention() {
|
|
762
|
+
return z;
|
|
763
|
+
},
|
|
764
|
+
set attention(e) {
|
|
765
|
+
z = e;
|
|
766
|
+
},
|
|
767
|
+
get focusRequest() {
|
|
768
|
+
return A;
|
|
769
|
+
},
|
|
770
|
+
set focusRequest(e) {
|
|
771
|
+
A = e;
|
|
772
|
+
},
|
|
773
|
+
get focused() {
|
|
774
|
+
return k;
|
|
775
|
+
},
|
|
776
|
+
set focused(e) {
|
|
777
|
+
k = e;
|
|
778
|
+
},
|
|
779
|
+
get overflowAnnounced() {
|
|
780
|
+
return H;
|
|
781
|
+
},
|
|
782
|
+
set overflowAnnounced(e) {
|
|
783
|
+
H = e;
|
|
784
|
+
},
|
|
785
|
+
token: W,
|
|
786
|
+
diagnostic: G,
|
|
787
|
+
failure: K,
|
|
788
|
+
mutate: X,
|
|
789
|
+
commit: Y,
|
|
790
|
+
settle: J,
|
|
791
|
+
assign: Ce,
|
|
792
|
+
newest: le,
|
|
793
|
+
formOf: pe,
|
|
794
|
+
handleError: _e,
|
|
795
|
+
withRecord: ve,
|
|
796
|
+
autoDismissing: Z,
|
|
797
|
+
setHostAutoDismiss: ke,
|
|
798
|
+
dismiss: Ae,
|
|
799
|
+
acknowledgeOverflow: je,
|
|
800
|
+
reportRendererLoadError(e) {
|
|
801
|
+
U || G({
|
|
802
|
+
code: "renderer-load-error",
|
|
803
|
+
source: "Toaster",
|
|
804
|
+
message: "Toaster renderer failed to load",
|
|
805
|
+
error: e
|
|
789
806
|
});
|
|
790
|
-
}),
|
|
791
|
-
setFocused: $((e) => {
|
|
792
|
-
let t = e === null ? void 0 : be(e);
|
|
793
|
-
return t ? v(t) : k === e ? _ : (k = e, g);
|
|
794
|
-
}),
|
|
795
|
-
beginPresentation: $(xe((e, t) => {
|
|
796
|
-
if (e.presentation !== t) return v("stale-presentation");
|
|
797
|
-
let n = H();
|
|
798
|
-
return X(() => {
|
|
799
|
-
e.presentation = n, e.readable = !1;
|
|
800
|
-
}), {
|
|
801
|
-
status: "started",
|
|
802
|
-
token: n
|
|
803
|
-
};
|
|
804
|
-
})),
|
|
805
|
-
acknowledgePresentation: $(xe((e, t) => e.presentation === t ? e.readable ? _ : X((t) => {
|
|
806
|
-
t.push({
|
|
807
|
-
type: "presented",
|
|
808
|
-
handle: e.handle,
|
|
809
|
-
firstPresentation: !e.everPresented
|
|
810
|
-
}), e.readable = e.everPresented = !0;
|
|
811
|
-
}) : v("stale-presentation"))),
|
|
812
|
-
acknowledgeFocus: $((e, t) => A?.token === e ? t !== "focused" && t !== "unavailable" ? v("invalid-input") : X(() => {
|
|
813
|
-
A = null;
|
|
814
|
-
}) : v("stale-focus-request")),
|
|
815
|
-
acknowledgeOverflow: $(() => Ie()),
|
|
816
|
-
acknowledgeAnnouncements: $((e) => Ke(e)),
|
|
817
|
-
dismiss: $((e, t) => {
|
|
818
|
-
let n = U(e);
|
|
819
|
-
return n ? v(n) : [
|
|
820
|
-
"close-button",
|
|
821
|
-
"swipe",
|
|
822
|
-
"navigation"
|
|
823
|
-
].includes(t) ? Fe(e, t) : v("invalid-input");
|
|
824
|
-
}),
|
|
825
|
-
invokeAction: $(W((e) => {
|
|
826
|
-
let t = e.handle, n = e.content.action;
|
|
827
|
-
if (!n || n.kind !== "command") return v("no-command");
|
|
828
|
-
if (e.action.status === "pending") return v("already-pending");
|
|
829
|
-
let r = H(), i = () => !V && C.get(t.id) === e && e.action.status === "pending" && e.action.token === r, a = J();
|
|
830
|
-
e.action = l({
|
|
831
|
-
status: "pending",
|
|
832
|
-
token: r
|
|
833
|
-
}), Y([{
|
|
834
|
-
type: "action-started",
|
|
835
|
-
handle: t,
|
|
836
|
-
token: r
|
|
837
|
-
}], a);
|
|
838
|
-
function o(a) {
|
|
839
|
-
if (!i()) return;
|
|
840
|
-
let o = b.messages?.actionError ?? "Action failed";
|
|
841
|
-
if (n?.kind === "command" && n.errorMessage) try {
|
|
842
|
-
let e = n.errorMessage(a);
|
|
843
|
-
if (typeof e != "string" || !e.trim()) throw TypeError("Invalid action error message");
|
|
844
|
-
o = e;
|
|
845
|
-
} catch (e) {
|
|
846
|
-
V || K("mapper-error", "action.errorMessage", e, t);
|
|
847
|
-
}
|
|
848
|
-
if (!i()) return;
|
|
849
|
-
let s = J();
|
|
850
|
-
e.action = l({
|
|
851
|
-
status: "failed",
|
|
852
|
-
token: r,
|
|
853
|
-
message: o
|
|
854
|
-
}), Y([{
|
|
855
|
-
type: "action-failed",
|
|
856
|
-
handle: t,
|
|
857
|
-
token: r,
|
|
858
|
-
message: o
|
|
859
|
-
}], s);
|
|
860
|
-
}
|
|
861
|
-
let s;
|
|
862
|
-
try {
|
|
863
|
-
s = Promise.resolve(n.run(l({
|
|
864
|
-
handle: t,
|
|
865
|
-
token: r
|
|
866
|
-
})));
|
|
867
|
-
} catch (e) {
|
|
868
|
-
s = Promise.reject(e);
|
|
869
|
-
}
|
|
870
|
-
return s.then(() => {
|
|
871
|
-
i() && Fe(t, "action-success");
|
|
872
|
-
}, o).catch((e) => {
|
|
873
|
-
V || K("callback-error", "action-settlement", e, t);
|
|
874
|
-
}), { status: "started" };
|
|
875
|
-
})),
|
|
876
|
-
retryOperation: $(Se((e) => {
|
|
877
|
-
let t = e.retry();
|
|
878
|
-
return t.status === "started" ? {
|
|
879
|
-
status: "started",
|
|
880
|
-
token: t.attempt.token
|
|
881
|
-
} : t;
|
|
882
|
-
})),
|
|
883
|
-
cancelOperation: $(Se((e, t) => e.cancel(t))),
|
|
884
|
-
reportDiagnostic: $((e) => !e || typeof e.source != "string" || typeof e.message != "string" || ![
|
|
885
|
-
"invalid-input",
|
|
886
|
-
"second-host",
|
|
887
|
-
"stale-host",
|
|
888
|
-
"mapper-error",
|
|
889
|
-
"callback-error",
|
|
890
|
-
"listener-error",
|
|
891
|
-
"cancellation-error",
|
|
892
|
-
"slot-error",
|
|
893
|
-
"formatter-error",
|
|
894
|
-
"invalid-container"
|
|
895
|
-
].includes(e.code) ? v("invalid-input") : (G(e), g))
|
|
896
|
-
});
|
|
897
|
-
function Ke(e) {
|
|
898
|
-
if (!Array.isArray(e)) return v("invalid-input");
|
|
899
|
-
let t = [], n = (e, t) => Number.isSafeInteger(e) && e >= 0 && e <= t;
|
|
900
|
-
for (let r of e) {
|
|
901
|
-
if (!r || typeof r != "object") return v("invalid-input");
|
|
902
|
-
if (r.kind === "overflow") {
|
|
903
|
-
if (!n(r.count, z)) return v("invalid-input");
|
|
904
|
-
r.count > B && t.push(() => {
|
|
905
|
-
B = Math.max(B, r.count);
|
|
906
|
-
});
|
|
907
|
-
continue;
|
|
908
|
-
}
|
|
909
|
-
let e = U(r.handle);
|
|
910
|
-
if (e) return v(e);
|
|
911
|
-
let i = C.get(r.handle.id);
|
|
912
|
-
if (r.kind === "operation") {
|
|
913
|
-
let e = i.operation?.getSnapshot();
|
|
914
|
-
if (!e || e.token !== r.token) return v("stale-operation-token");
|
|
915
|
-
if (![
|
|
916
|
-
"started",
|
|
917
|
-
"fulfilled",
|
|
918
|
-
"rejected",
|
|
919
|
-
"cancelled",
|
|
920
|
-
"cancel-requested"
|
|
921
|
-
].includes(r.phase) || (r.phase === "cancel-requested" ? !e.cancelRequested : r.phase !== "started" && r.phase !== e.status)) return v("invalid-input");
|
|
922
|
-
i.operationAnnounced.has(r.phase) || t.push(() => {
|
|
923
|
-
i.operationAnnounced.add(r.phase);
|
|
924
|
-
});
|
|
925
|
-
} else if (r.kind === "action") {
|
|
926
|
-
if (i.action.status === "idle" || i.action.token !== r.token || i.action.status !== r.status) return v("invalid-input");
|
|
927
|
-
(i.actionAnnounced?.token !== r.token || i.actionAnnounced?.status !== r.status) && t.push(() => {
|
|
928
|
-
i.actionAnnounced = l({
|
|
929
|
-
token: r.token,
|
|
930
|
-
status: r.status
|
|
931
|
-
});
|
|
932
|
-
});
|
|
933
|
-
} else if (r.kind === "occurrences") {
|
|
934
|
-
if (!n(r.count, i.occurrences)) return v("invalid-input");
|
|
935
|
-
r.count > i.occurrencesAnnounced && t.push(() => {
|
|
936
|
-
i.occurrencesAnnounced = Math.max(i.occurrencesAnnounced, r.count);
|
|
937
|
-
});
|
|
938
|
-
} else if (r.kind === "queued" || r.kind === "first-presentation") {
|
|
939
|
-
let e = r.kind === "queued" ? "queuedAnnounced" : "firstAnnounced";
|
|
940
|
-
i[e] || t.push(() => {
|
|
941
|
-
i[e] = !0;
|
|
942
|
-
});
|
|
943
|
-
} else return v("invalid-input");
|
|
944
807
|
}
|
|
945
|
-
|
|
946
|
-
for (let e of t) e();
|
|
947
|
-
}) : _;
|
|
948
|
-
}
|
|
949
|
-
return Ee(), ee.set(Ue, Ge), Ue;
|
|
808
|
+
})), Re;
|
|
950
809
|
}
|
|
951
810
|
//#endregion
|
|
952
|
-
export {
|
|
811
|
+
export { _ as APPLIED, g as NO_FORM_ERRORS, m as RENDERER_SERVER, v as UNCHANGED, x as createCloudletCore, b as getControllerKernel, y as reject };
|
|
953
812
|
|
|
954
813
|
//# sourceMappingURL=controller.js.map
|