@graffiti-garden/wrapper-vue 0.7.2 → 1.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 (70) hide show
  1. package/README.md +2 -3
  2. package/dist/browser/ajv-D_HICdxS.mjs +4447 -0
  3. package/dist/browser/ajv-D_HICdxS.mjs.map +1 -0
  4. package/dist/browser/plugin.mjs +1003 -943
  5. package/dist/browser/plugin.mjs.map +1 -1
  6. package/dist/node/components/ActorToHandle.vue.d.ts +23 -0
  7. package/dist/node/components/ActorToHandle.vue.d.ts.map +1 -0
  8. package/dist/node/{Discover.vue.d.ts → components/Discover.vue.d.ts} +4 -4
  9. package/dist/node/components/Discover.vue.d.ts.map +1 -0
  10. package/dist/node/{Get.vue.d.ts → components/Get.vue.d.ts} +2 -5
  11. package/dist/node/components/Get.vue.d.ts.map +1 -0
  12. package/dist/node/components/GetMedia.vue.d.ts +36 -0
  13. package/dist/node/components/GetMedia.vue.d.ts.map +1 -0
  14. package/dist/node/components/HandleToActor.vue.d.ts +23 -0
  15. package/dist/node/components/HandleToActor.vue.d.ts.map +1 -0
  16. package/dist/node/components/ObjectInfo.vue.d.ts +7 -0
  17. package/dist/node/components/ObjectInfo.vue.d.ts.map +1 -0
  18. package/dist/node/composables/actor-to-handle.d.ts +25 -0
  19. package/dist/node/composables/actor-to-handle.d.ts.map +1 -0
  20. package/dist/node/composables/discover.d.ts +38 -0
  21. package/dist/node/composables/discover.d.ts.map +1 -0
  22. package/dist/node/composables/get-media.d.ts +31 -0
  23. package/dist/node/composables/get-media.d.ts.map +1 -0
  24. package/dist/node/composables/get.d.ts +28 -0
  25. package/dist/node/composables/get.d.ts.map +1 -0
  26. package/dist/node/composables/handle-to-actor.d.ts +25 -0
  27. package/dist/node/composables/handle-to-actor.d.ts.map +1 -0
  28. package/dist/node/composables/resolve-string.d.ts +6 -0
  29. package/dist/node/composables/resolve-string.d.ts.map +1 -0
  30. package/dist/node/globals.d.ts +3 -5
  31. package/dist/node/globals.d.ts.map +1 -1
  32. package/dist/node/plugin.d.ts +174 -75
  33. package/dist/node/plugin.d.ts.map +1 -1
  34. package/dist/node/plugin.js +1 -1
  35. package/dist/node/plugin.js.map +1 -1
  36. package/dist/node/plugin.mjs +468 -333
  37. package/dist/node/plugin.mjs.map +1 -1
  38. package/package.json +15 -14
  39. package/src/components/ActorToHandle.vue +16 -0
  40. package/src/{Discover.vue → components/Discover.vue} +15 -9
  41. package/src/{Get.vue → components/Get.vue} +7 -11
  42. package/src/components/GetMedia.vue +75 -0
  43. package/src/components/HandleToActor.vue +16 -0
  44. package/src/components/ObjectInfo.vue +127 -0
  45. package/src/composables/actor-to-handle.ts +32 -0
  46. package/src/composables/discover.ts +202 -0
  47. package/src/composables/get-media.ts +116 -0
  48. package/src/composables/get.ts +109 -0
  49. package/src/composables/handle-to-actor.ts +32 -0
  50. package/src/composables/resolve-string.ts +46 -0
  51. package/src/globals.ts +24 -2
  52. package/src/plugin.ts +84 -29
  53. package/dist/browser/ajv-C30pimY5.mjs +0 -4400
  54. package/dist/browser/ajv-C30pimY5.mjs.map +0 -1
  55. package/dist/browser/index-CWfNKdDL.mjs +0 -424
  56. package/dist/browser/index-CWfNKdDL.mjs.map +0 -1
  57. package/dist/node/Discover.vue.d.ts.map +0 -1
  58. package/dist/node/Get.vue.d.ts.map +0 -1
  59. package/dist/node/RecoverOrphans.vue.d.ts +0 -31
  60. package/dist/node/RecoverOrphans.vue.d.ts.map +0 -1
  61. package/dist/node/composables.d.ts +0 -75
  62. package/dist/node/composables.d.ts.map +0 -1
  63. package/dist/node/pollers.d.ts +0 -28
  64. package/dist/node/pollers.d.ts.map +0 -1
  65. package/dist/node/reducers.d.ts +0 -37
  66. package/dist/node/reducers.d.ts.map +0 -1
  67. package/src/RecoverOrphans.vue +0 -37
  68. package/src/composables.ts +0 -347
  69. package/src/pollers.ts +0 -119
  70. package/src/reducers.ts +0 -124
