sanity 3.74.2-corel.18 → 3.74.2-coreui.20
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/lib/_chunks-cjs/runtime.js +8 -4
- package/lib/_chunks-cjs/runtime.js.map +1 -1
- package/lib/_chunks-cjs/version.js +1 -1
- package/lib/_chunks-es/version.mjs +1 -1
- package/lib/_legacy/version.esm.js +1 -1
- package/package.json +10 -11
- package/src/_internal/cli/server/renderDocument.tsx +12 -0
- package/src/_internal/cli/server/runtime.ts +13 -10
- package/src/_internal/cli/server/vite/plugin-sanity-build-entries.ts +14 -12
- package/dist/BroadcastDisplayedDocument-BHYI8o6u.mjs +0 -19
- package/dist/BroadcastDisplayedDocument-BHYI8o6u.mjs.map +0 -1
- package/dist/DisplayedDocumentBroadcaster-DfHPxc7C.mjs +0 -58
- package/dist/DisplayedDocumentBroadcaster-DfHPxc7C.mjs.map +0 -1
- package/dist/LiveQueries-sYvgBCKh.mjs +0 -267
- package/dist/LiveQueries-sYvgBCKh.mjs.map +0 -1
- package/dist/LoaderQueries-AQneabiG.mjs +0 -581
- package/dist/LoaderQueries-AQneabiG.mjs.map +0 -1
- package/dist/Observable-wwWYwtkh.mjs +0 -551
- package/dist/Observable-wwWYwtkh.mjs.map +0 -1
- package/dist/PostMessageDocuments-DLMdHDk6.mjs +0 -75
- package/dist/PostMessageDocuments-DLMdHDk6.mjs.map +0 -1
- package/dist/PostMessageFeatures-CazMQz3f.mjs +0 -21
- package/dist/PostMessageFeatures-CazMQz3f.mjs.map +0 -1
- package/dist/PostMessagePerspective-m4uZ6sI5.mjs +0 -23
- package/dist/PostMessagePerspective-m4uZ6sI5.mjs.map +0 -1
- package/dist/PostMessagePreviewSnapshots-Dr7CEAiM.mjs +0 -66
- package/dist/PostMessagePreviewSnapshots-Dr7CEAiM.mjs.map +0 -1
- package/dist/PostMessageRefreshMutations-CWb9UqSy.mjs +0 -66
- package/dist/PostMessageRefreshMutations-CWb9UqSy.mjs.map +0 -1
- package/dist/PostMessageSchema-BVFyZOH1.mjs +0 -514
- package/dist/PostMessageSchema-BVFyZOH1.mjs.map +0 -1
- package/dist/PostMessageTelemetry-CSluBvcC.mjs +0 -51
- package/dist/PostMessageTelemetry-CSluBvcC.mjs.map +0 -1
- package/dist/PresentationToolGrantsCheck-4zo266wj.mjs +0 -3919
- package/dist/PresentationToolGrantsCheck-4zo266wj.mjs.map +0 -1
- package/dist/QRCodeSVG-D6VfGEbM.mjs +0 -648
- package/dist/QRCodeSVG-D6VfGEbM.mjs.map +0 -1
- package/dist/SourceContext-T8zcpOpp.mjs +0 -33
- package/dist/SourceContext-T8zcpOpp.mjs.map +0 -1
- package/dist/StructureToolProvider-BMLps71e.mjs +0 -13815
- package/dist/StructureToolProvider-BMLps71e.mjs.map +0 -1
- package/dist/Subject-DP0DoUP_.mjs +0 -108
- package/dist/Subject-DP0DoUP_.mjs.map +0 -1
- package/dist/ViteDevServerStopped-DdibXNvO.mjs +0 -44
- package/dist/ViteDevServerStopped-DdibXNvO.mjs.map +0 -1
- package/dist/_createContext.mjs +0 -36
- package/dist/_createContext.mjs.map +0 -1
- package/dist/_singletons.mjs +0 -195
- package/dist/_singletons.mjs.map +0 -1
- package/dist/browser-BzDH2pyp.mjs +0 -455
- package/dist/browser-BzDH2pyp.mjs.map +0 -1
- package/dist/browser-DWCoWoiH.mjs +0 -3988
- package/dist/browser-DWCoWoiH.mjs.map +0 -1
- package/dist/debounceTime-BeoKrERE.mjs +0 -130
- package/dist/debounceTime-BeoKrERE.mjs.map +0 -1
- package/dist/desk.mjs +0 -52
- package/dist/desk.mjs.map +0 -1
- package/dist/first-Di4GZDIY.mjs +0 -42
- package/dist/first-Di4GZDIY.mjs.map +0 -1
- package/dist/get-psIoeD-z.mjs +0 -327
- package/dist/get-psIoeD-z.mjs.map +0 -1
- package/dist/hooks-4sgcd521.mjs +0 -90
- package/dist/hooks-4sgcd521.mjs.map +0 -1
- package/dist/index-9PJcXUTv.mjs +0 -87
- package/dist/index-9PJcXUTv.mjs.map +0 -1
- package/dist/index-ByFK-IwD.mjs +0 -528
- package/dist/index-ByFK-IwD.mjs.map +0 -1
- package/dist/index-C2OAo3To.mjs +0 -7079
- package/dist/index-C2OAo3To.mjs.map +0 -1
- package/dist/index-C3OvVLVP.mjs +0 -4636
- package/dist/index-C3OvVLVP.mjs.map +0 -1
- package/dist/index-DBPVDKJN.mjs +0 -1198
- package/dist/index-DBPVDKJN.mjs.map +0 -1
- package/dist/index-DkvUNBNf.mjs +0 -73
- package/dist/index-DkvUNBNf.mjs.map +0 -1
- package/dist/index-Sp9w8lMg.mjs +0 -118
- package/dist/index-Sp9w8lMg.mjs.map +0 -1
- package/dist/index.browser-BxT2qp9y.mjs +0 -104
- package/dist/index.browser-BxT2qp9y.mjs.map +0 -1
- package/dist/index.mjs +0 -129019
- package/dist/index.mjs.map +0 -1
- package/dist/isObservable-ByOheaM8.mjs +0 -8
- package/dist/isObservable-ByOheaM8.mjs.map +0 -1
- package/dist/never-ChKjLemk.mjs +0 -6
- package/dist/never-ChKjLemk.mjs.map +0 -1
- package/dist/pane-C4tskUPg.mjs +0 -5
- package/dist/pane-C4tskUPg.mjs.map +0 -1
- package/dist/pane-Dhx8FvsK.mjs +0 -5
- package/dist/pane-Dhx8FvsK.mjs.map +0 -1
- package/dist/presentation-CSS9GR9X.mjs +0 -984
- package/dist/presentation-CSS9GR9X.mjs.map +0 -1
- package/dist/presentation.mjs +0 -14
- package/dist/presentation.mjs.map +0 -1
- package/dist/resources-4cbq8YlR.mjs +0 -124
- package/dist/resources-4cbq8YlR.mjs.map +0 -1
- package/dist/resources-BVETz6Ur.mjs +0 -57
- package/dist/resources-BVETz6Ur.mjs.map +0 -1
- package/dist/resources-D4AaU75F.mjs +0 -434
- package/dist/resources-D4AaU75F.mjs.map +0 -1
- package/dist/resources-Dc-6ZcPg.mjs +0 -157
- package/dist/resources-Dc-6ZcPg.mjs.map +0 -1
- package/dist/resources-DgU0prBM.mjs +0 -179
- package/dist/resources-DgU0prBM.mjs.map +0 -1
- package/dist/resources-MD8RsYhH.mjs +0 -288
- package/dist/resources-MD8RsYhH.mjs.map +0 -1
- package/dist/router.mjs +0 -689
- package/dist/router.mjs.map +0 -1
- package/dist/share-bcOpIdQz.mjs +0 -71
- package/dist/share-bcOpIdQz.mjs.map +0 -1
- package/dist/shareReplay-Dj1O6fKV.mjs +0 -43
- package/dist/shareReplay-Dj1O6fKV.mjs.map +0 -1
- package/dist/stegaEncodeSourceMap-DXdUZQye.mjs +0 -342
- package/dist/stegaEncodeSourceMap-DXdUZQye.mjs.map +0 -1
- package/dist/structure.mjs +0 -56
- package/dist/structure.mjs.map +0 -1
- package/dist/takeUntil-CgZP1bze.mjs +0 -111
- package/dist/takeUntil-CgZP1bze.mjs.map +0 -1
- package/dist/v4-C78sE4Gb.mjs +0 -27082
- package/dist/v4-C78sE4Gb.mjs.map +0 -1
- package/dist/version-D7UZEoYI.mjs +0 -5
- package/dist/version-D7UZEoYI.mjs.map +0 -1
package/dist/index-C3OvVLVP.mjs
DELETED
@@ -1,4636 +0,0 @@
|
|
1
|
-
var xr = Object.defineProperty;
|
2
|
-
var Nt = (n) => {
|
3
|
-
throw TypeError(n);
|
4
|
-
};
|
5
|
-
var Sr = (n, e, t) => e in n ? xr(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
6
|
-
var b = (n, e, t) => Sr(n, typeof e != "symbol" ? e + "" : e, t), zt = (n, e, t) => e.has(n) || Nt("Cannot " + t);
|
7
|
-
var y = (n, e, t) => (zt(n, e, "read from private field"), t ? t.call(n) : e.get(n)), C = (n, e, t) => e.has(n) ? Nt("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(n) : e.set(n, t), _ = (n, e, t, r) => (zt(n, e, "write to private field"), r ? r.call(n, t) : e.set(n, t), t);
|
8
|
-
import { l as O, f as Ue } from "./takeUntil-CgZP1bze.mjs";
|
9
|
-
import { p as Tr, g as lt, h as ft, O as we } from "./Observable-wwWYwtkh.mjs";
|
10
|
-
import { J as $r, y as Ar, l as Ir, K as Or, h as Mr, e as X, L as S, N as _n } from "./v4-C78sE4Gb.mjs";
|
11
|
-
import { jsxs as nt, jsx as v } from "react/jsx-runtime";
|
12
|
-
import { forwardRef as rt } from "react";
|
13
|
-
var jr = Array.isArray;
|
14
|
-
function Rr(n) {
|
15
|
-
return n.length === 1 && jr(n[0]) ? n[0] : n;
|
16
|
-
}
|
17
|
-
function En() {
|
18
|
-
for (var n = [], e = 0; e < arguments.length; e++)
|
19
|
-
n[e] = arguments[e];
|
20
|
-
var t = $r(n);
|
21
|
-
return t ? Tr(En.apply(void 0, lt([], ft(n))), Ar(t)) : Ir(function(r, s) {
|
22
|
-
Or(lt([r], ft(Rr(n))))(s);
|
23
|
-
});
|
24
|
-
}
|
25
|
-
function kr() {
|
26
|
-
for (var n = [], e = 0; e < arguments.length; e++)
|
27
|
-
n[e] = arguments[e];
|
28
|
-
return En.apply(void 0, lt([], ft(n)));
|
29
|
-
}
|
30
|
-
const Cn = !(typeof navigator > "u") && navigator.product === "ReactNative", xn = { timeout: Cn ? 6e4 : 12e4 }, Lr = function(n) {
|
31
|
-
const e = { ...xn, ...typeof n == "string" ? { url: n } : n };
|
32
|
-
if (e.timeout = Sn(e.timeout), e.query) {
|
33
|
-
const { url: t, searchParams: r } = function(s) {
|
34
|
-
const i = s.indexOf("?");
|
35
|
-
if (i === -1) return { url: s, searchParams: new URLSearchParams() };
|
36
|
-
const o = s.slice(0, i), a = s.slice(i + 1);
|
37
|
-
if (!Cn) return { url: o, searchParams: new URLSearchParams(a) };
|
38
|
-
if (typeof decodeURIComponent != "function") throw new Error("Broken `URLSearchParams` implementation, and `decodeURIComponent` is not defined");
|
39
|
-
const c = new URLSearchParams();
|
40
|
-
for (const u of a.split("&")) {
|
41
|
-
const [g, d] = u.split("=");
|
42
|
-
g && c.append(Zt(g), Zt(d || ""));
|
43
|
-
}
|
44
|
-
return { url: o, searchParams: c };
|
45
|
-
}(e.url);
|
46
|
-
for (const [s, i] of Object.entries(e.query)) {
|
47
|
-
if (i !== void 0) if (Array.isArray(i)) for (const a of i) r.append(s, a);
|
48
|
-
else r.append(s, i);
|
49
|
-
const o = r.toString();
|
50
|
-
o && (e.url = `${t}?${o}`);
|
51
|
-
}
|
52
|
-
}
|
53
|
-
return e.method = e.body && !e.method ? "POST" : (e.method || "GET").toUpperCase(), e;
|
54
|
-
};
|
55
|
-
function Zt(n) {
|
56
|
-
return decodeURIComponent(n.replace(/\+/g, " "));
|
57
|
-
}
|
58
|
-
function Sn(n) {
|
59
|
-
if (n === !1 || n === 0) return !1;
|
60
|
-
if (n.connect || n.socket) return n;
|
61
|
-
const e = Number(n);
|
62
|
-
return isNaN(e) ? Sn(xn.timeout) : { connect: e, socket: e };
|
63
|
-
}
|
64
|
-
const qr = /^https?:\/\//i, Pr = function(n) {
|
65
|
-
if (!qr.test(n.url)) throw new Error(`"${n.url}" is not a valid URL`);
|
66
|
-
};
|
67
|
-
function Tn(n) {
|
68
|
-
return n && n.__esModule && Object.prototype.hasOwnProperty.call(n, "default") ? n.default : n;
|
69
|
-
}
|
70
|
-
const Dr = ["request", "response", "progress", "error", "abort"], Jt = ["processOptions", "validateOptions", "interceptRequest", "finalizeOptions", "onRequest", "onResponse", "onError", "onReturn", "onHeaders"];
|
71
|
-
function $n(n, e) {
|
72
|
-
const t = [], r = Jt.reduce((i, o) => (i[o] = i[o] || [], i), { processOptions: [Lr], validateOptions: [Pr] });
|
73
|
-
function s(i) {
|
74
|
-
const o = Dr.reduce((l, p) => (l[p] = /* @__PURE__ */ function() {
|
75
|
-
const f = /* @__PURE__ */ Object.create(null);
|
76
|
-
let m = 0;
|
77
|
-
return { publish: function(x) {
|
78
|
-
for (const w in f) f[w](x);
|
79
|
-
}, subscribe: function(x) {
|
80
|
-
const w = m++;
|
81
|
-
return f[w] = x, function() {
|
82
|
-
delete f[w];
|
83
|
-
};
|
84
|
-
} };
|
85
|
-
}(), l), {}), a = /* @__PURE__ */ ((l) => function(p, f, ...m) {
|
86
|
-
const x = p === "onError";
|
87
|
-
let w = f;
|
88
|
-
for (let E = 0; E < l[p].length && (w = (0, l[p][E])(w, ...m), !x || w); E++) ;
|
89
|
-
return w;
|
90
|
-
})(r), c = a("processOptions", i);
|
91
|
-
a("validateOptions", c);
|
92
|
-
const u = { options: c, channels: o, applyMiddleware: a };
|
93
|
-
let g;
|
94
|
-
const d = o.request.subscribe((l) => {
|
95
|
-
g = e(l, (p, f) => ((m, x, w) => {
|
96
|
-
let E = m, T = x;
|
97
|
-
if (!E) try {
|
98
|
-
T = a("onResponse", x, w);
|
99
|
-
} catch (M) {
|
100
|
-
T = null, E = M;
|
101
|
-
}
|
102
|
-
E = E && a("onError", E, w), E ? o.error.publish(E) : T && o.response.publish(T);
|
103
|
-
})(p, f, l));
|
104
|
-
});
|
105
|
-
o.abort.subscribe(() => {
|
106
|
-
d(), g && g.abort();
|
107
|
-
});
|
108
|
-
const h = a("onReturn", o, u);
|
109
|
-
return h === o && o.request.publish(u), h;
|
110
|
-
}
|
111
|
-
return s.use = function(i) {
|
112
|
-
if (!i) throw new Error("Tried to add middleware that resolved to falsey value");
|
113
|
-
if (typeof i == "function") throw new Error("Tried to add middleware that was a function. It probably expects you to pass options to it.");
|
114
|
-
if (i.onReturn && r.onReturn.length > 0) throw new Error("Tried to add new middleware with `onReturn` handler, but another handler has already been registered for this event");
|
115
|
-
return Jt.forEach((o) => {
|
116
|
-
i[o] && r[o].push(i[o]);
|
117
|
-
}), t.push(i), s;
|
118
|
-
}, s.clone = () => $n(t, e), n.forEach(s.use), s;
|
119
|
-
}
|
120
|
-
var Gt, Wt, Fr = /* @__PURE__ */ Tn(function() {
|
121
|
-
if (Wt) return Gt;
|
122
|
-
Wt = 1;
|
123
|
-
var n = function(e) {
|
124
|
-
return e.replace(/^\s+|\s+$/g, "");
|
125
|
-
};
|
126
|
-
return Gt = function(e) {
|
127
|
-
if (!e) return {};
|
128
|
-
for (var t = {}, r = n(e).split(`
|
129
|
-
`), s = 0; s < r.length; s++) {
|
130
|
-
var i = r[s], o = i.indexOf(":"), a = n(i.slice(0, o)).toLowerCase(), c = n(i.slice(o + 1));
|
131
|
-
typeof t[a] > "u" ? t[a] = c : (u = t[a], Object.prototype.toString.call(u) === "[object Array]" ? t[a].push(c) : t[a] = [t[a], c]);
|
132
|
-
}
|
133
|
-
var u;
|
134
|
-
return t;
|
135
|
-
};
|
136
|
-
}()), Ae, Ie, fe, Oe, H, Me, je, bn;
|
137
|
-
let pt = (bn = class {
|
138
|
-
constructor() {
|
139
|
-
b(this, "onabort");
|
140
|
-
b(this, "onerror");
|
141
|
-
b(this, "onreadystatechange");
|
142
|
-
b(this, "ontimeout");
|
143
|
-
b(this, "readyState", 0);
|
144
|
-
b(this, "response");
|
145
|
-
b(this, "responseText", "");
|
146
|
-
b(this, "responseType", "");
|
147
|
-
b(this, "status");
|
148
|
-
b(this, "statusText");
|
149
|
-
b(this, "withCredentials");
|
150
|
-
C(this, Ae);
|
151
|
-
C(this, Ie);
|
152
|
-
C(this, fe);
|
153
|
-
C(this, Oe, {});
|
154
|
-
C(this, H);
|
155
|
-
C(this, Me, {});
|
156
|
-
C(this, je);
|
157
|
-
}
|
158
|
-
open(e, t, r) {
|
159
|
-
var s;
|
160
|
-
_(this, Ae, e), _(this, Ie, t), _(this, fe, ""), this.readyState = 1, (s = this.onreadystatechange) == null || s.call(this), _(this, H, void 0);
|
161
|
-
}
|
162
|
-
abort() {
|
163
|
-
y(this, H) && y(this, H).abort();
|
164
|
-
}
|
165
|
-
getAllResponseHeaders() {
|
166
|
-
return y(this, fe);
|
167
|
-
}
|
168
|
-
setRequestHeader(e, t) {
|
169
|
-
y(this, Oe)[e] = t;
|
170
|
-
}
|
171
|
-
setInit(e, t = !0) {
|
172
|
-
_(this, Me, e), _(this, je, t);
|
173
|
-
}
|
174
|
-
send(e) {
|
175
|
-
const t = this.responseType !== "arraybuffer", r = { ...y(this, Me), method: y(this, Ae), headers: y(this, Oe), body: e };
|
176
|
-
typeof AbortController == "function" && y(this, je) && (_(this, H, new AbortController()), typeof EventTarget < "u" && y(this, H).signal instanceof EventTarget && (r.signal = y(this, H).signal)), typeof document < "u" && (r.credentials = this.withCredentials ? "include" : "omit"), fetch(y(this, Ie), r).then((s) => {
|
177
|
-
var i;
|
178
|
-
return s.headers.forEach((o, a) => {
|
179
|
-
_(this, fe, y(this, fe) + `${a}: ${o}\r
|
180
|
-
`);
|
181
|
-
}), this.status = s.status, this.statusText = s.statusText, this.readyState = 3, (i = this.onreadystatechange) == null || i.call(this), t ? s.text() : s.arrayBuffer();
|
182
|
-
}).then((s) => {
|
183
|
-
var i;
|
184
|
-
typeof s == "string" ? this.responseText = s : this.response = s, this.readyState = 4, (i = this.onreadystatechange) == null || i.call(this);
|
185
|
-
}).catch((s) => {
|
186
|
-
var i, o;
|
187
|
-
s.name !== "AbortError" ? (i = this.onerror) == null || i.call(this, s) : (o = this.onabort) == null || o.call(this);
|
188
|
-
});
|
189
|
-
}
|
190
|
-
}, Ae = new WeakMap(), Ie = new WeakMap(), fe = new WeakMap(), Oe = new WeakMap(), H = new WeakMap(), Me = new WeakMap(), je = new WeakMap(), bn);
|
191
|
-
const yt = typeof XMLHttpRequest == "function" ? "xhr" : "fetch", Hr = yt === "xhr" ? XMLHttpRequest : pt, Ur = (n, e) => {
|
192
|
-
const t = n.options, r = n.applyMiddleware("finalizeOptions", t), s = {}, i = n.applyMiddleware("interceptRequest", void 0, { adapter: yt, context: n });
|
193
|
-
if (i) {
|
194
|
-
const f = setTimeout(e, 0, null, i);
|
195
|
-
return { abort: () => clearTimeout(f) };
|
196
|
-
}
|
197
|
-
let o = new Hr();
|
198
|
-
o instanceof pt && typeof r.fetch == "object" && o.setInit(r.fetch, r.useAbortSignal ?? !0);
|
199
|
-
const a = r.headers, c = r.timeout;
|
200
|
-
let u = !1, g = !1, d = !1;
|
201
|
-
if (o.onerror = (f) => {
|
202
|
-
p(o instanceof pt ? f instanceof Error ? f : new Error(`Request error while attempting to reach is ${r.url}`, { cause: f }) : new Error(`Request error while attempting to reach is ${r.url}${f.lengthComputable ? `(${f.loaded} of ${f.total} bytes transferred)` : ""}`));
|
203
|
-
}, o.ontimeout = (f) => {
|
204
|
-
p(new Error(`Request timeout while attempting to reach ${r.url}${f.lengthComputable ? `(${f.loaded} of ${f.total} bytes transferred)` : ""}`));
|
205
|
-
}, o.onabort = () => {
|
206
|
-
l(!0), u = !0;
|
207
|
-
}, o.onreadystatechange = () => {
|
208
|
-
c && (l(), s.socket = setTimeout(() => h("ESOCKETTIMEDOUT"), c.socket)), !u && o.readyState === 4 && o.status !== 0 && function() {
|
209
|
-
if (!(u || g || d)) {
|
210
|
-
if (o.status === 0) return void p(new Error("Unknown XHR error"));
|
211
|
-
l(), g = !0, e(null, { body: o.response || (o.responseType === "" || o.responseType === "text" ? o.responseText : ""), url: r.url, method: r.method, headers: Fr(o.getAllResponseHeaders()), statusCode: o.status, statusMessage: o.statusText });
|
212
|
-
}
|
213
|
-
}();
|
214
|
-
}, o.open(r.method, r.url, !0), o.withCredentials = !!r.withCredentials, a && o.setRequestHeader) for (const f in a) a.hasOwnProperty(f) && o.setRequestHeader(f, a[f]);
|
215
|
-
return r.rawBody && (o.responseType = "arraybuffer"), n.applyMiddleware("onRequest", { options: r, adapter: yt, request: o, context: n }), o.send(r.body || null), c && (s.connect = setTimeout(() => h("ETIMEDOUT"), c.connect)), { abort: function() {
|
216
|
-
u = !0, o && o.abort();
|
217
|
-
} };
|
218
|
-
function h(f) {
|
219
|
-
d = !0, o.abort();
|
220
|
-
const m = new Error(f === "ESOCKETTIMEDOUT" ? `Socket timed out on request to ${r.url}` : `Connection timed out on request to ${r.url}`);
|
221
|
-
m.code = f, n.channels.error.publish(m);
|
222
|
-
}
|
223
|
-
function l(f) {
|
224
|
-
(f || u || o.readyState >= 2 && s.connect) && clearTimeout(s.connect), s.socket && clearTimeout(s.socket);
|
225
|
-
}
|
226
|
-
function p(f) {
|
227
|
-
if (g) return;
|
228
|
-
l(!0), g = !0, o = null;
|
229
|
-
const m = f || new Error(`Network error while attempting to reach ${r.url}`);
|
230
|
-
m.isNetworkError = !0, m.request = r, e(m);
|
231
|
-
}
|
232
|
-
}, Vr = (n = [], e = Ur) => $n(n, e);
|
233
|
-
var Br = {}, Xt, Yt, Qt, Kt, en, ct = { exports: {} };
|
234
|
-
en || (en = 1, function(n, e) {
|
235
|
-
e.formatArgs = function(r) {
|
236
|
-
if (r[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + r[0] + (this.useColors ? "%c " : " ") + "+" + n.exports.humanize(this.diff), !this.useColors) return;
|
237
|
-
const s = "color: " + this.color;
|
238
|
-
r.splice(1, 0, s, "color: inherit");
|
239
|
-
let i = 0, o = 0;
|
240
|
-
r[0].replace(/%[a-zA-Z%]/g, (a) => {
|
241
|
-
a !== "%%" && (i++, a === "%c" && (o = i));
|
242
|
-
}), r.splice(o, 0, s);
|
243
|
-
}, e.save = function(r) {
|
244
|
-
try {
|
245
|
-
r ? e.storage.setItem("debug", r) : e.storage.removeItem("debug");
|
246
|
-
} catch {
|
247
|
-
}
|
248
|
-
}, e.load = function() {
|
249
|
-
let r;
|
250
|
-
try {
|
251
|
-
r = e.storage.getItem("debug");
|
252
|
-
} catch {
|
253
|
-
}
|
254
|
-
return !r && typeof process < "u" && "env" in process && (r = Br.DEBUG), r;
|
255
|
-
}, e.useColors = function() {
|
256
|
-
return !(!(typeof window < "u" && window.process) || window.process.type !== "renderer" && !window.process.__nwjs) || !(typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) && (typeof document < "u" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window < "u" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator < "u" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/));
|
257
|
-
}, e.storage = function() {
|
258
|
-
try {
|
259
|
-
return localStorage;
|
260
|
-
} catch {
|
261
|
-
}
|
262
|
-
}(), e.destroy = /* @__PURE__ */ (() => {
|
263
|
-
let r = !1;
|
264
|
-
return () => {
|
265
|
-
r || (r = !0, console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."));
|
266
|
-
};
|
267
|
-
})(), e.colors = ["#0000CC", "#0000FF", "#0033CC", "#0033FF", "#0066CC", "#0066FF", "#0099CC", "#0099FF", "#00CC00", "#00CC33", "#00CC66", "#00CC99", "#00CCCC", "#00CCFF", "#3300CC", "#3300FF", "#3333CC", "#3333FF", "#3366CC", "#3366FF", "#3399CC", "#3399FF", "#33CC00", "#33CC33", "#33CC66", "#33CC99", "#33CCCC", "#33CCFF", "#6600CC", "#6600FF", "#6633CC", "#6633FF", "#66CC00", "#66CC33", "#9900CC", "#9900FF", "#9933CC", "#9933FF", "#99CC00", "#99CC33", "#CC0000", "#CC0033", "#CC0066", "#CC0099", "#CC00CC", "#CC00FF", "#CC3300", "#CC3333", "#CC3366", "#CC3399", "#CC33CC", "#CC33FF", "#CC6600", "#CC6633", "#CC9900", "#CC9933", "#CCCC00", "#CCCC33", "#FF0000", "#FF0033", "#FF0066", "#FF0099", "#FF00CC", "#FF00FF", "#FF3300", "#FF3333", "#FF3366", "#FF3399", "#FF33CC", "#FF33FF", "#FF6600", "#FF6633", "#FF9900", "#FF9933", "#FFCC00", "#FFCC33"], e.log = console.debug || console.log || (() => {
|
268
|
-
}), n.exports = (Kt ? Qt : (Kt = 1, Qt = function(r) {
|
269
|
-
function s(a) {
|
270
|
-
let c, u, g, d = null;
|
271
|
-
function h(...l) {
|
272
|
-
if (!h.enabled) return;
|
273
|
-
const p = h, f = Number(/* @__PURE__ */ new Date()), m = f - (c || f);
|
274
|
-
p.diff = m, p.prev = c, p.curr = f, c = f, l[0] = s.coerce(l[0]), typeof l[0] != "string" && l.unshift("%O");
|
275
|
-
let x = 0;
|
276
|
-
l[0] = l[0].replace(/%([a-zA-Z%])/g, (w, E) => {
|
277
|
-
if (w === "%%") return "%";
|
278
|
-
x++;
|
279
|
-
const T = s.formatters[E];
|
280
|
-
if (typeof T == "function") {
|
281
|
-
const M = l[x];
|
282
|
-
w = T.call(p, M), l.splice(x, 1), x--;
|
283
|
-
}
|
284
|
-
return w;
|
285
|
-
}), s.formatArgs.call(p, l), (p.log || s.log).apply(p, l);
|
286
|
-
}
|
287
|
-
return h.namespace = a, h.useColors = s.useColors(), h.color = s.selectColor(a), h.extend = i, h.destroy = s.destroy, Object.defineProperty(h, "enabled", { enumerable: !0, configurable: !1, get: () => d !== null ? d : (u !== s.namespaces && (u = s.namespaces, g = s.enabled(a)), g), set: (l) => {
|
288
|
-
d = l;
|
289
|
-
} }), typeof s.init == "function" && s.init(h), h;
|
290
|
-
}
|
291
|
-
function i(a, c) {
|
292
|
-
const u = s(this.namespace + (typeof c > "u" ? ":" : c) + a);
|
293
|
-
return u.log = this.log, u;
|
294
|
-
}
|
295
|
-
function o(a) {
|
296
|
-
return a.toString().substring(2, a.toString().length - 2).replace(/\.\*\?$/, "*");
|
297
|
-
}
|
298
|
-
return s.debug = s, s.default = s, s.coerce = function(a) {
|
299
|
-
return a instanceof Error ? a.stack || a.message : a;
|
300
|
-
}, s.disable = function() {
|
301
|
-
const a = [...s.names.map(o), ...s.skips.map(o).map((c) => "-" + c)].join(",");
|
302
|
-
return s.enable(""), a;
|
303
|
-
}, s.enable = function(a) {
|
304
|
-
let c;
|
305
|
-
s.save(a), s.namespaces = a, s.names = [], s.skips = [];
|
306
|
-
const u = (typeof a == "string" ? a : "").split(/[\s,]+/), g = u.length;
|
307
|
-
for (c = 0; c < g; c++) u[c] && ((a = u[c].replace(/\*/g, ".*?"))[0] === "-" ? s.skips.push(new RegExp("^" + a.slice(1) + "$")) : s.names.push(new RegExp("^" + a + "$")));
|
308
|
-
}, s.enabled = function(a) {
|
309
|
-
if (a[a.length - 1] === "*") return !0;
|
310
|
-
let c, u;
|
311
|
-
for (c = 0, u = s.skips.length; c < u; c++) if (s.skips[c].test(a)) return !1;
|
312
|
-
for (c = 0, u = s.names.length; c < u; c++) if (s.names[c].test(a)) return !0;
|
313
|
-
return !1;
|
314
|
-
}, s.humanize = function() {
|
315
|
-
if (Yt) return Xt;
|
316
|
-
Yt = 1;
|
317
|
-
var a = 1e3, c = 60 * a, u = 60 * c, g = 24 * u, d = 7 * g;
|
318
|
-
function h(l, p, f, m) {
|
319
|
-
var x = p >= 1.5 * f;
|
320
|
-
return Math.round(l / f) + " " + m + (x ? "s" : "");
|
321
|
-
}
|
322
|
-
return Xt = function(l, p) {
|
323
|
-
p = p || {};
|
324
|
-
var f, m, x = typeof l;
|
325
|
-
if (x === "string" && l.length > 0) return function(w) {
|
326
|
-
if (!((w = String(w)).length > 100)) {
|
327
|
-
var E = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(w);
|
328
|
-
if (E) {
|
329
|
-
var T = parseFloat(E[1]);
|
330
|
-
switch ((E[2] || "ms").toLowerCase()) {
|
331
|
-
case "years":
|
332
|
-
case "year":
|
333
|
-
case "yrs":
|
334
|
-
case "yr":
|
335
|
-
case "y":
|
336
|
-
return 315576e5 * T;
|
337
|
-
case "weeks":
|
338
|
-
case "week":
|
339
|
-
case "w":
|
340
|
-
return T * d;
|
341
|
-
case "days":
|
342
|
-
case "day":
|
343
|
-
case "d":
|
344
|
-
return T * g;
|
345
|
-
case "hours":
|
346
|
-
case "hour":
|
347
|
-
case "hrs":
|
348
|
-
case "hr":
|
349
|
-
case "h":
|
350
|
-
return T * u;
|
351
|
-
case "minutes":
|
352
|
-
case "minute":
|
353
|
-
case "mins":
|
354
|
-
case "min":
|
355
|
-
case "m":
|
356
|
-
return T * c;
|
357
|
-
case "seconds":
|
358
|
-
case "second":
|
359
|
-
case "secs":
|
360
|
-
case "sec":
|
361
|
-
case "s":
|
362
|
-
return T * a;
|
363
|
-
case "milliseconds":
|
364
|
-
case "millisecond":
|
365
|
-
case "msecs":
|
366
|
-
case "msec":
|
367
|
-
case "ms":
|
368
|
-
return T;
|
369
|
-
default:
|
370
|
-
return;
|
371
|
-
}
|
372
|
-
}
|
373
|
-
}
|
374
|
-
}(l);
|
375
|
-
if (x === "number" && isFinite(l)) return p.long ? (f = l, (m = Math.abs(f)) >= g ? h(f, m, g, "day") : m >= u ? h(f, m, u, "hour") : m >= c ? h(f, m, c, "minute") : m >= a ? h(f, m, a, "second") : f + " ms") : function(w) {
|
376
|
-
var E = Math.abs(w);
|
377
|
-
return E >= g ? Math.round(w / g) + "d" : E >= u ? Math.round(w / u) + "h" : E >= c ? Math.round(w / c) + "m" : E >= a ? Math.round(w / a) + "s" : w + "ms";
|
378
|
-
}(l);
|
379
|
-
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(l));
|
380
|
-
};
|
381
|
-
}(), s.destroy = function() {
|
382
|
-
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
383
|
-
}, Object.keys(r).forEach((a) => {
|
384
|
-
s[a] = r[a];
|
385
|
-
}), s.names = [], s.skips = [], s.formatters = {}, s.selectColor = function(a) {
|
386
|
-
let c = 0;
|
387
|
-
for (let u = 0; u < a.length; u++) c = (c << 5) - c + a.charCodeAt(u), c |= 0;
|
388
|
-
return s.colors[Math.abs(c) % s.colors.length];
|
389
|
-
}, s.enable(s.load()), s;
|
390
|
-
}))(e);
|
391
|
-
const { formatters: t } = n.exports;
|
392
|
-
t.j = function(r) {
|
393
|
-
try {
|
394
|
-
return JSON.stringify(r);
|
395
|
-
} catch (s) {
|
396
|
-
return "[UnexpectedJSONParseError]: " + s.message;
|
397
|
-
}
|
398
|
-
};
|
399
|
-
}(ct, ct.exports)), ct.exports;
|
400
|
-
const Nr = typeof Buffer > "u" ? () => !1 : (n) => Buffer.isBuffer(n);
|
401
|
-
function tn(n) {
|
402
|
-
return Object.prototype.toString.call(n) === "[object Object]";
|
403
|
-
}
|
404
|
-
function zr(n) {
|
405
|
-
if (tn(n) === !1) return !1;
|
406
|
-
const e = n.constructor;
|
407
|
-
if (e === void 0) return !0;
|
408
|
-
const t = e.prototype;
|
409
|
-
return !(tn(t) === !1 || t.hasOwnProperty("isPrototypeOf") === !1);
|
410
|
-
}
|
411
|
-
const Zr = ["boolean", "string", "number"];
|
412
|
-
function Jr() {
|
413
|
-
return { processOptions: (n) => {
|
414
|
-
const e = n.body;
|
415
|
-
return !e || typeof e.pipe == "function" || Nr(e) || Zr.indexOf(typeof e) === -1 && !Array.isArray(e) && !zr(e) ? n : Object.assign({}, n, { body: JSON.stringify(n.body), headers: Object.assign({}, n.headers, { "Content-Type": "application/json" }) });
|
416
|
-
} };
|
417
|
-
}
|
418
|
-
function Gr(n) {
|
419
|
-
return { onResponse: (t) => {
|
420
|
-
const r = t.headers["content-type"] || "", s = n && n.force || r.indexOf("application/json") !== -1;
|
421
|
-
return t.body && r && s ? Object.assign({}, t, { body: e(t.body) }) : t;
|
422
|
-
}, processOptions: (t) => Object.assign({}, t, { headers: Object.assign({ Accept: "application/json" }, t.headers) }) };
|
423
|
-
function e(t) {
|
424
|
-
try {
|
425
|
-
return JSON.parse(t);
|
426
|
-
} catch (r) {
|
427
|
-
throw r.message = `Failed to parsed response body as JSON: ${r.message}`, r;
|
428
|
-
}
|
429
|
-
}
|
430
|
-
}
|
431
|
-
let xe = {};
|
432
|
-
typeof globalThis < "u" ? xe = globalThis : typeof window < "u" ? xe = window : typeof global < "u" ? xe = global : typeof self < "u" && (xe = self);
|
433
|
-
var Wr = xe;
|
434
|
-
function Xr(n = {}) {
|
435
|
-
const e = n.implementation || Wr.Observable;
|
436
|
-
if (!e) throw new Error("`Observable` is not available in global scope, and no implementation was passed");
|
437
|
-
return { onReturn: (t, r) => new e((s) => (t.error.subscribe((i) => s.error(i)), t.progress.subscribe((i) => s.next(Object.assign({ type: "progress" }, i))), t.response.subscribe((i) => {
|
438
|
-
s.next(Object.assign({ type: "response" }, i)), s.complete();
|
439
|
-
}), t.request.publish(r), () => t.abort.publish())) };
|
440
|
-
}
|
441
|
-
function Yr() {
|
442
|
-
return { onRequest: (n) => {
|
443
|
-
if (n.adapter !== "xhr") return;
|
444
|
-
const e = n.request, t = n.context;
|
445
|
-
function r(s) {
|
446
|
-
return (i) => {
|
447
|
-
const o = i.lengthComputable ? i.loaded / i.total * 100 : -1;
|
448
|
-
t.channels.progress.publish({ stage: s, percent: o, total: i.total, loaded: i.loaded, lengthComputable: i.lengthComputable });
|
449
|
-
};
|
450
|
-
}
|
451
|
-
"upload" in e && "onprogress" in e.upload && (e.upload.onprogress = r("upload")), "onprogress" in e && (e.onprogress = r("download"));
|
452
|
-
} };
|
453
|
-
}
|
454
|
-
var An = (n, e, t) => (t.method === "GET" || t.method === "HEAD") && (n.isNetworkError || !1);
|
455
|
-
function Qr(n) {
|
456
|
-
return 100 * Math.pow(2, n) + 100 * Math.random();
|
457
|
-
}
|
458
|
-
const xt = (n = {}) => ((e) => {
|
459
|
-
const t = e.maxRetries || 5, r = e.retryDelay || Qr, s = e.shouldRetry;
|
460
|
-
return { onError: (i, o) => {
|
461
|
-
const a = o.options, c = a.maxRetries || t, u = a.retryDelay || r, g = a.shouldRetry || s, d = a.attemptNumber || 0;
|
462
|
-
if ((h = a.body) !== null && typeof h == "object" && typeof h.pipe == "function" || !g(i, d, a) || d >= c) return i;
|
463
|
-
var h;
|
464
|
-
const l = Object.assign({}, o, { options: Object.assign({}, a, { attemptNumber: d + 1 }) });
|
465
|
-
return setTimeout(() => o.channels.request.publish(l), u(d)), null;
|
466
|
-
} };
|
467
|
-
})({ shouldRetry: An, ...n });
|
468
|
-
xt.shouldRetry = An;
|
469
|
-
var In = { 0: 8203, 1: 8204, 2: 8205, 3: 8290, 4: 8291, 5: 8288, 6: 65279, 7: 8289, 8: 119155, 9: 119156, a: 119157, b: 119158, c: 119159, d: 119160, e: 119161, f: 119162 }, St = { 0: 8203, 1: 8204, 2: 8205, 3: 65279 }, Kr = new Array(4).fill(String.fromCodePoint(St[0])).join("");
|
470
|
-
function es(n) {
|
471
|
-
let e = JSON.stringify(n);
|
472
|
-
return `${Kr}${Array.from(e).map((t) => {
|
473
|
-
let r = t.charCodeAt(0);
|
474
|
-
if (r > 255) throw new Error(`Only ASCII edit info can be encoded. Error attempting to encode ${e} on character ${t} (${r})`);
|
475
|
-
return Array.from(r.toString(4).padStart(4, "0")).map((s) => String.fromCodePoint(St[s])).join("");
|
476
|
-
}).join("")}`;
|
477
|
-
}
|
478
|
-
function ts(n) {
|
479
|
-
return !Number.isNaN(Number(n)) || /[a-z]/i.test(n) && !/\d+(?:[-:\/]\d+){2}(?:T\d+(?:[-:\/]\d+){1,2}(\.\d+)?Z?)?/.test(n) ? !1 : !!Date.parse(n);
|
480
|
-
}
|
481
|
-
function ns(n) {
|
482
|
-
try {
|
483
|
-
new URL(n, n.startsWith("/") ? "https://acme.com" : void 0);
|
484
|
-
} catch {
|
485
|
-
return !1;
|
486
|
-
}
|
487
|
-
return !0;
|
488
|
-
}
|
489
|
-
function Oo(n, e, t = "auto") {
|
490
|
-
return t === !0 || t === "auto" && (ts(n) || ns(n)) ? n : `${n}${es(e)}`;
|
491
|
-
}
|
492
|
-
Object.fromEntries(Object.entries(St).map((n) => n.reverse()));
|
493
|
-
Object.fromEntries(Object.entries(In).map((n) => n.reverse()));
|
494
|
-
var rs = `${Object.values(In).map((n) => `\\u{${n.toString(16)}}`).join("")}`, nn = new RegExp(`[${rs}]{4,}`, "gu");
|
495
|
-
function ss(n) {
|
496
|
-
var e;
|
497
|
-
return { cleaned: n.replace(nn, ""), encoded: ((e = n.match(nn)) == null ? void 0 : e[0]) || "" };
|
498
|
-
}
|
499
|
-
function is(n) {
|
500
|
-
return n && JSON.parse(ss(JSON.stringify(n)).cleaned);
|
501
|
-
}
|
502
|
-
function os(n) {
|
503
|
-
return is(n);
|
504
|
-
}
|
505
|
-
class as extends Error {
|
506
|
-
constructor(t) {
|
507
|
-
const r = On(t);
|
508
|
-
super(r.message);
|
509
|
-
b(this, "response");
|
510
|
-
b(this, "statusCode", 400);
|
511
|
-
b(this, "responseBody");
|
512
|
-
b(this, "details");
|
513
|
-
Object.assign(this, r);
|
514
|
-
}
|
515
|
-
}
|
516
|
-
class cs extends Error {
|
517
|
-
constructor(t) {
|
518
|
-
const r = On(t);
|
519
|
-
super(r.message);
|
520
|
-
b(this, "response");
|
521
|
-
b(this, "statusCode", 500);
|
522
|
-
b(this, "responseBody");
|
523
|
-
b(this, "details");
|
524
|
-
Object.assign(this, r);
|
525
|
-
}
|
526
|
-
}
|
527
|
-
function On(n) {
|
528
|
-
const e = n.body, t = {
|
529
|
-
response: n,
|
530
|
-
statusCode: n.statusCode,
|
531
|
-
responseBody: ls(e, n),
|
532
|
-
message: "",
|
533
|
-
details: void 0
|
534
|
-
};
|
535
|
-
if (e.error && e.message)
|
536
|
-
return t.message = `${e.error} - ${e.message}`, t;
|
537
|
-
if (us(e) || ds(e)) {
|
538
|
-
const r = e.error.items || [], s = r.slice(0, 5).map((o) => {
|
539
|
-
var a;
|
540
|
-
return (a = o.error) == null ? void 0 : a.description;
|
541
|
-
}).filter(Boolean);
|
542
|
-
let i = s.length ? `:
|
543
|
-
- ${s.join(`
|
544
|
-
- `)}` : "";
|
545
|
-
return r.length > 5 && (i += `
|
546
|
-
...and ${r.length - 5} more`), t.message = `${e.error.description}${i}`, t.details = e.error, t;
|
547
|
-
}
|
548
|
-
return e.error && e.error.description ? (t.message = e.error.description, t.details = e.error, t) : (t.message = e.error || e.message || hs(n), t);
|
549
|
-
}
|
550
|
-
function us(n) {
|
551
|
-
return Ze(n) && Ze(n.error) && n.error.type === "mutationError" && typeof n.error.description == "string";
|
552
|
-
}
|
553
|
-
function ds(n) {
|
554
|
-
return Ze(n) && Ze(n.error) && n.error.type === "actionError" && typeof n.error.description == "string";
|
555
|
-
}
|
556
|
-
function Ze(n) {
|
557
|
-
return typeof n == "object" && n !== null && !Array.isArray(n);
|
558
|
-
}
|
559
|
-
function hs(n) {
|
560
|
-
const e = n.statusMessage ? ` ${n.statusMessage}` : "";
|
561
|
-
return `${n.method}-request to ${n.url} resulted in HTTP ${n.statusCode}${e}`;
|
562
|
-
}
|
563
|
-
function ls(n, e) {
|
564
|
-
return (e.headers["content-type"] || "").toLowerCase().indexOf("application/json") !== -1 ? JSON.stringify(n, null, 2) : n;
|
565
|
-
}
|
566
|
-
class fs extends Error {
|
567
|
-
constructor({ projectId: t }) {
|
568
|
-
super("CorsOriginError");
|
569
|
-
b(this, "projectId");
|
570
|
-
b(this, "addOriginUrl");
|
571
|
-
this.name = "CorsOriginError", this.projectId = t;
|
572
|
-
const r = new URL(`https://sanity.io/manage/project/${t}/api`);
|
573
|
-
if (typeof location < "u") {
|
574
|
-
const { origin: s } = location;
|
575
|
-
r.searchParams.set("cors", "add"), r.searchParams.set("origin", s), this.addOriginUrl = r, this.message = `The current origin is not allowed to connect to the Live Content API. Add it here: ${r}`;
|
576
|
-
} else
|
577
|
-
this.message = `The current origin is not allowed to connect to the Live Content API. Change your configuration here: ${r}`;
|
578
|
-
}
|
579
|
-
}
|
580
|
-
const ps = {
|
581
|
-
onResponse: (n) => {
|
582
|
-
if (n.statusCode >= 500)
|
583
|
-
throw new cs(n);
|
584
|
-
if (n.statusCode >= 400)
|
585
|
-
throw new as(n);
|
586
|
-
return n;
|
587
|
-
}
|
588
|
-
}, ys = {
|
589
|
-
onResponse: (n) => {
|
590
|
-
const e = n.headers["x-sanity-warning"];
|
591
|
-
return (Array.isArray(e) ? e : [e]).filter(Boolean).forEach((t) => console.warn(t)), n;
|
592
|
-
}
|
593
|
-
};
|
594
|
-
function gs(n) {
|
595
|
-
return Vr([
|
596
|
-
xt({ shouldRetry: ms }),
|
597
|
-
...n,
|
598
|
-
ys,
|
599
|
-
Jr(),
|
600
|
-
Gr(),
|
601
|
-
Yr(),
|
602
|
-
ps,
|
603
|
-
Xr({ implementation: we })
|
604
|
-
]);
|
605
|
-
}
|
606
|
-
function ms(n, e, t) {
|
607
|
-
if (t.maxRetries === 0) return !1;
|
608
|
-
const r = t.method === "GET" || t.method === "HEAD", s = (t.uri || t.url).startsWith("/data/query"), i = n.response && (n.response.statusCode === 429 || n.response.statusCode === 502 || n.response.statusCode === 503);
|
609
|
-
return (r || s) && i ? !0 : xt.shouldRetry(n, e, t);
|
610
|
-
}
|
611
|
-
const ws = "https://www.sanity.io/help/";
|
612
|
-
function Tt(n) {
|
613
|
-
return ws + n;
|
614
|
-
}
|
615
|
-
const rn = ["image", "file"], sn = ["before", "after", "replace"], Mn = (n) => {
|
616
|
-
if (!/^(~[a-z0-9]{1}[-\w]{0,63}|[a-z0-9]{1}[-\w]{0,63})$/.test(n))
|
617
|
-
throw new Error(
|
618
|
-
"Datasets can only contain lowercase characters, numbers, underscores and dashes, and start with tilde, and be maximum 64 characters"
|
619
|
-
);
|
620
|
-
}, vs = (n) => {
|
621
|
-
if (!/^[-a-z0-9]+$/i.test(n))
|
622
|
-
throw new Error("`projectId` can only contain only a-z, 0-9 and dashes");
|
623
|
-
}, bs = (n) => {
|
624
|
-
if (rn.indexOf(n) === -1)
|
625
|
-
throw new Error(`Invalid asset type: ${n}. Must be one of ${rn.join(", ")}`);
|
626
|
-
}, Se = (n, e) => {
|
627
|
-
if (e === null || typeof e != "object" || Array.isArray(e))
|
628
|
-
throw new Error(`${n}() takes an object of properties`);
|
629
|
-
}, jn = (n, e) => {
|
630
|
-
if (typeof e != "string" || !/^[a-z0-9_][a-z0-9_.-]{0,127}$/i.test(e) || e.includes(".."))
|
631
|
-
throw new Error(`${n}(): "${e}" is not a valid document ID`);
|
632
|
-
}, Je = (n, e) => {
|
633
|
-
if (!e._id)
|
634
|
-
throw new Error(`${n}() requires that the document contains an ID ("_id" property)`);
|
635
|
-
jn(n, e._id);
|
636
|
-
}, _s = (n, e, t) => {
|
637
|
-
const r = "insert(at, selector, items)";
|
638
|
-
if (sn.indexOf(n) === -1) {
|
639
|
-
const s = sn.map((i) => `"${i}"`).join(", ");
|
640
|
-
throw new Error(`${r} takes an "at"-argument which is one of: ${s}`);
|
641
|
-
}
|
642
|
-
if (typeof e != "string")
|
643
|
-
throw new Error(`${r} takes a "selector"-argument which must be a string`);
|
644
|
-
if (!Array.isArray(t))
|
645
|
-
throw new Error(`${r} takes an "items"-argument which must be an array`);
|
646
|
-
}, Rn = (n) => {
|
647
|
-
if (!n.dataset)
|
648
|
-
throw new Error("`dataset` must be provided to perform queries");
|
649
|
-
return n.dataset || "";
|
650
|
-
}, kn = (n) => {
|
651
|
-
if (typeof n != "string" || !/^[a-z0-9._-]{1,75}$/i.test(n))
|
652
|
-
throw new Error(
|
653
|
-
"Tag can only contain alphanumeric characters, underscores, dashes and dots, and be between one and 75 characters long."
|
654
|
-
);
|
655
|
-
return n;
|
656
|
-
};
|
657
|
-
function Es(n) {
|
658
|
-
let e = !1, t;
|
659
|
-
return (...r) => (e || (t = n(...r), e = !0), t);
|
660
|
-
}
|
661
|
-
const Ve = (n) => (
|
662
|
-
// eslint-disable-next-line no-console
|
663
|
-
Es((...e) => console.warn(n.join(" "), ...e))
|
664
|
-
), Cs = Ve([
|
665
|
-
"Because you set `withCredentials` to true, we will override your `useCdn`",
|
666
|
-
"setting to be false since (cookie-based) credentials are never set on the CDN"
|
667
|
-
]), xs = Ve([
|
668
|
-
"Since you haven't set a value for `useCdn`, we will deliver content using our",
|
669
|
-
"global, edge-cached API-CDN. If you wish to have content delivered faster, set",
|
670
|
-
"`useCdn: false` to use the Live API. Note: You may incur higher costs using the live API."
|
671
|
-
]), Ss = Ve([
|
672
|
-
"The Sanity client is configured with the `perspective` set to `previewDrafts`, which doesn't support the API-CDN.",
|
673
|
-
"The Live API will be used instead. Set `useCdn: false` in your configuration to hide this warning."
|
674
|
-
]), Ts = Ve([
|
675
|
-
"You have configured Sanity client to use a token in the browser. This may cause unintentional security issues.",
|
676
|
-
`See ${Tt(
|
677
|
-
"js-client-browser-token"
|
678
|
-
)} for more information and how to hide this warning.`
|
679
|
-
]), $s = Ve([
|
680
|
-
"Using the Sanity client without specifying an API version is deprecated.",
|
681
|
-
`See ${Tt("js-client-api-version")}`
|
682
|
-
]), As = "apicdn.sanity.io", Te = {
|
683
|
-
apiHost: "https://api.sanity.io",
|
684
|
-
apiVersion: "1",
|
685
|
-
useProjectHostname: !0,
|
686
|
-
stega: { enabled: !1 }
|
687
|
-
}, Is = ["localhost", "127.0.0.1", "0.0.0.0"], Os = (n) => Is.indexOf(n) !== -1;
|
688
|
-
function Ms(n) {
|
689
|
-
if (n === "1" || n === "X")
|
690
|
-
return;
|
691
|
-
const e = new Date(n);
|
692
|
-
if (!(/^\d{4}-\d{2}-\d{2}$/.test(n) && e instanceof Date && e.getTime() > 0))
|
693
|
-
throw new Error("Invalid API version string, expected `1` or date in format `YYYY-MM-DD`");
|
694
|
-
}
|
695
|
-
function Ln(n) {
|
696
|
-
if (Array.isArray(n)) {
|
697
|
-
for (const e of n)
|
698
|
-
if (e !== "published" && e !== "drafts" && !(typeof e == "string" && e.startsWith("r") && e !== "raw"))
|
699
|
-
throw new TypeError(
|
700
|
-
"Invalid API perspective value, expected `published`, `drafts` or a valid release identifier string"
|
701
|
-
);
|
702
|
-
return;
|
703
|
-
}
|
704
|
-
switch (n) {
|
705
|
-
case "previewDrafts":
|
706
|
-
case "drafts":
|
707
|
-
case "published":
|
708
|
-
case "raw":
|
709
|
-
return;
|
710
|
-
default:
|
711
|
-
throw new TypeError(
|
712
|
-
"Invalid API perspective string, expected `published`, `previewDrafts` or `raw`"
|
713
|
-
);
|
714
|
-
}
|
715
|
-
}
|
716
|
-
const qn = (n, e) => {
|
717
|
-
const t = {
|
718
|
-
...e,
|
719
|
-
...n,
|
720
|
-
stega: {
|
721
|
-
...typeof e.stega == "boolean" ? { enabled: e.stega } : e.stega || Te.stega,
|
722
|
-
...typeof n.stega == "boolean" ? { enabled: n.stega } : n.stega || {}
|
723
|
-
}
|
724
|
-
};
|
725
|
-
t.apiVersion || $s();
|
726
|
-
const r = {
|
727
|
-
...Te,
|
728
|
-
...t
|
729
|
-
}, s = r.useProjectHostname;
|
730
|
-
if (typeof Promise > "u") {
|
731
|
-
const d = Tt("js-client-promise-polyfill");
|
732
|
-
throw new Error(`No native Promise-implementation found, polyfill needed - see ${d}`);
|
733
|
-
}
|
734
|
-
if (s && !r.projectId)
|
735
|
-
throw new Error("Configuration must contain `projectId`");
|
736
|
-
if (typeof r.perspective < "u" && Ln(r.perspective), "encodeSourceMap" in r)
|
737
|
-
throw new Error(
|
738
|
-
"It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMap' is not supported in '@sanity/client'. Did you mean 'stega.enabled'?"
|
739
|
-
);
|
740
|
-
if ("encodeSourceMapAtPath" in r)
|
741
|
-
throw new Error(
|
742
|
-
"It looks like you're using options meant for '@sanity/preview-kit/client'. 'encodeSourceMapAtPath' is not supported in '@sanity/client'. Did you mean 'stega.filter'?"
|
743
|
-
);
|
744
|
-
if (typeof r.stega.enabled != "boolean")
|
745
|
-
throw new Error(`stega.enabled must be a boolean, received ${r.stega.enabled}`);
|
746
|
-
if (r.stega.enabled && r.stega.studioUrl === void 0)
|
747
|
-
throw new Error("stega.studioUrl must be defined when stega.enabled is true");
|
748
|
-
if (r.stega.enabled && typeof r.stega.studioUrl != "string" && typeof r.stega.studioUrl != "function")
|
749
|
-
throw new Error(
|
750
|
-
`stega.studioUrl must be a string or a function, received ${r.stega.studioUrl}`
|
751
|
-
);
|
752
|
-
const i = typeof window < "u" && window.location && window.location.hostname, o = i && Os(window.location.hostname);
|
753
|
-
i && o && r.token && r.ignoreBrowserTokenWarning !== !0 ? Ts() : typeof r.useCdn > "u" && xs(), s && vs(r.projectId), r.dataset && Mn(r.dataset), "requestTagPrefix" in r && (r.requestTagPrefix = r.requestTagPrefix ? kn(r.requestTagPrefix).replace(/\.+$/, "") : void 0), r.apiVersion = `${r.apiVersion}`.replace(/^v/, ""), r.isDefaultApi = r.apiHost === Te.apiHost, r.useCdn === !0 && r.withCredentials && Cs(), r.useCdn = r.useCdn !== !1 && !r.withCredentials, Ms(r.apiVersion);
|
754
|
-
const a = r.apiHost.split("://", 2), c = a[0], u = a[1], g = r.isDefaultApi ? As : u;
|
755
|
-
return r.useProjectHostname ? (r.url = `${c}://${r.projectId}.${u}/v${r.apiVersion}`, r.cdnUrl = `${c}://${r.projectId}.${g}/v${r.apiVersion}`) : (r.url = `${r.apiHost}/v${r.apiVersion}`, r.cdnUrl = r.url), r;
|
756
|
-
};
|
757
|
-
function Pn(n) {
|
758
|
-
if (typeof n == "string")
|
759
|
-
return { id: n };
|
760
|
-
if (Array.isArray(n))
|
761
|
-
return { query: "*[_id in $ids]", params: { ids: n } };
|
762
|
-
if (typeof n == "object" && n !== null && "query" in n && typeof n.query == "string")
|
763
|
-
return "params" in n && typeof n.params == "object" && n.params !== null ? { query: n.query, params: n.params } : { query: n.query };
|
764
|
-
const e = [
|
765
|
-
"* Document ID (<docId>)",
|
766
|
-
"* Array of document IDs",
|
767
|
-
"* Object containing `query`"
|
768
|
-
].join(`
|
769
|
-
`);
|
770
|
-
throw new Error(`Unknown selection - must be one of:
|
771
|
-
|
772
|
-
${e}`);
|
773
|
-
}
|
774
|
-
class Dn {
|
775
|
-
constructor(e, t = {}) {
|
776
|
-
b(this, "selection");
|
777
|
-
b(this, "operations");
|
778
|
-
this.selection = e, this.operations = t;
|
779
|
-
}
|
780
|
-
/**
|
781
|
-
* Sets the given attributes to the document. Does NOT merge objects.
|
782
|
-
* The operation is added to the current patch, ready to be commited by `commit()`
|
783
|
-
*
|
784
|
-
* @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
|
785
|
-
*/
|
786
|
-
set(e) {
|
787
|
-
return this._assign("set", e);
|
788
|
-
}
|
789
|
-
/**
|
790
|
-
* Sets the given attributes to the document if they are not currently set. Does NOT merge objects.
|
791
|
-
* The operation is added to the current patch, ready to be commited by `commit()`
|
792
|
-
*
|
793
|
-
* @param attrs - Attributes to set. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "value"\}
|
794
|
-
*/
|
795
|
-
setIfMissing(e) {
|
796
|
-
return this._assign("setIfMissing", e);
|
797
|
-
}
|
798
|
-
/**
|
799
|
-
* Performs a "diff-match-patch" operation on the string attributes provided.
|
800
|
-
* The operation is added to the current patch, ready to be commited by `commit()`
|
801
|
-
*
|
802
|
-
* @param attrs - Attributes to perform operation on. To set a deep attribute, use JSONMatch, eg: \{"nested.prop": "dmp"\}
|
803
|
-
*/
|
804
|
-
diffMatchPatch(e) {
|
805
|
-
return Se("diffMatchPatch", e), this._assign("diffMatchPatch", e);
|
806
|
-
}
|
807
|
-
/**
|
808
|
-
* Unsets the attribute paths provided.
|
809
|
-
* The operation is added to the current patch, ready to be commited by `commit()`
|
810
|
-
*
|
811
|
-
* @param attrs - Attribute paths to unset.
|
812
|
-
*/
|
813
|
-
unset(e) {
|
814
|
-
if (!Array.isArray(e))
|
815
|
-
throw new Error("unset(attrs) takes an array of attributes to unset, non-array given");
|
816
|
-
return this.operations = Object.assign({}, this.operations, { unset: e }), this;
|
817
|
-
}
|
818
|
-
/**
|
819
|
-
* Increment a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
|
820
|
-
*
|
821
|
-
* @param attrs - Object of attribute paths to increment, values representing the number to increment by.
|
822
|
-
*/
|
823
|
-
inc(e) {
|
824
|
-
return this._assign("inc", e);
|
825
|
-
}
|
826
|
-
/**
|
827
|
-
* Decrement a numeric value. Each entry in the argument is either an attribute or a JSON path. The value may be a positive or negative integer or floating-point value. The operation will fail if target value is not a numeric value, or doesn't exist.
|
828
|
-
*
|
829
|
-
* @param attrs - Object of attribute paths to decrement, values representing the number to decrement by.
|
830
|
-
*/
|
831
|
-
dec(e) {
|
832
|
-
return this._assign("dec", e);
|
833
|
-
}
|
834
|
-
/**
|
835
|
-
* Provides methods for modifying arrays, by inserting, appending and replacing elements via a JSONPath expression.
|
836
|
-
*
|
837
|
-
* @param at - Location to insert at, relative to the given selector, or 'replace' the matched path
|
838
|
-
* @param selector - JSONPath expression, eg `comments[-1]` or `blocks[_key=="abc123"]`
|
839
|
-
* @param items - Array of items to insert/replace
|
840
|
-
*/
|
841
|
-
insert(e, t, r) {
|
842
|
-
return _s(e, t, r), this._assign("insert", { [e]: t, items: r });
|
843
|
-
}
|
844
|
-
/**
|
845
|
-
* Append the given items to the array at the given JSONPath
|
846
|
-
*
|
847
|
-
* @param selector - Attribute/path to append to, eg `comments` or `person.hobbies`
|
848
|
-
* @param items - Array of items to append to the array
|
849
|
-
*/
|
850
|
-
append(e, t) {
|
851
|
-
return this.insert("after", `${e}[-1]`, t);
|
852
|
-
}
|
853
|
-
/**
|
854
|
-
* Prepend the given items to the array at the given JSONPath
|
855
|
-
*
|
856
|
-
* @param selector - Attribute/path to prepend to, eg `comments` or `person.hobbies`
|
857
|
-
* @param items - Array of items to prepend to the array
|
858
|
-
*/
|
859
|
-
prepend(e, t) {
|
860
|
-
return this.insert("before", `${e}[0]`, t);
|
861
|
-
}
|
862
|
-
/**
|
863
|
-
* Change the contents of an array by removing existing elements and/or adding new elements.
|
864
|
-
*
|
865
|
-
* @param selector - Attribute or JSONPath expression for array
|
866
|
-
* @param start - Index at which to start changing the array (with origin 0). If greater than the length of the array, actual starting index will be set to the length of the array. If negative, will begin that many elements from the end of the array (with origin -1) and will be set to 0 if absolute value is greater than the length of the array.x
|
867
|
-
* @param deleteCount - An integer indicating the number of old array elements to remove.
|
868
|
-
* @param items - The elements to add to the array, beginning at the start index. If you don't specify any elements, splice() will only remove elements from the array.
|
869
|
-
*/
|
870
|
-
splice(e, t, r, s) {
|
871
|
-
const i = typeof r > "u" || r === -1, o = t < 0 ? t - 1 : t, a = i ? -1 : Math.max(0, t + r), c = o < 0 && a >= 0 ? "" : a, u = `${e}[${o}:${c}]`;
|
872
|
-
return this.insert("replace", u, s || []);
|
873
|
-
}
|
874
|
-
/**
|
875
|
-
* Adds a revision clause, preventing the document from being patched if the `_rev` property does not match the given value
|
876
|
-
*
|
877
|
-
* @param rev - Revision to lock the patch to
|
878
|
-
*/
|
879
|
-
ifRevisionId(e) {
|
880
|
-
return this.operations.ifRevisionID = e, this;
|
881
|
-
}
|
882
|
-
/**
|
883
|
-
* Return a plain JSON representation of the patch
|
884
|
-
*/
|
885
|
-
serialize() {
|
886
|
-
return { ...Pn(this.selection), ...this.operations };
|
887
|
-
}
|
888
|
-
/**
|
889
|
-
* Return a plain JSON representation of the patch
|
890
|
-
*/
|
891
|
-
toJSON() {
|
892
|
-
return this.serialize();
|
893
|
-
}
|
894
|
-
/**
|
895
|
-
* Clears the patch of all operations
|
896
|
-
*/
|
897
|
-
reset() {
|
898
|
-
return this.operations = {}, this;
|
899
|
-
}
|
900
|
-
_assign(e, t, r = !0) {
|
901
|
-
return Se(e, t), this.operations = Object.assign({}, this.operations, {
|
902
|
-
[e]: Object.assign({}, r && this.operations[e] || {}, t)
|
903
|
-
}), this;
|
904
|
-
}
|
905
|
-
_set(e, t) {
|
906
|
-
return this._assign(e, t, !1);
|
907
|
-
}
|
908
|
-
}
|
909
|
-
var te;
|
910
|
-
const Ft = class Ft extends Dn {
|
911
|
-
constructor(t, r, s) {
|
912
|
-
super(t, r);
|
913
|
-
C(this, te);
|
914
|
-
_(this, te, s);
|
915
|
-
}
|
916
|
-
/**
|
917
|
-
* Clones the patch
|
918
|
-
*/
|
919
|
-
clone() {
|
920
|
-
return new Ft(this.selection, { ...this.operations }, y(this, te));
|
921
|
-
}
|
922
|
-
commit(t) {
|
923
|
-
if (!y(this, te))
|
924
|
-
throw new Error(
|
925
|
-
"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
|
926
|
-
);
|
927
|
-
const r = typeof this.selection == "string", s = Object.assign({ returnFirst: r, returnDocuments: !0 }, t);
|
928
|
-
return y(this, te).mutate({ patch: this.serialize() }, s);
|
929
|
-
}
|
930
|
-
};
|
931
|
-
te = new WeakMap();
|
932
|
-
let se = Ft;
|
933
|
-
var ne;
|
934
|
-
const Ht = class Ht extends Dn {
|
935
|
-
constructor(t, r, s) {
|
936
|
-
super(t, r);
|
937
|
-
C(this, ne);
|
938
|
-
_(this, ne, s);
|
939
|
-
}
|
940
|
-
/**
|
941
|
-
* Clones the patch
|
942
|
-
*/
|
943
|
-
clone() {
|
944
|
-
return new Ht(this.selection, { ...this.operations }, y(this, ne));
|
945
|
-
}
|
946
|
-
commit(t) {
|
947
|
-
if (!y(this, ne))
|
948
|
-
throw new Error(
|
949
|
-
"No `client` passed to patch, either provide one or pass the patch to a clients `mutate()` method"
|
950
|
-
);
|
951
|
-
const r = typeof this.selection == "string", s = Object.assign({ returnFirst: r, returnDocuments: !0 }, t);
|
952
|
-
return y(this, ne).mutate({ patch: this.serialize() }, s);
|
953
|
-
}
|
954
|
-
};
|
955
|
-
ne = new WeakMap();
|
956
|
-
let ie = Ht;
|
957
|
-
const Fn = { returnDocuments: !1 };
|
958
|
-
class Hn {
|
959
|
-
constructor(e = [], t) {
|
960
|
-
b(this, "operations");
|
961
|
-
b(this, "trxId");
|
962
|
-
this.operations = e, this.trxId = t;
|
963
|
-
}
|
964
|
-
/**
|
965
|
-
* Creates a new Sanity document. If `_id` is provided and already exists, the mutation will fail. If no `_id` is given, one will automatically be generated by the database.
|
966
|
-
* The operation is added to the current transaction, ready to be commited by `commit()`
|
967
|
-
*
|
968
|
-
* @param doc - Document to create. Requires a `_type` property.
|
969
|
-
*/
|
970
|
-
create(e) {
|
971
|
-
return Se("create", e), this._add({ create: e });
|
972
|
-
}
|
973
|
-
/**
|
974
|
-
* Creates a new Sanity document. If a document with the same `_id` already exists, the create operation will be ignored.
|
975
|
-
* The operation is added to the current transaction, ready to be commited by `commit()`
|
976
|
-
*
|
977
|
-
* @param doc - Document to create if it does not already exist. Requires `_id` and `_type` properties.
|
978
|
-
*/
|
979
|
-
createIfNotExists(e) {
|
980
|
-
const t = "createIfNotExists";
|
981
|
-
return Se(t, e), Je(t, e), this._add({ [t]: e });
|
982
|
-
}
|
983
|
-
/**
|
984
|
-
* Creates a new Sanity document, or replaces an existing one if the same `_id` is already used.
|
985
|
-
* The operation is added to the current transaction, ready to be commited by `commit()`
|
986
|
-
*
|
987
|
-
* @param doc - Document to create or replace. Requires `_id` and `_type` properties.
|
988
|
-
*/
|
989
|
-
createOrReplace(e) {
|
990
|
-
const t = "createOrReplace";
|
991
|
-
return Se(t, e), Je(t, e), this._add({ [t]: e });
|
992
|
-
}
|
993
|
-
/**
|
994
|
-
* Deletes the document with the given document ID
|
995
|
-
* The operation is added to the current transaction, ready to be commited by `commit()`
|
996
|
-
*
|
997
|
-
* @param documentId - Document ID to delete
|
998
|
-
*/
|
999
|
-
delete(e) {
|
1000
|
-
return jn("delete", e), this._add({ delete: { id: e } });
|
1001
|
-
}
|
1002
|
-
transactionId(e) {
|
1003
|
-
return e ? (this.trxId = e, this) : this.trxId;
|
1004
|
-
}
|
1005
|
-
/**
|
1006
|
-
* Return a plain JSON representation of the transaction
|
1007
|
-
*/
|
1008
|
-
serialize() {
|
1009
|
-
return [...this.operations];
|
1010
|
-
}
|
1011
|
-
/**
|
1012
|
-
* Return a plain JSON representation of the transaction
|
1013
|
-
*/
|
1014
|
-
toJSON() {
|
1015
|
-
return this.serialize();
|
1016
|
-
}
|
1017
|
-
/**
|
1018
|
-
* Clears the transaction of all operations
|
1019
|
-
*/
|
1020
|
-
reset() {
|
1021
|
-
return this.operations = [], this;
|
1022
|
-
}
|
1023
|
-
_add(e) {
|
1024
|
-
return this.operations.push(e), this;
|
1025
|
-
}
|
1026
|
-
}
|
1027
|
-
var N;
|
1028
|
-
const Ut = class Ut extends Hn {
|
1029
|
-
constructor(t, r, s) {
|
1030
|
-
super(t, s);
|
1031
|
-
C(this, N);
|
1032
|
-
_(this, N, r);
|
1033
|
-
}
|
1034
|
-
/**
|
1035
|
-
* Clones the transaction
|
1036
|
-
*/
|
1037
|
-
clone() {
|
1038
|
-
return new Ut([...this.operations], y(this, N), this.trxId);
|
1039
|
-
}
|
1040
|
-
commit(t) {
|
1041
|
-
if (!y(this, N))
|
1042
|
-
throw new Error(
|
1043
|
-
"No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
|
1044
|
-
);
|
1045
|
-
return y(this, N).mutate(
|
1046
|
-
this.serialize(),
|
1047
|
-
Object.assign({ transactionId: this.trxId }, Fn, t || {})
|
1048
|
-
);
|
1049
|
-
}
|
1050
|
-
patch(t, r) {
|
1051
|
-
const s = typeof r == "function";
|
1052
|
-
if (typeof t != "string" && t instanceof ie)
|
1053
|
-
return this._add({ patch: t.serialize() });
|
1054
|
-
if (s) {
|
1055
|
-
const i = r(new ie(t, {}, y(this, N)));
|
1056
|
-
if (!(i instanceof ie))
|
1057
|
-
throw new Error("function passed to `patch()` must return the patch");
|
1058
|
-
return this._add({ patch: i.serialize() });
|
1059
|
-
}
|
1060
|
-
return this._add({ patch: { id: t, ...r } });
|
1061
|
-
}
|
1062
|
-
};
|
1063
|
-
N = new WeakMap();
|
1064
|
-
let Ge = Ut;
|
1065
|
-
var z;
|
1066
|
-
const Vt = class Vt extends Hn {
|
1067
|
-
constructor(t, r, s) {
|
1068
|
-
super(t, s);
|
1069
|
-
C(this, z);
|
1070
|
-
_(this, z, r);
|
1071
|
-
}
|
1072
|
-
/**
|
1073
|
-
* Clones the transaction
|
1074
|
-
*/
|
1075
|
-
clone() {
|
1076
|
-
return new Vt([...this.operations], y(this, z), this.trxId);
|
1077
|
-
}
|
1078
|
-
commit(t) {
|
1079
|
-
if (!y(this, z))
|
1080
|
-
throw new Error(
|
1081
|
-
"No `client` passed to transaction, either provide one or pass the transaction to a clients `mutate()` method"
|
1082
|
-
);
|
1083
|
-
return y(this, z).mutate(
|
1084
|
-
this.serialize(),
|
1085
|
-
Object.assign({ transactionId: this.trxId }, Fn, t || {})
|
1086
|
-
);
|
1087
|
-
}
|
1088
|
-
patch(t, r) {
|
1089
|
-
const s = typeof r == "function";
|
1090
|
-
if (typeof t != "string" && t instanceof se)
|
1091
|
-
return this._add({ patch: t.serialize() });
|
1092
|
-
if (s) {
|
1093
|
-
const i = r(new se(t, {}, y(this, z)));
|
1094
|
-
if (!(i instanceof se))
|
1095
|
-
throw new Error("function passed to `patch()` must return the patch");
|
1096
|
-
return this._add({ patch: i.serialize() });
|
1097
|
-
}
|
1098
|
-
return this._add({ patch: { id: t, ...r } });
|
1099
|
-
}
|
1100
|
-
};
|
1101
|
-
z = new WeakMap();
|
1102
|
-
let We = Vt;
|
1103
|
-
const js = "X-Sanity-Project-ID";
|
1104
|
-
function Rs(n, e = {}) {
|
1105
|
-
const t = {}, r = e.token || n.token;
|
1106
|
-
r && (t.Authorization = `Bearer ${r}`), !e.useGlobalApi && !n.useProjectHostname && n.projectId && (t[js] = n.projectId);
|
1107
|
-
const s = !!(typeof e.withCredentials > "u" ? n.token || n.withCredentials : e.withCredentials), i = typeof e.timeout > "u" ? n.timeout : e.timeout;
|
1108
|
-
return Object.assign({}, e, {
|
1109
|
-
headers: Object.assign({}, t, e.headers || {}),
|
1110
|
-
timeout: typeof i > "u" ? 5 * 60 * 1e3 : i,
|
1111
|
-
proxy: e.proxy || n.proxy,
|
1112
|
-
json: !0,
|
1113
|
-
withCredentials: s,
|
1114
|
-
fetch: typeof e.fetch == "object" && typeof n.fetch == "object" ? { ...n.fetch, ...e.fetch } : e.fetch || n.fetch
|
1115
|
-
});
|
1116
|
-
}
|
1117
|
-
const Un = ({
|
1118
|
-
query: n,
|
1119
|
-
params: e = {},
|
1120
|
-
options: t = {}
|
1121
|
-
}) => {
|
1122
|
-
const r = new URLSearchParams(), { tag: s, includeMutations: i, returnQuery: o, ...a } = t;
|
1123
|
-
s && r.append("tag", s), r.append("query", n);
|
1124
|
-
for (const [c, u] of Object.entries(e))
|
1125
|
-
r.append(`$${c}`, JSON.stringify(u));
|
1126
|
-
for (const [c, u] of Object.entries(a))
|
1127
|
-
u && r.append(c, `${u}`);
|
1128
|
-
return o === !1 && r.append("returnQuery", "false"), i === !1 && r.append("includeMutations", "false"), `?${r}`;
|
1129
|
-
}, ks = (n, e) => n === !1 ? void 0 : typeof n > "u" ? e : n, Ls = (n = {}) => ({
|
1130
|
-
dryRun: n.dryRun,
|
1131
|
-
returnIds: !0,
|
1132
|
-
returnDocuments: ks(n.returnDocuments, !0),
|
1133
|
-
visibility: n.visibility || "sync",
|
1134
|
-
autoGenerateArrayKeys: n.autoGenerateArrayKeys,
|
1135
|
-
skipCrossDatasetReferenceValidation: n.skipCrossDatasetReferenceValidation
|
1136
|
-
}), $t = (n) => n.type === "response", qs = (n) => n.body, Ps = (n, e) => n.reduce((t, r) => (t[e(r)] = r, t), /* @__PURE__ */ Object.create(null)), Ds = 11264;
|
1137
|
-
function Vn(n, e, t, r, s = {}, i = {}) {
|
1138
|
-
const o = "stega" in i ? {
|
1139
|
-
...t || {},
|
1140
|
-
...typeof i.stega == "boolean" ? { enabled: i.stega } : i.stega || {}
|
1141
|
-
} : t, a = o.enabled ? os(s) : s, c = i.filterResponse === !1 ? (p) => p : (p) => p.result, { cache: u, next: g, ...d } = {
|
1142
|
-
// Opt out of setting a `signal` on an internal `fetch` if one isn't provided.
|
1143
|
-
// This is necessary in React Server Components to avoid opting out of Request Memoization.
|
1144
|
-
useAbortSignal: typeof i.signal < "u",
|
1145
|
-
// Set `resultSourceMap' when stega is enabled, as it's required for encoding.
|
1146
|
-
resultSourceMap: o.enabled ? "withKeyArraySelector" : i.resultSourceMap,
|
1147
|
-
...i,
|
1148
|
-
// Default to not returning the query, unless `filterResponse` is `false`,
|
1149
|
-
// or `returnQuery` is explicitly set. `true` is the default in Content Lake, so skip if truthy
|
1150
|
-
returnQuery: i.filterResponse === !1 && i.returnQuery !== !1
|
1151
|
-
}, h = typeof u < "u" || typeof g < "u" ? { ...d, fetch: { cache: u, next: g } } : d, l = Ee(n, e, "query", { query: r, params: a }, h);
|
1152
|
-
return o.enabled ? l.pipe(
|
1153
|
-
kr(
|
1154
|
-
Mr(
|
1155
|
-
import("./stegaEncodeSourceMap-DXdUZQye.mjs").then(function(p) {
|
1156
|
-
return p.stegaEncodeSourceMap$1;
|
1157
|
-
}).then(
|
1158
|
-
({ stegaEncodeSourceMap: p }) => p
|
1159
|
-
)
|
1160
|
-
)
|
1161
|
-
),
|
1162
|
-
X(
|
1163
|
-
([p, f]) => {
|
1164
|
-
const m = f(p.result, p.resultSourceMap, o);
|
1165
|
-
return c({ ...p, result: m });
|
1166
|
-
}
|
1167
|
-
)
|
1168
|
-
) : l.pipe(X(c));
|
1169
|
-
}
|
1170
|
-
function Bn(n, e, t, r = {}) {
|
1171
|
-
const s = {
|
1172
|
-
uri: ae(n, "doc", t),
|
1173
|
-
json: !0,
|
1174
|
-
tag: r.tag,
|
1175
|
-
signal: r.signal
|
1176
|
-
};
|
1177
|
-
return Be(n, e, s).pipe(
|
1178
|
-
Ue($t),
|
1179
|
-
X((i) => i.body.documents && i.body.documents[0])
|
1180
|
-
);
|
1181
|
-
}
|
1182
|
-
function Nn(n, e, t, r = {}) {
|
1183
|
-
const s = {
|
1184
|
-
uri: ae(n, "doc", t.join(",")),
|
1185
|
-
json: !0,
|
1186
|
-
tag: r.tag,
|
1187
|
-
signal: r.signal
|
1188
|
-
};
|
1189
|
-
return Be(n, e, s).pipe(
|
1190
|
-
Ue($t),
|
1191
|
-
X((i) => {
|
1192
|
-
const o = Ps(i.body.documents || [], (a) => a._id);
|
1193
|
-
return t.map((a) => o[a] || null);
|
1194
|
-
})
|
1195
|
-
);
|
1196
|
-
}
|
1197
|
-
function zn(n, e, t, r) {
|
1198
|
-
return Je("createIfNotExists", t), st(n, e, t, "createIfNotExists", r);
|
1199
|
-
}
|
1200
|
-
function Zn(n, e, t, r) {
|
1201
|
-
return Je("createOrReplace", t), st(n, e, t, "createOrReplace", r);
|
1202
|
-
}
|
1203
|
-
function Jn(n, e, t, r) {
|
1204
|
-
return Ee(
|
1205
|
-
n,
|
1206
|
-
e,
|
1207
|
-
"mutate",
|
1208
|
-
{ mutations: [{ delete: Pn(t) }] },
|
1209
|
-
r
|
1210
|
-
);
|
1211
|
-
}
|
1212
|
-
function Gn(n, e, t, r) {
|
1213
|
-
let s;
|
1214
|
-
t instanceof ie || t instanceof se ? s = { patch: t.serialize() } : t instanceof Ge || t instanceof We ? s = t.serialize() : s = t;
|
1215
|
-
const i = Array.isArray(s) ? s : [s], o = r && r.transactionId || void 0;
|
1216
|
-
return Ee(n, e, "mutate", { mutations: i, transactionId: o }, r);
|
1217
|
-
}
|
1218
|
-
function Wn(n, e, t, r) {
|
1219
|
-
const s = Array.isArray(t) ? t : [t], i = r && r.transactionId || void 0, o = r && r.skipCrossDatasetReferenceValidation || void 0, a = r && r.dryRun || void 0;
|
1220
|
-
return Ee(
|
1221
|
-
n,
|
1222
|
-
e,
|
1223
|
-
"actions",
|
1224
|
-
{ actions: s, transactionId: i, skipCrossDatasetReferenceValidation: o, dryRun: a },
|
1225
|
-
r
|
1226
|
-
);
|
1227
|
-
}
|
1228
|
-
function Ee(n, e, t, r, s = {}) {
|
1229
|
-
const i = t === "mutate", o = t === "actions", a = t === "query", c = i || o ? "" : Un(r), u = !i && !o && c.length < Ds, g = u ? c : "", d = s.returnFirst, { timeout: h, token: l, tag: p, headers: f, returnQuery: m, lastLiveEventId: x, cacheMode: w } = s, E = ae(n, t, g), T = {
|
1230
|
-
method: u ? "GET" : "POST",
|
1231
|
-
uri: E,
|
1232
|
-
json: !0,
|
1233
|
-
body: u ? void 0 : r,
|
1234
|
-
query: i && Ls(s),
|
1235
|
-
timeout: h,
|
1236
|
-
headers: f,
|
1237
|
-
token: l,
|
1238
|
-
tag: p,
|
1239
|
-
returnQuery: m,
|
1240
|
-
perspective: s.perspective,
|
1241
|
-
resultSourceMap: s.resultSourceMap,
|
1242
|
-
lastLiveEventId: Array.isArray(x) ? x[0] : x,
|
1243
|
-
cacheMode: w,
|
1244
|
-
canUseCdn: a,
|
1245
|
-
signal: s.signal,
|
1246
|
-
fetch: s.fetch,
|
1247
|
-
useAbortSignal: s.useAbortSignal,
|
1248
|
-
useCdn: s.useCdn
|
1249
|
-
};
|
1250
|
-
return Be(n, e, T).pipe(
|
1251
|
-
Ue($t),
|
1252
|
-
X(qs),
|
1253
|
-
X((M) => {
|
1254
|
-
if (!i)
|
1255
|
-
return M;
|
1256
|
-
const R = M.results || [];
|
1257
|
-
if (s.returnDocuments)
|
1258
|
-
return d ? R[0] && R[0].document : R.map((I) => I.document);
|
1259
|
-
const Q = d ? "documentId" : "documentIds", P = d ? R[0] && R[0].id : R.map((I) => I.id);
|
1260
|
-
return {
|
1261
|
-
transactionId: M.transactionId,
|
1262
|
-
results: R,
|
1263
|
-
[Q]: P
|
1264
|
-
};
|
1265
|
-
})
|
1266
|
-
);
|
1267
|
-
}
|
1268
|
-
function st(n, e, t, r, s = {}) {
|
1269
|
-
const i = { [r]: t }, o = Object.assign({ returnFirst: !0, returnDocuments: !0 }, s);
|
1270
|
-
return Ee(n, e, "mutate", { mutations: [i] }, o);
|
1271
|
-
}
|
1272
|
-
function Be(n, e, t) {
|
1273
|
-
const r = t.url || t.uri, s = n.config(), i = typeof t.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(t.method || "GET") >= 0 && r.indexOf("/data/") === 0 : t.canUseCdn;
|
1274
|
-
let o = (t.useCdn ?? s.useCdn) && i;
|
1275
|
-
const a = t.tag && s.requestTagPrefix ? [s.requestTagPrefix, t.tag].join(".") : t.tag || s.requestTagPrefix;
|
1276
|
-
if (a && t.tag !== null && (t.query = { tag: kn(a), ...t.query }), ["GET", "HEAD", "POST"].indexOf(t.method || "GET") >= 0 && r.indexOf("/data/query/") === 0) {
|
1277
|
-
const g = t.resultSourceMap ?? s.resultSourceMap;
|
1278
|
-
g !== void 0 && g !== !1 && (t.query = { resultSourceMap: g, ...t.query });
|
1279
|
-
const d = t.perspective || s.perspective;
|
1280
|
-
typeof d < "u" && (Ln(d), t.query = {
|
1281
|
-
perspective: Array.isArray(d) ? d.join(",") : d,
|
1282
|
-
...t.query
|
1283
|
-
}, d === "previewDrafts" && o && (o = !1, Ss())), t.lastLiveEventId && (t.query = { ...t.query, lastLiveEventId: t.lastLiveEventId }), t.returnQuery === !1 && (t.query = { returnQuery: "false", ...t.query }), o && t.cacheMode == "noStale" && (t.query = { cacheMode: "noStale", ...t.query });
|
1284
|
-
}
|
1285
|
-
const c = Rs(
|
1286
|
-
s,
|
1287
|
-
Object.assign({}, t, {
|
1288
|
-
url: At(n, r, o)
|
1289
|
-
})
|
1290
|
-
), u = new we(
|
1291
|
-
(g) => e(c, s.requester).subscribe(g)
|
1292
|
-
);
|
1293
|
-
return t.signal ? u.pipe(Fs(t.signal)) : u;
|
1294
|
-
}
|
1295
|
-
function q(n, e, t) {
|
1296
|
-
return Be(n, e, t).pipe(
|
1297
|
-
Ue((r) => r.type === "response"),
|
1298
|
-
X((r) => r.body)
|
1299
|
-
);
|
1300
|
-
}
|
1301
|
-
function ae(n, e, t) {
|
1302
|
-
const r = n.config(), s = Rn(r), i = `/${e}/${s}`;
|
1303
|
-
return `/data${t ? `${i}/${t}` : i}`.replace(/\/($|\?)/, "$1");
|
1304
|
-
}
|
1305
|
-
function At(n, e, t = !1) {
|
1306
|
-
const { url: r, cdnUrl: s } = n.config();
|
1307
|
-
return `${t ? s : r}/${e.replace(/^\//, "")}`;
|
1308
|
-
}
|
1309
|
-
function Fs(n) {
|
1310
|
-
return (e) => new we((t) => {
|
1311
|
-
const r = () => t.error(Us(n));
|
1312
|
-
if (n && n.aborted) {
|
1313
|
-
r();
|
1314
|
-
return;
|
1315
|
-
}
|
1316
|
-
const s = e.subscribe(t);
|
1317
|
-
return n.addEventListener("abort", r), () => {
|
1318
|
-
n.removeEventListener("abort", r), s.unsubscribe();
|
1319
|
-
};
|
1320
|
-
});
|
1321
|
-
}
|
1322
|
-
const Hs = !!globalThis.DOMException;
|
1323
|
-
function Us(n) {
|
1324
|
-
if (Hs)
|
1325
|
-
return new DOMException((n == null ? void 0 : n.reason) ?? "The operation was aborted.", "AbortError");
|
1326
|
-
const e = new Error((n == null ? void 0 : n.reason) ?? "The operation was aborted.");
|
1327
|
-
return e.name = "AbortError", e;
|
1328
|
-
}
|
1329
|
-
var Re, ke;
|
1330
|
-
class Vs {
|
1331
|
-
constructor(e, t) {
|
1332
|
-
C(this, Re);
|
1333
|
-
C(this, ke);
|
1334
|
-
_(this, Re, e), _(this, ke, t);
|
1335
|
-
}
|
1336
|
-
upload(e, t, r) {
|
1337
|
-
return Xn(y(this, Re), y(this, ke), e, t, r);
|
1338
|
-
}
|
1339
|
-
}
|
1340
|
-
Re = new WeakMap(), ke = new WeakMap();
|
1341
|
-
var Le, qe;
|
1342
|
-
class Bs {
|
1343
|
-
constructor(e, t) {
|
1344
|
-
C(this, Le);
|
1345
|
-
C(this, qe);
|
1346
|
-
_(this, Le, e), _(this, qe, t);
|
1347
|
-
}
|
1348
|
-
upload(e, t, r) {
|
1349
|
-
const s = Xn(y(this, Le), y(this, qe), e, t, r);
|
1350
|
-
return O(
|
1351
|
-
s.pipe(
|
1352
|
-
Ue((i) => i.type === "response"),
|
1353
|
-
X(
|
1354
|
-
(i) => i.body.document
|
1355
|
-
)
|
1356
|
-
)
|
1357
|
-
);
|
1358
|
-
}
|
1359
|
-
}
|
1360
|
-
Le = new WeakMap(), qe = new WeakMap();
|
1361
|
-
function Xn(n, e, t, r, s = {}) {
|
1362
|
-
bs(t);
|
1363
|
-
let i = s.extract || void 0;
|
1364
|
-
i && !i.length && (i = ["none"]);
|
1365
|
-
const o = Rn(n.config()), a = t === "image" ? "images" : "files", c = Ns(s, r), { tag: u, label: g, title: d, description: h, creditLine: l, filename: p, source: f } = c, m = {
|
1366
|
-
label: g,
|
1367
|
-
title: d,
|
1368
|
-
description: h,
|
1369
|
-
filename: p,
|
1370
|
-
meta: i,
|
1371
|
-
creditLine: l
|
1372
|
-
};
|
1373
|
-
return f && (m.sourceId = f.id, m.sourceName = f.name, m.sourceUrl = f.url), Be(n, e, {
|
1374
|
-
tag: u,
|
1375
|
-
method: "POST",
|
1376
|
-
timeout: c.timeout || 0,
|
1377
|
-
uri: `/assets/${a}/${o}`,
|
1378
|
-
headers: c.contentType ? { "Content-Type": c.contentType } : {},
|
1379
|
-
query: m,
|
1380
|
-
body: r
|
1381
|
-
});
|
1382
|
-
}
|
1383
|
-
function Ns(n, e) {
|
1384
|
-
return typeof File > "u" || !(e instanceof File) ? n : Object.assign(
|
1385
|
-
{
|
1386
|
-
filename: n.preserveFilename === !1 ? void 0 : e.name,
|
1387
|
-
contentType: e.type
|
1388
|
-
},
|
1389
|
-
n
|
1390
|
-
);
|
1391
|
-
}
|
1392
|
-
var zs = (n, e) => Object.keys(e).concat(Object.keys(n)).reduce((t, r) => (t[r] = typeof n[r] > "u" ? e[r] : n[r], t), {});
|
1393
|
-
const Zs = (n, e) => e.reduce((t, r) => (typeof n[r] > "u" || (t[r] = n[r]), t), {}), Js = 14800, Gs = [
|
1394
|
-
"includePreviousRevision",
|
1395
|
-
"includeResult",
|
1396
|
-
"includeMutations",
|
1397
|
-
"visibility",
|
1398
|
-
"effectFormat",
|
1399
|
-
"tag"
|
1400
|
-
], Ws = {
|
1401
|
-
includeResult: !0
|
1402
|
-
};
|
1403
|
-
function Yn(n, e, t = {}) {
|
1404
|
-
const { url: r, token: s, withCredentials: i, requestTagPrefix: o } = this.config(), a = t.tag && o ? [o, t.tag].join(".") : t.tag, c = { ...zs(t, Ws), tag: a }, u = Zs(c, Gs), g = Un({ query: n, params: e, options: { tag: a, ...u } }), d = `${r}${ae(this, "listen", g)}`;
|
1405
|
-
if (d.length > Js)
|
1406
|
-
return new we((f) => f.error(new Error("Query too large for listener")));
|
1407
|
-
const h = c.events ? c.events : ["mutation"], l = h.indexOf("reconnect") !== -1, p = {};
|
1408
|
-
return (s || i) && (p.withCredentials = !0), s && (p.headers = {
|
1409
|
-
Authorization: `Bearer ${s}`
|
1410
|
-
}), new we((f) => {
|
1411
|
-
let m, x, w = !1, E = !1;
|
1412
|
-
ce();
|
1413
|
-
function T() {
|
1414
|
-
w || (I(), !w && m.readyState === m.CLOSED && (P(), clearTimeout(x), x = setTimeout(ce, 100)));
|
1415
|
-
}
|
1416
|
-
function M(L) {
|
1417
|
-
f.error(Xs(L));
|
1418
|
-
}
|
1419
|
-
function R(L) {
|
1420
|
-
const D = Qn(L);
|
1421
|
-
return D instanceof Error ? f.error(D) : f.next(D);
|
1422
|
-
}
|
1423
|
-
function Q() {
|
1424
|
-
w = !0, P(), f.complete();
|
1425
|
-
}
|
1426
|
-
function P() {
|
1427
|
-
m && (m.removeEventListener("error", T), m.removeEventListener("channelError", M), m.removeEventListener("disconnect", Q), h.forEach((L) => m.removeEventListener(L, R)), m.close());
|
1428
|
-
}
|
1429
|
-
function I() {
|
1430
|
-
l && f.next({ type: "reconnect" });
|
1431
|
-
}
|
1432
|
-
async function k() {
|
1433
|
-
const { default: L } = await import("./browser-BzDH2pyp.mjs").then((at) => at.b);
|
1434
|
-
if (E)
|
1435
|
-
return;
|
1436
|
-
const D = new L(d, p);
|
1437
|
-
return D.addEventListener("error", T), D.addEventListener("channelError", M), D.addEventListener("disconnect", Q), h.forEach((at) => D.addEventListener(at, R)), D;
|
1438
|
-
}
|
1439
|
-
function ce() {
|
1440
|
-
k().then((L) => {
|
1441
|
-
L && (m = L, E && P());
|
1442
|
-
}).catch((L) => {
|
1443
|
-
f.error(L), Bt();
|
1444
|
-
});
|
1445
|
-
}
|
1446
|
-
function Bt() {
|
1447
|
-
w = !0, P(), E = !0;
|
1448
|
-
}
|
1449
|
-
return Bt;
|
1450
|
-
});
|
1451
|
-
}
|
1452
|
-
function Qn(n) {
|
1453
|
-
try {
|
1454
|
-
const e = n.data && JSON.parse(n.data) || {};
|
1455
|
-
return Object.assign({ type: n.type }, e);
|
1456
|
-
} catch (e) {
|
1457
|
-
return e;
|
1458
|
-
}
|
1459
|
-
}
|
1460
|
-
function Xs(n) {
|
1461
|
-
if (n instanceof Error)
|
1462
|
-
return n;
|
1463
|
-
const e = Qn(n);
|
1464
|
-
return e instanceof Error ? e : new Error(Ys(e));
|
1465
|
-
}
|
1466
|
-
function Ys(n) {
|
1467
|
-
return n.error ? n.error.description ? n.error.description : typeof n.error == "string" ? n.error : JSON.stringify(n.error, null, 2) : n.message || "Unknown listener error";
|
1468
|
-
}
|
1469
|
-
const on = "2021-03-26";
|
1470
|
-
var re;
|
1471
|
-
class Kn {
|
1472
|
-
constructor(e) {
|
1473
|
-
C(this, re);
|
1474
|
-
_(this, re, e);
|
1475
|
-
}
|
1476
|
-
/**
|
1477
|
-
* Requires `apiVersion` to be `2021-03-26` or later.
|
1478
|
-
*/
|
1479
|
-
events({
|
1480
|
-
includeDrafts: e = !1,
|
1481
|
-
tag: t
|
1482
|
-
} = {}) {
|
1483
|
-
const {
|
1484
|
-
projectId: r,
|
1485
|
-
apiVersion: s,
|
1486
|
-
token: i,
|
1487
|
-
withCredentials: o,
|
1488
|
-
requestTagPrefix: a
|
1489
|
-
} = y(this, re).config(), c = s.replace(/^v/, "");
|
1490
|
-
if (c !== "X" && c < on)
|
1491
|
-
throw new Error(
|
1492
|
-
`The live events API requires API version ${on} or later. The current API version is ${c}. Please update your API version to use this feature.`
|
1493
|
-
);
|
1494
|
-
if (e && !i && !o)
|
1495
|
-
throw new Error(
|
1496
|
-
"The live events API requires a token or withCredentials when 'includeDrafts: true'. Please update your client configuration. The token should have the lowest possible access role."
|
1497
|
-
);
|
1498
|
-
if (e && c !== "X")
|
1499
|
-
throw new Error(
|
1500
|
-
"The live events API requires API version X when 'includeDrafts: true'. This API is experimental and may change or even be removed."
|
1501
|
-
);
|
1502
|
-
const u = ae(y(this, re), "live/events"), g = new URL(y(this, re).getUrl(u, !1)), d = t && a ? [a, t].join(".") : t;
|
1503
|
-
d && g.searchParams.set("tag", d), e && g.searchParams.set("includeDrafts", "true");
|
1504
|
-
const h = ["restart", "message", "welcome", "reconnect"], l = {};
|
1505
|
-
return e && i && (l.headers = {
|
1506
|
-
Authorization: `Bearer ${i}`
|
1507
|
-
}), e && o && (l.withCredentials = !0), new we((p) => {
|
1508
|
-
let f, m, x = !1, w = !1;
|
1509
|
-
Q();
|
1510
|
-
function E(I) {
|
1511
|
-
if (!x) {
|
1512
|
-
if ("data" in I) {
|
1513
|
-
const k = an(I);
|
1514
|
-
p.error(new Error(k.message, { cause: k }));
|
1515
|
-
}
|
1516
|
-
f.readyState === f.CLOSED && (M(), clearTimeout(m), m = setTimeout(Q, 100));
|
1517
|
-
}
|
1518
|
-
}
|
1519
|
-
function T(I) {
|
1520
|
-
const k = an(I);
|
1521
|
-
return k instanceof Error ? p.error(k) : p.next(k);
|
1522
|
-
}
|
1523
|
-
function M() {
|
1524
|
-
if (f) {
|
1525
|
-
f.removeEventListener("error", E);
|
1526
|
-
for (const I of h)
|
1527
|
-
f.removeEventListener(I, T);
|
1528
|
-
f.close();
|
1529
|
-
}
|
1530
|
-
}
|
1531
|
-
async function R() {
|
1532
|
-
const I = typeof EventSource > "u" || l.headers || l.withCredentials ? (await import("./browser-BzDH2pyp.mjs").then((ce) => ce.b)).default : EventSource;
|
1533
|
-
if (w)
|
1534
|
-
return;
|
1535
|
-
try {
|
1536
|
-
if (await fetch(g, {
|
1537
|
-
method: "OPTIONS",
|
1538
|
-
mode: "cors",
|
1539
|
-
credentials: l.withCredentials ? "include" : "omit",
|
1540
|
-
headers: l.headers
|
1541
|
-
}), w)
|
1542
|
-
return;
|
1543
|
-
} catch {
|
1544
|
-
throw new fs({ projectId: r });
|
1545
|
-
}
|
1546
|
-
const k = new I(g.toString(), l);
|
1547
|
-
k.addEventListener("error", E);
|
1548
|
-
for (const ce of h)
|
1549
|
-
k.addEventListener(ce, T);
|
1550
|
-
return k;
|
1551
|
-
}
|
1552
|
-
function Q() {
|
1553
|
-
R().then((I) => {
|
1554
|
-
I && (f = I, w && M());
|
1555
|
-
}).catch((I) => {
|
1556
|
-
p.error(I), P();
|
1557
|
-
});
|
1558
|
-
}
|
1559
|
-
function P() {
|
1560
|
-
x = !0, M(), w = !0;
|
1561
|
-
}
|
1562
|
-
return P;
|
1563
|
-
});
|
1564
|
-
}
|
1565
|
-
}
|
1566
|
-
re = new WeakMap();
|
1567
|
-
function an(n) {
|
1568
|
-
try {
|
1569
|
-
const e = n.data && JSON.parse(n.data) || {};
|
1570
|
-
return { type: n.type, id: n.lastEventId, ...e };
|
1571
|
-
} catch (e) {
|
1572
|
-
return e;
|
1573
|
-
}
|
1574
|
-
}
|
1575
|
-
var Z, J;
|
1576
|
-
class Qs {
|
1577
|
-
constructor(e, t) {
|
1578
|
-
C(this, Z);
|
1579
|
-
C(this, J);
|
1580
|
-
_(this, Z, e), _(this, J, t);
|
1581
|
-
}
|
1582
|
-
/**
|
1583
|
-
* Create a new dataset with the given name
|
1584
|
-
*
|
1585
|
-
* @param name - Name of the dataset to create
|
1586
|
-
* @param options - Options for the dataset
|
1587
|
-
*/
|
1588
|
-
create(e, t) {
|
1589
|
-
return le(y(this, Z), y(this, J), "PUT", e, t);
|
1590
|
-
}
|
1591
|
-
/**
|
1592
|
-
* Edit a dataset with the given name
|
1593
|
-
*
|
1594
|
-
* @param name - Name of the dataset to edit
|
1595
|
-
* @param options - New options for the dataset
|
1596
|
-
*/
|
1597
|
-
edit(e, t) {
|
1598
|
-
return le(y(this, Z), y(this, J), "PATCH", e, t);
|
1599
|
-
}
|
1600
|
-
/**
|
1601
|
-
* Delete a dataset with the given name
|
1602
|
-
*
|
1603
|
-
* @param name - Name of the dataset to delete
|
1604
|
-
*/
|
1605
|
-
delete(e) {
|
1606
|
-
return le(y(this, Z), y(this, J), "DELETE", e);
|
1607
|
-
}
|
1608
|
-
/**
|
1609
|
-
* Fetch a list of datasets for the configured project
|
1610
|
-
*/
|
1611
|
-
list() {
|
1612
|
-
return q(y(this, Z), y(this, J), {
|
1613
|
-
uri: "/datasets",
|
1614
|
-
tag: null
|
1615
|
-
});
|
1616
|
-
}
|
1617
|
-
}
|
1618
|
-
Z = new WeakMap(), J = new WeakMap();
|
1619
|
-
var G, W;
|
1620
|
-
class Ks {
|
1621
|
-
constructor(e, t) {
|
1622
|
-
C(this, G);
|
1623
|
-
C(this, W);
|
1624
|
-
_(this, G, e), _(this, W, t);
|
1625
|
-
}
|
1626
|
-
/**
|
1627
|
-
* Create a new dataset with the given name
|
1628
|
-
*
|
1629
|
-
* @param name - Name of the dataset to create
|
1630
|
-
* @param options - Options for the dataset
|
1631
|
-
*/
|
1632
|
-
create(e, t) {
|
1633
|
-
return O(
|
1634
|
-
le(y(this, G), y(this, W), "PUT", e, t)
|
1635
|
-
);
|
1636
|
-
}
|
1637
|
-
/**
|
1638
|
-
* Edit a dataset with the given name
|
1639
|
-
*
|
1640
|
-
* @param name - Name of the dataset to edit
|
1641
|
-
* @param options - New options for the dataset
|
1642
|
-
*/
|
1643
|
-
edit(e, t) {
|
1644
|
-
return O(
|
1645
|
-
le(y(this, G), y(this, W), "PATCH", e, t)
|
1646
|
-
);
|
1647
|
-
}
|
1648
|
-
/**
|
1649
|
-
* Delete a dataset with the given name
|
1650
|
-
*
|
1651
|
-
* @param name - Name of the dataset to delete
|
1652
|
-
*/
|
1653
|
-
delete(e) {
|
1654
|
-
return O(le(y(this, G), y(this, W), "DELETE", e));
|
1655
|
-
}
|
1656
|
-
/**
|
1657
|
-
* Fetch a list of datasets for the configured project
|
1658
|
-
*/
|
1659
|
-
list() {
|
1660
|
-
return O(
|
1661
|
-
q(y(this, G), y(this, W), { uri: "/datasets", tag: null })
|
1662
|
-
);
|
1663
|
-
}
|
1664
|
-
}
|
1665
|
-
G = new WeakMap(), W = new WeakMap();
|
1666
|
-
function le(n, e, t, r, s) {
|
1667
|
-
return Mn(r), q(n, e, {
|
1668
|
-
method: t,
|
1669
|
-
uri: `/datasets/${r}`,
|
1670
|
-
body: s,
|
1671
|
-
tag: null
|
1672
|
-
});
|
1673
|
-
}
|
1674
|
-
var pe, ye;
|
1675
|
-
class ei {
|
1676
|
-
constructor(e, t) {
|
1677
|
-
C(this, pe);
|
1678
|
-
C(this, ye);
|
1679
|
-
_(this, pe, e), _(this, ye, t);
|
1680
|
-
}
|
1681
|
-
list(e) {
|
1682
|
-
const t = (e == null ? void 0 : e.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
|
1683
|
-
return q(y(this, pe), y(this, ye), { uri: t });
|
1684
|
-
}
|
1685
|
-
/**
|
1686
|
-
* Fetch a project by project ID
|
1687
|
-
*
|
1688
|
-
* @param projectId - ID of the project to fetch
|
1689
|
-
*/
|
1690
|
-
getById(e) {
|
1691
|
-
return q(y(this, pe), y(this, ye), { uri: `/projects/${e}` });
|
1692
|
-
}
|
1693
|
-
}
|
1694
|
-
pe = new WeakMap(), ye = new WeakMap();
|
1695
|
-
var ge, me;
|
1696
|
-
class ti {
|
1697
|
-
constructor(e, t) {
|
1698
|
-
C(this, ge);
|
1699
|
-
C(this, me);
|
1700
|
-
_(this, ge, e), _(this, me, t);
|
1701
|
-
}
|
1702
|
-
list(e) {
|
1703
|
-
const t = (e == null ? void 0 : e.includeMembers) === !1 ? "/projects?includeMembers=false" : "/projects";
|
1704
|
-
return O(q(y(this, ge), y(this, me), { uri: t }));
|
1705
|
-
}
|
1706
|
-
/**
|
1707
|
-
* Fetch a project by project ID
|
1708
|
-
*
|
1709
|
-
* @param projectId - ID of the project to fetch
|
1710
|
-
*/
|
1711
|
-
getById(e) {
|
1712
|
-
return O(
|
1713
|
-
q(y(this, ge), y(this, me), { uri: `/projects/${e}` })
|
1714
|
-
);
|
1715
|
-
}
|
1716
|
-
}
|
1717
|
-
ge = new WeakMap(), me = new WeakMap();
|
1718
|
-
var Pe, De;
|
1719
|
-
class ni {
|
1720
|
-
constructor(e, t) {
|
1721
|
-
C(this, Pe);
|
1722
|
-
C(this, De);
|
1723
|
-
_(this, Pe, e), _(this, De, t);
|
1724
|
-
}
|
1725
|
-
/**
|
1726
|
-
* Fetch a user by user ID
|
1727
|
-
*
|
1728
|
-
* @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
|
1729
|
-
*/
|
1730
|
-
getById(e) {
|
1731
|
-
return q(
|
1732
|
-
y(this, Pe),
|
1733
|
-
y(this, De),
|
1734
|
-
{ uri: `/users/${e}` }
|
1735
|
-
);
|
1736
|
-
}
|
1737
|
-
}
|
1738
|
-
Pe = new WeakMap(), De = new WeakMap();
|
1739
|
-
var Fe, He;
|
1740
|
-
class ri {
|
1741
|
-
constructor(e, t) {
|
1742
|
-
C(this, Fe);
|
1743
|
-
C(this, He);
|
1744
|
-
_(this, Fe, e), _(this, He, t);
|
1745
|
-
}
|
1746
|
-
/**
|
1747
|
-
* Fetch a user by user ID
|
1748
|
-
*
|
1749
|
-
* @param id - User ID of the user to fetch. If `me` is provided, a minimal response including the users role is returned.
|
1750
|
-
*/
|
1751
|
-
getById(e) {
|
1752
|
-
return O(
|
1753
|
-
q(y(this, Fe), y(this, He), {
|
1754
|
-
uri: `/users/${e}`
|
1755
|
-
})
|
1756
|
-
);
|
1757
|
-
}
|
1758
|
-
}
|
1759
|
-
Fe = new WeakMap(), He = new WeakMap();
|
1760
|
-
var U, A;
|
1761
|
-
const et = class et {
|
1762
|
-
constructor(e, t = Te) {
|
1763
|
-
b(this, "assets");
|
1764
|
-
b(this, "datasets");
|
1765
|
-
b(this, "live");
|
1766
|
-
b(this, "projects");
|
1767
|
-
b(this, "users");
|
1768
|
-
/**
|
1769
|
-
* Private properties
|
1770
|
-
*/
|
1771
|
-
C(this, U);
|
1772
|
-
C(this, A);
|
1773
|
-
/**
|
1774
|
-
* Instance properties
|
1775
|
-
*/
|
1776
|
-
b(this, "listen", Yn);
|
1777
|
-
this.config(t), _(this, A, e), this.assets = new Vs(this, y(this, A)), this.datasets = new Qs(this, y(this, A)), this.live = new Kn(this), this.projects = new ei(this, y(this, A)), this.users = new ni(this, y(this, A));
|
1778
|
-
}
|
1779
|
-
/**
|
1780
|
-
* Clone the client - returns a new instance
|
1781
|
-
*/
|
1782
|
-
clone() {
|
1783
|
-
return new et(y(this, A), this.config());
|
1784
|
-
}
|
1785
|
-
config(e) {
|
1786
|
-
if (e === void 0)
|
1787
|
-
return { ...y(this, U) };
|
1788
|
-
if (y(this, U) && y(this, U).allowReconfigure === !1)
|
1789
|
-
throw new Error(
|
1790
|
-
"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
|
1791
|
-
);
|
1792
|
-
return _(this, U, qn(e, y(this, U) || {})), this;
|
1793
|
-
}
|
1794
|
-
/**
|
1795
|
-
* Clone the client with a new (partial) configuration.
|
1796
|
-
*
|
1797
|
-
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
1798
|
-
*/
|
1799
|
-
withConfig(e) {
|
1800
|
-
const t = this.config();
|
1801
|
-
return new et(y(this, A), {
|
1802
|
-
...t,
|
1803
|
-
...e,
|
1804
|
-
stega: {
|
1805
|
-
...t.stega || {},
|
1806
|
-
...typeof (e == null ? void 0 : e.stega) == "boolean" ? { enabled: e.stega } : (e == null ? void 0 : e.stega) || {}
|
1807
|
-
}
|
1808
|
-
});
|
1809
|
-
}
|
1810
|
-
fetch(e, t, r) {
|
1811
|
-
return Vn(
|
1812
|
-
this,
|
1813
|
-
y(this, A),
|
1814
|
-
y(this, U).stega,
|
1815
|
-
e,
|
1816
|
-
t,
|
1817
|
-
r
|
1818
|
-
);
|
1819
|
-
}
|
1820
|
-
/**
|
1821
|
-
* Fetch a single document with the given ID.
|
1822
|
-
*
|
1823
|
-
* @param id - Document ID to fetch
|
1824
|
-
* @param options - Request options
|
1825
|
-
*/
|
1826
|
-
getDocument(e, t) {
|
1827
|
-
return Bn(this, y(this, A), e, t);
|
1828
|
-
}
|
1829
|
-
/**
|
1830
|
-
* Fetch multiple documents in one request.
|
1831
|
-
* Should be used sparingly - performing a query is usually a better option.
|
1832
|
-
* The order/position of documents is preserved based on the original array of IDs.
|
1833
|
-
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
1834
|
-
*
|
1835
|
-
* @param ids - Document IDs to fetch
|
1836
|
-
* @param options - Request options
|
1837
|
-
*/
|
1838
|
-
getDocuments(e, t) {
|
1839
|
-
return Nn(this, y(this, A), e, t);
|
1840
|
-
}
|
1841
|
-
create(e, t) {
|
1842
|
-
return st(this, y(this, A), e, "create", t);
|
1843
|
-
}
|
1844
|
-
createIfNotExists(e, t) {
|
1845
|
-
return zn(this, y(this, A), e, t);
|
1846
|
-
}
|
1847
|
-
createOrReplace(e, t) {
|
1848
|
-
return Zn(this, y(this, A), e, t);
|
1849
|
-
}
|
1850
|
-
delete(e, t) {
|
1851
|
-
return Jn(this, y(this, A), e, t);
|
1852
|
-
}
|
1853
|
-
mutate(e, t) {
|
1854
|
-
return Gn(this, y(this, A), e, t);
|
1855
|
-
}
|
1856
|
-
/**
|
1857
|
-
* Create a new buildable patch of operations to perform
|
1858
|
-
*
|
1859
|
-
* @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
|
1860
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
1861
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
1862
|
-
*/
|
1863
|
-
patch(e, t) {
|
1864
|
-
return new se(e, t, this);
|
1865
|
-
}
|
1866
|
-
/**
|
1867
|
-
* Create a new transaction of mutations
|
1868
|
-
*
|
1869
|
-
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
1870
|
-
*/
|
1871
|
-
transaction(e) {
|
1872
|
-
return new We(e, this);
|
1873
|
-
}
|
1874
|
-
/**
|
1875
|
-
* Perform action operations against the configured dataset
|
1876
|
-
*
|
1877
|
-
* @param operations - Action operation(s) to execute
|
1878
|
-
* @param options - Action options
|
1879
|
-
*/
|
1880
|
-
action(e, t) {
|
1881
|
-
return Wn(this, y(this, A), e, t);
|
1882
|
-
}
|
1883
|
-
/**
|
1884
|
-
* Perform an HTTP request against the Sanity API
|
1885
|
-
*
|
1886
|
-
* @param options - Request options
|
1887
|
-
*/
|
1888
|
-
request(e) {
|
1889
|
-
return q(this, y(this, A), e);
|
1890
|
-
}
|
1891
|
-
/**
|
1892
|
-
* Get a Sanity API URL for the URI provided
|
1893
|
-
*
|
1894
|
-
* @param uri - URI/path to build URL for
|
1895
|
-
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
1896
|
-
*/
|
1897
|
-
getUrl(e, t) {
|
1898
|
-
return At(this, e, t);
|
1899
|
-
}
|
1900
|
-
/**
|
1901
|
-
* Get a Sanity API URL for the data operation and path provided
|
1902
|
-
*
|
1903
|
-
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
1904
|
-
* @param path - Path to append after the operation
|
1905
|
-
*/
|
1906
|
-
getDataUrl(e, t) {
|
1907
|
-
return ae(this, e, t);
|
1908
|
-
}
|
1909
|
-
};
|
1910
|
-
U = new WeakMap(), A = new WeakMap();
|
1911
|
-
let gt = et;
|
1912
|
-
var V, $;
|
1913
|
-
const tt = class tt {
|
1914
|
-
constructor(e, t = Te) {
|
1915
|
-
b(this, "assets");
|
1916
|
-
b(this, "datasets");
|
1917
|
-
b(this, "live");
|
1918
|
-
b(this, "projects");
|
1919
|
-
b(this, "users");
|
1920
|
-
/**
|
1921
|
-
* Observable version of the Sanity client, with the same configuration as the promise-based one
|
1922
|
-
*/
|
1923
|
-
b(this, "observable");
|
1924
|
-
/**
|
1925
|
-
* Private properties
|
1926
|
-
*/
|
1927
|
-
C(this, V);
|
1928
|
-
C(this, $);
|
1929
|
-
/**
|
1930
|
-
* Instance properties
|
1931
|
-
*/
|
1932
|
-
b(this, "listen", Yn);
|
1933
|
-
this.config(t), _(this, $, e), this.assets = new Bs(this, y(this, $)), this.datasets = new Ks(this, y(this, $)), this.live = new Kn(this), this.projects = new ti(this, y(this, $)), this.users = new ri(this, y(this, $)), this.observable = new gt(e, t);
|
1934
|
-
}
|
1935
|
-
/**
|
1936
|
-
* Clone the client - returns a new instance
|
1937
|
-
*/
|
1938
|
-
clone() {
|
1939
|
-
return new tt(y(this, $), this.config());
|
1940
|
-
}
|
1941
|
-
config(e) {
|
1942
|
-
if (e === void 0)
|
1943
|
-
return { ...y(this, V) };
|
1944
|
-
if (y(this, V) && y(this, V).allowReconfigure === !1)
|
1945
|
-
throw new Error(
|
1946
|
-
"Existing client instance cannot be reconfigured - use `withConfig(newConfig)` to return a new client"
|
1947
|
-
);
|
1948
|
-
return this.observable && this.observable.config(e), _(this, V, qn(e, y(this, V) || {})), this;
|
1949
|
-
}
|
1950
|
-
/**
|
1951
|
-
* Clone the client with a new (partial) configuration.
|
1952
|
-
*
|
1953
|
-
* @param newConfig - New client configuration properties, shallowly merged with existing configuration
|
1954
|
-
*/
|
1955
|
-
withConfig(e) {
|
1956
|
-
const t = this.config();
|
1957
|
-
return new tt(y(this, $), {
|
1958
|
-
...t,
|
1959
|
-
...e,
|
1960
|
-
stega: {
|
1961
|
-
...t.stega || {},
|
1962
|
-
...typeof (e == null ? void 0 : e.stega) == "boolean" ? { enabled: e.stega } : (e == null ? void 0 : e.stega) || {}
|
1963
|
-
}
|
1964
|
-
});
|
1965
|
-
}
|
1966
|
-
fetch(e, t, r) {
|
1967
|
-
return O(
|
1968
|
-
Vn(
|
1969
|
-
this,
|
1970
|
-
y(this, $),
|
1971
|
-
y(this, V).stega,
|
1972
|
-
e,
|
1973
|
-
t,
|
1974
|
-
r
|
1975
|
-
)
|
1976
|
-
);
|
1977
|
-
}
|
1978
|
-
/**
|
1979
|
-
* Fetch a single document with the given ID.
|
1980
|
-
*
|
1981
|
-
* @param id - Document ID to fetch
|
1982
|
-
* @param options - Request options
|
1983
|
-
*/
|
1984
|
-
getDocument(e, t) {
|
1985
|
-
return O(Bn(this, y(this, $), e, t));
|
1986
|
-
}
|
1987
|
-
/**
|
1988
|
-
* Fetch multiple documents in one request.
|
1989
|
-
* Should be used sparingly - performing a query is usually a better option.
|
1990
|
-
* The order/position of documents is preserved based on the original array of IDs.
|
1991
|
-
* If any of the documents are missing, they will be replaced by a `null` entry in the returned array
|
1992
|
-
*
|
1993
|
-
* @param ids - Document IDs to fetch
|
1994
|
-
* @param options - Request options
|
1995
|
-
*/
|
1996
|
-
getDocuments(e, t) {
|
1997
|
-
return O(Nn(this, y(this, $), e, t));
|
1998
|
-
}
|
1999
|
-
create(e, t) {
|
2000
|
-
return O(
|
2001
|
-
st(this, y(this, $), e, "create", t)
|
2002
|
-
);
|
2003
|
-
}
|
2004
|
-
createIfNotExists(e, t) {
|
2005
|
-
return O(
|
2006
|
-
zn(this, y(this, $), e, t)
|
2007
|
-
);
|
2008
|
-
}
|
2009
|
-
createOrReplace(e, t) {
|
2010
|
-
return O(
|
2011
|
-
Zn(this, y(this, $), e, t)
|
2012
|
-
);
|
2013
|
-
}
|
2014
|
-
delete(e, t) {
|
2015
|
-
return O(Jn(this, y(this, $), e, t));
|
2016
|
-
}
|
2017
|
-
mutate(e, t) {
|
2018
|
-
return O(Gn(this, y(this, $), e, t));
|
2019
|
-
}
|
2020
|
-
/**
|
2021
|
-
* Create a new buildable patch of operations to perform
|
2022
|
-
*
|
2023
|
-
* @param selection - Document ID, an array of document IDs, or an object with `query` and optional `params`, defining which document(s) to patch
|
2024
|
-
* @param operations - Optional object of patch operations to initialize the patch instance with
|
2025
|
-
* @returns Patch instance - call `.commit()` to perform the operations defined
|
2026
|
-
*/
|
2027
|
-
patch(e, t) {
|
2028
|
-
return new ie(e, t, this);
|
2029
|
-
}
|
2030
|
-
/**
|
2031
|
-
* Create a new transaction of mutations
|
2032
|
-
*
|
2033
|
-
* @param operations - Optional array of mutation operations to initialize the transaction instance with
|
2034
|
-
*/
|
2035
|
-
transaction(e) {
|
2036
|
-
return new Ge(e, this);
|
2037
|
-
}
|
2038
|
-
/**
|
2039
|
-
* Perform action operations against the configured dataset
|
2040
|
-
* Returns a promise that resolves to the transaction result
|
2041
|
-
*
|
2042
|
-
* @param operations - Action operation(s) to execute
|
2043
|
-
* @param options - Action options
|
2044
|
-
*/
|
2045
|
-
action(e, t) {
|
2046
|
-
return O(Wn(this, y(this, $), e, t));
|
2047
|
-
}
|
2048
|
-
/**
|
2049
|
-
* Perform a request against the Sanity API
|
2050
|
-
* NOTE: Only use this for Sanity API endpoints, not for your own APIs!
|
2051
|
-
*
|
2052
|
-
* @param options - Request options
|
2053
|
-
* @returns Promise resolving to the response body
|
2054
|
-
*/
|
2055
|
-
request(e) {
|
2056
|
-
return O(q(this, y(this, $), e));
|
2057
|
-
}
|
2058
|
-
/**
|
2059
|
-
* Perform an HTTP request a `/data` sub-endpoint
|
2060
|
-
* NOTE: Considered internal, thus marked as deprecated. Use `request` instead.
|
2061
|
-
*
|
2062
|
-
* @deprecated - Use `request()` or your own HTTP library instead
|
2063
|
-
* @param endpoint - Endpoint to hit (mutate, query etc)
|
2064
|
-
* @param body - Request body
|
2065
|
-
* @param options - Request options
|
2066
|
-
* @internal
|
2067
|
-
*/
|
2068
|
-
dataRequest(e, t, r) {
|
2069
|
-
return O(Ee(this, y(this, $), e, t, r));
|
2070
|
-
}
|
2071
|
-
/**
|
2072
|
-
* Get a Sanity API URL for the URI provided
|
2073
|
-
*
|
2074
|
-
* @param uri - URI/path to build URL for
|
2075
|
-
* @param canUseCdn - Whether or not to allow using the API CDN for this route
|
2076
|
-
*/
|
2077
|
-
getUrl(e, t) {
|
2078
|
-
return At(this, e, t);
|
2079
|
-
}
|
2080
|
-
/**
|
2081
|
-
* Get a Sanity API URL for the data operation and path provided
|
2082
|
-
*
|
2083
|
-
* @param operation - Data operation (eg `query`, `mutate`, `listen` or similar)
|
2084
|
-
* @param path - Path to append after the operation
|
2085
|
-
*/
|
2086
|
-
getDataUrl(e, t) {
|
2087
|
-
return ae(this, e, t);
|
2088
|
-
}
|
2089
|
-
};
|
2090
|
-
V = new WeakMap(), $ = new WeakMap();
|
2091
|
-
let mt = tt;
|
2092
|
-
function si(n, e) {
|
2093
|
-
const t = gs(n);
|
2094
|
-
return { requester: t, createClient: (r) => new e(
|
2095
|
-
(s, i) => (i || t)({
|
2096
|
-
maxRedirects: 0,
|
2097
|
-
maxRetries: r.maxRetries,
|
2098
|
-
retryDelay: r.retryDelay,
|
2099
|
-
...s
|
2100
|
-
}),
|
2101
|
-
r
|
2102
|
-
) };
|
2103
|
-
}
|
2104
|
-
var ii = [];
|
2105
|
-
const oi = si(ii, mt), Mo = oi.createClient;
|
2106
|
-
function ai() {
|
2107
|
-
if (typeof globalThis < "u")
|
2108
|
-
return globalThis;
|
2109
|
-
if (typeof self < "u")
|
2110
|
-
return self;
|
2111
|
-
if (typeof window < "u")
|
2112
|
-
return window;
|
2113
|
-
if (typeof global < "u")
|
2114
|
-
return global;
|
2115
|
-
}
|
2116
|
-
function ci() {
|
2117
|
-
const n = ai();
|
2118
|
-
if (n.__xstate__)
|
2119
|
-
return n.__xstate__;
|
2120
|
-
}
|
2121
|
-
const ui = (n) => {
|
2122
|
-
if (typeof window > "u")
|
2123
|
-
return;
|
2124
|
-
const e = ci();
|
2125
|
-
e && e.register(n);
|
2126
|
-
};
|
2127
|
-
class cn {
|
2128
|
-
constructor(e) {
|
2129
|
-
this._process = e, this._active = !1, this._current = null, this._last = null;
|
2130
|
-
}
|
2131
|
-
start() {
|
2132
|
-
this._active = !0, this.flush();
|
2133
|
-
}
|
2134
|
-
clear() {
|
2135
|
-
this._current && (this._current.next = null, this._last = this._current);
|
2136
|
-
}
|
2137
|
-
enqueue(e) {
|
2138
|
-
const t = {
|
2139
|
-
value: e,
|
2140
|
-
next: null
|
2141
|
-
};
|
2142
|
-
if (this._current) {
|
2143
|
-
this._last.next = t, this._last = t;
|
2144
|
-
return;
|
2145
|
-
}
|
2146
|
-
this._current = t, this._last = t, this._active && this.flush();
|
2147
|
-
}
|
2148
|
-
flush() {
|
2149
|
-
for (; this._current; ) {
|
2150
|
-
const e = this._current;
|
2151
|
-
this._process(e.value), this._current = e.next;
|
2152
|
-
}
|
2153
|
-
this._last = null;
|
2154
|
-
}
|
2155
|
-
}
|
2156
|
-
const er = ".", di = "", tr = "", hi = "#", li = "*", nr = "xstate.init", fi = "xstate.error", $e = "xstate.stop";
|
2157
|
-
function pi(n, e) {
|
2158
|
-
return {
|
2159
|
-
type: `xstate.after.${n}.${e}`
|
2160
|
-
};
|
2161
|
-
}
|
2162
|
-
function wt(n, e) {
|
2163
|
-
return {
|
2164
|
-
type: `xstate.done.state.${n}`,
|
2165
|
-
output: e
|
2166
|
-
};
|
2167
|
-
}
|
2168
|
-
function yi(n, e) {
|
2169
|
-
return {
|
2170
|
-
type: `xstate.done.actor.${n}`,
|
2171
|
-
output: e,
|
2172
|
-
actorId: n
|
2173
|
-
};
|
2174
|
-
}
|
2175
|
-
function rr(n, e) {
|
2176
|
-
return {
|
2177
|
-
type: `xstate.error.actor.${n}`,
|
2178
|
-
error: e,
|
2179
|
-
actorId: n
|
2180
|
-
};
|
2181
|
-
}
|
2182
|
-
function sr(n) {
|
2183
|
-
return {
|
2184
|
-
type: nr,
|
2185
|
-
input: n
|
2186
|
-
};
|
2187
|
-
}
|
2188
|
-
function F(n) {
|
2189
|
-
setTimeout(() => {
|
2190
|
-
throw n;
|
2191
|
-
});
|
2192
|
-
}
|
2193
|
-
const gi = typeof Symbol == "function" && Symbol.observable || "@@observable";
|
2194
|
-
function ir(n, e) {
|
2195
|
-
const t = un(n), r = un(e);
|
2196
|
-
return typeof r == "string" ? typeof t == "string" ? r === t : !1 : typeof t == "string" ? t in r : Object.keys(t).every((s) => s in r ? ir(t[s], r[s]) : !1);
|
2197
|
-
}
|
2198
|
-
function It(n) {
|
2199
|
-
if (ar(n))
|
2200
|
-
return n;
|
2201
|
-
const e = [];
|
2202
|
-
let t = "";
|
2203
|
-
for (let r = 0; r < n.length; r++) {
|
2204
|
-
switch (n.charCodeAt(r)) {
|
2205
|
-
case 92:
|
2206
|
-
t += n[r + 1], r++;
|
2207
|
-
continue;
|
2208
|
-
case 46:
|
2209
|
-
e.push(t), t = "";
|
2210
|
-
continue;
|
2211
|
-
}
|
2212
|
-
t += n[r];
|
2213
|
-
}
|
2214
|
-
return e.push(t), e;
|
2215
|
-
}
|
2216
|
-
function un(n) {
|
2217
|
-
if (Gi(n))
|
2218
|
-
return n.value;
|
2219
|
-
if (typeof n != "string")
|
2220
|
-
return n;
|
2221
|
-
const e = It(n);
|
2222
|
-
return mi(e);
|
2223
|
-
}
|
2224
|
-
function mi(n) {
|
2225
|
-
if (n.length === 1)
|
2226
|
-
return n[0];
|
2227
|
-
const e = {};
|
2228
|
-
let t = e;
|
2229
|
-
for (let r = 0; r < n.length - 1; r++)
|
2230
|
-
if (r === n.length - 2)
|
2231
|
-
t[n[r]] = n[r + 1];
|
2232
|
-
else {
|
2233
|
-
const s = t;
|
2234
|
-
t = {}, s[n[r]] = t;
|
2235
|
-
}
|
2236
|
-
return e;
|
2237
|
-
}
|
2238
|
-
function dn(n, e) {
|
2239
|
-
const t = {}, r = Object.keys(n);
|
2240
|
-
for (let s = 0; s < r.length; s++) {
|
2241
|
-
const i = r[s];
|
2242
|
-
t[i] = e(n[i], i, n, s);
|
2243
|
-
}
|
2244
|
-
return t;
|
2245
|
-
}
|
2246
|
-
function or(n) {
|
2247
|
-
return ar(n) ? n : [n];
|
2248
|
-
}
|
2249
|
-
function B(n) {
|
2250
|
-
return n === void 0 ? [] : or(n);
|
2251
|
-
}
|
2252
|
-
function vt(n, e, t, r) {
|
2253
|
-
return typeof n == "function" ? n({
|
2254
|
-
context: e,
|
2255
|
-
event: t,
|
2256
|
-
self: r
|
2257
|
-
}) : n;
|
2258
|
-
}
|
2259
|
-
function ar(n) {
|
2260
|
-
return Array.isArray(n);
|
2261
|
-
}
|
2262
|
-
function wi(n) {
|
2263
|
-
return n.type.startsWith("xstate.error.actor");
|
2264
|
-
}
|
2265
|
-
function de(n) {
|
2266
|
-
return or(n).map((e) => typeof e > "u" || typeof e == "string" ? {
|
2267
|
-
target: e
|
2268
|
-
} : e);
|
2269
|
-
}
|
2270
|
-
function cr(n) {
|
2271
|
-
if (!(n === void 0 || n === di))
|
2272
|
-
return B(n);
|
2273
|
-
}
|
2274
|
-
function bt(n, e, t) {
|
2275
|
-
var i, o, a;
|
2276
|
-
const r = typeof n == "object", s = r ? n : void 0;
|
2277
|
-
return {
|
2278
|
-
next: (i = r ? n.next : n) == null ? void 0 : i.bind(s),
|
2279
|
-
error: (o = r ? n.error : e) == null ? void 0 : o.bind(s),
|
2280
|
-
complete: (a = r ? n.complete : t) == null ? void 0 : a.bind(s)
|
2281
|
-
};
|
2282
|
-
}
|
2283
|
-
function hn(n, e) {
|
2284
|
-
return `${e}.${n}`;
|
2285
|
-
}
|
2286
|
-
function Ot(n, e) {
|
2287
|
-
const t = e.match(/^xstate\.invoke\.(\d+)\.(.*)/);
|
2288
|
-
if (!t)
|
2289
|
-
return n.implementations.actors[e];
|
2290
|
-
const [, r, s] = t, o = n.getStateNodeById(s).config.invoke;
|
2291
|
-
return (Array.isArray(o) ? o[r] : o).src;
|
2292
|
-
}
|
2293
|
-
function ln(n, e) {
|
2294
|
-
return `${n.sessionId}.${e}`;
|
2295
|
-
}
|
2296
|
-
let vi = 0;
|
2297
|
-
function bi(n, e) {
|
2298
|
-
const t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new Set(), o = {}, {
|
2299
|
-
clock: a,
|
2300
|
-
logger: c
|
2301
|
-
} = e, u = {
|
2302
|
-
schedule: (h, l, p, f, m = Math.random().toString(36).slice(2)) => {
|
2303
|
-
const x = {
|
2304
|
-
source: h,
|
2305
|
-
target: l,
|
2306
|
-
event: p,
|
2307
|
-
delay: f,
|
2308
|
-
id: m,
|
2309
|
-
startedAt: Date.now()
|
2310
|
-
}, w = ln(h, m);
|
2311
|
-
d._snapshot._scheduledEvents[w] = x;
|
2312
|
-
const E = a.setTimeout(() => {
|
2313
|
-
delete o[w], delete d._snapshot._scheduledEvents[w], d._relay(h, l, p);
|
2314
|
-
}, f);
|
2315
|
-
o[w] = E;
|
2316
|
-
},
|
2317
|
-
cancel: (h, l) => {
|
2318
|
-
const p = ln(h, l), f = o[p];
|
2319
|
-
delete o[p], delete d._snapshot._scheduledEvents[p], f !== void 0 && a.clearTimeout(f);
|
2320
|
-
},
|
2321
|
-
cancelAll: (h) => {
|
2322
|
-
for (const l in d._snapshot._scheduledEvents) {
|
2323
|
-
const p = d._snapshot._scheduledEvents[l];
|
2324
|
-
p.source === h && u.cancel(h, p.id);
|
2325
|
-
}
|
2326
|
-
}
|
2327
|
-
}, g = (h) => {
|
2328
|
-
if (!i.size)
|
2329
|
-
return;
|
2330
|
-
const l = {
|
2331
|
-
...h,
|
2332
|
-
rootId: n.sessionId
|
2333
|
-
};
|
2334
|
-
i.forEach((p) => {
|
2335
|
-
var f;
|
2336
|
-
return (f = p.next) == null ? void 0 : f.call(p, l);
|
2337
|
-
});
|
2338
|
-
}, d = {
|
2339
|
-
_snapshot: {
|
2340
|
-
_scheduledEvents: ((e == null ? void 0 : e.snapshot) && e.snapshot.scheduler) ?? {}
|
2341
|
-
},
|
2342
|
-
_bookId: () => `x:${vi++}`,
|
2343
|
-
_register: (h, l) => (t.set(h, l), h),
|
2344
|
-
_unregister: (h) => {
|
2345
|
-
t.delete(h.sessionId);
|
2346
|
-
const l = s.get(h);
|
2347
|
-
l !== void 0 && (r.delete(l), s.delete(h));
|
2348
|
-
},
|
2349
|
-
get: (h) => r.get(h),
|
2350
|
-
_set: (h, l) => {
|
2351
|
-
const p = r.get(h);
|
2352
|
-
if (p && p !== l)
|
2353
|
-
throw new Error(`Actor with system ID '${h}' already exists.`);
|
2354
|
-
r.set(h, l), s.set(l, h);
|
2355
|
-
},
|
2356
|
-
inspect: (h) => {
|
2357
|
-
const l = bt(h);
|
2358
|
-
return i.add(l), {
|
2359
|
-
unsubscribe() {
|
2360
|
-
i.delete(l);
|
2361
|
-
}
|
2362
|
-
};
|
2363
|
-
},
|
2364
|
-
_sendInspectionEvent: g,
|
2365
|
-
_relay: (h, l, p) => {
|
2366
|
-
d._sendInspectionEvent({
|
2367
|
-
type: "@xstate.event",
|
2368
|
-
sourceRef: h,
|
2369
|
-
actorRef: l,
|
2370
|
-
event: p
|
2371
|
-
}), l._send(p);
|
2372
|
-
},
|
2373
|
-
scheduler: u,
|
2374
|
-
getSnapshot: () => ({
|
2375
|
-
_scheduledEvents: {
|
2376
|
-
...d._snapshot._scheduledEvents
|
2377
|
-
}
|
2378
|
-
}),
|
2379
|
-
start: () => {
|
2380
|
-
const h = d._snapshot._scheduledEvents;
|
2381
|
-
d._snapshot._scheduledEvents = {};
|
2382
|
-
for (const l in h) {
|
2383
|
-
const {
|
2384
|
-
source: p,
|
2385
|
-
target: f,
|
2386
|
-
event: m,
|
2387
|
-
delay: x,
|
2388
|
-
id: w
|
2389
|
-
} = h[l];
|
2390
|
-
u.schedule(p, f, m, x, w);
|
2391
|
-
}
|
2392
|
-
},
|
2393
|
-
_clock: a,
|
2394
|
-
_logger: c
|
2395
|
-
};
|
2396
|
-
return d;
|
2397
|
-
}
|
2398
|
-
let ut = !1;
|
2399
|
-
const Mt = 1;
|
2400
|
-
let j = /* @__PURE__ */ function(n) {
|
2401
|
-
return n[n.NotStarted = 0] = "NotStarted", n[n.Running = 1] = "Running", n[n.Stopped = 2] = "Stopped", n;
|
2402
|
-
}({});
|
2403
|
-
const _i = {
|
2404
|
-
clock: {
|
2405
|
-
setTimeout: (n, e) => setTimeout(n, e),
|
2406
|
-
clearTimeout: (n) => clearTimeout(n)
|
2407
|
-
},
|
2408
|
-
logger: console.log.bind(console),
|
2409
|
-
devTools: !1
|
2410
|
-
};
|
2411
|
-
class Ei {
|
2412
|
-
/**
|
2413
|
-
* Creates a new actor instance for the given logic with the provided options,
|
2414
|
-
* if any.
|
2415
|
-
*
|
2416
|
-
* @param logic The logic to create an actor from
|
2417
|
-
* @param options Actor options
|
2418
|
-
*/
|
2419
|
-
constructor(e, t) {
|
2420
|
-
this.logic = e, this._snapshot = void 0, this.clock = void 0, this.options = void 0, this.id = void 0, this.mailbox = new cn(this._process.bind(this)), this.observers = /* @__PURE__ */ new Set(), this.eventListeners = /* @__PURE__ */ new Map(), this.logger = void 0, this._processingStatus = j.NotStarted, this._parent = void 0, this._syncSnapshot = void 0, this.ref = void 0, this._actorScope = void 0, this._systemId = void 0, this.sessionId = void 0, this.system = void 0, this._doneEvent = void 0, this.src = void 0, this._deferred = [];
|
2421
|
-
const r = {
|
2422
|
-
..._i,
|
2423
|
-
...t
|
2424
|
-
}, {
|
2425
|
-
clock: s,
|
2426
|
-
logger: i,
|
2427
|
-
parent: o,
|
2428
|
-
syncSnapshot: a,
|
2429
|
-
id: c,
|
2430
|
-
systemId: u,
|
2431
|
-
inspect: g
|
2432
|
-
} = r;
|
2433
|
-
this.system = o ? o.system : bi(this, {
|
2434
|
-
clock: s,
|
2435
|
-
logger: i
|
2436
|
-
}), g && !o && this.system.inspect(bt(g)), this.sessionId = this.system._bookId(), this.id = c ?? this.sessionId, this.logger = (t == null ? void 0 : t.logger) ?? this.system._logger, this.clock = (t == null ? void 0 : t.clock) ?? this.system._clock, this._parent = o, this._syncSnapshot = a, this.options = r, this.src = r.src ?? e, this.ref = this, this._actorScope = {
|
2437
|
-
self: this,
|
2438
|
-
id: this.id,
|
2439
|
-
sessionId: this.sessionId,
|
2440
|
-
logger: this.logger,
|
2441
|
-
defer: (d) => {
|
2442
|
-
this._deferred.push(d);
|
2443
|
-
},
|
2444
|
-
system: this.system,
|
2445
|
-
stopChild: (d) => {
|
2446
|
-
if (d._parent !== this)
|
2447
|
-
throw new Error(`Cannot stop child actor ${d.id} of ${this.id} because it is not a child`);
|
2448
|
-
d._stop();
|
2449
|
-
},
|
2450
|
-
emit: (d) => {
|
2451
|
-
const h = this.eventListeners.get(d.type), l = this.eventListeners.get("*");
|
2452
|
-
if (!h && !l)
|
2453
|
-
return;
|
2454
|
-
const p = [...h ? h.values() : [], ...l ? l.values() : []];
|
2455
|
-
for (const f of p)
|
2456
|
-
f(d);
|
2457
|
-
},
|
2458
|
-
actionExecutor: (d) => {
|
2459
|
-
const h = () => {
|
2460
|
-
if (this._actorScope.system._sendInspectionEvent({
|
2461
|
-
type: "@xstate.action",
|
2462
|
-
actorRef: this,
|
2463
|
-
action: {
|
2464
|
-
type: d.type,
|
2465
|
-
params: d.params
|
2466
|
-
}
|
2467
|
-
}), !d.exec)
|
2468
|
-
return;
|
2469
|
-
const l = ut;
|
2470
|
-
try {
|
2471
|
-
ut = !0, d.exec(d.info, d.params);
|
2472
|
-
} finally {
|
2473
|
-
ut = l;
|
2474
|
-
}
|
2475
|
-
};
|
2476
|
-
this._processingStatus === j.Running ? h() : this._deferred.push(h);
|
2477
|
-
}
|
2478
|
-
}, this.send = this.send.bind(this), this.system._sendInspectionEvent({
|
2479
|
-
type: "@xstate.actor",
|
2480
|
-
actorRef: this
|
2481
|
-
}), u && (this._systemId = u, this.system._set(u, this)), this._initState((t == null ? void 0 : t.snapshot) ?? (t == null ? void 0 : t.state)), u && this._snapshot.status !== "active" && this.system._unregister(this);
|
2482
|
-
}
|
2483
|
-
_initState(e) {
|
2484
|
-
var t;
|
2485
|
-
try {
|
2486
|
-
this._snapshot = e ? this.logic.restoreSnapshot ? this.logic.restoreSnapshot(e, this._actorScope) : e : this.logic.getInitialSnapshot(this._actorScope, (t = this.options) == null ? void 0 : t.input);
|
2487
|
-
} catch (r) {
|
2488
|
-
this._snapshot = {
|
2489
|
-
status: "error",
|
2490
|
-
output: void 0,
|
2491
|
-
error: r
|
2492
|
-
};
|
2493
|
-
}
|
2494
|
-
}
|
2495
|
-
update(e, t) {
|
2496
|
-
var s, i;
|
2497
|
-
this._snapshot = e;
|
2498
|
-
let r;
|
2499
|
-
for (; r = this._deferred.shift(); )
|
2500
|
-
try {
|
2501
|
-
r();
|
2502
|
-
} catch (o) {
|
2503
|
-
this._deferred.length = 0, this._snapshot = {
|
2504
|
-
...e,
|
2505
|
-
status: "error",
|
2506
|
-
error: o
|
2507
|
-
};
|
2508
|
-
}
|
2509
|
-
switch (this._snapshot.status) {
|
2510
|
-
case "active":
|
2511
|
-
for (const o of this.observers)
|
2512
|
-
try {
|
2513
|
-
(s = o.next) == null || s.call(o, e);
|
2514
|
-
} catch (a) {
|
2515
|
-
F(a);
|
2516
|
-
}
|
2517
|
-
break;
|
2518
|
-
case "done":
|
2519
|
-
for (const o of this.observers)
|
2520
|
-
try {
|
2521
|
-
(i = o.next) == null || i.call(o, e);
|
2522
|
-
} catch (a) {
|
2523
|
-
F(a);
|
2524
|
-
}
|
2525
|
-
this._stopProcedure(), this._complete(), this._doneEvent = yi(this.id, this._snapshot.output), this._parent && this.system._relay(this, this._parent, this._doneEvent);
|
2526
|
-
break;
|
2527
|
-
case "error":
|
2528
|
-
this._error(this._snapshot.error);
|
2529
|
-
break;
|
2530
|
-
}
|
2531
|
-
this.system._sendInspectionEvent({
|
2532
|
-
type: "@xstate.snapshot",
|
2533
|
-
actorRef: this,
|
2534
|
-
event: t,
|
2535
|
-
snapshot: e
|
2536
|
-
});
|
2537
|
-
}
|
2538
|
-
/**
|
2539
|
-
* Subscribe an observer to an actor’s snapshot values.
|
2540
|
-
*
|
2541
|
-
* @remarks
|
2542
|
-
* The observer will receive the actor’s snapshot value when it is emitted.
|
2543
|
-
* The observer can be:
|
2544
|
-
*
|
2545
|
-
* - A plain function that receives the latest snapshot, or
|
2546
|
-
* - An observer object whose `.next(snapshot)` method receives the latest
|
2547
|
-
* snapshot
|
2548
|
-
*
|
2549
|
-
* @example
|
2550
|
-
*
|
2551
|
-
* ```ts
|
2552
|
-
* // Observer as a plain function
|
2553
|
-
* const subscription = actor.subscribe((snapshot) => {
|
2554
|
-
* console.log(snapshot);
|
2555
|
-
* });
|
2556
|
-
* ```
|
2557
|
-
*
|
2558
|
-
* @example
|
2559
|
-
*
|
2560
|
-
* ```ts
|
2561
|
-
* // Observer as an object
|
2562
|
-
* const subscription = actor.subscribe({
|
2563
|
-
* next(snapshot) {
|
2564
|
-
* console.log(snapshot);
|
2565
|
-
* },
|
2566
|
-
* error(err) {
|
2567
|
-
* // ...
|
2568
|
-
* },
|
2569
|
-
* complete() {
|
2570
|
-
* // ...
|
2571
|
-
* }
|
2572
|
-
* });
|
2573
|
-
* ```
|
2574
|
-
*
|
2575
|
-
* The return value of `actor.subscribe(observer)` is a subscription object
|
2576
|
-
* that has an `.unsubscribe()` method. You can call
|
2577
|
-
* `subscription.unsubscribe()` to unsubscribe the observer:
|
2578
|
-
*
|
2579
|
-
* @example
|
2580
|
-
*
|
2581
|
-
* ```ts
|
2582
|
-
* const subscription = actor.subscribe((snapshot) => {
|
2583
|
-
* // ...
|
2584
|
-
* });
|
2585
|
-
*
|
2586
|
-
* // Unsubscribe the observer
|
2587
|
-
* subscription.unsubscribe();
|
2588
|
-
* ```
|
2589
|
-
*
|
2590
|
-
* When the actor is stopped, all of its observers will automatically be
|
2591
|
-
* unsubscribed.
|
2592
|
-
*
|
2593
|
-
* @param observer - Either a plain function that receives the latest
|
2594
|
-
* snapshot, or an observer object whose `.next(snapshot)` method receives
|
2595
|
-
* the latest snapshot
|
2596
|
-
*/
|
2597
|
-
subscribe(e, t, r) {
|
2598
|
-
var i;
|
2599
|
-
const s = bt(e, t, r);
|
2600
|
-
if (this._processingStatus !== j.Stopped)
|
2601
|
-
this.observers.add(s);
|
2602
|
-
else
|
2603
|
-
switch (this._snapshot.status) {
|
2604
|
-
case "done":
|
2605
|
-
try {
|
2606
|
-
(i = s.complete) == null || i.call(s);
|
2607
|
-
} catch (o) {
|
2608
|
-
F(o);
|
2609
|
-
}
|
2610
|
-
break;
|
2611
|
-
case "error": {
|
2612
|
-
const o = this._snapshot.error;
|
2613
|
-
if (!s.error)
|
2614
|
-
F(o);
|
2615
|
-
else
|
2616
|
-
try {
|
2617
|
-
s.error(o);
|
2618
|
-
} catch (a) {
|
2619
|
-
F(a);
|
2620
|
-
}
|
2621
|
-
break;
|
2622
|
-
}
|
2623
|
-
}
|
2624
|
-
return {
|
2625
|
-
unsubscribe: () => {
|
2626
|
-
this.observers.delete(s);
|
2627
|
-
}
|
2628
|
-
};
|
2629
|
-
}
|
2630
|
-
on(e, t) {
|
2631
|
-
let r = this.eventListeners.get(e);
|
2632
|
-
r || (r = /* @__PURE__ */ new Set(), this.eventListeners.set(e, r));
|
2633
|
-
const s = t.bind(void 0);
|
2634
|
-
return r.add(s), {
|
2635
|
-
unsubscribe: () => {
|
2636
|
-
r.delete(s);
|
2637
|
-
}
|
2638
|
-
};
|
2639
|
-
}
|
2640
|
-
/** Starts the Actor from the initial state */
|
2641
|
-
start() {
|
2642
|
-
if (this._processingStatus === j.Running)
|
2643
|
-
return this;
|
2644
|
-
this._syncSnapshot && this.subscribe({
|
2645
|
-
next: (r) => {
|
2646
|
-
r.status === "active" && this.system._relay(this, this._parent, {
|
2647
|
-
type: `xstate.snapshot.${this.id}`,
|
2648
|
-
snapshot: r
|
2649
|
-
});
|
2650
|
-
},
|
2651
|
-
error: () => {
|
2652
|
-
}
|
2653
|
-
}), this.system._register(this.sessionId, this), this._systemId && this.system._set(this._systemId, this), this._processingStatus = j.Running;
|
2654
|
-
const e = sr(this.options.input);
|
2655
|
-
switch (this.system._sendInspectionEvent({
|
2656
|
-
type: "@xstate.event",
|
2657
|
-
sourceRef: this._parent,
|
2658
|
-
actorRef: this,
|
2659
|
-
event: e
|
2660
|
-
}), this._snapshot.status) {
|
2661
|
-
case "done":
|
2662
|
-
return this.update(this._snapshot, e), this;
|
2663
|
-
case "error":
|
2664
|
-
return this._error(this._snapshot.error), this;
|
2665
|
-
}
|
2666
|
-
if (this._parent || this.system.start(), this.logic.start)
|
2667
|
-
try {
|
2668
|
-
this.logic.start(this._snapshot, this._actorScope);
|
2669
|
-
} catch (r) {
|
2670
|
-
return this._snapshot = {
|
2671
|
-
...this._snapshot,
|
2672
|
-
status: "error",
|
2673
|
-
error: r
|
2674
|
-
}, this._error(r), this;
|
2675
|
-
}
|
2676
|
-
return this.update(this._snapshot, e), this.options.devTools && this.attachDevTools(), this.mailbox.start(), this;
|
2677
|
-
}
|
2678
|
-
_process(e) {
|
2679
|
-
let t, r;
|
2680
|
-
try {
|
2681
|
-
t = this.logic.transition(this._snapshot, e, this._actorScope);
|
2682
|
-
} catch (s) {
|
2683
|
-
r = {
|
2684
|
-
err: s
|
2685
|
-
};
|
2686
|
-
}
|
2687
|
-
if (r) {
|
2688
|
-
const {
|
2689
|
-
err: s
|
2690
|
-
} = r;
|
2691
|
-
this._snapshot = {
|
2692
|
-
...this._snapshot,
|
2693
|
-
status: "error",
|
2694
|
-
error: s
|
2695
|
-
}, this._error(s);
|
2696
|
-
return;
|
2697
|
-
}
|
2698
|
-
this.update(t, e), e.type === $e && (this._stopProcedure(), this._complete());
|
2699
|
-
}
|
2700
|
-
_stop() {
|
2701
|
-
return this._processingStatus === j.Stopped ? this : (this.mailbox.clear(), this._processingStatus === j.NotStarted ? (this._processingStatus = j.Stopped, this) : (this.mailbox.enqueue({
|
2702
|
-
type: $e
|
2703
|
-
}), this));
|
2704
|
-
}
|
2705
|
-
/** Stops the Actor and unsubscribe all listeners. */
|
2706
|
-
stop() {
|
2707
|
-
if (this._parent)
|
2708
|
-
throw new Error("A non-root actor cannot be stopped directly.");
|
2709
|
-
return this._stop();
|
2710
|
-
}
|
2711
|
-
_complete() {
|
2712
|
-
var e;
|
2713
|
-
for (const t of this.observers)
|
2714
|
-
try {
|
2715
|
-
(e = t.complete) == null || e.call(t);
|
2716
|
-
} catch (r) {
|
2717
|
-
F(r);
|
2718
|
-
}
|
2719
|
-
this.observers.clear();
|
2720
|
-
}
|
2721
|
-
_reportError(e) {
|
2722
|
-
if (!this.observers.size) {
|
2723
|
-
this._parent || F(e);
|
2724
|
-
return;
|
2725
|
-
}
|
2726
|
-
let t = !1;
|
2727
|
-
for (const r of this.observers) {
|
2728
|
-
const s = r.error;
|
2729
|
-
t || (t = !s);
|
2730
|
-
try {
|
2731
|
-
s == null || s(e);
|
2732
|
-
} catch (i) {
|
2733
|
-
F(i);
|
2734
|
-
}
|
2735
|
-
}
|
2736
|
-
this.observers.clear(), t && F(e);
|
2737
|
-
}
|
2738
|
-
_error(e) {
|
2739
|
-
this._stopProcedure(), this._reportError(e), this._parent && this.system._relay(this, this._parent, rr(this.id, e));
|
2740
|
-
}
|
2741
|
-
// TODO: atm children don't belong entirely to the actor so
|
2742
|
-
// in a way - it's not even super aware of them
|
2743
|
-
// so we can't stop them from here but we really should!
|
2744
|
-
// right now, they are being stopped within the machine's transition
|
2745
|
-
// but that could throw and leave us with "orphaned" active actors
|
2746
|
-
_stopProcedure() {
|
2747
|
-
return this._processingStatus !== j.Running ? this : (this.system.scheduler.cancelAll(this), this.mailbox.clear(), this.mailbox = new cn(this._process.bind(this)), this._processingStatus = j.Stopped, this.system._unregister(this), this);
|
2748
|
-
}
|
2749
|
-
/** @internal */
|
2750
|
-
_send(e) {
|
2751
|
-
this._processingStatus !== j.Stopped && this.mailbox.enqueue(e);
|
2752
|
-
}
|
2753
|
-
/**
|
2754
|
-
* Sends an event to the running Actor to trigger a transition.
|
2755
|
-
*
|
2756
|
-
* @param event The event to send
|
2757
|
-
*/
|
2758
|
-
send(e) {
|
2759
|
-
this.system._relay(void 0, this, e);
|
2760
|
-
}
|
2761
|
-
attachDevTools() {
|
2762
|
-
const {
|
2763
|
-
devTools: e
|
2764
|
-
} = this.options;
|
2765
|
-
e && (typeof e == "function" ? e : ui)(this);
|
2766
|
-
}
|
2767
|
-
toJSON() {
|
2768
|
-
return {
|
2769
|
-
xstate$$type: Mt,
|
2770
|
-
id: this.id
|
2771
|
-
};
|
2772
|
-
}
|
2773
|
-
/**
|
2774
|
-
* Obtain the internal state of the actor, which can be persisted.
|
2775
|
-
*
|
2776
|
-
* @remarks
|
2777
|
-
* The internal state can be persisted from any actor, not only machines.
|
2778
|
-
*
|
2779
|
-
* Note that the persisted state is not the same as the snapshot from
|
2780
|
-
* {@link Actor.getSnapshot}. Persisted state represents the internal state of
|
2781
|
-
* the actor, while snapshots represent the actor's last emitted value.
|
2782
|
-
*
|
2783
|
-
* Can be restored with {@link ActorOptions.state}
|
2784
|
-
* @see https://stately.ai/docs/persistence
|
2785
|
-
*/
|
2786
|
-
getPersistedSnapshot(e) {
|
2787
|
-
return this.logic.getPersistedSnapshot(this._snapshot, e);
|
2788
|
-
}
|
2789
|
-
[gi]() {
|
2790
|
-
return this;
|
2791
|
-
}
|
2792
|
-
/**
|
2793
|
-
* Read an actor’s snapshot synchronously.
|
2794
|
-
*
|
2795
|
-
* @remarks
|
2796
|
-
* The snapshot represent an actor's last emitted value.
|
2797
|
-
*
|
2798
|
-
* When an actor receives an event, its internal state may change. An actor
|
2799
|
-
* may emit a snapshot when a state transition occurs.
|
2800
|
-
*
|
2801
|
-
* Note that some actors, such as callback actors generated with
|
2802
|
-
* `fromCallback`, will not emit snapshots.
|
2803
|
-
* @see {@link Actor.subscribe} to subscribe to an actor’s snapshot values.
|
2804
|
-
* @see {@link Actor.getPersistedSnapshot} to persist the internal state of an actor (which is more than just a snapshot).
|
2805
|
-
*/
|
2806
|
-
getSnapshot() {
|
2807
|
-
return this._snapshot;
|
2808
|
-
}
|
2809
|
-
}
|
2810
|
-
function Xe(n, ...[e]) {
|
2811
|
-
return new Ei(n, e);
|
2812
|
-
}
|
2813
|
-
function Ci(n, e, t, r, {
|
2814
|
-
sendId: s
|
2815
|
-
}) {
|
2816
|
-
const i = typeof s == "function" ? s(t, r) : s;
|
2817
|
-
return [e, {
|
2818
|
-
sendId: i
|
2819
|
-
}, void 0];
|
2820
|
-
}
|
2821
|
-
function xi(n, e) {
|
2822
|
-
n.defer(() => {
|
2823
|
-
n.system.scheduler.cancel(n.self, e.sendId);
|
2824
|
-
});
|
2825
|
-
}
|
2826
|
-
function ur(n) {
|
2827
|
-
function e(t, r) {
|
2828
|
-
}
|
2829
|
-
return e.type = "xstate.cancel", e.sendId = n, e.resolve = Ci, e.execute = xi, e;
|
2830
|
-
}
|
2831
|
-
function Si(n, e, t, r, {
|
2832
|
-
id: s,
|
2833
|
-
systemId: i,
|
2834
|
-
src: o,
|
2835
|
-
input: a,
|
2836
|
-
syncSnapshot: c
|
2837
|
-
}) {
|
2838
|
-
const u = typeof o == "string" ? Ot(e.machine, o) : o, g = typeof s == "function" ? s(t) : s;
|
2839
|
-
let d, h;
|
2840
|
-
return u && (h = typeof a == "function" ? a({
|
2841
|
-
context: e.context,
|
2842
|
-
event: t.event,
|
2843
|
-
self: n.self
|
2844
|
-
}) : a, d = Xe(u, {
|
2845
|
-
id: g,
|
2846
|
-
src: o,
|
2847
|
-
parent: n.self,
|
2848
|
-
syncSnapshot: c,
|
2849
|
-
systemId: i,
|
2850
|
-
input: h
|
2851
|
-
})), [oe(e, {
|
2852
|
-
children: {
|
2853
|
-
...e.children,
|
2854
|
-
[g]: d
|
2855
|
-
}
|
2856
|
-
}), {
|
2857
|
-
id: s,
|
2858
|
-
systemId: i,
|
2859
|
-
actorRef: d,
|
2860
|
-
src: o,
|
2861
|
-
input: h
|
2862
|
-
}, void 0];
|
2863
|
-
}
|
2864
|
-
function Ti(n, {
|
2865
|
-
actorRef: e
|
2866
|
-
}) {
|
2867
|
-
e && n.defer(() => {
|
2868
|
-
e._processingStatus !== j.Stopped && e.start();
|
2869
|
-
});
|
2870
|
-
}
|
2871
|
-
function dr(...[n, {
|
2872
|
-
id: e,
|
2873
|
-
systemId: t,
|
2874
|
-
input: r,
|
2875
|
-
syncSnapshot: s = !1
|
2876
|
-
} = {}]) {
|
2877
|
-
function i(o, a) {
|
2878
|
-
}
|
2879
|
-
return i.type = "xstate.spawnChild", i.id = e, i.systemId = t, i.src = n, i.input = r, i.syncSnapshot = s, i.resolve = Si, i.execute = Ti, i;
|
2880
|
-
}
|
2881
|
-
function $i(n, e, t, r, {
|
2882
|
-
actorRef: s
|
2883
|
-
}) {
|
2884
|
-
const i = typeof s == "function" ? s(t, r) : s, o = typeof i == "string" ? e.children[i] : i;
|
2885
|
-
let a = e.children;
|
2886
|
-
return o && (a = {
|
2887
|
-
...a
|
2888
|
-
}, delete a[o.id]), [oe(e, {
|
2889
|
-
children: a
|
2890
|
-
}), o, void 0];
|
2891
|
-
}
|
2892
|
-
function Ai(n, e) {
|
2893
|
-
if (e) {
|
2894
|
-
if (n.system._unregister(e), e._processingStatus !== j.Running) {
|
2895
|
-
n.stopChild(e);
|
2896
|
-
return;
|
2897
|
-
}
|
2898
|
-
n.defer(() => {
|
2899
|
-
n.stopChild(e);
|
2900
|
-
});
|
2901
|
-
}
|
2902
|
-
}
|
2903
|
-
function jt(n) {
|
2904
|
-
function e(t, r) {
|
2905
|
-
}
|
2906
|
-
return e.type = "xstate.stopChild", e.actorRef = n, e.resolve = $i, e.execute = Ai, e;
|
2907
|
-
}
|
2908
|
-
function it(n, e, t, r) {
|
2909
|
-
const {
|
2910
|
-
machine: s
|
2911
|
-
} = r, i = typeof n == "function", o = i ? n : s.implementations.guards[typeof n == "string" ? n : n.type];
|
2912
|
-
if (!i && !o)
|
2913
|
-
throw new Error(`Guard '${typeof n == "string" ? n : n.type}' is not implemented.'.`);
|
2914
|
-
if (typeof o != "function")
|
2915
|
-
return it(o, e, t, r);
|
2916
|
-
const a = {
|
2917
|
-
context: e,
|
2918
|
-
event: t
|
2919
|
-
}, c = i || typeof n == "string" ? void 0 : "params" in n ? typeof n.params == "function" ? n.params({
|
2920
|
-
context: e,
|
2921
|
-
event: t
|
2922
|
-
}) : n.params : void 0;
|
2923
|
-
return "check" in o ? o.check(
|
2924
|
-
r,
|
2925
|
-
a,
|
2926
|
-
o
|
2927
|
-
// this holds all params
|
2928
|
-
) : o(a, c);
|
2929
|
-
}
|
2930
|
-
const Rt = (n) => n.type === "atomic" || n.type === "final";
|
2931
|
-
function ve(n) {
|
2932
|
-
return Object.values(n.states).filter((e) => e.type !== "history");
|
2933
|
-
}
|
2934
|
-
function Ne(n, e) {
|
2935
|
-
const t = [];
|
2936
|
-
if (e === n)
|
2937
|
-
return t;
|
2938
|
-
let r = n.parent;
|
2939
|
-
for (; r && r !== e; )
|
2940
|
-
t.push(r), r = r.parent;
|
2941
|
-
return t;
|
2942
|
-
}
|
2943
|
-
function Ye(n) {
|
2944
|
-
const e = new Set(n), t = lr(e);
|
2945
|
-
for (const r of e)
|
2946
|
-
if (r.type === "compound" && (!t.get(r) || !t.get(r).length))
|
2947
|
-
fn(r).forEach((s) => e.add(s));
|
2948
|
-
else if (r.type === "parallel") {
|
2949
|
-
for (const s of ve(r))
|
2950
|
-
if (s.type !== "history" && !e.has(s)) {
|
2951
|
-
const i = fn(s);
|
2952
|
-
for (const o of i)
|
2953
|
-
e.add(o);
|
2954
|
-
}
|
2955
|
-
}
|
2956
|
-
for (const r of e) {
|
2957
|
-
let s = r.parent;
|
2958
|
-
for (; s; )
|
2959
|
-
e.add(s), s = s.parent;
|
2960
|
-
}
|
2961
|
-
return e;
|
2962
|
-
}
|
2963
|
-
function hr(n, e) {
|
2964
|
-
const t = e.get(n);
|
2965
|
-
if (!t)
|
2966
|
-
return {};
|
2967
|
-
if (n.type === "compound") {
|
2968
|
-
const s = t[0];
|
2969
|
-
if (s) {
|
2970
|
-
if (Rt(s))
|
2971
|
-
return s.key;
|
2972
|
-
} else
|
2973
|
-
return {};
|
2974
|
-
}
|
2975
|
-
const r = {};
|
2976
|
-
for (const s of t)
|
2977
|
-
r[s.key] = hr(s, e);
|
2978
|
-
return r;
|
2979
|
-
}
|
2980
|
-
function lr(n) {
|
2981
|
-
const e = /* @__PURE__ */ new Map();
|
2982
|
-
for (const t of n)
|
2983
|
-
e.has(t) || e.set(t, []), t.parent && (e.has(t.parent) || e.set(t.parent, []), e.get(t.parent).push(t));
|
2984
|
-
return e;
|
2985
|
-
}
|
2986
|
-
function fr(n, e) {
|
2987
|
-
const t = Ye(e);
|
2988
|
-
return hr(n, lr(t));
|
2989
|
-
}
|
2990
|
-
function kt(n, e) {
|
2991
|
-
return e.type === "compound" ? ve(e).some((t) => t.type === "final" && n.has(t)) : e.type === "parallel" ? ve(e).every((t) => kt(n, t)) : e.type === "final";
|
2992
|
-
}
|
2993
|
-
const ot = (n) => n[0] === hi;
|
2994
|
-
function Ii(n, e) {
|
2995
|
-
return n.transitions.get(e) || [...n.transitions.keys()].filter((r) => {
|
2996
|
-
if (r === li)
|
2997
|
-
return !0;
|
2998
|
-
if (!r.endsWith(".*"))
|
2999
|
-
return !1;
|
3000
|
-
const s = r.split("."), i = e.split(".");
|
3001
|
-
for (let o = 0; o < s.length; o++) {
|
3002
|
-
const a = s[o], c = i[o];
|
3003
|
-
if (a === "*")
|
3004
|
-
return o === s.length - 1;
|
3005
|
-
if (a !== c)
|
3006
|
-
return !1;
|
3007
|
-
}
|
3008
|
-
return !0;
|
3009
|
-
}).sort((r, s) => s.length - r.length).flatMap((r) => n.transitions.get(r));
|
3010
|
-
}
|
3011
|
-
function Oi(n) {
|
3012
|
-
const e = n.config.after;
|
3013
|
-
if (!e)
|
3014
|
-
return [];
|
3015
|
-
const t = (s) => {
|
3016
|
-
const i = pi(s, n.id), o = i.type;
|
3017
|
-
return n.entry.push(_r(i, {
|
3018
|
-
id: o,
|
3019
|
-
delay: s
|
3020
|
-
})), n.exit.push(ur(o)), o;
|
3021
|
-
};
|
3022
|
-
return Object.keys(e).flatMap((s) => {
|
3023
|
-
const i = e[s], o = typeof i == "string" ? {
|
3024
|
-
target: i
|
3025
|
-
} : i, a = Number.isNaN(+s) ? s : +s, c = t(a);
|
3026
|
-
return B(o).map((u) => ({
|
3027
|
-
...u,
|
3028
|
-
event: c,
|
3029
|
-
delay: a
|
3030
|
-
}));
|
3031
|
-
}).map((s) => {
|
3032
|
-
const {
|
3033
|
-
delay: i
|
3034
|
-
} = s;
|
3035
|
-
return {
|
3036
|
-
...K(n, s.event, s),
|
3037
|
-
delay: i
|
3038
|
-
};
|
3039
|
-
});
|
3040
|
-
}
|
3041
|
-
function K(n, e, t) {
|
3042
|
-
const r = cr(t.target), s = t.reenter ?? !1, i = Ri(n, r), o = {
|
3043
|
-
...t,
|
3044
|
-
actions: B(t.actions),
|
3045
|
-
guard: t.guard,
|
3046
|
-
target: i,
|
3047
|
-
source: n,
|
3048
|
-
reenter: s,
|
3049
|
-
eventType: e,
|
3050
|
-
toJSON: () => ({
|
3051
|
-
...o,
|
3052
|
-
source: `#${n.id}`,
|
3053
|
-
target: i ? i.map((a) => `#${a.id}`) : void 0
|
3054
|
-
})
|
3055
|
-
};
|
3056
|
-
return o;
|
3057
|
-
}
|
3058
|
-
function Mi(n) {
|
3059
|
-
const e = /* @__PURE__ */ new Map();
|
3060
|
-
if (n.config.on)
|
3061
|
-
for (const t of Object.keys(n.config.on)) {
|
3062
|
-
if (t === tr)
|
3063
|
-
throw new Error('Null events ("") cannot be specified as a transition key. Use `always: { ... }` instead.');
|
3064
|
-
const r = n.config.on[t];
|
3065
|
-
e.set(t, de(r).map((s) => K(n, t, s)));
|
3066
|
-
}
|
3067
|
-
if (n.config.onDone) {
|
3068
|
-
const t = `xstate.done.state.${n.id}`;
|
3069
|
-
e.set(t, de(n.config.onDone).map((r) => K(n, t, r)));
|
3070
|
-
}
|
3071
|
-
for (const t of n.invoke) {
|
3072
|
-
if (t.onDone) {
|
3073
|
-
const r = `xstate.done.actor.${t.id}`;
|
3074
|
-
e.set(r, de(t.onDone).map((s) => K(n, r, s)));
|
3075
|
-
}
|
3076
|
-
if (t.onError) {
|
3077
|
-
const r = `xstate.error.actor.${t.id}`;
|
3078
|
-
e.set(r, de(t.onError).map((s) => K(n, r, s)));
|
3079
|
-
}
|
3080
|
-
if (t.onSnapshot) {
|
3081
|
-
const r = `xstate.snapshot.${t.id}`;
|
3082
|
-
e.set(r, de(t.onSnapshot).map((s) => K(n, r, s)));
|
3083
|
-
}
|
3084
|
-
}
|
3085
|
-
for (const t of n.after) {
|
3086
|
-
let r = e.get(t.eventType);
|
3087
|
-
r || (r = [], e.set(t.eventType, r)), r.push(t);
|
3088
|
-
}
|
3089
|
-
return e;
|
3090
|
-
}
|
3091
|
-
function ji(n, e) {
|
3092
|
-
const t = typeof e == "string" ? n.states[e] : e ? n.states[e.target] : void 0;
|
3093
|
-
if (!t && e)
|
3094
|
-
throw new Error(
|
3095
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions, @typescript-eslint/no-base-to-string
|
3096
|
-
`Initial state node "${e}" not found on parent state node #${n.id}`
|
3097
|
-
);
|
3098
|
-
const r = {
|
3099
|
-
source: n,
|
3100
|
-
actions: !e || typeof e == "string" ? [] : B(e.actions),
|
3101
|
-
eventType: null,
|
3102
|
-
reenter: !1,
|
3103
|
-
target: t ? [t] : [],
|
3104
|
-
toJSON: () => ({
|
3105
|
-
...r,
|
3106
|
-
source: `#${n.id}`,
|
3107
|
-
target: t ? [`#${t.id}`] : []
|
3108
|
-
})
|
3109
|
-
};
|
3110
|
-
return r;
|
3111
|
-
}
|
3112
|
-
function Ri(n, e) {
|
3113
|
-
if (e !== void 0)
|
3114
|
-
return e.map((t) => {
|
3115
|
-
if (typeof t != "string")
|
3116
|
-
return t;
|
3117
|
-
if (ot(t))
|
3118
|
-
return n.machine.getStateNodeById(t);
|
3119
|
-
const r = t[0] === er;
|
3120
|
-
if (r && !n.parent)
|
3121
|
-
return Qe(n, t.slice(1));
|
3122
|
-
const s = r ? n.key + t : t;
|
3123
|
-
if (n.parent)
|
3124
|
-
try {
|
3125
|
-
return Qe(n.parent, s);
|
3126
|
-
} catch (i) {
|
3127
|
-
throw new Error(`Invalid transition definition for state node '${n.id}':
|
3128
|
-
${i.message}`);
|
3129
|
-
}
|
3130
|
-
else
|
3131
|
-
throw new Error(`Invalid target: "${t}" is not a valid target from the root node. Did you mean ".${t}"?`);
|
3132
|
-
});
|
3133
|
-
}
|
3134
|
-
function pr(n) {
|
3135
|
-
const e = cr(n.config.target);
|
3136
|
-
return e ? {
|
3137
|
-
target: e.map((t) => typeof t == "string" ? Qe(n.parent, t) : t)
|
3138
|
-
} : n.parent.initial;
|
3139
|
-
}
|
3140
|
-
function ee(n) {
|
3141
|
-
return n.type === "history";
|
3142
|
-
}
|
3143
|
-
function fn(n) {
|
3144
|
-
const e = yr(n);
|
3145
|
-
for (const t of e)
|
3146
|
-
for (const r of Ne(t, n))
|
3147
|
-
e.add(r);
|
3148
|
-
return e;
|
3149
|
-
}
|
3150
|
-
function yr(n) {
|
3151
|
-
const e = /* @__PURE__ */ new Set();
|
3152
|
-
function t(r) {
|
3153
|
-
if (!e.has(r)) {
|
3154
|
-
if (e.add(r), r.type === "compound")
|
3155
|
-
t(r.initial.target[0]);
|
3156
|
-
else if (r.type === "parallel")
|
3157
|
-
for (const s of ve(r))
|
3158
|
-
t(s);
|
3159
|
-
}
|
3160
|
-
}
|
3161
|
-
return t(n), e;
|
3162
|
-
}
|
3163
|
-
function be(n, e) {
|
3164
|
-
if (ot(e))
|
3165
|
-
return n.machine.getStateNodeById(e);
|
3166
|
-
if (!n.states)
|
3167
|
-
throw new Error(`Unable to retrieve child state '${e}' from '${n.id}'; no child states exist.`);
|
3168
|
-
const t = n.states[e];
|
3169
|
-
if (!t)
|
3170
|
-
throw new Error(`Child state '${e}' does not exist on '${n.id}'`);
|
3171
|
-
return t;
|
3172
|
-
}
|
3173
|
-
function Qe(n, e) {
|
3174
|
-
if (typeof e == "string" && ot(e))
|
3175
|
-
try {
|
3176
|
-
return n.machine.getStateNodeById(e);
|
3177
|
-
} catch {
|
3178
|
-
}
|
3179
|
-
const t = It(e).slice();
|
3180
|
-
let r = n;
|
3181
|
-
for (; t.length; ) {
|
3182
|
-
const s = t.shift();
|
3183
|
-
if (!s.length)
|
3184
|
-
break;
|
3185
|
-
r = be(r, s);
|
3186
|
-
}
|
3187
|
-
return r;
|
3188
|
-
}
|
3189
|
-
function Ke(n, e) {
|
3190
|
-
if (typeof e == "string") {
|
3191
|
-
const s = n.states[e];
|
3192
|
-
if (!s)
|
3193
|
-
throw new Error(`State '${e}' does not exist on '${n.id}'`);
|
3194
|
-
return [n, s];
|
3195
|
-
}
|
3196
|
-
const t = Object.keys(e), r = t.map((s) => be(n, s)).filter(Boolean);
|
3197
|
-
return [n.machine.root, n].concat(r, t.reduce((s, i) => {
|
3198
|
-
const o = be(n, i);
|
3199
|
-
if (!o)
|
3200
|
-
return s;
|
3201
|
-
const a = Ke(o, e[i]);
|
3202
|
-
return s.concat(a);
|
3203
|
-
}, []));
|
3204
|
-
}
|
3205
|
-
function ki(n, e, t, r) {
|
3206
|
-
const i = be(n, e).next(t, r);
|
3207
|
-
return !i || !i.length ? n.next(t, r) : i;
|
3208
|
-
}
|
3209
|
-
function Li(n, e, t, r) {
|
3210
|
-
const s = Object.keys(e), i = be(n, s[0]), o = Lt(i, e[s[0]], t, r);
|
3211
|
-
return !o || !o.length ? n.next(t, r) : o;
|
3212
|
-
}
|
3213
|
-
function qi(n, e, t, r) {
|
3214
|
-
const s = [];
|
3215
|
-
for (const i of Object.keys(e)) {
|
3216
|
-
const o = e[i];
|
3217
|
-
if (!o)
|
3218
|
-
continue;
|
3219
|
-
const a = be(n, i), c = Lt(a, o, t, r);
|
3220
|
-
c && s.push(...c);
|
3221
|
-
}
|
3222
|
-
return s.length ? s : n.next(t, r);
|
3223
|
-
}
|
3224
|
-
function Lt(n, e, t, r) {
|
3225
|
-
return typeof e == "string" ? ki(n, e, t, r) : Object.keys(e).length === 1 ? Li(n, e, t, r) : qi(n, e, t, r);
|
3226
|
-
}
|
3227
|
-
function Pi(n) {
|
3228
|
-
return Object.keys(n.states).map((e) => n.states[e]).filter((e) => e.type === "history");
|
3229
|
-
}
|
3230
|
-
function Y(n, e) {
|
3231
|
-
let t = n;
|
3232
|
-
for (; t.parent && t.parent !== e; )
|
3233
|
-
t = t.parent;
|
3234
|
-
return t.parent === e;
|
3235
|
-
}
|
3236
|
-
function Di(n, e) {
|
3237
|
-
const t = new Set(n), r = new Set(e);
|
3238
|
-
for (const s of t)
|
3239
|
-
if (r.has(s))
|
3240
|
-
return !0;
|
3241
|
-
for (const s of r)
|
3242
|
-
if (t.has(s))
|
3243
|
-
return !0;
|
3244
|
-
return !1;
|
3245
|
-
}
|
3246
|
-
function gr(n, e, t) {
|
3247
|
-
const r = /* @__PURE__ */ new Set();
|
3248
|
-
for (const s of n) {
|
3249
|
-
let i = !1;
|
3250
|
-
const o = /* @__PURE__ */ new Set();
|
3251
|
-
for (const a of r)
|
3252
|
-
if (Di(_t([s], e, t), _t([a], e, t)))
|
3253
|
-
if (Y(s.source, a.source))
|
3254
|
-
o.add(a);
|
3255
|
-
else {
|
3256
|
-
i = !0;
|
3257
|
-
break;
|
3258
|
-
}
|
3259
|
-
if (!i) {
|
3260
|
-
for (const a of o)
|
3261
|
-
r.delete(a);
|
3262
|
-
r.add(s);
|
3263
|
-
}
|
3264
|
-
}
|
3265
|
-
return Array.from(r);
|
3266
|
-
}
|
3267
|
-
function Fi(n) {
|
3268
|
-
const [e, ...t] = n;
|
3269
|
-
for (const r of Ne(e, void 0))
|
3270
|
-
if (t.every((s) => Y(s, r)))
|
3271
|
-
return r;
|
3272
|
-
}
|
3273
|
-
function qt(n, e) {
|
3274
|
-
if (!n.target)
|
3275
|
-
return [];
|
3276
|
-
const t = /* @__PURE__ */ new Set();
|
3277
|
-
for (const r of n.target)
|
3278
|
-
if (ee(r))
|
3279
|
-
if (e[r.id])
|
3280
|
-
for (const s of e[r.id])
|
3281
|
-
t.add(s);
|
3282
|
-
else
|
3283
|
-
for (const s of qt(pr(r), e))
|
3284
|
-
t.add(s);
|
3285
|
-
else
|
3286
|
-
t.add(r);
|
3287
|
-
return [...t];
|
3288
|
-
}
|
3289
|
-
function mr(n, e) {
|
3290
|
-
const t = qt(n, e);
|
3291
|
-
if (!t)
|
3292
|
-
return;
|
3293
|
-
if (!n.reenter && t.every((s) => s === n.source || Y(s, n.source)))
|
3294
|
-
return n.source;
|
3295
|
-
const r = Fi(t.concat(n.source));
|
3296
|
-
if (r)
|
3297
|
-
return r;
|
3298
|
-
if (!n.reenter)
|
3299
|
-
return n.source.machine.root;
|
3300
|
-
}
|
3301
|
-
function _t(n, e, t) {
|
3302
|
-
var s;
|
3303
|
-
const r = /* @__PURE__ */ new Set();
|
3304
|
-
for (const i of n)
|
3305
|
-
if ((s = i.target) != null && s.length) {
|
3306
|
-
const o = mr(i, t);
|
3307
|
-
i.reenter && i.source === o && r.add(o);
|
3308
|
-
for (const a of e)
|
3309
|
-
Y(a, o) && r.add(a);
|
3310
|
-
}
|
3311
|
-
return [...r];
|
3312
|
-
}
|
3313
|
-
function Hi(n, e) {
|
3314
|
-
if (n.length !== e.size)
|
3315
|
-
return !1;
|
3316
|
-
for (const t of n)
|
3317
|
-
if (!e.has(t))
|
3318
|
-
return !1;
|
3319
|
-
return !0;
|
3320
|
-
}
|
3321
|
-
function Et(n, e, t, r, s, i) {
|
3322
|
-
if (!n.length)
|
3323
|
-
return e;
|
3324
|
-
const o = new Set(e._nodes);
|
3325
|
-
let a = e.historyValue;
|
3326
|
-
const c = gr(n, o, a);
|
3327
|
-
let u = e;
|
3328
|
-
s || ([u, a] = Ni(u, r, t, c, o, a, i, t.actionExecutor)), u = _e(u, r, t, c.flatMap((d) => d.actions), i, void 0), u = Vi(u, r, t, c, o, i, a, s);
|
3329
|
-
const g = [...o];
|
3330
|
-
u.status === "done" && (u = _e(u, r, t, g.sort((d, h) => h.order - d.order).flatMap((d) => d.exit), i, void 0));
|
3331
|
-
try {
|
3332
|
-
return a === e.historyValue && Hi(e._nodes, o) ? u : oe(u, {
|
3333
|
-
_nodes: g,
|
3334
|
-
historyValue: a
|
3335
|
-
});
|
3336
|
-
} catch (d) {
|
3337
|
-
throw d;
|
3338
|
-
}
|
3339
|
-
}
|
3340
|
-
function Ui(n, e, t, r, s) {
|
3341
|
-
if (r.output === void 0)
|
3342
|
-
return;
|
3343
|
-
const i = wt(s.id, s.output !== void 0 && s.parent ? vt(s.output, n.context, e, t.self) : void 0);
|
3344
|
-
return vt(r.output, n.context, i, t.self);
|
3345
|
-
}
|
3346
|
-
function Vi(n, e, t, r, s, i, o, a) {
|
3347
|
-
let c = n;
|
3348
|
-
const u = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set();
|
3349
|
-
Bi(r, o, g, u), a && g.add(n.machine.root);
|
3350
|
-
const d = /* @__PURE__ */ new Set();
|
3351
|
-
for (const h of [...u].sort((l, p) => l.order - p.order)) {
|
3352
|
-
s.add(h);
|
3353
|
-
const l = [];
|
3354
|
-
l.push(...h.entry);
|
3355
|
-
for (const p of h.invoke)
|
3356
|
-
l.push(dr(p.src, {
|
3357
|
-
...p,
|
3358
|
-
syncSnapshot: !!p.onSnapshot
|
3359
|
-
}));
|
3360
|
-
if (g.has(h)) {
|
3361
|
-
const p = h.initial.actions;
|
3362
|
-
l.push(...p);
|
3363
|
-
}
|
3364
|
-
if (c = _e(c, e, t, l, i, h.invoke.map((p) => p.id)), h.type === "final") {
|
3365
|
-
const p = h.parent;
|
3366
|
-
let f = (p == null ? void 0 : p.type) === "parallel" ? p : p == null ? void 0 : p.parent, m = f || h;
|
3367
|
-
for ((p == null ? void 0 : p.type) === "compound" && i.push(wt(p.id, h.output !== void 0 ? vt(h.output, c.context, e, t.self) : void 0)); (f == null ? void 0 : f.type) === "parallel" && !d.has(f) && kt(s, f); )
|
3368
|
-
d.add(f), i.push(wt(f.id)), m = f, f = f.parent;
|
3369
|
-
if (f)
|
3370
|
-
continue;
|
3371
|
-
c = oe(c, {
|
3372
|
-
status: "done",
|
3373
|
-
output: Ui(c, e, t, c.machine.root, m)
|
3374
|
-
});
|
3375
|
-
}
|
3376
|
-
}
|
3377
|
-
return c;
|
3378
|
-
}
|
3379
|
-
function Bi(n, e, t, r) {
|
3380
|
-
for (const s of n) {
|
3381
|
-
const i = mr(s, e);
|
3382
|
-
for (const a of s.target || [])
|
3383
|
-
!ee(a) && // if the target is different than the source then it will *definitely* be entered
|
3384
|
-
(s.source !== a || // we know that the domain can't lie within the source
|
3385
|
-
// if it's different than the source then it's outside of it and it means that the target has to be entered as well
|
3386
|
-
s.source !== i || // reentering transitions always enter the target, even if it's the source itself
|
3387
|
-
s.reenter) && (r.add(a), t.add(a)), he(a, e, t, r);
|
3388
|
-
const o = qt(s, e);
|
3389
|
-
for (const a of o) {
|
3390
|
-
const c = Ne(a, i);
|
3391
|
-
(i == null ? void 0 : i.type) === "parallel" && c.push(i), wr(r, e, t, c, !s.source.parent && s.reenter ? void 0 : i);
|
3392
|
-
}
|
3393
|
-
}
|
3394
|
-
}
|
3395
|
-
function he(n, e, t, r) {
|
3396
|
-
var s;
|
3397
|
-
if (ee(n))
|
3398
|
-
if (e[n.id]) {
|
3399
|
-
const i = e[n.id];
|
3400
|
-
for (const o of i)
|
3401
|
-
r.add(o), he(o, e, t, r);
|
3402
|
-
for (const o of i)
|
3403
|
-
dt(o, n.parent, r, e, t);
|
3404
|
-
} else {
|
3405
|
-
const i = pr(n);
|
3406
|
-
for (const o of i.target)
|
3407
|
-
r.add(o), i === ((s = n.parent) == null ? void 0 : s.initial) && t.add(n.parent), he(o, e, t, r);
|
3408
|
-
for (const o of i.target)
|
3409
|
-
dt(o, n.parent, r, e, t);
|
3410
|
-
}
|
3411
|
-
else if (n.type === "compound") {
|
3412
|
-
const [i] = n.initial.target;
|
3413
|
-
ee(i) || (r.add(i), t.add(i)), he(i, e, t, r), dt(i, n, r, e, t);
|
3414
|
-
} else if (n.type === "parallel")
|
3415
|
-
for (const i of ve(n).filter((o) => !ee(o)))
|
3416
|
-
[...r].some((o) => Y(o, i)) || (ee(i) || (r.add(i), t.add(i)), he(i, e, t, r));
|
3417
|
-
}
|
3418
|
-
function wr(n, e, t, r, s) {
|
3419
|
-
for (const i of r)
|
3420
|
-
if ((!s || Y(i, s)) && n.add(i), i.type === "parallel")
|
3421
|
-
for (const o of ve(i).filter((a) => !ee(a)))
|
3422
|
-
[...n].some((a) => Y(a, o)) || (n.add(o), he(o, e, t, n));
|
3423
|
-
}
|
3424
|
-
function dt(n, e, t, r, s) {
|
3425
|
-
wr(t, r, s, Ne(n, e));
|
3426
|
-
}
|
3427
|
-
function Ni(n, e, t, r, s, i, o, a) {
|
3428
|
-
let c = n;
|
3429
|
-
const u = _t(r, s, i);
|
3430
|
-
u.sort((d, h) => h.order - d.order);
|
3431
|
-
let g;
|
3432
|
-
for (const d of u)
|
3433
|
-
for (const h of Pi(d)) {
|
3434
|
-
let l;
|
3435
|
-
h.history === "deep" ? l = (p) => Rt(p) && Y(p, d) : l = (p) => p.parent === d, g ?? (g = {
|
3436
|
-
...i
|
3437
|
-
}), g[h.id] = Array.from(s).filter(l);
|
3438
|
-
}
|
3439
|
-
for (const d of u)
|
3440
|
-
c = _e(c, e, t, [...d.exit, ...d.invoke.map((h) => jt(h.id))], o, void 0), s.delete(d);
|
3441
|
-
return [c, g || i];
|
3442
|
-
}
|
3443
|
-
function zi(n, e) {
|
3444
|
-
return n.implementations.actions[e];
|
3445
|
-
}
|
3446
|
-
function vr(n, e, t, r, s, i) {
|
3447
|
-
const {
|
3448
|
-
machine: o
|
3449
|
-
} = n;
|
3450
|
-
let a = n;
|
3451
|
-
for (const c of r) {
|
3452
|
-
const u = typeof c == "function", g = u ? c : (
|
3453
|
-
// the existing type of `.actions` assumes non-nullable `TExpressionAction`
|
3454
|
-
// it's fine to cast this here to get a common type and lack of errors in the rest of the code
|
3455
|
-
// our logic below makes sure that we call those 2 "variants" correctly
|
3456
|
-
zi(o, typeof c == "string" ? c : c.type)
|
3457
|
-
), d = {
|
3458
|
-
context: a.context,
|
3459
|
-
event: e,
|
3460
|
-
self: t.self,
|
3461
|
-
system: t.system
|
3462
|
-
}, h = u || typeof c == "string" ? void 0 : "params" in c ? typeof c.params == "function" ? c.params({
|
3463
|
-
context: a.context,
|
3464
|
-
event: e
|
3465
|
-
}) : c.params : void 0;
|
3466
|
-
if (!g || !("resolve" in g)) {
|
3467
|
-
t.actionExecutor({
|
3468
|
-
type: typeof c == "string" ? c : typeof c == "object" ? c.type : c.name || "(anonymous)",
|
3469
|
-
info: d,
|
3470
|
-
params: h,
|
3471
|
-
exec: g
|
3472
|
-
});
|
3473
|
-
continue;
|
3474
|
-
}
|
3475
|
-
const l = g, [p, f, m] = l.resolve(
|
3476
|
-
t,
|
3477
|
-
a,
|
3478
|
-
d,
|
3479
|
-
h,
|
3480
|
-
g,
|
3481
|
-
// this holds all params
|
3482
|
-
s
|
3483
|
-
);
|
3484
|
-
a = p, "retryResolve" in l && (i == null || i.push([l, f])), "execute" in l && t.actionExecutor({
|
3485
|
-
type: l.type,
|
3486
|
-
info: d,
|
3487
|
-
params: f,
|
3488
|
-
exec: l.execute.bind(null, t, f)
|
3489
|
-
}), m && (a = vr(a, e, t, m, s, i));
|
3490
|
-
}
|
3491
|
-
return a;
|
3492
|
-
}
|
3493
|
-
function _e(n, e, t, r, s, i) {
|
3494
|
-
const o = i ? [] : void 0, a = vr(n, e, t, r, {
|
3495
|
-
internalQueue: s,
|
3496
|
-
deferredActorIds: i
|
3497
|
-
}, o);
|
3498
|
-
return o == null || o.forEach(([c, u]) => {
|
3499
|
-
c.retryResolve(t, a, u);
|
3500
|
-
}), a;
|
3501
|
-
}
|
3502
|
-
function ht(n, e, t, r) {
|
3503
|
-
let s = n;
|
3504
|
-
const i = [];
|
3505
|
-
function o(u, g, d) {
|
3506
|
-
t.system._sendInspectionEvent({
|
3507
|
-
type: "@xstate.microstep",
|
3508
|
-
actorRef: t.self,
|
3509
|
-
event: g,
|
3510
|
-
snapshot: u,
|
3511
|
-
_transitions: d
|
3512
|
-
}), i.push(u);
|
3513
|
-
}
|
3514
|
-
if (e.type === $e)
|
3515
|
-
return s = oe(pn(s, e, t), {
|
3516
|
-
status: "stopped"
|
3517
|
-
}), o(s, e, []), {
|
3518
|
-
snapshot: s,
|
3519
|
-
microstates: i
|
3520
|
-
};
|
3521
|
-
let a = e;
|
3522
|
-
if (a.type !== nr) {
|
3523
|
-
const u = a, g = wi(u), d = yn(u, s);
|
3524
|
-
if (g && !d.length)
|
3525
|
-
return s = oe(n, {
|
3526
|
-
status: "error",
|
3527
|
-
error: u.error
|
3528
|
-
}), o(s, u, []), {
|
3529
|
-
snapshot: s,
|
3530
|
-
microstates: i
|
3531
|
-
};
|
3532
|
-
s = Et(
|
3533
|
-
d,
|
3534
|
-
n,
|
3535
|
-
t,
|
3536
|
-
a,
|
3537
|
-
!1,
|
3538
|
-
// isInitial
|
3539
|
-
r
|
3540
|
-
), o(s, u, d);
|
3541
|
-
}
|
3542
|
-
let c = !0;
|
3543
|
-
for (; s.status === "active"; ) {
|
3544
|
-
let u = c ? Zi(s, a) : [];
|
3545
|
-
const g = u.length ? s : void 0;
|
3546
|
-
if (!u.length) {
|
3547
|
-
if (!r.length)
|
3548
|
-
break;
|
3549
|
-
a = r.shift(), u = yn(a, s);
|
3550
|
-
}
|
3551
|
-
s = Et(u, s, t, a, !1, r), c = s !== g, o(s, a, u);
|
3552
|
-
}
|
3553
|
-
return s.status !== "active" && pn(s, a, t), {
|
3554
|
-
snapshot: s,
|
3555
|
-
microstates: i
|
3556
|
-
};
|
3557
|
-
}
|
3558
|
-
function pn(n, e, t) {
|
3559
|
-
return _e(n, e, t, Object.values(n.children).map((r) => jt(r)), [], void 0);
|
3560
|
-
}
|
3561
|
-
function yn(n, e) {
|
3562
|
-
return e.machine.getTransitionData(e, n);
|
3563
|
-
}
|
3564
|
-
function Zi(n, e) {
|
3565
|
-
const t = /* @__PURE__ */ new Set(), r = n._nodes.filter(Rt);
|
3566
|
-
for (const s of r)
|
3567
|
-
e: for (const i of [s].concat(Ne(s, void 0)))
|
3568
|
-
if (i.always) {
|
3569
|
-
for (const o of i.always)
|
3570
|
-
if (o.guard === void 0 || it(o.guard, n.context, e, n)) {
|
3571
|
-
t.add(o);
|
3572
|
-
break e;
|
3573
|
-
}
|
3574
|
-
}
|
3575
|
-
return gr(Array.from(t), new Set(n._nodes), n.historyValue);
|
3576
|
-
}
|
3577
|
-
function Ji(n, e) {
|
3578
|
-
const t = Ye(Ke(n, e));
|
3579
|
-
return fr(n, [...t]);
|
3580
|
-
}
|
3581
|
-
function Gi(n) {
|
3582
|
-
return !!n && typeof n == "object" && "machine" in n && "value" in n;
|
3583
|
-
}
|
3584
|
-
const Wi = function(e) {
|
3585
|
-
return ir(e, this.value);
|
3586
|
-
}, Xi = function(e) {
|
3587
|
-
return this.tags.has(e);
|
3588
|
-
}, Yi = function(e) {
|
3589
|
-
const t = this.machine.getTransitionData(this, e);
|
3590
|
-
return !!(t != null && t.length) && // Check that at least one transition is not forbidden
|
3591
|
-
t.some((r) => r.target !== void 0 || r.actions.length);
|
3592
|
-
}, Qi = function() {
|
3593
|
-
const {
|
3594
|
-
_nodes: e,
|
3595
|
-
tags: t,
|
3596
|
-
machine: r,
|
3597
|
-
getMeta: s,
|
3598
|
-
toJSON: i,
|
3599
|
-
can: o,
|
3600
|
-
hasTag: a,
|
3601
|
-
matches: c,
|
3602
|
-
...u
|
3603
|
-
} = this;
|
3604
|
-
return {
|
3605
|
-
...u,
|
3606
|
-
tags: Array.from(t)
|
3607
|
-
};
|
3608
|
-
}, Ki = function() {
|
3609
|
-
return this._nodes.reduce((e, t) => (t.meta !== void 0 && (e[t.id] = t.meta), e), {});
|
3610
|
-
};
|
3611
|
-
function ze(n, e) {
|
3612
|
-
return {
|
3613
|
-
status: n.status,
|
3614
|
-
output: n.output,
|
3615
|
-
error: n.error,
|
3616
|
-
machine: e,
|
3617
|
-
context: n.context,
|
3618
|
-
_nodes: n._nodes,
|
3619
|
-
value: fr(e.root, n._nodes),
|
3620
|
-
tags: new Set(n._nodes.flatMap((t) => t.tags)),
|
3621
|
-
children: n.children,
|
3622
|
-
historyValue: n.historyValue || {},
|
3623
|
-
matches: Wi,
|
3624
|
-
hasTag: Xi,
|
3625
|
-
can: Yi,
|
3626
|
-
getMeta: Ki,
|
3627
|
-
toJSON: Qi
|
3628
|
-
};
|
3629
|
-
}
|
3630
|
-
function oe(n, e = {}) {
|
3631
|
-
return ze({
|
3632
|
-
...n,
|
3633
|
-
...e
|
3634
|
-
}, n.machine);
|
3635
|
-
}
|
3636
|
-
function eo(n, e) {
|
3637
|
-
const {
|
3638
|
-
_nodes: t,
|
3639
|
-
tags: r,
|
3640
|
-
machine: s,
|
3641
|
-
children: i,
|
3642
|
-
context: o,
|
3643
|
-
can: a,
|
3644
|
-
hasTag: c,
|
3645
|
-
matches: u,
|
3646
|
-
getMeta: g,
|
3647
|
-
toJSON: d,
|
3648
|
-
...h
|
3649
|
-
} = n, l = {};
|
3650
|
-
for (const f in i) {
|
3651
|
-
const m = i[f];
|
3652
|
-
l[f] = {
|
3653
|
-
snapshot: m.getPersistedSnapshot(e),
|
3654
|
-
src: m.src,
|
3655
|
-
systemId: m._systemId,
|
3656
|
-
syncSnapshot: m._syncSnapshot
|
3657
|
-
};
|
3658
|
-
}
|
3659
|
-
return {
|
3660
|
-
...h,
|
3661
|
-
context: br(o),
|
3662
|
-
children: l
|
3663
|
-
};
|
3664
|
-
}
|
3665
|
-
function br(n) {
|
3666
|
-
let e;
|
3667
|
-
for (const t in n) {
|
3668
|
-
const r = n[t];
|
3669
|
-
if (r && typeof r == "object")
|
3670
|
-
if ("sessionId" in r && "send" in r && "ref" in r)
|
3671
|
-
e ?? (e = Array.isArray(n) ? n.slice() : {
|
3672
|
-
...n
|
3673
|
-
}), e[t] = {
|
3674
|
-
xstate$$type: Mt,
|
3675
|
-
id: r.id
|
3676
|
-
};
|
3677
|
-
else {
|
3678
|
-
const s = br(r);
|
3679
|
-
s !== r && (e ?? (e = Array.isArray(n) ? n.slice() : {
|
3680
|
-
...n
|
3681
|
-
}), e[t] = s);
|
3682
|
-
}
|
3683
|
-
}
|
3684
|
-
return e ?? n;
|
3685
|
-
}
|
3686
|
-
function to(n, e, t, r, {
|
3687
|
-
event: s,
|
3688
|
-
id: i,
|
3689
|
-
delay: o
|
3690
|
-
}, {
|
3691
|
-
internalQueue: a
|
3692
|
-
}) {
|
3693
|
-
const c = e.machine.implementations.delays;
|
3694
|
-
if (typeof s == "string")
|
3695
|
-
throw new Error(
|
3696
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
3697
|
-
`Only event objects may be used with raise; use raise({ type: "${s}" }) instead`
|
3698
|
-
);
|
3699
|
-
const u = typeof s == "function" ? s(t, r) : s;
|
3700
|
-
let g;
|
3701
|
-
if (typeof o == "string") {
|
3702
|
-
const d = c && c[o];
|
3703
|
-
g = typeof d == "function" ? d(t, r) : d;
|
3704
|
-
} else
|
3705
|
-
g = typeof o == "function" ? o(t, r) : o;
|
3706
|
-
return typeof g != "number" && a.push(u), [e, {
|
3707
|
-
event: u,
|
3708
|
-
id: i,
|
3709
|
-
delay: g
|
3710
|
-
}, void 0];
|
3711
|
-
}
|
3712
|
-
function no(n, e) {
|
3713
|
-
const {
|
3714
|
-
event: t,
|
3715
|
-
delay: r,
|
3716
|
-
id: s
|
3717
|
-
} = e;
|
3718
|
-
if (typeof r == "number") {
|
3719
|
-
n.defer(() => {
|
3720
|
-
const i = n.self;
|
3721
|
-
n.system.scheduler.schedule(i, i, t, r, s);
|
3722
|
-
});
|
3723
|
-
return;
|
3724
|
-
}
|
3725
|
-
}
|
3726
|
-
function _r(n, e) {
|
3727
|
-
function t(r, s) {
|
3728
|
-
}
|
3729
|
-
return t.type = "xstate.raise", t.event = n, t.id = e == null ? void 0 : e.id, t.delay = e == null ? void 0 : e.delay, t.resolve = to, t.execute = no, t;
|
3730
|
-
}
|
3731
|
-
const gn = /* @__PURE__ */ new WeakMap();
|
3732
|
-
function jo(n) {
|
3733
|
-
return {
|
3734
|
-
config: n,
|
3735
|
-
start: (t, r) => {
|
3736
|
-
const {
|
3737
|
-
self: s,
|
3738
|
-
system: i,
|
3739
|
-
emit: o
|
3740
|
-
} = r, a = {
|
3741
|
-
receivers: void 0,
|
3742
|
-
dispose: void 0
|
3743
|
-
};
|
3744
|
-
gn.set(s, a), a.dispose = n({
|
3745
|
-
input: t.input,
|
3746
|
-
system: i,
|
3747
|
-
self: s,
|
3748
|
-
sendBack: (c) => {
|
3749
|
-
s.getSnapshot().status !== "stopped" && s._parent && i._relay(s, s._parent, c);
|
3750
|
-
},
|
3751
|
-
receive: (c) => {
|
3752
|
-
a.receivers ?? (a.receivers = /* @__PURE__ */ new Set()), a.receivers.add(c);
|
3753
|
-
},
|
3754
|
-
emit: o
|
3755
|
-
});
|
3756
|
-
},
|
3757
|
-
transition: (t, r, s) => {
|
3758
|
-
var o, a;
|
3759
|
-
const i = gn.get(s.self);
|
3760
|
-
return r.type === $e ? (t = {
|
3761
|
-
...t,
|
3762
|
-
status: "stopped",
|
3763
|
-
error: void 0
|
3764
|
-
}, (o = i.dispose) == null || o.call(i), t) : ((a = i.receivers) == null || a.forEach((c) => c(r)), t);
|
3765
|
-
},
|
3766
|
-
getInitialSnapshot: (t, r) => ({
|
3767
|
-
status: "active",
|
3768
|
-
output: void 0,
|
3769
|
-
error: void 0,
|
3770
|
-
input: r
|
3771
|
-
}),
|
3772
|
-
getPersistedSnapshot: (t) => t,
|
3773
|
-
restoreSnapshot: (t) => t
|
3774
|
-
};
|
3775
|
-
}
|
3776
|
-
const mn = "xstate.observable.error", wn = "xstate.observable.complete";
|
3777
|
-
function Ro(n) {
|
3778
|
-
return {
|
3779
|
-
config: n,
|
3780
|
-
transition: (t, r) => {
|
3781
|
-
if (t.status !== "active")
|
3782
|
-
return t;
|
3783
|
-
switch (r.type) {
|
3784
|
-
case mn:
|
3785
|
-
return {
|
3786
|
-
...t,
|
3787
|
-
status: "error",
|
3788
|
-
error: r.data,
|
3789
|
-
input: void 0,
|
3790
|
-
_subscription: void 0
|
3791
|
-
};
|
3792
|
-
case wn:
|
3793
|
-
return {
|
3794
|
-
...t,
|
3795
|
-
status: "done",
|
3796
|
-
input: void 0,
|
3797
|
-
_subscription: void 0
|
3798
|
-
};
|
3799
|
-
case $e:
|
3800
|
-
return t._subscription.unsubscribe(), {
|
3801
|
-
...t,
|
3802
|
-
status: "stopped",
|
3803
|
-
input: void 0,
|
3804
|
-
_subscription: void 0
|
3805
|
-
};
|
3806
|
-
default:
|
3807
|
-
return t;
|
3808
|
-
}
|
3809
|
-
},
|
3810
|
-
getInitialSnapshot: (t, r) => ({
|
3811
|
-
status: "active",
|
3812
|
-
output: void 0,
|
3813
|
-
error: void 0,
|
3814
|
-
context: void 0,
|
3815
|
-
input: r,
|
3816
|
-
_subscription: void 0
|
3817
|
-
}),
|
3818
|
-
start: (t, {
|
3819
|
-
self: r,
|
3820
|
-
system: s,
|
3821
|
-
emit: i
|
3822
|
-
}) => {
|
3823
|
-
t.status !== "done" && (t._subscription = n({
|
3824
|
-
input: t.input,
|
3825
|
-
system: s,
|
3826
|
-
self: r,
|
3827
|
-
emit: i
|
3828
|
-
}).subscribe({
|
3829
|
-
next: (o) => {
|
3830
|
-
r._parent && s._relay(r, r._parent, o);
|
3831
|
-
},
|
3832
|
-
error: (o) => {
|
3833
|
-
s._relay(r, r, {
|
3834
|
-
type: mn,
|
3835
|
-
data: o
|
3836
|
-
});
|
3837
|
-
},
|
3838
|
-
complete: () => {
|
3839
|
-
s._relay(r, r, {
|
3840
|
-
type: wn
|
3841
|
-
});
|
3842
|
-
}
|
3843
|
-
}));
|
3844
|
-
},
|
3845
|
-
getPersistedSnapshot: ({
|
3846
|
-
_subscription: t,
|
3847
|
-
...r
|
3848
|
-
}) => r,
|
3849
|
-
restoreSnapshot: (t) => ({
|
3850
|
-
...t,
|
3851
|
-
_subscription: void 0
|
3852
|
-
})
|
3853
|
-
};
|
3854
|
-
}
|
3855
|
-
function ro(n, {
|
3856
|
-
machine: e,
|
3857
|
-
context: t
|
3858
|
-
}, r, s) {
|
3859
|
-
const i = (o, a) => {
|
3860
|
-
if (typeof o == "string") {
|
3861
|
-
const c = Ot(e, o);
|
3862
|
-
if (!c)
|
3863
|
-
throw new Error(`Actor logic '${o}' not implemented in machine '${e.id}'`);
|
3864
|
-
const u = Xe(c, {
|
3865
|
-
id: a == null ? void 0 : a.id,
|
3866
|
-
parent: n.self,
|
3867
|
-
syncSnapshot: a == null ? void 0 : a.syncSnapshot,
|
3868
|
-
input: typeof (a == null ? void 0 : a.input) == "function" ? a.input({
|
3869
|
-
context: t,
|
3870
|
-
event: r,
|
3871
|
-
self: n.self
|
3872
|
-
}) : a == null ? void 0 : a.input,
|
3873
|
-
src: o,
|
3874
|
-
systemId: a == null ? void 0 : a.systemId
|
3875
|
-
});
|
3876
|
-
return s[u.id] = u, u;
|
3877
|
-
} else
|
3878
|
-
return Xe(o, {
|
3879
|
-
id: a == null ? void 0 : a.id,
|
3880
|
-
parent: n.self,
|
3881
|
-
syncSnapshot: a == null ? void 0 : a.syncSnapshot,
|
3882
|
-
input: a == null ? void 0 : a.input,
|
3883
|
-
src: o,
|
3884
|
-
systemId: a == null ? void 0 : a.systemId
|
3885
|
-
});
|
3886
|
-
};
|
3887
|
-
return (o, a) => {
|
3888
|
-
const c = i(o, a);
|
3889
|
-
return s[c.id] = c, n.defer(() => {
|
3890
|
-
c._processingStatus !== j.Stopped && c.start();
|
3891
|
-
}), c;
|
3892
|
-
};
|
3893
|
-
}
|
3894
|
-
function so(n, e, t, r, {
|
3895
|
-
assignment: s
|
3896
|
-
}) {
|
3897
|
-
if (!e.context)
|
3898
|
-
throw new Error("Cannot assign to undefined `context`. Ensure that `context` is defined in the machine config.");
|
3899
|
-
const i = {}, o = {
|
3900
|
-
context: e.context,
|
3901
|
-
event: t.event,
|
3902
|
-
spawn: ro(n, e, t.event, i),
|
3903
|
-
self: n.self,
|
3904
|
-
system: n.system
|
3905
|
-
};
|
3906
|
-
let a = {};
|
3907
|
-
if (typeof s == "function")
|
3908
|
-
a = s(o, r);
|
3909
|
-
else
|
3910
|
-
for (const u of Object.keys(s)) {
|
3911
|
-
const g = s[u];
|
3912
|
-
a[u] = typeof g == "function" ? g(o, r) : g;
|
3913
|
-
}
|
3914
|
-
const c = Object.assign({}, e.context, a);
|
3915
|
-
return [oe(e, {
|
3916
|
-
context: c,
|
3917
|
-
children: Object.keys(i).length ? {
|
3918
|
-
...e.children,
|
3919
|
-
...i
|
3920
|
-
} : e.children
|
3921
|
-
}), void 0, void 0];
|
3922
|
-
}
|
3923
|
-
function Er(n) {
|
3924
|
-
function e(t, r) {
|
3925
|
-
}
|
3926
|
-
return e.type = "xstate.assign", e.assignment = n, e.resolve = so, e;
|
3927
|
-
}
|
3928
|
-
function io(n, e, t, r, {
|
3929
|
-
event: s
|
3930
|
-
}) {
|
3931
|
-
const i = typeof s == "function" ? s(t, r) : s;
|
3932
|
-
return [e, {
|
3933
|
-
event: i
|
3934
|
-
}, void 0];
|
3935
|
-
}
|
3936
|
-
function oo(n, {
|
3937
|
-
event: e
|
3938
|
-
}) {
|
3939
|
-
n.defer(() => n.emit(e));
|
3940
|
-
}
|
3941
|
-
function ao(n) {
|
3942
|
-
function e(t, r) {
|
3943
|
-
}
|
3944
|
-
return e.type = "xstate.emit", e.event = n, e.resolve = io, e.execute = oo, e;
|
3945
|
-
}
|
3946
|
-
let Ct = /* @__PURE__ */ function(n) {
|
3947
|
-
return n.Parent = "#_parent", n.Internal = "#_internal", n;
|
3948
|
-
}({});
|
3949
|
-
function co(n, e, t, r, {
|
3950
|
-
to: s,
|
3951
|
-
event: i,
|
3952
|
-
id: o,
|
3953
|
-
delay: a
|
3954
|
-
}, c) {
|
3955
|
-
var p;
|
3956
|
-
const u = e.machine.implementations.delays;
|
3957
|
-
if (typeof i == "string")
|
3958
|
-
throw new Error(
|
3959
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
3960
|
-
`Only event objects may be used with sendTo; use sendTo({ type: "${i}" }) instead`
|
3961
|
-
);
|
3962
|
-
const g = typeof i == "function" ? i(t, r) : i;
|
3963
|
-
let d;
|
3964
|
-
if (typeof a == "string") {
|
3965
|
-
const f = u && u[a];
|
3966
|
-
d = typeof f == "function" ? f(t, r) : f;
|
3967
|
-
} else
|
3968
|
-
d = typeof a == "function" ? a(t, r) : a;
|
3969
|
-
const h = typeof s == "function" ? s(t, r) : s;
|
3970
|
-
let l;
|
3971
|
-
if (typeof h == "string") {
|
3972
|
-
if (h === Ct.Parent ? l = n.self._parent : h === Ct.Internal ? l = n.self : h.startsWith("#_") ? l = e.children[h.slice(2)] : l = (p = c.deferredActorIds) != null && p.includes(h) ? h : e.children[h], !l)
|
3973
|
-
throw new Error(`Unable to send event to actor '${h}' from machine '${e.machine.id}'.`);
|
3974
|
-
} else
|
3975
|
-
l = h || n.self;
|
3976
|
-
return [e, {
|
3977
|
-
to: l,
|
3978
|
-
targetId: typeof h == "string" ? h : void 0,
|
3979
|
-
event: g,
|
3980
|
-
id: o,
|
3981
|
-
delay: d
|
3982
|
-
}, void 0];
|
3983
|
-
}
|
3984
|
-
function uo(n, e, t) {
|
3985
|
-
typeof t.to == "string" && (t.to = e.children[t.to]);
|
3986
|
-
}
|
3987
|
-
function ho(n, e) {
|
3988
|
-
n.defer(() => {
|
3989
|
-
const {
|
3990
|
-
to: t,
|
3991
|
-
event: r,
|
3992
|
-
delay: s,
|
3993
|
-
id: i
|
3994
|
-
} = e;
|
3995
|
-
if (typeof s == "number") {
|
3996
|
-
n.system.scheduler.schedule(n.self, t, r, s, i);
|
3997
|
-
return;
|
3998
|
-
}
|
3999
|
-
n.system._relay(
|
4000
|
-
n.self,
|
4001
|
-
// at this point, in a deferred task, it should already be mutated by retryResolveSendTo
|
4002
|
-
// if it initially started as a string
|
4003
|
-
t,
|
4004
|
-
r.type === fi ? rr(n.self.id, r.data) : r
|
4005
|
-
);
|
4006
|
-
});
|
4007
|
-
}
|
4008
|
-
function Cr(n, e, t) {
|
4009
|
-
function r(s, i) {
|
4010
|
-
}
|
4011
|
-
return r.type = "xstate.sendTo", r.to = n, r.event = e, r.id = t == null ? void 0 : t.id, r.delay = t == null ? void 0 : t.delay, r.resolve = co, r.retryResolve = uo, r.execute = ho, r;
|
4012
|
-
}
|
4013
|
-
function lo(n, e) {
|
4014
|
-
return Cr(Ct.Parent, n, e);
|
4015
|
-
}
|
4016
|
-
function fo(n, e, t, r, {
|
4017
|
-
collect: s
|
4018
|
-
}) {
|
4019
|
-
const i = [], o = function(c) {
|
4020
|
-
i.push(c);
|
4021
|
-
};
|
4022
|
-
return o.assign = (...a) => {
|
4023
|
-
i.push(Er(...a));
|
4024
|
-
}, o.cancel = (...a) => {
|
4025
|
-
i.push(ur(...a));
|
4026
|
-
}, o.raise = (...a) => {
|
4027
|
-
i.push(_r(...a));
|
4028
|
-
}, o.sendTo = (...a) => {
|
4029
|
-
i.push(Cr(...a));
|
4030
|
-
}, o.sendParent = (...a) => {
|
4031
|
-
i.push(lo(...a));
|
4032
|
-
}, o.spawnChild = (...a) => {
|
4033
|
-
i.push(dr(...a));
|
4034
|
-
}, o.stopChild = (...a) => {
|
4035
|
-
i.push(jt(...a));
|
4036
|
-
}, o.emit = (...a) => {
|
4037
|
-
i.push(ao(...a));
|
4038
|
-
}, s({
|
4039
|
-
context: t.context,
|
4040
|
-
event: t.event,
|
4041
|
-
enqueue: o,
|
4042
|
-
check: (a) => it(a, e.context, t.event, e),
|
4043
|
-
self: n.self,
|
4044
|
-
system: n.system
|
4045
|
-
}, r), [e, void 0, i];
|
4046
|
-
}
|
4047
|
-
function ko(n) {
|
4048
|
-
function e(t, r) {
|
4049
|
-
}
|
4050
|
-
return e.type = "xstate.enqueueActions", e.collect = n, e.resolve = fo, e;
|
4051
|
-
}
|
4052
|
-
function Lo(n, e) {
|
4053
|
-
const t = B(e);
|
4054
|
-
if (!t.includes(n.type)) {
|
4055
|
-
const r = t.length === 1 ? `type "${t[0]}"` : `one of types "${t.join('", "')}"`;
|
4056
|
-
throw new Error(`Expected event ${JSON.stringify(n)} to have ${r}`);
|
4057
|
-
}
|
4058
|
-
}
|
4059
|
-
const vn = /* @__PURE__ */ new WeakMap();
|
4060
|
-
function ue(n, e, t) {
|
4061
|
-
let r = vn.get(n);
|
4062
|
-
return r ? e in r || (r[e] = t()) : (r = {
|
4063
|
-
[e]: t()
|
4064
|
-
}, vn.set(n, r)), r[e];
|
4065
|
-
}
|
4066
|
-
const po = {}, Ce = (n) => typeof n == "string" ? {
|
4067
|
-
type: n
|
4068
|
-
} : typeof n == "function" ? "resolve" in n ? {
|
4069
|
-
type: n.type
|
4070
|
-
} : {
|
4071
|
-
type: n.name
|
4072
|
-
} : n;
|
4073
|
-
class Pt {
|
4074
|
-
constructor(e, t) {
|
4075
|
-
if (this.config = e, this.key = void 0, this.id = void 0, this.type = void 0, this.path = void 0, this.states = void 0, this.history = void 0, this.entry = void 0, this.exit = void 0, this.parent = void 0, this.machine = void 0, this.meta = void 0, this.output = void 0, this.order = -1, this.description = void 0, this.tags = [], this.transitions = void 0, this.always = void 0, this.parent = t._parent, this.key = t._key, this.machine = t._machine, this.path = this.parent ? this.parent.path.concat(this.key) : [], this.id = this.config.id || [this.machine.id, ...this.path].join(er), this.type = this.config.type || (this.config.states && Object.keys(this.config.states).length ? "compound" : this.config.history ? "history" : "atomic"), this.description = this.config.description, this.order = this.machine.idMap.size, this.machine.idMap.set(this.id, this), this.states = this.config.states ? dn(this.config.states, (r, s) => new Pt(r, {
|
4076
|
-
_parent: this,
|
4077
|
-
_key: s,
|
4078
|
-
_machine: this.machine
|
4079
|
-
})) : po, this.type === "compound" && !this.config.initial)
|
4080
|
-
throw new Error(`No initial state specified for compound state node "#${this.id}". Try adding { initial: "${Object.keys(this.states)[0]}" } to the state config.`);
|
4081
|
-
this.history = this.config.history === !0 ? "shallow" : this.config.history || !1, this.entry = B(this.config.entry).slice(), this.exit = B(this.config.exit).slice(), this.meta = this.config.meta, this.output = this.type === "final" || !this.parent ? this.config.output : void 0, this.tags = B(e.tags).slice();
|
4082
|
-
}
|
4083
|
-
/** @internal */
|
4084
|
-
_initialize() {
|
4085
|
-
this.transitions = Mi(this), this.config.always && (this.always = de(this.config.always).map((e) => K(this, tr, e))), Object.keys(this.states).forEach((e) => {
|
4086
|
-
this.states[e]._initialize();
|
4087
|
-
});
|
4088
|
-
}
|
4089
|
-
/** The well-structured state node definition. */
|
4090
|
-
get definition() {
|
4091
|
-
return {
|
4092
|
-
id: this.id,
|
4093
|
-
key: this.key,
|
4094
|
-
version: this.machine.version,
|
4095
|
-
type: this.type,
|
4096
|
-
initial: this.initial ? {
|
4097
|
-
target: this.initial.target,
|
4098
|
-
source: this,
|
4099
|
-
actions: this.initial.actions.map(Ce),
|
4100
|
-
eventType: null,
|
4101
|
-
reenter: !1,
|
4102
|
-
toJSON: () => ({
|
4103
|
-
target: this.initial.target.map((e) => `#${e.id}`),
|
4104
|
-
source: `#${this.id}`,
|
4105
|
-
actions: this.initial.actions.map(Ce),
|
4106
|
-
eventType: null
|
4107
|
-
})
|
4108
|
-
} : void 0,
|
4109
|
-
history: this.history,
|
4110
|
-
states: dn(this.states, (e) => e.definition),
|
4111
|
-
on: this.on,
|
4112
|
-
transitions: [...this.transitions.values()].flat().map((e) => ({
|
4113
|
-
...e,
|
4114
|
-
actions: e.actions.map(Ce)
|
4115
|
-
})),
|
4116
|
-
entry: this.entry.map(Ce),
|
4117
|
-
exit: this.exit.map(Ce),
|
4118
|
-
meta: this.meta,
|
4119
|
-
order: this.order || -1,
|
4120
|
-
output: this.output,
|
4121
|
-
invoke: this.invoke,
|
4122
|
-
description: this.description,
|
4123
|
-
tags: this.tags
|
4124
|
-
};
|
4125
|
-
}
|
4126
|
-
/** @internal */
|
4127
|
-
toJSON() {
|
4128
|
-
return this.definition;
|
4129
|
-
}
|
4130
|
-
/** The logic invoked as actors by this state node. */
|
4131
|
-
get invoke() {
|
4132
|
-
return ue(this, "invoke", () => B(this.config.invoke).map((e, t) => {
|
4133
|
-
const {
|
4134
|
-
src: r,
|
4135
|
-
systemId: s
|
4136
|
-
} = e, i = e.id ?? hn(this.id, t), o = typeof r == "string" ? r : `xstate.invoke.${hn(this.id, t)}`;
|
4137
|
-
return {
|
4138
|
-
...e,
|
4139
|
-
src: o,
|
4140
|
-
id: i,
|
4141
|
-
systemId: s,
|
4142
|
-
toJSON() {
|
4143
|
-
const {
|
4144
|
-
onDone: a,
|
4145
|
-
onError: c,
|
4146
|
-
...u
|
4147
|
-
} = e;
|
4148
|
-
return {
|
4149
|
-
...u,
|
4150
|
-
type: "xstate.invoke",
|
4151
|
-
src: o,
|
4152
|
-
id: i
|
4153
|
-
};
|
4154
|
-
}
|
4155
|
-
};
|
4156
|
-
}));
|
4157
|
-
}
|
4158
|
-
/** The mapping of events to transitions. */
|
4159
|
-
get on() {
|
4160
|
-
return ue(this, "on", () => [...this.transitions].flatMap(([t, r]) => r.map((s) => [t, s])).reduce((t, [r, s]) => (t[r] = t[r] || [], t[r].push(s), t), {}));
|
4161
|
-
}
|
4162
|
-
get after() {
|
4163
|
-
return ue(this, "delayedTransitions", () => Oi(this));
|
4164
|
-
}
|
4165
|
-
get initial() {
|
4166
|
-
return ue(this, "initial", () => ji(this, this.config.initial));
|
4167
|
-
}
|
4168
|
-
/** @internal */
|
4169
|
-
next(e, t) {
|
4170
|
-
const r = t.type, s = [];
|
4171
|
-
let i;
|
4172
|
-
const o = ue(this, `candidates-${r}`, () => Ii(this, r));
|
4173
|
-
for (const a of o) {
|
4174
|
-
const {
|
4175
|
-
guard: c
|
4176
|
-
} = a, u = e.context;
|
4177
|
-
let g = !1;
|
4178
|
-
try {
|
4179
|
-
g = !c || it(c, u, t, e);
|
4180
|
-
} catch (d) {
|
4181
|
-
const h = typeof c == "string" ? c : typeof c == "object" ? c.type : void 0;
|
4182
|
-
throw new Error(`Unable to evaluate guard ${h ? `'${h}' ` : ""}in transition for event '${r}' in state node '${this.id}':
|
4183
|
-
${d.message}`);
|
4184
|
-
}
|
4185
|
-
if (g) {
|
4186
|
-
s.push(...a.actions), i = a;
|
4187
|
-
break;
|
4188
|
-
}
|
4189
|
-
}
|
4190
|
-
return i ? [i] : void 0;
|
4191
|
-
}
|
4192
|
-
/** All the event types accepted by this state node and its descendants. */
|
4193
|
-
get events() {
|
4194
|
-
return ue(this, "events", () => {
|
4195
|
-
const {
|
4196
|
-
states: e
|
4197
|
-
} = this, t = new Set(this.ownEvents);
|
4198
|
-
if (e)
|
4199
|
-
for (const r of Object.keys(e)) {
|
4200
|
-
const s = e[r];
|
4201
|
-
if (s.states)
|
4202
|
-
for (const i of s.events)
|
4203
|
-
t.add(`${i}`);
|
4204
|
-
}
|
4205
|
-
return Array.from(t);
|
4206
|
-
});
|
4207
|
-
}
|
4208
|
-
/**
|
4209
|
-
* All the events that have transitions directly from this state node.
|
4210
|
-
*
|
4211
|
-
* Excludes any inert events.
|
4212
|
-
*/
|
4213
|
-
get ownEvents() {
|
4214
|
-
const e = new Set([...this.transitions.keys()].filter((t) => this.transitions.get(t).some((r) => !(!r.target && !r.actions.length && !r.reenter))));
|
4215
|
-
return Array.from(e);
|
4216
|
-
}
|
4217
|
-
}
|
4218
|
-
const yo = "#";
|
4219
|
-
class Dt {
|
4220
|
-
constructor(e, t) {
|
4221
|
-
this.config = e, this.version = void 0, this.schemas = void 0, this.implementations = void 0, this.__xstatenode = !0, this.idMap = /* @__PURE__ */ new Map(), this.root = void 0, this.id = void 0, this.states = void 0, this.events = void 0, this.id = e.id || "(machine)", this.implementations = {
|
4222
|
-
actors: (t == null ? void 0 : t.actors) ?? {},
|
4223
|
-
actions: (t == null ? void 0 : t.actions) ?? {},
|
4224
|
-
delays: (t == null ? void 0 : t.delays) ?? {},
|
4225
|
-
guards: (t == null ? void 0 : t.guards) ?? {}
|
4226
|
-
}, this.version = this.config.version, this.schemas = this.config.schemas, this.transition = this.transition.bind(this), this.getInitialSnapshot = this.getInitialSnapshot.bind(this), this.getPersistedSnapshot = this.getPersistedSnapshot.bind(this), this.restoreSnapshot = this.restoreSnapshot.bind(this), this.start = this.start.bind(this), this.root = new Pt(e, {
|
4227
|
-
_key: this.id,
|
4228
|
-
_machine: this
|
4229
|
-
}), this.root._initialize(), this.states = this.root.states, this.events = this.root.events;
|
4230
|
-
}
|
4231
|
-
/**
|
4232
|
-
* Clones this state machine with the provided implementations and merges the
|
4233
|
-
* `context` (if provided).
|
4234
|
-
*
|
4235
|
-
* @param implementations Options (`actions`, `guards`, `actors`, `delays`,
|
4236
|
-
* `context`) to recursively merge with the existing options.
|
4237
|
-
* @returns A new `StateMachine` instance with the provided implementations.
|
4238
|
-
*/
|
4239
|
-
provide(e) {
|
4240
|
-
const {
|
4241
|
-
actions: t,
|
4242
|
-
guards: r,
|
4243
|
-
actors: s,
|
4244
|
-
delays: i
|
4245
|
-
} = this.implementations;
|
4246
|
-
return new Dt(this.config, {
|
4247
|
-
actions: {
|
4248
|
-
...t,
|
4249
|
-
...e.actions
|
4250
|
-
},
|
4251
|
-
guards: {
|
4252
|
-
...r,
|
4253
|
-
...e.guards
|
4254
|
-
},
|
4255
|
-
actors: {
|
4256
|
-
...s,
|
4257
|
-
...e.actors
|
4258
|
-
},
|
4259
|
-
delays: {
|
4260
|
-
...i,
|
4261
|
-
...e.delays
|
4262
|
-
}
|
4263
|
-
});
|
4264
|
-
}
|
4265
|
-
resolveState(e) {
|
4266
|
-
const t = Ji(this.root, e.value), r = Ye(Ke(this.root, t));
|
4267
|
-
return ze({
|
4268
|
-
_nodes: [...r],
|
4269
|
-
context: e.context || {},
|
4270
|
-
children: {},
|
4271
|
-
status: kt(r, this.root) ? "done" : e.status || "active",
|
4272
|
-
output: e.output,
|
4273
|
-
error: e.error,
|
4274
|
-
historyValue: e.historyValue
|
4275
|
-
}, this);
|
4276
|
-
}
|
4277
|
-
/**
|
4278
|
-
* Determines the next snapshot given the current `snapshot` and received
|
4279
|
-
* `event`. Calculates a full macrostep from all microsteps.
|
4280
|
-
*
|
4281
|
-
* @param snapshot The current snapshot
|
4282
|
-
* @param event The received event
|
4283
|
-
*/
|
4284
|
-
transition(e, t, r) {
|
4285
|
-
return ht(e, t, r, []).snapshot;
|
4286
|
-
}
|
4287
|
-
/**
|
4288
|
-
* Determines the next state given the current `state` and `event`. Calculates
|
4289
|
-
* a microstep.
|
4290
|
-
*
|
4291
|
-
* @param state The current state
|
4292
|
-
* @param event The received event
|
4293
|
-
*/
|
4294
|
-
microstep(e, t, r) {
|
4295
|
-
return ht(e, t, r, []).microstates;
|
4296
|
-
}
|
4297
|
-
getTransitionData(e, t) {
|
4298
|
-
return Lt(this.root, e.value, e, t) || [];
|
4299
|
-
}
|
4300
|
-
/**
|
4301
|
-
* The initial state _before_ evaluating any microsteps. This "pre-initial"
|
4302
|
-
* state is provided to initial actions executed in the initial state.
|
4303
|
-
*/
|
4304
|
-
getPreInitialState(e, t, r) {
|
4305
|
-
const {
|
4306
|
-
context: s
|
4307
|
-
} = this.config, i = ze({
|
4308
|
-
context: typeof s != "function" && s ? s : {},
|
4309
|
-
_nodes: [this.root],
|
4310
|
-
children: {},
|
4311
|
-
status: "active"
|
4312
|
-
}, this);
|
4313
|
-
return typeof s == "function" ? _e(i, t, e, [Er(({
|
4314
|
-
spawn: a,
|
4315
|
-
event: c,
|
4316
|
-
self: u
|
4317
|
-
}) => s({
|
4318
|
-
spawn: a,
|
4319
|
-
input: c.input,
|
4320
|
-
self: u
|
4321
|
-
}))], r, void 0) : i;
|
4322
|
-
}
|
4323
|
-
/**
|
4324
|
-
* Returns the initial `State` instance, with reference to `self` as an
|
4325
|
-
* `ActorRef`.
|
4326
|
-
*/
|
4327
|
-
getInitialSnapshot(e, t) {
|
4328
|
-
const r = sr(t), s = [], i = this.getPreInitialState(e, r, s), o = Et([{
|
4329
|
-
target: [...yr(this.root)],
|
4330
|
-
source: this.root,
|
4331
|
-
reenter: !0,
|
4332
|
-
actions: [],
|
4333
|
-
eventType: null,
|
4334
|
-
toJSON: null
|
4335
|
-
// TODO: fix
|
4336
|
-
}], i, e, r, !0, s), {
|
4337
|
-
snapshot: a
|
4338
|
-
} = ht(o, r, e, s);
|
4339
|
-
return a;
|
4340
|
-
}
|
4341
|
-
start(e) {
|
4342
|
-
Object.values(e.children).forEach((t) => {
|
4343
|
-
t.getSnapshot().status === "active" && t.start();
|
4344
|
-
});
|
4345
|
-
}
|
4346
|
-
getStateNodeById(e) {
|
4347
|
-
const t = It(e), r = t.slice(1), s = ot(t[0]) ? t[0].slice(yo.length) : t[0], i = this.idMap.get(s);
|
4348
|
-
if (!i)
|
4349
|
-
throw new Error(`Child state node '#${s}' does not exist on machine '${this.id}'`);
|
4350
|
-
return Qe(i, r);
|
4351
|
-
}
|
4352
|
-
get definition() {
|
4353
|
-
return this.root.definition;
|
4354
|
-
}
|
4355
|
-
toJSON() {
|
4356
|
-
return this.definition;
|
4357
|
-
}
|
4358
|
-
getPersistedSnapshot(e, t) {
|
4359
|
-
return eo(e, t);
|
4360
|
-
}
|
4361
|
-
restoreSnapshot(e, t) {
|
4362
|
-
const r = {}, s = e.children;
|
4363
|
-
Object.keys(s).forEach((c) => {
|
4364
|
-
const u = s[c], g = u.snapshot, d = u.src, h = typeof d == "string" ? Ot(this, d) : d;
|
4365
|
-
if (!h)
|
4366
|
-
return;
|
4367
|
-
const l = Xe(h, {
|
4368
|
-
id: c,
|
4369
|
-
parent: t.self,
|
4370
|
-
syncSnapshot: u.syncSnapshot,
|
4371
|
-
snapshot: g,
|
4372
|
-
src: d,
|
4373
|
-
systemId: u.systemId
|
4374
|
-
});
|
4375
|
-
r[c] = l;
|
4376
|
-
});
|
4377
|
-
const i = ze({
|
4378
|
-
...e,
|
4379
|
-
children: r,
|
4380
|
-
_nodes: Array.from(Ye(Ke(this.root, e.value)))
|
4381
|
-
}, this), o = /* @__PURE__ */ new Set();
|
4382
|
-
function a(c, u) {
|
4383
|
-
if (!o.has(c)) {
|
4384
|
-
o.add(c);
|
4385
|
-
for (const g in c) {
|
4386
|
-
const d = c[g];
|
4387
|
-
if (d && typeof d == "object") {
|
4388
|
-
if ("xstate$$type" in d && d.xstate$$type === Mt) {
|
4389
|
-
c[g] = u[d.id];
|
4390
|
-
continue;
|
4391
|
-
}
|
4392
|
-
a(d, u);
|
4393
|
-
}
|
4394
|
-
}
|
4395
|
-
}
|
4396
|
-
}
|
4397
|
-
return a(i.context, r), i;
|
4398
|
-
}
|
4399
|
-
}
|
4400
|
-
function go(n, e) {
|
4401
|
-
return new Dt(n, e);
|
4402
|
-
}
|
4403
|
-
function qo({
|
4404
|
-
schemas: n,
|
4405
|
-
actors: e,
|
4406
|
-
actions: t,
|
4407
|
-
guards: r,
|
4408
|
-
delays: s
|
4409
|
-
}) {
|
4410
|
-
return {
|
4411
|
-
createMachine: (i) => go({
|
4412
|
-
...i,
|
4413
|
-
schemas: n
|
4414
|
-
}, {
|
4415
|
-
actors: e,
|
4416
|
-
actions: t,
|
4417
|
-
guards: r,
|
4418
|
-
delays: s
|
4419
|
-
})
|
4420
|
-
};
|
4421
|
-
}
|
4422
|
-
const mo = rt(function(n, e) {
|
4423
|
-
return /* @__PURE__ */ nt(
|
4424
|
-
"svg",
|
4425
|
-
{
|
4426
|
-
"data-sanity-icon": "groq-logo",
|
4427
|
-
height: "1em",
|
4428
|
-
viewBox: "0 0 304 64",
|
4429
|
-
fill: "none",
|
4430
|
-
xmlns: "http://www.w3.org/2000/svg",
|
4431
|
-
...n,
|
4432
|
-
ref: e,
|
4433
|
-
children: [
|
4434
|
-
/* @__PURE__ */ v("path", { d: "M32 0L0 32H32V0Z", fill: S.magenta[400].hex }),
|
4435
|
-
/* @__PURE__ */ v("path", { d: "M32 32H0L32 64V32Z", fill: S.green[300].hex }),
|
4436
|
-
/* @__PURE__ */ v("path", { d: "M64 32H32V64L64 32Z", fill: S.purple[300].hex }),
|
4437
|
-
/* @__PURE__ */ v("path", { d: "M112 0L80 32H112V0Z", fill: S.green[300].hex }),
|
4438
|
-
/* @__PURE__ */ v("path", { d: "M112 0H80V32L112 0Z", fill: S.purple[300].hex }),
|
4439
|
-
/* @__PURE__ */ v("path", { d: "M112 32H80L112 64V32Z", fill: S.yellow[200].hex }),
|
4440
|
-
/* @__PURE__ */ v("path", { d: "M144 64L112 32V64H144Z", fill: S.blue[300].hex }),
|
4441
|
-
/* @__PURE__ */ v("path", { d: "M80 32V64H112L80 32Z", fill: S.orange[400].hex }),
|
4442
|
-
/* @__PURE__ */ v("path", { d: "M112 0V32H144L112 0Z", fill: S.magenta[400].hex }),
|
4443
|
-
/* @__PURE__ */ v("path", { d: "M192 0L160 32H192V0Z", fill: S.yellow[200].hex }),
|
4444
|
-
/* @__PURE__ */ v("path", { d: "M192 32H160L192 64V32Z", fill: S.orange[400].hex }),
|
4445
|
-
/* @__PURE__ */ v("path", { d: "M224 32H192V64L224 32Z", fill: S.green[300].hex }),
|
4446
|
-
/* @__PURE__ */ v("path", { d: "M192 0V32H224L192 0Z", fill: S.blue[300].hex }),
|
4447
|
-
/* @__PURE__ */ v("path", { d: "M272 0L240 32H272V0Z", fill: S.purple[300].hex }),
|
4448
|
-
/* @__PURE__ */ v("path", { d: "M304 32L272 64H304V32Z", fill: S.magenta[400].hex }),
|
4449
|
-
/* @__PURE__ */ v("path", { d: "M272 32H240L272 64V32Z", fill: S.blue[300].hex }),
|
4450
|
-
/* @__PURE__ */ v("path", { d: "M304 32H272V64L304 32Z", fill: S.yellow[200].hex }),
|
4451
|
-
/* @__PURE__ */ v("path", { d: "M272 0V32H304L272 0Z", fill: S.green[300].hex })
|
4452
|
-
]
|
4453
|
-
}
|
4454
|
-
);
|
4455
|
-
});
|
4456
|
-
mo.displayName = "ForwardRef(GroqLogo)";
|
4457
|
-
const wo = rt(function(n, e) {
|
4458
|
-
return /* @__PURE__ */ nt(
|
4459
|
-
"svg",
|
4460
|
-
{
|
4461
|
-
"data-sanity-icon": "groq-monogram",
|
4462
|
-
width: "1em",
|
4463
|
-
height: "1em",
|
4464
|
-
viewBox: "0 0 128 128",
|
4465
|
-
fill: "none",
|
4466
|
-
xmlns: "http://www.w3.org/2000/svg",
|
4467
|
-
...n,
|
4468
|
-
ref: e,
|
4469
|
-
children: [
|
4470
|
-
/* @__PURE__ */ v("rect", { width: "128", height: "128", rx: "8", fill: S.green[950].hex }),
|
4471
|
-
/* @__PURE__ */ v("rect", { y: "32", width: "64", height: "64", fill: S.green[800].hex }),
|
4472
|
-
/* @__PURE__ */ v("path", { d: "M64 32L32 64H64V32Z", fill: S.magenta[400].hex }),
|
4473
|
-
/* @__PURE__ */ v("path", { d: "M64 64H32L64 96V64Z", fill: S.green[300].hex }),
|
4474
|
-
/* @__PURE__ */ v("path", { d: "M96 64H64V96L96 64Z", fill: S.purple[300].hex })
|
4475
|
-
]
|
4476
|
-
}
|
4477
|
-
);
|
4478
|
-
});
|
4479
|
-
wo.displayName = "ForwardRef(GroqMonogram)";
|
4480
|
-
const vo = {
|
4481
|
-
light: [S.red[200].hex, S.red[300].hex, S.red[500].hex],
|
4482
|
-
dark: [S.gray[500].hex, S.gray[300].hex, _n.hex]
|
4483
|
-
}, bo = rt(function(n, e) {
|
4484
|
-
const { dark: t, ...r } = n, s = vo[t ? "dark" : "light"];
|
4485
|
-
return /* @__PURE__ */ nt(
|
4486
|
-
"svg",
|
4487
|
-
{
|
4488
|
-
"data-sanity-icon": "sanity-logo",
|
4489
|
-
height: "1em",
|
4490
|
-
viewBox: "0 0 352 100",
|
4491
|
-
fill: "none",
|
4492
|
-
xmlns: "http://www.w3.org/2000/svg",
|
4493
|
-
...r,
|
4494
|
-
ref: e,
|
4495
|
-
children: [
|
4496
|
-
/* @__PURE__ */ v("path", { d: "M311.14 57.234V80.0016H298.499V57.234", fill: s[1] }),
|
4497
|
-
/* @__PURE__ */ v("path", { d: "M298.499 57.2341L319.889 20.0017H333.316L311.14 57.2341H298.499Z", fill: s[2] }),
|
4498
|
-
/* @__PURE__ */ v(
|
4499
|
-
"path",
|
4500
|
-
{
|
4501
|
-
d: "M298.499 57.2341L276.515 20.0017H290.345L305.239 45.5161L298.499 57.2341Z",
|
4502
|
-
fill: s[1]
|
4503
|
-
}
|
4504
|
-
),
|
4505
|
-
/* @__PURE__ */ v("path", { d: "M253.839 40.9625V80.0017H241.007V47.6275L253.839 40.9625Z", fill: s[1] }),
|
4506
|
-
/* @__PURE__ */ v(
|
4507
|
-
"path",
|
4508
|
-
{
|
4509
|
-
d: "M241.007 47.5944L273.538 30.9469L268.042 21.6519L241.007 34.8633V47.5944Z",
|
4510
|
-
fill: s[0]
|
4511
|
-
}
|
4512
|
-
),
|
4513
|
-
/* @__PURE__ */ v(
|
4514
|
-
"path",
|
4515
|
-
{
|
4516
|
-
d: "M241.007 30.9469H221.404V20.0017H267.064L273.538 30.9469H253.839H241.007Z",
|
4517
|
-
fill: s[2]
|
4518
|
-
}
|
4519
|
-
),
|
4520
|
-
/* @__PURE__ */ v("path", { d: "M214.047 20.0017H201.311V80.0121H214.047V20.0017Z", fill: s[2] }),
|
4521
|
-
/* @__PURE__ */ v("path", { d: "M149.39 37.8712V80.0017H137.153V20.0017L149.39 37.8712Z", fill: s[1] }),
|
4522
|
-
/* @__PURE__ */ v(
|
4523
|
-
"path",
|
4524
|
-
{
|
4525
|
-
d: "M151.282 20.0017L178.231 60.9939V80.0017L137.153 20.0017H151.282Z",
|
4526
|
-
fill: s[2]
|
4527
|
-
}
|
4528
|
-
),
|
4529
|
-
/* @__PURE__ */ v("path", { d: "M178.231 57.9129V20.0017H190.467V80.0017H178.231V57.9129Z", fill: s[1] }),
|
4530
|
-
/* @__PURE__ */ v(
|
4531
|
-
"path",
|
4532
|
-
{
|
4533
|
-
d: "M82.1168 80.9834L112.102 65.3053L108.405 55.7303L88.6644 64.9362L82.1168 80.9834Z",
|
4534
|
-
fill: s[0]
|
4535
|
-
}
|
4536
|
-
),
|
4537
|
-
/* @__PURE__ */ v(
|
4538
|
-
"path",
|
4539
|
-
{
|
4540
|
-
d: "M100.657 35.5422L82.1167 80.9834L72.5807 72.7745L94.6719 20.0017L100.657 35.5422Z",
|
4541
|
-
fill: s[1]
|
4542
|
-
}
|
4543
|
-
),
|
4544
|
-
/* @__PURE__ */ v("path", { d: "M94.672 20.0017H107.312L130.69 80.0017H117.752L94.672 20.0017Z", fill: s[2] }),
|
4545
|
-
/* @__PURE__ */ v(
|
4546
|
-
"path",
|
4547
|
-
{
|
4548
|
-
d: "M25.1347 26.926C25.1347 35.2811 30.3864 40.2524 40.9004 42.8738L52.0417 45.4117C61.9923 47.6571 68.0519 53.2341 68.0519 62.3203C68.1293 66.2787 66.8194 70.1429 64.3417 73.2654C64.3417 64.2002 59.5684 59.302 48.0551 56.3568L37.1158 53.913C28.3559 51.9495 21.5946 47.3647 21.5946 37.4952C21.5485 33.6839 22.7939 29.9658 25.1347 26.926",
|
4549
|
-
fill: s[2]
|
4550
|
-
}
|
4551
|
-
),
|
4552
|
-
/* @__PURE__ */ v(
|
4553
|
-
"path",
|
4554
|
-
{
|
4555
|
-
d: "M57.4954 60.0957C62.2475 63.0827 64.3311 67.2602 64.3311 73.255C60.3977 78.2054 53.4875 80.9834 45.3655 80.9834C31.6941 80.9834 22.1262 74.3725 20 62.8842H33.1292C34.8196 68.1584 39.2952 70.6022 45.2698 70.6022C52.5626 70.6022 57.4104 66.7798 57.506 60.0748",
|
4556
|
-
fill: s[1]
|
4557
|
-
}
|
4558
|
-
),
|
4559
|
-
/* @__PURE__ */ v(
|
4560
|
-
"path",
|
4561
|
-
{
|
4562
|
-
d: "M31.9598 39.3124C29.7898 38.0455 28.0095 36.225 26.8079 34.0442C25.6062 31.8634 25.028 29.4036 25.1347 26.926C28.93 22.0174 35.5318 19.02 43.5794 19.02C57.506 19.02 65.5643 26.2472 67.5523 36.4195H54.9227C53.53 32.409 50.0431 29.2863 43.6858 29.2863C36.8926 29.2863 32.2575 33.1715 31.9917 39.3124",
|
4563
|
-
fill: s[1]
|
4564
|
-
}
|
4565
|
-
)
|
4566
|
-
]
|
4567
|
-
}
|
4568
|
-
);
|
4569
|
-
});
|
4570
|
-
bo.displayName = "ForwardRef(SanityLogo)";
|
4571
|
-
const _o = {
|
4572
|
-
bg1: S.red[500].hex,
|
4573
|
-
bg2: S.red[200].hex,
|
4574
|
-
fg: _n.hex
|
4575
|
-
}, Eo = rt(function(n, e) {
|
4576
|
-
const { color: t = _o, ...r } = n;
|
4577
|
-
return /* @__PURE__ */ nt(
|
4578
|
-
"svg",
|
4579
|
-
{
|
4580
|
-
"data-sanity-icon": "sanity-monogram",
|
4581
|
-
width: "1em",
|
4582
|
-
height: "1em",
|
4583
|
-
viewBox: "0 0 128 128",
|
4584
|
-
fill: "none",
|
4585
|
-
xmlns: "http://www.w3.org/2000/svg",
|
4586
|
-
...r,
|
4587
|
-
ref: e,
|
4588
|
-
children: [
|
4589
|
-
/* @__PURE__ */ v("rect", { width: "128", height: "128", rx: "8", fill: t.bg1 }),
|
4590
|
-
/* @__PURE__ */ v(
|
4591
|
-
"path",
|
4592
|
-
{
|
4593
|
-
d: "M39.423 33.163C39.423 44.1615 46.3363 50.7056 60.1768 54.1564L74.843 57.4972C87.9418 60.453 95.9186 67.7945 95.9186 79.7554C96.0205 84.9662 94.2961 90.0531 91.0345 94.1635C91.0345 82.2301 84.751 75.7822 69.595 71.9052L55.1948 68.6882C43.6633 66.1035 34.7629 60.0681 34.7629 47.0761C34.7022 42.0589 36.3416 37.1644 39.423 33.163",
|
4594
|
-
fill: t.fg
|
4595
|
-
}
|
4596
|
-
),
|
4597
|
-
/* @__PURE__ */ v(
|
4598
|
-
"path",
|
4599
|
-
{
|
4600
|
-
d: "M82.0221 76.827C88.2776 80.759 91.0206 86.2582 91.0206 94.1497C85.8426 100.666 76.7462 104.323 66.0545 104.323C48.0576 104.323 35.4626 95.6207 32.6637 80.4977H49.9468C52.172 87.4406 58.0636 90.6576 65.9285 90.6576C75.5287 90.6576 81.9102 85.6258 82.0361 76.7995",
|
4601
|
-
fill: t.bg2
|
4602
|
-
}
|
4603
|
-
),
|
4604
|
-
/* @__PURE__ */ v(
|
4605
|
-
"path",
|
4606
|
-
{
|
4607
|
-
d: "M48.4075 49.4682C45.551 47.8004 43.2074 45.404 41.6256 42.5332C40.0437 39.6624 39.2826 36.4244 39.4231 33.1629C44.4191 26.7013 53.1096 22.7556 63.7034 22.7556C82.0362 22.7556 92.6439 32.2693 95.2609 45.66H78.6355C76.8022 40.3807 72.2121 36.27 63.8434 36.27C54.9009 36.27 48.7993 41.3843 48.4495 49.4682",
|
4608
|
-
fill: t.bg2
|
4609
|
-
}
|
4610
|
-
)
|
4611
|
-
]
|
4612
|
-
}
|
4613
|
-
);
|
4614
|
-
});
|
4615
|
-
Eo.displayName = "ForwardRef(SanityMonogram)";
|
4616
|
-
export {
|
4617
|
-
Oo as C,
|
4618
|
-
Eo as S,
|
4619
|
-
Cr as a,
|
4620
|
-
Er as b,
|
4621
|
-
Mo as c,
|
4622
|
-
ao as d,
|
4623
|
-
ko as e,
|
4624
|
-
Ro as f,
|
4625
|
-
jo as g,
|
4626
|
-
Lo as h,
|
4627
|
-
jt as i,
|
4628
|
-
Xe as j,
|
4629
|
-
Rr as k,
|
4630
|
-
bo as l,
|
4631
|
-
_r as r,
|
4632
|
-
qo as s,
|
4633
|
-
bt as t,
|
4634
|
-
Ln as v
|
4635
|
-
};
|
4636
|
-
//# sourceMappingURL=index-C3OvVLVP.mjs.map
|