@pinia/colada-devtools 0.0.2 → 0.0.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.
Files changed (24) hide show
  1. package/dist/index.js +321 -295
  2. package/dist/index.js.map +1 -1
  3. package/dist-panel/{_queryId_-dahx0N-a.js → _queryId_-SBAeSmfh.js} +4 -4
  4. package/dist-panel/{_queryId_-dahx0N-a.js.map → _queryId_-SBAeSmfh.js.map} +1 -1
  5. package/dist-panel/{index-Covr4drg.js → index-BdIpA-g4.js} +10 -8
  6. package/dist-panel/{index-Covr4drg.js.map → index-BdIpA-g4.js.map} +1 -1
  7. package/dist-panel/{index-BoUh47CR.js → index-CAv-3vCR.js} +2 -2
  8. package/dist-panel/{index-BoUh47CR.js.map → index-CAv-3vCR.js.map} +1 -1
  9. package/dist-panel/{index-BkrEntNA.js → index-DZwqU9e-.js} +3 -3
  10. package/dist-panel/{index-BkrEntNA.js.map → index-DZwqU9e-.js.map} +1 -1
  11. package/dist-panel/index.js +1 -1
  12. package/dist-panel/{loader-CuAz6irK.js → loader-DHLcbUhz.js} +2 -2
  13. package/dist-panel/loader-DHLcbUhz.js.map +1 -0
  14. package/dist-panel/{mouse-pointer-click-BRg0nGpd.js → mouse-pointer-click-BHnWXkC_.js} +2 -2
  15. package/dist-panel/mouse-pointer-click-BHnWXkC_.js.map +1 -0
  16. package/dist-panel/{mutations-ComK9mEg.js → mutations-BfqfXeMY.js} +2 -2
  17. package/dist-panel/{mutations-ComK9mEg.js.map → mutations-BfqfXeMY.js.map} +1 -1
  18. package/dist-panel/{queries-C8H8bbDX.js → queries-CE8W5p_h.js} +3 -3
  19. package/dist-panel/{queries-C8H8bbDX.js.map → queries-CE8W5p_h.js.map} +1 -1
  20. package/dist-panel/{settings-DoijmHf7.js → settings-DIqJoCBU.js} +2 -2
  21. package/dist-panel/{settings-DoijmHf7.js.map → settings-DIqJoCBU.js.map} +1 -1
  22. package/package.json +1 -1
  23. package/dist-panel/loader-CuAz6irK.js.map +0 -1
  24. package/dist-panel/mouse-pointer-click-BRg0nGpd.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent as $, ref as R, onMounted as L, renderSlot as ne, createCommentVNode as M, toValue as C, getCurrentScope as J, onScopeDispose as Q, useTemplateRef as oe, shallowRef as N, watch as P, onBeforeUnmount as ie, createBlock as W, openBlock as x, Teleport as re, createElementVNode as se, nextTick as G, readonly as K, getCurrentInstance as ae, toRef as le, customRef as ue, computed as U, unref as F, withCtx as ce, createElementBlock as de } from "vue";
1
+ import { defineComponent as $, ref as R, onMounted as L, renderSlot as ne, createCommentVNode as M, toValue as T, getCurrentScope as J, onScopeDispose as Q, useTemplateRef as oe, shallowRef as N, watch as _, onBeforeUnmount as ie, createBlock as W, openBlock as x, Teleport as re, createElementVNode as se, nextTick as G, readonly as K, getCurrentInstance as ae, toRef as le, customRef as ue, computed as U, unref as F, withCtx as ce, createElementBlock as de } from "vue";
2
2
  import { useQueryCache as fe } from "@pinia/colada";
3
3
  import { DEVTOOLS_INFO_KEY as p, DuplexChannel as pe } from "@pinia/colada-devtools/shared";
4
4
  const ve = /* @__PURE__ */ $({
@@ -7,70 +7,87 @@ const ve = /* @__PURE__ */ $({
7
7
  const t = R(!1);
8
8
  return L(() => {
9
9
  t.value = !0;
10
- }), (o, l) => t.value ? ne(o.$slots, "default", { key: 0 }) : M("", !0);
10
+ }), (n, l) => t.value ? ne(n.$slots, "default", { key: 0 }) : M("", !0);
11
11
  }
12
12
  }), b = () => performance.timeOrigin + performance.now();