@@ -1,310 +1,286 @@
1
- var fe = Object.defineProperty;
2
- var he = (t, n, e) => n in t ? fe(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var v = (t, n, e) => he(t, typeof n != "symbol" ? n + "" : n, e);
4
- import { ref as B, computed as pe, watch as de, onScopeDispose as ye, toValue as P, defineComponent as W, toRef as b, renderSlot as J, unref as g } from "vue";
5
- const q = {};
6
- function M() {
7
- const t = q.graffitiSynchronize;
8
- if (!t)
1
+ import { ref as k, onScopeDispose as le, watch as H, toValue as P, defineComponent as _, toRef as S, renderSlot as N, unref as v, createElementVNode as p, toDisplayString as O, createElementBlock as b, openBlock as w, createVNode as V, createCommentVNode as de, Fragment as re, renderList as oe } from "vue";
2
+ var D = class pe extends Error {
3
+ constructor(n) {
4
+ super(n), this.name = "GraffitiErrorNotFound", Object.setPrototypeOf(this, pe.prototype);
5
+ }
6
+ }, Se = class ve extends Error {
7
+ constructor(n) {
8
+ super(n), this.name = "GraffitiErrorInvalidSchema", Object.setPrototypeOf(this, ve.prototype);
9
+ }
10
+ };
11
+ function te(e) {
12
+ return typeof e == "string" ? e : e.url;
13
+ }
14
+ function Ge(e, n) {
15
+ return !Array.isArray(e.allowed) || typeof n?.actor == "string" && (e.actor === n.actor || e.allowed.includes(n.actor));
16
+ }
17
+ function ke(e, n, t) {
18
+ if (t === e.actor) return e;
19
+ let o = e.allowed && t ? [t] : void 0, i = e.channels.filter((r) => n.includes(r));
20
+ return { ...e, allowed: o, channels: i };
21
+ }
22
+ const I = {};
23
+ function Ee(e) {
24
+ if (!I.graffitiSession)
25
+ I.graffitiSession = e;
26
+ else
27
+ throw new Error(
28
+ "Graffiti session already set - plugin installed multiple times?"
29
+ );
30
+ }
31
+ function Oe(e) {
32
+ if (!I.graffitiSynchronize)
33
+ I.graffitiSynchronize = e;
34
+ else
35
+ throw new Error(
36
+ "Graffiti synchronize already set - plugin installed multiple times?"
37
+ );
38
+ }
39
+ function X() {
40
+ const e = I.graffitiSynchronize;
41
+ if (!e)
9
42
  throw new Error(
10
43
  "No Graffiti instance provided, did you forget to install the plugin?"
11
44
  );
12
- return t;
45
+ return e;
13
46
  }
14
- function $e() {
15
- return M();
47
+ function ae() {
48
+ return X();
16
49
  }
17
- function Y() {
18
- const t = q.graffitiSession;
19
- if (!t)
50
+ function ct() {
51
+ const e = I.graffitiSession;
52
+ if (!e)
20
53
  throw new Error(
21
54
  "No Graffiti session provided, did you forget to install the plugin?"
22
55
  );
23
- return t;
56
+ return e;
24
57
  }
25
- var ve = class {
26
- }, me = class Z extends Error {
27
- constructor(n) {
28
- super(n), this.name = "GraffitiErrorNotFound", Object.setPrototypeOf(this, Z.prototype);
29
- }
30
- }, be = class ee extends Error {
31
- constructor(n) {
32
- super(n), this.name = "GraffitiErrorInvalidSchema", Object.setPrototypeOf(this, ee.prototype);
33
- }
34
- }, we = class te extends Error {
35
- constructor(n) {
36
- super(n), this.name = "GraffitiErrorPatchTestFailed", Object.setPrototypeOf(this, te.prototype);
37
- }
38
- }, ge = class ne extends Error {
39
- constructor(n) {
40
- super(n), this.name = "GraffitiErrorPatchError", Object.setPrototypeOf(this, ne.prototype);
41
- }
42
- };
43
- class Pe {
44
- constructor(n) {
45
- v(this, "poll", async (n) => {
46
- let e;
47
- const r = this.getter;
48
- try {
49
- e = await r();
50
- } catch {
51
- this.getter === r && n(null);
52
- return;
53
- }
54
- this.getter === r && n({ object: e });
58
+ function Ae(e, n, t, o = !1) {
59
+ const i = X(), r = /* @__PURE__ */ new Map(), s = k([]);
60
+ let a = async () => {
61
+ };
62
+ const c = async () => a(), u = k(!0);
63
+ let f, h;
64
+ le(() => {
65
+ f?.return(null), h?.return({
66
+ continue: () => h,
67
+ cursor: ""
55
68
  });
56
- this.getter = n;
57
- }
58
- clear() {
69
+ });
70
+ const l = k(0);
71
+ function y(d = 0) {
72
+ setTimeout(() => {
73
+ l.value++;
74
+ }, d);
59
75
  }
60
- }
61
- class re {
62
- constructor(n) {
63
- v(this, "iterator");
64
- v(this, "continue");
65
- v(this, "poll", async (n) => {
66
- if (!this.iterator)
67
- if (this.continue)
76
+ return H(
77
+ () => ({
78
+ args: [P(e), P(n), P(t)],
79
+ refresh: l.value
80
+ }),
81
+ ({ args: d }, m, j) => {
82
+ r.clear(), s.value = [], u.value = !0;
83
+ const E = i.synchronizeDiscover(...d);
84
+ f = E;
85
+ let G, g = !0;
86
+ j(() => {
87
+ g = !1, E.return(null), G?.return({
88
+ continue: () => h,
89
+ cursor: ""
90
+ });
91
+ });
92
+ let L;
93
+ (async () => {
94
+ for await (const x of E) {
95
+ if (!g) break;
96
+ x.tombstone ? r.delete(x.object.url) : r.set(x.object.url, x.object), L || (L = new Promise((ee) => {
97
+ setTimeout(() => {
98
+ g && (s.value = Array.from(r.values())), L = void 0, ee();
99
+ }, 50);
100
+ }));
101
+ }
102
+ })();
103
+ let Z = !1, fe = () => i.discover(...d);
104
+ a = async () => {
105
+ if (!(Z || !g)) {
106
+ Z = !0;
68
107
  try {
69
- this.iterator = this.continue();
70
- } catch (e) {
71
- if (e instanceof me)
72
- n("clear"), this.iterator = this.streamFactory();
73
- else
74
- throw e;
75
- }
76
- else
77
- this.iterator = this.streamFactory();
78
- for (; this.iterator; ) {
79
- const e = this.iterator, r = await e.next();
80
- if (e === this.iterator) {
81
- if (r.done) {
82
- this.iterator = void 0, r.value && (this.continue = r.value.continue);
83
- break;
108
+ G = fe(d[2]);
109
+ } catch {
110
+ return y(5e3);
84
111
  }
85
- if (r.value.error) {
86
- console.error(r.value.error);
87
- continue;
112
+ if (g) {
113
+ for (h = G; ; ) {
114
+ let x;
115
+ try {
116
+ x = await G.next();
117
+ } catch (ee) {
118
+ return ee instanceof D ? y() : y(5e3);
119
+ }
120
+ if (!g) return;
121
+ if (x.done) {
122
+ fe = x.value.continue;
123
+ break;
124
+ } else x.value.error && console.error(x.value.error);
125
+ }
126
+ await new Promise((x) => setTimeout(x, 0)), L && await L, g && (Z = !1, u.value = !1, P(o) && c());
88
127
  }
89
- n(r.value);
90
128
  }
91
- }
92
- });
93
- this.streamFactory = n;
94
- }
95
- clear() {
96
- if (this.iterator) {
97
- const n = this.iterator;
98
- this.iterator.return({
99
- continue: () => n,
100
- cursor: ""
101
- });
102
- }
103
- this.iterator = void 0, this.continue = void 0;
104
- }
105
- }
106
- function ie(t, n) {
107
- return !n || t.object.lastModified > n.object.lastModified || t.object.lastModified === n.object.lastModified && !t.tombstone && !!n.tombstone;
108
- }
109
- class je {
110
- constructor() {
111
- v(this, "entry", B());
112
- }
113
- get result() {
114
- return pe(() => {
115
- const n = this.entry.value;
116
- return n && (n.tombstone ? null : n.object);
117
- });
118
- }
119
- clear() {
120
- this.entry.value = void 0;
121
- }
122
- onEntry(n) {
123
- if (n === "clear") {
124
- this.clear();
125
- return;
126
- }
127
- (!n || ie(n, this.entry.value)) && (this.entry.value = n);
128
- }
129
- }
130
- class oe {
131
- constructor(n) {
132
- v(this, "results", B([]));
133
- v(this, "resultsRaw", /* @__PURE__ */ new Map());
134
- v(this, "batchFlattenTimer");
135
- this.graffiti = n;
136
- }
137
- clear() {
138
- this.resultsRaw.clear(), this.results.value = [], clearTimeout(this.batchFlattenTimer), this.batchFlattenTimer = void 0;
139
- }
140
- flattenResults() {
141
- this.results.value = Array.from(this.resultsRaw.values()).reduce((n, e) => (e.tombstone || n.push(e.object), n), []);
142
- }
143
- onEntry(n) {
144
- if (!n) return;
145
- if (n === "clear") {
146
- this.clear();
147
- return;
148
- }
149
- const e = this.resultsRaw.get(n.object.url);
150
- ie(n, e) && (this.resultsRaw.set(n.object.url, n), this.batchFlattenTimer || (this.batchFlattenTimer = setTimeout(() => {
151
- this.flattenResults(), this.batchFlattenTimer = void 0;
152
- }, 0)));
153
- }
129
+ }, c();
130
+ },
131
+ { immediate: !0 }
132
+ ), H(
133
+ () => P(o),
134
+ (d) => d && c()
135
+ ), {
136
+ objects: s,
137
+ poll: c,
138
+ isFirstPoll: u
139
+ };
154
140
  }
155
- function H(t, n, e, r, o) {
156
- let i;
157
- async function a() {
158
- i = e();
159
- for await (const h of i) {
160
- if (h.error) {
161
- console.error(h.error);
162
- continue;
163
- }
164
- t.onEntry(h);
165
- }
166
- }
167
- let l = !1, c;
168
- const s = async () => {
169
- if (l || !c) return;
170
- const h = c;
171
- l = !0;
172
- try {
173
- await h();
174
- } catch {
175
- await new Promise((d) => setTimeout(d, 2e3));
176
- } finally {
177
- if (h !== c) return;
178
- l = !1, P(o) && s();
179
- }
180
- }, f = B(!1);
181
- return de(
182
- r,
183
- async (h, u) => {
184
- if (JSON.stringify(h) === JSON.stringify(u))
185
- return;
186
- i == null || i.return(null), t.clear(), n.clear(), a(), c = () => n.poll(t.onEntry.bind(t));
187
- const d = c;
188
- l = !1, f.value = !0;
141
+ function me(e, n) {
142
+ const t = k(void 0);
143
+ return H(
144
+ () => P(e),
145
+ async (o, i, r) => {
146
+ let s = !0;
147
+ r(() => {
148
+ s = !1;
149
+ }), t.value = void 0;
189
150
  try {
190
- await s();
191
- } finally {
192
- if (d !== c) return;
193
- f.value = !1;
151
+ const a = await n(o);
152
+ s && (t.value = a);
153
+ } catch (a) {
154
+ if (!s) return;
155
+ a instanceof D ? t.value = null : console.error(a);
194
156
  }
195
157
  },
196
- {
197
- immediate: !0
198
- }
199
- ), ye(() => {
200
- i == null || i.return(null), t.clear(), n.clear(), c = void 0;
201
- }), { poll: s, isInitialPolling: f };
202
- }
203
- function se(t, n) {
204
- return () => {
205
- const e = P(n);
206
- return e === void 0 ? t == null ? void 0 : t.value : e;
207
- };
208
- }
209
- function E(t) {
210
- return t.map((n) => n());
211
- }
212
- function xe(t, n, e, r = !1) {
213
- const o = M(), i = Y(), a = () => P(t), l = () => P(n), c = se(i, e), s = [a, l, c], f = () => o.synchronizeDiscover(...E(s)), h = () => o.discover(...E(s)), u = new oe(o), d = new re(h), { poll: p, isInitialPolling: y } = H(
214
- u,
215
- d,
216
- f,
217
- s,
218
- r
219
- );
220
- return {
221
- /**
222
- * A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
223
- * an array of Graffiti objects.
224
- */
225
- objects: u.results,
226
- /**
227
- * A method to poll for new results.
228
- */
229
- poll: p,
230
- /**
231
- * A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)
232
- * that indicates if the *first* poll is currently running.
233
- * Useful to show a loading spinner or disable a button.
234
- *
235
- * This also tracks new polls when the arguments have changed,
236
- * but it does not track ongoing polls from either calling
237
- * {@link poll} or using the `autopoll` argument.
238
- */
239
- isInitialPolling: y
158
+ { immediate: !0 }
159
+ ), {
160
+ output: t
240
161
  };
241
162
  }
242
- function Oe(t, n, e, r = !1) {
243
- const o = M(), i = Y(), a = () => P(t), l = () => P(n), c = se(i, e), s = [
244
- a,
245
- l,
246
- c
247
- ], f = () => o.synchronizeGet(...E(s)), h = new je(), u = () => o.get(...E(s)), d = new Pe(u), { poll: p, isInitialPolling: y } = H(
248
- h,
249
- d,
250
- f,
251
- s,
252
- r
253
- );
254
- return {
255
- /**
256
- * A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
257
- * the retrieved Graffiti object, if it exists. If the object has been deleted,
258
- * the result is `null`. If the object is still being fetched, the result is `undefined`.
259
- */
260
- object: h.result,
261
- /**
262
- * A method to poll for new results.
263
- */
264
- poll: p,
265
- /**
266
- * A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)
267
- * that indicates if the *first* poll is currently running.
268
- * Useful to show a loading spinner or disable a button.
269
- *
270
- * This also tracks new polls when the arguments have changed,
271
- * but it does not track ongoing polls from either calling
272
- * {@link poll} or using the `autopoll` argument.
273
- */
274
- isInitialPolling: y
275
- };
163
+ function be(e) {
164
+ return e === void 0 ? "Loading..." : e === null ? "Not found" : e;
276
165
  }
277
- function Se(t, n, e = !1) {
278
- const r = M(), a = [() => P(t), () => P(n)], l = () => r.synchronizeRecoverOrphans(...E(a)), c = new oe(r), s = () => r.recoverOrphans(...E(a)), f = new re(s), { poll: h, isInitialPolling: u } = H(
279
- c,
280
- f,
281
- l,
282
- a,
283
- e
166
+ function Te(e) {
167
+ const n = ae(), { output: t } = me(
168
+ e,
169
+ n.actorToHandle.bind(n)
284
170
  );
285
- return {
286
- /**
287
- * A [ref](https://vuejs.org/api/reactivity-core.html#ref) that contains
288
- * an array of Graffiti objects.
289
- */
290
- objects: c.results,
291
- /**
292
- * A method to poll for new results.
293
- */
294
- poll: h,
295
- /**
296
- * A boolean [ref](https://vuejs.org/api/reactivity-core.html#ref)
297
- * that indicates if the *first* poll is currently running.
298
- * Useful to show a loading spinner or disable a button.
299
- *
300
- * This also tracks new polls when the arguments have changed,
301
- * but it does not track ongoing polls from either calling
302
- * {@link poll} or using the `autopoll` argument.
303
- */
304
- isInitialPolling: u
305
- };
171
+ return { handle: t };
306
172
  }
307
- const ae = /* @__PURE__ */ W({
173
+ const W = /* @__PURE__ */ _({
174
+ __name: "ActorToHandle",
175
+ props: {
176
+ actor: {}
177
+ },
178
+ setup(e) {
179
+ const t = S(e, "actor"), { handle: o } = Te(t);
180
+ return (i, r) => N(i.$slots, "default", { handle: v(o) }, () => [
181
+ p("span", null, O(v(be)(v(o))), 1)
182
+ ]);
183
+ }
184
+ }), $e = ["data-url"], ze = { key: 0 }, De = { key: 1 }, Ie = { key: 0 }, Me = { key: 1 }, _e = { key: 0 }, Re = ["disabled"], Le = { key: 1 }, qe = { key: 2 }, K = /* @__PURE__ */ _({
185
+ __name: "ObjectInfo",
186
+ props: {
187
+ object: {}
188
+ },
189
+ setup(e) {
190
+ const n = ae(), t = k(!1);
191
+ async function o(i, r) {
192
+ t.value = !0, await new Promise((s) => setTimeout(s, 0)), confirm(
193
+ "Are you sure you want to delete this object? It cannot be undone."
194
+ ) && await n.delete(i, r), t.value = !1;
195
+ }
196
+ return (i, r) => e.object ? (w(), b("article", {
197
+ key: 0,
198
+ "data-url": e.object.url
199
+ }, [
200
+ p("header", null, [
201
+ r[4] || (r[4] = p("h2", null, "Graffiti Object", -1)),
202
+ p("dl", null, [
203
+ r[1] || (r[1] = p("dt", null, "Object URL", -1)),
204
+ p("dd", null, [
205
+ p("code", null, O(e.object.url), 1)
206
+ ]),
207
+ r[2] || (r[2] = p("dt", null, "Actor", -1)),
208
+ p("dd", null, [
209
+ p("code", null, O(e.object.actor), 1)
210
+ ]),
211
+ r[3] || (r[3] = p("dt", null, "Handle", -1)),
212
+ p("dd", null, [
213
+ V(W, {
214
+ actor: e.object.actor
215
+ }, null, 8, ["actor"])
216
+ ])
217
+ ])
218
+ ]),
219
+ p("section", null, [
220
+ r[5] || (r[5] = p("h3", null, "Content", -1)),
221
+ p("pre", null, O(e.object.value), 1)
222
+ ]),
223
+ p("section", null, [
224
+ r[10] || (r[10] = p("h3", null, "Allowed Actors", -1)),
225
+ Array.isArray(e.object.allowed) ? e.object.allowed.length === 0 ? (w(), b("p", De, [...r[7] || (r[7] = [
226
+ p("em", null, "Noone", -1)
227
+ ])])) : de("", !0) : (w(), b("p", ze, [...r[6] || (r[6] = [
228
+ p("em", null, "Public", -1)
229
+ ])])),
230
+ p("ul", null, [
231
+ (w(!0), b(re, null, oe(e.object.allowed, (s) => (w(), b("li", { key: s }, [
232
+ p("dl", null, [
233
+ r[8] || (r[8] = p("dt", null, "Actor", -1)),
234
+ p("dd", null, [
235
+ p("code", null, O(s), 1)
236
+ ]),
237
+ r[9] || (r[9] = p("dt", null, "Handle", -1)),
238
+ p("dd", null, [
239
+ V(W, { actor: s }, null, 8, ["actor"])
240
+ ])
241
+ ])
242
+ ]))), 128))
243
+ ])
244
+ ]),
245
+ p("section", null, [
246
+ r[12] || (r[12] = p("h3", null, "Channels", -1)),
247
+ e.object.channels?.length ? (w(), b("ul", Ie, [
248
+ (w(!0), b(re, null, oe(e.object.channels, (s) => (w(), b("li", { key: s }, [
249
+ p("code", null, O(s), 1)
250
+ ]))), 128))
251
+ ])) : (w(), b("p", Me, [...r[11] || (r[11] = [
252
+ p("em", null, "No channels", -1)
253
+ ])]))
254
+ ]),
255
+ p("footer", null, [
256
+ p("nav", null, [
257
+ p("ul", null, [
258
+ i.$graffitiSession.value?.actor === e.object.actor ? (w(), b("li", _e, [
259
+ p("button", {
260
+ disabled: t.value,
261
+ onClick: r[0] || (r[0] = (s) => o(e.object, i.$graffitiSession.value))
262
+ }, O(t.value ? "Deleting..." : "Delete"), 9, Re)
263
+ ])) : de("", !0)
264
+ ])
265
+ ])
266
+ ])
267
+ ], 8, $e)) : e.object === null ? (w(), b("article", Le, [...r[13] || (r[13] = [
268
+ p("header", null, [
269
+ p("h2", null, "Graffiti Object")
270
+ ], -1),
271
+ p("p", null, [
272
+ p("em", null, "Object not found")
273
+ ], -1)
274
+ ])])) : (w(), b("article", qe, [...r[14] || (r[14] = [
275
+ p("header", null, [
276
+ p("h2", null, "Graffiti Object")
277
+ ], -1),
278
+ p("p", null, [
279
+ p("em", null, "Loading...")
280
+ ], -1)
281
+ ])]));
282
+ }
283
+ }), He = { key: 0 }, Ce = { key: 1 }, we = /* @__PURE__ */ _({
308
284
  __name: "Discover",
309
285
  props: {
310
286
  channels: {},
@@ -312,516 +288,658 @@ const ae = /* @__PURE__ */ W({
312
288
  session: {},
313
289
  autopoll: { type: Boolean }
314
290
  },
315
- setup(t) {
316
- const n = t, { objects: e, poll: r, isInitialPolling: o } = xe(
317
- b(n, "channels"),
318
- b(n, "schema"),
319
- b(n, "session"),
320
- b(n, "autopoll")
291
+ setup(e) {
292
+ const n = e, { objects: t, poll: o, isFirstPoll: i } = Ae(
293
+ S(n, "channels"),
294
+ S(n, "schema"),
295
+ S(n, "session"),
296
+ S(n, "autopoll")
321
297
  );
322
- return (i, a) => J(i.$slots, "default", {
323
- objects: g(e),
324
- poll: g(r),
325
- isInitialPolling: g(o)
326
- });
298
+ return (r, s) => N(r.$slots, "default", {
299
+ objects: v(t),
300
+ poll: v(o),
301
+ isFirstPoll: v(i)
302
+ }, () => [
303
+ v(i) ? (w(), b("p", Ce, [...s[0] || (s[0] = [
304
+ p("em", null, " Loading... ", -1)
305
+ ])])) : (w(), b("ul", He, [
306
+ (w(!0), b(re, null, oe(v(t), (a) => (w(), b("li", {
307
+ key: a.url
308
+ }, [
309
+ V(K, { object: a }, null, 8, ["object"])
310
+ ]))), 128))
311
+ ]))
312
+ ]);
327
313
  }
328
- }), ue = /* @__PURE__ */ W({
314
+ });
315
+ function Ne(e, n, t) {
316
+ const o = X(), i = k(void 0);
317
+ let r = async () => {
318
+ };
319
+ const s = async () => r();
320
+ let a;
321
+ return le(() => {
322
+ a?.return(null);
323
+ }), H(
324
+ () => [P(e), P(n), P(t)],
325
+ (c, u, f) => {
326
+ i.value = void 0;
327
+ const h = o.synchronizeGet(...c);
328
+ a = h;
329
+ let l = !0;
330
+ f(() => {
331
+ l = !1, h.return(null);
332
+ }), (async () => {
333
+ for await (const d of h) {
334
+ if (!l) return;
335
+ d.tombstone ? i.value = null : i.value = d.object;
336
+ }
337
+ })();
338
+ let y = !1;
339
+ r = async () => {
340
+ if (!(y || !l)) {
341
+ y = !0;
342
+ try {
343
+ await o.get(...c);
344
+ } catch (d) {
345
+ d instanceof D || console.error(d);
346
+ }
347
+ await new Promise((d) => setTimeout(d, 0)), y = !1;
348
+ }
349
+ }, s();
350
+ },
351
+ { immediate: !0 }
352
+ ), {
353
+ object: i,
354
+ poll: s
355
+ };
356
+ }
357
+ const ge = /* @__PURE__ */ _({
329
358
  __name: "Get",
330
359
  props: {
331
360
  url: {},
332
361
  schema: {},
333
- session: {},
334
- autopoll: { type: Boolean }
362
+ session: {}
335
363
  },
336
- setup(t) {
337
- const n = t, { object: e, poll: r, isInitialPolling: o } = Oe(
338
- b(n, "url"),
339
- b(n, "schema"),
340
- b(n, "session"),
341
- b(n, "autopoll")
364
+ setup(e) {
365
+ const n = e, { object: t, poll: o } = Ne(
366
+ S(n, "url"),
367
+ S(n, "schema"),
368
+ S(n, "session")
342
369
  );
343
- return (i, a) => J(i.$slots, "default", {
344
- object: g(e),
345
- poll: g(r),
346
- isInitialPolling: g(o)
347
- });
370
+ return (i, r) => N(i.$slots, "default", {
371
+ object: v(t),
372
+ poll: v(o)
373
+ }, () => [
374
+ V(K, { object: v(t) }, null, 8, ["object"])
375
+ ]);
348
376
  }
349
- }), ce = /* @__PURE__ */ W({
350
- __name: "RecoverOrphans",
377
+ });
378
+ function Ue(e, n, t) {
379
+ const o = X(), i = k(
380
+ void 0
381
+ ), r = k(0);
382
+ let s = null, a = () => {
383
+ };
384
+ function c() {
385
+ return s || (r.value++, s = new Promise((u) => {
386
+ a = () => {
387
+ s = null, u();
388
+ };
389
+ }), s);
390
+ }
391
+ return H(
392
+ () => ({
393
+ args: [P(e), P(n), P(t)],
394
+ pollCounter: r.value
395
+ }),
396
+ async ({ args: u }, f, h) => {
397
+ i.value?.dataUrl && URL.revokeObjectURL(i.value.dataUrl), i.value = void 0;
398
+ let l = !0;
399
+ h(() => {
400
+ l = !1;
401
+ });
402
+ try {
403
+ const { data: y, actor: d, allowed: m } = await o.getMedia(...u);
404
+ if (!l) return;
405
+ const j = URL.createObjectURL(y);
406
+ i.value = {
407
+ data: y,
408
+ dataUrl: j,
409
+ actor: d,
410
+ allowed: m
411
+ };
412
+ } catch (y) {
413
+ if (!l) return;
414
+ y instanceof D ? i.value = null : console.error(y);
415
+ } finally {
416
+ a();
417
+ }
418
+ },
419
+ { immediate: !0 }
420
+ ), le(() => {
421
+ a(), i.value?.dataUrl && URL.revokeObjectURL(i.value.dataUrl);
422
+ }), {
423
+ media: i,
424
+ poll: c
425
+ };
426
+ }
427
+ const Be = ["src", "alt"], Ve = ["src", "alt"], We = ["src", "alt"], Fe = ["src", "alt"], Je = ["data", "alt"], Qe = { key: 6 }, Xe = { key: 7 }, je = /* @__PURE__ */ _({
428
+ __name: "GetMedia",
351
429
  props: {
352
- schema: {},
353
- session: {},
354
- autopoll: { type: Boolean }
430
+ url: {},
431
+ accept: {},
432
+ session: {}
355
433
  },
356
- setup(t) {
357
- const n = t, { objects: e, poll: r, isInitialPolling: o } = Se(
358
- b(n, "schema"),
359
- b(n, "session"),
360
- b(n, "autopoll")
434
+ setup(e) {
435
+ const n = e, { media: t, poll: o } = Ue(
436
+ S(n, "url"),
437
+ S(n, "accept"),
438
+ S(n, "session")
361
439
  );
362
- return (i, a) => J(i.$slots, "default", {
363
- objects: g(e),
364
- poll: g(r),
365
- isInitialPolling: g(o)
366
- });
440
+ function i() {
441
+ t.value && (window.location.href = t.value.dataUrl);
442
+ }
443
+ return (r, s) => N(r.$slots, "default", {
444
+ media: v(t),
445
+ poll: v(o)
446
+ }, () => [
447
+ v(t)?.data.type.startsWith("image/") ? (w(), b("img", {
448
+ key: 0,
449
+ src: v(t).dataUrl,
450
+ alt: `An image by ${v(t).actor}`
451
+ }, null, 8, Be)) : v(t)?.data.type.startsWith("video/") ? (w(), b("video", {
452
+ key: 1,
453
+ controls: "",
454
+ src: v(t).dataUrl,
455
+ alt: `A video by ${v(t).actor}`
456
+ }, null, 8, Ve)) : v(t)?.data.type.startsWith("audio/") ? (w(), b("audio", {
457
+ key: 2,
458
+ controls: "",
459
+ src: v(t).dataUrl,
460
+ alt: `Audio by ${v(t).actor}`
461
+ }, null, 8, We)) : v(t)?.data.type === "text/html" ? (w(), b("iframe", {
462
+ key: 3,
463
+ src: v(t).dataUrl,
464
+ alt: `HTML by ${v(t).actor}`,
465
+ sandbox: ""
466
+ }, null, 8, Fe)) : v(t)?.data.type.startsWith("application/pdf") ? (w(), b("object", {
467
+ key: 4,
468
+ data: v(t).dataUrl,
469
+ type: "application/pdf",
470
+ alt: `PDF by ${v(t).actor}`
471
+ }, null, 8, Je)) : v(t) ? (w(), b("button", {
472
+ key: 5,
473
+ onClick: i
474
+ }, "Download")) : v(t) === null ? (w(), b("p", Qe, [...s[0] || (s[0] = [
475
+ p("em", null, "Media not found", -1)
476
+ ])])) : (w(), b("p", Xe, [...s[1] || (s[1] = [
477
+ p("em", null, " Loading... ", -1)
478
+ ])]))
479
+ ]);
367
480
  }
368
481
  });
369
- /*! *****************************************************************************
370
- Copyright (c) Microsoft Corporation.
371
-
372
- Permission to use, copy, modify, and/or distribute this software for any
373
- purpose with or without fee is hereby granted.
374
-
375
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
376
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
377
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
378
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
379
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
380
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
381
- PERFORMANCE OF THIS SOFTWARE.
382
- ***************************************************************************** */
383
- var $ = function(t, n) {
384
- return $ = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(e, r) {
385
- e.__proto__ = r;
386
- } || function(e, r) {
387
- for (var o in r) r.hasOwnProperty(o) && (e[o] = r[o]);
388
- }, $(t, n);
482
+ function Ke(e) {
483
+ const n = ae(), { output: t } = me(
484
+ e,
485
+ n.handleToActor.bind(n)
486
+ );
487
+ return { actor: t };
488
+ }
489
+ const xe = /* @__PURE__ */ _({
490
+ __name: "HandleToActor",
491
+ props: {
492
+ handle: {}
493
+ },
494
+ setup(e) {
495
+ const t = S(e, "handle"), { actor: o } = Ke(t);
496
+ return (i, r) => N(i.$slots, "default", { actor: v(o) }, () => [
497
+ p("span", null, O(v(be)(v(o))), 1)
498
+ ]);
499
+ }
500
+ });
501
+ var ie = function(e, n) {
502
+ return ie = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(t, o) {
503
+ t.__proto__ = o;
504
+ } || function(t, o) {
505
+ for (var i in o) o.hasOwnProperty(i) && (t[i] = o[i]);
506
+ }, ie(e, n);
389
507
  };
390
- function Ee(t, n) {
391
- $(t, n);
392
- function e() {
393
- this.constructor = t;
508
+ function Ye(e, n) {
509
+ ie(e, n);
510
+ function t() {
511
+ this.constructor = e;
394
512
  }
395
- t.prototype = n === null ? Object.create(n) : (e.prototype = n.prototype, new e());
513
+ e.prototype = n === null ? Object.create(n) : (t.prototype = n.prototype, new t());
396
514
  }
397
- function G(t, n, e, r) {
398
- function o(i) {
399
- return i instanceof e ? i : new e(function(a) {
400
- a(i);
515
+ function M(e, n, t, o) {
516
+ function i(r) {
517
+ return r instanceof t ? r : new t(function(s) {
518
+ s(r);
401
519
  });
402
520
  }
403
- return new (e || (e = Promise))(function(i, a) {
404
- function l(f) {
521
+ return new (t || (t = Promise))(function(r, s) {
522
+ function a(f) {
405
523
  try {
406
- s(r.next(f));
524
+ u(o.next(f));
407
525
  } catch (h) {
408
- a(h);
526
+ s(h);
409
527
  }
410
528
  }
411
529
  function c(f) {
412
530
  try {
413
- s(r.throw(f));
531
+ u(o.throw(f));
414
532
  } catch (h) {
415
- a(h);
533
+ s(h);
416
534
  }
417
535
  }
418
- function s(f) {
419
- f.done ? i(f.value) : o(f.value).then(l, c);
536
+ function u(f) {
537
+ f.done ? r(f.value) : i(f.value).then(a, c);
420
538
  }
421
- s((r = r.apply(t, [])).next());
539
+ u((o = o.apply(e, [])).next());
422
540
  });
423
541
  }
424
- function j(t, n) {
425
- var e = { label: 0, sent: function() {
426
- if (i[0] & 1) throw i[1];
427
- return i[1];
428
- }, trys: [], ops: [] }, r, o, i, a;
429
- return a = { next: l(0), throw: l(1), return: l(2) }, typeof Symbol == "function" && (a[Symbol.iterator] = function() {
542
+ function A(e, n) {
543
+ var t = { label: 0, sent: function() {
544
+ if (r[0] & 1) throw r[1];
545
+ return r[1];
546
+ }, trys: [], ops: [] }, o, i, r, s;
547
+ return s = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (s[Symbol.iterator] = function() {
430
548
  return this;
431
- }), a;
432
- function l(s) {
549
+ }), s;
550
+ function a(u) {
433
551
  return function(f) {
434
- return c([s, f]);
552
+ return c([u, f]);
435
553
  };
436
554
  }
437
- function c(s) {
438
- if (r) throw new TypeError("Generator is already executing.");
439
- for (; e; ) try {
440
- if (r = 1, o && (i = s[0] & 2 ? o.return : s[0] ? o.throw || ((i = o.return) && i.call(o), 0) : o.next) && !(i = i.call(o, s[1])).done) return i;
441
- switch (o = 0, i && (s = [s[0] & 2, i.value]), s[0]) {
555
+ function c(u) {
556
+ if (o) throw new TypeError("Generator is already executing.");
557
+ for (; t; ) try {
558
+ if (o = 1, i && (r = u[0] & 2 ? i.return : u[0] ? i.throw || ((r = i.return) && r.call(i), 0) : i.next) && !(r = r.call(i, u[1])).done) return r;
559
+ switch (i = 0, r && (u = [u[0] & 2, r.value]), u[0]) {
442
560
  case 0:
443
561
  case 1:
444
- i = s;
562
+ r = u;
445
563
  break;
446
564
  case 4:
447
- return e.label++, { value: s[1], done: !1 };
565
+ return t.label++, { value: u[1], done: !1 };
448
566
  case 5:
449
- e.label++, o = s[1], s = [0];
567
+ t.label++, i = u[1], u = [0];
450
568
  continue;
451
569
  case 7:
452
- s = e.ops.pop(), e.trys.pop();
570
+ u = t.ops.pop(), t.trys.pop();
453
571
  continue;
454
572
  default:
455
- if (i = e.trys, !(i = i.length > 0 && i[i.length - 1]) && (s[0] === 6 || s[0] === 2)) {
456
- e = 0;
573
+ if (r = t.trys, !(r = r.length > 0 && r[r.length - 1]) && (u[0] === 6 || u[0] === 2)) {
574
+ t = 0;
457
575
  continue;
458
576
  }
459
- if (s[0] === 3 && (!i || s[1] > i[0] && s[1] < i[3])) {
460
- e.label = s[1];
577
+ if (u[0] === 3 && (!r || u[1] > r[0] && u[1] < r[3])) {
578
+ t.label = u[1];
461
579
  break;
462
580
  }
463
- if (s[0] === 6 && e.label < i[1]) {
464
- e.label = i[1], i = s;
581
+ if (u[0] === 6 && t.label < r[1]) {
582
+ t.label = r[1], r = u;
465
583
  break;
466
584
  }
467
- if (i && e.label < i[2]) {
468
- e.label = i[2], e.ops.push(s);
585
+ if (r && t.label < r[2]) {
586
+ t.label = r[2], t.ops.push(u);
469
587
  break;
470
588
  }
471
- i[2] && e.ops.pop(), e.trys.pop();
589
+ r[2] && t.ops.pop(), t.trys.pop();
472
590
  continue;
473
591
  }
474
- s = n.call(t, e);
592
+ u = n.call(e, t);
475
593
  } catch (f) {
476
- s = [6, f], o = 0;
594
+ u = [6, f], i = 0;
477
595
  } finally {
478
- r = i = 0;
596
+ o = r = 0;
479
597
  }
480
- if (s[0] & 5) throw s[1];
481
- return { value: s[0] ? s[1] : void 0, done: !0 };
598
+ if (u[0] & 5) throw u[1];
599
+ return { value: u[0] ? u[1] : void 0, done: !0 };
482
600
  }
483
601
  }
484
- function _(t) {
485
- var n = typeof Symbol == "function" && Symbol.iterator, e = n && t[n], r = 0;
486
- if (e) return e.call(t);
487
- if (t && typeof t.length == "number") return {
602
+ function R(e) {
603
+ var n = typeof Symbol == "function" && Symbol.iterator, t = n && e[n], o = 0;
604
+ if (t) return t.call(e);
605
+ if (e && typeof e.length == "number") return {
488
606
  next: function() {
489
- return t && r >= t.length && (t = void 0), { value: t && t[r++], done: !t };
607
+ return e && o >= e.length && (e = void 0), { value: e && e[o++], done: !e };
490
608
  }
491
609
  };
492
610
  throw new TypeError(n ? "Object is not iterable." : "Symbol.iterator is not defined.");
493
611
  }
494
- function R(t) {
495
- return this instanceof R ? (this.v = t, this) : new R(t);
612
+ function C(e) {
613
+ return this instanceof C ? (this.v = e, this) : new C(e);
496
614
  }
497
- function Ge(t, n, e) {
615
+ function Ze(e, n, t) {
498
616
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
499
- var r = e.apply(t, n || []), o, i = [];
500
- return o = {}, a("next"), a("throw"), a("return"), o[Symbol.asyncIterator] = function() {
617
+ var o = t.apply(e, n || []), i, r = [];
618
+ return i = {}, s("next"), s("throw"), s("return"), i[Symbol.asyncIterator] = function() {
501
619
  return this;
502
- }, o;
503
- function a(u) {
504
- r[u] && (o[u] = function(d) {
505
- return new Promise(function(p, y) {
506
- i.push([u, d, p, y]) > 1 || l(u, d);
620
+ }, i;
621
+ function s(l) {
622
+ o[l] && (i[l] = function(y) {
623
+ return new Promise(function(d, m) {
624
+ r.push([l, y, d, m]) > 1 || a(l, y);
507
625
  });
508
626
  });
509
627
  }
510
- function l(u, d) {
628
+ function a(l, y) {
511
629
  try {
512
- c(r[u](d));
513
- } catch (p) {
514
- h(i[0][3], p);
630
+ c(o[l](y));
631
+ } catch (d) {
632
+ h(r[0][3], d);
515
633
  }
516
634
  }
517
- function c(u) {
518
- u.value instanceof R ? Promise.resolve(u.value.v).then(s, f) : h(i[0][2], u);
635
+ function c(l) {
636
+ l.value instanceof C ? Promise.resolve(l.value.v).then(u, f) : h(r[0][2], l);
519
637
  }
520
- function s(u) {
521
- l("next", u);
638
+ function u(l) {
639
+ a("next", l);
522
640
  }
523
- function f(u) {
524
- l("throw", u);
641
+ function f(l) {
642
+ a("throw", l);
525
643
  }
526
- function h(u, d) {
527
- u(d), i.shift(), i.length && l(i[0][0], i[0][1]);
644
+ function h(l, y) {
645
+ l(y), r.shift(), r.length && a(r[0][0], r[0][1]);
528
646
  }
529
647
  }
530
- var le = (
648
+ var Pe = (
531
649
  /** @class */
532
- function(t) {
533
- Ee(n, t);
534
- function n(e) {
535
- var r = t.call(this, e) || this;
536
- return Object.defineProperty(r, "name", {
650
+ (function(e) {
651
+ Ye(n, e);
652
+ function n(t) {
653
+ var o = e.call(this, t) || this;
654
+ return Object.defineProperty(o, "name", {
537
655
  value: "RepeaterOverflowError",
538
656
  enumerable: !1
539
- }), typeof Object.setPrototypeOf == "function" ? Object.setPrototypeOf(r, r.constructor.prototype) : r.__proto__ = r.constructor.prototype, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(r, r.constructor), r;
657
+ }), typeof Object.setPrototypeOf == "function" ? Object.setPrototypeOf(o, o.constructor.prototype) : o.__proto__ = o.constructor.prototype, typeof Error.captureStackTrace == "function" && Error.captureStackTrace(o, o.constructor), o;
540
658
  }
541
659
  return n;
542
- }(Error)
660
+ })(Error)
543
661
  );
544
662
  (function() {
545
- function t(n) {
663
+ function e(n) {
546
664
  if (n < 0)
547
665
  throw new RangeError("Capacity may not be less than 0");
548
666
  this._c = n, this._q = [];
549
667
  }
550
- return Object.defineProperty(t.prototype, "empty", {
668
+ return Object.defineProperty(e.prototype, "empty", {
551
669
  get: function() {
552
670
  return this._q.length === 0;
553
671
  },
554
672
  enumerable: !1,
555
673
  configurable: !0
556
- }), Object.defineProperty(t.prototype, "full", {
674
+ }), Object.defineProperty(e.prototype, "full", {
557
675
  get: function() {
558
676
  return this._q.length >= this._c;
559
677
  },
560
678
  enumerable: !1,
561
679
  configurable: !0
562
- }), t.prototype.add = function(n) {
680
+ }), e.prototype.add = function(n) {
563
681
  if (this.full)
564
682
  throw new Error("Buffer full");
565
683
  this._q.push(n);
566
- }, t.prototype.remove = function() {
684
+ }, e.prototype.remove = function() {
567
685
  if (this.empty)
568
686
  throw new Error("Buffer empty");
569
687
  return this._q.shift();
570
- }, t;
688
+ }, e;
571
689
  })();
572
690
  (function() {
573
- function t(n) {
691
+ function e(n) {
574
692
  if (n < 1)
575
693
  throw new RangeError("Capacity may not be less than 1");
576
694
  this._c = n, this._q = [];
577
695
  }
578
- return Object.defineProperty(t.prototype, "empty", {
696
+ return Object.defineProperty(e.prototype, "empty", {
579
697
  get: function() {
580
698
  return this._q.length === 0;
581
699
  },
582
700
  enumerable: !1,
583
701
  configurable: !0
584
- }), Object.defineProperty(t.prototype, "full", {
702
+ }), Object.defineProperty(e.prototype, "full", {
585
703
  get: function() {
586
704
  return !1;
587
705
  },
588
706
  enumerable: !1,
589
707
  configurable: !0
590
- }), t.prototype.add = function(n) {
708
+ }), e.prototype.add = function(n) {
591
709
  for (; this._q.length >= this._c; )
592
710
  this._q.shift();
593
711
  this._q.push(n);
594
- }, t.prototype.remove = function() {
712
+ }, e.prototype.remove = function() {
595
713
  if (this.empty)
596
714
  throw new Error("Buffer empty");
597
715
  return this._q.shift();
598
- }, t;
716
+ }, e;
599
717
  })();
600
718
  (function() {
601
- function t(n) {
719
+ function e(n) {
602
720
  if (n < 1)
603
721
  throw new RangeError("Capacity may not be less than 1");
604
722
  this._c = n, this._q = [];
605
723
  }
606
- return Object.defineProperty(t.prototype, "empty", {
724
+ return Object.defineProperty(e.prototype, "empty", {
607
725
  get: function() {
608
726
  return this._q.length === 0;
609
727
  },
610
728
  enumerable: !1,
611
729
  configurable: !0
612
- }), Object.defineProperty(t.prototype, "full", {
730
+ }), Object.defineProperty(e.prototype, "full", {
613
731
  get: function() {
614
732
  return !1;
615
733
  },
616
734
  enumerable: !1,
617
735
  configurable: !0
618
- }), t.prototype.add = function(n) {
736
+ }), e.prototype.add = function(n) {
619
737
  this._q.length < this._c && this._q.push(n);
620
- }, t.prototype.remove = function() {
738
+ }, e.prototype.remove = function() {
621
739
  if (this.empty)
622
740
  throw new Error("Buffer empty");
623
741
  return this._q.shift();
624
- }, t;
742
+ }, e;
625
743
  })();
626
- function U(t) {
627
- t != null && typeof t.then == "function" && t.then(N, N);
744
+ function se(e) {
745
+ e != null && typeof e.then == "function" && e.then(Q, Q);
628
746
  }
629
- var C = 0, X = 1, O = 2, D = 3, L = 4, A = 1024, N = function() {
747
+ var ne = 0, he = 1, $ = 2, F = 3, ue = 4, J = 1024, Q = function() {
630
748
  };
631
- function S(t) {
632
- var n = t.err, e = Promise.resolve(t.execution).then(function(r) {
749
+ function z(e) {
750
+ var n = e.err, t = Promise.resolve(e.execution).then(function(o) {
633
751
  if (n != null)
634
752
  throw n;
635
- return r;
753
+ return o;
636
754
  });
637
- return t.err = void 0, t.execution = e.then(function() {
755
+ return e.err = void 0, e.execution = t.then(function() {
638
756
  }, function() {
639
- }), t.pending === void 0 ? e : t.pending.then(function() {
640
- return e;
757
+ }), e.pending === void 0 ? t : e.pending.then(function() {
758
+ return t;
641
759
  });
642
760
  }
643
- function x(t, n) {
644
- var e = t.state >= D;
645
- return Promise.resolve(n).then(function(r) {
646
- return !e && t.state >= L ? S(t).then(function(o) {
761
+ function T(e, n) {
762
+ var t = e.state >= F;
763
+ return Promise.resolve(n).then(function(o) {
764
+ return !t && e.state >= ue ? z(e).then(function(i) {
647
765
  return {
648
- value: o,
766
+ value: i,
649
767
  done: !0
650
768
  };
651
- }) : { value: r, done: e };
769
+ }) : { value: o, done: t };
652
770
  });
653
771
  }
654
- function Q(t, n) {
655
- var e, r;
656
- if (!(t.state >= O))
657
- if (t.state = O, t.onnext(), t.onstop(), t.err == null && (t.err = n), t.pushes.length === 0 && (typeof t.buffer > "u" || t.buffer.empty))
658
- z(t);
772
+ function ce(e, n) {
773
+ var t, o;
774
+ if (!(e.state >= $))
775
+ if (e.state = $, e.onnext(), e.onstop(), e.err == null && (e.err = n), e.pushes.length === 0 && (typeof e.buffer > "u" || e.buffer.empty))
776
+ q(e);
659
777
  else
660
778
  try {
661
- for (var o = _(t.pushes), i = o.next(); !i.done; i = o.next()) {
662
- var a = i.value;
663
- a.resolve();
779
+ for (var i = R(e.pushes), r = i.next(); !r.done; r = i.next()) {
780
+ var s = r.value;
781
+ s.resolve();
664
782
  }
665
- } catch (l) {
666
- e = { error: l };
783
+ } catch (a) {
784
+ t = { error: a };
667
785
  } finally {
668
786
  try {
669
- i && !i.done && (r = o.return) && r.call(o);
787
+ r && !r.done && (o = i.return) && o.call(i);
670
788
  } finally {
671
- if (e) throw e.error;
789
+ if (t) throw t.error;
672
790
  }
673
791
  }
674
792
  }
675
- function z(t) {
676
- var n, e;
677
- if (!(t.state >= D)) {
678
- t.state < O && Q(t), t.state = D, t.buffer = void 0;
793
+ function q(e) {
794
+ var n, t;
795
+ if (!(e.state >= F)) {
796
+ e.state < $ && ce(e), e.state = F, e.buffer = void 0;
679
797
  try {
680
- for (var r = _(t.nexts), o = r.next(); !o.done; o = r.next()) {
681
- var i = o.value, a = t.pending === void 0 ? S(t) : t.pending.then(function() {
682
- return S(t);
798
+ for (var o = R(e.nexts), i = o.next(); !i.done; i = o.next()) {
799
+ var r = i.value, s = e.pending === void 0 ? z(e) : e.pending.then(function() {
800
+ return z(e);
683
801
  });
684
- i.resolve(x(t, a));
802
+ r.resolve(T(e, s));
685
803
  }
686
- } catch (l) {
687
- n = { error: l };
804
+ } catch (a) {
805
+ n = { error: a };
688
806
  } finally {
689
807
  try {
690
- o && !o.done && (e = r.return) && e.call(r);
808
+ i && !i.done && (t = o.return) && t.call(o);
691
809
  } finally {
692
810
  if (n) throw n.error;
693
811
  }
694
812
  }
695
- t.pushes = [], t.nexts = [];
813
+ e.pushes = [], e.nexts = [];
696
814
  }
697
815
  }
698
- function K(t) {
699
- t.state >= L || (t.state < D && z(t), t.state = L);
816
+ function ye(e) {
817
+ e.state >= ue || (e.state < F && q(e), e.state = ue);
700
818
  }
701
- function _e(t, n) {
702
- if (U(n), t.pushes.length >= A)
703
- throw new le("No more than " + A + " pending calls to push are allowed on a single repeater.");
704
- if (t.state >= O)
819
+ function et(e, n) {
820
+ if (se(n), e.pushes.length >= J)
821
+ throw new Pe("No more than " + J + " pending calls to push are allowed on a single repeater.");
822
+ if (e.state >= $)
705
823
  return Promise.resolve(void 0);
706
- var e = t.pending === void 0 ? Promise.resolve(n) : t.pending.then(function() {
824
+ var t = e.pending === void 0 ? Promise.resolve(n) : e.pending.then(function() {
707
825
  return n;
708
826
  });
709
- e = e.catch(function(c) {
710
- t.state < O && (t.err = c), K(t);
827
+ t = t.catch(function(c) {
828
+ e.state < $ && (e.err = c), ye(e);
711
829
  });
712
- var r;
713
- if (t.nexts.length) {
714
- var o = t.nexts.shift();
715
- o.resolve(x(t, e)), t.nexts.length ? r = Promise.resolve(t.nexts[0].value) : typeof t.buffer < "u" && !t.buffer.full ? r = Promise.resolve(void 0) : r = new Promise(function(c) {
716
- return t.onnext = c;
830
+ var o;
831
+ if (e.nexts.length) {
832
+ var i = e.nexts.shift();
833
+ i.resolve(T(e, t)), e.nexts.length ? o = Promise.resolve(e.nexts[0].value) : typeof e.buffer < "u" && !e.buffer.full ? o = Promise.resolve(void 0) : o = new Promise(function(c) {
834
+ return e.onnext = c;
717
835
  });
718
- } else typeof t.buffer < "u" && !t.buffer.full ? (t.buffer.add(e), r = Promise.resolve(void 0)) : r = new Promise(function(c) {
719
- return t.pushes.push({ resolve: c, value: e });
836
+ } else typeof e.buffer < "u" && !e.buffer.full ? (e.buffer.add(t), o = Promise.resolve(void 0)) : o = new Promise(function(c) {
837
+ return e.pushes.push({ resolve: c, value: t });
720
838
  });
721
- var i = !0, a = {}, l = r.catch(function(c) {
722
- if (i)
839
+ var r = !0, s = {}, a = o.catch(function(c) {
840
+ if (r)
723
841
  throw c;
724
842
  });
725
- return a.then = function(c, s) {
726
- return i = !1, Promise.prototype.then.call(r, c, s);
727
- }, a.catch = function(c) {
728
- return i = !1, Promise.prototype.catch.call(r, c);
729
- }, a.finally = r.finally.bind(r), t.pending = e.then(function() {
730
- return l;
843
+ return s.then = function(c, u) {
844
+ return r = !1, Promise.prototype.then.call(o, c, u);
845
+ }, s.catch = function(c) {
846
+ return r = !1, Promise.prototype.catch.call(o, c);
847
+ }, s.finally = o.finally.bind(o), e.pending = t.then(function() {
848
+ return a;
731
849
  }).catch(function(c) {
732
- t.err = c, K(t);
733
- }), a;
850
+ e.err = c, ye(e);
851
+ }), s;
734
852
  }
735
- function ze(t) {
736
- var n = Q.bind(null, t), e = new Promise(function(r) {
737
- return t.onstop = r;
853
+ function tt(e) {
854
+ var n = ce.bind(null, e), t = new Promise(function(o) {
855
+ return e.onstop = o;
738
856
  });
739
- return n.then = e.then.bind(e), n.catch = e.catch.bind(e), n.finally = e.finally.bind(e), n;
857
+ return n.then = t.then.bind(t), n.catch = t.catch.bind(t), n.finally = t.finally.bind(t), n;
740
858
  }
741
- function Re(t) {
742
- if (!(t.state >= X)) {
743
- t.state = X;
744
- var n = _e.bind(null, t), e = ze(t);
745
- t.execution = new Promise(function(r) {
746
- return r(t.executor(n, e));
747
- }), t.execution.catch(function() {
748
- return Q(t);
859
+ function nt(e) {
860
+ if (!(e.state >= he)) {
861
+ e.state = he;
862
+ var n = et.bind(null, e), t = tt(e);
863
+ e.execution = new Promise(function(o) {
864
+ return o(e.executor(n, t));
865
+ }), e.execution.catch(function() {
866
+ return ce(e);
749
867
  });
750
868
  }
751
869
  }
752
- var F = /* @__PURE__ */ new WeakMap(), k = (
870
+ var B = /* @__PURE__ */ new WeakMap(), U = (
753
871
  /** @class */
754
- function() {
755
- function t(n, e) {
756
- F.set(this, {
872
+ (function() {
873
+ function e(n, t) {
874
+ B.set(this, {
757
875
  executor: n,
758
- buffer: e,
876
+ buffer: t,
759
877
  err: void 0,
760
- state: C,
878
+ state: ne,
761
879
  pushes: [],
762
880
  nexts: [],
763
881
  pending: void 0,
764
882
  execution: void 0,
765
- onnext: N,
766
- onstop: N
883
+ onnext: Q,
884
+ onstop: Q
767
885
  });
768
886
  }
769
- return t.prototype.next = function(n) {
770
- U(n);
771
- var e = F.get(this);
772
- if (e === void 0)
887
+ return e.prototype.next = function(n) {
888
+ se(n);
889
+ var t = B.get(this);
890
+ if (t === void 0)
773
891
  throw new Error("WeakMap error");
774
- if (e.nexts.length >= A)
775
- throw new le("No more than " + A + " pending calls to next are allowed on a single repeater.");
776
- if (e.state <= C && Re(e), e.onnext(n), typeof e.buffer < "u" && !e.buffer.empty) {
777
- var r = x(e, e.buffer.remove());
778
- if (e.pushes.length) {
779
- var o = e.pushes.shift();
780
- e.buffer.add(o.value), e.onnext = o.resolve;
892
+ if (t.nexts.length >= J)
893
+ throw new Pe("No more than " + J + " pending calls to next are allowed on a single repeater.");
894
+ if (t.state <= ne && nt(t), t.onnext(n), typeof t.buffer < "u" && !t.buffer.empty) {
895
+ var o = T(t, t.buffer.remove());
896
+ if (t.pushes.length) {
897
+ var i = t.pushes.shift();
898
+ t.buffer.add(i.value), t.onnext = i.resolve;
781
899
  }
782
- return r;
783
- } else if (e.pushes.length) {
784
- var i = e.pushes.shift();
785
- return e.onnext = i.resolve, x(e, i.value);
786
- } else if (e.state >= O)
787
- return z(e), x(e, S(e));
788
- return new Promise(function(a) {
789
- return e.nexts.push({ resolve: a, value: n });
900
+ return o;
901
+ } else if (t.pushes.length) {
902
+ var r = t.pushes.shift();
903
+ return t.onnext = r.resolve, T(t, r.value);
904
+ } else if (t.state >= $)
905
+ return q(t), T(t, z(t));
906
+ return new Promise(function(s) {
907
+ return t.nexts.push({ resolve: s, value: n });
790
908
  });
791
- }, t.prototype.return = function(n) {
792
- U(n);
793
- var e = F.get(this);
794
- if (e === void 0)
909
+ }, e.prototype.return = function(n) {
910
+ se(n);
911
+ var t = B.get(this);
912
+ if (t === void 0)
795
913
  throw new Error("WeakMap error");
796
- return z(e), e.execution = Promise.resolve(e.execution).then(function() {
914
+ return q(t), t.execution = Promise.resolve(t.execution).then(function() {
797
915
  return n;
798
- }), x(e, S(e));
799
- }, t.prototype.throw = function(n) {
800
- var e = F.get(this);
801
- if (e === void 0)
916
+ }), T(t, z(t));
917
+ }, e.prototype.throw = function(n) {
918
+ var t = B.get(this);
919
+ if (t === void 0)
802
920
  throw new Error("WeakMap error");
803
- return e.state <= C || e.state >= O || typeof e.buffer < "u" && !e.buffer.empty ? (z(e), e.err == null && (e.err = n), x(e, S(e))) : this.next(Promise.reject(n));
804
- }, t.prototype[Symbol.asyncIterator] = function() {
921
+ return t.state <= ne || t.state >= $ || typeof t.buffer < "u" && !t.buffer.empty ? (q(t), t.err == null && (t.err = n), T(t, z(t))) : this.next(Promise.reject(n));
922
+ }, e.prototype[Symbol.asyncIterator] = function() {
805
923
  return this;
806
- }, t.race = ke, t.merge = Ie, t.zip = Te, t.latest = Fe, t;
807
- }()
924
+ }, e.race = rt, e.merge = ot, e.zip = it, e.latest = st, e;
925
+ })()
808
926
  );
809
- function V(t, n) {
810
- var e, r, o = [], i = function(s) {
811
- s != null && typeof s[Symbol.asyncIterator] == "function" ? o.push(s[Symbol.asyncIterator]()) : s != null && typeof s[Symbol.iterator] == "function" ? o.push(s[Symbol.iterator]()) : o.push(function() {
812
- return Ge(this, arguments, function() {
813
- return j(this, function(u) {
814
- switch (u.label) {
927
+ function Y(e, n) {
928
+ var t, o, i = [], r = function(u) {
929
+ u != null && typeof u[Symbol.asyncIterator] == "function" ? i.push(u[Symbol.asyncIterator]()) : u != null && typeof u[Symbol.iterator] == "function" ? i.push(u[Symbol.iterator]()) : i.push((function() {
930
+ return Ze(this, arguments, function() {
931
+ return A(this, function(l) {
932
+ switch (l.label) {
815
933
  case 0:
816
- return n.yieldValues ? [4, R(s)] : [3, 3];
934
+ return n.yieldValues ? [4, C(u)] : [3, 3];
817
935
  case 1:
818
- return [4, u.sent()];
936
+ return [4, l.sent()];
819
937
  case 2:
820
- u.sent(), u.label = 3;
938
+ l.sent(), l.label = 3;
821
939
  case 3:
822
- return n.returnValues ? [4, R(s)] : [3, 5];
940
+ return n.returnValues ? [4, C(u)] : [3, 5];
823
941
  case 4:
824
- return [2, u.sent()];
942
+ return [2, l.sent()];
825
943
  case 5:
826
944
  return [
827
945
  2
@@ -830,70 +948,70 @@ function V(t, n) {
830
948
  }
831
949
  });
832
950
  });
833
- }());
951
+ })());
834
952
  };
835
953
  try {
836
- for (var a = _(t), l = a.next(); !l.done; l = a.next()) {
837
- var c = l.value;
838
- i(c);
954
+ for (var s = R(e), a = s.next(); !a.done; a = s.next()) {
955
+ var c = a.value;
956
+ r(c);
839
957
  }
840
- } catch (s) {
841
- e = { error: s };
958
+ } catch (u) {
959
+ t = { error: u };
842
960
  } finally {
843
961
  try {
844
- l && !l.done && (r = a.return) && r.call(a);
962
+ a && !a.done && (o = s.return) && o.call(s);
845
963
  } finally {
846
- if (e) throw e.error;
964
+ if (t) throw t.error;
847
965
  }
848
966
  }
849
- return o;
967
+ return i;
850
968
  }
851
- function ke(t) {
852
- var n = this, e = V(t, { returnValues: !0 });
853
- return new k(function(r, o) {
854
- return G(n, void 0, void 0, function() {
855
- var i, a, l, c, s, f;
856
- return j(this, function(h) {
969
+ function rt(e) {
970
+ var n = this, t = Y(e, { returnValues: !0 });
971
+ return new U(function(o, i) {
972
+ return M(n, void 0, void 0, function() {
973
+ var r, s, a, c, u, f;
974
+ return A(this, function(h) {
857
975
  switch (h.label) {
858
976
  case 0:
859
- if (!e.length)
860
- return o(), [
977
+ if (!t.length)
978
+ return i(), [
861
979
  2
862
980
  /*return*/
863
981
  ];
864
- a = !1, o.then(function() {
865
- i(), a = !0;
982
+ s = !1, i.then(function() {
983
+ r(), s = !0;
866
984
  }), h.label = 1;
867
985
  case 1:
868
- h.trys.push([1, , 5, 7]), c = void 0, s = 0, f = function() {
869
- var u, d, p, y, m, I;
870
- return j(this, function(T) {
871
- switch (T.label) {
986
+ h.trys.push([1, , 5, 7]), c = void 0, u = 0, f = function() {
987
+ var l, y, d, m, j, E;
988
+ return A(this, function(G) {
989
+ switch (G.label) {
872
990
  case 0:
873
- u = s;
991
+ l = u;
874
992
  try {
875
- for (d = (m = void 0, _(e)), p = d.next(); !p.done; p = d.next())
876
- y = p.value, Promise.resolve(y.next()).then(function(w) {
877
- w.done ? (o(), l === void 0 && (l = w)) : s === u && (s++, i(w));
878
- }, function(w) {
879
- return o(w);
993
+ for (y = (j = void 0, R(t)), d = y.next(); !d.done; d = y.next())
994
+ m = d.value, Promise.resolve(m.next()).then(function(g) {
995
+ g.done ? (i(), a === void 0 && (a = g)) : u === l && (u++, r(g));
996
+ }, function(g) {
997
+ return i(g);
880
998
  });
881
- } catch (w) {
882
- m = { error: w };
999
+ } catch (g) {
1000
+ j = { error: g };
883
1001
  } finally {
884
1002
  try {
885
- p && !p.done && (I = d.return) && I.call(d);
1003
+ d && !d.done && (E = y.return) && E.call(y);
886
1004
  } finally {
887
- if (m) throw m.error;
1005
+ if (j) throw j.error;
888
1006
  }
889
1007
  }
890
- return [4, new Promise(function(w) {
891
- return i = w;
1008
+ return [4, new Promise(function(g) {
1009
+ return r = g;
892
1010
  })];
893
1011
  case 1:
894
- return c = T.sent(), c === void 0 ? [3, 3] : [4, r(c.value)];
1012
+ return c = G.sent(), c === void 0 ? [3, 3] : [4, o(c.value)];
895
1013
  case 2:
896
- T.sent(), T.label = 3;
1014
+ G.sent(), G.label = 3;
897
1015
  case 3:
898
1016
  return [
899
1017
  2
@@ -903,14 +1021,14 @@ function ke(t) {
903
1021
  });
904
1022
  }, h.label = 2;
905
1023
  case 2:
906
- return a ? [3, 4] : [5, f()];
1024
+ return s ? [3, 4] : [5, f()];
907
1025
  case 3:
908
1026
  return h.sent(), [3, 2];
909
1027
  case 4:
910
- return [2, l && l.value];
1028
+ return [2, a && a.value];
911
1029
  case 5:
912
- return o(), [4, Promise.race(e.map(function(u) {
913
- return u.return && u.return();
1030
+ return i(), [4, Promise.race(t.map(function(l) {
1031
+ return l.return && l.return();
914
1032
  }))];
915
1033
  case 6:
916
1034
  return h.sent(), [
@@ -927,68 +1045,68 @@ function ke(t) {
927
1045
  });
928
1046
  });
929
1047
  }
930
- function Ie(t) {
931
- var n = this, e = V(t, { yieldValues: !0 });
932
- return new k(function(r, o) {
933
- return G(n, void 0, void 0, function() {
934
- var i, a, l, c = this;
935
- return j(this, function(s) {
936
- switch (s.label) {
1048
+ function ot(e) {
1049
+ var n = this, t = Y(e, { yieldValues: !0 });
1050
+ return new U(function(o, i) {
1051
+ return M(n, void 0, void 0, function() {
1052
+ var r, s, a, c = this;
1053
+ return A(this, function(u) {
1054
+ switch (u.label) {
937
1055
  case 0:
938
- if (!e.length)
939
- return o(), [
1056
+ if (!t.length)
1057
+ return i(), [
940
1058
  2
941
1059
  /*return*/
942
1060
  ];
943
- i = [], a = !1, o.then(function() {
1061
+ r = [], s = !1, i.then(function() {
944
1062
  var f, h;
945
- a = !0;
1063
+ s = !0;
946
1064
  try {
947
- for (var u = _(i), d = u.next(); !d.done; d = u.next()) {
948
- var p = d.value;
949
- p();
1065
+ for (var l = R(r), y = l.next(); !y.done; y = l.next()) {
1066
+ var d = y.value;
1067
+ d();
950
1068
  }
951
- } catch (y) {
952
- f = { error: y };
1069
+ } catch (m) {
1070
+ f = { error: m };
953
1071
  } finally {
954
1072
  try {
955
- d && !d.done && (h = u.return) && h.call(u);
1073
+ y && !y.done && (h = l.return) && h.call(l);
956
1074
  } finally {
957
1075
  if (f) throw f.error;
958
1076
  }
959
1077
  }
960
- }), s.label = 1;
1078
+ }), u.label = 1;
961
1079
  case 1:
962
- return s.trys.push([1, , 3, 4]), [4, Promise.all(e.map(function(f, h) {
963
- return G(c, void 0, void 0, function() {
964
- var u, d;
965
- return j(this, function(p) {
966
- switch (p.label) {
1080
+ return u.trys.push([1, , 3, 4]), [4, Promise.all(t.map(function(f, h) {
1081
+ return M(c, void 0, void 0, function() {
1082
+ var l, y;
1083
+ return A(this, function(d) {
1084
+ switch (d.label) {
967
1085
  case 0:
968
- p.trys.push([0, , 6, 9]), p.label = 1;
1086
+ d.trys.push([0, , 6, 9]), d.label = 1;
969
1087
  case 1:
970
- return a ? [3, 5] : (Promise.resolve(f.next()).then(function(y) {
971
- return i[h](y);
972
- }, function(y) {
973
- return o(y);
974
- }), [4, new Promise(function(y) {
975
- i[h] = y;
1088
+ return s ? [3, 5] : (Promise.resolve(f.next()).then(function(m) {
1089
+ return r[h](m);
1090
+ }, function(m) {
1091
+ return i(m);
1092
+ }), [4, new Promise(function(m) {
1093
+ r[h] = m;
976
1094
  })]);
977
1095
  case 2:
978
- return u = p.sent(), u === void 0 ? [3, 4] : u.done ? (l = u, [
1096
+ return l = d.sent(), l === void 0 ? [3, 4] : l.done ? (a = l, [
979
1097
  2
980
1098
  /*return*/
981
- ]) : [4, r(u.value)];
1099
+ ]) : [4, o(l.value)];
982
1100
  case 3:
983
- p.sent(), p.label = 4;
1101
+ d.sent(), d.label = 4;
984
1102
  case 4:
985
1103
  return [3, 1];
986
1104
  case 5:
987
1105
  return [3, 9];
988
1106
  case 6:
989
- return d = f.return, d ? [4, f.return()] : [3, 8];
1107
+ return y = f.return, y ? [4, f.return()] : [3, 8];
990
1108
  case 7:
991
- d = p.sent(), p.label = 8;
1109
+ y = d.sent(), d.label = 8;
992
1110
  case 8:
993
1111
  return [
994
1112
  7
@@ -1004,9 +1122,9 @@ function Ie(t) {
1004
1122
  });
1005
1123
  }))];
1006
1124
  case 2:
1007
- return s.sent(), [2, l && l.value];
1125
+ return u.sent(), [2, a && a.value];
1008
1126
  case 3:
1009
- return o(), [
1127
+ return i(), [
1010
1128
  7
1011
1129
  /*endfinally*/
1012
1130
  ];
@@ -1020,50 +1138,50 @@ function Ie(t) {
1020
1138
  });
1021
1139
  });
1022
1140
  }
1023
- function Te(t) {
1024
- var n = this, e = V(t, { returnValues: !0 });
1025
- return new k(function(r, o) {
1026
- return G(n, void 0, void 0, function() {
1027
- var i, a, l, c;
1028
- return j(this, function(s) {
1029
- switch (s.label) {
1141
+ function it(e) {
1142
+ var n = this, t = Y(e, { returnValues: !0 });
1143
+ return new U(function(o, i) {
1144
+ return M(n, void 0, void 0, function() {
1145
+ var r, s, a, c;
1146
+ return A(this, function(u) {
1147
+ switch (u.label) {
1030
1148
  case 0:
1031
- if (!e.length)
1032
- return o(), [2, []];
1033
- a = !1, o.then(function() {
1034
- i(), a = !0;
1035
- }), s.label = 1;
1149
+ if (!t.length)
1150
+ return i(), [2, []];
1151
+ s = !1, i.then(function() {
1152
+ r(), s = !0;
1153
+ }), u.label = 1;
1036
1154
  case 1:
1037
- s.trys.push([1, , 6, 8]), s.label = 2;
1155
+ u.trys.push([1, , 6, 8]), u.label = 2;
1038
1156
  case 2:
1039
- return a ? [3, 5] : (Promise.all(e.map(function(f) {
1157
+ return s ? [3, 5] : (Promise.all(t.map(function(f) {
1040
1158
  return f.next();
1041
1159
  })).then(function(f) {
1042
- return i(f);
1160
+ return r(f);
1043
1161
  }, function(f) {
1044
- return o(f);
1162
+ return i(f);
1045
1163
  }), [4, new Promise(function(f) {
1046
- return i = f;
1164
+ return r = f;
1047
1165
  })]);
1048
1166
  case 3:
1049
- return l = s.sent(), l === void 0 ? [
1167
+ return a = u.sent(), a === void 0 ? [
1050
1168
  2
1051
1169
  /*return*/
1052
- ] : (c = l.map(function(f) {
1170
+ ] : (c = a.map(function(f) {
1053
1171
  return f.value;
1054
- }), l.some(function(f) {
1172
+ }), a.some(function(f) {
1055
1173
  return f.done;
1056
- }) ? [2, c] : [4, r(c)]);
1174
+ }) ? [2, c] : [4, o(c)]);
1057
1175
  case 4:
1058
- return s.sent(), [3, 2];
1176
+ return u.sent(), [3, 2];
1059
1177
  case 5:
1060
1178
  return [3, 8];
1061
1179
  case 6:
1062
- return o(), [4, Promise.all(e.map(function(f) {
1180
+ return i(), [4, Promise.all(t.map(function(f) {
1063
1181
  return f.return && f.return();
1064
1182
  }))];
1065
1183
  case 7:
1066
- return s.sent(), [
1184
+ return u.sent(), [
1067
1185
  7
1068
1186
  /*endfinally*/
1069
1187
  ];
@@ -1077,79 +1195,79 @@ function Te(t) {
1077
1195
  });
1078
1196
  });
1079
1197
  }
1080
- function Fe(t) {
1081
- var n = this, e = V(t, {
1198
+ function st(e) {
1199
+ var n = this, t = Y(e, {
1082
1200
  yieldValues: !0,
1083
1201
  returnValues: !0
1084
1202
  });
1085
- return new k(function(r, o) {
1086
- return G(n, void 0, void 0, function() {
1087
- var i, a, l, c, s, f = this;
1088
- return j(this, function(h) {
1203
+ return new U(function(o, i) {
1204
+ return M(n, void 0, void 0, function() {
1205
+ var r, s, a, c, u, f = this;
1206
+ return A(this, function(h) {
1089
1207
  switch (h.label) {
1090
1208
  case 0:
1091
- if (!e.length)
1092
- return o(), [2, []];
1093
- a = [], l = !1, o.then(function() {
1094
- var u, d;
1095
- i();
1209
+ if (!t.length)
1210
+ return i(), [2, []];
1211
+ s = [], a = !1, i.then(function() {
1212
+ var l, y;
1213
+ r();
1096
1214
  try {
1097
- for (var p = _(a), y = p.next(); !y.done; y = p.next()) {
1098
- var m = y.value;
1099
- m();
1215
+ for (var d = R(s), m = d.next(); !m.done; m = d.next()) {
1216
+ var j = m.value;
1217
+ j();
1100
1218
  }
1101
- } catch (I) {
1102
- u = { error: I };
1219
+ } catch (E) {
1220
+ l = { error: E };
1103
1221
  } finally {
1104
1222
  try {
1105
- y && !y.done && (d = p.return) && d.call(p);
1223
+ m && !m.done && (y = d.return) && y.call(d);
1106
1224
  } finally {
1107
- if (u) throw u.error;
1225
+ if (l) throw l.error;
1108
1226
  }
1109
1227
  }
1110
- l = !0;
1228
+ a = !0;
1111
1229
  }), h.label = 1;
1112
1230
  case 1:
1113
- return h.trys.push([1, , 5, 7]), Promise.all(e.map(function(u) {
1114
- return u.next();
1115
- })).then(function(u) {
1116
- return i(u);
1117
- }, function(u) {
1118
- return o(u);
1119
- }), [4, new Promise(function(u) {
1120
- return i = u;
1231
+ return h.trys.push([1, , 5, 7]), Promise.all(t.map(function(l) {
1232
+ return l.next();
1233
+ })).then(function(l) {
1234
+ return r(l);
1235
+ }, function(l) {
1236
+ return i(l);
1237
+ }), [4, new Promise(function(l) {
1238
+ return r = l;
1121
1239
  })];
1122
1240
  case 2:
1123
1241
  return c = h.sent(), c === void 0 ? [
1124
1242
  2
1125
1243
  /*return*/
1126
- ] : (s = c.map(function(u) {
1127
- return u.value;
1128
- }), c.every(function(u) {
1129
- return u.done;
1130
- }) ? [2, s] : [4, r(s.slice())]);
1244
+ ] : (u = c.map(function(l) {
1245
+ return l.value;
1246
+ }), c.every(function(l) {
1247
+ return l.done;
1248
+ }) ? [2, u] : [4, o(u.slice())]);
1131
1249
  case 3:
1132
- return h.sent(), [4, Promise.all(e.map(function(u, d) {
1133
- return G(f, void 0, void 0, function() {
1134
- var p;
1135
- return j(this, function(y) {
1136
- switch (y.label) {
1250
+ return h.sent(), [4, Promise.all(t.map(function(l, y) {
1251
+ return M(f, void 0, void 0, function() {
1252
+ var d;
1253
+ return A(this, function(m) {
1254
+ switch (m.label) {
1137
1255
  case 0:
1138
- if (c[d].done)
1139
- return [2, c[d].value];
1140
- y.label = 1;
1256
+ if (c[y].done)
1257
+ return [2, c[y].value];
1258
+ m.label = 1;
1141
1259
  case 1:
1142
- return l ? [3, 4] : (Promise.resolve(u.next()).then(function(m) {
1143
- return a[d](m);
1144
- }, function(m) {
1145
- return o(m);
1146
- }), [4, new Promise(function(m) {
1147
- return a[d] = m;
1260
+ return a ? [3, 4] : (Promise.resolve(l.next()).then(function(j) {
1261
+ return s[y](j);
1262
+ }, function(j) {
1263
+ return i(j);
1264
+ }), [4, new Promise(function(j) {
1265
+ return s[y] = j;
1148
1266
  })]);
1149
1267
  case 2:
1150
- return p = y.sent(), p === void 0 ? [2, c[d].value] : p.done ? [2, p.value] : (s[d] = p.value, [4, r(s.slice())]);
1268
+ return d = m.sent(), d === void 0 ? [2, c[y].value] : d.done ? [2, d.value] : (u[y] = d.value, [4, o(u.slice())]);
1151
1269
  case 3:
1152
- return y.sent(), [3, 1];
1270
+ return m.sent(), [3, 1];
1153
1271
  case 4:
1154
1272
  return [
1155
1273
  2
@@ -1162,8 +1280,8 @@ function Fe(t) {
1162
1280
  case 4:
1163
1281
  return [2, h.sent()];
1164
1282
  case 5:
1165
- return o(), [4, Promise.all(e.map(function(u) {
1166
- return u.return && u.return();
1283
+ return i(), [4, Promise.all(t.map(function(l) {
1284
+ return l.return && l.return();
1167
1285
  }))];
1168
1286
  case 6:
1169
1287
  return h.sent(), [
@@ -1180,149 +1298,57 @@ function Fe(t) {
1180
1298
  });
1181
1299
  });
1182
1300
  }
1183
- function qe(t) {
1184
- return typeof t == "string" ? t : t.url;
1185
- }
1186
- function De(t, n, e, r) {
1187
- const o = e[n];
1188
- if (!(!o || !o.length))
1189
- try {
1190
- r[n] = t(r[n], o, !0, !1).newDocument;
1191
- } catch (i) {
1192
- throw typeof i == "object" && i && "name" in i && typeof i.name == "string" && "message" in i && typeof i.message == "string" ? i.name === "TEST_OPERATION_FAILED" ? new we(i.message) : new ge(i.name + ": " + i.message) : i;
1193
- }
1194
- }
1195
- function Ae(t, n) {
1196
- try {
1197
- return t.compile(n);
1198
- } catch (e) {
1199
- throw new be(
1200
- e instanceof Error ? e.message : void 0
1201
- );
1301
+ class ut {
1302
+ ajv_;
1303
+ graffiti;
1304
+ callbacks = /* @__PURE__ */ new Set();
1305
+ options;
1306
+ login;
1307
+ logout;
1308
+ sessionEvents;
1309
+ postMedia;
1310
+ getMedia;
1311
+ deleteMedia;
1312
+ actorToHandle;
1313
+ handleToActor;
1314
+ get ajv() {
1315
+ return this.ajv_ || (this.ajv_ = (async () => {
1316
+ const { default: n } = await import("./ajv-D_HICdxS.mjs").then((t) => t.a);
1317
+ return new n({ strict: !1 });
1318
+ })()), this.ajv_;
1202
1319
  }
1203
- }
1204
- function Ne(t, n, e) {
1205
- t.actor !== (e == null ? void 0 : e.actor) && (t.allowed = t.allowed && e ? [e.actor] : void 0, t.channels = t.channels.filter(
1206
- (r) => n.includes(r)
1207
- ));
1208
- }
1209
- function Be(t, n) {
1210
- return t.allowed === void 0 || t.allowed === null || !!(n != null && n.actor) && (t.actor === n.actor || t.allowed.includes(n.actor));
1211
- }
1212
- class Me extends ve {
1213
1320
  /**
1214
1321
  * Wraps a Graffiti API instance to provide the synchronize methods.
1215
1322
  * The GraffitiSyncrhonize class rather than the Graffiti class
1216
1323
  * must be used for all functions for the synchronize methods to work.
1217
1324
  */
1218
- constructor(e, r) {
1219
- super();
1220
- v(this, "ajv_");
1221
- v(this, "applyPatch_");
1222
- v(this, "graffiti");
1223
- v(this, "callbacks", /* @__PURE__ */ new Set());
1224
- v(this, "options");
1225
- v(this, "channelStats");
1226
- v(this, "login");
1227
- v(this, "logout");
1228
- v(this, "sessionEvents");
1229
- v(this, "get", async (...e) => {
1230
- const r = await this.graffiti.get(...e);
1231
- return this.synchronizeDispatch({ object: r }), r;
1232
- });
1233
- v(this, "put", async (...e) => {
1234
- const r = await this.graffiti.put(...e), o = e[0], i = {
1235
- ...r,
1236
- value: o.value,
1237
- channels: o.channels,
1238
- allowed: o.allowed
1239
- };
1240
- return await this.synchronizeDispatch(
1241
- {
1242
- tombstone: !0,
1243
- object: r
1244
- },
1245
- {
1246
- object: i
1247
- },
1248
- !0
1249
- ), r;
1250
- });
1251
- v(this, "patch", async (...e) => {
1252
- const r = await this.graffiti.patch(...e), o = { ...r };
1253
- for (const i of ["value", "channels", "allowed"])
1254
- De(await this.applyPatch, i, e[0], o);
1255
- return await this.synchronizeDispatch(
1256
- {
1257
- tombstone: !0,
1258
- object: r
1259
- },
1260
- {
1261
- object: o
1262
- },
1263
- !0
1264
- ), r;
1265
- });
1266
- v(this, "delete", async (...e) => {
1267
- const r = await this.graffiti.delete(...e);
1268
- return await this.synchronizeDispatch(
1269
- {
1270
- tombstone: !0,
1271
- object: r
1272
- },
1273
- void 0,
1274
- !0
1275
- ), r;
1276
- });
1277
- v(this, "discover", (...e) => {
1278
- const r = this.graffiti.discover(...e);
1279
- return this.objectStream(r);
1280
- });
1281
- v(this, "recoverOrphans", (...e) => {
1282
- const r = this.graffiti.recoverOrphans(...e);
1283
- return this.objectStream(r);
1284
- });
1285
- v(this, "continueObjectStream", (...e) => this.graffiti.continueObjectStream(...e));
1286
- this.options = r ?? {}, this.graffiti = e, this.channelStats = e.channelStats.bind(e), this.login = e.login.bind(e), this.logout = e.logout.bind(e), this.sessionEvents = e.sessionEvents;
1287
- }
1288
- get ajv() {
1289
- return this.ajv_ || (this.ajv_ = (async () => {
1290
- const { default: e } = await import("./ajv-C30pimY5.mjs").then((r) => r.a);
1291
- return new e({ strict: !1 });
1292
- })()), this.ajv_;
1293
- }
1294
- get applyPatch() {
1295
- return this.applyPatch_ || (this.applyPatch_ = (async () => {
1296
- const { applyPatch: e } = await import("./index-CWfNKdDL.mjs");
1297
- return e;
1298
- })()), this.applyPatch_;
1325
+ constructor(n, t) {
1326
+ this.options = t ?? {}, this.graffiti = n, this.login = n.login.bind(n), this.logout = n.logout.bind(n), this.sessionEvents = n.sessionEvents, this.postMedia = n.postMedia.bind(n), this.getMedia = n.getMedia.bind(n), this.deleteMedia = n.deleteMedia.bind(n), this.actorToHandle = n.actorToHandle.bind(n), this.handleToActor = n.handleToActor.bind(n);
1299
1327
  }
1300
- synchronize(e, r, o, i) {
1301
- const a = /* @__PURE__ */ new Set();
1302
- return new k(
1303
- async (c, s) => {
1304
- const f = Ae(await this.ajv, o), h = (u, d) => {
1305
- for (const p of [d, u])
1306
- if (p != null && p.tombstone)
1307
- a.has(p.object.url) && c(p);
1308
- else if (p && e(p.object) && (this.options.omniscient || Be(p.object, i))) {
1309
- const y = JSON.parse(
1310
- JSON.stringify(p.object)
1311
- );
1312
- if (this.options.omniscient || Ne(y, r, i), f(y)) {
1313
- c({ object: y }), a.add(y.url);
1314
- break;
1315
- }
1316
- }
1328
+ synchronize(n, t, o, i, r = /* @__PURE__ */ new Set()) {
1329
+ const s = new U(
1330
+ async (a, c) => {
1331
+ const u = lt(await this.ajv, o), f = (h) => {
1332
+ if (h?.tombstone)
1333
+ r.has(h.object.url) && a(h);
1334
+ else if (h && n(h.object) && (this.options.omniscient || Ge(h.object, i))) {
1335
+ let l = JSON.parse(
1336
+ JSON.stringify(h.object)
1337
+ );
1338
+ this.options.omniscient || (l = ke(l, t, i?.actor)), u(l) && (a({ object: l }), r.add(l.url));
1339
+ }
1317
1340
  };
1318
- this.callbacks.add(h), await s, this.callbacks.delete(h);
1341
+ this.callbacks.add(f), await c, this.callbacks.delete(f);
1319
1342
  }
1320
1343
  );
1344
+ return (async function* () {
1345
+ for await (const a of s) yield a;
1346
+ })();
1321
1347
  }
1322
1348
  /**
1323
1349
  * This method has the same signature as {@link discover} but listens for
1324
- * changes made via {@link put}, {@link patch}, and {@link delete} or
1325
- * fetched from {@link get}, {@link discover}, and {@link recoverOrphans}
1350
+ * changes made via {@link post} and {@link delete} or
1351
+ * fetched from {@link get}, {@link discover}, and {@link continueDiscover}
1326
1352
  * and then streams appropriate changes to provide a responsive and
1327
1353
  * consistent user experience.
1328
1354
  *
@@ -1330,53 +1356,38 @@ class Me extends ve {
1330
1356
  * and will not terminate unless the user calls the `return` method on the iterator
1331
1357
  * or `break`s out of the loop.
1332
1358
  *
1333
- * @group Synchronize Methods
1359
+ * @group 0 - Synchronize Methods
1334
1360
  */
1335
- synchronizeDiscover(...e) {
1336
- const [r, o, i] = e;
1337
- function a(l) {
1338
- return l.channels.some((c) => r.includes(c));
1361
+ synchronizeDiscover(n, t, o) {
1362
+ function i(r) {
1363
+ return r.channels.some((s) => n.includes(s));
1339
1364
  }
1340
- return this.synchronize(a, r, o, i);
1365
+ return this.synchronize(i, n, t, o);
1341
1366
  }
1342
1367
  /**
1343
1368
  * This method has the same signature as {@link get} but
1344
- * listens for changes made via {@link put}, {@link patch}, and {@link delete} or
1345
- * fetched from {@link get}, {@link discover}, and {@link recoverOrphans} and then
1369
+ * listens for changes made via {@link post}, and {@link delete} or
1370
+ * fetched from {@link get}, {@link discover}, and {@link continueDiscover} and then
1346
1371
  * streams appropriate changes to provide a responsive and consistent user experience.
1347
1372
  *
1348
1373
  * Unlike {@link get}, which returns a single result, this method continuously
1349
1374
  * listens for changes which are output as an asynchronous stream, similar
1350
1375
  * to {@link discover}.
1351
1376
  *
1352
- * @group Synchronize Methods
1377
+ * @group 0 - Synchronize Methods
1353
1378
  */
1354
- synchronizeGet(...e) {
1355
- const [r, o, i] = e, a = qe(r);
1356
- function l(c) {
1357
- return c.url === a;
1379
+ synchronizeGet(n, t, o) {
1380
+ const i = te(n);
1381
+ function r(s) {
1382
+ return s.url === i;
1358
1383
  }
1359
- return this.synchronize(l, [], o, i);
1360
- }
1361
- /**
1362
- * This method has the same signature as {@link recoverOrphans} but
1363
- * listens for changes made via
1364
- * {@link put}, {@link patch}, and {@link delete} or fetched from
1365
- * {@link get}, {@link discover}, and {@link recoverOrphans} and then
1366
- * streams appropriate changes to provide a responsive and consistent user experience.
1367
- *
1368
- * Unlike {@link recoverOrphans}, this method continuously listens for changes
1369
- * and will not terminate unless the user calls the `return` method on the iterator
1370
- * or `break`s out of the loop.
1371
- *
1372
- * @group Synchronize Methods
1373
- */
1374
- synchronizeRecoverOrphans(...e) {
1375
- const [r, o] = e;
1376
- function i(a) {
1377
- return a.actor === o.actor && a.channels.length === 0;
1378
- }
1379
- return this.synchronize(i, [], r, o);
1384
+ return this.synchronize(
1385
+ r,
1386
+ [],
1387
+ t,
1388
+ o,
1389
+ /* @__PURE__ */ new Set([i])
1390
+ );
1380
1391
  }
1381
1392
  /**
1382
1393
  * Streams changes made to *any* object in *any* channel
@@ -1387,80 +1398,129 @@ class Me extends ve {
1387
1398
  *
1388
1399
  * Be careful using this method. Without additional filters it can
1389
1400
  * expose the user to content out of context.
1401
+ *
1402
+ * @group 0 - Synchronize Methods
1390
1403
  */
1391
- synchronizeAll(e, r) {
1392
- return this.synchronize(() => !0, [], e, r);
1404
+ synchronizeAll(n, t) {
1405
+ return this.synchronize(() => !0, [], n, t);
1393
1406
  }
1394
- async synchronizeDispatch(e, r, o = !1) {
1395
- for (const i of this.callbacks)
1396
- i(e, r);
1397
- o && await new Promise((i) => setTimeout(i, 0));
1407
+ async synchronizeDispatch(n, t = !1) {
1408
+ for (const o of this.callbacks)
1409
+ o(n);
1410
+ t && await new Promise((o) => setTimeout(o, 0));
1398
1411
  }
1399
- objectStreamContinue(e) {
1400
- const r = this;
1401
- return async function* () {
1412
+ get = async (...n) => {
1413
+ try {
1414
+ const t = await this.graffiti.get(...n);
1415
+ return this.synchronizeDispatch({ object: t }), t;
1416
+ } catch (t) {
1417
+ throw t instanceof D && this.synchronizeDispatch({
1418
+ tombstone: !0,
1419
+ object: { url: te(n[0]) }
1420
+ }), t;
1421
+ }
1422
+ };
1423
+ post = async (...n) => {
1424
+ const t = await this.graffiti.post(...n);
1425
+ return await this.synchronizeDispatch({ object: t }, !0), t;
1426
+ };
1427
+ delete = async (...n) => {
1428
+ const t = {
1429
+ tombstone: !0,
1430
+ object: { url: te(n[0]) }
1431
+ };
1432
+ try {
1433
+ const o = await this.graffiti.delete(...n);
1434
+ return await this.synchronizeDispatch(t, !0), o;
1435
+ } catch (o) {
1436
+ throw o instanceof D && await this.synchronizeDispatch(t, !0), o;
1437
+ }
1438
+ };
1439
+ objectStreamContinue(n) {
1440
+ const t = this;
1441
+ return (async function* () {
1402
1442
  for (; ; ) {
1403
- const o = await e.next();
1443
+ const o = await n.next();
1404
1444
  if (o.done) {
1405
- const { continue: i, cursor: a } = o.value;
1445
+ const { continue: i, cursor: r } = o.value;
1406
1446
  return {
1407
- continue: () => r.objectStreamContinue(i()),
1408
- cursor: a
1447
+ continue: (s) => t.objectStreamContinue(i(s)),
1448
+ cursor: r
1409
1449
  };
1410
1450
  }
1411
- o.value.error || r.synchronizeDispatch(
1412
- o.value
1413
- ), yield o.value;
1451
+ o.value.error || t.synchronizeDispatch(o.value), yield o.value;
1414
1452
  }
1415
- }();
1453
+ })();
1416
1454
  }
1417
- objectStream(e) {
1418
- const r = this.objectStreamContinue(e);
1419
- return async function* () {
1455
+ objectStream(n) {
1456
+ const t = this.objectStreamContinue(n);
1457
+ return (async function* () {
1420
1458
  for (; ; ) {
1421
- const o = await r.next();
1459
+ const o = await t.next();
1422
1460
  if (o.done) return o.value;
1423
1461
  (o.value.error || !o.value.tombstone) && (yield o.value);
1424
1462
  }
1425
- }();
1463
+ })();
1464
+ }
1465
+ discover = (...n) => {
1466
+ const t = this.graffiti.discover(...n);
1467
+ return this.objectStream(t);
1468
+ };
1469
+ continueDiscover = (...n) => {
1470
+ const t = this.graffiti.continueDiscover(...n);
1471
+ return this.objectStreamContinue(t);
1472
+ };
1473
+ }
1474
+ function lt(e, n) {
1475
+ try {
1476
+ return e.compile(n);
1477
+ } catch (t) {
1478
+ throw new Se(
1479
+ t instanceof Error ? t.message : String(t)
1480
+ );
1426
1481
  }
1427
1482
  }
1428
- const Ue = {
1429
- install(t, n) {
1430
- const e = n.graffiti, r = new Me(e), o = B(void 0);
1431
- r.sessionEvents.addEventListener("initialized", async (i) => {
1432
- const a = i.detail;
1433
- if (a && a.error && console.error(a.error), a && a.href) {
1434
- const l = t.config.globalProperties.$router;
1435
- if (l) {
1436
- const c = l.options.history.base, s = new URL(a.href);
1437
- s.pathname.startsWith(c) && (s.pathname = s.pathname.slice(c.length)), await l.replace(s.pathname + s.search + s.hash);
1483
+ const ft = {
1484
+ install(e, n) {
1485
+ const t = n.graffiti, o = new ut(t), i = k(void 0);
1486
+ o.sessionEvents.addEventListener("initialized", async (r) => {
1487
+ const s = r.detail;
1488
+ if (s && s.error && console.error(s.error), s && s.href) {
1489
+ const a = e.config.globalProperties.$router;
1490
+ if (a) {
1491
+ const c = a.options.history.base, u = new URL(s.href);
1492
+ u.pathname.startsWith(c) && (u.pathname = u.pathname.slice(c.length)), await a.replace(u.pathname + u.search + u.hash);
1438
1493
  }
1439
1494
  }
1440
- o.value || (o.value = null);
1441
- }), r.sessionEvents.addEventListener("login", (i) => {
1442
- const a = i.detail;
1443
- if (a.error) {
1444
- console.error("Error logging in:"), console.error(a.error);
1495
+ i.value || (i.value = null);
1496
+ }), o.sessionEvents.addEventListener("login", (r) => {
1497
+ const s = r.detail;
1498
+ if (s.error) {
1499
+ console.error("Error logging in:"), console.error(s.error);
1445
1500
  return;
1446
1501
  } else
1447
- o.value = a.session;
1448
- }), r.sessionEvents.addEventListener("logout", (i) => {
1449
- const a = i.detail;
1450
- a.error ? (console.error("Error logging out:"), console.error(a.error)) : o.value = null;
1451
- }), q.graffitiSynchronize = r, q.graffitiSession = o, t.component("GraffitiDiscover", ae), t.component("GraffitiGet", ue), t.component("GraffitiRecoverOrphans", ce), t.config.globalProperties.$graffiti = r, t.config.globalProperties.$graffitiSession = o;
1502
+ i.value = s.session;
1503
+ }), o.sessionEvents.addEventListener("logout", (r) => {
1504
+ const s = r.detail;
1505
+ s.error ? (console.error("Error logging out:"), console.error(s.error)) : i.value = null;
1506
+ }), Oe(o), Ee(i), e.component("GraffitiDiscover", we), e.component("GraffitiGet", ge), e.component("GraffitiGetMedia", je), e.component("GraffitiActorToHandle", W), e.component("GraffitiHandleToActor", xe), e.component("GraffitiObjectInfo", K), e.config.globalProperties.$graffiti = o, e.config.globalProperties.$graffitiSession = i;
1452
1507
  }
1453
- }, Le = ae, We = ue, Je = ce;
1508
+ }, dt = we, ht = ge, yt = je, pt = W, vt = xe, mt = K;
1454
1509
  export {
1455
- Le as GraffitiDiscover,
1456
- We as GraffitiGet,
1457
- Ue as GraffitiPlugin,
1458
- Je as GraffitiRecoverOrphans,
1459
- $e as useGraffiti,
1460
- xe as useGraffitiDiscover,
1461
- Oe as useGraffitiGet,
1462
- Se as useGraffitiRecoverOrphans,
1463
- Y as useGraffitiSession,
1464
- M as useGraffitiSynchronize
1510
+ pt as GraffitiActorToHandle,
1511
+ dt as GraffitiDiscover,
1512
+ ht as GraffitiGet,
1513
+ yt as GraffitiGetMedia,
1514
+ vt as GraffitiHandleToActor,
1515
+ mt as GraffitiObjectInfo,
1516
+ ft as GraffitiPlugin,
1517
+ ae as useGraffiti,
1518
+ Te as useGraffitiActorToHandle,
1519
+ Ae as useGraffitiDiscover,
1520
+ Ne as useGraffitiGet,
1521
+ Ue as useGraffitiGetMedia,
1522
+ Ke as useGraffitiHandleToActor,
1523
+ ct as useGraffitiSession,
1524
+ X as useGraffitiSynchronize
1465
1525
  };
1466
1526
  //# sourceMappingURL=plugin.mjs.map