@chaibuilder/sdk 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AddBlocks-e23baf9a.cjs → AddBlocks-1f683caa.cjs} +1 -1
- package/dist/{AddBlocks-b5f37f2f.js → AddBlocks-b6a12d50.js} +19 -19
- package/dist/{BrandingOptions-3d1bd24a.cjs → BrandingOptions-02e4ebcf.cjs} +1 -1
- package/dist/{BrandingOptions-cfd1b740.js → BrandingOptions-1190723a.js} +27 -27
- package/dist/{CanvasArea-a065a586.js → CanvasArea-15458836.js} +19 -18
- package/dist/CanvasArea-f5d27245.cjs +60 -0
- package/dist/Class-7d6aadbc.cjs +1 -0
- package/dist/{Class-e6b07b79.js → Class-e34b2337.js} +9 -9
- package/dist/{ImagesPanel-eccf9a56.js → ImagesPanel-8ccab6d9.js} +1 -1
- package/dist/{ImagesPanel-cc136c92.cjs → ImagesPanel-addb2bf9.cjs} +1 -1
- package/dist/{Layers-f002ba1a.cjs → Layers-06fa708d.cjs} +1 -1
- package/dist/{Layers-f935e07b.js → Layers-ff4ef9c0.js} +3 -3
- package/dist/{MarkAsGlobalBlock-613bfdab.js → MarkAsGlobalBlock-dea26aa7.js} +2 -2
- package/dist/{MarkAsGlobalBlock-5f435dd5.cjs → MarkAsGlobalBlock-fa0e0543.cjs} +1 -1
- package/dist/PagesPanel-3e9163c4.js +46 -0
- package/dist/PagesPanel-b08e1357.cjs +1 -0
- package/dist/ProjectPanel-17c5f131.js +66 -0
- package/dist/ProjectPanel-f0b94e3f.cjs +1 -0
- package/dist/{Settings-a19fbb69.js → Settings-6f2e86a9.js} +25 -24
- package/dist/Settings-739cff3b.cjs +1 -0
- package/dist/{SidePanels-67ebbcb4.js → SidePanels-96e64da9.js} +3 -3
- package/dist/{SidePanels-af222189.cjs → SidePanels-ce4d41d5.cjs} +1 -1
- package/dist/{Topbar-fcb01371.js → Topbar-08d10607.js} +2 -2
- package/dist/{Topbar-e92351cc.cjs → Topbar-b97472fc.cjs} +1 -1
- package/dist/UnsplashImages-68492dc9.cjs +1 -0
- package/dist/{UnsplashImages-fda2f29a.js → UnsplashImages-afaa7706.js} +19 -28
- package/dist/add-page-modal-3275cfb2.cjs +1 -0
- package/dist/add-page-modal-bcd9249e.js +93 -0
- package/dist/alert-dialog-4ce6ed22.cjs +1 -0
- package/dist/alert-dialog-ee98f47e.js +64 -0
- package/dist/confirm-alert-4f50caa7.cjs +1 -0
- package/dist/confirm-alert-f2a47cc7.js +36 -0
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +20 -12
- package/dist/core.js +53 -52
- package/dist/delete-page-modal-420a17e3.cjs +1 -0
- package/dist/delete-page-modal-fa7b4272.js +64 -0
- package/dist/dropdown-menu-84b2439e.cjs +1 -0
- package/dist/dropdown-menu-ae3ed09b.js +164 -0
- package/dist/form-5d5c5c9e.js +125 -0
- package/dist/form-6eac0287.cjs +1 -0
- package/dist/{html-to-json-7510f587.js → html-to-json-9304dbda.js} +1 -1
- package/dist/{html-to-json-7eba915f.cjs → html-to-json-9c9961da.cjs} +1 -1
- package/dist/index-133d90a5.cjs +2 -0
- package/dist/index-3f65447f.js +4754 -0
- package/dist/input-42acea7e.cjs +1 -0
- package/dist/input-a0ea2bc7.js +19 -0
- package/dist/lib.cjs +1 -1
- package/dist/lib.js +3 -3
- package/dist/link-86c532b5.cjs +1 -0
- package/dist/{link-e406254f.js → link-f80a947d.js} +44 -60
- package/dist/mockServiceWorker.js +292 -0
- package/dist/page-viewer-139bfb2a.cjs +1 -0
- package/dist/page-viewer-f1452439.js +88 -0
- package/dist/project-general-setting-0d7715b8.cjs +1 -0
- package/dist/project-general-setting-e5d14fa6.js +65 -0
- package/dist/project-seo-setting-01536592.js +67 -0
- package/dist/project-seo-setting-e3924578.cjs +1 -0
- package/dist/server.cjs +1 -0
- package/dist/server.d.ts +142 -0
- package/dist/server.js +126 -0
- package/dist/single-page-detail-54d7feca.cjs +1 -0
- package/dist/single-page-detail-74f88ed2.js +207 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +124 -122
- package/dist/useMutation-7d536740.cjs +1 -0
- package/dist/useMutation-97876a40.js +126 -0
- package/dist/usePageActions-ac9ad321.cjs +1 -0
- package/dist/usePageActions-de3b7515.js +37 -0
- package/dist/useProjectActions-3b1dbb5e.js +18 -0
- package/dist/useProjectActions-41af0f70.cjs +1 -0
- package/package.json +20 -2
- package/dist/CanvasArea-c4554d61.cjs +0 -60
- package/dist/Class-0801d193.cjs +0 -1
- package/dist/Settings-05b9b5fe.cjs +0 -1
- package/dist/UnsplashImages-cca34e45.cjs +0 -1
- package/dist/dropdown-menu-a9b096f9.cjs +0 -1
- package/dist/dropdown-menu-d912a52e.js +0 -223
- package/dist/index-73cf645f.cjs +0 -2
- package/dist/index-7e212fbc.js +0 -2657
- package/dist/link-1ee70bca.cjs +0 -1
|
@@ -0,0 +1,4754 @@
|
|
|
1
|
+
var Yn = (e, t, n) => {
|
|
2
|
+
if (!t.has(e))
|
|
3
|
+
throw TypeError("Cannot " + n);
|
|
4
|
+
};
|
|
5
|
+
var c = (e, t, n) => (Yn(e, t, "read from private field"), n ? n.call(e) : t.get(e)), L = (e, t, n) => {
|
|
6
|
+
if (t.has(e))
|
|
7
|
+
throw TypeError("Cannot add the same private member more than once");
|
|
8
|
+
t instanceof WeakSet ? t.add(e) : t.set(e, n);
|
|
9
|
+
}, P = (e, t, n, s) => (Yn(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
|
|
10
|
+
var wn = (e, t, n, s) => ({
|
|
11
|
+
set _(r) {
|
|
12
|
+
P(e, t, r, n);
|
|
13
|
+
},
|
|
14
|
+
get _() {
|
|
15
|
+
return c(e, t, s);
|
|
16
|
+
}
|
|
17
|
+
}), K = (e, t, n) => (Yn(e, t, "access private method"), n);
|
|
18
|
+
import { j as _ } from "./jsx-runtime-944c88e2.js";
|
|
19
|
+
import ho from "i18next";
|
|
20
|
+
import { initReactI18next as po } from "react-i18next";
|
|
21
|
+
import { FlagsProvider as mo } from "flagged";
|
|
22
|
+
import * as pe from "react";
|
|
23
|
+
import Es, { createContext as go, useReducer as yo, useEffect as ke, useDebugValue as vo, useCallback as X, useContext as bo, useMemo as wo, useState as So, Suspense as Gt, lazy as $t } from "react";
|
|
24
|
+
import { DndProvider as xo } from "react-dnd";
|
|
25
|
+
import { flatten as be, find as Ae, filter as te, map as ue, omit as Tn, isEmpty as Me, isString as Ps, set as ut, get as ee, has as Os, includes as de, without as Yr, forIn as Zr, findIndex as Sn, last as ko, startsWith as ei, first as Be, isNull as os, each as We, pick as Gs, sortBy as Ws, isObject as Ao } from "lodash";
|
|
26
|
+
import { getBackendOptions as Eo, MultiBackend as Po } from "@minoru/react-dnd-treeview";
|
|
27
|
+
import { u as en, c as ti, B as Oo, S as _o, T as Co, a as Io } from "./useBuilderProp-81a14920.js";
|
|
28
|
+
import { atom as N, useAtomValue as ne, useAtom as Y, useSetAtom as Xe, getDefaultStore as jo } from "jotai";
|
|
29
|
+
import { c as Bo } from "./utils-ac68b2c8.js";
|
|
30
|
+
import { useHotkeys as Le } from "react-hotkeys-hook";
|
|
31
|
+
import ni from "flat-to-nested";
|
|
32
|
+
import { g as He, c as Cn, B as as, a as Ro } from "./Class-e34b2337.js";
|
|
33
|
+
import Do, { excludeAction as Mo, ActionCreators as Zn } from "redux-undo";
|
|
34
|
+
import { useThrottledCallback as Lo } from "@react-hookz/web";
|
|
35
|
+
import { useChaiBlocks as No, syncBlocksWithDefaults as To } from "@chaibuilder/blocks";
|
|
36
|
+
import { FileTextIcon as Fo, GearIcon as Uo } from "@radix-ui/react-icons";
|
|
37
|
+
import { S as lt, I as si, a as cs } from "./CONTROLS-442caee5.js";
|
|
38
|
+
const qo = "Dark mode", $o = "This page has no blocks. Add a block by clicking the + button", Qo = "This page is empty", Vo = "Please select a block to edit settings or styles", Ko = "Please select a styling block", zo = "Drop your block here", Go = {
|
|
39
|
+
dark_mode: qo,
|
|
40
|
+
tree_view_no_blocks: $o,
|
|
41
|
+
canvas_empty: Qo,
|
|
42
|
+
no_block_selected_for_styling: Vo,
|
|
43
|
+
no_styling_block_selected: Ko,
|
|
44
|
+
drop_here_message: zo
|
|
45
|
+
};
|
|
46
|
+
ho.use(po).init({
|
|
47
|
+
// the translations
|
|
48
|
+
// (tip move them in a JSON file and import them,
|
|
49
|
+
// or even better, manage them via a UI: https://react.i18next.com/guides/multiple-translation-files#manage-your-translations-with-a-management-gui)
|
|
50
|
+
resources: {
|
|
51
|
+
en: {
|
|
52
|
+
translation: Go
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
lng: "en",
|
|
56
|
+
// if you're using a language detector, do not define the lng option
|
|
57
|
+
fallbackLng: "en",
|
|
58
|
+
interpolation: {
|
|
59
|
+
escapeValue: !1
|
|
60
|
+
// react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
const Wo = "";
|
|
64
|
+
const Ho = {};
|
|
65
|
+
class Jo extends Es.Component {
|
|
66
|
+
constructor(t) {
|
|
67
|
+
super(t), this.state = { hasError: !1 };
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A static method that returns an object to update the state when an error is caught.
|
|
71
|
+
* @returns {object} An object to update the state when an error is caught.
|
|
72
|
+
*/
|
|
73
|
+
static getDerivedStateFromError(t) {
|
|
74
|
+
return console.error(t), { hasError: !0 };
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
return this.state.hasError ? /* @__PURE__ */ _.jsx("h1", { children: "Something went wrong." }) : this.props.children;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
const Xo = (e) => {
|
|
81
|
+
const t = e.replace(lt, "").split(",");
|
|
82
|
+
return { baseClasses: t[0], classes: t[1] };
|
|
83
|
+
};
|
|
84
|
+
let Yo = 0;
|
|
85
|
+
function Fe(e, t) {
|
|
86
|
+
const n = `atom${++Yo}`, s = {
|
|
87
|
+
toString: () => n
|
|
88
|
+
};
|
|
89
|
+
return typeof e == "function" ? s.read = e : (s.init = e, s.read = (r) => r(s), s.write = (r, o, i) => o(
|
|
90
|
+
s,
|
|
91
|
+
typeof i == "function" ? i(r(s)) : i
|
|
92
|
+
)), t && (s.write = t), s;
|
|
93
|
+
}
|
|
94
|
+
const Hs = (e) => "init" in e, Js = (e) => !!e.write, Bn = /* @__PURE__ */ new WeakMap(), Zo = (e, t) => {
|
|
95
|
+
Bn.set(e, t), e.catch(() => {
|
|
96
|
+
}).finally(() => Bn.delete(e));
|
|
97
|
+
}, Xs = (e, t) => {
|
|
98
|
+
const n = Bn.get(e);
|
|
99
|
+
n && (Bn.delete(e), n(t));
|
|
100
|
+
}, Ys = (e, t) => {
|
|
101
|
+
e.status = "fulfilled", e.value = t;
|
|
102
|
+
}, Zs = (e, t) => {
|
|
103
|
+
e.status = "rejected", e.reason = t;
|
|
104
|
+
}, ea = (e) => typeof (e == null ? void 0 : e.then) == "function", zt = (e, t) => "v" in e && "v" in t && Object.is(e.v, t.v), er = (e, t) => "e" in e && "e" in t && Object.is(e.e, t.e), gt = (e) => "v" in e && e.v instanceof Promise, ta = (e, t) => "v" in e && "v" in t && e.v.orig && e.v.orig === t.v.orig, xn = (e) => {
|
|
105
|
+
if ("e" in e)
|
|
106
|
+
throw e.e;
|
|
107
|
+
return e.v;
|
|
108
|
+
}, na = () => {
|
|
109
|
+
const e = /* @__PURE__ */ new WeakMap(), t = /* @__PURE__ */ new WeakMap(), n = /* @__PURE__ */ new Map();
|
|
110
|
+
let s, r, o;
|
|
111
|
+
const i = (p) => e.get(p), a = (p, v) => {
|
|
112
|
+
const I = e.get(p);
|
|
113
|
+
if (e.set(p, v), n.has(p) || n.set(p, I), I && gt(I)) {
|
|
114
|
+
const w = "v" in v ? v.v instanceof Promise ? v.v : Promise.resolve(v.v) : Promise.reject(v.e);
|
|
115
|
+
Xs(I.v, w);
|
|
116
|
+
}
|
|
117
|
+
}, d = (p, v, I) => {
|
|
118
|
+
const w = /* @__PURE__ */ new Map();
|
|
119
|
+
let j = !1;
|
|
120
|
+
I.forEach((E, S) => {
|
|
121
|
+
!E && S === p && (E = v), E && (w.set(S, E), v.d.get(S) !== E && (j = !0));
|
|
122
|
+
}), (j || v.d.size !== w.size) && (v.d = w);
|
|
123
|
+
}, u = (p, v, I) => {
|
|
124
|
+
const w = i(p), j = {
|
|
125
|
+
d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
|
|
126
|
+
v
|
|
127
|
+
};
|
|
128
|
+
if (I && d(p, j, I), w && zt(w, j) && w.d === j.d)
|
|
129
|
+
return w;
|
|
130
|
+
if (w && gt(w) && gt(j) && ta(w, j)) {
|
|
131
|
+
if (w.d === j.d)
|
|
132
|
+
return w;
|
|
133
|
+
j.v = w.v;
|
|
134
|
+
}
|
|
135
|
+
return a(p, j), j;
|
|
136
|
+
}, f = (p, v, I, w) => {
|
|
137
|
+
if (ea(v)) {
|
|
138
|
+
let j;
|
|
139
|
+
const E = new Promise((S, Q) => {
|
|
140
|
+
let $ = !1;
|
|
141
|
+
v.then(
|
|
142
|
+
(G) => {
|
|
143
|
+
if (!$) {
|
|
144
|
+
$ = !0;
|
|
145
|
+
const l = i(p), h = u(
|
|
146
|
+
p,
|
|
147
|
+
E,
|
|
148
|
+
I
|
|
149
|
+
);
|
|
150
|
+
Ys(E, G), S(G), (l == null ? void 0 : l.d) !== h.d && F(p, h, l == null ? void 0 : l.d);
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
(G) => {
|
|
154
|
+
if (!$) {
|
|
155
|
+
$ = !0;
|
|
156
|
+
const l = i(p), h = u(
|
|
157
|
+
p,
|
|
158
|
+
E,
|
|
159
|
+
I
|
|
160
|
+
);
|
|
161
|
+
Zs(E, G), Q(G), (l == null ? void 0 : l.d) !== h.d && F(p, h, l == null ? void 0 : l.d);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
), j = (G) => {
|
|
165
|
+
$ || ($ = !0, G.then(
|
|
166
|
+
(l) => Ys(E, l),
|
|
167
|
+
(l) => Zs(E, l)
|
|
168
|
+
), S(G));
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
return E.orig = v, E.status = "pending", Zo(E, (S) => {
|
|
172
|
+
S && j(S), w == null || w();
|
|
173
|
+
}), u(p, E, I);
|
|
174
|
+
}
|
|
175
|
+
return u(p, v, I);
|
|
176
|
+
}, m = (p, v, I) => {
|
|
177
|
+
const w = i(p), j = {
|
|
178
|
+
d: (w == null ? void 0 : w.d) || /* @__PURE__ */ new Map(),
|
|
179
|
+
e: v
|
|
180
|
+
};
|
|
181
|
+
return I && d(p, j, I), w && er(w, j) && w.d === j.d ? w : (a(p, j), j);
|
|
182
|
+
}, b = (p) => {
|
|
183
|
+
const v = i(p);
|
|
184
|
+
if (v && (v.d.forEach(($, G) => {
|
|
185
|
+
G !== p && !t.has(G) && b(G);
|
|
186
|
+
}), Array.from(v.d).every(([$, G]) => {
|
|
187
|
+
const l = i($);
|
|
188
|
+
return $ === p || l === G || // TODO This is a hack, we should find a better solution.
|
|
189
|
+
l && !gt(l) && zt(l, G);
|
|
190
|
+
})))
|
|
191
|
+
return v;
|
|
192
|
+
const I = /* @__PURE__ */ new Map();
|
|
193
|
+
let w = !0;
|
|
194
|
+
const j = ($) => {
|
|
195
|
+
if ($ === p) {
|
|
196
|
+
const l = i($);
|
|
197
|
+
if (l)
|
|
198
|
+
return I.set($, l), xn(l);
|
|
199
|
+
if (Hs($))
|
|
200
|
+
return I.set($, void 0), $.init;
|
|
201
|
+
throw new Error("no atom init");
|
|
202
|
+
}
|
|
203
|
+
const G = b($);
|
|
204
|
+
return I.set($, G), xn(G);
|
|
205
|
+
};
|
|
206
|
+
let E, S;
|
|
207
|
+
const Q = {
|
|
208
|
+
get signal() {
|
|
209
|
+
return E || (E = new AbortController()), E.signal;
|
|
210
|
+
},
|
|
211
|
+
get setSelf() {
|
|
212
|
+
return !S && Js(p) && (S = (...$) => {
|
|
213
|
+
if (!w)
|
|
214
|
+
return B(p, ...$);
|
|
215
|
+
}), S;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
try {
|
|
219
|
+
const $ = p.read(j, Q);
|
|
220
|
+
return f(
|
|
221
|
+
p,
|
|
222
|
+
$,
|
|
223
|
+
I,
|
|
224
|
+
() => E == null ? void 0 : E.abort()
|
|
225
|
+
);
|
|
226
|
+
} catch ($) {
|
|
227
|
+
return m(p, $, I);
|
|
228
|
+
} finally {
|
|
229
|
+
w = !1;
|
|
230
|
+
}
|
|
231
|
+
}, g = (p) => xn(b(p)), O = (p) => {
|
|
232
|
+
let v = t.get(p);
|
|
233
|
+
return v || (v = x(p)), v;
|
|
234
|
+
}, C = (p, v) => !v.l.size && (!v.t.size || v.t.size === 1 && v.t.has(p)), y = (p) => {
|
|
235
|
+
const v = t.get(p);
|
|
236
|
+
v && C(p, v) && k(p);
|
|
237
|
+
}, A = (p) => {
|
|
238
|
+
const v = /* @__PURE__ */ new Map(), I = /* @__PURE__ */ new WeakMap(), w = (E) => {
|
|
239
|
+
const S = t.get(E);
|
|
240
|
+
S == null || S.t.forEach((Q) => {
|
|
241
|
+
Q !== E && (v.set(
|
|
242
|
+
Q,
|
|
243
|
+
(v.get(Q) || /* @__PURE__ */ new Set()).add(E)
|
|
244
|
+
), I.set(Q, (I.get(Q) || 0) + 1), w(Q));
|
|
245
|
+
});
|
|
246
|
+
};
|
|
247
|
+
w(p);
|
|
248
|
+
const j = (E) => {
|
|
249
|
+
const S = t.get(E);
|
|
250
|
+
S == null || S.t.forEach((Q) => {
|
|
251
|
+
var $;
|
|
252
|
+
if (Q !== E) {
|
|
253
|
+
let G = I.get(Q);
|
|
254
|
+
if (G && I.set(Q, --G), !G) {
|
|
255
|
+
let l = !!(($ = v.get(Q)) != null && $.size);
|
|
256
|
+
if (l) {
|
|
257
|
+
const h = i(Q), M = b(Q);
|
|
258
|
+
l = !h || !zt(h, M);
|
|
259
|
+
}
|
|
260
|
+
l || v.forEach((h) => h.delete(Q));
|
|
261
|
+
}
|
|
262
|
+
j(Q);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
};
|
|
266
|
+
j(p);
|
|
267
|
+
}, D = (p, ...v) => {
|
|
268
|
+
let I = !0;
|
|
269
|
+
const w = (S) => xn(b(S)), j = (S, ...Q) => {
|
|
270
|
+
let $;
|
|
271
|
+
if (S === p) {
|
|
272
|
+
if (!Hs(S))
|
|
273
|
+
throw new Error("atom not writable");
|
|
274
|
+
const G = i(S), l = f(S, Q[0]);
|
|
275
|
+
(!G || !zt(G, l)) && A(S);
|
|
276
|
+
} else
|
|
277
|
+
$ = D(S, ...Q);
|
|
278
|
+
if (!I) {
|
|
279
|
+
const G = T();
|
|
280
|
+
}
|
|
281
|
+
return $;
|
|
282
|
+
}, E = p.write(w, j, ...v);
|
|
283
|
+
return I = !1, E;
|
|
284
|
+
}, B = (p, ...v) => {
|
|
285
|
+
const I = D(p, ...v), w = T();
|
|
286
|
+
return I;
|
|
287
|
+
}, x = (p, v) => {
|
|
288
|
+
const I = {
|
|
289
|
+
t: new Set(v && [v]),
|
|
290
|
+
l: /* @__PURE__ */ new Set()
|
|
291
|
+
};
|
|
292
|
+
if (t.set(p, I), b(p).d.forEach((w, j) => {
|
|
293
|
+
const E = t.get(j);
|
|
294
|
+
E ? E.t.add(p) : j !== p && x(j, p);
|
|
295
|
+
}), b(p), Js(p) && p.onMount) {
|
|
296
|
+
const w = p.onMount((...j) => B(p, ...j));
|
|
297
|
+
w && (I.u = w);
|
|
298
|
+
}
|
|
299
|
+
return I;
|
|
300
|
+
}, k = (p) => {
|
|
301
|
+
var v;
|
|
302
|
+
const I = (v = t.get(p)) == null ? void 0 : v.u;
|
|
303
|
+
I && I(), t.delete(p);
|
|
304
|
+
const w = i(p);
|
|
305
|
+
w && (gt(w) && Xs(w.v), w.d.forEach((j, E) => {
|
|
306
|
+
if (E !== p) {
|
|
307
|
+
const S = t.get(E);
|
|
308
|
+
S && (S.t.delete(p), C(E, S) && k(E));
|
|
309
|
+
}
|
|
310
|
+
}));
|
|
311
|
+
}, F = (p, v, I) => {
|
|
312
|
+
const w = new Set(v.d.keys());
|
|
313
|
+
I == null || I.forEach((j, E) => {
|
|
314
|
+
if (w.has(E)) {
|
|
315
|
+
w.delete(E);
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
const S = t.get(E);
|
|
319
|
+
S && (S.t.delete(p), C(E, S) && k(E));
|
|
320
|
+
}), w.forEach((j) => {
|
|
321
|
+
const E = t.get(j);
|
|
322
|
+
E ? E.t.add(p) : t.has(p) && x(j, p);
|
|
323
|
+
});
|
|
324
|
+
}, T = () => {
|
|
325
|
+
let p;
|
|
326
|
+
for (; n.size; ) {
|
|
327
|
+
const v = Array.from(n);
|
|
328
|
+
n.clear(), v.forEach(([I, w]) => {
|
|
329
|
+
const j = i(I);
|
|
330
|
+
if (j) {
|
|
331
|
+
j.d !== (w == null ? void 0 : w.d) && F(I, j, w == null ? void 0 : w.d);
|
|
332
|
+
const E = t.get(I);
|
|
333
|
+
E && !// TODO This seems pretty hacky. Hope to fix it.
|
|
334
|
+
// Maybe we could `mountDependencies` in `setAtomState`?
|
|
335
|
+
(w && !gt(w) && (zt(w, j) || er(w, j))) && E.l.forEach((S) => S());
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
return {
|
|
341
|
+
get: g,
|
|
342
|
+
set: B,
|
|
343
|
+
sub: (p, v) => {
|
|
344
|
+
const I = O(p), w = T(), j = I.l;
|
|
345
|
+
return j.add(v), () => {
|
|
346
|
+
j.delete(v), y(p);
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
};
|
|
351
|
+
let es;
|
|
352
|
+
const sa = () => (es || (es = na()), es), ra = Symbol();
|
|
353
|
+
function ia(e, t) {
|
|
354
|
+
const n = Fe(
|
|
355
|
+
e,
|
|
356
|
+
(s, r, o) => r(n, t(s(n), o))
|
|
357
|
+
);
|
|
358
|
+
return n;
|
|
359
|
+
}
|
|
360
|
+
const tr = (e, t, n) => (t.has(n) ? t : t.set(n, e())).get(n), oa = /* @__PURE__ */ new WeakMap(), aa = (e, t, n) => {
|
|
361
|
+
const s = tr(() => /* @__PURE__ */ new WeakMap(), oa, t);
|
|
362
|
+
return tr(e, s, n);
|
|
363
|
+
}, ca = {}, nr = (e) => !!e.write, ua = (e) => typeof e == "function";
|
|
364
|
+
function la(e, t) {
|
|
365
|
+
return aa(
|
|
366
|
+
() => {
|
|
367
|
+
const n = /* @__PURE__ */ new WeakMap(), s = (i, a) => {
|
|
368
|
+
let d = n.get(i);
|
|
369
|
+
if (d)
|
|
370
|
+
return d;
|
|
371
|
+
const u = a && n.get(a), f = [], m = [];
|
|
372
|
+
return i.forEach((b, g) => {
|
|
373
|
+
const O = t ? t(b) : g;
|
|
374
|
+
m[g] = O;
|
|
375
|
+
const C = u && u.atomList[u.keyList.indexOf(O)];
|
|
376
|
+
if (C) {
|
|
377
|
+
f[g] = C;
|
|
378
|
+
return;
|
|
379
|
+
}
|
|
380
|
+
const y = (D) => {
|
|
381
|
+
const B = D(r), x = D(e), F = s(x, B == null ? void 0 : B.arr).keyList.indexOf(O);
|
|
382
|
+
if (F < 0 || F >= x.length) {
|
|
383
|
+
const T = i[s(i).keyList.indexOf(O)];
|
|
384
|
+
if (T)
|
|
385
|
+
return T;
|
|
386
|
+
throw new Error("splitAtom: index out of bounds for read");
|
|
387
|
+
}
|
|
388
|
+
return x[F];
|
|
389
|
+
}, A = (D, B, x) => {
|
|
390
|
+
const k = D(r), F = D(e), R = s(F, k == null ? void 0 : k.arr).keyList.indexOf(O);
|
|
391
|
+
if (R < 0 || R >= F.length)
|
|
392
|
+
throw new Error("splitAtom: index out of bounds for write");
|
|
393
|
+
const p = ua(x) ? x(F[R]) : x;
|
|
394
|
+
B(e, [
|
|
395
|
+
...F.slice(0, R),
|
|
396
|
+
p,
|
|
397
|
+
...F.slice(R + 1)
|
|
398
|
+
]);
|
|
399
|
+
};
|
|
400
|
+
f[g] = nr(e) ? Fe(y, A) : Fe(y);
|
|
401
|
+
}), u && u.keyList.length === m.length && u.keyList.every((b, g) => b === m[g]) ? d = u : d = { arr: i, atomList: f, keyList: m }, n.set(i, d), d;
|
|
402
|
+
}, r = Fe((i) => {
|
|
403
|
+
const a = i(r), d = i(e);
|
|
404
|
+
return s(d, a == null ? void 0 : a.arr);
|
|
405
|
+
});
|
|
406
|
+
r.init = void 0;
|
|
407
|
+
const o = nr(e) ? Fe(
|
|
408
|
+
(i) => i(r).atomList,
|
|
409
|
+
(i, a, d) => {
|
|
410
|
+
switch (d.type) {
|
|
411
|
+
case "remove": {
|
|
412
|
+
const u = i(o).indexOf(d.atom);
|
|
413
|
+
if (u >= 0) {
|
|
414
|
+
const f = i(e);
|
|
415
|
+
a(e, [
|
|
416
|
+
...f.slice(0, u),
|
|
417
|
+
...f.slice(u + 1)
|
|
418
|
+
]);
|
|
419
|
+
}
|
|
420
|
+
break;
|
|
421
|
+
}
|
|
422
|
+
case "insert": {
|
|
423
|
+
const u = d.before ? i(o).indexOf(d.before) : i(o).length;
|
|
424
|
+
if (u >= 0) {
|
|
425
|
+
const f = i(e);
|
|
426
|
+
a(e, [
|
|
427
|
+
...f.slice(0, u),
|
|
428
|
+
d.value,
|
|
429
|
+
...f.slice(u)
|
|
430
|
+
]);
|
|
431
|
+
}
|
|
432
|
+
break;
|
|
433
|
+
}
|
|
434
|
+
case "move": {
|
|
435
|
+
const u = i(o).indexOf(d.atom), f = d.before ? i(o).indexOf(d.before) : i(o).length;
|
|
436
|
+
if (u >= 0 && f >= 0) {
|
|
437
|
+
const m = i(e);
|
|
438
|
+
u < f ? a(e, [
|
|
439
|
+
...m.slice(0, u),
|
|
440
|
+
...m.slice(u + 1, f),
|
|
441
|
+
m[u],
|
|
442
|
+
...m.slice(f)
|
|
443
|
+
]) : a(e, [
|
|
444
|
+
...m.slice(0, f),
|
|
445
|
+
m[u],
|
|
446
|
+
...m.slice(f, u),
|
|
447
|
+
...m.slice(u + 1)
|
|
448
|
+
]);
|
|
449
|
+
}
|
|
450
|
+
break;
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
) : Fe((i) => i(r).atomList);
|
|
455
|
+
return o;
|
|
456
|
+
},
|
|
457
|
+
e,
|
|
458
|
+
t || ca
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
const da = (e) => typeof (e == null ? void 0 : e.then) == "function";
|
|
462
|
+
function fa(e) {
|
|
463
|
+
let t, n;
|
|
464
|
+
const s = {
|
|
465
|
+
getItem: (r, o) => {
|
|
466
|
+
var i, a;
|
|
467
|
+
const d = (f) => {
|
|
468
|
+
if (f = f || "", t !== f) {
|
|
469
|
+
try {
|
|
470
|
+
n = JSON.parse(f);
|
|
471
|
+
} catch {
|
|
472
|
+
return o;
|
|
473
|
+
}
|
|
474
|
+
t = f;
|
|
475
|
+
}
|
|
476
|
+
return n;
|
|
477
|
+
}, u = (a = (i = e()) == null ? void 0 : i.getItem(r)) != null ? a : null;
|
|
478
|
+
return da(u) ? u.then(d) : d(u);
|
|
479
|
+
},
|
|
480
|
+
setItem: (r, o) => {
|
|
481
|
+
var i;
|
|
482
|
+
return (i = e()) == null ? void 0 : i.setItem(r, JSON.stringify(o));
|
|
483
|
+
},
|
|
484
|
+
removeItem: (r) => {
|
|
485
|
+
var o;
|
|
486
|
+
return (o = e()) == null ? void 0 : o.removeItem(r);
|
|
487
|
+
}
|
|
488
|
+
};
|
|
489
|
+
return typeof window < "u" && typeof window.addEventListener == "function" && (s.subscribe = (r, o, i) => {
|
|
490
|
+
if (!(e() instanceof window.Storage))
|
|
491
|
+
return () => {
|
|
492
|
+
};
|
|
493
|
+
const a = (d) => {
|
|
494
|
+
if (d.storageArea === e() && d.key === r) {
|
|
495
|
+
let u;
|
|
496
|
+
try {
|
|
497
|
+
u = JSON.parse(d.newValue || "");
|
|
498
|
+
} catch {
|
|
499
|
+
u = i;
|
|
500
|
+
}
|
|
501
|
+
o(u);
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
return window.addEventListener("storage", a), () => {
|
|
505
|
+
window.removeEventListener("storage", a);
|
|
506
|
+
};
|
|
507
|
+
}), s;
|
|
508
|
+
}
|
|
509
|
+
const ha = fa(
|
|
510
|
+
() => typeof window < "u" ? window.localStorage : void 0
|
|
511
|
+
);
|
|
512
|
+
function pt(e, t, n = ha, s) {
|
|
513
|
+
const r = s == null ? void 0 : s.unstable_getOnInit, o = Fe(
|
|
514
|
+
r ? n.getItem(e, t) : t
|
|
515
|
+
);
|
|
516
|
+
return o.onMount = (a) => {
|
|
517
|
+
r || a(n.getItem(e, t));
|
|
518
|
+
let d;
|
|
519
|
+
return n.subscribe && (d = n.subscribe(e, a, t)), d;
|
|
520
|
+
}, Fe(
|
|
521
|
+
(a) => a(o),
|
|
522
|
+
(a, d, u) => {
|
|
523
|
+
const f = typeof u == "function" ? u(a(o)) : u;
|
|
524
|
+
return f === ra ? (d(o, t), n.removeItem(e)) : f instanceof Promise ? f.then((m) => (d(o, m), n.setItem(e, m))) : (d(o, f), n.setItem(e, f));
|
|
525
|
+
}
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
const pa = go(void 0), ri = (e) => {
|
|
529
|
+
const t = bo(pa);
|
|
530
|
+
return (e == null ? void 0 : e.store) || t || sa();
|
|
531
|
+
}, ma = (e) => typeof (e == null ? void 0 : e.then) == "function", ga = Es.use || ((e) => {
|
|
532
|
+
if (e.status === "pending")
|
|
533
|
+
throw e;
|
|
534
|
+
if (e.status === "fulfilled")
|
|
535
|
+
return e.value;
|
|
536
|
+
throw e.status === "rejected" ? e.reason : (e.status = "pending", e.then(
|
|
537
|
+
(t) => {
|
|
538
|
+
e.status = "fulfilled", e.value = t;
|
|
539
|
+
},
|
|
540
|
+
(t) => {
|
|
541
|
+
e.status = "rejected", e.reason = t;
|
|
542
|
+
}
|
|
543
|
+
), e);
|
|
544
|
+
});
|
|
545
|
+
function ya(e, t) {
|
|
546
|
+
const n = ri(t), [[s, r, o], i] = yo(
|
|
547
|
+
(u) => {
|
|
548
|
+
const f = n.get(e);
|
|
549
|
+
return Object.is(u[0], f) && u[1] === n && u[2] === e ? u : [f, n, e];
|
|
550
|
+
},
|
|
551
|
+
void 0,
|
|
552
|
+
() => [n.get(e), n, e]
|
|
553
|
+
);
|
|
554
|
+
let a = s;
|
|
555
|
+
(r !== n || o !== e) && (i(), a = n.get(e));
|
|
556
|
+
const d = t == null ? void 0 : t.delay;
|
|
557
|
+
return ke(() => {
|
|
558
|
+
const u = n.sub(e, () => {
|
|
559
|
+
if (typeof d == "number") {
|
|
560
|
+
setTimeout(i, d);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
i();
|
|
564
|
+
});
|
|
565
|
+
return i(), u;
|
|
566
|
+
}, [n, e, d]), vo(a), ma(a) ? ga(a) : a;
|
|
567
|
+
}
|
|
568
|
+
function va(e, t) {
|
|
569
|
+
const n = ri(t);
|
|
570
|
+
return X(
|
|
571
|
+
(...r) => n.set(e, ...r),
|
|
572
|
+
[n, e]
|
|
573
|
+
);
|
|
574
|
+
}
|
|
575
|
+
function ba(e, t) {
|
|
576
|
+
return [
|
|
577
|
+
ya(e, t),
|
|
578
|
+
// We do wrong type assertion here, which results in throwing an error.
|
|
579
|
+
va(e, t)
|
|
580
|
+
];
|
|
581
|
+
}
|
|
582
|
+
const wa = new ni({ children: "blockNodes" }), ii = (e, t = null) => be(
|
|
583
|
+
e.map((n) => {
|
|
584
|
+
if (n = t !== null ? { ...n, parent: t } : n, n.children && n.children.length) {
|
|
585
|
+
const s = [...n.children];
|
|
586
|
+
return delete n.children, be([n, ...ii(s, n._id)]);
|
|
587
|
+
}
|
|
588
|
+
return n;
|
|
589
|
+
})
|
|
590
|
+
);
|
|
591
|
+
function oi(e, t, n) {
|
|
592
|
+
const s = te(e, (o) => o._parent === t), r = [];
|
|
593
|
+
for (let o = 0; o < s.length; o++) {
|
|
594
|
+
const i = ai(s[o]);
|
|
595
|
+
if (Object.keys(i).length > 0 && Object.keys(i).forEach((a) => {
|
|
596
|
+
s[o][a] = `slot:${He()}`;
|
|
597
|
+
}), te(e, { _parent: s[o]._id }).length > 0) {
|
|
598
|
+
const a = He();
|
|
599
|
+
r.push({ ...s[o], oldId: s[o]._id, _id: a, _parent: n }), r.push(be(oi(e, s[o]._id, a)));
|
|
600
|
+
} else
|
|
601
|
+
r.push({
|
|
602
|
+
...s[o],
|
|
603
|
+
oldId: s[o]._id,
|
|
604
|
+
_id: He(),
|
|
605
|
+
_parent: n
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
return be(r);
|
|
609
|
+
}
|
|
610
|
+
function Sa(e) {
|
|
611
|
+
let t = wa.convert(e.map((n) => Tn(n, ["settings"])));
|
|
612
|
+
return t = !t.type && t.blockNodes ? t.blockNodes : Me(t) ? [] : [t], t;
|
|
613
|
+
}
|
|
614
|
+
const ai = (e) => {
|
|
615
|
+
const t = {};
|
|
616
|
+
return Object.keys(e).forEach((n) => {
|
|
617
|
+
Ps(e[n]) && e[n].startsWith("slot") && (t[n] = e[n].replace("slot:", ""));
|
|
618
|
+
}), t;
|
|
619
|
+
}, xa = (e, t, n = null) => {
|
|
620
|
+
let s = Ae(e, { _id: t });
|
|
621
|
+
s = { ...s, oldId: s._id, _id: He() }, n && (s = { ...s, _parent: n });
|
|
622
|
+
const r = [s];
|
|
623
|
+
te(e, { _parent: t }).length > 0 && r.push(be(oi(e, t, s._id)));
|
|
624
|
+
const o = be(r);
|
|
625
|
+
return ue(o, (i) => {
|
|
626
|
+
const a = i, d = ai(a);
|
|
627
|
+
return Object.keys(d).length > 0 && Object.keys(d).forEach((u) => {
|
|
628
|
+
const f = Ae(o, { oldId: d[u].replace("slot:", "") });
|
|
629
|
+
a[u] = `slot:${f._id}`;
|
|
630
|
+
}), Tn(a, ["global", "oldId"]);
|
|
631
|
+
});
|
|
632
|
+
}, ka = Do(
|
|
633
|
+
// eslint-disable-next-line default-param-last
|
|
634
|
+
(e = [], t) => {
|
|
635
|
+
switch (t.type) {
|
|
636
|
+
case "add_new_blocks":
|
|
637
|
+
case "add_duplicate_blocks":
|
|
638
|
+
return [...e, ...t.payload];
|
|
639
|
+
case "create_snapshot":
|
|
640
|
+
return [...e];
|
|
641
|
+
case "set_blocks":
|
|
642
|
+
case "set_page_blocks":
|
|
643
|
+
return [...t.payload];
|
|
644
|
+
case "update_props":
|
|
645
|
+
case "update_props_realtime":
|
|
646
|
+
const { payload: n } = t;
|
|
647
|
+
return e.map((s) => (n.ids.includes(s._id) && !Me(t.payload.props) && Object.keys(t.payload.props).forEach((r) => {
|
|
648
|
+
ut(s, r, t.payload.props[r]);
|
|
649
|
+
}), s));
|
|
650
|
+
default:
|
|
651
|
+
return e;
|
|
652
|
+
}
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
debug: !1,
|
|
656
|
+
ignoreInitialState: !1,
|
|
657
|
+
limit: 30,
|
|
658
|
+
filter: Mo(["update_props_realtime", "add_duplicate_blocks", "set_page_blocks"])
|
|
659
|
+
}
|
|
660
|
+
), Fn = ia(
|
|
661
|
+
{
|
|
662
|
+
past: [],
|
|
663
|
+
present: [],
|
|
664
|
+
future: []
|
|
665
|
+
},
|
|
666
|
+
ka
|
|
667
|
+
);
|
|
668
|
+
Fn.debugLabel = "pageBlocksAtom";
|
|
669
|
+
const we = N((e) => {
|
|
670
|
+
var t;
|
|
671
|
+
return (t = e(Fn)) == null ? void 0 : t.present;
|
|
672
|
+
});
|
|
673
|
+
we.debugLabel = "presentBlocksAtom";
|
|
674
|
+
const _s = la(we);
|
|
675
|
+
_s.debugLabel = "pageBlocksAtomsAtom";
|
|
676
|
+
const ci = N((e) => Sa(e(we)));
|
|
677
|
+
ci.debugLabel = "pageBlocksTreeAtom";
|
|
678
|
+
const Aa = N("");
|
|
679
|
+
Aa.debugLabel = "builderActivePageAtom";
|
|
680
|
+
const Ea = N(-1);
|
|
681
|
+
Ea.debugLabel = "destinationDropIndexAtom";
|
|
682
|
+
const Pa = N(!1);
|
|
683
|
+
Pa.debugLabel = "addBlocksModalAtom";
|
|
684
|
+
const Se = () => {
|
|
685
|
+
const [, e] = Y(Fn);
|
|
686
|
+
return e;
|
|
687
|
+
}, rd = () => {
|
|
688
|
+
const e = Se(), t = ne(ci), n = X(
|
|
689
|
+
(s) => {
|
|
690
|
+
const r = ii(s);
|
|
691
|
+
e({ type: "set_page_blocks", payload: r });
|
|
692
|
+
},
|
|
693
|
+
[e]
|
|
694
|
+
);
|
|
695
|
+
return [t, n];
|
|
696
|
+
}, Oa = () => {
|
|
697
|
+
const e = Se();
|
|
698
|
+
return [X(
|
|
699
|
+
(n) => {
|
|
700
|
+
e({ type: "set_page_blocks", payload: n });
|
|
701
|
+
},
|
|
702
|
+
[e]
|
|
703
|
+
)];
|
|
704
|
+
}, us = (e) => ["Box", "Slot", "Form", "DataContext", "Link", "List", "ListItem", "Row", "Column", "Table", "TableCell"].includes(
|
|
705
|
+
e
|
|
706
|
+
), id = (e) => !["Slot"].includes(e), od = (e) => !["Slot"].includes(e);
|
|
707
|
+
function _a(e, t) {
|
|
708
|
+
return e === "Slot" || t === "List" && e !== "ListItem" || t === "Row" && e !== "Column" ? !1 : us(t);
|
|
709
|
+
}
|
|
710
|
+
const ad = (e, { dragSource: t, dropTarget: n }) => {
|
|
711
|
+
const s = ee(t, "data._type", ""), r = ee(n, "data._type", "");
|
|
712
|
+
return s === "Slot" || ee(t, "id") && ee(t, "id") === ee(n, "id") ? !1 : Me(r) ? !0 : _a(s, r);
|
|
713
|
+
}, ui = N([]);
|
|
714
|
+
ui.debugLabel = "buildingBlocksAtom";
|
|
715
|
+
const Ca = N((e) => {
|
|
716
|
+
const t = e(ui);
|
|
717
|
+
return te(t, (n) => Os(n, "blockId"));
|
|
718
|
+
}), Ia = () => {
|
|
719
|
+
}, li = () => {
|
|
720
|
+
const e = No(), t = ne(Ca), n = () => {
|
|
721
|
+
}, s = X(() => Ia(), []);
|
|
722
|
+
return [e, t, n, s];
|
|
723
|
+
}, Cs = N([]);
|
|
724
|
+
Cs.debugLabel = "selectedBlockIdsAtom";
|
|
725
|
+
const Is = N((e) => {
|
|
726
|
+
const t = e(we), n = e(Cs);
|
|
727
|
+
return ue(
|
|
728
|
+
te(t, ({ _id: s }) => de(n, s)),
|
|
729
|
+
(s) => ({ ...s })
|
|
730
|
+
);
|
|
731
|
+
});
|
|
732
|
+
Is.debugLabel = "selectedBlocksAtom";
|
|
733
|
+
const js = N((e) => {
|
|
734
|
+
const t = e(Is);
|
|
735
|
+
return t.length === 0 ? null : t.length === 1 ? t[0] : {
|
|
736
|
+
type: "Multiple",
|
|
737
|
+
id: ue(t, "id")
|
|
738
|
+
};
|
|
739
|
+
});
|
|
740
|
+
js.debugLabel = "selectedBlockAtom";
|
|
741
|
+
const ja = (e) => ee(e, "parent", null), Ba = N((e) => {
|
|
742
|
+
const t = e(Is), n = ue(t, ja);
|
|
743
|
+
return te(e(we), (s) => de(n, s._id));
|
|
744
|
+
});
|
|
745
|
+
Ba.debugLabel = "selectedBlocksParentsAtom";
|
|
746
|
+
const di = N(() => !1);
|
|
747
|
+
di.debugLabel = "selectedBlockFlexChildAtom";
|
|
748
|
+
const fi = N(() => !1);
|
|
749
|
+
fi.debugLabel = "selectedBlockGridChildAtom";
|
|
750
|
+
const Bs = N("");
|
|
751
|
+
Bs.debugLabel = "styleStateAtom";
|
|
752
|
+
const hi = pt("styleBreakpoint", "xs");
|
|
753
|
+
hi.debugLabel = "styleBreakpointAtom";
|
|
754
|
+
const cd = () => ({
|
|
755
|
+
flexChild: ne(di),
|
|
756
|
+
gridChild: ne(fi)
|
|
757
|
+
}), ud = () => ne(js), mt = () => {
|
|
758
|
+
const [e, t] = Y(Cs), n = X(
|
|
759
|
+
(s) => {
|
|
760
|
+
t((r) => de(r, s) ? Yr(r, s) : [...r, s]);
|
|
761
|
+
},
|
|
762
|
+
[t]
|
|
763
|
+
);
|
|
764
|
+
return [e, t, n];
|
|
765
|
+
}, sr = (e, t = "") => {
|
|
766
|
+
switch (e.type) {
|
|
767
|
+
case "singular":
|
|
768
|
+
return e.uiSchema;
|
|
769
|
+
case "model":
|
|
770
|
+
const { properties: n } = e, s = {};
|
|
771
|
+
return Object.keys(n).forEach((i) => {
|
|
772
|
+
const a = n[i];
|
|
773
|
+
if (de(["slot", "styles"], a.type))
|
|
774
|
+
return;
|
|
775
|
+
const d = ee(a, "i18n", !1) ? `${i}-${t}` : i;
|
|
776
|
+
s[d] = sr(a, t);
|
|
777
|
+
}), s;
|
|
778
|
+
case "list":
|
|
779
|
+
const { itemProperties: r } = e, o = {
|
|
780
|
+
items: {}
|
|
781
|
+
};
|
|
782
|
+
return Object.keys(r).forEach((i) => {
|
|
783
|
+
const a = r[i];
|
|
784
|
+
if (de(["slot", "styles"], a.type))
|
|
785
|
+
return;
|
|
786
|
+
const d = ee(a, "i18n", !1) ? `${i}-${t}` : i;
|
|
787
|
+
o.items[d] = sr(a, t);
|
|
788
|
+
}), o;
|
|
789
|
+
default:
|
|
790
|
+
return {};
|
|
791
|
+
}
|
|
792
|
+
}, rr = (e, t = "") => {
|
|
793
|
+
switch (e.type) {
|
|
794
|
+
case "singular":
|
|
795
|
+
return e.schema;
|
|
796
|
+
case "model":
|
|
797
|
+
const { properties: n, title: s } = e, r = {
|
|
798
|
+
title: s,
|
|
799
|
+
type: "object",
|
|
800
|
+
properties: {}
|
|
801
|
+
};
|
|
802
|
+
return Object.keys(n).forEach((d) => {
|
|
803
|
+
const u = n[d];
|
|
804
|
+
if (de(["slot", "styles"], u.type))
|
|
805
|
+
return;
|
|
806
|
+
const f = ee(u, "i18n", !1) ? `${d}-${t}` : d;
|
|
807
|
+
r.properties[f] = rr(u, t);
|
|
808
|
+
}), r;
|
|
809
|
+
case "list":
|
|
810
|
+
const { itemProperties: o, title: i } = e, a = {
|
|
811
|
+
title: i,
|
|
812
|
+
type: "array",
|
|
813
|
+
items: {
|
|
814
|
+
type: "object",
|
|
815
|
+
properties: {}
|
|
816
|
+
}
|
|
817
|
+
};
|
|
818
|
+
return Object.keys(o).forEach((d) => {
|
|
819
|
+
const u = o[d];
|
|
820
|
+
if (de(["slot", "styles"], u.type))
|
|
821
|
+
return;
|
|
822
|
+
const f = ee(u, "i18n", !1) ? `${d}-${t}` : d;
|
|
823
|
+
a.items.properties[f] = rr(u, t), ut(a.items, "title", ee(u, "itemTitle", `${i} item`));
|
|
824
|
+
}), a;
|
|
825
|
+
default:
|
|
826
|
+
return {};
|
|
827
|
+
}
|
|
828
|
+
}, pi = (e) => {
|
|
829
|
+
const t = {};
|
|
830
|
+
return Object.keys(e).forEach((n) => {
|
|
831
|
+
t[n] = Da(e[n]);
|
|
832
|
+
}), t;
|
|
833
|
+
}, Ra = (e) => {
|
|
834
|
+
if (Me(e.default))
|
|
835
|
+
return [];
|
|
836
|
+
const { itemProperties: t } = e;
|
|
837
|
+
return ue(e.default, (n) => {
|
|
838
|
+
const s = { ...n };
|
|
839
|
+
return Zr(n, (r, o) => {
|
|
840
|
+
Os(t, o) && ee(t[o], "i18n", !1) && (s[o] = si);
|
|
841
|
+
}), s;
|
|
842
|
+
});
|
|
843
|
+
}, Da = (e) => {
|
|
844
|
+
switch (e.type) {
|
|
845
|
+
case "styles":
|
|
846
|
+
return e.default;
|
|
847
|
+
case "slot":
|
|
848
|
+
return `${cs}${He()}`;
|
|
849
|
+
case "singular":
|
|
850
|
+
const { i18n: t, schema: n } = e;
|
|
851
|
+
return t ? si : ee(n, "default", "");
|
|
852
|
+
case "model":
|
|
853
|
+
return pi(e.properties);
|
|
854
|
+
case "list":
|
|
855
|
+
return Ra(e);
|
|
856
|
+
default:
|
|
857
|
+
return "";
|
|
858
|
+
}
|
|
859
|
+
}, Ma = () => ne(we);
|
|
860
|
+
function ir(e, t, n, s, r) {
|
|
861
|
+
if (t === null)
|
|
862
|
+
return [...e, ...s];
|
|
863
|
+
if (n !== null) {
|
|
864
|
+
const d = Sn(e, { _parent: t }), u = (d === -1 ? 0 : d) + n;
|
|
865
|
+
return e.splice(u, 0, ...s), e;
|
|
866
|
+
}
|
|
867
|
+
if (!r) {
|
|
868
|
+
const u = Sn(e, { _id: t }) + 1;
|
|
869
|
+
return e.splice(u, 0, ...s), e;
|
|
870
|
+
}
|
|
871
|
+
let o = Sn(e, { _id: t });
|
|
872
|
+
const i = te(e, { _parent: t });
|
|
873
|
+
Me(i) || (o = Sn(e, { _id: ko(i)._id }));
|
|
874
|
+
const a = o + 1;
|
|
875
|
+
return e.splice(a, 0, ...s), e;
|
|
876
|
+
}
|
|
877
|
+
const ld = () => {
|
|
878
|
+
const e = Se(), t = Ma(), [, n] = li(), [, s] = mt(), r = X(
|
|
879
|
+
(i, a, d) => {
|
|
880
|
+
if (Os(i, "blocks")) {
|
|
881
|
+
const y = i.blocks;
|
|
882
|
+
return o(y, a, d);
|
|
883
|
+
}
|
|
884
|
+
const u = He(), f = pi(i.props), m = [];
|
|
885
|
+
Zr(f, (y, A) => {
|
|
886
|
+
if (ei(y, cs)) {
|
|
887
|
+
const D = y.replace(cs, "");
|
|
888
|
+
m.push({
|
|
889
|
+
_id: D,
|
|
890
|
+
_type: "Slot",
|
|
891
|
+
_parent: u,
|
|
892
|
+
_name: i.props[A].name,
|
|
893
|
+
_styles: i.props[A].styles,
|
|
894
|
+
_emptyStyles: i.props[A].emptyStyles
|
|
895
|
+
});
|
|
896
|
+
}
|
|
897
|
+
});
|
|
898
|
+
const b = {
|
|
899
|
+
_type: i.type,
|
|
900
|
+
_id: u,
|
|
901
|
+
...f
|
|
902
|
+
};
|
|
903
|
+
let g;
|
|
904
|
+
a && (g = Ae(t, { _id: a }), b._parent = a);
|
|
905
|
+
const O = g ? us(g._type) : !0;
|
|
906
|
+
!O && g && (b._parent = g._parent);
|
|
907
|
+
const C = [b, ...m];
|
|
908
|
+
return e({
|
|
909
|
+
type: "set_blocks",
|
|
910
|
+
payload: ir(t, a || null, d || null, C, O)
|
|
911
|
+
}), s([b._id]), b;
|
|
912
|
+
},
|
|
913
|
+
[t, e, s]
|
|
914
|
+
), o = X(
|
|
915
|
+
(i, a, d) => {
|
|
916
|
+
var m;
|
|
917
|
+
for (let b = 0; b < i.length; b++) {
|
|
918
|
+
const { _id: g } = i[b];
|
|
919
|
+
i[b]._id = He();
|
|
920
|
+
const O = te(i, { _parent: g });
|
|
921
|
+
for (let C = 0; C < O.length; C++)
|
|
922
|
+
O[C]._parent = i[b]._id;
|
|
923
|
+
}
|
|
924
|
+
let u;
|
|
925
|
+
a && (u = Ae(t, { _id: a }), i[0]._parent = a);
|
|
926
|
+
const f = u ? us(u._type) : !0;
|
|
927
|
+
return !f && u && (i[0]._parent = u._parent), e({
|
|
928
|
+
type: "set_blocks",
|
|
929
|
+
payload: ir(t, a || null, d || null, i, f)
|
|
930
|
+
}), s([(m = Be(i)) == null ? void 0 : m._id]), Be(i);
|
|
931
|
+
},
|
|
932
|
+
[t, e, s, n]
|
|
933
|
+
);
|
|
934
|
+
return { addCoreBlock: r, addPredefinedBlock: o };
|
|
935
|
+
}, or = {
|
|
936
|
+
xs: 420,
|
|
937
|
+
sm: 620,
|
|
938
|
+
md: 768,
|
|
939
|
+
lg: 1024,
|
|
940
|
+
xl: 1280,
|
|
941
|
+
"2xl": 1536
|
|
942
|
+
}, ar = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
943
|
+
function La(e, t) {
|
|
944
|
+
if (t === null)
|
|
945
|
+
return "baseClasses";
|
|
946
|
+
const n = t.mq;
|
|
947
|
+
if (n === "xs" || t.dark || t.mod !== "")
|
|
948
|
+
return "classes";
|
|
949
|
+
let s = "baseClasses", r = ar.indexOf(n);
|
|
950
|
+
for (; r > 0; ) {
|
|
951
|
+
const o = ar[r - 1];
|
|
952
|
+
if (Ae(e, {
|
|
953
|
+
mq: o,
|
|
954
|
+
property: t.property
|
|
955
|
+
})) {
|
|
956
|
+
s = "classes";
|
|
957
|
+
break;
|
|
958
|
+
}
|
|
959
|
+
r--;
|
|
960
|
+
}
|
|
961
|
+
return s;
|
|
962
|
+
}
|
|
963
|
+
const cr = [];
|
|
964
|
+
function Na(e = "", t = "", n = []) {
|
|
965
|
+
e = e.trim().replace(/ +/g, "");
|
|
966
|
+
let s = te(
|
|
967
|
+
ue(e.split(" "), Cn),
|
|
968
|
+
(u) => !os(u)
|
|
969
|
+
), r = te(ue(t.split(" "), Cn), (u) => !os(u));
|
|
970
|
+
r = te(
|
|
971
|
+
r,
|
|
972
|
+
(u) => !de(cr, u.property)
|
|
973
|
+
);
|
|
974
|
+
const o = [], i = [];
|
|
975
|
+
We(n, (u) => {
|
|
976
|
+
const f = Cn(u), m = Ae(s, Gs(f, ["dark", "mq", "mod", "property"]));
|
|
977
|
+
if (m && (s = te(
|
|
978
|
+
s,
|
|
979
|
+
(b) => b.fullCls !== (m == null ? void 0 : m.fullCls)
|
|
980
|
+
)), o.push(f), f.mq === "xs" && !f.dark && f.mod === "" && (r = te(r, (b) => b.property !== f.property)), La(s, f) === "baseClasses" && !de(cr, f.property)) {
|
|
981
|
+
const b = Ae(r, Gs(f, ["property"]));
|
|
982
|
+
m && (r = te(
|
|
983
|
+
r,
|
|
984
|
+
(g) => g.fullCls !== (b == null ? void 0 : b.fullCls)
|
|
985
|
+
)), i.push({
|
|
986
|
+
...f,
|
|
987
|
+
fullCls: f.cls,
|
|
988
|
+
mq: "xs"
|
|
989
|
+
});
|
|
990
|
+
}
|
|
991
|
+
});
|
|
992
|
+
const a = ue(
|
|
993
|
+
Ws([...s, ...o], (u) => or[u.mq]),
|
|
994
|
+
"fullCls"
|
|
995
|
+
).join(" ");
|
|
996
|
+
return `${ue(
|
|
997
|
+
Ws([...r, ...i], (u) => or[u.mq]),
|
|
998
|
+
"fullCls"
|
|
999
|
+
).join(" ").trim()},${a.trim()}`.trim().replace(/ +/g, "");
|
|
1000
|
+
}
|
|
1001
|
+
const gn = N([]);
|
|
1002
|
+
gn.debugLabel = "selectedStylingBlocksAtom";
|
|
1003
|
+
const mi = () => Y(gn), Ta = (e) => {
|
|
1004
|
+
const t = e.replace(lt, "").split(",");
|
|
1005
|
+
return { baseClasses: t[0], classes: t[1] };
|
|
1006
|
+
}, Fa = N(null, (e, t, { blockIds: n, newClasses: s, dispatch: r }) => {
|
|
1007
|
+
const o = te(
|
|
1008
|
+
e(_s),
|
|
1009
|
+
(a) => (
|
|
1010
|
+
// @ts-ignore
|
|
1011
|
+
n.includes(e(a)._id)
|
|
1012
|
+
)
|
|
1013
|
+
), i = Be(e(gn));
|
|
1014
|
+
We(o, (a) => {
|
|
1015
|
+
const d = e(a), u = ee(d, i.prop, `${lt},`), { baseClasses: f, classes: m } = Ta(u);
|
|
1016
|
+
r({
|
|
1017
|
+
type: "update_props_realtime",
|
|
1018
|
+
payload: {
|
|
1019
|
+
ids: [d._id],
|
|
1020
|
+
props: { [i.prop]: `${lt}${Na(m, f, s)}` }
|
|
1021
|
+
}
|
|
1022
|
+
});
|
|
1023
|
+
});
|
|
1024
|
+
}), dd = () => {
|
|
1025
|
+
const e = Se(), t = Xe(Fa);
|
|
1026
|
+
return X(
|
|
1027
|
+
(n, s, r) => {
|
|
1028
|
+
t({ blockIds: n, newClasses: s, dispatch: e }), r && setTimeout(() => e({ type: "create_snapshot" }), 500);
|
|
1029
|
+
},
|
|
1030
|
+
[e, t]
|
|
1031
|
+
);
|
|
1032
|
+
}, Ua = N(!1), gi = () => {
|
|
1033
|
+
const [e, t] = Y(Ua);
|
|
1034
|
+
return [e, t];
|
|
1035
|
+
}, qa = N(as), yi = () => {
|
|
1036
|
+
const [e, t] = Y(qa);
|
|
1037
|
+
return [
|
|
1038
|
+
Ao(e) ? { ...e, ...as } : as,
|
|
1039
|
+
t
|
|
1040
|
+
];
|
|
1041
|
+
}, $a = N(null), Qa = () => ({ currentPage: ne($a) }), vi = new ni({});
|
|
1042
|
+
function Va(e) {
|
|
1043
|
+
let t = vi.convert(e);
|
|
1044
|
+
return t = !t.type && t.children && t.children.length ? t.children : Me(t) ? [] : [t], t;
|
|
1045
|
+
}
|
|
1046
|
+
const Rs = (e, t) => be(
|
|
1047
|
+
e.map((n) => {
|
|
1048
|
+
if (n = t ? { ...n, parent: t } : { ...n }, n.children) {
|
|
1049
|
+
const s = [...n.children];
|
|
1050
|
+
return delete n.children, be([n, ...Rs(s, n._id)]);
|
|
1051
|
+
}
|
|
1052
|
+
return n;
|
|
1053
|
+
})
|
|
1054
|
+
);
|
|
1055
|
+
function Ds(e, t = !1) {
|
|
1056
|
+
for (let n = 0; n < e.length; n++) {
|
|
1057
|
+
const s = e[n];
|
|
1058
|
+
s.global && !t ? e[n] = {
|
|
1059
|
+
type: "GlobalBlock",
|
|
1060
|
+
_parent: ee(s, "parent", null),
|
|
1061
|
+
blockId: s.blockId,
|
|
1062
|
+
_id: s._id
|
|
1063
|
+
} : s.children && s.children.length && Ds(s.children);
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
function bi(e) {
|
|
1067
|
+
let t = [], n = te(e, { type: "GlobalBlock" });
|
|
1068
|
+
return n.length > 0 && (n = ue(n, wi), We(n, (s) => {
|
|
1069
|
+
t = [...t, ...Ka(s)];
|
|
1070
|
+
})), t;
|
|
1071
|
+
}
|
|
1072
|
+
function Ka(e) {
|
|
1073
|
+
let t = [];
|
|
1074
|
+
const n = ee(Be(e), "parent", null);
|
|
1075
|
+
ut(Be(e), "parent", null);
|
|
1076
|
+
const s = [vi.convert(Si(e))];
|
|
1077
|
+
Ds(s, !0);
|
|
1078
|
+
let r = Rs(s, e[0]._id);
|
|
1079
|
+
return r = ut(r, "0.parent", n), t = [...t, r, ...bi(r)], t;
|
|
1080
|
+
}
|
|
1081
|
+
function wi(e) {
|
|
1082
|
+
const t = Ae(ls, { _id: e._id });
|
|
1083
|
+
if (!t)
|
|
1084
|
+
return [];
|
|
1085
|
+
const n = [t], s = te(ls, { _parent: e._id });
|
|
1086
|
+
return s.length ? be([...n, ...be(ue(s, wi))]) : be(n);
|
|
1087
|
+
}
|
|
1088
|
+
const Si = (e) => JSON.parse(JSON.stringify(e));
|
|
1089
|
+
let ls = [];
|
|
1090
|
+
function za(e) {
|
|
1091
|
+
ls = e;
|
|
1092
|
+
const t = Va(Si(e));
|
|
1093
|
+
Ds(t);
|
|
1094
|
+
const n = Rs(t, null), s = bi(n), r = {};
|
|
1095
|
+
return We(s, (o) => ut(r, Be(o).blockId, o)), [n, r];
|
|
1096
|
+
}
|
|
1097
|
+
const xi = () => {
|
|
1098
|
+
const [e] = yi(), { currentPage: t } = Qa(), n = ne(we);
|
|
1099
|
+
return X(() => {
|
|
1100
|
+
const s = ue(
|
|
1101
|
+
n,
|
|
1102
|
+
(i) => Tn(i, ["expanded", "order", "title", "siblings", "tempClasses"])
|
|
1103
|
+
), [r = [], o = []] = za(s);
|
|
1104
|
+
return {
|
|
1105
|
+
currentPage: t,
|
|
1106
|
+
blocks: r,
|
|
1107
|
+
globalBlocks: o
|
|
1108
|
+
};
|
|
1109
|
+
}, [e, t, n]);
|
|
1110
|
+
};
|
|
1111
|
+
pt("blockStylingActiveTab", 1);
|
|
1112
|
+
N([]);
|
|
1113
|
+
const ki = N(!1);
|
|
1114
|
+
ki.debugLabel = "readOnlyModeAtom";
|
|
1115
|
+
const Ga = N(!1);
|
|
1116
|
+
Ga.debugLabel = "inlineEditingActiveAtom";
|
|
1117
|
+
const Wa = N(!1);
|
|
1118
|
+
Wa.debugLabel = "advanceStylingOpenAtom";
|
|
1119
|
+
const Ha = N("online");
|
|
1120
|
+
Ha.debugLabel = "networkModeAtom";
|
|
1121
|
+
pt("currentUiLibrary", "");
|
|
1122
|
+
const Ja = N(!1);
|
|
1123
|
+
Ja.debugLabel = "codeEditorOpenAtom";
|
|
1124
|
+
const Xa = N(!1);
|
|
1125
|
+
Xa.debugLabel = "editLayerNameAtom";
|
|
1126
|
+
const Ya = N("");
|
|
1127
|
+
Ya.debugLabel = "activeLanguageAtom";
|
|
1128
|
+
const Za = N("");
|
|
1129
|
+
Za.debugLabel = "primaryLanguageAtom";
|
|
1130
|
+
const ec = N(null);
|
|
1131
|
+
ec.debugLabel = "canvasIframeAtom";
|
|
1132
|
+
const tc = N("layers");
|
|
1133
|
+
tc.debugLabel = "activePanelAtom";
|
|
1134
|
+
const nc = N(!1);
|
|
1135
|
+
nc.debugLabel = "addBlockOffCanvasAtom";
|
|
1136
|
+
const sc = N("");
|
|
1137
|
+
sc.debugLabel = "showPredefinedBlockCategoryAtom";
|
|
1138
|
+
const Un = N({ undoCount: 0, redoCount: 0 });
|
|
1139
|
+
Un.debugLabel = "historyStatesAtom";
|
|
1140
|
+
const qn = N("SAVED");
|
|
1141
|
+
qn.debugLabel = "pageSyncStateAtom";
|
|
1142
|
+
const fd = () => {
|
|
1143
|
+
const [e, t] = Y(qn), n = en("onSaveBlocks", async () => {
|
|
1144
|
+
}), s = en("onSyncStatusChange", () => {
|
|
1145
|
+
}), r = xi(), o = Xe(Un), { undoCount: i, redoCount: a } = $n();
|
|
1146
|
+
return { savePage: Lo(
|
|
1147
|
+
async () => {
|
|
1148
|
+
t("SAVING"), s("SAVING");
|
|
1149
|
+
const u = r();
|
|
1150
|
+
return await n({ blocks: u.blocks, globalBlocks: u.globalBlocks }), setTimeout(() => {
|
|
1151
|
+
o({ undoCount: i, redoCount: a }), t("SAVED"), s("SAVED");
|
|
1152
|
+
}, 100), !0;
|
|
1153
|
+
},
|
|
1154
|
+
[r, t, s, n],
|
|
1155
|
+
5e3
|
|
1156
|
+
// save only every 5 seconds
|
|
1157
|
+
), syncState: e, setSyncState: t };
|
|
1158
|
+
}, $n = () => {
|
|
1159
|
+
const e = ne(Fn), [{ undoCount: t, redoCount: n }] = Y(Un), s = Se(), [r] = gi(), [, o] = mt(), [, i] = mi(), [, a] = Y(qn), d = en("onSyncStatusChange", () => {
|
|
1160
|
+
}), u = X(() => {
|
|
1161
|
+
s({ type: "create_snapshot" });
|
|
1162
|
+
}, [s]);
|
|
1163
|
+
return ke(() => {
|
|
1164
|
+
t !== (e == null ? void 0 : e.past.length) || n !== (e == null ? void 0 : e.future.length) ? (a("UNSAVED"), d("UNSAVED")) : t === (e == null ? void 0 : e.past.length) && n === (e == null ? void 0 : e.future.length) && (a("SAVED"), d("SAVED"));
|
|
1165
|
+
}, [e == null ? void 0 : e.past.length, e == null ? void 0 : e.future.length, t, n, d, a]), {
|
|
1166
|
+
undoCount: e == null ? void 0 : e.past.length,
|
|
1167
|
+
redoCount: e == null ? void 0 : e.future.length,
|
|
1168
|
+
undo: X(() => {
|
|
1169
|
+
r || (s(Zn.undo()), setTimeout(() => {
|
|
1170
|
+
i([]), o([]);
|
|
1171
|
+
}, 200));
|
|
1172
|
+
}, [s, r, a]),
|
|
1173
|
+
redo: X(() => {
|
|
1174
|
+
r || (s(Zn.redo()), setTimeout(() => {
|
|
1175
|
+
i([]), o([]);
|
|
1176
|
+
}, 200));
|
|
1177
|
+
}, [r, s]),
|
|
1178
|
+
clear: () => {
|
|
1179
|
+
s(Zn.clearHistory());
|
|
1180
|
+
},
|
|
1181
|
+
createSnapshot: u
|
|
1182
|
+
};
|
|
1183
|
+
}, rc = () => Y(hi), Ai = pt("canvasWidth", 360), Ei = N((e) => {
|
|
1184
|
+
const t = e(Ai);
|
|
1185
|
+
return Ro(t).toLowerCase();
|
|
1186
|
+
}), hd = () => {
|
|
1187
|
+
const [e, t] = Y(Ai), n = ne(Ei), [s, r] = rc();
|
|
1188
|
+
return ke(() => {
|
|
1189
|
+
s !== "xs" && r(n);
|
|
1190
|
+
}, [n, s, r]), [e, n, t];
|
|
1191
|
+
}, ic = pt("canvasZoom", 100), pd = () => Y(ic), Pi = N([]), Oi = () => {
|
|
1192
|
+
const [e, t] = Y(Pi), n = Xe(Ms), s = X(
|
|
1193
|
+
(r) => {
|
|
1194
|
+
t(r), n([]);
|
|
1195
|
+
},
|
|
1196
|
+
[t, n]
|
|
1197
|
+
);
|
|
1198
|
+
return [e, s];
|
|
1199
|
+
}, Ms = N([]), oc = () => {
|
|
1200
|
+
const [e, t] = Y(Ms), n = Xe(Pi), s = X(
|
|
1201
|
+
(r) => {
|
|
1202
|
+
t(r), n([]);
|
|
1203
|
+
},
|
|
1204
|
+
[t, n]
|
|
1205
|
+
);
|
|
1206
|
+
return [e, s];
|
|
1207
|
+
}, _i = pt("darkMode", !1), md = () => {
|
|
1208
|
+
const [e, t] = Y(_i);
|
|
1209
|
+
return [e, t];
|
|
1210
|
+
}, ac = N(!1), gd = () => {
|
|
1211
|
+
const [e, t] = Y(ac);
|
|
1212
|
+
return [e, t];
|
|
1213
|
+
}, Ci = () => {
|
|
1214
|
+
const e = Se(), t = ne(we), [, n] = mt();
|
|
1215
|
+
return X(
|
|
1216
|
+
(s, r = null) => {
|
|
1217
|
+
const o = [];
|
|
1218
|
+
We(s, (i) => {
|
|
1219
|
+
const d = xa(t, i, r === i ? null : r);
|
|
1220
|
+
o.push(ee(d, "0._id", "")), e({ type: "add_duplicate_blocks", payload: d });
|
|
1221
|
+
}), n(o), e({ type: "create_snapshot" });
|
|
1222
|
+
},
|
|
1223
|
+
[t, n, e]
|
|
1224
|
+
);
|
|
1225
|
+
}, cc = N([]), yd = () => {
|
|
1226
|
+
const [e, t] = Y(cc), n = X(
|
|
1227
|
+
(s) => {
|
|
1228
|
+
t((r) => de(r, s) ? Yr(r, s) : [...r, s]);
|
|
1229
|
+
},
|
|
1230
|
+
[t]
|
|
1231
|
+
);
|
|
1232
|
+
return [e, t, n];
|
|
1233
|
+
}, uc = N(""), lc = () => Y(uc), vd = () => {
|
|
1234
|
+
const e = ne(we), t = Se(), n = xi(), [, , s] = li();
|
|
1235
|
+
return X(
|
|
1236
|
+
async (r, o) => {
|
|
1237
|
+
const i = He(16), a = ue(e, (d) => (d._id === r && (d._globalBlockId = i, d._name = o), d));
|
|
1238
|
+
t({ type: "set_page_blocks", payload: a }), s();
|
|
1239
|
+
},
|
|
1240
|
+
[e, t, n, s]
|
|
1241
|
+
);
|
|
1242
|
+
}, bd = () => ({}), dc = () => {
|
|
1243
|
+
const e = ne(we), t = Se();
|
|
1244
|
+
return X(
|
|
1245
|
+
(n, s) => {
|
|
1246
|
+
const r = ue(e, (o) => (de(n, ee(o, "_id")) && ut(o, "_parent", s), o));
|
|
1247
|
+
t({ type: "set_blocks", payload: r });
|
|
1248
|
+
},
|
|
1249
|
+
[e, t]
|
|
1250
|
+
);
|
|
1251
|
+
}, fc = () => {
|
|
1252
|
+
const e = ne(Ms), [t, n] = Oi(), s = Ci(), r = dc();
|
|
1253
|
+
return {
|
|
1254
|
+
canPaste: wo(
|
|
1255
|
+
() => t.length > 0 || e.length > 0,
|
|
1256
|
+
[e, t]
|
|
1257
|
+
),
|
|
1258
|
+
pasteBlocks: X(
|
|
1259
|
+
(i) => {
|
|
1260
|
+
Me(e) ? r(t, i) : s(e, i), n(() => []);
|
|
1261
|
+
},
|
|
1262
|
+
[t, e, s, r, n]
|
|
1263
|
+
)
|
|
1264
|
+
};
|
|
1265
|
+
}, hc = N(""), wd = () => {
|
|
1266
|
+
const e = ne(hc), t = X(() => {
|
|
1267
|
+
}, []), n = X(() => {
|
|
1268
|
+
}, []), s = X(() => {
|
|
1269
|
+
}, []);
|
|
1270
|
+
return { currentProject: e, createProject: s, deleteProject: t, updateProject: n };
|
|
1271
|
+
}, Ii = (e, t) => {
|
|
1272
|
+
const n = [], s = te(e, (r) => de(t, r._id) || de(t, r._parent) ? (n.push(r._id), !1) : !0);
|
|
1273
|
+
return Me(n) ? s : Ii(s, n);
|
|
1274
|
+
}, pc = () => {
|
|
1275
|
+
const e = Se(), t = ne(we), [n, s] = mt();
|
|
1276
|
+
return X(
|
|
1277
|
+
(r) => {
|
|
1278
|
+
var a;
|
|
1279
|
+
const o = ((a = Ae(t, { _id: r[0] })) == null ? void 0 : a._parent) || null, i = Ii(t, r);
|
|
1280
|
+
e({ type: "set_blocks", payload: i }), s(o ? [o] : []);
|
|
1281
|
+
},
|
|
1282
|
+
[t, s, e, n]
|
|
1283
|
+
);
|
|
1284
|
+
}, mc = N(null, (e, t, { blockIds: n, fullClasses: s, dispatch: r }) => {
|
|
1285
|
+
const o = Be(e(gn)), i = te(
|
|
1286
|
+
e(_s),
|
|
1287
|
+
(a) => (
|
|
1288
|
+
// @ts-ignore
|
|
1289
|
+
n.includes(e(a)._id)
|
|
1290
|
+
)
|
|
1291
|
+
);
|
|
1292
|
+
We(i, (a) => {
|
|
1293
|
+
const d = e(a), u = s;
|
|
1294
|
+
let { classes: f, baseClasses: m } = Xo(ee(d, o.prop, "styles:,"));
|
|
1295
|
+
We(u, (b) => {
|
|
1296
|
+
const g = new RegExp(`(^| )${b.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
1297
|
+
f = f.replace(g, " ").replace(/ +/g, " ").trim();
|
|
1298
|
+
const O = Be(b.split(":"));
|
|
1299
|
+
de(["2xl", "xl", "lg", "md", "sm"], O) && u.push(b.split(":").pop().trim());
|
|
1300
|
+
}), We(u, (b) => {
|
|
1301
|
+
const g = new RegExp(`(^| )${b.replace("[", "\\[").replace("]", "\\]")}($| )`, "g");
|
|
1302
|
+
m = m.replace(g, " ").replace(/ +/g, " ").trim();
|
|
1303
|
+
}), r({
|
|
1304
|
+
type: "update_props_realtime",
|
|
1305
|
+
payload: {
|
|
1306
|
+
ids: [d._id],
|
|
1307
|
+
props: {
|
|
1308
|
+
[o.prop]: `${lt}${m},${f}`
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
});
|
|
1312
|
+
});
|
|
1313
|
+
}), Sd = () => {
|
|
1314
|
+
const e = Se(), t = Xe(mc);
|
|
1315
|
+
return X(
|
|
1316
|
+
(n, s) => {
|
|
1317
|
+
t({ blockIds: n, fullClasses: s, dispatch: e }), setTimeout(() => e({ type: "create_snapshot" }));
|
|
1318
|
+
},
|
|
1319
|
+
[e, t]
|
|
1320
|
+
);
|
|
1321
|
+
}, ji = N((e) => {
|
|
1322
|
+
const t = Be(e(gn)), n = e(js);
|
|
1323
|
+
if (!t || t.blockId !== ee(n, "_id", null))
|
|
1324
|
+
return [];
|
|
1325
|
+
const r = ee(n, t.prop, `${lt},`).replace(lt, "").split(",").join(" ");
|
|
1326
|
+
return te(ue(r.trim().split(" "), Cn), (o) => !os(o));
|
|
1327
|
+
}), xd = () => ne(ji), ur = { xs: 0, sm: 1, md: 2, lg: 3, xl: 4, "2xl": 5 }, gc = N((e) => {
|
|
1328
|
+
const t = e(Ei), n = e(Bs), s = e(_i), r = yc(t);
|
|
1329
|
+
let o = te(e(ji), { mod: n });
|
|
1330
|
+
return ei(n, "_") || (o = te(o, (i) => r.includes(i.mq))), o = o.sort((i, a) => ur[i.mq] - ur[a.mq]), s || (o = te(o, { dark: !1 })), o;
|
|
1331
|
+
}), yc = (e) => {
|
|
1332
|
+
let t = [];
|
|
1333
|
+
switch (e) {
|
|
1334
|
+
case "xs":
|
|
1335
|
+
t = ["xs"];
|
|
1336
|
+
break;
|
|
1337
|
+
case "sm":
|
|
1338
|
+
t = ["xs", "sm"];
|
|
1339
|
+
break;
|
|
1340
|
+
case "md":
|
|
1341
|
+
t = ["xs", "sm", "md"];
|
|
1342
|
+
break;
|
|
1343
|
+
case "lg":
|
|
1344
|
+
t = ["xs", "sm", "md", "lg"];
|
|
1345
|
+
break;
|
|
1346
|
+
case "xl":
|
|
1347
|
+
t = ["xs", "sm", "md", "lg", "xl"];
|
|
1348
|
+
break;
|
|
1349
|
+
case "2xl":
|
|
1350
|
+
t = ["xs", "sm", "md", "lg", "xl", "2xl"];
|
|
1351
|
+
break;
|
|
1352
|
+
default:
|
|
1353
|
+
t = ["xs"];
|
|
1354
|
+
break;
|
|
1355
|
+
}
|
|
1356
|
+
return t;
|
|
1357
|
+
}, kd = () => ne(gc), Ad = () => Y(Bs), Bi = N(null, (e, t, { blockIds: n, props: s, dispatch: r }) => {
|
|
1358
|
+
r({
|
|
1359
|
+
type: "update_props_realtime",
|
|
1360
|
+
payload: { ids: n, props: s }
|
|
1361
|
+
});
|
|
1362
|
+
}), Ed = () => {
|
|
1363
|
+
const { createSnapshot: e } = $n(), t = Se(), n = Xe(Bi);
|
|
1364
|
+
return X(
|
|
1365
|
+
(s, r) => {
|
|
1366
|
+
n({ blockIds: s, props: r, dispatch: t }), e();
|
|
1367
|
+
},
|
|
1368
|
+
[e, t, n]
|
|
1369
|
+
);
|
|
1370
|
+
}, Pd = () => {
|
|
1371
|
+
const e = Se(), t = Xe(Bi);
|
|
1372
|
+
return X(
|
|
1373
|
+
(n, s) => {
|
|
1374
|
+
t({ blockIds: n, props: s, dispatch: e });
|
|
1375
|
+
},
|
|
1376
|
+
[e, t]
|
|
1377
|
+
);
|
|
1378
|
+
}, Ri = {
|
|
1379
|
+
name: "",
|
|
1380
|
+
props: {},
|
|
1381
|
+
modalProps: {},
|
|
1382
|
+
backdropClose: !0
|
|
1383
|
+
}, vc = N(Ri), Od = () => {
|
|
1384
|
+
const [e, t] = Y(vc), n = X(
|
|
1385
|
+
(r, o = {}, i = {}) => {
|
|
1386
|
+
t({ name: r, props: o, modalProps: i });
|
|
1387
|
+
},
|
|
1388
|
+
[t]
|
|
1389
|
+
), s = X(
|
|
1390
|
+
(...r) => {
|
|
1391
|
+
ee(e, "props.onClose", () => {
|
|
1392
|
+
})(...r), t(Ri);
|
|
1393
|
+
},
|
|
1394
|
+
[t, e]
|
|
1395
|
+
);
|
|
1396
|
+
return {
|
|
1397
|
+
activeModal: e,
|
|
1398
|
+
openModal: n,
|
|
1399
|
+
closeModal: s
|
|
1400
|
+
};
|
|
1401
|
+
}, _d = () => ne(ki), bc = N(""), wc = N(null), Cd = () => Y(bc), Id = () => Y(wc), Sc = pt("selectedBreakpoints", ["XS", "MD", "XL"]), jd = () => {
|
|
1402
|
+
const [e, t] = Y(Sc);
|
|
1403
|
+
return [e, t];
|
|
1404
|
+
}, xc = () => {
|
|
1405
|
+
const e = Xe(Un), { clear: t } = $n(), [, n] = mt(), [, s] = lc(), [, r] = mi();
|
|
1406
|
+
return () => {
|
|
1407
|
+
n([]), r([]), s(""), t(), e({ undoCount: 0, redoCount: 0 });
|
|
1408
|
+
};
|
|
1409
|
+
}, kc = N({ en: {} }), Bd = () => {
|
|
1410
|
+
const [e, t] = Y(kc), n = X(
|
|
1411
|
+
(s, r, o) => {
|
|
1412
|
+
ut(e, `${s}.${r}`, o), t(e);
|
|
1413
|
+
},
|
|
1414
|
+
[e, t]
|
|
1415
|
+
);
|
|
1416
|
+
return [e, n];
|
|
1417
|
+
}, Rd = (e, t) => {
|
|
1418
|
+
const [n] = Y(ti);
|
|
1419
|
+
return ee(n, e, t);
|
|
1420
|
+
}, Ac = N([]), Dd = () => {
|
|
1421
|
+
const [e, t] = So(!1), [n, s] = Y(Ac), r = en("getUILibraryBlocks", () => []);
|
|
1422
|
+
return ke(() => {
|
|
1423
|
+
(async () => n.length > 0 || (t(!0), s(await r()), t(!1)))();
|
|
1424
|
+
}, []), { data: n, isLoading: e };
|
|
1425
|
+
}, Ec = N("en"), Pc = N("en"), Oc = N(["en"]), _c = () => Y(Ec), Md = () => Y(Pc), Ld = () => Y(Oc), Nd = (e, t) => {
|
|
1426
|
+
const [n] = _c(), s = `${e}${n ? `-${n}` : ""}`;
|
|
1427
|
+
return { content: ee(t, s, ee(t, e, "")), propKey: e };
|
|
1428
|
+
}, Cc = () => {
|
|
1429
|
+
const [e, t] = gi(), n = en("previewComponent");
|
|
1430
|
+
return /* @__PURE__ */ _.jsxs("div", { className: Bo("fixed inset-0 z-[999] bg-background", e ? "block" : "hidden"), children: [
|
|
1431
|
+
/* @__PURE__ */ _.jsx(Oo, { size: "sm", className: "absolute right-0 top-0 m-4", onClick: () => t(!1), children: "Close Preview" }),
|
|
1432
|
+
/* @__PURE__ */ _.jsx("div", { children: n ? /* @__PURE__ */ _.jsx(Gt, { fallback: /* @__PURE__ */ _.jsx(_o, { className: "h-96 w-full" }), children: Es.createElement(n) }) : null })
|
|
1433
|
+
] });
|
|
1434
|
+
}, Ic = () => {
|
|
1435
|
+
const [e, t] = mt(), [, n] = oc(), s = pc(), r = Ci(), [, o] = Oi(), { pasteBlocks: i } = fc(), { undo: a, redo: d } = $n();
|
|
1436
|
+
Le("esc", () => t([]), {}, [t]), Le("ctrl+c,command+c", () => n(e), {}, [e, n]), Le("ctrl+d,command+d", () => r(e), { preventDefault: !0 }, [e, r]), Le("ctrl+x,command+x", () => o(e), {}, [e, o]), Le("ctrl+v,command+v", () => e.length === 1 ? i(e[0]) : null, {}, [e, i]), Le("ctrl+z,command+z", () => a(), {}, [a]), Le("ctrl+y,command+y", () => d(), {}, [d]), Le(
|
|
1437
|
+
"del, backspace",
|
|
1438
|
+
(u) => {
|
|
1439
|
+
u.preventDefault(), s(e);
|
|
1440
|
+
},
|
|
1441
|
+
{},
|
|
1442
|
+
[e, s]
|
|
1443
|
+
);
|
|
1444
|
+
}, jc = (e, t) => {
|
|
1445
|
+
const n = [];
|
|
1446
|
+
let s = Ae(e, { _id: t }), r = ee(s, "_parent", "");
|
|
1447
|
+
for (; Ps(r) && !Me(r); )
|
|
1448
|
+
n.push(s == null ? void 0 : s._parent), s = Ae(e, { _id: r }), r = s == null ? void 0 : s._parent;
|
|
1449
|
+
return be(n);
|
|
1450
|
+
}, Di = N([]), Bc = () => {
|
|
1451
|
+
const [e] = mt(), t = ne(we), [, n] = Y(Di);
|
|
1452
|
+
ke(() => {
|
|
1453
|
+
let s = [];
|
|
1454
|
+
const r = Be(e);
|
|
1455
|
+
Ps(r) && (s = [r, ...jc(t, r)]), n(s);
|
|
1456
|
+
}, [e, t, n]);
|
|
1457
|
+
}, Td = () => ne(Di), Rc = $t(() => import("./SidePanels-96e64da9.js")), Dc = $t(() => import("./Topbar-08d10607.js")), Mc = $t(() => import("./CanvasArea-15458836.js")), Lc = $t(() => import("./Settings-6f2e86a9.js")), Nc = () => {
|
|
1458
|
+
const [e] = ba(qn), t = (n) => {
|
|
1459
|
+
n.preventDefault();
|
|
1460
|
+
};
|
|
1461
|
+
return Ic(), Bc(), ke(() => (e !== "SAVED" ? window.onbeforeunload = () => "" : window.onbeforeunload = null, () => {
|
|
1462
|
+
window.onbeforeunload = null;
|
|
1463
|
+
}), [e]), /* @__PURE__ */ _.jsx("div", { className: "h-screen w-screen bg-background text-foreground", children: /* @__PURE__ */ _.jsxs(Co, { children: [
|
|
1464
|
+
/* @__PURE__ */ _.jsxs(
|
|
1465
|
+
"div",
|
|
1466
|
+
{
|
|
1467
|
+
onContextMenu: t,
|
|
1468
|
+
className: "flex h-screen flex-col overflow-hidden bg-background text-foreground",
|
|
1469
|
+
children: [
|
|
1470
|
+
/* @__PURE__ */ _.jsx("div", { className: "h-14 w-screen shrink-0 border-b border-border", children: /* @__PURE__ */ _.jsx(Gt, { children: /* @__PURE__ */ _.jsx(Dc, {}) }) }),
|
|
1471
|
+
/* @__PURE__ */ _.jsxs("main", { className: "flex h-full flex-row", children: [
|
|
1472
|
+
/* @__PURE__ */ _.jsx("div", { className: "flex h-full w-fit border-border", children: /* @__PURE__ */ _.jsx(Gt, { children: /* @__PURE__ */ _.jsx(Rc, {}) }) }),
|
|
1473
|
+
/* @__PURE__ */ _.jsx("div", { className: "h-full flex-1 bg-slate-800/20", children: /* @__PURE__ */ _.jsx(Gt, { children: /* @__PURE__ */ _.jsx(Mc, {}) }) }),
|
|
1474
|
+
/* @__PURE__ */ _.jsx("div", { className: "flex h-full w-[280px] min-w-[280px] border-l border-border", children: /* @__PURE__ */ _.jsx(Gt, { children: /* @__PURE__ */ _.jsx(Lc, {}) }) })
|
|
1475
|
+
] })
|
|
1476
|
+
]
|
|
1477
|
+
}
|
|
1478
|
+
),
|
|
1479
|
+
/* @__PURE__ */ _.jsx(Cc, {})
|
|
1480
|
+
] }) });
|
|
1481
|
+
}, Tc = jo();
|
|
1482
|
+
N({});
|
|
1483
|
+
function lr(e, t, n, s, r) {
|
|
1484
|
+
for (t = t.split ? t.split(".") : t, s = 0; s < t.length; s++)
|
|
1485
|
+
e = e ? e[t[s]] : r;
|
|
1486
|
+
return e === r ? n : e;
|
|
1487
|
+
}
|
|
1488
|
+
var kn = "undefined", dr = "object", Mi = "any", Li = "*", dt = "__", Rn = typeof process < "u" ? process : {};
|
|
1489
|
+
Rn.env && Rn.env.NODE_ENV;
|
|
1490
|
+
var Ee = typeof document < "u";
|
|
1491
|
+
Rn.versions != null && Rn.versions.node != null;
|
|
1492
|
+
typeof Deno < "u" && Deno.core;
|
|
1493
|
+
Ee && window.name === "nodejs" || typeof navigator < "u" && navigator.userAgent !== void 0 && (navigator.userAgent.includes("Node.js") || navigator.userAgent.includes("jsdom"));
|
|
1494
|
+
function Ni(e, t) {
|
|
1495
|
+
return t.charAt(0)[e]() + t.slice(1);
|
|
1496
|
+
}
|
|
1497
|
+
var Fc = Ni.bind(null, "toUpperCase"), Uc = Ni.bind(null, "toLowerCase");
|
|
1498
|
+
function qc(e) {
|
|
1499
|
+
return Ti(e) ? Fc("null") : typeof e == "object" ? zc(e) : Object.prototype.toString.call(e).slice(8, -1);
|
|
1500
|
+
}
|
|
1501
|
+
function Dn(e, t) {
|
|
1502
|
+
t === void 0 && (t = !0);
|
|
1503
|
+
var n = qc(e);
|
|
1504
|
+
return t ? Uc(n) : n;
|
|
1505
|
+
}
|
|
1506
|
+
function yn(e, t) {
|
|
1507
|
+
return typeof t === e;
|
|
1508
|
+
}
|
|
1509
|
+
var je = yn.bind(null, "function"), bt = yn.bind(null, "string"), yt = yn.bind(null, "undefined"), $c = yn.bind(null, "boolean");
|
|
1510
|
+
yn.bind(null, "symbol");
|
|
1511
|
+
function Ti(e) {
|
|
1512
|
+
return e === null;
|
|
1513
|
+
}
|
|
1514
|
+
function Qc(e) {
|
|
1515
|
+
return Dn(e) === "number" && !isNaN(e);
|
|
1516
|
+
}
|
|
1517
|
+
function Vc(e) {
|
|
1518
|
+
return Dn(e) === "array";
|
|
1519
|
+
}
|
|
1520
|
+
function he(e) {
|
|
1521
|
+
if (!Kc(e))
|
|
1522
|
+
return !1;
|
|
1523
|
+
for (var t = e; Object.getPrototypeOf(t) !== null; )
|
|
1524
|
+
t = Object.getPrototypeOf(t);
|
|
1525
|
+
return Object.getPrototypeOf(e) === t;
|
|
1526
|
+
}
|
|
1527
|
+
function Kc(e) {
|
|
1528
|
+
return e && (typeof e == "object" || e !== null);
|
|
1529
|
+
}
|
|
1530
|
+
function zc(e) {
|
|
1531
|
+
return je(e.constructor) ? e.constructor.name : null;
|
|
1532
|
+
}
|
|
1533
|
+
function Gc(e) {
|
|
1534
|
+
return e instanceof Error || bt(e.message) && e.constructor && Qc(e.constructor.stackTraceLimit);
|
|
1535
|
+
}
|
|
1536
|
+
function Fi(e, t) {
|
|
1537
|
+
if (typeof t != "object" || Ti(t))
|
|
1538
|
+
return !1;
|
|
1539
|
+
if (t instanceof e)
|
|
1540
|
+
return !0;
|
|
1541
|
+
var n = Dn(new e(""));
|
|
1542
|
+
if (Gc(t))
|
|
1543
|
+
for (; t; ) {
|
|
1544
|
+
if (Dn(t) === n)
|
|
1545
|
+
return !0;
|
|
1546
|
+
t = Object.getPrototypeOf(t);
|
|
1547
|
+
}
|
|
1548
|
+
return !1;
|
|
1549
|
+
}
|
|
1550
|
+
Fi.bind(null, TypeError);
|
|
1551
|
+
Fi.bind(null, SyntaxError);
|
|
1552
|
+
function Qn(e, t) {
|
|
1553
|
+
var n = e instanceof Element || e instanceof HTMLDocument;
|
|
1554
|
+
return n && t ? Wc(e, t) : n;
|
|
1555
|
+
}
|
|
1556
|
+
function Wc(e, t) {
|
|
1557
|
+
return t === void 0 && (t = ""), e && e.nodeName === t.toUpperCase();
|
|
1558
|
+
}
|
|
1559
|
+
function Vn(e) {
|
|
1560
|
+
var t = [].slice.call(arguments, 1);
|
|
1561
|
+
return function() {
|
|
1562
|
+
return e.apply(void 0, [].slice.call(arguments).concat(t));
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
Vn(Qn, "form");
|
|
1566
|
+
Vn(Qn, "button");
|
|
1567
|
+
Vn(Qn, "input");
|
|
1568
|
+
Vn(Qn, "select");
|
|
1569
|
+
function fr(e) {
|
|
1570
|
+
try {
|
|
1571
|
+
return decodeURIComponent(e.replace(/\+/g, " "));
|
|
1572
|
+
} catch {
|
|
1573
|
+
return null;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
function Hc() {
|
|
1577
|
+
if (Ee) {
|
|
1578
|
+
var e = navigator, t = e.languages;
|
|
1579
|
+
return e.userLanguage || (t && t.length ? t[0] : e.language);
|
|
1580
|
+
}
|
|
1581
|
+
}
|
|
1582
|
+
function Jc() {
|
|
1583
|
+
try {
|
|
1584
|
+
return Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
1585
|
+
} catch {
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1588
|
+
function Xc(e) {
|
|
1589
|
+
return function(t) {
|
|
1590
|
+
for (var n, s = /* @__PURE__ */ Object.create(null), r = /([^&=]+)=?([^&]*)/g; n = r.exec(t); ) {
|
|
1591
|
+
var o = fr(n[1]), i = fr(n[2]);
|
|
1592
|
+
o.substring(o.length - 2) === "[]" ? (s[o = o.substring(0, o.length - 2)] || (s[o] = [])).push(i) : s[o] = i === "" || i;
|
|
1593
|
+
}
|
|
1594
|
+
for (var a in s) {
|
|
1595
|
+
var d = a.split("[");
|
|
1596
|
+
d.length > 1 && (Yc(s, d.map(function(u) {
|
|
1597
|
+
return u.replace(/[?[\]\\ ]/g, "");
|
|
1598
|
+
}), s[a]), delete s[a]);
|
|
1599
|
+
}
|
|
1600
|
+
return s;
|
|
1601
|
+
}(function(t) {
|
|
1602
|
+
if (t) {
|
|
1603
|
+
var n = t.match(/\?(.*)/);
|
|
1604
|
+
return n && n[1] ? n[1].split("#")[0] : "";
|
|
1605
|
+
}
|
|
1606
|
+
return Ee && window.location.search.substring(1);
|
|
1607
|
+
}(e));
|
|
1608
|
+
}
|
|
1609
|
+
function Yc(e, t, n) {
|
|
1610
|
+
for (var s = t.length - 1, r = 0; r < s; ++r) {
|
|
1611
|
+
var o = t[r];
|
|
1612
|
+
if (o === "__proto__" || o === "constructor")
|
|
1613
|
+
break;
|
|
1614
|
+
o in e || (e[o] = {}), e = e[o];
|
|
1615
|
+
}
|
|
1616
|
+
e[t[s]] = n;
|
|
1617
|
+
}
|
|
1618
|
+
function Kn() {
|
|
1619
|
+
for (var e = "", t = 0, n = 4294967295 * Math.random() | 0; t++ < 36; ) {
|
|
1620
|
+
var s = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[t - 1], r = 15 & n;
|
|
1621
|
+
e += s == "-" || s == "4" ? s : (s == "x" ? r : 3 & r | 8).toString(16), n = t % 8 == 0 ? 4294967295 * Math.random() | 0 : n >> 4;
|
|
1622
|
+
}
|
|
1623
|
+
return e;
|
|
1624
|
+
}
|
|
1625
|
+
var Jt = "global", Tt = dt + "global" + dt, Ft = typeof self === dr && self.self === self && self || typeof global === dr && global.global === global && global || void 0;
|
|
1626
|
+
function ft(e) {
|
|
1627
|
+
return Ft[Tt][e];
|
|
1628
|
+
}
|
|
1629
|
+
function ht(e, t) {
|
|
1630
|
+
return Ft[Tt][e] = t;
|
|
1631
|
+
}
|
|
1632
|
+
function Qt(e) {
|
|
1633
|
+
delete Ft[Tt][e];
|
|
1634
|
+
}
|
|
1635
|
+
function Vt(e, t, n) {
|
|
1636
|
+
var s;
|
|
1637
|
+
try {
|
|
1638
|
+
if (Ls(e)) {
|
|
1639
|
+
var r = window[e];
|
|
1640
|
+
s = r[t].bind(r);
|
|
1641
|
+
}
|
|
1642
|
+
} catch {
|
|
1643
|
+
}
|
|
1644
|
+
return s || n;
|
|
1645
|
+
}
|
|
1646
|
+
Ft[Tt] || (Ft[Tt] = {});
|
|
1647
|
+
var An = {};
|
|
1648
|
+
function Ls(e) {
|
|
1649
|
+
if (typeof An[e] !== kn)
|
|
1650
|
+
return An[e];
|
|
1651
|
+
try {
|
|
1652
|
+
var t = window[e];
|
|
1653
|
+
t.setItem(kn, kn), t.removeItem(kn);
|
|
1654
|
+
} catch {
|
|
1655
|
+
return An[e] = !1;
|
|
1656
|
+
}
|
|
1657
|
+
return An[e] = !0;
|
|
1658
|
+
}
|
|
1659
|
+
function q() {
|
|
1660
|
+
return q = Object.assign || function(e) {
|
|
1661
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
1662
|
+
var n = arguments[t];
|
|
1663
|
+
for (var s in n)
|
|
1664
|
+
Object.prototype.hasOwnProperty.call(n, s) && (e[s] = n[s]);
|
|
1665
|
+
}
|
|
1666
|
+
return e;
|
|
1667
|
+
}, q.apply(this, arguments);
|
|
1668
|
+
}
|
|
1669
|
+
var Ue = "function", De = "undefined", Zc = "@@redux/" + Math.random().toString(36), hr = /* @__PURE__ */ function() {
|
|
1670
|
+
return typeof Symbol === Ue && Symbol.observable || "@@observable";
|
|
1671
|
+
}(), En = " != " + Ue;
|
|
1672
|
+
function Ui(e, t, n) {
|
|
1673
|
+
var s;
|
|
1674
|
+
if (typeof t === Ue && typeof n === De && (n = t, t = void 0), typeof n !== De) {
|
|
1675
|
+
if (typeof n !== Ue)
|
|
1676
|
+
throw new Error("enhancer" + En);
|
|
1677
|
+
return n(Ui)(e, t);
|
|
1678
|
+
}
|
|
1679
|
+
if (typeof e !== Ue)
|
|
1680
|
+
throw new Error("reducer" + En);
|
|
1681
|
+
var r = e, o = t, i = [], a = i, d = !1;
|
|
1682
|
+
function u() {
|
|
1683
|
+
a === i && (a = i.slice());
|
|
1684
|
+
}
|
|
1685
|
+
function f() {
|
|
1686
|
+
return o;
|
|
1687
|
+
}
|
|
1688
|
+
function m(g) {
|
|
1689
|
+
if (typeof g !== Ue)
|
|
1690
|
+
throw new Error("Listener" + En);
|
|
1691
|
+
var O = !0;
|
|
1692
|
+
return u(), a.push(g), function() {
|
|
1693
|
+
if (O) {
|
|
1694
|
+
O = !1, u();
|
|
1695
|
+
var C = a.indexOf(g);
|
|
1696
|
+
a.splice(C, 1);
|
|
1697
|
+
}
|
|
1698
|
+
};
|
|
1699
|
+
}
|
|
1700
|
+
function b(g) {
|
|
1701
|
+
if (!he(g))
|
|
1702
|
+
throw new Error("Act != obj");
|
|
1703
|
+
if (typeof g.type === De)
|
|
1704
|
+
throw new Error("ActType " + De);
|
|
1705
|
+
if (d)
|
|
1706
|
+
throw new Error("Dispatch in reducer");
|
|
1707
|
+
try {
|
|
1708
|
+
d = !0, o = r(o, g);
|
|
1709
|
+
} finally {
|
|
1710
|
+
d = !1;
|
|
1711
|
+
}
|
|
1712
|
+
for (var O = i = a, C = 0; C < O.length; C++)
|
|
1713
|
+
(0, O[C])();
|
|
1714
|
+
return g;
|
|
1715
|
+
}
|
|
1716
|
+
return b({ type: "@@redux/INIT" }), (s = { dispatch: b, subscribe: m, getState: f, replaceReducer: function(g) {
|
|
1717
|
+
if (typeof g !== Ue)
|
|
1718
|
+
throw new Error("next reducer" + En);
|
|
1719
|
+
r = g, b({ type: "@@redux/INIT" });
|
|
1720
|
+
} })[hr] = function() {
|
|
1721
|
+
var g, O = m;
|
|
1722
|
+
return (g = { subscribe: function(C) {
|
|
1723
|
+
if (typeof C != "object")
|
|
1724
|
+
throw new TypeError("Observer != obj");
|
|
1725
|
+
function y() {
|
|
1726
|
+
C.next && C.next(f());
|
|
1727
|
+
}
|
|
1728
|
+
return y(), { unsubscribe: O(y) };
|
|
1729
|
+
} })[hr] = function() {
|
|
1730
|
+
return this;
|
|
1731
|
+
}, g;
|
|
1732
|
+
}, s;
|
|
1733
|
+
}
|
|
1734
|
+
function eu(e, t) {
|
|
1735
|
+
var n = t && t.type;
|
|
1736
|
+
return "action " + (n && n.toString() || "?") + "reducer " + e + " returns " + De;
|
|
1737
|
+
}
|
|
1738
|
+
function Ut() {
|
|
1739
|
+
var e = [].slice.call(arguments);
|
|
1740
|
+
return e.length === 0 ? function(t) {
|
|
1741
|
+
return t;
|
|
1742
|
+
} : e.length === 1 ? e[0] : e.reduce(function(t, n) {
|
|
1743
|
+
return function() {
|
|
1744
|
+
return t(n.apply(void 0, [].slice.call(arguments)));
|
|
1745
|
+
};
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1748
|
+
function tu() {
|
|
1749
|
+
var e = arguments;
|
|
1750
|
+
return function(t) {
|
|
1751
|
+
return function(n, s, r) {
|
|
1752
|
+
var o, i = t(n, s, r), a = i.dispatch, d = { getState: i.getState, dispatch: function(u) {
|
|
1753
|
+
return a(u);
|
|
1754
|
+
} };
|
|
1755
|
+
return o = [].slice.call(e).map(function(u) {
|
|
1756
|
+
return u(d);
|
|
1757
|
+
}), q({}, i, { dispatch: a = Ut.apply(void 0, o)(i.dispatch) });
|
|
1758
|
+
};
|
|
1759
|
+
};
|
|
1760
|
+
}
|
|
1761
|
+
var Je = dt + "anon_id", ct = dt + "user_id", wt = dt + "user_traits", Te = "userId", vt = "anonymousId", In = ["bootstrap", "params", "campaign", "initializeStart", "initialize", "initializeEnd", "ready", "resetStart", "reset", "resetEnd", "pageStart", "page", "pageEnd", "pageAborted", "trackStart", "track", "trackEnd", "trackAborted", "identifyStart", "identify", "identifyEnd", "identifyAborted", "userIdChanged", "registerPlugins", "enablePlugin", "disablePlugin", "online", "offline", "setItemStart", "setItem", "setItemEnd", "setItemAborted", "removeItemStart", "removeItem", "removeItemEnd", "removeItemAborted"], ds = ["name", "EVENTS", "config", "loaded"], U = In.reduce(function(e, t) {
|
|
1762
|
+
return e[t] = t, e;
|
|
1763
|
+
}, { registerPluginType: function(e) {
|
|
1764
|
+
return "registerPlugin:" + e;
|
|
1765
|
+
}, pluginReadyType: function(e) {
|
|
1766
|
+
return "ready:" + e;
|
|
1767
|
+
} }), pr = /^utm_/, mr = /^an_prop_/, gr = /^an_trait_/;
|
|
1768
|
+
function nu(e) {
|
|
1769
|
+
var t = e.storage.setItem;
|
|
1770
|
+
return function(n) {
|
|
1771
|
+
return function(s) {
|
|
1772
|
+
return function(r) {
|
|
1773
|
+
if (r.type === U.bootstrap) {
|
|
1774
|
+
var o = r.params, i = r.user, a = r.persistedUser, d = r.initialUser, u = a.userId === i.userId;
|
|
1775
|
+
a.anonymousId !== i.anonymousId && t(Je, i.anonymousId), u || t(ct, i.userId), d.traits && t(wt, q({}, u && a.traits ? a.traits : {}, d.traits));
|
|
1776
|
+
var f = Object.keys(r.params);
|
|
1777
|
+
if (f.length) {
|
|
1778
|
+
var m = o.an_uid, b = o.an_event, g = f.reduce(function(O, C) {
|
|
1779
|
+
if (C.match(pr) || C.match(/^(d|g)clid/)) {
|
|
1780
|
+
var y = C.replace(pr, "");
|
|
1781
|
+
O.campaign[y === "campaign" ? "name" : y] = o[C];
|
|
1782
|
+
}
|
|
1783
|
+
return C.match(mr) && (O.props[C.replace(mr, "")] = o[C]), C.match(gr) && (O.traits[C.replace(gr, "")] = o[C]), O;
|
|
1784
|
+
}, { campaign: {}, props: {}, traits: {} });
|
|
1785
|
+
n.dispatch(q({ type: U.params, raw: o }, g, m ? { userId: m } : {})), m && setTimeout(function() {
|
|
1786
|
+
return e.identify(m, g.traits);
|
|
1787
|
+
}, 0), b && setTimeout(function() {
|
|
1788
|
+
return e.track(b, g.props);
|
|
1789
|
+
}, 0), Object.keys(g.campaign).length && n.dispatch({ type: U.campaign, campaign: g.campaign });
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
return s(r);
|
|
1793
|
+
};
|
|
1794
|
+
};
|
|
1795
|
+
};
|
|
1796
|
+
}
|
|
1797
|
+
function su(e) {
|
|
1798
|
+
return function(t, n) {
|
|
1799
|
+
if (t === void 0 && (t = {}), n === void 0 && (n = {}), n.type === U.setItemEnd) {
|
|
1800
|
+
if (n.key === Je)
|
|
1801
|
+
return q({}, t, { anonymousId: n.value });
|
|
1802
|
+
if (n.key === ct)
|
|
1803
|
+
return q({}, t, { userId: n.value });
|
|
1804
|
+
}
|
|
1805
|
+
switch (n.type) {
|
|
1806
|
+
case U.identify:
|
|
1807
|
+
return Object.assign({}, t, { userId: n.userId, traits: q({}, t.traits, n.traits) });
|
|
1808
|
+
case U.reset:
|
|
1809
|
+
return [ct, Je, wt].forEach(function(s) {
|
|
1810
|
+
e.removeItem(s);
|
|
1811
|
+
}), Object.assign({}, t, { userId: null, anonymousId: null, traits: {} });
|
|
1812
|
+
default:
|
|
1813
|
+
return t;
|
|
1814
|
+
}
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
function yr(e) {
|
|
1818
|
+
return { userId: e.getItem(ct), anonymousId: e.getItem(Je), traits: e.getItem(wt) };
|
|
1819
|
+
}
|
|
1820
|
+
var fs = function(e) {
|
|
1821
|
+
return dt + "TEMP" + dt + e;
|
|
1822
|
+
};
|
|
1823
|
+
function ru(e) {
|
|
1824
|
+
var t = e.storage, n = t.setItem, s = t.removeItem, r = t.getItem;
|
|
1825
|
+
return function(o) {
|
|
1826
|
+
return function(i) {
|
|
1827
|
+
return function(a) {
|
|
1828
|
+
var d = a.userId, u = a.traits, f = a.options;
|
|
1829
|
+
if (a.type === U.reset && ([ct, wt, Je].forEach(function(g) {
|
|
1830
|
+
s(g);
|
|
1831
|
+
}), [Te, vt, "traits"].forEach(function(g) {
|
|
1832
|
+
Qt(fs(g));
|
|
1833
|
+
})), a.type === U.identify) {
|
|
1834
|
+
r(Je) || n(Je, Kn());
|
|
1835
|
+
var m = r(ct), b = r(wt) || {};
|
|
1836
|
+
m && m !== d && o.dispatch({ type: U.userIdChanged, old: { userId: m, traits: b }, new: { userId: d, traits: u }, options: f }), d && n(ct, d), u && n(wt, q({}, b, u));
|
|
1837
|
+
}
|
|
1838
|
+
return i(a);
|
|
1839
|
+
};
|
|
1840
|
+
};
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1843
|
+
var Wt = {};
|
|
1844
|
+
function vr(e, t) {
|
|
1845
|
+
Wt[e] && je(Wt[e]) && (Wt[e](t), delete Wt[e]);
|
|
1846
|
+
}
|
|
1847
|
+
function qi(e, t, n) {
|
|
1848
|
+
return new Promise(function(s, r) {
|
|
1849
|
+
return t() ? s(e) : n < 1 ? r(q({}, e, { queue: !0 })) : new Promise(function(o) {
|
|
1850
|
+
return setTimeout(o, 10);
|
|
1851
|
+
}).then(function(o) {
|
|
1852
|
+
return qi(e, t, n - 10).then(s, r);
|
|
1853
|
+
});
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
function $i(e, t, n) {
|
|
1857
|
+
var s = t(), r = e.getState(), o = r.plugins, i = r.queue, a = r.user;
|
|
1858
|
+
if (!r.context.offline && i && i.actions && i.actions.length) {
|
|
1859
|
+
var d = i.actions.reduce(function(f, m, b) {
|
|
1860
|
+
return o[m.plugin].loaded ? (f.process.push(m), f.processIndex.push(b)) : (f.requeue.push(m), f.requeueIndex.push(b)), f;
|
|
1861
|
+
}, { processIndex: [], process: [], requeue: [], requeueIndex: [] });
|
|
1862
|
+
if (d.processIndex && d.processIndex.length) {
|
|
1863
|
+
d.processIndex.forEach(function(f) {
|
|
1864
|
+
var m = i.actions[f], b = m.plugin, g = m.payload.type, O = s[b][g];
|
|
1865
|
+
if (O && je(O)) {
|
|
1866
|
+
var C = function(A, D) {
|
|
1867
|
+
return A === void 0 && (A = {}), D === void 0 && (D = {}), [Te, vt].reduce(function(B, x) {
|
|
1868
|
+
return A.hasOwnProperty(x) && D[x] && D[x] !== A[x] && (B[x] = D[x]), B;
|
|
1869
|
+
}, A);
|
|
1870
|
+
}(m.payload, a);
|
|
1871
|
+
O({ payload: C, config: o[b].config, instance: n });
|
|
1872
|
+
var y = g + ":" + b;
|
|
1873
|
+
e.dispatch(q({}, C, { type: y, _: { called: y, from: "queueDrain" } }));
|
|
1874
|
+
}
|
|
1875
|
+
});
|
|
1876
|
+
var u = i.actions.filter(function(f, m) {
|
|
1877
|
+
return !~d.processIndex.indexOf(m);
|
|
1878
|
+
});
|
|
1879
|
+
i.actions = u;
|
|
1880
|
+
}
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
var ts = function(e) {
|
|
1884
|
+
var t = e.data, n = e.action, s = e.instance, r = e.state, o = e.allPlugins, i = e.allMatches, a = e.store, d = e.EVENTS;
|
|
1885
|
+
try {
|
|
1886
|
+
var u = r.plugins, f = r.context, m = n.type, b = m.match(St), g = t.exact.map(function(y) {
|
|
1887
|
+
return y.pluginName;
|
|
1888
|
+
});
|
|
1889
|
+
b && (g = i.during.map(function(y) {
|
|
1890
|
+
return y.pluginName;
|
|
1891
|
+
}));
|
|
1892
|
+
var O = function(y, A) {
|
|
1893
|
+
return function(D, B, x) {
|
|
1894
|
+
var k = B.config, F = B.name, T = F + "." + D.type;
|
|
1895
|
+
x && (T = x.event);
|
|
1896
|
+
var R = D.type.match(St) ? function(p, v, I, w, j) {
|
|
1897
|
+
return function(E, S) {
|
|
1898
|
+
var Q = w ? w.name : p, $ = S && tn(S) ? S : I;
|
|
1899
|
+
if (w && (!($ = S && tn(S) ? S : [p]).includes(p) || $.length !== 1))
|
|
1900
|
+
throw new Error("Method " + v + " can only abort " + p + " plugin. " + JSON.stringify($) + " input valid");
|
|
1901
|
+
return q({}, j, { abort: { reason: E, plugins: $, caller: v, _: Q } });
|
|
1902
|
+
};
|
|
1903
|
+
}(F, T, A, x, D) : function(p, v) {
|
|
1904
|
+
return function() {
|
|
1905
|
+
throw new Error(p.type + " action not cancellable. Remove abort in " + v);
|
|
1906
|
+
};
|
|
1907
|
+
}(D, T);
|
|
1908
|
+
return { payload: iu(D), instance: y, config: k || {}, abort: R };
|
|
1909
|
+
};
|
|
1910
|
+
}(s, g), C = t.exact.reduce(function(y, A) {
|
|
1911
|
+
var D = A.pluginName, B = A.methodName, x = !1;
|
|
1912
|
+
return B.match(/^initialize/) || B.match(/^reset/) || (x = !u[D].loaded), f.offline && B.match(/^(page|track|identify)/) && (x = !0), y["" + D] = x, y;
|
|
1913
|
+
}, {});
|
|
1914
|
+
return Promise.resolve(t.exact.reduce(function(y, A, D) {
|
|
1915
|
+
try {
|
|
1916
|
+
var B = A.pluginName;
|
|
1917
|
+
return Promise.resolve(y).then(function(x) {
|
|
1918
|
+
function k() {
|
|
1919
|
+
return Promise.resolve(x);
|
|
1920
|
+
}
|
|
1921
|
+
var F = function() {
|
|
1922
|
+
if (t.namespaced && t.namespaced[B])
|
|
1923
|
+
return Promise.resolve(t.namespaced[B].reduce(function(T, R, p) {
|
|
1924
|
+
try {
|
|
1925
|
+
return Promise.resolve(T).then(function(v) {
|
|
1926
|
+
return R.method && je(R.method) ? (function(E, S) {
|
|
1927
|
+
var Q = Er(E);
|
|
1928
|
+
if (Q && Q.name === S) {
|
|
1929
|
+
var $ = Er(Q.method);
|
|
1930
|
+
throw new Error([S + " plugin is calling method " + E, "Plugins cant call self", "Use " + Q.method + " " + ($ ? "or " + $.method : "") + " in " + S + " plugin insteadof " + E].join(`
|
|
1931
|
+
`));
|
|
1932
|
+
}
|
|
1933
|
+
}(R.methodName, R.pluginName), Promise.resolve(R.method({ payload: v, instance: s, abort: (I = v, w = B, j = R.pluginName, function(E, S) {
|
|
1934
|
+
return q({}, I, { abort: { reason: E, plugins: S || [w], caller: m, from: j || w } });
|
|
1935
|
+
}), config: Sr(R.pluginName, u, o), plugins: u })).then(function(E) {
|
|
1936
|
+
var S = he(E) ? E : {};
|
|
1937
|
+
return Promise.resolve(q({}, v, S));
|
|
1938
|
+
})) : v;
|
|
1939
|
+
var I, w, j;
|
|
1940
|
+
});
|
|
1941
|
+
} catch (v) {
|
|
1942
|
+
return Promise.reject(v);
|
|
1943
|
+
}
|
|
1944
|
+
}, Promise.resolve(n))).then(function(T) {
|
|
1945
|
+
x[B] = T;
|
|
1946
|
+
});
|
|
1947
|
+
x[B] = n;
|
|
1948
|
+
}();
|
|
1949
|
+
return F && F.then ? F.then(k) : k();
|
|
1950
|
+
});
|
|
1951
|
+
} catch (x) {
|
|
1952
|
+
return Promise.reject(x);
|
|
1953
|
+
}
|
|
1954
|
+
}, Promise.resolve({}))).then(function(y) {
|
|
1955
|
+
return Promise.resolve(t.exact.reduce(function(A, D, B) {
|
|
1956
|
+
try {
|
|
1957
|
+
var x = t.exact.length === B + 1, k = D.pluginName, F = o[k];
|
|
1958
|
+
return Promise.resolve(A).then(function(T) {
|
|
1959
|
+
var R = y[k] ? y[k] : {};
|
|
1960
|
+
if (b && (R = T), ss(R, k))
|
|
1961
|
+
return ns({ data: R, method: m, instance: s, pluginName: k, store: a }), Promise.resolve(T);
|
|
1962
|
+
if (ss(T, k))
|
|
1963
|
+
return x && ns({ data: T, method: m, instance: s, store: a }), Promise.resolve(T);
|
|
1964
|
+
if (C.hasOwnProperty(k) && C[k] === !0)
|
|
1965
|
+
return a.dispatch({ type: "queue", plugin: k, payload: R, _: { called: "queue", from: "queueMechanism" } }), Promise.resolve(T);
|
|
1966
|
+
var p = O(y[k], o[k]);
|
|
1967
|
+
return Promise.resolve(F[m]({ abort: p.abort, payload: R, instance: s, config: Sr(k, u, o), plugins: u })).then(function(v) {
|
|
1968
|
+
var I = he(v) ? v : {}, w = q({}, T, I), j = y[k];
|
|
1969
|
+
if (ss(j, k))
|
|
1970
|
+
ns({ data: j, method: m, instance: s, pluginName: k, store: a });
|
|
1971
|
+
else {
|
|
1972
|
+
var E = m + ":" + k;
|
|
1973
|
+
(E.match(/:/g) || []).length < 2 && !m.match(br) && !m.match(wr) && s.dispatch(q({}, b ? w : R, { type: E, _: { called: E, from: "submethod" } }));
|
|
1974
|
+
}
|
|
1975
|
+
return Promise.resolve(w);
|
|
1976
|
+
});
|
|
1977
|
+
});
|
|
1978
|
+
} catch (T) {
|
|
1979
|
+
return Promise.reject(T);
|
|
1980
|
+
}
|
|
1981
|
+
}, Promise.resolve(n))).then(function(A) {
|
|
1982
|
+
if (!(m.match(St) || m.match(/^registerPlugin/) || m.match(wr) || m.match(br) || m.match(/^params/) || m.match(/^userIdChanged/))) {
|
|
1983
|
+
if (d.plugins.includes(m), A._ && A._.originalAction === m)
|
|
1984
|
+
return A;
|
|
1985
|
+
var D = q({}, A, { _: { originalAction: A.type, called: A.type, from: "engineEnd" } });
|
|
1986
|
+
Qi(A, t.exact.length) && !m.match(/End$/) && (D = q({}, D, { type: A.type + "Aborted" })), a.dispatch(D);
|
|
1987
|
+
}
|
|
1988
|
+
return A;
|
|
1989
|
+
});
|
|
1990
|
+
});
|
|
1991
|
+
} catch (y) {
|
|
1992
|
+
return Promise.reject(y);
|
|
1993
|
+
}
|
|
1994
|
+
}, St = /Start$/, br = /^bootstrap/, wr = /^ready/;
|
|
1995
|
+
function ns(e) {
|
|
1996
|
+
var t = e.pluginName, n = e.method + "Aborted" + (t ? ":" + t : "");
|
|
1997
|
+
e.store.dispatch(q({}, e.data, { type: n, _: { called: n, from: "abort" } }));
|
|
1998
|
+
}
|
|
1999
|
+
function Sr(e, t, n) {
|
|
2000
|
+
var s = t[e] || n[e];
|
|
2001
|
+
return s && s.config ? s.config : {};
|
|
2002
|
+
}
|
|
2003
|
+
function xr(e, t) {
|
|
2004
|
+
return t.reduce(function(n, s) {
|
|
2005
|
+
return s[e] ? n.concat({ methodName: e, pluginName: s.name, method: s[e] }) : n;
|
|
2006
|
+
}, []);
|
|
2007
|
+
}
|
|
2008
|
+
function kr(e, t) {
|
|
2009
|
+
var n = e.replace(St, ""), s = t ? ":" + t : "";
|
|
2010
|
+
return ["" + e + s, "" + n + s, n + "End" + s];
|
|
2011
|
+
}
|
|
2012
|
+
function ss(e, t) {
|
|
2013
|
+
var n = e.abort;
|
|
2014
|
+
return !!n && (n === !0 || Ar(n, t) || n && Ar(n.plugins, t));
|
|
2015
|
+
}
|
|
2016
|
+
function Qi(e, t) {
|
|
2017
|
+
var n = e.abort;
|
|
2018
|
+
if (!n)
|
|
2019
|
+
return !1;
|
|
2020
|
+
if (n === !0 || bt(n))
|
|
2021
|
+
return !0;
|
|
2022
|
+
var s = n.plugins;
|
|
2023
|
+
return tn(n) && n.length === t || tn(s) && s.length === t;
|
|
2024
|
+
}
|
|
2025
|
+
function tn(e) {
|
|
2026
|
+
return Array.isArray(e);
|
|
2027
|
+
}
|
|
2028
|
+
function Ar(e, t) {
|
|
2029
|
+
return !(!e || !tn(e)) && e.includes(t);
|
|
2030
|
+
}
|
|
2031
|
+
function Er(e) {
|
|
2032
|
+
var t = e.match(/(.*):(.*)/);
|
|
2033
|
+
return !!t && { method: t[1], name: t[2] };
|
|
2034
|
+
}
|
|
2035
|
+
function iu(e) {
|
|
2036
|
+
return Object.keys(e).reduce(function(t, n) {
|
|
2037
|
+
return n === "type" || (t[n] = he(e[n]) ? Object.assign({}, e[n]) : e[n]), t;
|
|
2038
|
+
}, {});
|
|
2039
|
+
}
|
|
2040
|
+
function ou(e, t, n) {
|
|
2041
|
+
var s = {};
|
|
2042
|
+
return function(r) {
|
|
2043
|
+
return function(o) {
|
|
2044
|
+
return function(i) {
|
|
2045
|
+
try {
|
|
2046
|
+
var a, d = function(x) {
|
|
2047
|
+
return a ? x : o(m);
|
|
2048
|
+
}, u = i.type, f = i.plugins, m = i;
|
|
2049
|
+
if (i.abort)
|
|
2050
|
+
return Promise.resolve(o(i));
|
|
2051
|
+
if (u === U.enablePlugin && r.dispatch({ type: U.initializeStart, plugins: f, disabled: [], fromEnable: !0, meta: i.meta }), u === U.disablePlugin && setTimeout(function() {
|
|
2052
|
+
return vr(i.meta.rid, { payload: i });
|
|
2053
|
+
}, 0), u === U.initializeEnd) {
|
|
2054
|
+
var b = t(), g = Object.keys(b), O = g.filter(function(x) {
|
|
2055
|
+
return f.includes(x);
|
|
2056
|
+
}).map(function(x) {
|
|
2057
|
+
return b[x];
|
|
2058
|
+
}), C = [], y = [], A = i.disabled, D = O.map(function(x) {
|
|
2059
|
+
var k = x.loaded, F = x.name, T = x.config;
|
|
2060
|
+
return qi(x, function() {
|
|
2061
|
+
return k({ config: T });
|
|
2062
|
+
}, 1e4).then(function(R) {
|
|
2063
|
+
return s[F] || (r.dispatch({ type: U.pluginReadyType(F), name: F, events: Object.keys(x).filter(function(p) {
|
|
2064
|
+
return !ds.includes(p);
|
|
2065
|
+
}) }), s[F] = !0), C = C.concat(F), x;
|
|
2066
|
+
}).catch(function(R) {
|
|
2067
|
+
if (R instanceof Error)
|
|
2068
|
+
throw new Error(R);
|
|
2069
|
+
return y = y.concat(R.name), R;
|
|
2070
|
+
});
|
|
2071
|
+
});
|
|
2072
|
+
Promise.all(D).then(function(x) {
|
|
2073
|
+
var k = { plugins: C, failed: y, disabled: A };
|
|
2074
|
+
setTimeout(function() {
|
|
2075
|
+
g.length === D.length + A.length && r.dispatch(q({}, { type: U.ready }, k));
|
|
2076
|
+
}, 0);
|
|
2077
|
+
});
|
|
2078
|
+
}
|
|
2079
|
+
var B = function() {
|
|
2080
|
+
if (u !== U.bootstrap)
|
|
2081
|
+
return /^ready:([^:]*)$/.test(u) && setTimeout(function() {
|
|
2082
|
+
return $i(r, t, e);
|
|
2083
|
+
}, 0), Promise.resolve(function(x, k, F, T, R) {
|
|
2084
|
+
try {
|
|
2085
|
+
var p = je(k) ? k() : k, v = x.type, I = v.replace(St, "");
|
|
2086
|
+
if (x._ && x._.called)
|
|
2087
|
+
return Promise.resolve(x);
|
|
2088
|
+
var w = F.getState(), j = (Q = p, ($ = w.plugins) === void 0 && ($ = {}), (G = x.options) === void 0 && (G = {}), Object.keys(Q).filter(function(l) {
|
|
2089
|
+
var h = G.plugins || {};
|
|
2090
|
+
return $c(h[l]) ? h[l] : h.all !== !1 && (!$[l] || $[l].enabled !== !1);
|
|
2091
|
+
}).map(function(l) {
|
|
2092
|
+
return Q[l];
|
|
2093
|
+
}));
|
|
2094
|
+
v === U.initializeStart && x.fromEnable && (j = Object.keys(w.plugins).filter(function(l) {
|
|
2095
|
+
var h = w.plugins[l];
|
|
2096
|
+
return x.plugins.includes(l) && !h.initialized;
|
|
2097
|
+
}).map(function(l) {
|
|
2098
|
+
return p[l];
|
|
2099
|
+
}));
|
|
2100
|
+
var E = j.map(function(l) {
|
|
2101
|
+
return l.name;
|
|
2102
|
+
}), S = function(l, h, M) {
|
|
2103
|
+
var V = kr(l).map(function(z) {
|
|
2104
|
+
return xr(z, h);
|
|
2105
|
+
});
|
|
2106
|
+
return h.reduce(function(z, W) {
|
|
2107
|
+
var oe = W.name, J = kr(l, oe).map(function(Kt) {
|
|
2108
|
+
return xr(Kt, h);
|
|
2109
|
+
}), se = J[0], H = J[1], Pe = J[2];
|
|
2110
|
+
return se.length && (z.beforeNS[oe] = se), H.length && (z.duringNS[oe] = H), Pe.length && (z.afterNS[oe] = Pe), z;
|
|
2111
|
+
}, { before: V[0], beforeNS: {}, during: V[1], duringNS: {}, after: V[2], afterNS: {} });
|
|
2112
|
+
}(v, j);
|
|
2113
|
+
return Promise.resolve(ts({ action: x, data: { exact: S.before, namespaced: S.beforeNS }, state: w, allPlugins: p, allMatches: S, instance: F, store: T, EVENTS: R })).then(function(l) {
|
|
2114
|
+
function h() {
|
|
2115
|
+
var z = function() {
|
|
2116
|
+
if (v.match(St))
|
|
2117
|
+
return Promise.resolve(ts({ action: q({}, M, { type: I + "End" }), data: { exact: S.after, namespaced: S.afterNS }, state: w, allPlugins: p, allMatches: S, instance: F, store: T, EVENTS: R })).then(function(W) {
|
|
2118
|
+
W.meta && W.meta.hasCallback && vr(W.meta.rid, { payload: W });
|
|
2119
|
+
});
|
|
2120
|
+
}();
|
|
2121
|
+
return z && z.then ? z.then(function() {
|
|
2122
|
+
return l;
|
|
2123
|
+
}) : l;
|
|
2124
|
+
}
|
|
2125
|
+
if (Qi(l, E.length))
|
|
2126
|
+
return l;
|
|
2127
|
+
var M, V = function() {
|
|
2128
|
+
if (v !== I)
|
|
2129
|
+
return Promise.resolve(ts({ action: q({}, l, { type: I }), data: { exact: S.during, namespaced: S.duringNS }, state: w, allPlugins: p, allMatches: S, instance: F, store: T, EVENTS: R })).then(function(z) {
|
|
2130
|
+
M = z;
|
|
2131
|
+
});
|
|
2132
|
+
M = l;
|
|
2133
|
+
}();
|
|
2134
|
+
return V && V.then ? V.then(h) : h();
|
|
2135
|
+
});
|
|
2136
|
+
} catch (l) {
|
|
2137
|
+
return Promise.reject(l);
|
|
2138
|
+
}
|
|
2139
|
+
var Q, $, G;
|
|
2140
|
+
}(i, t, e, r, n)).then(function(x) {
|
|
2141
|
+
return a = 1, o(x);
|
|
2142
|
+
});
|
|
2143
|
+
}();
|
|
2144
|
+
return Promise.resolve(B && B.then ? B.then(d) : d(B));
|
|
2145
|
+
} catch (x) {
|
|
2146
|
+
return Promise.reject(x);
|
|
2147
|
+
}
|
|
2148
|
+
};
|
|
2149
|
+
};
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
function au(e) {
|
|
2153
|
+
return function(t) {
|
|
2154
|
+
return function(n) {
|
|
2155
|
+
return function(s) {
|
|
2156
|
+
var r = s.type, o = s.key, i = s.value, a = s.options;
|
|
2157
|
+
if (r === U.setItem || r === U.removeItem) {
|
|
2158
|
+
if (s.abort)
|
|
2159
|
+
return n(s);
|
|
2160
|
+
r === U.setItem ? e.setItem(o, i, a) : e.removeItem(o, a);
|
|
2161
|
+
}
|
|
2162
|
+
return n(s);
|
|
2163
|
+
};
|
|
2164
|
+
};
|
|
2165
|
+
};
|
|
2166
|
+
}
|
|
2167
|
+
var cu = function() {
|
|
2168
|
+
var e = this;
|
|
2169
|
+
this.before = [], this.after = [], this.addMiddleware = function(t, n) {
|
|
2170
|
+
e[n] = e[n].concat(t);
|
|
2171
|
+
}, this.removeMiddleware = function(t, n) {
|
|
2172
|
+
var s = e[n].findIndex(function(r) {
|
|
2173
|
+
return r === t;
|
|
2174
|
+
});
|
|
2175
|
+
s !== -1 && (e[n] = [].concat(e[n].slice(0, s), e[n].slice(s + 1)));
|
|
2176
|
+
}, this.dynamicMiddlewares = function(t) {
|
|
2177
|
+
return function(n) {
|
|
2178
|
+
return function(s) {
|
|
2179
|
+
return function(r) {
|
|
2180
|
+
var o = { getState: n.getState, dispatch: function(a) {
|
|
2181
|
+
return n.dispatch(a);
|
|
2182
|
+
} }, i = e[t].map(function(a) {
|
|
2183
|
+
return a(o);
|
|
2184
|
+
});
|
|
2185
|
+
return Ut.apply(void 0, i)(s)(r);
|
|
2186
|
+
};
|
|
2187
|
+
};
|
|
2188
|
+
};
|
|
2189
|
+
};
|
|
2190
|
+
};
|
|
2191
|
+
function uu(e) {
|
|
2192
|
+
return function(t, n) {
|
|
2193
|
+
t === void 0 && (t = {});
|
|
2194
|
+
var s = {};
|
|
2195
|
+
if (n.type === "initialize:aborted")
|
|
2196
|
+
return t;
|
|
2197
|
+
if (/^registerPlugin:([^:]*)$/.test(n.type)) {
|
|
2198
|
+
var r = Pr(n.type, "registerPlugin"), o = e()[r];
|
|
2199
|
+
if (!o || !r)
|
|
2200
|
+
return t;
|
|
2201
|
+
var i = n.enabled, a = o.config;
|
|
2202
|
+
return s[r] = { enabled: i, initialized: !!i && !o.initialize, loaded: !!i && !!o.loaded({ config: a }), config: a }, q({}, t, s);
|
|
2203
|
+
}
|
|
2204
|
+
if (/^initialize:([^:]*)$/.test(n.type)) {
|
|
2205
|
+
var d = Pr(n.type, U.initialize), u = e()[d];
|
|
2206
|
+
return u && d ? (s[d] = q({}, t[d], { initialized: !0, loaded: !!u.loaded({ config: u.config }) }), q({}, t, s)) : t;
|
|
2207
|
+
}
|
|
2208
|
+
if (/^ready:([^:]*)$/.test(n.type))
|
|
2209
|
+
return s[n.name] = q({}, t[n.name], { loaded: !0 }), q({}, t, s);
|
|
2210
|
+
switch (n.type) {
|
|
2211
|
+
case U.disablePlugin:
|
|
2212
|
+
return q({}, t, Or(n.plugins, !1, t));
|
|
2213
|
+
case U.enablePlugin:
|
|
2214
|
+
return q({}, t, Or(n.plugins, !0, t));
|
|
2215
|
+
default:
|
|
2216
|
+
return t;
|
|
2217
|
+
}
|
|
2218
|
+
};
|
|
2219
|
+
}
|
|
2220
|
+
function Pr(e, t) {
|
|
2221
|
+
return e.substring(t.length + 1, e.length);
|
|
2222
|
+
}
|
|
2223
|
+
function Or(e, t, n) {
|
|
2224
|
+
return e.reduce(function(s, r) {
|
|
2225
|
+
return s[r] = q({}, n[r], { enabled: t }), s;
|
|
2226
|
+
}, n);
|
|
2227
|
+
}
|
|
2228
|
+
function Vi(e) {
|
|
2229
|
+
try {
|
|
2230
|
+
return JSON.parse(JSON.stringify(e));
|
|
2231
|
+
} catch {
|
|
2232
|
+
}
|
|
2233
|
+
return e;
|
|
2234
|
+
}
|
|
2235
|
+
var lu = { last: {}, history: [] };
|
|
2236
|
+
function du(e, t) {
|
|
2237
|
+
e === void 0 && (e = lu);
|
|
2238
|
+
var n = t.options, s = t.meta;
|
|
2239
|
+
if (t.type === U.track) {
|
|
2240
|
+
var r = Vi(q({ event: t.event, properties: t.properties }, Object.keys(n).length && { options: n }, { meta: s }));
|
|
2241
|
+
return q({}, e, { last: r, history: e.history.concat(r) });
|
|
2242
|
+
}
|
|
2243
|
+
return e;
|
|
2244
|
+
}
|
|
2245
|
+
var fu = { actions: [] };
|
|
2246
|
+
function hu(e, t) {
|
|
2247
|
+
e === void 0 && (e = fu);
|
|
2248
|
+
var n = t.payload;
|
|
2249
|
+
switch (t.type) {
|
|
2250
|
+
case "queue":
|
|
2251
|
+
var s;
|
|
2252
|
+
return s = n && n.type && n.type === U.identify ? [t].concat(e.actions) : e.actions.concat(t), q({}, e, { actions: s });
|
|
2253
|
+
case "dequeue":
|
|
2254
|
+
return [];
|
|
2255
|
+
default:
|
|
2256
|
+
return e;
|
|
2257
|
+
}
|
|
2258
|
+
}
|
|
2259
|
+
var Ki = /#.*$/;
|
|
2260
|
+
function pu(e) {
|
|
2261
|
+
var t = /(http[s]?:\/\/)?([^\/\s]+\/)(.*)/g.exec(e);
|
|
2262
|
+
return "/" + (t && t[3] ? t[3].split("?")[0].replace(Ki, "") : "");
|
|
2263
|
+
}
|
|
2264
|
+
var zi, Gi, Wi, Hi, mu = function(e) {
|
|
2265
|
+
if (e === void 0 && (e = {}), !Ee)
|
|
2266
|
+
return e;
|
|
2267
|
+
var t = document, n = t.title, s = t.referrer, r = window, o = r.location, i = r.innerWidth, a = r.innerHeight, d = o.hash, u = o.search, f = function(b) {
|
|
2268
|
+
var g = function() {
|
|
2269
|
+
if (Ee) {
|
|
2270
|
+
for (var O, C = document.getElementsByTagName("link"), y = 0; O = C[y]; y++)
|
|
2271
|
+
if (O.getAttribute("rel") === "canonical")
|
|
2272
|
+
return O.getAttribute("href");
|
|
2273
|
+
}
|
|
2274
|
+
}();
|
|
2275
|
+
return g ? g.match(/\?/) ? g : g + b : window.location.href.replace(Ki, "");
|
|
2276
|
+
}(u), m = { title: n, url: f, path: pu(f), hash: d, search: u, width: i, height: a };
|
|
2277
|
+
return s && s !== "" && (m.referrer = s), q({}, m, e);
|
|
2278
|
+
}, gu = { last: {}, history: [] };
|
|
2279
|
+
function yu(e, t) {
|
|
2280
|
+
e === void 0 && (e = gu);
|
|
2281
|
+
var n = t.options;
|
|
2282
|
+
if (t.type === U.page) {
|
|
2283
|
+
var s = Vi(q({ properties: t.properties, meta: t.meta }, Object.keys(n).length && { options: n }));
|
|
2284
|
+
return q({}, e, { last: s, history: e.history.concat(s) });
|
|
2285
|
+
}
|
|
2286
|
+
return e;
|
|
2287
|
+
}
|
|
2288
|
+
zi = function() {
|
|
2289
|
+
if (!Ee)
|
|
2290
|
+
return !1;
|
|
2291
|
+
var e = navigator.appVersion;
|
|
2292
|
+
return ~e.indexOf("Win") ? "Windows" : ~e.indexOf("Mac") ? "MacOS" : ~e.indexOf("X11") ? "UNIX" : ~e.indexOf("Linux") ? "Linux" : "Unknown OS";
|
|
2293
|
+
}(), Gi = Ee ? document.referrer : null, Wi = Hc(), Hi = Jc();
|
|
2294
|
+
var _r = { initialized: !1, sessionId: Kn(), app: null, version: null, debug: !1, offline: !!Ee && !navigator.onLine, os: { name: zi }, userAgent: Ee ? navigator.userAgent : "node", library: { name: "analytics", version: "0.12.5" }, timezone: Hi, locale: Wi, campaign: {}, referrer: Gi };
|
|
2295
|
+
function vu(e, t) {
|
|
2296
|
+
e === void 0 && (e = _r);
|
|
2297
|
+
var n = e.initialized, s = t.campaign;
|
|
2298
|
+
switch (t.type) {
|
|
2299
|
+
case U.campaign:
|
|
2300
|
+
return q({}, e, { campaign: s });
|
|
2301
|
+
case U.offline:
|
|
2302
|
+
return q({}, e, { offline: !0 });
|
|
2303
|
+
case U.online:
|
|
2304
|
+
return q({}, e, { offline: !1 });
|
|
2305
|
+
default:
|
|
2306
|
+
return n ? e : q({}, _r, e, { initialized: !0 });
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
var bu = ["plugins", "reducers", "storage"];
|
|
2310
|
+
function wu(e, t, n) {
|
|
2311
|
+
if (Ee) {
|
|
2312
|
+
var s = window[(n ? "add" : "remove") + "EventListener"];
|
|
2313
|
+
e.split(" ").forEach(function(r) {
|
|
2314
|
+
s(r, t);
|
|
2315
|
+
});
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
function Su(e) {
|
|
2319
|
+
var t = wu.bind(null, "online offline", function(n) {
|
|
2320
|
+
return Promise.resolve(!navigator.onLine).then(e);
|
|
2321
|
+
});
|
|
2322
|
+
return t(!0), function(n) {
|
|
2323
|
+
return t(!1);
|
|
2324
|
+
};
|
|
2325
|
+
}
|
|
2326
|
+
function Ji() {
|
|
2327
|
+
return ht("analytics", []), function(e) {
|
|
2328
|
+
return function(t, n, s) {
|
|
2329
|
+
var r = e(t, n, s), o = r.dispatch;
|
|
2330
|
+
return Object.assign(r, { dispatch: function(i) {
|
|
2331
|
+
return Ft[Tt].analytics.push(i.action || i), o(i);
|
|
2332
|
+
} });
|
|
2333
|
+
};
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2336
|
+
function Cr(e) {
|
|
2337
|
+
return function() {
|
|
2338
|
+
return Ut(Ut.apply(null, arguments), Ji());
|
|
2339
|
+
};
|
|
2340
|
+
}
|
|
2341
|
+
function rs(e) {
|
|
2342
|
+
return e ? Vc(e) ? e : [e] : [];
|
|
2343
|
+
}
|
|
2344
|
+
function Ir(e, t, n) {
|
|
2345
|
+
e === void 0 && (e = {});
|
|
2346
|
+
var s, r, o = Kn();
|
|
2347
|
+
return t && (Wt[o] = (s = t, r = function(i) {
|
|
2348
|
+
for (var a, d = i || Array.prototype.slice.call(arguments), u = 0; u < d.length; u++)
|
|
2349
|
+
if (je(d[u])) {
|
|
2350
|
+
a = d[u];
|
|
2351
|
+
break;
|
|
2352
|
+
}
|
|
2353
|
+
return a;
|
|
2354
|
+
}(n), function(i) {
|
|
2355
|
+
r && r(i), s(i);
|
|
2356
|
+
})), q({}, e, { rid: o, ts: (/* @__PURE__ */ new Date()).getTime() }, t ? { hasCallback: !0 } : {});
|
|
2357
|
+
}
|
|
2358
|
+
function xu(e) {
|
|
2359
|
+
e === void 0 && (e = {});
|
|
2360
|
+
var t = e.reducers || {}, n = e.initialUser || {}, s = (e.plugins || []).reduce(function(l, h) {
|
|
2361
|
+
if (je(h))
|
|
2362
|
+
return l.middlewares = l.middlewares.concat(h), l;
|
|
2363
|
+
if (h.NAMESPACE && (h.name = h.NAMESPACE), !h.name)
|
|
2364
|
+
throw new Error("https://lytics.dev/errors/1");
|
|
2365
|
+
h.config || (h.config = {});
|
|
2366
|
+
var M = h.EVENTS ? Object.keys(h.EVENTS).map(function(W) {
|
|
2367
|
+
return h.EVENTS[W];
|
|
2368
|
+
}) : [];
|
|
2369
|
+
l.pluginEnabled[h.name] = !(h.enabled === !1 || h.config.enabled === !1), delete h.enabled, h.methods && (l.methods[h.name] = Object.keys(h.methods).reduce(function(W, oe) {
|
|
2370
|
+
var J;
|
|
2371
|
+
return W[oe] = (J = h.methods[oe], function() {
|
|
2372
|
+
for (var se = Array.prototype.slice.call(arguments), H = new Array(J.length), Pe = 0; Pe < se.length; Pe++)
|
|
2373
|
+
H[Pe] = se[Pe];
|
|
2374
|
+
return H[H.length] = k, J.apply({ instance: k }, H);
|
|
2375
|
+
}), W;
|
|
2376
|
+
}, {}), delete h.methods);
|
|
2377
|
+
var V = Object.keys(h).concat(M), z = new Set(l.events.concat(V));
|
|
2378
|
+
if (l.events = Array.from(z), l.pluginsArray = l.pluginsArray.concat(h), l.plugins[h.name])
|
|
2379
|
+
throw new Error(h.name + "AlreadyLoaded");
|
|
2380
|
+
return l.plugins[h.name] = h, l.plugins[h.name].loaded || (l.plugins[h.name].loaded = function() {
|
|
2381
|
+
return !0;
|
|
2382
|
+
}), l;
|
|
2383
|
+
}, { plugins: {}, pluginEnabled: {}, methods: {}, pluginsArray: [], middlewares: [], events: [] }), r = e.storage ? e.storage : { getItem: ft, setItem: ht, removeItem: Qt }, o = function(l) {
|
|
2384
|
+
return function(h, M, V) {
|
|
2385
|
+
return M.getState("user")[h] || (V && he(V) && V[h] ? V[h] : yr(l)[h] || ft(fs(h)) || null);
|
|
2386
|
+
};
|
|
2387
|
+
}(r), i = s.plugins, a = s.events.filter(function(l) {
|
|
2388
|
+
return !ds.includes(l);
|
|
2389
|
+
}).sort(), d = new Set(a.concat(In).filter(function(l) {
|
|
2390
|
+
return !ds.includes(l);
|
|
2391
|
+
})), u = Array.from(d).sort(), f = function() {
|
|
2392
|
+
return i;
|
|
2393
|
+
}, m = new cu(), b = m.addMiddleware, g = m.removeMiddleware, O = m.dynamicMiddlewares, C = function() {
|
|
2394
|
+
throw new Error("Abort disabled inListener");
|
|
2395
|
+
}, y = Xc(), A = yr(r), D = q({}, A, n, y.an_uid ? { userId: y.an_uid } : {}, y.an_aid ? { anonymousId: y.an_aid } : {});
|
|
2396
|
+
D.anonymousId || (D.anonymousId = Kn());
|
|
2397
|
+
var B = q({ enable: function(l, h) {
|
|
2398
|
+
return new Promise(function(M) {
|
|
2399
|
+
S.dispatch({ type: U.enablePlugin, plugins: rs(l), _: { originalAction: U.enablePlugin } }, M, [h]);
|
|
2400
|
+
});
|
|
2401
|
+
}, disable: function(l, h) {
|
|
2402
|
+
return new Promise(function(M) {
|
|
2403
|
+
S.dispatch({ type: U.disablePlugin, plugins: rs(l), _: { originalAction: U.disablePlugin } }, M, [h]);
|
|
2404
|
+
});
|
|
2405
|
+
} }, s.methods), x = !1, k = { identify: function(l, h, M, V) {
|
|
2406
|
+
try {
|
|
2407
|
+
var z = bt(l) ? l : null, W = he(l) ? l : h, oe = M || {}, J = k.user();
|
|
2408
|
+
ht(fs(Te), z);
|
|
2409
|
+
var se = z || W.userId || o(Te, k, W);
|
|
2410
|
+
return Promise.resolve(new Promise(function(H) {
|
|
2411
|
+
S.dispatch(q({ type: U.identifyStart, userId: se, traits: W || {}, options: oe, anonymousId: J.anonymousId }, J.id && J.id !== z && { previousId: J.id }), H, [h, M, V]);
|
|
2412
|
+
}));
|
|
2413
|
+
} catch (H) {
|
|
2414
|
+
return Promise.reject(H);
|
|
2415
|
+
}
|
|
2416
|
+
}, track: function(l, h, M, V) {
|
|
2417
|
+
try {
|
|
2418
|
+
var z = he(l) ? l.event : l;
|
|
2419
|
+
if (!z || !bt(z))
|
|
2420
|
+
throw new Error("EventMissing");
|
|
2421
|
+
var W = he(l) ? l : h || {}, oe = he(M) ? M : {};
|
|
2422
|
+
return Promise.resolve(new Promise(function(J) {
|
|
2423
|
+
S.dispatch({ type: U.trackStart, event: z, properties: W, options: oe, userId: o(Te, k, h), anonymousId: o(vt, k, h) }, J, [h, M, V]);
|
|
2424
|
+
}));
|
|
2425
|
+
} catch (J) {
|
|
2426
|
+
return Promise.reject(J);
|
|
2427
|
+
}
|
|
2428
|
+
}, page: function(l, h, M) {
|
|
2429
|
+
try {
|
|
2430
|
+
var V = he(l) ? l : {}, z = he(h) ? h : {};
|
|
2431
|
+
return Promise.resolve(new Promise(function(W) {
|
|
2432
|
+
S.dispatch({ type: U.pageStart, properties: mu(V), options: z, userId: o(Te, k, V), anonymousId: o(vt, k, V) }, W, [l, h, M]);
|
|
2433
|
+
}));
|
|
2434
|
+
} catch (W) {
|
|
2435
|
+
return Promise.reject(W);
|
|
2436
|
+
}
|
|
2437
|
+
}, user: function(l) {
|
|
2438
|
+
if (l === Te || l === "id")
|
|
2439
|
+
return o(Te, k);
|
|
2440
|
+
if (l === vt || l === "anonId")
|
|
2441
|
+
return o(vt, k);
|
|
2442
|
+
var h = k.getState("user");
|
|
2443
|
+
return l ? lr(h, l) : h;
|
|
2444
|
+
}, reset: function(l) {
|
|
2445
|
+
return new Promise(function(h) {
|
|
2446
|
+
S.dispatch({ type: U.resetStart }, h, l);
|
|
2447
|
+
});
|
|
2448
|
+
}, ready: function(l) {
|
|
2449
|
+
return x && l({ plugins: B, instance: k }), k.on(U.ready, function(h) {
|
|
2450
|
+
l(h), x = !0;
|
|
2451
|
+
});
|
|
2452
|
+
}, on: function(l, h) {
|
|
2453
|
+
if (!l || !je(h))
|
|
2454
|
+
return !1;
|
|
2455
|
+
if (l === U.bootstrap)
|
|
2456
|
+
throw new Error(".on disabled for " + l);
|
|
2457
|
+
var M = /Start$|Start:/;
|
|
2458
|
+
if (l === "*") {
|
|
2459
|
+
var V = function(J) {
|
|
2460
|
+
return function(se) {
|
|
2461
|
+
return function(H) {
|
|
2462
|
+
return H.type.match(M) && h({ payload: H, instance: k, plugins: i }), se(H);
|
|
2463
|
+
};
|
|
2464
|
+
};
|
|
2465
|
+
}, z = function(J) {
|
|
2466
|
+
return function(se) {
|
|
2467
|
+
return function(H) {
|
|
2468
|
+
return H.type.match(M) || h({ payload: H, instance: k, plugins: i }), se(H);
|
|
2469
|
+
};
|
|
2470
|
+
};
|
|
2471
|
+
};
|
|
2472
|
+
return b(V, Pn), b(z, On), function() {
|
|
2473
|
+
g(V, Pn), g(z, On);
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
var W = l.match(M) ? Pn : On, oe = function(J) {
|
|
2477
|
+
return function(se) {
|
|
2478
|
+
return function(H) {
|
|
2479
|
+
return H.type === l && h({ payload: H, instance: k, plugins: i, abort: C }), se(H);
|
|
2480
|
+
};
|
|
2481
|
+
};
|
|
2482
|
+
};
|
|
2483
|
+
return b(oe, W), function() {
|
|
2484
|
+
return g(oe, W);
|
|
2485
|
+
};
|
|
2486
|
+
}, once: function(l, h) {
|
|
2487
|
+
if (!l || !je(h))
|
|
2488
|
+
return !1;
|
|
2489
|
+
if (l === U.bootstrap)
|
|
2490
|
+
throw new Error(".once disabled for " + l);
|
|
2491
|
+
var M = k.on(l, function(V) {
|
|
2492
|
+
h({ payload: V.payload, instance: k, plugins: i, abort: C }), M();
|
|
2493
|
+
});
|
|
2494
|
+
return M;
|
|
2495
|
+
}, getState: function(l) {
|
|
2496
|
+
var h = S.getState();
|
|
2497
|
+
return l ? lr(h, l) : Object.assign({}, h);
|
|
2498
|
+
}, dispatch: function(l) {
|
|
2499
|
+
var h = bt(l) ? { type: l } : l;
|
|
2500
|
+
if (In.includes(h.type))
|
|
2501
|
+
throw new Error("reserved action " + h.type);
|
|
2502
|
+
var M = q({}, h, { _: q({ originalAction: h.type }, l._ || {}) });
|
|
2503
|
+
S.dispatch(M);
|
|
2504
|
+
}, enablePlugin: B.enable, disablePlugin: B.disable, plugins: B, storage: { getItem: r.getItem, setItem: function(l, h, M) {
|
|
2505
|
+
S.dispatch({ type: U.setItemStart, key: l, value: h, options: M });
|
|
2506
|
+
}, removeItem: function(l, h) {
|
|
2507
|
+
S.dispatch({ type: U.removeItemStart, key: l, options: h });
|
|
2508
|
+
} }, setAnonymousId: function(l, h) {
|
|
2509
|
+
k.storage.setItem(Je, l, h);
|
|
2510
|
+
}, events: { core: In, plugins: a } }, F = s.middlewares.concat([function(l) {
|
|
2511
|
+
return function(h) {
|
|
2512
|
+
return function(M) {
|
|
2513
|
+
return M.meta || (M.meta = Ir()), h(M);
|
|
2514
|
+
};
|
|
2515
|
+
};
|
|
2516
|
+
}, O(Pn), ou(k, f, { all: u, plugins: a }), au(r), nu(k), ru(k), O(On)]), T = { context: vu, user: su(r), page: yu, track: du, plugins: uu(f), queue: hu }, R = Ut, p = Ut;
|
|
2517
|
+
if (Ee && e.debug) {
|
|
2518
|
+
var v = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__;
|
|
2519
|
+
v && (R = v({ trace: !0, traceLimit: 25 })), p = function() {
|
|
2520
|
+
return arguments.length === 0 ? Ji() : he(typeof arguments[0]) ? Cr() : Cr().apply(null, arguments);
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2523
|
+
var I, w = function(l) {
|
|
2524
|
+
return Object.keys(l).reduce(function(h, M) {
|
|
2525
|
+
return bu.includes(M) || (h[M] = l[M]), h;
|
|
2526
|
+
}, {});
|
|
2527
|
+
}(e), j = s.pluginsArray.reduce(function(l, h) {
|
|
2528
|
+
var M = h.name, V = h.config, z = h.loaded, W = s.pluginEnabled[M];
|
|
2529
|
+
return l[M] = { enabled: W, initialized: !!W && !h.initialize, loaded: !!z({ config: V }), config: V }, l;
|
|
2530
|
+
}, {}), E = { context: w, user: D, plugins: j }, S = Ui(function(l) {
|
|
2531
|
+
for (var h = Object.keys(l), M = {}, V = 0; V < h.length; V++) {
|
|
2532
|
+
var z = h[V];
|
|
2533
|
+
typeof l[z] === Ue && (M[z] = l[z]);
|
|
2534
|
+
}
|
|
2535
|
+
var W, oe = Object.keys(M);
|
|
2536
|
+
try {
|
|
2537
|
+
(function(J) {
|
|
2538
|
+
Object.keys(J).forEach(function(se) {
|
|
2539
|
+
var H = J[se];
|
|
2540
|
+
if (typeof H(void 0, { type: "@@redux/INIT" }) === De || typeof H(void 0, { type: Zc }) === De)
|
|
2541
|
+
throw new Error("reducer " + se + " " + De);
|
|
2542
|
+
});
|
|
2543
|
+
})(M);
|
|
2544
|
+
} catch (J) {
|
|
2545
|
+
W = J;
|
|
2546
|
+
}
|
|
2547
|
+
return function(J, se) {
|
|
2548
|
+
if (J === void 0 && (J = {}), W)
|
|
2549
|
+
throw W;
|
|
2550
|
+
for (var H = !1, Pe = {}, Kt = 0; Kt < oe.length; Kt++) {
|
|
2551
|
+
var bn = oe[Kt], zs = J[bn], Xn = (0, M[bn])(zs, se);
|
|
2552
|
+
if (typeof Xn === De) {
|
|
2553
|
+
var fo = eu(bn, se);
|
|
2554
|
+
throw new Error(fo);
|
|
2555
|
+
}
|
|
2556
|
+
Pe[bn] = Xn, H = H || Xn !== zs;
|
|
2557
|
+
}
|
|
2558
|
+
return H ? Pe : J;
|
|
2559
|
+
};
|
|
2560
|
+
}(q({}, T, t)), E, p(R(tu.apply(void 0, F))));
|
|
2561
|
+
S.dispatch = (I = S.dispatch, function(l, h, M) {
|
|
2562
|
+
var V = q({}, l, { meta: Ir(l.meta, h, rs(M)) });
|
|
2563
|
+
return I.apply(null, [V]);
|
|
2564
|
+
});
|
|
2565
|
+
var Q = Object.keys(i);
|
|
2566
|
+
S.dispatch({ type: U.bootstrap, plugins: Q, config: w, params: y, user: D, initialUser: n, persistedUser: A });
|
|
2567
|
+
var $ = Q.filter(function(l) {
|
|
2568
|
+
return s.pluginEnabled[l];
|
|
2569
|
+
}), G = Q.filter(function(l) {
|
|
2570
|
+
return !s.pluginEnabled[l];
|
|
2571
|
+
});
|
|
2572
|
+
return S.dispatch({ type: U.registerPlugins, plugins: Q, enabled: s.pluginEnabled }), s.pluginsArray.map(function(l, h) {
|
|
2573
|
+
var M = l.bootstrap, V = l.config, z = l.name;
|
|
2574
|
+
M && je(M) && M({ instance: k, config: V, payload: l }), S.dispatch({ type: U.registerPluginType(z), name: z, enabled: s.pluginEnabled[z], plugin: l }), s.pluginsArray.length === h + 1 && S.dispatch({ type: U.initializeStart, plugins: $, disabled: G });
|
|
2575
|
+
}), Su(function(l) {
|
|
2576
|
+
S.dispatch({ type: l ? U.offline : U.online });
|
|
2577
|
+
}), function(l, h, M) {
|
|
2578
|
+
setInterval(function() {
|
|
2579
|
+
return $i(l, h, M);
|
|
2580
|
+
}, 3e3);
|
|
2581
|
+
}(S, f, k), k;
|
|
2582
|
+
}
|
|
2583
|
+
var Pn = "before", On = "after", Xt = "cookie", Ye = Zi(), Xi = zn, ku = zn;
|
|
2584
|
+
function Yi(e) {
|
|
2585
|
+
return Ye ? zn(e, "", -1) : Qt(e);
|
|
2586
|
+
}
|
|
2587
|
+
function Zi() {
|
|
2588
|
+
if (Ye !== void 0)
|
|
2589
|
+
return Ye;
|
|
2590
|
+
var e = "cookiecookie";
|
|
2591
|
+
try {
|
|
2592
|
+
zn(e, e), Ye = document.cookie.indexOf(e) !== -1, Yi(e);
|
|
2593
|
+
} catch {
|
|
2594
|
+
Ye = !1;
|
|
2595
|
+
}
|
|
2596
|
+
return Ye;
|
|
2597
|
+
}
|
|
2598
|
+
function zn(e, t, n, s, r, o) {
|
|
2599
|
+
if (typeof window < "u") {
|
|
2600
|
+
var i = arguments.length > 1;
|
|
2601
|
+
return Ye === !1 && (i ? ht(e, t) : ft(e)), i ? document.cookie = e + "=" + encodeURIComponent(t) + (n ? "; expires=" + new Date(+/* @__PURE__ */ new Date() + 1e3 * n).toUTCString() + (s ? "; path=" + s : "") + (r ? "; domain=" + r : "") + (o ? "; secure" : "") : "") : decodeURIComponent((("; " + document.cookie).split("; " + e + "=")[1] || "").split(";")[0]);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
var Yt = "localStorage", Au = Ls.bind(null, "localStorage");
|
|
2605
|
+
Vt("localStorage", "getItem", ft);
|
|
2606
|
+
Vt("localStorage", "setItem", ht);
|
|
2607
|
+
Vt("localStorage", "removeItem", Qt);
|
|
2608
|
+
var Zt = "sessionStorage", Eu = Ls.bind(null, "sessionStorage");
|
|
2609
|
+
Vt("sessionStorage", "getItem", ft);
|
|
2610
|
+
Vt("sessionStorage", "setItem", ht);
|
|
2611
|
+
Vt("sessionStorage", "removeItem", Qt);
|
|
2612
|
+
function xt(e) {
|
|
2613
|
+
var t = e;
|
|
2614
|
+
try {
|
|
2615
|
+
if ((t = JSON.parse(e)) === "true")
|
|
2616
|
+
return !0;
|
|
2617
|
+
if (t === "false")
|
|
2618
|
+
return !1;
|
|
2619
|
+
if (he(t))
|
|
2620
|
+
return t;
|
|
2621
|
+
parseFloat(t) === t && (t = parseFloat(t));
|
|
2622
|
+
} catch {
|
|
2623
|
+
}
|
|
2624
|
+
if (t !== null && t !== "")
|
|
2625
|
+
return t;
|
|
2626
|
+
}
|
|
2627
|
+
var Pu = Au(), Ou = Eu(), _u = Zi();
|
|
2628
|
+
function eo(e, t) {
|
|
2629
|
+
if (e) {
|
|
2630
|
+
var n = Ns(t), s = !qs(n), r = Ts(n) ? xt(localStorage.getItem(e)) : void 0;
|
|
2631
|
+
if (s && !yt(r))
|
|
2632
|
+
return r;
|
|
2633
|
+
var o = Fs(n) ? xt(Xi(e)) : void 0;
|
|
2634
|
+
if (s && o)
|
|
2635
|
+
return o;
|
|
2636
|
+
var i = Us(n) ? xt(sessionStorage.getItem(e)) : void 0;
|
|
2637
|
+
if (s && i)
|
|
2638
|
+
return i;
|
|
2639
|
+
var a = ft(e);
|
|
2640
|
+
return s ? a : { localStorage: r, sessionStorage: i, cookie: o, global: a };
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
function Cu(e, t, n) {
|
|
2644
|
+
if (e && !yt(t)) {
|
|
2645
|
+
var s = {}, r = Ns(n), o = JSON.stringify(t), i = !qs(r);
|
|
2646
|
+
return Ts(r) && (s[Yt] = _n(Yt, t, xt(localStorage.getItem(e))), localStorage.setItem(e, o), i) ? s[Yt] : Fs(r) && (s[Xt] = _n(Xt, t, xt(Xi(e))), ku(e, o), i) ? s[Xt] : Us(r) && (s[Zt] = _n(Zt, t, xt(sessionStorage.getItem(e))), sessionStorage.setItem(e, o), i) ? s[Zt] : (s[Jt] = _n(Jt, t, ft(e)), ht(e, t), i ? s[Jt] : s);
|
|
2647
|
+
}
|
|
2648
|
+
}
|
|
2649
|
+
function Iu(e, t) {
|
|
2650
|
+
if (e) {
|
|
2651
|
+
var n = Ns(t), s = eo(e, Li), r = {};
|
|
2652
|
+
return !yt(s.localStorage) && Ts(n) && (localStorage.removeItem(e), r[Yt] = s.localStorage), !yt(s.cookie) && Fs(n) && (Yi(e), r[Xt] = s.cookie), !yt(s.sessionStorage) && Us(n) && (sessionStorage.removeItem(e), r[Zt] = s.sessionStorage), !yt(s.global) && Gn(n, Jt) && (Qt(e), r[Jt] = s.global), r;
|
|
2653
|
+
}
|
|
2654
|
+
}
|
|
2655
|
+
function Ns(e) {
|
|
2656
|
+
return e ? bt(e) ? e : e.storage : Mi;
|
|
2657
|
+
}
|
|
2658
|
+
function Ts(e) {
|
|
2659
|
+
return Pu && Gn(e, Yt);
|
|
2660
|
+
}
|
|
2661
|
+
function Fs(e) {
|
|
2662
|
+
return _u && Gn(e, Xt);
|
|
2663
|
+
}
|
|
2664
|
+
function Us(e) {
|
|
2665
|
+
return Ou && Gn(e, Zt);
|
|
2666
|
+
}
|
|
2667
|
+
function qs(e) {
|
|
2668
|
+
return e === Li || e === "all";
|
|
2669
|
+
}
|
|
2670
|
+
function Gn(e, t) {
|
|
2671
|
+
return e === Mi || e === t || qs(e);
|
|
2672
|
+
}
|
|
2673
|
+
function _n(e, t, n) {
|
|
2674
|
+
return { location: e, current: t, previous: n };
|
|
2675
|
+
}
|
|
2676
|
+
var ju = { setItem: Cu, getItem: eo, removeItem: Iu };
|
|
2677
|
+
function Bu(e, t, n) {
|
|
2678
|
+
return t in e ? Object.defineProperty(e, t, {
|
|
2679
|
+
value: n,
|
|
2680
|
+
enumerable: !0,
|
|
2681
|
+
configurable: !0,
|
|
2682
|
+
writable: !0
|
|
2683
|
+
}) : e[t] = n, e;
|
|
2684
|
+
}
|
|
2685
|
+
function jr(e, t) {
|
|
2686
|
+
var n = Object.keys(e);
|
|
2687
|
+
if (Object.getOwnPropertySymbols) {
|
|
2688
|
+
var s = Object.getOwnPropertySymbols(e);
|
|
2689
|
+
t && (s = s.filter(function(r) {
|
|
2690
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
2691
|
+
})), n.push.apply(n, s);
|
|
2692
|
+
}
|
|
2693
|
+
return n;
|
|
2694
|
+
}
|
|
2695
|
+
function Br(e) {
|
|
2696
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
2697
|
+
var n = arguments[t] != null ? arguments[t] : {};
|
|
2698
|
+
t % 2 ? jr(Object(n), !0).forEach(function(s) {
|
|
2699
|
+
Bu(e, s, n[s]);
|
|
2700
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : jr(Object(n)).forEach(function(s) {
|
|
2701
|
+
Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(n, s));
|
|
2702
|
+
});
|
|
2703
|
+
}
|
|
2704
|
+
return e;
|
|
2705
|
+
}
|
|
2706
|
+
function Ru() {
|
|
2707
|
+
var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, t = {
|
|
2708
|
+
storage: ju
|
|
2709
|
+
};
|
|
2710
|
+
return xu(Br(Br({}, t), e));
|
|
2711
|
+
}
|
|
2712
|
+
const Du = "@chaibuilder/sdk", Mu = "0.1.4", Lu = "module", Nu = [
|
|
2713
|
+
"dist"
|
|
2714
|
+
], Tu = "dist/core.js", Fu = !1, Uu = {
|
|
2715
|
+
".": {
|
|
2716
|
+
import: "./dist/core.js",
|
|
2717
|
+
require: "./dist/core.cjs",
|
|
2718
|
+
types: "./dist/core.d.ts"
|
|
2719
|
+
},
|
|
2720
|
+
"./render": {
|
|
2721
|
+
import: "./dist/render.js",
|
|
2722
|
+
require: "./dist/render.cjs",
|
|
2723
|
+
types: "./dist/render.d.ts"
|
|
2724
|
+
},
|
|
2725
|
+
"./ui": {
|
|
2726
|
+
import: "./dist/ui.js",
|
|
2727
|
+
require: "./dist/ui.cjs",
|
|
2728
|
+
types: "./dist/ui.d.ts"
|
|
2729
|
+
},
|
|
2730
|
+
"./lib": {
|
|
2731
|
+
import: "./dist/lib.js",
|
|
2732
|
+
require: "./dist/lib.cjs",
|
|
2733
|
+
types: "./dist/lib.d.ts"
|
|
2734
|
+
},
|
|
2735
|
+
"./server": {
|
|
2736
|
+
import: "./dist/server.js",
|
|
2737
|
+
require: "./dist/server.cjs",
|
|
2738
|
+
types: "./dist/server.d.ts"
|
|
2739
|
+
},
|
|
2740
|
+
"./styles": {
|
|
2741
|
+
import: "./dist/style.css",
|
|
2742
|
+
require: "./dist/style.css"
|
|
2743
|
+
}
|
|
2744
|
+
}, qu = {
|
|
2745
|
+
dev: "vite",
|
|
2746
|
+
build: "tsc && vite build",
|
|
2747
|
+
lint: "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
2748
|
+
preview: "vite preview",
|
|
2749
|
+
test: "jest --colors",
|
|
2750
|
+
"test:watch": "jest --watch --colors",
|
|
2751
|
+
"test:coverage": "jest --coverage --colors",
|
|
2752
|
+
e2e: "playwright test",
|
|
2753
|
+
"e2e:report": "playwright show-report",
|
|
2754
|
+
"e2e:ui": "playwright test --ui",
|
|
2755
|
+
docs: "jsdoc -c jsdoc.conf.json"
|
|
2756
|
+
}, $u = {
|
|
2757
|
+
"@analytics/google-analytics": "^1.0.7",
|
|
2758
|
+
"@bobthered/tailwindcss-palette-generator": "3.1.1",
|
|
2759
|
+
"@chaibuilder/blocks": "^0.1.0",
|
|
2760
|
+
"@floating-ui/dom": "1.4.5",
|
|
2761
|
+
"@floating-ui/react-dom": "2.0.1",
|
|
2762
|
+
"@mhsdesign/jit-browser-tailwindcss": "0.3.0",
|
|
2763
|
+
"@minoru/react-dnd-treeview": "3.4.4",
|
|
2764
|
+
"@radix-ui/react-accordion": "^1.1.2",
|
|
2765
|
+
"@radix-ui/react-alert-dialog": "^1.0.4",
|
|
2766
|
+
"@radix-ui/react-context-menu": "^2.1.4",
|
|
2767
|
+
"@radix-ui/react-dialog": "^1.0.4",
|
|
2768
|
+
"@radix-ui/react-dropdown-menu": "^2.0.5",
|
|
2769
|
+
"@radix-ui/react-hover-card": "^1.0.6",
|
|
2770
|
+
"@radix-ui/react-icons": "^1.3.0",
|
|
2771
|
+
"@radix-ui/react-label": "^2.0.2",
|
|
2772
|
+
"@radix-ui/react-menubar": "^1.0.3",
|
|
2773
|
+
"@radix-ui/react-navigation-menu": "^1.1.3",
|
|
2774
|
+
"@radix-ui/react-popover": "^1.0.6",
|
|
2775
|
+
"@radix-ui/react-scroll-area": "^1.0.4",
|
|
2776
|
+
"@radix-ui/react-select": "^1.2.2",
|
|
2777
|
+
"@radix-ui/react-separator": "^1.0.3",
|
|
2778
|
+
"@radix-ui/react-slot": "^1.0.2",
|
|
2779
|
+
"@radix-ui/react-switch": "^1.0.3",
|
|
2780
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
2781
|
+
"@radix-ui/react-toast": "^1.1.4",
|
|
2782
|
+
"@radix-ui/react-toggle": "^1.0.3",
|
|
2783
|
+
"@radix-ui/react-tooltip": "^1.0.6",
|
|
2784
|
+
"@react-hookz/web": "23.1.0",
|
|
2785
|
+
"@rjsf/core": "5.11.2",
|
|
2786
|
+
"@rjsf/utils": "5.11.2",
|
|
2787
|
+
"@rjsf/validator-ajv8": "5.11.2",
|
|
2788
|
+
"@tailwindcss/aspect-ratio": "0.4.2",
|
|
2789
|
+
"@tailwindcss/forms": "^0.5.6",
|
|
2790
|
+
"@tailwindcss/line-clamp": "^0.4.4",
|
|
2791
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
2792
|
+
"@tanstack/react-query": "^5.8.4",
|
|
2793
|
+
analytics: "^0.8.9",
|
|
2794
|
+
"class-variance-authority": "0.6.1",
|
|
2795
|
+
clsx: "1.2.1",
|
|
2796
|
+
cmdk: "0.2.0",
|
|
2797
|
+
"date-fns": "^2.30.0",
|
|
2798
|
+
flagged: "2.0.9",
|
|
2799
|
+
"flat-to-nested": "1.1.1",
|
|
2800
|
+
"focus-trap-react": "^10.2.1",
|
|
2801
|
+
"forgiving-xml-parser": "1.4.0",
|
|
2802
|
+
"framer-motion": "^10.12.18",
|
|
2803
|
+
"fuse.js": "6.6.2",
|
|
2804
|
+
"gray-matter": "^4.0.3",
|
|
2805
|
+
himalaya: "^1.1.0",
|
|
2806
|
+
"html-formatter": "0.1.9",
|
|
2807
|
+
i18next: "^23.2.8",
|
|
2808
|
+
jotai: "2.2.2",
|
|
2809
|
+
lodash: "4.17.21",
|
|
2810
|
+
"lucide-react": "^0.244.0",
|
|
2811
|
+
nanoid: "^4.0.2",
|
|
2812
|
+
"post-robot": "10.0.46",
|
|
2813
|
+
react: "^18.2.0",
|
|
2814
|
+
"react-autosuggest": "10.1.0",
|
|
2815
|
+
"react-colorful": "5.6.1",
|
|
2816
|
+
"react-dnd": "16.0.1",
|
|
2817
|
+
"react-dnd-html5-backend": "16.0.1",
|
|
2818
|
+
"react-dom": "^18.2.0",
|
|
2819
|
+
"react-hotkeys-hook": "4.4.1",
|
|
2820
|
+
"react-i18next": "13.0.1",
|
|
2821
|
+
"react-icons": "^4.10.1",
|
|
2822
|
+
"react-icons-picker": "^1.0.9",
|
|
2823
|
+
"react-quill": "^2.0.0",
|
|
2824
|
+
"react-textarea-autosize": "^8.5.2",
|
|
2825
|
+
"react-wrap-balancer": "^1.0.0",
|
|
2826
|
+
"redux-undo": "1.1.0",
|
|
2827
|
+
sonner: "^1.2.0",
|
|
2828
|
+
"tailwind-merge": "1.13.2",
|
|
2829
|
+
"tailwindcss-animate": "1.0.6",
|
|
2830
|
+
"tippy.js": "^6.3.7",
|
|
2831
|
+
"unist-util-visit": "^4.1.2",
|
|
2832
|
+
"unsplash-js": "^7.0.18"
|
|
2833
|
+
}, Qu = {
|
|
2834
|
+
"@commitlint/cli": "17.7.1",
|
|
2835
|
+
"@commitlint/config-conventional": "17.7.0",
|
|
2836
|
+
"@faker-js/faker": "^8.3.1",
|
|
2837
|
+
"@nozbe/watermelondb": "^0.27.1",
|
|
2838
|
+
"@playwright/test": "^1.39.0",
|
|
2839
|
+
"@tanstack/eslint-plugin-query": "^5.8.4",
|
|
2840
|
+
"@types/better-sqlite3": "^7.6.7",
|
|
2841
|
+
"@types/jest": "^29.5.7",
|
|
2842
|
+
"@types/lodash": "^4.14.200",
|
|
2843
|
+
"@types/node": "^20.8.10",
|
|
2844
|
+
"@types/react": "^18.2.15",
|
|
2845
|
+
"@types/react-dom": "^18.2.7",
|
|
2846
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
2847
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
2848
|
+
"@vitejs/plugin-react-swc": "^3.3.2",
|
|
2849
|
+
autoprefixer: "^10.4.16",
|
|
2850
|
+
"better-docs": "^2.7.2",
|
|
2851
|
+
"better-sqlite3": "^9.1.1",
|
|
2852
|
+
"drizzle-kit": "^0.20.4",
|
|
2853
|
+
"drizzle-orm": "^0.29.0",
|
|
2854
|
+
eslint: "^8.45.0",
|
|
2855
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
2856
|
+
"eslint-plugin-react-refresh": "^0.4.3",
|
|
2857
|
+
jest: "^29.7.0",
|
|
2858
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
2859
|
+
jsdoc: "^4.0.2",
|
|
2860
|
+
msw: "^2.0.8",
|
|
2861
|
+
postcss: "^8.4.31",
|
|
2862
|
+
prettier: "^3.0.3",
|
|
2863
|
+
"prettier-plugin-tailwindcss": "^0.5.6",
|
|
2864
|
+
"prop-types": "^15.8.1",
|
|
2865
|
+
tailwindcss: "^3.3.5",
|
|
2866
|
+
"ts-jest": "^29.1.1",
|
|
2867
|
+
typescript: "^5.0.2",
|
|
2868
|
+
vite: "^4.4.5",
|
|
2869
|
+
"vite-plugin-dts": "^3.6.3"
|
|
2870
|
+
}, Vu = {
|
|
2871
|
+
workerDirectory: "public"
|
|
2872
|
+
}, Ku = {
|
|
2873
|
+
name: Du,
|
|
2874
|
+
private: !1,
|
|
2875
|
+
version: Mu,
|
|
2876
|
+
type: Lu,
|
|
2877
|
+
files: Nu,
|
|
2878
|
+
main: Tu,
|
|
2879
|
+
sideEffects: Fu,
|
|
2880
|
+
exports: Uu,
|
|
2881
|
+
scripts: qu,
|
|
2882
|
+
dependencies: $u,
|
|
2883
|
+
devDependencies: Qu,
|
|
2884
|
+
msw: Vu
|
|
2885
|
+
}, Rr = "https://api.chaibuilder.com", Dr = () => typeof window > "u" ? !1 : window.location.href.includes("localhost");
|
|
2886
|
+
function zu() {
|
|
2887
|
+
return {
|
|
2888
|
+
/* All plugins require a name */
|
|
2889
|
+
name: "chaibuilder-analytics",
|
|
2890
|
+
/* Everything else below this is optional depending on your plugin requirements */
|
|
2891
|
+
config: {},
|
|
2892
|
+
initialize: () => {
|
|
2893
|
+
if (typeof window > "u")
|
|
2894
|
+
return !1;
|
|
2895
|
+
window.chaibuilderAnalyticsLoaded = !0;
|
|
2896
|
+
},
|
|
2897
|
+
page: (e) => {
|
|
2898
|
+
if (typeof window > "u")
|
|
2899
|
+
return !1;
|
|
2900
|
+
if (Dr())
|
|
2901
|
+
return;
|
|
2902
|
+
const { payload: t } = e;
|
|
2903
|
+
fetch(`${Rr}/v1/log`, { method: "post", body: JSON.stringify(t) }).then((n) => n.json());
|
|
2904
|
+
},
|
|
2905
|
+
track: ({ payload: e }) => {
|
|
2906
|
+
if (typeof window > "u")
|
|
2907
|
+
return !1;
|
|
2908
|
+
Dr() || fetch(`${Rr}/v1/log`, { method: "post", body: JSON.stringify(e) });
|
|
2909
|
+
},
|
|
2910
|
+
loaded: () => typeof window > "u" ? !0 : !!window.chaibuilderAnalyticsLoaded
|
|
2911
|
+
};
|
|
2912
|
+
}
|
|
2913
|
+
const Gu = Ru({
|
|
2914
|
+
app: "chaibuilder",
|
|
2915
|
+
version: Ku.version,
|
|
2916
|
+
plugins: [zu()]
|
|
2917
|
+
});
|
|
2918
|
+
({}).NODE_ENV === "development" && console.log("Chai Builder:", Wo);
|
|
2919
|
+
const Wu = (e) => /* @__PURE__ */ _.jsx(_.Fragment, { children: e.children }), Hu = (e) => {
|
|
2920
|
+
const { dndOptions: t = { backend: Po } } = e, [n] = Oa(), [, s] = yi(), r = xc();
|
|
2921
|
+
return ke(() => {
|
|
2922
|
+
Tc.set(
|
|
2923
|
+
// @ts-ignore
|
|
2924
|
+
ti,
|
|
2925
|
+
Tn(e, ["blocks", "globalBlocks", "brandingOptions"])
|
|
2926
|
+
);
|
|
2927
|
+
}, [e]), ke(() => {
|
|
2928
|
+
n(To(e.blocks || [])), r();
|
|
2929
|
+
}, [e.blocks]), ke(() => {
|
|
2930
|
+
s(e.brandingOptions);
|
|
2931
|
+
}, [e.brandingOptions]), ke(() => {
|
|
2932
|
+
Gu.page();
|
|
2933
|
+
}, []), /* @__PURE__ */ _.jsx(xo, { ...t, options: Eo(), children: /* @__PURE__ */ _.jsx(Wu, { children: /* @__PURE__ */ _.jsx(Nc, {}) }) });
|
|
2934
|
+
}, Ju = (e) => /* @__PURE__ */ _.jsxs(Jo, { children: [
|
|
2935
|
+
/* @__PURE__ */ _.jsx(mo, { features: Ho, children: /* @__PURE__ */ _.jsx(Hu, { ...e }) }),
|
|
2936
|
+
/* @__PURE__ */ _.jsx(Io, {})
|
|
2937
|
+
] });
|
|
2938
|
+
var vn = class {
|
|
2939
|
+
constructor() {
|
|
2940
|
+
this.listeners = /* @__PURE__ */ new Set(), this.subscribe = this.subscribe.bind(this);
|
|
2941
|
+
}
|
|
2942
|
+
subscribe(e) {
|
|
2943
|
+
return this.listeners.add(e), this.onSubscribe(), () => {
|
|
2944
|
+
this.listeners.delete(e), this.onUnsubscribe();
|
|
2945
|
+
};
|
|
2946
|
+
}
|
|
2947
|
+
hasListeners() {
|
|
2948
|
+
return this.listeners.size > 0;
|
|
2949
|
+
}
|
|
2950
|
+
onSubscribe() {
|
|
2951
|
+
}
|
|
2952
|
+
onUnsubscribe() {
|
|
2953
|
+
}
|
|
2954
|
+
}, qt = typeof window > "u" || "Deno" in window;
|
|
2955
|
+
function ve() {
|
|
2956
|
+
}
|
|
2957
|
+
function Xu(e, t) {
|
|
2958
|
+
return typeof e == "function" ? e(t) : e;
|
|
2959
|
+
}
|
|
2960
|
+
function hs(e) {
|
|
2961
|
+
return typeof e == "number" && e >= 0 && e !== 1 / 0;
|
|
2962
|
+
}
|
|
2963
|
+
function to(e, t) {
|
|
2964
|
+
return Math.max(e + (t || 0) - Date.now(), 0);
|
|
2965
|
+
}
|
|
2966
|
+
function Mr(e, t) {
|
|
2967
|
+
const {
|
|
2968
|
+
type: n = "all",
|
|
2969
|
+
exact: s,
|
|
2970
|
+
fetchStatus: r,
|
|
2971
|
+
predicate: o,
|
|
2972
|
+
queryKey: i,
|
|
2973
|
+
stale: a
|
|
2974
|
+
} = e;
|
|
2975
|
+
if (i) {
|
|
2976
|
+
if (s) {
|
|
2977
|
+
if (t.queryHash !== $s(i, t.options))
|
|
2978
|
+
return !1;
|
|
2979
|
+
} else if (!sn(t.queryKey, i))
|
|
2980
|
+
return !1;
|
|
2981
|
+
}
|
|
2982
|
+
if (n !== "all") {
|
|
2983
|
+
const d = t.isActive();
|
|
2984
|
+
if (n === "active" && !d || n === "inactive" && d)
|
|
2985
|
+
return !1;
|
|
2986
|
+
}
|
|
2987
|
+
return !(typeof a == "boolean" && t.isStale() !== a || typeof r < "u" && r !== t.state.fetchStatus || o && !o(t));
|
|
2988
|
+
}
|
|
2989
|
+
function Lr(e, t) {
|
|
2990
|
+
const { exact: n, status: s, predicate: r, mutationKey: o } = e;
|
|
2991
|
+
if (o) {
|
|
2992
|
+
if (!t.options.mutationKey)
|
|
2993
|
+
return !1;
|
|
2994
|
+
if (n) {
|
|
2995
|
+
if (nn(t.options.mutationKey) !== nn(o))
|
|
2996
|
+
return !1;
|
|
2997
|
+
} else if (!sn(t.options.mutationKey, o))
|
|
2998
|
+
return !1;
|
|
2999
|
+
}
|
|
3000
|
+
return !(s && t.state.status !== s || r && !r(t));
|
|
3001
|
+
}
|
|
3002
|
+
function $s(e, t) {
|
|
3003
|
+
return ((t == null ? void 0 : t.queryKeyHashFn) || nn)(e);
|
|
3004
|
+
}
|
|
3005
|
+
function nn(e) {
|
|
3006
|
+
return JSON.stringify(
|
|
3007
|
+
e,
|
|
3008
|
+
(t, n) => ms(n) ? Object.keys(n).sort().reduce((s, r) => (s[r] = n[r], s), {}) : n
|
|
3009
|
+
);
|
|
3010
|
+
}
|
|
3011
|
+
function sn(e, t) {
|
|
3012
|
+
return e === t ? !0 : typeof e != typeof t ? !1 : e && t && typeof e == "object" && typeof t == "object" ? !Object.keys(t).some((n) => !sn(e[n], t[n])) : !1;
|
|
3013
|
+
}
|
|
3014
|
+
function no(e, t) {
|
|
3015
|
+
if (e === t)
|
|
3016
|
+
return e;
|
|
3017
|
+
const n = Nr(e) && Nr(t);
|
|
3018
|
+
if (n || ms(e) && ms(t)) {
|
|
3019
|
+
const s = n ? e.length : Object.keys(e).length, r = n ? t : Object.keys(t), o = r.length, i = n ? [] : {};
|
|
3020
|
+
let a = 0;
|
|
3021
|
+
for (let d = 0; d < o; d++) {
|
|
3022
|
+
const u = n ? d : r[d];
|
|
3023
|
+
i[u] = no(e[u], t[u]), i[u] === e[u] && a++;
|
|
3024
|
+
}
|
|
3025
|
+
return s === o && a === s ? e : i;
|
|
3026
|
+
}
|
|
3027
|
+
return t;
|
|
3028
|
+
}
|
|
3029
|
+
function ps(e, t) {
|
|
3030
|
+
if (e && !t || t && !e)
|
|
3031
|
+
return !1;
|
|
3032
|
+
for (const n in e)
|
|
3033
|
+
if (e[n] !== t[n])
|
|
3034
|
+
return !1;
|
|
3035
|
+
return !0;
|
|
3036
|
+
}
|
|
3037
|
+
function Nr(e) {
|
|
3038
|
+
return Array.isArray(e) && e.length === Object.keys(e).length;
|
|
3039
|
+
}
|
|
3040
|
+
function ms(e) {
|
|
3041
|
+
if (!Tr(e))
|
|
3042
|
+
return !1;
|
|
3043
|
+
const t = e.constructor;
|
|
3044
|
+
if (typeof t > "u")
|
|
3045
|
+
return !0;
|
|
3046
|
+
const n = t.prototype;
|
|
3047
|
+
return !(!Tr(n) || !n.hasOwnProperty("isPrototypeOf"));
|
|
3048
|
+
}
|
|
3049
|
+
function Tr(e) {
|
|
3050
|
+
return Object.prototype.toString.call(e) === "[object Object]";
|
|
3051
|
+
}
|
|
3052
|
+
function so(e) {
|
|
3053
|
+
return new Promise((t) => {
|
|
3054
|
+
setTimeout(t, e);
|
|
3055
|
+
});
|
|
3056
|
+
}
|
|
3057
|
+
function Fr(e) {
|
|
3058
|
+
so(0).then(e);
|
|
3059
|
+
}
|
|
3060
|
+
function gs(e, t, n) {
|
|
3061
|
+
return typeof n.structuralSharing == "function" ? n.structuralSharing(e, t) : n.structuralSharing !== !1 ? no(e, t) : t;
|
|
3062
|
+
}
|
|
3063
|
+
function Yu(e, t, n = 0) {
|
|
3064
|
+
const s = [...e, t];
|
|
3065
|
+
return n && s.length > n ? s.slice(1) : s;
|
|
3066
|
+
}
|
|
3067
|
+
function Zu(e, t, n = 0) {
|
|
3068
|
+
const s = [t, ...e];
|
|
3069
|
+
return n && s.length > n ? s.slice(0, -1) : s;
|
|
3070
|
+
}
|
|
3071
|
+
var Ze, qe, kt, Qr, el = (Qr = class extends vn {
|
|
3072
|
+
constructor() {
|
|
3073
|
+
super();
|
|
3074
|
+
L(this, Ze, void 0);
|
|
3075
|
+
L(this, qe, void 0);
|
|
3076
|
+
L(this, kt, void 0);
|
|
3077
|
+
P(this, kt, (t) => {
|
|
3078
|
+
if (!qt && window.addEventListener) {
|
|
3079
|
+
const n = () => t();
|
|
3080
|
+
return window.addEventListener("visibilitychange", n, !1), () => {
|
|
3081
|
+
window.removeEventListener("visibilitychange", n);
|
|
3082
|
+
};
|
|
3083
|
+
}
|
|
3084
|
+
});
|
|
3085
|
+
}
|
|
3086
|
+
onSubscribe() {
|
|
3087
|
+
c(this, qe) || this.setEventListener(c(this, kt));
|
|
3088
|
+
}
|
|
3089
|
+
onUnsubscribe() {
|
|
3090
|
+
var t;
|
|
3091
|
+
this.hasListeners() || ((t = c(this, qe)) == null || t.call(this), P(this, qe, void 0));
|
|
3092
|
+
}
|
|
3093
|
+
setEventListener(t) {
|
|
3094
|
+
var n;
|
|
3095
|
+
P(this, kt, t), (n = c(this, qe)) == null || n.call(this), P(this, qe, t((s) => {
|
|
3096
|
+
typeof s == "boolean" ? this.setFocused(s) : this.onFocus();
|
|
3097
|
+
}));
|
|
3098
|
+
}
|
|
3099
|
+
setFocused(t) {
|
|
3100
|
+
c(this, Ze) !== t && (P(this, Ze, t), this.onFocus());
|
|
3101
|
+
}
|
|
3102
|
+
onFocus() {
|
|
3103
|
+
this.listeners.forEach((t) => {
|
|
3104
|
+
t();
|
|
3105
|
+
});
|
|
3106
|
+
}
|
|
3107
|
+
isFocused() {
|
|
3108
|
+
var t;
|
|
3109
|
+
return typeof c(this, Ze) == "boolean" ? c(this, Ze) : ((t = globalThis.document) == null ? void 0 : t.visibilityState) !== "hidden";
|
|
3110
|
+
}
|
|
3111
|
+
}, Ze = new WeakMap(), qe = new WeakMap(), kt = new WeakMap(), Qr), Mn = new el(), At, $e, Et, Vr, tl = (Vr = class extends vn {
|
|
3112
|
+
constructor() {
|
|
3113
|
+
super();
|
|
3114
|
+
L(this, At, !0);
|
|
3115
|
+
L(this, $e, void 0);
|
|
3116
|
+
L(this, Et, void 0);
|
|
3117
|
+
P(this, Et, (t) => {
|
|
3118
|
+
if (!qt && window.addEventListener) {
|
|
3119
|
+
const n = () => t(!0), s = () => t(!1);
|
|
3120
|
+
return window.addEventListener("online", n, !1), window.addEventListener("offline", s, !1), () => {
|
|
3121
|
+
window.removeEventListener("online", n), window.removeEventListener("offline", s);
|
|
3122
|
+
};
|
|
3123
|
+
}
|
|
3124
|
+
});
|
|
3125
|
+
}
|
|
3126
|
+
onSubscribe() {
|
|
3127
|
+
c(this, $e) || this.setEventListener(c(this, Et));
|
|
3128
|
+
}
|
|
3129
|
+
onUnsubscribe() {
|
|
3130
|
+
var t;
|
|
3131
|
+
this.hasListeners() || ((t = c(this, $e)) == null || t.call(this), P(this, $e, void 0));
|
|
3132
|
+
}
|
|
3133
|
+
setEventListener(t) {
|
|
3134
|
+
var n;
|
|
3135
|
+
P(this, Et, t), (n = c(this, $e)) == null || n.call(this), P(this, $e, t(this.setOnline.bind(this)));
|
|
3136
|
+
}
|
|
3137
|
+
setOnline(t) {
|
|
3138
|
+
c(this, At) !== t && (P(this, At, t), this.listeners.forEach((s) => {
|
|
3139
|
+
s(t);
|
|
3140
|
+
}));
|
|
3141
|
+
}
|
|
3142
|
+
isOnline() {
|
|
3143
|
+
return c(this, At);
|
|
3144
|
+
}
|
|
3145
|
+
}, At = new WeakMap(), $e = new WeakMap(), Et = new WeakMap(), Vr), Ln = new tl();
|
|
3146
|
+
function nl(e) {
|
|
3147
|
+
return Math.min(1e3 * 2 ** e, 3e4);
|
|
3148
|
+
}
|
|
3149
|
+
function Wn(e) {
|
|
3150
|
+
return (e ?? "online") === "online" ? Ln.isOnline() : !0;
|
|
3151
|
+
}
|
|
3152
|
+
var ro = class {
|
|
3153
|
+
constructor(e) {
|
|
3154
|
+
this.revert = e == null ? void 0 : e.revert, this.silent = e == null ? void 0 : e.silent;
|
|
3155
|
+
}
|
|
3156
|
+
};
|
|
3157
|
+
function is(e) {
|
|
3158
|
+
return e instanceof ro;
|
|
3159
|
+
}
|
|
3160
|
+
function io(e) {
|
|
3161
|
+
let t = !1, n = 0, s = !1, r, o, i;
|
|
3162
|
+
const a = new Promise((y, A) => {
|
|
3163
|
+
o = y, i = A;
|
|
3164
|
+
}), d = (y) => {
|
|
3165
|
+
var A;
|
|
3166
|
+
s || (g(new ro(y)), (A = e.abort) == null || A.call(e));
|
|
3167
|
+
}, u = () => {
|
|
3168
|
+
t = !0;
|
|
3169
|
+
}, f = () => {
|
|
3170
|
+
t = !1;
|
|
3171
|
+
}, m = () => !Mn.isFocused() || e.networkMode !== "always" && !Ln.isOnline(), b = (y) => {
|
|
3172
|
+
var A;
|
|
3173
|
+
s || (s = !0, (A = e.onSuccess) == null || A.call(e, y), r == null || r(), o(y));
|
|
3174
|
+
}, g = (y) => {
|
|
3175
|
+
var A;
|
|
3176
|
+
s || (s = !0, (A = e.onError) == null || A.call(e, y), r == null || r(), i(y));
|
|
3177
|
+
}, O = () => new Promise((y) => {
|
|
3178
|
+
var A;
|
|
3179
|
+
r = (D) => {
|
|
3180
|
+
const B = s || !m();
|
|
3181
|
+
return B && y(D), B;
|
|
3182
|
+
}, (A = e.onPause) == null || A.call(e);
|
|
3183
|
+
}).then(() => {
|
|
3184
|
+
var y;
|
|
3185
|
+
r = void 0, s || (y = e.onContinue) == null || y.call(e);
|
|
3186
|
+
}), C = () => {
|
|
3187
|
+
if (s)
|
|
3188
|
+
return;
|
|
3189
|
+
let y;
|
|
3190
|
+
try {
|
|
3191
|
+
y = e.fn();
|
|
3192
|
+
} catch (A) {
|
|
3193
|
+
y = Promise.reject(A);
|
|
3194
|
+
}
|
|
3195
|
+
Promise.resolve(y).then(b).catch((A) => {
|
|
3196
|
+
var F;
|
|
3197
|
+
if (s)
|
|
3198
|
+
return;
|
|
3199
|
+
const D = e.retry ?? (qt ? 0 : 3), B = e.retryDelay ?? nl, x = typeof B == "function" ? B(n, A) : B, k = D === !0 || typeof D == "number" && n < D || typeof D == "function" && D(n, A);
|
|
3200
|
+
if (t || !k) {
|
|
3201
|
+
g(A);
|
|
3202
|
+
return;
|
|
3203
|
+
}
|
|
3204
|
+
n++, (F = e.onFail) == null || F.call(e, n, A), so(x).then(() => {
|
|
3205
|
+
if (m())
|
|
3206
|
+
return O();
|
|
3207
|
+
}).then(() => {
|
|
3208
|
+
t ? g(A) : C();
|
|
3209
|
+
});
|
|
3210
|
+
});
|
|
3211
|
+
};
|
|
3212
|
+
return Wn(e.networkMode) ? C() : O().then(C), {
|
|
3213
|
+
promise: a,
|
|
3214
|
+
cancel: d,
|
|
3215
|
+
continue: () => (r == null ? void 0 : r()) ? a : Promise.resolve(),
|
|
3216
|
+
cancelRetry: u,
|
|
3217
|
+
continueRetry: f
|
|
3218
|
+
};
|
|
3219
|
+
}
|
|
3220
|
+
function sl() {
|
|
3221
|
+
let e = [], t = 0, n = (f) => {
|
|
3222
|
+
f();
|
|
3223
|
+
}, s = (f) => {
|
|
3224
|
+
f();
|
|
3225
|
+
};
|
|
3226
|
+
const r = (f) => {
|
|
3227
|
+
let m;
|
|
3228
|
+
t++;
|
|
3229
|
+
try {
|
|
3230
|
+
m = f();
|
|
3231
|
+
} finally {
|
|
3232
|
+
t--, t || a();
|
|
3233
|
+
}
|
|
3234
|
+
return m;
|
|
3235
|
+
}, o = (f) => {
|
|
3236
|
+
t ? e.push(f) : Fr(() => {
|
|
3237
|
+
n(f);
|
|
3238
|
+
});
|
|
3239
|
+
}, i = (f) => (...m) => {
|
|
3240
|
+
o(() => {
|
|
3241
|
+
f(...m);
|
|
3242
|
+
});
|
|
3243
|
+
}, a = () => {
|
|
3244
|
+
const f = e;
|
|
3245
|
+
e = [], f.length && Fr(() => {
|
|
3246
|
+
s(() => {
|
|
3247
|
+
f.forEach((m) => {
|
|
3248
|
+
n(m);
|
|
3249
|
+
});
|
|
3250
|
+
});
|
|
3251
|
+
});
|
|
3252
|
+
};
|
|
3253
|
+
return {
|
|
3254
|
+
batch: r,
|
|
3255
|
+
batchCalls: i,
|
|
3256
|
+
schedule: o,
|
|
3257
|
+
setNotifyFunction: (f) => {
|
|
3258
|
+
n = f;
|
|
3259
|
+
},
|
|
3260
|
+
setBatchNotifyFunction: (f) => {
|
|
3261
|
+
s = f;
|
|
3262
|
+
}
|
|
3263
|
+
};
|
|
3264
|
+
}
|
|
3265
|
+
var ae = sl(), et, Kr, oo = (Kr = class {
|
|
3266
|
+
constructor() {
|
|
3267
|
+
L(this, et, void 0);
|
|
3268
|
+
}
|
|
3269
|
+
destroy() {
|
|
3270
|
+
this.clearGcTimeout();
|
|
3271
|
+
}
|
|
3272
|
+
scheduleGc() {
|
|
3273
|
+
this.clearGcTimeout(), hs(this.gcTime) && P(this, et, setTimeout(() => {
|
|
3274
|
+
this.optionalRemove();
|
|
3275
|
+
}, this.gcTime));
|
|
3276
|
+
}
|
|
3277
|
+
updateGcTime(e) {
|
|
3278
|
+
this.gcTime = Math.max(
|
|
3279
|
+
this.gcTime || 0,
|
|
3280
|
+
e ?? (qt ? 1 / 0 : 5 * 60 * 1e3)
|
|
3281
|
+
);
|
|
3282
|
+
}
|
|
3283
|
+
clearGcTimeout() {
|
|
3284
|
+
c(this, et) && (clearTimeout(c(this, et)), P(this, et, void 0));
|
|
3285
|
+
}
|
|
3286
|
+
}, et = new WeakMap(), Kr), Pt, Ot, me, Qe, ge, ie, rn, tt, _t, jn, xe, Re, zr, rl = (zr = class extends oo {
|
|
3287
|
+
constructor(t) {
|
|
3288
|
+
super();
|
|
3289
|
+
L(this, _t);
|
|
3290
|
+
L(this, xe);
|
|
3291
|
+
L(this, Pt, void 0);
|
|
3292
|
+
L(this, Ot, void 0);
|
|
3293
|
+
L(this, me, void 0);
|
|
3294
|
+
L(this, Qe, void 0);
|
|
3295
|
+
L(this, ge, void 0);
|
|
3296
|
+
L(this, ie, void 0);
|
|
3297
|
+
L(this, rn, void 0);
|
|
3298
|
+
L(this, tt, void 0);
|
|
3299
|
+
P(this, tt, !1), P(this, rn, t.defaultOptions), K(this, _t, jn).call(this, t.options), P(this, ie, []), P(this, me, t.cache), this.queryKey = t.queryKey, this.queryHash = t.queryHash, P(this, Pt, t.state || il(this.options)), this.state = c(this, Pt), this.scheduleGc();
|
|
3300
|
+
}
|
|
3301
|
+
get meta() {
|
|
3302
|
+
return this.options.meta;
|
|
3303
|
+
}
|
|
3304
|
+
optionalRemove() {
|
|
3305
|
+
!c(this, ie).length && this.state.fetchStatus === "idle" && c(this, me).remove(this);
|
|
3306
|
+
}
|
|
3307
|
+
setData(t, n) {
|
|
3308
|
+
const s = gs(this.state.data, t, this.options);
|
|
3309
|
+
return K(this, xe, Re).call(this, {
|
|
3310
|
+
data: s,
|
|
3311
|
+
type: "success",
|
|
3312
|
+
dataUpdatedAt: n == null ? void 0 : n.updatedAt,
|
|
3313
|
+
manual: n == null ? void 0 : n.manual
|
|
3314
|
+
}), s;
|
|
3315
|
+
}
|
|
3316
|
+
setState(t, n) {
|
|
3317
|
+
K(this, xe, Re).call(this, { type: "setState", state: t, setStateOptions: n });
|
|
3318
|
+
}
|
|
3319
|
+
cancel(t) {
|
|
3320
|
+
var s;
|
|
3321
|
+
const n = c(this, Qe);
|
|
3322
|
+
return (s = c(this, ge)) == null || s.cancel(t), n ? n.then(ve).catch(ve) : Promise.resolve();
|
|
3323
|
+
}
|
|
3324
|
+
destroy() {
|
|
3325
|
+
super.destroy(), this.cancel({ silent: !0 });
|
|
3326
|
+
}
|
|
3327
|
+
reset() {
|
|
3328
|
+
this.destroy(), this.setState(c(this, Pt));
|
|
3329
|
+
}
|
|
3330
|
+
isActive() {
|
|
3331
|
+
return c(this, ie).some(
|
|
3332
|
+
(t) => t.options.enabled !== !1
|
|
3333
|
+
);
|
|
3334
|
+
}
|
|
3335
|
+
isDisabled() {
|
|
3336
|
+
return this.getObserversCount() > 0 && !this.isActive();
|
|
3337
|
+
}
|
|
3338
|
+
isStale() {
|
|
3339
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || c(this, ie).some((t) => t.getCurrentResult().isStale);
|
|
3340
|
+
}
|
|
3341
|
+
isStaleByTime(t = 0) {
|
|
3342
|
+
return this.state.isInvalidated || !this.state.dataUpdatedAt || !to(this.state.dataUpdatedAt, t);
|
|
3343
|
+
}
|
|
3344
|
+
onFocus() {
|
|
3345
|
+
var n;
|
|
3346
|
+
const t = c(this, ie).find((s) => s.shouldFetchOnWindowFocus());
|
|
3347
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (n = c(this, ge)) == null || n.continue();
|
|
3348
|
+
}
|
|
3349
|
+
onOnline() {
|
|
3350
|
+
var n;
|
|
3351
|
+
const t = c(this, ie).find((s) => s.shouldFetchOnReconnect());
|
|
3352
|
+
t == null || t.refetch({ cancelRefetch: !1 }), (n = c(this, ge)) == null || n.continue();
|
|
3353
|
+
}
|
|
3354
|
+
addObserver(t) {
|
|
3355
|
+
c(this, ie).includes(t) || (c(this, ie).push(t), this.clearGcTimeout(), c(this, me).notify({ type: "observerAdded", query: this, observer: t }));
|
|
3356
|
+
}
|
|
3357
|
+
removeObserver(t) {
|
|
3358
|
+
c(this, ie).includes(t) && (P(this, ie, c(this, ie).filter((n) => n !== t)), c(this, ie).length || (c(this, ge) && (c(this, tt) ? c(this, ge).cancel({ revert: !0 }) : c(this, ge).cancelRetry()), this.scheduleGc()), c(this, me).notify({ type: "observerRemoved", query: this, observer: t }));
|
|
3359
|
+
}
|
|
3360
|
+
getObserversCount() {
|
|
3361
|
+
return c(this, ie).length;
|
|
3362
|
+
}
|
|
3363
|
+
invalidate() {
|
|
3364
|
+
this.state.isInvalidated || K(this, xe, Re).call(this, { type: "invalidate" });
|
|
3365
|
+
}
|
|
3366
|
+
fetch(t, n) {
|
|
3367
|
+
var u, f, m, b;
|
|
3368
|
+
if (this.state.fetchStatus !== "idle") {
|
|
3369
|
+
if (this.state.dataUpdatedAt && (n != null && n.cancelRefetch))
|
|
3370
|
+
this.cancel({ silent: !0 });
|
|
3371
|
+
else if (c(this, Qe))
|
|
3372
|
+
return (u = c(this, ge)) == null || u.continueRetry(), c(this, Qe);
|
|
3373
|
+
}
|
|
3374
|
+
if (t && K(this, _t, jn).call(this, t), !this.options.queryFn) {
|
|
3375
|
+
const g = c(this, ie).find((O) => O.options.queryFn);
|
|
3376
|
+
g && K(this, _t, jn).call(this, g.options);
|
|
3377
|
+
}
|
|
3378
|
+
process.env.NODE_ENV !== "production" && (Array.isArray(this.options.queryKey) || console.error(
|
|
3379
|
+
"As of v4, queryKey needs to be an Array. If you are using a string like 'repoData', please change it to an Array, e.g. ['repoData']"
|
|
3380
|
+
));
|
|
3381
|
+
const s = new AbortController(), r = {
|
|
3382
|
+
queryKey: this.queryKey,
|
|
3383
|
+
meta: this.meta
|
|
3384
|
+
}, o = (g) => {
|
|
3385
|
+
Object.defineProperty(g, "signal", {
|
|
3386
|
+
enumerable: !0,
|
|
3387
|
+
get: () => (P(this, tt, !0), s.signal)
|
|
3388
|
+
});
|
|
3389
|
+
};
|
|
3390
|
+
o(r);
|
|
3391
|
+
const i = () => this.options.queryFn ? (P(this, tt, !1), this.options.persister ? this.options.persister(
|
|
3392
|
+
this.options.queryFn,
|
|
3393
|
+
r,
|
|
3394
|
+
this
|
|
3395
|
+
) : this.options.queryFn(
|
|
3396
|
+
r
|
|
3397
|
+
)) : Promise.reject(
|
|
3398
|
+
new Error(`Missing queryFn: '${this.options.queryHash}'`)
|
|
3399
|
+
), a = {
|
|
3400
|
+
fetchOptions: n,
|
|
3401
|
+
options: this.options,
|
|
3402
|
+
queryKey: this.queryKey,
|
|
3403
|
+
state: this.state,
|
|
3404
|
+
fetchFn: i
|
|
3405
|
+
};
|
|
3406
|
+
o(a), (f = this.options.behavior) == null || f.onFetch(
|
|
3407
|
+
a,
|
|
3408
|
+
this
|
|
3409
|
+
), P(this, Ot, this.state), (this.state.fetchStatus === "idle" || this.state.fetchMeta !== ((m = a.fetchOptions) == null ? void 0 : m.meta)) && K(this, xe, Re).call(this, { type: "fetch", meta: (b = a.fetchOptions) == null ? void 0 : b.meta });
|
|
3410
|
+
const d = (g) => {
|
|
3411
|
+
var O, C, y, A;
|
|
3412
|
+
is(g) && g.silent || K(this, xe, Re).call(this, {
|
|
3413
|
+
type: "error",
|
|
3414
|
+
error: g
|
|
3415
|
+
}), is(g) || ((C = (O = c(this, me).config).onError) == null || C.call(
|
|
3416
|
+
O,
|
|
3417
|
+
g,
|
|
3418
|
+
this
|
|
3419
|
+
), (A = (y = c(this, me).config).onSettled) == null || A.call(
|
|
3420
|
+
y,
|
|
3421
|
+
this.state.data,
|
|
3422
|
+
g,
|
|
3423
|
+
this
|
|
3424
|
+
)), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
|
|
3425
|
+
};
|
|
3426
|
+
return P(this, ge, io({
|
|
3427
|
+
fn: a.fetchFn,
|
|
3428
|
+
abort: s.abort.bind(s),
|
|
3429
|
+
onSuccess: (g) => {
|
|
3430
|
+
var O, C, y, A;
|
|
3431
|
+
if (typeof g > "u") {
|
|
3432
|
+
process.env.NODE_ENV !== "production" && console.error(
|
|
3433
|
+
`Query data cannot be undefined. Please make sure to return a value other than undefined from your query function. Affected query key: ${this.queryHash}`
|
|
3434
|
+
), d(new Error(`${this.queryHash} data is undefined`));
|
|
3435
|
+
return;
|
|
3436
|
+
}
|
|
3437
|
+
this.setData(g), (C = (O = c(this, me).config).onSuccess) == null || C.call(O, g, this), (A = (y = c(this, me).config).onSettled) == null || A.call(
|
|
3438
|
+
y,
|
|
3439
|
+
g,
|
|
3440
|
+
this.state.error,
|
|
3441
|
+
this
|
|
3442
|
+
), this.isFetchingOptimistic || this.scheduleGc(), this.isFetchingOptimistic = !1;
|
|
3443
|
+
},
|
|
3444
|
+
onError: d,
|
|
3445
|
+
onFail: (g, O) => {
|
|
3446
|
+
K(this, xe, Re).call(this, { type: "failed", failureCount: g, error: O });
|
|
3447
|
+
},
|
|
3448
|
+
onPause: () => {
|
|
3449
|
+
K(this, xe, Re).call(this, { type: "pause" });
|
|
3450
|
+
},
|
|
3451
|
+
onContinue: () => {
|
|
3452
|
+
K(this, xe, Re).call(this, { type: "continue" });
|
|
3453
|
+
},
|
|
3454
|
+
retry: a.options.retry,
|
|
3455
|
+
retryDelay: a.options.retryDelay,
|
|
3456
|
+
networkMode: a.options.networkMode
|
|
3457
|
+
})), P(this, Qe, c(this, ge).promise), c(this, Qe);
|
|
3458
|
+
}
|
|
3459
|
+
}, Pt = new WeakMap(), Ot = new WeakMap(), me = new WeakMap(), Qe = new WeakMap(), ge = new WeakMap(), ie = new WeakMap(), rn = new WeakMap(), tt = new WeakMap(), _t = new WeakSet(), jn = function(t) {
|
|
3460
|
+
this.options = { ...c(this, rn), ...t }, this.updateGcTime(this.options.gcTime);
|
|
3461
|
+
}, xe = new WeakSet(), Re = function(t) {
|
|
3462
|
+
const n = (s) => {
|
|
3463
|
+
switch (t.type) {
|
|
3464
|
+
case "failed":
|
|
3465
|
+
return {
|
|
3466
|
+
...s,
|
|
3467
|
+
fetchFailureCount: t.failureCount,
|
|
3468
|
+
fetchFailureReason: t.error
|
|
3469
|
+
};
|
|
3470
|
+
case "pause":
|
|
3471
|
+
return {
|
|
3472
|
+
...s,
|
|
3473
|
+
fetchStatus: "paused"
|
|
3474
|
+
};
|
|
3475
|
+
case "continue":
|
|
3476
|
+
return {
|
|
3477
|
+
...s,
|
|
3478
|
+
fetchStatus: "fetching"
|
|
3479
|
+
};
|
|
3480
|
+
case "fetch":
|
|
3481
|
+
return {
|
|
3482
|
+
...s,
|
|
3483
|
+
fetchFailureCount: 0,
|
|
3484
|
+
fetchFailureReason: null,
|
|
3485
|
+
fetchMeta: t.meta ?? null,
|
|
3486
|
+
fetchStatus: Wn(this.options.networkMode) ? "fetching" : "paused",
|
|
3487
|
+
...!s.dataUpdatedAt && {
|
|
3488
|
+
error: null,
|
|
3489
|
+
status: "pending"
|
|
3490
|
+
}
|
|
3491
|
+
};
|
|
3492
|
+
case "success":
|
|
3493
|
+
return {
|
|
3494
|
+
...s,
|
|
3495
|
+
data: t.data,
|
|
3496
|
+
dataUpdateCount: s.dataUpdateCount + 1,
|
|
3497
|
+
dataUpdatedAt: t.dataUpdatedAt ?? Date.now(),
|
|
3498
|
+
error: null,
|
|
3499
|
+
isInvalidated: !1,
|
|
3500
|
+
status: "success",
|
|
3501
|
+
...!t.manual && {
|
|
3502
|
+
fetchStatus: "idle",
|
|
3503
|
+
fetchFailureCount: 0,
|
|
3504
|
+
fetchFailureReason: null
|
|
3505
|
+
}
|
|
3506
|
+
};
|
|
3507
|
+
case "error":
|
|
3508
|
+
const r = t.error;
|
|
3509
|
+
return is(r) && r.revert && c(this, Ot) ? { ...c(this, Ot), fetchStatus: "idle" } : {
|
|
3510
|
+
...s,
|
|
3511
|
+
error: r,
|
|
3512
|
+
errorUpdateCount: s.errorUpdateCount + 1,
|
|
3513
|
+
errorUpdatedAt: Date.now(),
|
|
3514
|
+
fetchFailureCount: s.fetchFailureCount + 1,
|
|
3515
|
+
fetchFailureReason: r,
|
|
3516
|
+
fetchStatus: "idle",
|
|
3517
|
+
status: "error"
|
|
3518
|
+
};
|
|
3519
|
+
case "invalidate":
|
|
3520
|
+
return {
|
|
3521
|
+
...s,
|
|
3522
|
+
isInvalidated: !0
|
|
3523
|
+
};
|
|
3524
|
+
case "setState":
|
|
3525
|
+
return {
|
|
3526
|
+
...s,
|
|
3527
|
+
...t.state
|
|
3528
|
+
};
|
|
3529
|
+
}
|
|
3530
|
+
};
|
|
3531
|
+
this.state = n(this.state), ae.batch(() => {
|
|
3532
|
+
c(this, ie).forEach((s) => {
|
|
3533
|
+
s.onQueryUpdate();
|
|
3534
|
+
}), c(this, me).notify({ query: this, type: "updated", action: t });
|
|
3535
|
+
});
|
|
3536
|
+
}, zr);
|
|
3537
|
+
function il(e) {
|
|
3538
|
+
const t = typeof e.initialData == "function" ? e.initialData() : e.initialData, n = typeof t < "u", s = n ? typeof e.initialDataUpdatedAt == "function" ? e.initialDataUpdatedAt() : e.initialDataUpdatedAt : 0;
|
|
3539
|
+
return {
|
|
3540
|
+
data: t,
|
|
3541
|
+
dataUpdateCount: 0,
|
|
3542
|
+
dataUpdatedAt: n ? s ?? Date.now() : 0,
|
|
3543
|
+
error: null,
|
|
3544
|
+
errorUpdateCount: 0,
|
|
3545
|
+
errorUpdatedAt: 0,
|
|
3546
|
+
fetchFailureCount: 0,
|
|
3547
|
+
fetchFailureReason: null,
|
|
3548
|
+
fetchMeta: null,
|
|
3549
|
+
isInvalidated: !1,
|
|
3550
|
+
status: n ? "success" : "pending",
|
|
3551
|
+
fetchStatus: "idle"
|
|
3552
|
+
};
|
|
3553
|
+
}
|
|
3554
|
+
var Oe, Gr, ol = (Gr = class extends vn {
|
|
3555
|
+
constructor(t = {}) {
|
|
3556
|
+
super();
|
|
3557
|
+
L(this, Oe, void 0);
|
|
3558
|
+
this.config = t, P(this, Oe, /* @__PURE__ */ new Map());
|
|
3559
|
+
}
|
|
3560
|
+
build(t, n, s) {
|
|
3561
|
+
const r = n.queryKey, o = n.queryHash ?? $s(r, n);
|
|
3562
|
+
let i = this.get(o);
|
|
3563
|
+
return i || (i = new rl({
|
|
3564
|
+
cache: this,
|
|
3565
|
+
queryKey: r,
|
|
3566
|
+
queryHash: o,
|
|
3567
|
+
options: t.defaultQueryOptions(n),
|
|
3568
|
+
state: s,
|
|
3569
|
+
defaultOptions: t.getQueryDefaults(r)
|
|
3570
|
+
}), this.add(i)), i;
|
|
3571
|
+
}
|
|
3572
|
+
add(t) {
|
|
3573
|
+
c(this, Oe).has(t.queryHash) || (c(this, Oe).set(t.queryHash, t), this.notify({
|
|
3574
|
+
type: "added",
|
|
3575
|
+
query: t
|
|
3576
|
+
}));
|
|
3577
|
+
}
|
|
3578
|
+
remove(t) {
|
|
3579
|
+
const n = c(this, Oe).get(t.queryHash);
|
|
3580
|
+
n && (t.destroy(), n === t && c(this, Oe).delete(t.queryHash), this.notify({ type: "removed", query: t }));
|
|
3581
|
+
}
|
|
3582
|
+
clear() {
|
|
3583
|
+
ae.batch(() => {
|
|
3584
|
+
this.getAll().forEach((t) => {
|
|
3585
|
+
this.remove(t);
|
|
3586
|
+
});
|
|
3587
|
+
});
|
|
3588
|
+
}
|
|
3589
|
+
get(t) {
|
|
3590
|
+
return c(this, Oe).get(t);
|
|
3591
|
+
}
|
|
3592
|
+
getAll() {
|
|
3593
|
+
return [...c(this, Oe).values()];
|
|
3594
|
+
}
|
|
3595
|
+
find(t) {
|
|
3596
|
+
const n = { exact: !0, ...t };
|
|
3597
|
+
return this.getAll().find(
|
|
3598
|
+
(s) => Mr(n, s)
|
|
3599
|
+
);
|
|
3600
|
+
}
|
|
3601
|
+
findAll(t = {}) {
|
|
3602
|
+
const n = this.getAll();
|
|
3603
|
+
return Object.keys(t).length > 0 ? n.filter((s) => Mr(t, s)) : n;
|
|
3604
|
+
}
|
|
3605
|
+
notify(t) {
|
|
3606
|
+
ae.batch(() => {
|
|
3607
|
+
this.listeners.forEach((n) => {
|
|
3608
|
+
n(t);
|
|
3609
|
+
});
|
|
3610
|
+
});
|
|
3611
|
+
}
|
|
3612
|
+
onFocus() {
|
|
3613
|
+
ae.batch(() => {
|
|
3614
|
+
this.getAll().forEach((t) => {
|
|
3615
|
+
t.onFocus();
|
|
3616
|
+
});
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3619
|
+
onOnline() {
|
|
3620
|
+
ae.batch(() => {
|
|
3621
|
+
this.getAll().forEach((t) => {
|
|
3622
|
+
t.onOnline();
|
|
3623
|
+
});
|
|
3624
|
+
});
|
|
3625
|
+
}
|
|
3626
|
+
}, Oe = new WeakMap(), Gr), _e, on, fe, Ct, Ce, Ne, Wr, al = (Wr = class extends oo {
|
|
3627
|
+
constructor(t) {
|
|
3628
|
+
super();
|
|
3629
|
+
L(this, Ce);
|
|
3630
|
+
L(this, _e, void 0);
|
|
3631
|
+
L(this, on, void 0);
|
|
3632
|
+
L(this, fe, void 0);
|
|
3633
|
+
L(this, Ct, void 0);
|
|
3634
|
+
this.mutationId = t.mutationId, P(this, on, t.defaultOptions), P(this, fe, t.mutationCache), P(this, _e, []), this.state = t.state || cl(), this.setOptions(t.options), this.scheduleGc();
|
|
3635
|
+
}
|
|
3636
|
+
setOptions(t) {
|
|
3637
|
+
this.options = { ...c(this, on), ...t }, this.updateGcTime(this.options.gcTime);
|
|
3638
|
+
}
|
|
3639
|
+
get meta() {
|
|
3640
|
+
return this.options.meta;
|
|
3641
|
+
}
|
|
3642
|
+
addObserver(t) {
|
|
3643
|
+
c(this, _e).includes(t) || (c(this, _e).push(t), this.clearGcTimeout(), c(this, fe).notify({
|
|
3644
|
+
type: "observerAdded",
|
|
3645
|
+
mutation: this,
|
|
3646
|
+
observer: t
|
|
3647
|
+
}));
|
|
3648
|
+
}
|
|
3649
|
+
removeObserver(t) {
|
|
3650
|
+
P(this, _e, c(this, _e).filter((n) => n !== t)), this.scheduleGc(), c(this, fe).notify({
|
|
3651
|
+
type: "observerRemoved",
|
|
3652
|
+
mutation: this,
|
|
3653
|
+
observer: t
|
|
3654
|
+
});
|
|
3655
|
+
}
|
|
3656
|
+
optionalRemove() {
|
|
3657
|
+
c(this, _e).length || (this.state.status === "pending" ? this.scheduleGc() : c(this, fe).remove(this));
|
|
3658
|
+
}
|
|
3659
|
+
continue() {
|
|
3660
|
+
var t;
|
|
3661
|
+
return ((t = c(this, Ct)) == null ? void 0 : t.continue()) ?? // continuing a mutation assumes that variables are set, mutation must have been dehydrated before
|
|
3662
|
+
this.execute(this.state.variables);
|
|
3663
|
+
}
|
|
3664
|
+
async execute(t) {
|
|
3665
|
+
var r, o, i, a, d, u, f, m, b, g, O, C, y, A, D, B, x, k, F, T;
|
|
3666
|
+
const n = () => (P(this, Ct, io({
|
|
3667
|
+
fn: () => this.options.mutationFn ? this.options.mutationFn(t) : Promise.reject(new Error("No mutationFn found")),
|
|
3668
|
+
onFail: (R, p) => {
|
|
3669
|
+
K(this, Ce, Ne).call(this, { type: "failed", failureCount: R, error: p });
|
|
3670
|
+
},
|
|
3671
|
+
onPause: () => {
|
|
3672
|
+
K(this, Ce, Ne).call(this, { type: "pause" });
|
|
3673
|
+
},
|
|
3674
|
+
onContinue: () => {
|
|
3675
|
+
K(this, Ce, Ne).call(this, { type: "continue" });
|
|
3676
|
+
},
|
|
3677
|
+
retry: this.options.retry ?? 0,
|
|
3678
|
+
retryDelay: this.options.retryDelay,
|
|
3679
|
+
networkMode: this.options.networkMode
|
|
3680
|
+
})), c(this, Ct).promise), s = this.state.status === "pending";
|
|
3681
|
+
try {
|
|
3682
|
+
if (!s) {
|
|
3683
|
+
K(this, Ce, Ne).call(this, { type: "pending", variables: t }), await ((o = (r = c(this, fe).config).onMutate) == null ? void 0 : o.call(
|
|
3684
|
+
r,
|
|
3685
|
+
t,
|
|
3686
|
+
this
|
|
3687
|
+
));
|
|
3688
|
+
const p = await ((a = (i = this.options).onMutate) == null ? void 0 : a.call(i, t));
|
|
3689
|
+
p !== this.state.context && K(this, Ce, Ne).call(this, {
|
|
3690
|
+
type: "pending",
|
|
3691
|
+
context: p,
|
|
3692
|
+
variables: t
|
|
3693
|
+
});
|
|
3694
|
+
}
|
|
3695
|
+
const R = await n();
|
|
3696
|
+
return await ((u = (d = c(this, fe).config).onSuccess) == null ? void 0 : u.call(
|
|
3697
|
+
d,
|
|
3698
|
+
R,
|
|
3699
|
+
t,
|
|
3700
|
+
this.state.context,
|
|
3701
|
+
this
|
|
3702
|
+
)), await ((m = (f = this.options).onSuccess) == null ? void 0 : m.call(f, R, t, this.state.context)), await ((g = (b = c(this, fe).config).onSettled) == null ? void 0 : g.call(
|
|
3703
|
+
b,
|
|
3704
|
+
R,
|
|
3705
|
+
null,
|
|
3706
|
+
this.state.variables,
|
|
3707
|
+
this.state.context,
|
|
3708
|
+
this
|
|
3709
|
+
)), await ((C = (O = this.options).onSettled) == null ? void 0 : C.call(O, R, null, t, this.state.context)), K(this, Ce, Ne).call(this, { type: "success", data: R }), R;
|
|
3710
|
+
} catch (R) {
|
|
3711
|
+
try {
|
|
3712
|
+
throw await ((A = (y = c(this, fe).config).onError) == null ? void 0 : A.call(
|
|
3713
|
+
y,
|
|
3714
|
+
R,
|
|
3715
|
+
t,
|
|
3716
|
+
this.state.context,
|
|
3717
|
+
this
|
|
3718
|
+
)), await ((B = (D = this.options).onError) == null ? void 0 : B.call(
|
|
3719
|
+
D,
|
|
3720
|
+
R,
|
|
3721
|
+
t,
|
|
3722
|
+
this.state.context
|
|
3723
|
+
)), await ((k = (x = c(this, fe).config).onSettled) == null ? void 0 : k.call(
|
|
3724
|
+
x,
|
|
3725
|
+
void 0,
|
|
3726
|
+
R,
|
|
3727
|
+
this.state.variables,
|
|
3728
|
+
this.state.context,
|
|
3729
|
+
this
|
|
3730
|
+
)), await ((T = (F = this.options).onSettled) == null ? void 0 : T.call(
|
|
3731
|
+
F,
|
|
3732
|
+
void 0,
|
|
3733
|
+
R,
|
|
3734
|
+
t,
|
|
3735
|
+
this.state.context
|
|
3736
|
+
)), R;
|
|
3737
|
+
} finally {
|
|
3738
|
+
K(this, Ce, Ne).call(this, { type: "error", error: R });
|
|
3739
|
+
}
|
|
3740
|
+
}
|
|
3741
|
+
}
|
|
3742
|
+
}, _e = new WeakMap(), on = new WeakMap(), fe = new WeakMap(), Ct = new WeakMap(), Ce = new WeakSet(), Ne = function(t) {
|
|
3743
|
+
const n = (s) => {
|
|
3744
|
+
switch (t.type) {
|
|
3745
|
+
case "failed":
|
|
3746
|
+
return {
|
|
3747
|
+
...s,
|
|
3748
|
+
failureCount: t.failureCount,
|
|
3749
|
+
failureReason: t.error
|
|
3750
|
+
};
|
|
3751
|
+
case "pause":
|
|
3752
|
+
return {
|
|
3753
|
+
...s,
|
|
3754
|
+
isPaused: !0
|
|
3755
|
+
};
|
|
3756
|
+
case "continue":
|
|
3757
|
+
return {
|
|
3758
|
+
...s,
|
|
3759
|
+
isPaused: !1
|
|
3760
|
+
};
|
|
3761
|
+
case "pending":
|
|
3762
|
+
return {
|
|
3763
|
+
...s,
|
|
3764
|
+
context: t.context,
|
|
3765
|
+
data: void 0,
|
|
3766
|
+
failureCount: 0,
|
|
3767
|
+
failureReason: null,
|
|
3768
|
+
error: null,
|
|
3769
|
+
isPaused: !Wn(this.options.networkMode),
|
|
3770
|
+
status: "pending",
|
|
3771
|
+
variables: t.variables,
|
|
3772
|
+
submittedAt: Date.now()
|
|
3773
|
+
};
|
|
3774
|
+
case "success":
|
|
3775
|
+
return {
|
|
3776
|
+
...s,
|
|
3777
|
+
data: t.data,
|
|
3778
|
+
failureCount: 0,
|
|
3779
|
+
failureReason: null,
|
|
3780
|
+
error: null,
|
|
3781
|
+
status: "success",
|
|
3782
|
+
isPaused: !1
|
|
3783
|
+
};
|
|
3784
|
+
case "error":
|
|
3785
|
+
return {
|
|
3786
|
+
...s,
|
|
3787
|
+
data: void 0,
|
|
3788
|
+
error: t.error,
|
|
3789
|
+
failureCount: s.failureCount + 1,
|
|
3790
|
+
failureReason: t.error,
|
|
3791
|
+
isPaused: !1,
|
|
3792
|
+
status: "error"
|
|
3793
|
+
};
|
|
3794
|
+
}
|
|
3795
|
+
};
|
|
3796
|
+
this.state = n(this.state), ae.batch(() => {
|
|
3797
|
+
c(this, _e).forEach((s) => {
|
|
3798
|
+
s.onMutationUpdate(t);
|
|
3799
|
+
}), c(this, fe).notify({
|
|
3800
|
+
mutation: this,
|
|
3801
|
+
type: "updated",
|
|
3802
|
+
action: t
|
|
3803
|
+
});
|
|
3804
|
+
});
|
|
3805
|
+
}, Wr);
|
|
3806
|
+
function cl() {
|
|
3807
|
+
return {
|
|
3808
|
+
context: void 0,
|
|
3809
|
+
data: void 0,
|
|
3810
|
+
error: null,
|
|
3811
|
+
failureCount: 0,
|
|
3812
|
+
failureReason: null,
|
|
3813
|
+
isPaused: !1,
|
|
3814
|
+
status: "idle",
|
|
3815
|
+
variables: void 0,
|
|
3816
|
+
submittedAt: 0
|
|
3817
|
+
};
|
|
3818
|
+
}
|
|
3819
|
+
var ye, an, nt, Hr, ul = (Hr = class extends vn {
|
|
3820
|
+
constructor(t = {}) {
|
|
3821
|
+
super();
|
|
3822
|
+
L(this, ye, void 0);
|
|
3823
|
+
L(this, an, void 0);
|
|
3824
|
+
L(this, nt, void 0);
|
|
3825
|
+
this.config = t, P(this, ye, []), P(this, an, 0);
|
|
3826
|
+
}
|
|
3827
|
+
build(t, n, s) {
|
|
3828
|
+
const r = new al({
|
|
3829
|
+
mutationCache: this,
|
|
3830
|
+
mutationId: ++wn(this, an)._,
|
|
3831
|
+
options: t.defaultMutationOptions(n),
|
|
3832
|
+
state: s
|
|
3833
|
+
});
|
|
3834
|
+
return this.add(r), r;
|
|
3835
|
+
}
|
|
3836
|
+
add(t) {
|
|
3837
|
+
c(this, ye).push(t), this.notify({ type: "added", mutation: t });
|
|
3838
|
+
}
|
|
3839
|
+
remove(t) {
|
|
3840
|
+
P(this, ye, c(this, ye).filter((n) => n !== t)), this.notify({ type: "removed", mutation: t });
|
|
3841
|
+
}
|
|
3842
|
+
clear() {
|
|
3843
|
+
ae.batch(() => {
|
|
3844
|
+
c(this, ye).forEach((t) => {
|
|
3845
|
+
this.remove(t);
|
|
3846
|
+
});
|
|
3847
|
+
});
|
|
3848
|
+
}
|
|
3849
|
+
getAll() {
|
|
3850
|
+
return c(this, ye);
|
|
3851
|
+
}
|
|
3852
|
+
find(t) {
|
|
3853
|
+
const n = { exact: !0, ...t };
|
|
3854
|
+
return c(this, ye).find(
|
|
3855
|
+
(s) => Lr(n, s)
|
|
3856
|
+
);
|
|
3857
|
+
}
|
|
3858
|
+
findAll(t = {}) {
|
|
3859
|
+
return c(this, ye).filter(
|
|
3860
|
+
(n) => Lr(t, n)
|
|
3861
|
+
);
|
|
3862
|
+
}
|
|
3863
|
+
notify(t) {
|
|
3864
|
+
ae.batch(() => {
|
|
3865
|
+
this.listeners.forEach((n) => {
|
|
3866
|
+
n(t);
|
|
3867
|
+
});
|
|
3868
|
+
});
|
|
3869
|
+
}
|
|
3870
|
+
resumePausedMutations() {
|
|
3871
|
+
return P(this, nt, (c(this, nt) ?? Promise.resolve()).then(() => {
|
|
3872
|
+
const t = c(this, ye).filter((n) => n.state.isPaused);
|
|
3873
|
+
return ae.batch(
|
|
3874
|
+
() => t.reduce(
|
|
3875
|
+
(n, s) => n.then(() => s.continue().catch(ve)),
|
|
3876
|
+
Promise.resolve()
|
|
3877
|
+
)
|
|
3878
|
+
);
|
|
3879
|
+
}).then(() => {
|
|
3880
|
+
P(this, nt, void 0);
|
|
3881
|
+
})), c(this, nt);
|
|
3882
|
+
}
|
|
3883
|
+
}, ye = new WeakMap(), an = new WeakMap(), nt = new WeakMap(), Hr);
|
|
3884
|
+
function ll(e) {
|
|
3885
|
+
return {
|
|
3886
|
+
onFetch: (t, n) => {
|
|
3887
|
+
const s = async () => {
|
|
3888
|
+
var O, C, y, A, D;
|
|
3889
|
+
const r = t.options, o = (y = (C = (O = t.fetchOptions) == null ? void 0 : O.meta) == null ? void 0 : C.fetchMore) == null ? void 0 : y.direction, i = ((A = t.state.data) == null ? void 0 : A.pages) || [], a = ((D = t.state.data) == null ? void 0 : D.pageParams) || [], d = { pages: [], pageParams: [] };
|
|
3890
|
+
let u = !1;
|
|
3891
|
+
const f = (B) => {
|
|
3892
|
+
Object.defineProperty(B, "signal", {
|
|
3893
|
+
enumerable: !0,
|
|
3894
|
+
get: () => (t.signal.aborted ? u = !0 : t.signal.addEventListener("abort", () => {
|
|
3895
|
+
u = !0;
|
|
3896
|
+
}), t.signal)
|
|
3897
|
+
});
|
|
3898
|
+
}, m = t.options.queryFn || (() => Promise.reject(
|
|
3899
|
+
new Error(`Missing queryFn: '${t.options.queryHash}'`)
|
|
3900
|
+
)), b = async (B, x, k) => {
|
|
3901
|
+
if (u)
|
|
3902
|
+
return Promise.reject();
|
|
3903
|
+
if (x == null && B.pages.length)
|
|
3904
|
+
return Promise.resolve(B);
|
|
3905
|
+
const F = {
|
|
3906
|
+
queryKey: t.queryKey,
|
|
3907
|
+
pageParam: x,
|
|
3908
|
+
direction: k ? "backward" : "forward",
|
|
3909
|
+
meta: t.options.meta
|
|
3910
|
+
};
|
|
3911
|
+
f(F);
|
|
3912
|
+
const T = await m(
|
|
3913
|
+
F
|
|
3914
|
+
), { maxPages: R } = t.options, p = k ? Zu : Yu;
|
|
3915
|
+
return {
|
|
3916
|
+
pages: p(B.pages, T, R),
|
|
3917
|
+
pageParams: p(B.pageParams, x, R)
|
|
3918
|
+
};
|
|
3919
|
+
};
|
|
3920
|
+
let g;
|
|
3921
|
+
if (o && i.length) {
|
|
3922
|
+
const B = o === "backward", x = B ? dl : Ur, k = {
|
|
3923
|
+
pages: i,
|
|
3924
|
+
pageParams: a
|
|
3925
|
+
}, F = x(r, k);
|
|
3926
|
+
g = await b(k, F, B);
|
|
3927
|
+
} else {
|
|
3928
|
+
g = await b(
|
|
3929
|
+
d,
|
|
3930
|
+
a[0] ?? r.initialPageParam
|
|
3931
|
+
);
|
|
3932
|
+
const B = e ?? i.length;
|
|
3933
|
+
for (let x = 1; x < B; x++) {
|
|
3934
|
+
const k = Ur(r, g);
|
|
3935
|
+
g = await b(g, k);
|
|
3936
|
+
}
|
|
3937
|
+
}
|
|
3938
|
+
return g;
|
|
3939
|
+
};
|
|
3940
|
+
t.options.persister ? t.fetchFn = () => {
|
|
3941
|
+
var r, o;
|
|
3942
|
+
return (o = (r = t.options).persister) == null ? void 0 : o.call(
|
|
3943
|
+
r,
|
|
3944
|
+
s,
|
|
3945
|
+
{
|
|
3946
|
+
queryKey: t.queryKey,
|
|
3947
|
+
meta: t.options.meta,
|
|
3948
|
+
signal: t.signal
|
|
3949
|
+
},
|
|
3950
|
+
n
|
|
3951
|
+
);
|
|
3952
|
+
} : t.fetchFn = s;
|
|
3953
|
+
}
|
|
3954
|
+
};
|
|
3955
|
+
}
|
|
3956
|
+
function Ur(e, { pages: t, pageParams: n }) {
|
|
3957
|
+
const s = t.length - 1;
|
|
3958
|
+
return e.getNextPageParam(
|
|
3959
|
+
t[s],
|
|
3960
|
+
t,
|
|
3961
|
+
n[s],
|
|
3962
|
+
n
|
|
3963
|
+
);
|
|
3964
|
+
}
|
|
3965
|
+
function dl(e, { pages: t, pageParams: n }) {
|
|
3966
|
+
var s;
|
|
3967
|
+
return (s = e.getPreviousPageParam) == null ? void 0 : s.call(
|
|
3968
|
+
e,
|
|
3969
|
+
t[0],
|
|
3970
|
+
t,
|
|
3971
|
+
n[0],
|
|
3972
|
+
n
|
|
3973
|
+
);
|
|
3974
|
+
}
|
|
3975
|
+
var re, Ve, Ke, It, jt, ze, Bt, Rt, Jr, fl = (Jr = class {
|
|
3976
|
+
constructor(e = {}) {
|
|
3977
|
+
L(this, re, void 0);
|
|
3978
|
+
L(this, Ve, void 0);
|
|
3979
|
+
L(this, Ke, void 0);
|
|
3980
|
+
L(this, It, void 0);
|
|
3981
|
+
L(this, jt, void 0);
|
|
3982
|
+
L(this, ze, void 0);
|
|
3983
|
+
L(this, Bt, void 0);
|
|
3984
|
+
L(this, Rt, void 0);
|
|
3985
|
+
P(this, re, e.queryCache || new ol()), P(this, Ve, e.mutationCache || new ul()), P(this, Ke, e.defaultOptions || {}), P(this, It, /* @__PURE__ */ new Map()), P(this, jt, /* @__PURE__ */ new Map()), P(this, ze, 0);
|
|
3986
|
+
}
|
|
3987
|
+
mount() {
|
|
3988
|
+
wn(this, ze)._++, c(this, ze) === 1 && (P(this, Bt, Mn.subscribe(() => {
|
|
3989
|
+
Mn.isFocused() && (this.resumePausedMutations(), c(this, re).onFocus());
|
|
3990
|
+
})), P(this, Rt, Ln.subscribe(() => {
|
|
3991
|
+
Ln.isOnline() && (this.resumePausedMutations(), c(this, re).onOnline());
|
|
3992
|
+
})));
|
|
3993
|
+
}
|
|
3994
|
+
unmount() {
|
|
3995
|
+
var e, t;
|
|
3996
|
+
wn(this, ze)._--, c(this, ze) === 0 && ((e = c(this, Bt)) == null || e.call(this), P(this, Bt, void 0), (t = c(this, Rt)) == null || t.call(this), P(this, Rt, void 0));
|
|
3997
|
+
}
|
|
3998
|
+
isFetching(e) {
|
|
3999
|
+
return c(this, re).findAll({ ...e, fetchStatus: "fetching" }).length;
|
|
4000
|
+
}
|
|
4001
|
+
isMutating(e) {
|
|
4002
|
+
return c(this, Ve).findAll({ ...e, status: "pending" }).length;
|
|
4003
|
+
}
|
|
4004
|
+
getQueryData(e) {
|
|
4005
|
+
var t;
|
|
4006
|
+
return (t = c(this, re).find({ queryKey: e })) == null ? void 0 : t.state.data;
|
|
4007
|
+
}
|
|
4008
|
+
ensureQueryData(e) {
|
|
4009
|
+
const t = this.getQueryData(e.queryKey);
|
|
4010
|
+
return t !== void 0 ? Promise.resolve(t) : this.fetchQuery(e);
|
|
4011
|
+
}
|
|
4012
|
+
getQueriesData(e) {
|
|
4013
|
+
return this.getQueryCache().findAll(e).map(({ queryKey: t, state: n }) => {
|
|
4014
|
+
const s = n.data;
|
|
4015
|
+
return [t, s];
|
|
4016
|
+
});
|
|
4017
|
+
}
|
|
4018
|
+
setQueryData(e, t, n) {
|
|
4019
|
+
const s = c(this, re).find({ queryKey: e }), r = s == null ? void 0 : s.state.data, o = Xu(t, r);
|
|
4020
|
+
if (typeof o > "u")
|
|
4021
|
+
return;
|
|
4022
|
+
const i = this.defaultQueryOptions({ queryKey: e });
|
|
4023
|
+
return c(this, re).build(this, i).setData(o, { ...n, manual: !0 });
|
|
4024
|
+
}
|
|
4025
|
+
setQueriesData(e, t, n) {
|
|
4026
|
+
return ae.batch(
|
|
4027
|
+
() => this.getQueryCache().findAll(e).map(({ queryKey: s }) => [
|
|
4028
|
+
s,
|
|
4029
|
+
this.setQueryData(s, t, n)
|
|
4030
|
+
])
|
|
4031
|
+
);
|
|
4032
|
+
}
|
|
4033
|
+
getQueryState(e) {
|
|
4034
|
+
var t;
|
|
4035
|
+
return (t = c(this, re).find({ queryKey: e })) == null ? void 0 : t.state;
|
|
4036
|
+
}
|
|
4037
|
+
removeQueries(e) {
|
|
4038
|
+
const t = c(this, re);
|
|
4039
|
+
ae.batch(() => {
|
|
4040
|
+
t.findAll(e).forEach((n) => {
|
|
4041
|
+
t.remove(n);
|
|
4042
|
+
});
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
resetQueries(e, t) {
|
|
4046
|
+
const n = c(this, re), s = {
|
|
4047
|
+
type: "active",
|
|
4048
|
+
...e
|
|
4049
|
+
};
|
|
4050
|
+
return ae.batch(() => (n.findAll(e).forEach((r) => {
|
|
4051
|
+
r.reset();
|
|
4052
|
+
}), this.refetchQueries(s, t)));
|
|
4053
|
+
}
|
|
4054
|
+
cancelQueries(e = {}, t = {}) {
|
|
4055
|
+
const n = { revert: !0, ...t }, s = ae.batch(
|
|
4056
|
+
() => c(this, re).findAll(e).map((r) => r.cancel(n))
|
|
4057
|
+
);
|
|
4058
|
+
return Promise.all(s).then(ve).catch(ve);
|
|
4059
|
+
}
|
|
4060
|
+
invalidateQueries(e = {}, t = {}) {
|
|
4061
|
+
return ae.batch(() => {
|
|
4062
|
+
if (c(this, re).findAll(e).forEach((s) => {
|
|
4063
|
+
s.invalidate();
|
|
4064
|
+
}), e.refetchType === "none")
|
|
4065
|
+
return Promise.resolve();
|
|
4066
|
+
const n = {
|
|
4067
|
+
...e,
|
|
4068
|
+
type: e.refetchType ?? e.type ?? "active"
|
|
4069
|
+
};
|
|
4070
|
+
return this.refetchQueries(n, t);
|
|
4071
|
+
});
|
|
4072
|
+
}
|
|
4073
|
+
refetchQueries(e = {}, t) {
|
|
4074
|
+
const n = {
|
|
4075
|
+
...t,
|
|
4076
|
+
cancelRefetch: (t == null ? void 0 : t.cancelRefetch) ?? !0
|
|
4077
|
+
}, s = ae.batch(
|
|
4078
|
+
() => c(this, re).findAll(e).filter((r) => !r.isDisabled()).map((r) => {
|
|
4079
|
+
let o = r.fetch(void 0, n);
|
|
4080
|
+
return n.throwOnError || (o = o.catch(ve)), r.state.fetchStatus === "paused" ? Promise.resolve() : o;
|
|
4081
|
+
})
|
|
4082
|
+
);
|
|
4083
|
+
return Promise.all(s).then(ve);
|
|
4084
|
+
}
|
|
4085
|
+
fetchQuery(e) {
|
|
4086
|
+
const t = this.defaultQueryOptions(e);
|
|
4087
|
+
typeof t.retry > "u" && (t.retry = !1);
|
|
4088
|
+
const n = c(this, re).build(this, t);
|
|
4089
|
+
return n.isStaleByTime(t.staleTime) ? n.fetch(t) : Promise.resolve(n.state.data);
|
|
4090
|
+
}
|
|
4091
|
+
prefetchQuery(e) {
|
|
4092
|
+
return this.fetchQuery(e).then(ve).catch(ve);
|
|
4093
|
+
}
|
|
4094
|
+
fetchInfiniteQuery(e) {
|
|
4095
|
+
return e.behavior = ll(e.pages), this.fetchQuery(e);
|
|
4096
|
+
}
|
|
4097
|
+
prefetchInfiniteQuery(e) {
|
|
4098
|
+
return this.fetchInfiniteQuery(e).then(ve).catch(ve);
|
|
4099
|
+
}
|
|
4100
|
+
resumePausedMutations() {
|
|
4101
|
+
return c(this, Ve).resumePausedMutations();
|
|
4102
|
+
}
|
|
4103
|
+
getQueryCache() {
|
|
4104
|
+
return c(this, re);
|
|
4105
|
+
}
|
|
4106
|
+
getMutationCache() {
|
|
4107
|
+
return c(this, Ve);
|
|
4108
|
+
}
|
|
4109
|
+
getDefaultOptions() {
|
|
4110
|
+
return c(this, Ke);
|
|
4111
|
+
}
|
|
4112
|
+
setDefaultOptions(e) {
|
|
4113
|
+
P(this, Ke, e);
|
|
4114
|
+
}
|
|
4115
|
+
setQueryDefaults(e, t) {
|
|
4116
|
+
c(this, It).set(nn(e), {
|
|
4117
|
+
queryKey: e,
|
|
4118
|
+
defaultOptions: t
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
4121
|
+
getQueryDefaults(e) {
|
|
4122
|
+
const t = [...c(this, It).values()];
|
|
4123
|
+
let n = {};
|
|
4124
|
+
return t.forEach((s) => {
|
|
4125
|
+
sn(e, s.queryKey) && (n = { ...n, ...s.defaultOptions });
|
|
4126
|
+
}), n;
|
|
4127
|
+
}
|
|
4128
|
+
setMutationDefaults(e, t) {
|
|
4129
|
+
c(this, jt).set(nn(e), {
|
|
4130
|
+
mutationKey: e,
|
|
4131
|
+
defaultOptions: t
|
|
4132
|
+
});
|
|
4133
|
+
}
|
|
4134
|
+
getMutationDefaults(e) {
|
|
4135
|
+
const t = [...c(this, jt).values()];
|
|
4136
|
+
let n = {};
|
|
4137
|
+
return t.forEach((s) => {
|
|
4138
|
+
sn(e, s.mutationKey) && (n = { ...n, ...s.defaultOptions });
|
|
4139
|
+
}), n;
|
|
4140
|
+
}
|
|
4141
|
+
defaultQueryOptions(e) {
|
|
4142
|
+
if (e != null && e._defaulted)
|
|
4143
|
+
return e;
|
|
4144
|
+
const t = {
|
|
4145
|
+
...c(this, Ke).queries,
|
|
4146
|
+
...(e == null ? void 0 : e.queryKey) && this.getQueryDefaults(e.queryKey),
|
|
4147
|
+
...e,
|
|
4148
|
+
_defaulted: !0
|
|
4149
|
+
};
|
|
4150
|
+
return t.queryHash || (t.queryHash = $s(
|
|
4151
|
+
t.queryKey,
|
|
4152
|
+
t
|
|
4153
|
+
)), typeof t.refetchOnReconnect > "u" && (t.refetchOnReconnect = t.networkMode !== "always"), typeof t.throwOnError > "u" && (t.throwOnError = !!t.suspense), typeof t.networkMode > "u" && t.persister && (t.networkMode = "offlineFirst"), t;
|
|
4154
|
+
}
|
|
4155
|
+
defaultMutationOptions(e) {
|
|
4156
|
+
return e != null && e._defaulted ? e : {
|
|
4157
|
+
...c(this, Ke).mutations,
|
|
4158
|
+
...(e == null ? void 0 : e.mutationKey) && this.getMutationDefaults(e.mutationKey),
|
|
4159
|
+
...e,
|
|
4160
|
+
_defaulted: !0
|
|
4161
|
+
};
|
|
4162
|
+
}
|
|
4163
|
+
clear() {
|
|
4164
|
+
c(this, re).clear(), c(this, Ve).clear();
|
|
4165
|
+
}
|
|
4166
|
+
}, re = new WeakMap(), Ve = new WeakMap(), Ke = new WeakMap(), It = new WeakMap(), jt = new WeakMap(), ze = new WeakMap(), Bt = new WeakMap(), Rt = new WeakMap(), Jr), le, Z, Dt, ce, st, Mt, Ie, cn, Lt, Nt, rt, it, Ge, ot, at, Ht, un, ys, ln, vs, dn, bs, fn, ws, hn, Ss, pn, xs, mn, ks, Nn, ao, Xr, hl = (Xr = class extends vn {
|
|
4167
|
+
constructor(t, n) {
|
|
4168
|
+
super();
|
|
4169
|
+
L(this, at);
|
|
4170
|
+
L(this, un);
|
|
4171
|
+
L(this, ln);
|
|
4172
|
+
L(this, dn);
|
|
4173
|
+
L(this, fn);
|
|
4174
|
+
L(this, hn);
|
|
4175
|
+
L(this, pn);
|
|
4176
|
+
L(this, mn);
|
|
4177
|
+
L(this, Nn);
|
|
4178
|
+
L(this, le, void 0);
|
|
4179
|
+
L(this, Z, void 0);
|
|
4180
|
+
L(this, Dt, void 0);
|
|
4181
|
+
L(this, ce, void 0);
|
|
4182
|
+
L(this, st, void 0);
|
|
4183
|
+
L(this, Mt, void 0);
|
|
4184
|
+
L(this, Ie, void 0);
|
|
4185
|
+
L(this, cn, void 0);
|
|
4186
|
+
L(this, Lt, void 0);
|
|
4187
|
+
// This property keeps track of the last query with defined data.
|
|
4188
|
+
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
4189
|
+
L(this, Nt, void 0);
|
|
4190
|
+
L(this, rt, void 0);
|
|
4191
|
+
L(this, it, void 0);
|
|
4192
|
+
L(this, Ge, void 0);
|
|
4193
|
+
L(this, ot, void 0);
|
|
4194
|
+
P(this, Z, void 0), P(this, Dt, void 0), P(this, ce, void 0), P(this, ot, /* @__PURE__ */ new Set()), P(this, le, t), this.options = n, P(this, Ie, null), this.bindMethods(), this.setOptions(n);
|
|
4195
|
+
}
|
|
4196
|
+
bindMethods() {
|
|
4197
|
+
this.refetch = this.refetch.bind(this);
|
|
4198
|
+
}
|
|
4199
|
+
onSubscribe() {
|
|
4200
|
+
this.listeners.size === 1 && (c(this, Z).addObserver(this), qr(c(this, Z), this.options) ? K(this, at, Ht).call(this) : this.updateResult(), K(this, fn, ws).call(this));
|
|
4201
|
+
}
|
|
4202
|
+
onUnsubscribe() {
|
|
4203
|
+
this.hasListeners() || this.destroy();
|
|
4204
|
+
}
|
|
4205
|
+
shouldFetchOnReconnect() {
|
|
4206
|
+
return As(
|
|
4207
|
+
c(this, Z),
|
|
4208
|
+
this.options,
|
|
4209
|
+
this.options.refetchOnReconnect
|
|
4210
|
+
);
|
|
4211
|
+
}
|
|
4212
|
+
shouldFetchOnWindowFocus() {
|
|
4213
|
+
return As(
|
|
4214
|
+
c(this, Z),
|
|
4215
|
+
this.options,
|
|
4216
|
+
this.options.refetchOnWindowFocus
|
|
4217
|
+
);
|
|
4218
|
+
}
|
|
4219
|
+
destroy() {
|
|
4220
|
+
this.listeners = /* @__PURE__ */ new Set(), K(this, hn, Ss).call(this), K(this, pn, xs).call(this), c(this, Z).removeObserver(this);
|
|
4221
|
+
}
|
|
4222
|
+
setOptions(t, n) {
|
|
4223
|
+
const s = this.options, r = c(this, Z);
|
|
4224
|
+
if (this.options = c(this, le).defaultQueryOptions(t), ps(s, this.options) || c(this, le).getQueryCache().notify({
|
|
4225
|
+
type: "observerOptionsUpdated",
|
|
4226
|
+
query: c(this, Z),
|
|
4227
|
+
observer: this
|
|
4228
|
+
}), typeof this.options.enabled < "u" && typeof this.options.enabled != "boolean")
|
|
4229
|
+
throw new Error("Expected enabled to be a boolean");
|
|
4230
|
+
this.options.queryKey || (this.options.queryKey = s.queryKey), K(this, mn, ks).call(this);
|
|
4231
|
+
const o = this.hasListeners();
|
|
4232
|
+
o && $r(
|
|
4233
|
+
c(this, Z),
|
|
4234
|
+
r,
|
|
4235
|
+
this.options,
|
|
4236
|
+
s
|
|
4237
|
+
) && K(this, at, Ht).call(this), this.updateResult(n), o && (c(this, Z) !== r || this.options.enabled !== s.enabled || this.options.staleTime !== s.staleTime) && K(this, un, ys).call(this);
|
|
4238
|
+
const i = K(this, ln, vs).call(this);
|
|
4239
|
+
o && (c(this, Z) !== r || this.options.enabled !== s.enabled || i !== c(this, Ge)) && K(this, dn, bs).call(this, i);
|
|
4240
|
+
}
|
|
4241
|
+
getOptimisticResult(t) {
|
|
4242
|
+
const n = c(this, le).getQueryCache().build(c(this, le), t), s = this.createResult(n, t);
|
|
4243
|
+
return ml(this, s) && (P(this, ce, s), P(this, Mt, this.options), P(this, st, c(this, Z).state)), s;
|
|
4244
|
+
}
|
|
4245
|
+
getCurrentResult() {
|
|
4246
|
+
return c(this, ce);
|
|
4247
|
+
}
|
|
4248
|
+
trackResult(t) {
|
|
4249
|
+
const n = {};
|
|
4250
|
+
return Object.keys(t).forEach((s) => {
|
|
4251
|
+
Object.defineProperty(n, s, {
|
|
4252
|
+
configurable: !1,
|
|
4253
|
+
enumerable: !0,
|
|
4254
|
+
get: () => (c(this, ot).add(s), t[s])
|
|
4255
|
+
});
|
|
4256
|
+
}), n;
|
|
4257
|
+
}
|
|
4258
|
+
getCurrentQuery() {
|
|
4259
|
+
return c(this, Z);
|
|
4260
|
+
}
|
|
4261
|
+
refetch({ ...t } = {}) {
|
|
4262
|
+
return this.fetch({
|
|
4263
|
+
...t
|
|
4264
|
+
});
|
|
4265
|
+
}
|
|
4266
|
+
fetchOptimistic(t) {
|
|
4267
|
+
const n = c(this, le).defaultQueryOptions(t), s = c(this, le).getQueryCache().build(c(this, le), n);
|
|
4268
|
+
return s.isFetchingOptimistic = !0, s.fetch().then(() => this.createResult(s, n));
|
|
4269
|
+
}
|
|
4270
|
+
fetch(t) {
|
|
4271
|
+
return K(this, at, Ht).call(this, {
|
|
4272
|
+
...t,
|
|
4273
|
+
cancelRefetch: t.cancelRefetch ?? !0
|
|
4274
|
+
}).then(() => (this.updateResult(), c(this, ce)));
|
|
4275
|
+
}
|
|
4276
|
+
createResult(t, n) {
|
|
4277
|
+
var F;
|
|
4278
|
+
const s = c(this, Z), r = this.options, o = c(this, ce), i = c(this, st), a = c(this, Mt), u = t !== s ? t.state : c(this, Dt), { state: f } = t;
|
|
4279
|
+
let { error: m, errorUpdatedAt: b, fetchStatus: g, status: O } = f, C = !1, y;
|
|
4280
|
+
if (n._optimisticResults) {
|
|
4281
|
+
const T = this.hasListeners(), R = !T && qr(t, n), p = T && $r(t, s, n, r);
|
|
4282
|
+
(R || p) && (g = Wn(t.options.networkMode) ? "fetching" : "paused", f.dataUpdatedAt || (O = "pending")), n._optimisticResults === "isRestoring" && (g = "idle");
|
|
4283
|
+
}
|
|
4284
|
+
if (n.select && typeof f.data < "u")
|
|
4285
|
+
if (o && f.data === (i == null ? void 0 : i.data) && n.select === c(this, cn))
|
|
4286
|
+
y = c(this, Lt);
|
|
4287
|
+
else
|
|
4288
|
+
try {
|
|
4289
|
+
P(this, cn, n.select), y = n.select(f.data), y = gs(o == null ? void 0 : o.data, y, n), P(this, Lt, y), P(this, Ie, null);
|
|
4290
|
+
} catch (T) {
|
|
4291
|
+
P(this, Ie, T);
|
|
4292
|
+
}
|
|
4293
|
+
else
|
|
4294
|
+
y = f.data;
|
|
4295
|
+
if (typeof n.placeholderData < "u" && typeof y > "u" && O === "pending") {
|
|
4296
|
+
let T;
|
|
4297
|
+
if (o != null && o.isPlaceholderData && n.placeholderData === (a == null ? void 0 : a.placeholderData))
|
|
4298
|
+
T = o.data;
|
|
4299
|
+
else if (T = typeof n.placeholderData == "function" ? n.placeholderData(
|
|
4300
|
+
(F = c(this, Nt)) == null ? void 0 : F.state.data,
|
|
4301
|
+
c(this, Nt)
|
|
4302
|
+
) : n.placeholderData, n.select && typeof T < "u")
|
|
4303
|
+
try {
|
|
4304
|
+
T = n.select(T), P(this, Ie, null);
|
|
4305
|
+
} catch (R) {
|
|
4306
|
+
P(this, Ie, R);
|
|
4307
|
+
}
|
|
4308
|
+
typeof T < "u" && (O = "success", y = gs(
|
|
4309
|
+
o == null ? void 0 : o.data,
|
|
4310
|
+
T,
|
|
4311
|
+
n
|
|
4312
|
+
), C = !0);
|
|
4313
|
+
}
|
|
4314
|
+
c(this, Ie) && (m = c(this, Ie), y = c(this, Lt), b = Date.now(), O = "error");
|
|
4315
|
+
const A = g === "fetching", D = O === "pending", B = O === "error", x = D && A;
|
|
4316
|
+
return {
|
|
4317
|
+
status: O,
|
|
4318
|
+
fetchStatus: g,
|
|
4319
|
+
isPending: D,
|
|
4320
|
+
isSuccess: O === "success",
|
|
4321
|
+
isError: B,
|
|
4322
|
+
isInitialLoading: x,
|
|
4323
|
+
isLoading: x,
|
|
4324
|
+
data: y,
|
|
4325
|
+
dataUpdatedAt: f.dataUpdatedAt,
|
|
4326
|
+
error: m,
|
|
4327
|
+
errorUpdatedAt: b,
|
|
4328
|
+
failureCount: f.fetchFailureCount,
|
|
4329
|
+
failureReason: f.fetchFailureReason,
|
|
4330
|
+
errorUpdateCount: f.errorUpdateCount,
|
|
4331
|
+
isFetched: f.dataUpdateCount > 0 || f.errorUpdateCount > 0,
|
|
4332
|
+
isFetchedAfterMount: f.dataUpdateCount > u.dataUpdateCount || f.errorUpdateCount > u.errorUpdateCount,
|
|
4333
|
+
isFetching: A,
|
|
4334
|
+
isRefetching: A && !D,
|
|
4335
|
+
isLoadingError: B && f.dataUpdatedAt === 0,
|
|
4336
|
+
isPaused: g === "paused",
|
|
4337
|
+
isPlaceholderData: C,
|
|
4338
|
+
isRefetchError: B && f.dataUpdatedAt !== 0,
|
|
4339
|
+
isStale: Qs(t, n),
|
|
4340
|
+
refetch: this.refetch
|
|
4341
|
+
};
|
|
4342
|
+
}
|
|
4343
|
+
updateResult(t) {
|
|
4344
|
+
const n = c(this, ce), s = this.createResult(c(this, Z), this.options);
|
|
4345
|
+
if (P(this, st, c(this, Z).state), P(this, Mt, this.options), c(this, st).data !== void 0 && P(this, Nt, c(this, Z)), ps(s, n))
|
|
4346
|
+
return;
|
|
4347
|
+
P(this, ce, s);
|
|
4348
|
+
const r = {}, o = () => {
|
|
4349
|
+
if (!n)
|
|
4350
|
+
return !0;
|
|
4351
|
+
const { notifyOnChangeProps: i } = this.options, a = typeof i == "function" ? i() : i;
|
|
4352
|
+
if (a === "all" || !a && !c(this, ot).size)
|
|
4353
|
+
return !0;
|
|
4354
|
+
const d = new Set(
|
|
4355
|
+
a ?? c(this, ot)
|
|
4356
|
+
);
|
|
4357
|
+
return this.options.throwOnError && d.add("error"), Object.keys(c(this, ce)).some((u) => {
|
|
4358
|
+
const f = u;
|
|
4359
|
+
return c(this, ce)[f] !== n[f] && d.has(f);
|
|
4360
|
+
});
|
|
4361
|
+
};
|
|
4362
|
+
(t == null ? void 0 : t.listeners) !== !1 && o() && (r.listeners = !0), K(this, Nn, ao).call(this, { ...r, ...t });
|
|
4363
|
+
}
|
|
4364
|
+
onQueryUpdate() {
|
|
4365
|
+
this.updateResult(), this.hasListeners() && K(this, fn, ws).call(this);
|
|
4366
|
+
}
|
|
4367
|
+
}, le = new WeakMap(), Z = new WeakMap(), Dt = new WeakMap(), ce = new WeakMap(), st = new WeakMap(), Mt = new WeakMap(), Ie = new WeakMap(), cn = new WeakMap(), Lt = new WeakMap(), Nt = new WeakMap(), rt = new WeakMap(), it = new WeakMap(), Ge = new WeakMap(), ot = new WeakMap(), at = new WeakSet(), Ht = function(t) {
|
|
4368
|
+
K(this, mn, ks).call(this);
|
|
4369
|
+
let n = c(this, Z).fetch(
|
|
4370
|
+
this.options,
|
|
4371
|
+
t
|
|
4372
|
+
);
|
|
4373
|
+
return t != null && t.throwOnError || (n = n.catch(ve)), n;
|
|
4374
|
+
}, un = new WeakSet(), ys = function() {
|
|
4375
|
+
if (K(this, hn, Ss).call(this), qt || c(this, ce).isStale || !hs(this.options.staleTime))
|
|
4376
|
+
return;
|
|
4377
|
+
const n = to(
|
|
4378
|
+
c(this, ce).dataUpdatedAt,
|
|
4379
|
+
this.options.staleTime
|
|
4380
|
+
) + 1;
|
|
4381
|
+
P(this, rt, setTimeout(() => {
|
|
4382
|
+
c(this, ce).isStale || this.updateResult();
|
|
4383
|
+
}, n));
|
|
4384
|
+
}, ln = new WeakSet(), vs = function() {
|
|
4385
|
+
return (typeof this.options.refetchInterval == "function" ? this.options.refetchInterval(c(this, Z)) : this.options.refetchInterval) ?? !1;
|
|
4386
|
+
}, dn = new WeakSet(), bs = function(t) {
|
|
4387
|
+
K(this, pn, xs).call(this), P(this, Ge, t), !(qt || this.options.enabled === !1 || !hs(c(this, Ge)) || c(this, Ge) === 0) && P(this, it, setInterval(() => {
|
|
4388
|
+
(this.options.refetchIntervalInBackground || Mn.isFocused()) && K(this, at, Ht).call(this);
|
|
4389
|
+
}, c(this, Ge)));
|
|
4390
|
+
}, fn = new WeakSet(), ws = function() {
|
|
4391
|
+
K(this, un, ys).call(this), K(this, dn, bs).call(this, K(this, ln, vs).call(this));
|
|
4392
|
+
}, hn = new WeakSet(), Ss = function() {
|
|
4393
|
+
c(this, rt) && (clearTimeout(c(this, rt)), P(this, rt, void 0));
|
|
4394
|
+
}, pn = new WeakSet(), xs = function() {
|
|
4395
|
+
c(this, it) && (clearInterval(c(this, it)), P(this, it, void 0));
|
|
4396
|
+
}, mn = new WeakSet(), ks = function() {
|
|
4397
|
+
const t = c(this, le).getQueryCache().build(c(this, le), this.options);
|
|
4398
|
+
if (t === c(this, Z))
|
|
4399
|
+
return;
|
|
4400
|
+
const n = c(this, Z);
|
|
4401
|
+
P(this, Z, t), P(this, Dt, t.state), this.hasListeners() && (n == null || n.removeObserver(this), t.addObserver(this));
|
|
4402
|
+
}, Nn = new WeakSet(), ao = function(t) {
|
|
4403
|
+
ae.batch(() => {
|
|
4404
|
+
t.listeners && this.listeners.forEach((n) => {
|
|
4405
|
+
n(c(this, ce));
|
|
4406
|
+
}), c(this, le).getQueryCache().notify({
|
|
4407
|
+
query: c(this, Z),
|
|
4408
|
+
type: "observerResultsUpdated"
|
|
4409
|
+
});
|
|
4410
|
+
});
|
|
4411
|
+
}, Xr);
|
|
4412
|
+
function pl(e, t) {
|
|
4413
|
+
return t.enabled !== !1 && !e.state.dataUpdatedAt && !(e.state.status === "error" && t.retryOnMount === !1);
|
|
4414
|
+
}
|
|
4415
|
+
function qr(e, t) {
|
|
4416
|
+
return pl(e, t) || e.state.dataUpdatedAt > 0 && As(e, t, t.refetchOnMount);
|
|
4417
|
+
}
|
|
4418
|
+
function As(e, t, n) {
|
|
4419
|
+
if (t.enabled !== !1) {
|
|
4420
|
+
const s = typeof n == "function" ? n(e) : n;
|
|
4421
|
+
return s === "always" || s !== !1 && Qs(e, t);
|
|
4422
|
+
}
|
|
4423
|
+
return !1;
|
|
4424
|
+
}
|
|
4425
|
+
function $r(e, t, n, s) {
|
|
4426
|
+
return n.enabled !== !1 && (e !== t || s.enabled === !1) && (!n.suspense || e.state.status !== "error") && Qs(e, n);
|
|
4427
|
+
}
|
|
4428
|
+
function Qs(e, t) {
|
|
4429
|
+
return e.isStaleByTime(t.staleTime);
|
|
4430
|
+
}
|
|
4431
|
+
function ml(e, t) {
|
|
4432
|
+
return !ps(e.getCurrentResult(), t);
|
|
4433
|
+
}
|
|
4434
|
+
var co = pe.createContext(
|
|
4435
|
+
void 0
|
|
4436
|
+
), Hn = (e) => {
|
|
4437
|
+
const t = pe.useContext(co);
|
|
4438
|
+
if (e)
|
|
4439
|
+
return e;
|
|
4440
|
+
if (!t)
|
|
4441
|
+
throw new Error("No QueryClient set, use QueryClientProvider to set one");
|
|
4442
|
+
return t;
|
|
4443
|
+
}, gl = ({
|
|
4444
|
+
client: e,
|
|
4445
|
+
children: t
|
|
4446
|
+
}) => (pe.useEffect(() => (e.mount(), () => {
|
|
4447
|
+
e.unmount();
|
|
4448
|
+
}), [e]), /* @__PURE__ */ pe.createElement(co.Provider, { value: e }, t)), uo = pe.createContext(!1), yl = () => pe.useContext(uo);
|
|
4449
|
+
uo.Provider;
|
|
4450
|
+
function vl() {
|
|
4451
|
+
let e = !1;
|
|
4452
|
+
return {
|
|
4453
|
+
clearReset: () => {
|
|
4454
|
+
e = !1;
|
|
4455
|
+
},
|
|
4456
|
+
reset: () => {
|
|
4457
|
+
e = !0;
|
|
4458
|
+
},
|
|
4459
|
+
isReset: () => e
|
|
4460
|
+
};
|
|
4461
|
+
}
|
|
4462
|
+
var bl = pe.createContext(vl()), wl = () => pe.useContext(bl);
|
|
4463
|
+
function Sl(e, t) {
|
|
4464
|
+
return typeof e == "function" ? e(...t) : !!e;
|
|
4465
|
+
}
|
|
4466
|
+
var xl = (e, t) => {
|
|
4467
|
+
(e.suspense || e.throwOnError) && (t.isReset() || (e.retryOnMount = !1));
|
|
4468
|
+
}, kl = (e) => {
|
|
4469
|
+
pe.useEffect(() => {
|
|
4470
|
+
e.clearReset();
|
|
4471
|
+
}, [e]);
|
|
4472
|
+
}, Al = ({
|
|
4473
|
+
result: e,
|
|
4474
|
+
errorResetBoundary: t,
|
|
4475
|
+
throwOnError: n,
|
|
4476
|
+
query: s
|
|
4477
|
+
}) => e.isError && !t.isReset() && !e.isFetching && Sl(n, [e.error, s]), El = (e) => {
|
|
4478
|
+
e.suspense && typeof e.staleTime != "number" && (e.staleTime = 1e3);
|
|
4479
|
+
}, Pl = (e, t) => (e == null ? void 0 : e.suspense) && t.isPending, Ol = (e, t, n) => t.fetchOptimistic(e).catch(() => {
|
|
4480
|
+
n.clearReset();
|
|
4481
|
+
});
|
|
4482
|
+
function _l(e, t, n) {
|
|
4483
|
+
if (process.env.NODE_ENV !== "production" && (typeof e != "object" || Array.isArray(e)))
|
|
4484
|
+
throw new Error(
|
|
4485
|
+
'Bad argument type. Starting with v5, only the "Object" form is allowed when calling query related functions. Please use the error stack to find the culprit call. More info here: https://tanstack.com/query/latest/docs/react/guides/migrating-to-v5#supports-a-single-signature-one-object'
|
|
4486
|
+
);
|
|
4487
|
+
const s = Hn(n), r = yl(), o = wl(), i = s.defaultQueryOptions(e);
|
|
4488
|
+
i._optimisticResults = r ? "isRestoring" : "optimistic", El(i), xl(i, o), kl(o);
|
|
4489
|
+
const [a] = pe.useState(
|
|
4490
|
+
() => new t(
|
|
4491
|
+
s,
|
|
4492
|
+
i
|
|
4493
|
+
)
|
|
4494
|
+
), d = a.getOptimisticResult(i);
|
|
4495
|
+
if (pe.useSyncExternalStore(
|
|
4496
|
+
pe.useCallback(
|
|
4497
|
+
(u) => {
|
|
4498
|
+
const f = r ? () => {
|
|
4499
|
+
} : a.subscribe(ae.batchCalls(u));
|
|
4500
|
+
return a.updateResult(), f;
|
|
4501
|
+
},
|
|
4502
|
+
[a, r]
|
|
4503
|
+
),
|
|
4504
|
+
() => a.getCurrentResult(),
|
|
4505
|
+
() => a.getCurrentResult()
|
|
4506
|
+
), pe.useEffect(() => {
|
|
4507
|
+
a.setOptions(i, { listeners: !1 });
|
|
4508
|
+
}, [i, a]), Pl(i, d))
|
|
4509
|
+
throw Ol(i, a, o);
|
|
4510
|
+
if (Al({
|
|
4511
|
+
result: d,
|
|
4512
|
+
errorResetBoundary: o,
|
|
4513
|
+
throwOnError: i.throwOnError,
|
|
4514
|
+
query: a.getCurrentQuery()
|
|
4515
|
+
}))
|
|
4516
|
+
throw d.error;
|
|
4517
|
+
return i.notifyOnChangeProps ? d : a.trackResult(d);
|
|
4518
|
+
}
|
|
4519
|
+
function Jn(e, t) {
|
|
4520
|
+
return _l(e, hl, t);
|
|
4521
|
+
}
|
|
4522
|
+
const Cl = () => Jn({
|
|
4523
|
+
queryKey: ["user"],
|
|
4524
|
+
queryFn: async () => await localStorage.getItem("__nano_id")
|
|
4525
|
+
}), Il = () => /* @__PURE__ */ _.jsx("section", { className: "py-10 h-screen bg-gray-50 sm:py-16 lg:py-24", children: /* @__PURE__ */ _.jsxs("div", { className: "px-4 mx-auto max-w-7xl sm:px-6 lg:px-8", children: [
|
|
4526
|
+
/* @__PURE__ */ _.jsxs("div", { className: "max-w-2xl mx-auto text-center", children: [
|
|
4527
|
+
/* @__PURE__ */ _.jsx("h2", { className: "text-3xl font-bold leading-tight text-black sm:text-4xl lg:text-5xl", children: "Welcome Back!" }),
|
|
4528
|
+
/* @__PURE__ */ _.jsx("p", { className: "max-w-xl mx-auto mt-4 text-base leading-relaxed text-gray-600", children: "Login to your account" })
|
|
4529
|
+
] }),
|
|
4530
|
+
/* @__PURE__ */ _.jsx("div", { className: "relative max-w-md mx-auto mt-8 md:mt-16", children: /* @__PURE__ */ _.jsx("div", { className: "overflow-hidden bg-white rounded-md shadow-md", children: /* @__PURE__ */ _.jsx("div", { className: "px-4 py-6 sm:px-8 sm:py-7", children: /* @__PURE__ */ _.jsx("form", { action: "#", method: "POST", children: /* @__PURE__ */ _.jsxs("div", { className: "space-y-5", children: [
|
|
4531
|
+
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
4532
|
+
/* @__PURE__ */ _.jsx("label", { htmlFor: "", className: "text-base font-medium text-gray-900", children: "Email address" }),
|
|
4533
|
+
/* @__PURE__ */ _.jsxs("div", { className: "mt-2.5 relative text-gray-400 focus-within:text-gray-600", children: [
|
|
4534
|
+
/* @__PURE__ */ _.jsx("div", { className: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none", children: /* @__PURE__ */ _.jsx(
|
|
4535
|
+
"svg",
|
|
4536
|
+
{
|
|
4537
|
+
className: "w-5 h-5",
|
|
4538
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4539
|
+
fill: "none",
|
|
4540
|
+
viewBox: "0 0 24 24",
|
|
4541
|
+
stroke: "currentColor",
|
|
4542
|
+
children: /* @__PURE__ */ _.jsx(
|
|
4543
|
+
"path",
|
|
4544
|
+
{
|
|
4545
|
+
strokeLinecap: "round",
|
|
4546
|
+
strokeLinejoin: "round",
|
|
4547
|
+
strokeWidth: "2",
|
|
4548
|
+
d: "M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207"
|
|
4549
|
+
}
|
|
4550
|
+
)
|
|
4551
|
+
}
|
|
4552
|
+
) }),
|
|
4553
|
+
/* @__PURE__ */ _.jsx(
|
|
4554
|
+
"input",
|
|
4555
|
+
{
|
|
4556
|
+
type: "email",
|
|
4557
|
+
name: "",
|
|
4558
|
+
id: "",
|
|
4559
|
+
placeholder: "Enter email to get started",
|
|
4560
|
+
className: "block w-full py-4 pl-10 pr-4 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"
|
|
4561
|
+
}
|
|
4562
|
+
)
|
|
4563
|
+
] })
|
|
4564
|
+
] }),
|
|
4565
|
+
/* @__PURE__ */ _.jsxs("div", { children: [
|
|
4566
|
+
/* @__PURE__ */ _.jsx("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ _.jsx("label", { htmlFor: "", className: "text-base font-medium text-gray-900", children: "Password" }) }),
|
|
4567
|
+
/* @__PURE__ */ _.jsxs("div", { className: "mt-2.5 relative text-gray-400 focus-within:text-gray-600", children: [
|
|
4568
|
+
/* @__PURE__ */ _.jsx("div", { className: "absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none", children: /* @__PURE__ */ _.jsx(
|
|
4569
|
+
"svg",
|
|
4570
|
+
{
|
|
4571
|
+
className: "w-5 h-5",
|
|
4572
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4573
|
+
fill: "none",
|
|
4574
|
+
viewBox: "0 0 24 24",
|
|
4575
|
+
stroke: "currentColor",
|
|
4576
|
+
children: /* @__PURE__ */ _.jsx(
|
|
4577
|
+
"path",
|
|
4578
|
+
{
|
|
4579
|
+
strokeLinecap: "round",
|
|
4580
|
+
strokeLinejoin: "round",
|
|
4581
|
+
strokeWidth: "2",
|
|
4582
|
+
d: "M12 11c0 3.517-1.009 6.799-2.753 9.571m-3.44-2.04l.054-.09A13.916 13.916 0 008 11a4 4 0 118 0c0 1.017-.07 2.019-.203 3m-2.118 6.844A21.88 21.88 0 0015.171 17m3.839 1.132c.645-2.266.99-4.659.99-7.132A8 8 0 008 4.07M3 15.364c.64-1.319 1-2.8 1-4.364 0-1.457.39-2.823 1.07-4"
|
|
4583
|
+
}
|
|
4584
|
+
)
|
|
4585
|
+
}
|
|
4586
|
+
) }),
|
|
4587
|
+
/* @__PURE__ */ _.jsx(
|
|
4588
|
+
"input",
|
|
4589
|
+
{
|
|
4590
|
+
type: "password",
|
|
4591
|
+
name: "",
|
|
4592
|
+
id: "",
|
|
4593
|
+
placeholder: "Enter your password",
|
|
4594
|
+
className: "block w-full py-4 pl-10 pr-4 text-black placeholder-gray-500 transition-all duration-200 bg-white border border-gray-200 rounded-md focus:outline-none focus:border-blue-600 caret-blue-600"
|
|
4595
|
+
}
|
|
4596
|
+
)
|
|
4597
|
+
] })
|
|
4598
|
+
] }),
|
|
4599
|
+
/* @__PURE__ */ _.jsx("div", { children: /* @__PURE__ */ _.jsx(
|
|
4600
|
+
"button",
|
|
4601
|
+
{
|
|
4602
|
+
type: "submit",
|
|
4603
|
+
className: "inline-flex items-center justify-center w-full px-4 py-4 text-base font-semibold text-white transition-all duration-200 bg-blue-600 border border-transparent rounded-md focus:outline-none hover:bg-blue-700 focus:bg-blue-700",
|
|
4604
|
+
children: "Log in"
|
|
4605
|
+
}
|
|
4606
|
+
) })
|
|
4607
|
+
] }) }) }) }) })
|
|
4608
|
+
] }) });
|
|
4609
|
+
function Vs() {
|
|
4610
|
+
return Hn().getQueryData(["apiBaseUrl"]) || "/api/chaibuilder";
|
|
4611
|
+
}
|
|
4612
|
+
const lo = () => {
|
|
4613
|
+
const e = Hn();
|
|
4614
|
+
let t = e.getQueryData(["currentPage"]);
|
|
4615
|
+
return t || (t = localStorage.getItem("currentPage")), [
|
|
4616
|
+
t || "",
|
|
4617
|
+
(n) => {
|
|
4618
|
+
localStorage.setItem("currentPage", n || ""), e.setQueryData(["currentPage"], n || "");
|
|
4619
|
+
}
|
|
4620
|
+
];
|
|
4621
|
+
}, Ks = () => {
|
|
4622
|
+
const [e, t] = lo(), n = Vs();
|
|
4623
|
+
return Jn({
|
|
4624
|
+
queryKey: ["project"],
|
|
4625
|
+
queryFn: async () => {
|
|
4626
|
+
const s = await fetch(`${n}/project`).then((r) => r.json());
|
|
4627
|
+
return !e && s && t(s.homepage), s;
|
|
4628
|
+
}
|
|
4629
|
+
});
|
|
4630
|
+
}, jl = () => {
|
|
4631
|
+
const { data: e } = Ks(), t = Vs(), n = e == null ? void 0 : e.uuid;
|
|
4632
|
+
return Jn({
|
|
4633
|
+
queryKey: ["pages", n],
|
|
4634
|
+
queryFn: async () => await fetch(`${t}/pages`).then((r) => r.json()) || [],
|
|
4635
|
+
enabled: !!n
|
|
4636
|
+
});
|
|
4637
|
+
}, Bl = () => {
|
|
4638
|
+
const [e, t] = lo(), { data: n } = Ks(), s = Vs();
|
|
4639
|
+
return Jn({
|
|
4640
|
+
queryKey: ["page_data", e],
|
|
4641
|
+
queryFn: async () => {
|
|
4642
|
+
const r = await fetch(`${s}/page?uuid=${e}`);
|
|
4643
|
+
return r.ok ? r.json() : (t(n.homepage), null);
|
|
4644
|
+
},
|
|
4645
|
+
enabled: !!e
|
|
4646
|
+
});
|
|
4647
|
+
}, Rl = $t(() => import("./PagesPanel-3e9163c4.js")), Dl = $t(() => import("./ProjectPanel-17c5f131.js")), Ml = () => {
|
|
4648
|
+
const { data: e, isLoading: t } = Ks(), { data: n, isLoading: s } = jl(), { data: r } = Bl();
|
|
4649
|
+
return t || !e ? /* @__PURE__ */ _.jsx("div", { children: "Loading..." }) : s || !n ? /* @__PURE__ */ _.jsx("div", { children: "Loading..." }) : r ? /* @__PURE__ */ _.jsx("div", { className: "bg-background text-foreground", children: /* @__PURE__ */ _.jsx(
|
|
4650
|
+
Ju,
|
|
4651
|
+
{
|
|
4652
|
+
blocks: r.blocks,
|
|
4653
|
+
brandingOptions: e.brandingOptions,
|
|
4654
|
+
darkMode: !0,
|
|
4655
|
+
onSaveBlocks: async () => {
|
|
4656
|
+
},
|
|
4657
|
+
onSaveBrandingOptions: async () => {
|
|
4658
|
+
},
|
|
4659
|
+
sideBarComponents: {
|
|
4660
|
+
top: [
|
|
4661
|
+
{ icon: Fo, name: "pages", panel: Rl },
|
|
4662
|
+
{ icon: Uo, name: "settings", panel: Dl }
|
|
4663
|
+
]
|
|
4664
|
+
}
|
|
4665
|
+
}
|
|
4666
|
+
) }) : /* @__PURE__ */ _.jsx("div", { children: "Loading..." });
|
|
4667
|
+
}, Ll = (e) => {
|
|
4668
|
+
const { data: t } = Cl(), n = Hn();
|
|
4669
|
+
return ke(() => {
|
|
4670
|
+
n.setQueryData(["apiBaseUrl"], e.apiBaseUrl || "/api/chaibuilder");
|
|
4671
|
+
}, [e.apiBaseUrl, n]), t ? /* @__PURE__ */ _.jsx(Ml, {}) : /* @__PURE__ */ _.jsx(Il, {});
|
|
4672
|
+
}, Nl = new fl(), Fd = (e) => /* @__PURE__ */ _.jsx(gl, { client: Nl, children: /* @__PURE__ */ _.jsx(Ll, { ...e }) }), Ud = (e) => ({ ...e }), qd = (e) => ({ ...e });
|
|
4673
|
+
export {
|
|
4674
|
+
cl as $,
|
|
4675
|
+
ud as A,
|
|
4676
|
+
ec as B,
|
|
4677
|
+
Pd as C,
|
|
4678
|
+
_c as D,
|
|
4679
|
+
Jo as E,
|
|
4680
|
+
rr as F,
|
|
4681
|
+
sr as G,
|
|
4682
|
+
dd as H,
|
|
4683
|
+
Sd as I,
|
|
4684
|
+
Ad as J,
|
|
4685
|
+
kd as K,
|
|
4686
|
+
cd as L,
|
|
4687
|
+
Wa as M,
|
|
4688
|
+
jl as N,
|
|
4689
|
+
Ks as O,
|
|
4690
|
+
yd as P,
|
|
4691
|
+
ld as Q,
|
|
4692
|
+
Td as R,
|
|
4693
|
+
ad as S,
|
|
4694
|
+
Dd as T,
|
|
4695
|
+
nc as U,
|
|
4696
|
+
sc as V,
|
|
4697
|
+
vd as W,
|
|
4698
|
+
Hn as X,
|
|
4699
|
+
Vs as Y,
|
|
4700
|
+
vn as Z,
|
|
4701
|
+
ps as _,
|
|
4702
|
+
tc as a,
|
|
4703
|
+
ae as a0,
|
|
4704
|
+
Sl as a1,
|
|
4705
|
+
lo as a2,
|
|
4706
|
+
xc as a3,
|
|
4707
|
+
Ud as a4,
|
|
4708
|
+
qd as a5,
|
|
4709
|
+
Ju as a6,
|
|
4710
|
+
_d as a7,
|
|
4711
|
+
Od as a8,
|
|
4712
|
+
li as a9,
|
|
4713
|
+
Qa as aa,
|
|
4714
|
+
gd as ab,
|
|
4715
|
+
xi as ac,
|
|
4716
|
+
bd as ad,
|
|
4717
|
+
wd as ae,
|
|
4718
|
+
Bd as af,
|
|
4719
|
+
xd as ag,
|
|
4720
|
+
rc as ah,
|
|
4721
|
+
rd as ai,
|
|
4722
|
+
Ed as aj,
|
|
4723
|
+
Cd as ak,
|
|
4724
|
+
Id as al,
|
|
4725
|
+
Md as am,
|
|
4726
|
+
Ld as an,
|
|
4727
|
+
Nd as ao,
|
|
4728
|
+
Fd as ap,
|
|
4729
|
+
Pa as b,
|
|
4730
|
+
$n as c,
|
|
4731
|
+
md as d,
|
|
4732
|
+
hd as e,
|
|
4733
|
+
jd as f,
|
|
4734
|
+
Oa as g,
|
|
4735
|
+
mt as h,
|
|
4736
|
+
mi as i,
|
|
4737
|
+
Rd as j,
|
|
4738
|
+
pd as k,
|
|
4739
|
+
Ci as l,
|
|
4740
|
+
Oi as m,
|
|
4741
|
+
oc as n,
|
|
4742
|
+
fc as o,
|
|
4743
|
+
gi as p,
|
|
4744
|
+
pc as q,
|
|
4745
|
+
Ga as r,
|
|
4746
|
+
Xa as s,
|
|
4747
|
+
id as t,
|
|
4748
|
+
fd as u,
|
|
4749
|
+
od as v,
|
|
4750
|
+
yi as w,
|
|
4751
|
+
lc as x,
|
|
4752
|
+
Ma as y,
|
|
4753
|
+
Ha as z
|
|
4754
|
+
};
|