13
13
  function me(e) {
14
- I.has(e) || (I.set(e, !0), e.$onAction(({ name: t, args: o, after: l, onError: s }) => {
15
- var c, y;
16
- if (t === "create")
17
- l((r) => {
18
- r[p] = {
19
- count: {
20
- total: 0,
21
- succeed: 0,
22
- errored: 0,
23
- cancelled: 0
24
- },
25
- updatedAt: b(),
26
- inactiveAt: 0,
27
- simulate: null,
28
- history: []
29
- };
30
- });
31
- else if (t === "fetch") {
32
- const [r] = o;
33
- r[p].count.total++, r[p].updatedAt = b();
34
- const u = b(), f = {
35
- id: (((c = r[p].history.at(0)) == null ? void 0 : c.id) ?? -1) + 1,
36
- key: r.key,
37
- state: r.state.value,
38
- updatedAt: u,
39
- createdAt: u,
40
- fetchTime: null
41
- }, h = C((y = r.options) == null ? void 0 : y.enabled) ?? !0;
42
- h && (f.fetchTime = {
43
- start: u,
44
- end: null
45
- }), r[p].history.unshift(f), r[p].history = r[p].history.slice(0, 10), l(() => {
46
- h && (f.fetchTime.end = b(), r[p].count.succeed++, f.state = r.state.value, f.updatedAt = b());
47
- }), s(() => {
48
- h && (f.fetchTime.end = b(), r[p].count.errored++, f.state = r.state.value, f.updatedAt = b());
49
- });
50
- } else if (t === "cancel") {
51
- const [r] = o;
52
- r.pending && r[p].count.cancelled++;
53
- } else if (t === "setEntryState") {
54
- const [r] = o;
55
- let u = r[p].history[0];
56
- l(() => {
57
- r[p].updatedAt = b(), u ?? (u = r[p].history[0]), u && (u.state = r.state.value, u.updatedAt = b());
58
- });
59
- } else if (t === "untrack") {
60
- const [r] = o;
61
- l(() => {
62
- r.active || (r[p].inactiveAt = b());
63
- });
64
- } else if (t === "setQueryData") {
65
- const [r] = o;
66
- l(() => {
67
- const u = e.getEntries({ key: r, exact: !0 })[0];
68
- u && !u.active && (u[p].inactiveAt = b());
14
+ var t;
15
+ if (!I.has(e)) {
16
+ I.set(e, !0);
17
+ for (const n of e.getEntries())
18
+ n[t = p] ?? (n[t] = {
19
+ count: {
20
+ total: 0,
21
+ succeed: 0,
22
+ errored: 0,
23
+ cancelled: 0
24
+ },
25
+ updatedAt: b(),
26
+ inactiveAt: 0,
27
+ simulate: null,
28
+ history: []
69
29
  });
70
- }
71
- }));
30
+ e.$onAction(({ name: n, args: l, after: r, onError: d }) => {
31
+ var h, f;
32
+ if (n === "create")
33
+ r((s) => {
34
+ s[p] = {
35
+ count: {
36
+ total: 0,
37
+ succeed: 0,
38
+ errored: 0,
39
+ cancelled: 0
40
+ },
41
+ updatedAt: b(),
42
+ inactiveAt: 0,
43
+ simulate: null,
44
+ history: []
45
+ };
46
+ });
47
+ else if (n === "fetch") {
48
+ const [s] = l;
49
+ s[p].count.total++, s[p].updatedAt = b();
50
+ const u = b(), v = {
51
+ id: (((h = s[p].history.at(0)) == null ? void 0 : h.id) ?? -1) + 1,
52
+ key: s.key,
53
+ state: s.state.value,
54
+ updatedAt: u,
55
+ createdAt: u,
56
+ fetchTime: null
57
+ }, E = T((f = s.options) == null ? void 0 : f.enabled) ?? !0;
58
+ E && (v.fetchTime = {
59
+ start: u,
60
+ end: null
61
+ }), s[p].history.unshift(v), s[p].history = s[p].history.slice(0, 10), r(() => {
62
+ E && (v.fetchTime.end = b(), s[p].count.succeed++, v.state = s.state.value, v.updatedAt = b());
63
+ }), d(() => {
64
+ E && (v.fetchTime.end = b(), s[p].count.errored++, v.state = s.state.value, v.updatedAt = b());
65
+ });
66
+ } else if (n === "cancel") {
67
+ const [s] = l;
68
+ s.pending && s[p].count.cancelled++;
69
+ } else if (n === "setEntryState") {
70
+ const [s] = l;
71
+ let u = s[p].history[0];
72
+ r(() => {
73
+ s[p].updatedAt = b(), u ?? (u = s[p].history[0]), u && (u.state = s.state.value, u.updatedAt = b());
74
+ });
75
+ } else if (n === "untrack") {
76
+ const [s] = l;
77
+ r(() => {
78
+ s.active || (s[p].inactiveAt = b());
79
+ });
80
+ } else if (n === "setQueryData") {
81
+ const [s] = l;
82
+ r(() => {
83
+ const u = e.getEntries({ key: s, exact: !0 })[0];
84
+ u && !u.active && (u[p].inactiveAt = b());
85
+ });
86
+ }
87
+ });
88
+ }
72
89
  }
73
- function w(e) {
90
+ function S(e) {
74
91
  return {
75
92
  id: e.key.join("\0"),
76
93
  key: e.key,
@@ -82,10 +99,10 @@ function w(e) {
82
99
  options: e.options && {
83
100
  staleTime: e.options.staleTime,
84
101
  gcTime: e.options.gcTime,
85
- refetchOnMount: C(e.options.refetchOnMount),
86
- refetchOnReconnect: C(e.options.refetchOnReconnect),
87
- refetchOnWindowFocus: C(e.options.refetchOnWindowFocus),
88
- enabled: C(e.options.enabled)
102
+ refetchOnMount: T(e.options.refetchOnMount),
103
+ refetchOnReconnect: T(e.options.refetchOnReconnect),
104
+ refetchOnWindowFocus: T(e.options.refetchOnWindowFocus),
105
+ enabled: T(e.options.enabled)
89
106
  },
90
107
  deps: Array.from(e.deps).map(
91
108
  (t) => "uid" in t ? {
@@ -103,161 +120,170 @@ function w(e) {
103
120
  };
104
121
  }
105
122
  const I = /* @__PURE__ */ new WeakMap();
106
- function ye(e, t, o, l) {
107
- e.addEventListener(t, o, l), J() && Q(() => {
108
- e.removeEventListener(t, o);
123
+ function ye(e, t, n, l) {
124
+ e.addEventListener(t, n, l), J() && Q(() => {
125
+ e.removeEventListener(t, n);
109
126
  });
110
127
  }
111
128
  const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
112
129
  __name: "PiniaColadaDevtools",
113
130
  setup(e) {
114
131
  const t = fe();
115
- me(t), t.$onAction(({ name: n, after: i, onError: v, args: S }) => {
116
- if (n === "remove") {
117
- const [a] = S;
118
- i(() => {
119
- s.emit("queries:delete", w(a));
132
+ me(t), t.$onAction(({ name: i, after: o, onError: m, args: g }) => {
133
+ if (i === "remove") {
134
+ const [a] = g;
135
+ o(() => {
136
+ r.emit("queries:delete", S(a));
120
137
  });
121
- } else if (n === "track" || n === "untrack" || n === "cancel" || n === "invalidate" || n === "fetch" || n === "setEntryState") {
122
- const [a] = S;
123
- if (n === "fetch") {
124
- const m = w(a);
125
- m.asyncStatus = "loading", s.emit("queries:update", m);
138
+ } else if (i === "track" || i === "untrack" || i === "cancel" || i === "invalidate" || i === "fetch" || i === "setEntryState") {
139
+ const [a] = g;
140
+ if (i === "fetch") {
141
+ const y = S(a);
142
+ y.asyncStatus = "loading", r.emit("queries:update", y);
126
143
  }
127
- i(() => {
128
- var m;
129
- a[p].simulate = null, s.emit("queries:update", w(a)), n === "fetch" && ((m = a.options) == null ? void 0 : m.staleTime) != null && Number.isFinite(a.options.staleTime) && setTimeout(() => {
130
- s.emit("queries:update", w(a));
144
+ o(() => {
145
+ var y;
146
+ a[p].simulate = null, r.emit("queries:update", S(a)), i === "fetch" && ((y = a.options) == null ? void 0 : y.staleTime) != null && Number.isFinite(a.options.staleTime) && setTimeout(() => {
147
+ r.emit("queries:update", S(a));
131
148
  }, a.options.staleTime);
132
- }), v(() => {
133
- s.emit("queries:update", w(a));
149
+ }), m(() => {
150
+ r.emit("queries:update", S(a));
134
151
  });
135
- } else if (n === "create")
136
- i((a) => {
137
- s.emit("queries:update", w(a));
152
+ } else if (i === "create")
153
+ o((a) => {
154
+ r.emit("queries:update", S(a));
138
155
  });
139
- else if (n === "setQueryData") {
140
- const [a] = S;
141
- i(() => {
142
- const m = t.getEntries({ key: a, exact: !0 })[0];
143
- m && s.emit("queries:update", w(m));
156
+ else if (i === "setQueryData") {
157
+ const [a] = g;
158
+ o(() => {
159
+ const y = t.getEntries({ key: a, exact: !0 })[0];
160
+ y && r.emit("queries:update", S(y));
144
161
  });
145
162
  }
146
163
  });
147
- const o = oe("devtools"), l = N(new MessageChannel()), s = new pe(l.value.port1);
148
- P(
164
+ const n = oe("devtools"), l = N(new MessageChannel()), r = new pe(l.value.port1);
165
+ _(
149
166
  l,
150
- (n) => {
151
- s.setPort(n.port1);
167
+ (i) => {
168
+ r.setPort(i.port1);
152
169
  },
153
170
  { flush: "sync" }
154
- ), s.on("ping", () => {
155
- console.log("[App] Received ping from devtools"), s.emit("pong");
156
- }), s.on("pong", () => {
171
+ ), r.on("ping", () => {
172
+ console.log("[App] Received ping from devtools"), r.emit("pong");
173
+ }), r.on("pong", () => {
157
174
  console.log("[App] Received pong from devtools");
158
- }), s.on("queries:refetch", (n) => {
159
- t.invalidateQueries({ key: n, exact: !0, active: null, stale: null });
160
- }), s.on("queries:invalidate", (n) => {
161
- t.invalidateQueries({ key: n, exact: !0 });
162
- }), s.on("queries:reset", (n) => {
163
- const i = t.getEntries({ key: n, exact: !0 })[0];
164
- i && (t.cancel(i), t.setEntryState(i, {
175
+ }), r.on("queries:refetch", (i) => {
176
+ t.invalidateQueries({ key: i, exact: !0, active: null, stale: null });
177
+ }), r.on("queries:invalidate", (i) => {
178
+ t.invalidateQueries({ key: i, exact: !0 });
179
+ }), r.on("queries:reset", (i) => {
180
+ const o = t.getEntries({ key: i, exact: !0 })[0];
181
+ o && (t.cancel(o), t.setEntryState(o, {
165
182
  status: "pending",
166
183
  data: void 0,
167
184
  error: null
168
185
  }));
169
- }), s.on("queries:set:state", (n, i) => {
170
- const v = t.getEntries({ key: n, exact: !0 })[0];
171
- v && (t.setEntryState(v, i), s.emit("queries:update", w(v)));
172
- }), s.on("queries:simulate:loading", (n) => {
173
- const i = t.getEntries({ key: n, exact: !0 })[0];
174
- i && (i.asyncStatus.value = "loading", i[p].simulate = "loading", s.emit("queries:update", w(i)));
175
- }), s.on("queries:simulate:loading:stop", (n) => {
176
- const i = t.getEntries({ key: n, exact: !0 })[0];
177
- i && i[p].simulate === "loading" && (i.asyncStatus.value = "idle", i[p].simulate = null, s.emit("queries:update", w(i)));
178
- }), s.on("queries:simulate:error", (n) => {
179
- const i = t.getEntries({ key: n, exact: !0 })[0];
180
- i && (t.cancel(i), t.setEntryState(i, {
181
- ...i.state.value,
186
+ }), r.on("queries:set:state", (i, o) => {
187
+ const m = t.getEntries({ key: i, exact: !0 })[0];
188
+ m && (t.setEntryState(m, o), r.emit("queries:update", S(m)));
189
+ }), r.on("queries:simulate:loading", (i) => {
190
+ const o = t.getEntries({ key: i, exact: !0 })[0];
191
+ o && (o.asyncStatus.value = "loading", o[p].simulate = "loading", r.emit("queries:update", S(o)));
192
+ }), r.on("queries:simulate:loading:stop", (i) => {
193
+ const o = t.getEntries({ key: i, exact: !0 })[0];
194
+ o && o[p].simulate === "loading" && (o.asyncStatus.value = "idle", o[p].simulate = null, r.emit("queries:update", S(o)));
195
+ }), r.on("queries:simulate:error", (i) => {
196
+ const o = t.getEntries({ key: i, exact: !0 })[0];
197
+ o && (t.cancel(o), t.setEntryState(o, {
198
+ ...o.state.value,
182
199
  status: "error",
183
200
  error: new Error("Simulated error")
184
- }), i[p].simulate = "error", s.emit("queries:update", w(i)));
185
- }), s.on("queries:simulate:error:stop", (n) => {
186
- const i = t.getEntries({ key: n, exact: !0 })[0];
187
- i && i[p].simulate === "error" && (t.cancel(i), t.setEntryState(i, {
188
- ...i.state.value,
189
- status: i.state.value.data !== void 0 ? "success" : "pending",
201
+ }), o[p].simulate = "error", r.emit("queries:update", S(o)));
202
+ }), r.on("queries:simulate:error:stop", (i) => {
203
+ const o = t.getEntries({ key: i, exact: !0 })[0];
204
+ o && o[p].simulate === "error" && (t.cancel(o), t.setEntryState(o, {
205
+ ...o.state.value,
206
+ status: o.state.value.data !== void 0 ? "success" : "pending",
190
207
  error: null
191
- }), i[p].simulate = null, s.emit("queries:update", w(i)));
208
+ }), o[p].simulate = null, r.emit("queries:update", S(o)));
192
209
  });
193
- const c = N(null);
194
- P(c, () => {
210
+ const d = N(null);
211
+ _(d, () => {
195
212
  l.value = new MessageChannel();
196
213
  }), ye(
197
214
  window,
198
215
  "unload",
199
216
  () => {
200
- var n;
201
- (n = c.value) == null || n.close();
217
+ var i;
218
+ (i = d.value) == null || i.close();
202
219
  },
203
220
  { passive: !0 }
204
221
  ), ie(() => {
205
- var n;
206
- (n = c.value) == null || n.close();
222
+ var i;
223
+ (i = d.value) == null || i.close();
207
224
  });
208
- function y() {
209
- var n;
210
- (n = c.value) == null || n.close(), c.value = null;
225
+ function h() {
226
+ var i;
227
+ (i = d.value) == null || i.close(), d.value = null;
211
228
  }
212
- function r() {
213
- const n = o.value;
214
- if (!n || !n.shadowRoot)
229
+ function f() {
230
+ const i = n.value;
231
+ if (!i || !i.shadowRoot)
215
232
  throw new Error("No devtools elemnt found for Pinia Colada devtools");
216
- const i = n.shadowRoot.getElementById("root");
217
- if (!i)
233
+ const o = i.shadowRoot.getElementById("root");
234
+ if (!o)
218
235
  throw new Error("No devtools root element found for Pinia Colada devtools");
219
- const v = Math.max(i.offsetWidth, 400), S = Math.max(i.offsetHeight, 400), a = window.open(
236
+ const m = Math.max(o.offsetWidth, 400), g = Math.max(o.offsetHeight, 400), a = window.open(
220
237
  "",
221
238
  "pinia-colada-devtools",
222
- `popup,width=${v},height=${S}`
239
+ `popup,width=${m},height=${g}`
223
240
  );
224
241
  if (!a)
225
242
  throw new Error("Failed to open PiP window for Pinia Colada devtools");
226
- c.value = a, a.document.head.innerHTML = "", a.document.body.innerHTML = "", a.document.title = "🍹 Pinia Colada Devtools", a.document.body.style.margin = "0", u(n, a.document), a.addEventListener(
243
+ d.value = a, a.document.head.innerHTML = "", a.document.body.innerHTML = "", a.document.title = "🍹 Pinia Colada Devtools", a.document.body.style.margin = "0", s(i, a.document), a.addEventListener(
227
244
  "unload",
228
245
  () => {
229
- c.value = null;
246
+ d.value = null;
230
247
  },
231
248
  { passive: !0 }
232
249
  );
233
250
  }
234
- function u(n, i = document) {
235
- if (!n || !n.shadowRoot)
251
+ function s(i, o = document) {
252
+ if (!i || !i.shadowRoot)
236
253
  throw new Error("No devtools element found for Pinia Colada devtools");
237
- const v = i.getElementById("__pc-tw-properties") ?? i.createElement("style");
238
- v.setAttribute("id", "__pc-tw-properties");
239
- const S = [...n.shadowRoot.styleSheets].flatMap((a) => [...a.cssRules]).filter((a) => a instanceof CSSPropertyRule).map((a) => a.cssText).join("");
240
- v.textContent = S, i.head.appendChild(v);
254
+ const m = o.getElementById("__pc-tw-properties") ?? o.createElement("style");
255
+ m.setAttribute("id", "__pc-tw-properties");
256
+ const g = [...i.shadowRoot.styleSheets].flatMap((a) => [...a.cssRules]).filter((a) => a instanceof CSSPropertyRule).map((a) => a.cssText).join("");
257
+ m.textContent = g, o.head.appendChild(m);
241
258
  }
242
- function f() {
243
- c.value ? y() : r();
259
+ function u() {
260
+ d.value ? h() : f();
244
261
  }
245
- async function h() {
246
- u(o.value), s.emit("queries:all", t.getEntries({}).map(w)), s.emit(
262
+ let v = 0;
263
+ async function E() {
264
+ if (!n.value) {
265
+ if (++v > 100)
266
+ throw new Error("Failed to find devtools element for Pinia Colada devtools");
267
+ setTimeout(() => {
268
+ E();
269
+ }, 100);
270
+ return;
271
+ }
272
+ s(n.value), r.emit("queries:all", t.getEntries({}).map(S)), r.emit(
247
273
  "mutations:all",
248
274
  // FIXME: mutations
249
- t.getEntries({}).map(w)
275
+ t.getEntries({}).map(S)
250
276
  );
251
277
  }
252
- return (n, i) => (x(), W(re, {
253
- to: c.value ? c.value.document.body : "body"
278
+ return (i, o) => (x(), W(re, {
279
+ to: d.value ? d.value.document.body : "body"
254
280
  }, [
255
281
  se("pinia-colada-devtools-panel", {
256
282
  ref: "devtools",
257
- ".isPip": !!c.value,
283
+ ".isPip": !!d.value,
258
284
  ".port": l.value.port2,
259
- onTogglePip: i[0] || (i[0] = (v) => f()),
260
- onReady: i[1] || (i[1] = (v) => h())
285
+ onTogglePip: o[0] || (o[0] = (m) => u()),
286
+ onReady: o[1] || (o[1] = (m) => E())
261
287
  }, null, 40, he)
262
288
  ], 8, ["to"]));
263
289
  }
@@ -265,128 +291,128 @@ const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
265
291
  function we(e) {
266
292
  return J() ? (Q(e), !0) : !1;
267
293
  }
268
- const Se = typeof window < "u" && typeof document < "u";
294
+ const Ee = typeof window < "u" && typeof document < "u";
269
295
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
270
- const Ee = Object.prototype.toString, be = (e) => Ee.call(e) === "[object Object]", Ce = () => {
296
+ const Se = Object.prototype.toString, be = (e) => Se.call(e) === "[object Object]", Ae = () => {
271
297
  };
272
298
  function Te(...e) {
273
299
  if (e.length !== 1)
274
300
  return le(...e);
275
301
  const t = e[0];
276
- return typeof t == "function" ? K(ue(() => ({ get: t, set: Ce }))) : R(t);
302
+ return typeof t == "function" ? K(ue(() => ({ get: t, set: Ae }))) : R(t);
277
303
  }
278
- function Ae(e, t) {
279
- function o(...l) {
280
- return new Promise((s, c) => {
281
- Promise.resolve(e(() => t.apply(this, l), { fn: t, thisArg: this, args: l })).then(s).catch(c);
304
+ function Ce(e, t) {
305
+ function n(...l) {
306
+ return new Promise((r, d) => {
307
+ Promise.resolve(e(() => t.apply(this, l), { fn: t, thisArg: this, args: l })).then(r).catch(d);
282
308
  });
283
309
  }
284
- return o;
310
+ return n;
285
311
  }
286
312
  const Y = (e) => e();
287
- function _e(e = Y, t = {}) {
313
+ function Pe(e = Y, t = {}) {
288
314
  const {
289
- initialState: o = "active"
290
- } = t, l = Te(o === "active");
291
- function s() {
315
+ initialState: n = "active"
316
+ } = t, l = Te(n === "active");
317
+ function r() {
292
318
  l.value = !1;
293
319
  }
294
- function c() {
320
+ function d() {
295
321
  l.value = !0;
296
322
  }
297
- const y = (...r) => {
298
- l.value && e(...r);
323
+ const h = (...f) => {
324
+ l.value && e(...f);
299
325
  };
300
- return { isActive: K(l), pause: s, resume: c, eventFilter: y };
326
+ return { isActive: K(l), pause: r, resume: d, eventFilter: h };
301
327
  }
302
328
  function q(e) {
303
329
  return Array.isArray(e) ? e : [e];
304
330
  }
305
- function Pe(e) {
331
+ function _e(e) {
306
332
  return ae();
307
333
  }
308
- function Oe(e, t, o = {}) {
334
+ function Oe(e, t, n = {}) {
309
335
  const {
310
336
  eventFilter: l = Y,
311
- ...s
312
- } = o;
313
- return P(
337
+ ...r
338
+ } = n;
339
+ return _(
314
340
  e,
315
- Ae(
341
+ Ce(
316
342
  l,
317
343
  t
318
344
  ),
319
- s
345
+ r
320
346
  );
321
347
  }
322
- function ke(e, t, o = {}) {
348
+ function ke(e, t, n = {}) {
323
349
  const {
324
350
  eventFilter: l,
325
- initialState: s = "active",
326
- ...c
327
- } = o, { eventFilter: y, pause: r, resume: u, isActive: f } = _e(l, { initialState: s });
351
+ initialState: r = "active",
352
+ ...d
353
+ } = n, { eventFilter: h, pause: f, resume: s, isActive: u } = Pe(l, { initialState: r });
328
354
  return { stop: Oe(
329
355
  e,
330
356
  t,
331
357
  {
332
- ...c,
333
- eventFilter: y
358
+ ...d,
359
+ eventFilter: h
334
360
  }
335
- ), pause: r, resume: u, isActive: f };
361
+ ), pause: f, resume: s, isActive: u };
336
362
  }
337
- function xe(e, t = !0, o) {
338
- Pe() ? L(e, o) : t ? e() : G(e);
363
+ function xe(e, t = !0, n) {
364
+ _e() ? L(e, n) : t ? e() : G(e);
339
365
  }
340
- function De(e, t, o) {
341
- return P(
366
+ function De(e, t, n) {
367
+ return _(
342
368
  e,
343
369
  t,
344
370
  {
345
- ...o,
371
+ ...n,
346
372
  immediate: !0
347
373
  }
348
374
  );
349
375
  }
350
- const D = Se ? window : void 0;
376
+ const D = Ee ? window : void 0;
351
377
  function Re(e) {
352
378
  var t;
353
- const o = C(e);
354
- return (t = o == null ? void 0 : o.$el) != null ? t : o;
379
+ const n = T(e);
380
+ return (t = n == null ? void 0 : n.$el) != null ? t : n;
355
381
  }
356
382
  function z(...e) {
357
- const t = [], o = () => {
358
- t.forEach((r) => r()), t.length = 0;
359
- }, l = (r, u, f, h) => (r.addEventListener(u, f, h), () => r.removeEventListener(u, f, h)), s = U(() => {
360
- const r = q(C(e[0])).filter((u) => u != null);
361
- return r.every((u) => typeof u != "string") ? r : void 0;
362
- }), c = De(
383
+ const t = [], n = () => {
384
+ t.forEach((f) => f()), t.length = 0;
385
+ }, l = (f, s, u, v) => (f.addEventListener(s, u, v), () => f.removeEventListener(s, u, v)), r = U(() => {
386
+ const f = q(T(e[0])).filter((s) => s != null);
387
+ return f.every((s) => typeof s != "string") ? f : void 0;
388
+ }), d = De(
363
389
  () => {
364
- var r, u;
390
+ var f, s;
365
391
  return [
366
- (u = (r = s.value) == null ? void 0 : r.map((f) => Re(f))) != null ? u : [D].filter((f) => f != null),
367
- q(C(s.value ? e[1] : e[0])),
368
- q(F(s.value ? e[2] : e[1])),
392
+ (s = (f = r.value) == null ? void 0 : f.map((u) => Re(u))) != null ? s : [D].filter((u) => u != null),
393
+ q(T(r.value ? e[1] : e[0])),
394
+ q(F(r.value ? e[2] : e[1])),
369
395
  // @ts-expect-error - TypeScript gets the correct types, but somehow still complains
370
- C(s.value ? e[3] : e[2])
396
+ T(r.value ? e[3] : e[2])
371
397
  ];
372
398
  },
373
- ([r, u, f, h]) => {
374
- if (o(), !(r != null && r.length) || !(u != null && u.length) || !(f != null && f.length))
399
+ ([f, s, u, v]) => {
400
+ if (n(), !(f != null && f.length) || !(s != null && s.length) || !(u != null && u.length))
375
401
  return;
376
- const n = be(h) ? { ...h } : h;
402
+ const E = be(v) ? { ...v } : v;
377
403
  t.push(
378
- ...r.flatMap(
379
- (i) => u.flatMap(
380
- (v) => f.map((S) => l(i, v, S, n))
404
+ ...f.flatMap(
405
+ (i) => s.flatMap(
406
+ (o) => u.map((m) => l(i, o, m, E))
381
407
  )
382
408
  )
383
409
  );
384
410
  },
385
411
  { flush: "post" }
386
- ), y = () => {
387
- c(), o();
412
+ ), h = () => {
413
+ d(), n();
388
414
  };
389
- return we(o), y;
415
+ return we(n), h;
390
416
  }
391
417
  const O = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, k = "__vueuse_ssr_handlers__", qe = /* @__PURE__ */ Me();
392
418
  function Me() {
@@ -432,128 +458,128 @@ const Fe = {
432
458
  write: (e) => e.toISOString()
433
459
  }
434
460
  }, B = "vueuse-storage";
435
- function $e(e, t, o, l = {}) {
436
- var s;
461
+ function $e(e, t, n, l = {}) {
462
+ var r;
437
463
  const {
438
- flush: c = "pre",
439
- deep: y = !0,
440
- listenToStorageChanges: r = !0,
441
- writeDefaults: u = !0,
442
- mergeDefaults: f = !1,
443
- shallow: h,
444
- window: n = D,
464
+ flush: d = "pre",
465
+ deep: h = !0,
466
+ listenToStorageChanges: f = !0,
467
+ writeDefaults: s = !0,
468
+ mergeDefaults: u = !1,
469
+ shallow: v,
470
+ window: E = D,
445
471
  eventFilter: i,
446
- onError: v = (d) => {
447
- console.error(d);
472
+ onError: o = (c) => {
473
+ console.error(c);
448
474
  },
449
- initOnMounted: S
450
- } = l, a = (h ? N : R)(t), m = U(() => C(e));
451
- if (!o)
475
+ initOnMounted: m
476
+ } = l, g = (v ? N : R)(t), a = U(() => T(e));
477
+ if (!n)
452
478
  try {
453
- o = Ne("getDefaultStorage", () => {
454
- var d;
455
- return (d = D) == null ? void 0 : d.localStorage;
479
+ n = Ne("getDefaultStorage", () => {
480
+ var c;
481
+ return (c = D) == null ? void 0 : c.localStorage;
456
482
  })();
457
- } catch (d) {
458
- v(d);
483
+ } catch (c) {
484
+ o(c);
459
485
  }
460
- if (!o)
461
- return a;
462
- const T = C(t), j = We(T), A = (s = l.serializer) != null ? s : Fe[j], { pause: X, resume: V } = ke(
463
- a,
464
- () => Z(a.value),
465
- { flush: c, deep: y, eventFilter: i }
486
+ if (!n)
487
+ return g;
488
+ const y = T(t), j = We(y), C = (r = l.serializer) != null ? r : Fe[j], { pause: X, resume: V } = ke(
489
+ g,
490
+ () => Z(g.value),
491
+ { flush: d, deep: h, eventFilter: i }
466
492
  );
467
- P(m, () => _(), { flush: c }), n && r && xe(() => {
468
- o instanceof Storage ? z(n, "storage", _, { passive: !0 }) : z(n, B, te), S && _();
469
- }), S || _();
470
- function H(d, g) {
471
- if (n) {
472
- const E = {
473
- key: m.value,
474
- oldValue: d,
475
- newValue: g,
476
- storageArea: o
493
+ _(a, () => P(), { flush: d }), E && f && xe(() => {
494
+ n instanceof Storage ? z(E, "storage", P, { passive: !0 }) : z(E, B, te), m && P();
495
+ }), m || P();
496
+ function H(c, w) {
497
+ if (E) {
498
+ const A = {
499
+ key: a.value,
500
+ oldValue: c,
501
+ newValue: w,
502
+ storageArea: n
477
503
  };
478
- n.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", E) : new CustomEvent(B, {
479
- detail: E
504
+ E.dispatchEvent(n instanceof Storage ? new StorageEvent("storage", A) : new CustomEvent(B, {
505
+ detail: A
480
506
  }));
481
507
  }
482
508
  }
483
- function Z(d) {
509
+ function Z(c) {
484
510
  try {
485
- const g = o.getItem(m.value);
486
- if (d == null)
487
- H(g, null), o.removeItem(m.value);
511
+ const w = n.getItem(a.value);
512
+ if (c == null)
513
+ H(w, null), n.removeItem(a.value);
488
514
  else {
489
- const E = A.write(d);
490
- g !== E && (o.setItem(m.value, E), H(g, E));
515
+ const A = C.write(c);
516
+ w !== A && (n.setItem(a.value, A), H(w, A));
491
517
  }
492
- } catch (g) {
493
- v(g);
518
+ } catch (w) {
519
+ o(w);
494
520
  }
495
521
  }
496
- function ee(d) {
497
- const g = d ? d.newValue : o.getItem(m.value);
498
- if (g == null)
499
- return u && T != null && o.setItem(m.value, A.write(T)), T;
500
- if (!d && f) {
501
- const E = A.read(g);
502
- return typeof f == "function" ? f(E, T) : j === "object" && !Array.isArray(E) ? { ...T, ...E } : E;
503
- } else return typeof g != "string" ? g : A.read(g);
522
+ function ee(c) {
523
+ const w = c ? c.newValue : n.getItem(a.value);
524
+ if (w == null)
525
+ return s && y != null && n.setItem(a.value, C.write(y)), y;
526
+ if (!c && u) {
527
+ const A = C.read(w);
528
+ return typeof u == "function" ? u(A, y) : j === "object" && !Array.isArray(A) ? { ...y, ...A } : A;
529
+ } else return typeof w != "string" ? w : C.read(w);
504
530
  }
505
- function _(d) {
506
- if (!(d && d.storageArea !== o)) {
507
- if (d && d.key == null) {
508
- a.value = T;
531
+ function P(c) {
532
+ if (!(c && c.storageArea !== n)) {
533
+ if (c && c.key == null) {
534
+ g.value = y;
509
535
  return;
510
536
  }
511
- if (!(d && d.key !== m.value)) {
537
+ if (!(c && c.key !== a.value)) {
512
538
  X();
513
539
  try {
514
- (d == null ? void 0 : d.newValue) !== A.write(a.value) && (a.value = ee(d));
515
- } catch (g) {
516
- v(g);
540
+ (c == null ? void 0 : c.newValue) !== C.write(g.value) && (g.value = ee(c));
541
+ } catch (w) {
542
+ o(w);
517
543
  } finally {
518
- d ? G(V) : V();
544
+ c ? G(V) : V();
519
545
  }
520
546
  }
521
547
  }
522
548
  }
523
- function te(d) {
524
- _(d.detail);
549
+ function te(c) {
550
+ P(c.detail);
525
551
  }
526
- return a;
552
+ return g;
527
553
  }
528
- function Le(e, t, o = {}) {
529
- const { window: l = D } = o;
530
- return $e(e, t, l == null ? void 0 : l.localStorage, o);
554
+ function Le(e, t, n = {}) {
555
+ const { window: l = D } = n;
556
+ return $e(e, t, l == null ? void 0 : l.localStorage, n);
531
557
  }
532
558
  const Ie = /* @__PURE__ */ $({
533
559
  __name: "PCDevtoolsWrapper",
534
560
  setup(e) {
535
- const t = R(!1), o = Le("pinia-colada-devtools-open", !1);
561
+ const t = R(!1), n = Le("pinia-colada-devtools-open", !1);
536
562
  async function l() {
537
563
  if (!t.value && (t.value = !0, !customElements.get("pinia-colada-devtools-panel"))) {
538
- const { DevtoolsPanel: c } = await import("@pinia/colada-devtools/panel");
539
- customElements.define("pinia-colada-devtools-panel", c);
564
+ const { DevtoolsPanel: d } = await import("@pinia/colada-devtools/panel");
565
+ customElements.define("pinia-colada-devtools-panel", d);
540
566
  }
541
567
  }
542
- async function s() {
543
- await l(), o.value = !0;
568
+ async function r() {
569
+ await l(), n.value = !0;
544
570
  }
545
571
  return L(() => {
546
572
  requestIdleCallback(() => {
547
573
  import("@pinia/colada-devtools/panel");
548
- }), o.value && s();
549
- }), (c, y) => (x(), W(ve, null, {
574
+ }), n.value && r();
575
+ }), (d, h) => (x(), W(ve, null, {
550
576
  default: ce(() => [
551
- F(o) ? M("", !0) : (x(), de("button", {
577
+ F(n) ? M("", !0) : (x(), de("button", {
552
578
  key: 0,
553
579
  class: "fixed bottom-2 right-2 bg-primary-500 hover:cursor-pointer z-99999",
554
- onClick: y[0] || (y[0] = (r) => s())
580
+ onClick: h[0] || (h[0] = (f) => r())
555
581
  }, " 🍹 Devtools ")),
556
- t.value && F(o) ? (x(), W(ge, { key: 1 })) : M("", !0)
582
+ t.value && F(n) ? (x(), W(ge, { key: 1 })) : M("", !0)
557
583
  ]),
558
584
  _: 1
559
585
  }));