@viceme-ai/sdk 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +18 -6
  2. package/dist/capability-mount.d.ts +2 -0
  3. package/dist/capability-mount.d.ts.map +1 -1
  4. package/dist/chunks/{client-DEg6YouY.js → client-C1Sw400H.js} +386 -300
  5. package/dist/chunks/client-C1Sw400H.js.map +1 -0
  6. package/dist/chunks/integration-CTsnJ8mN.js +38 -0
  7. package/dist/chunks/integration-CTsnJ8mN.js.map +1 -0
  8. package/dist/chunks/version-CAPPYmfK.js +6 -0
  9. package/dist/chunks/{version-BJiUVcir.js.map → version-CAPPYmfK.js.map} +1 -1
  10. package/dist/core/capabilities.d.ts.map +1 -1
  11. package/dist/core/presentation.d.ts +5 -0
  12. package/dist/core/presentation.d.ts.map +1 -1
  13. package/dist/danmaku/mount.d.ts.map +1 -1
  14. package/dist/danmaku.js +117 -91
  15. package/dist/danmaku.js.map +1 -1
  16. package/dist/engagement/integration.d.ts +15 -0
  17. package/dist/engagement/integration.d.ts.map +1 -0
  18. package/dist/generated/public-contract.d.ts +15 -1
  19. package/dist/generated/public-contract.d.ts.map +1 -1
  20. package/dist/index.js +7 -6
  21. package/dist/index.js.map +1 -1
  22. package/dist/loader/auto-loader.d.ts.map +1 -1
  23. package/dist/manifest.json +36 -27
  24. package/dist/session/session.d.ts +12 -0
  25. package/dist/session/session.d.ts.map +1 -1
  26. package/dist/testing.js +1 -1
  27. package/dist/tip/index.d.ts +2 -0
  28. package/dist/tip/index.d.ts.map +1 -1
  29. package/dist/tip/mount.d.ts.map +1 -1
  30. package/dist/tip.js +211 -194
  31. package/dist/tip.js.map +1 -1
  32. package/dist/transport/transport.d.ts.map +1 -1
  33. package/dist/version.d.ts +1 -1
  34. package/dist/viceme.min.js +46 -4
  35. package/dist/viceme.min.js.map +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunks/client-DEg6YouY.js.map +0 -1
  38. package/dist/chunks/version-BJiUVcir.js +0 -6
@@ -1,47 +1,47 @@
1
- import { a as L, V as b, c as v, i as G } from "./errors-C7DfLKcF.js";
2
- import { a as q, B as j } from "./build-endpoints-NrDmg6jf.js";
3
- import { S as W, A as H } from "./version-BJiUVcir.js";
4
- const V = /* @__PURE__ */ new Set(["cn", "global"]), z = {
5
- cn: q.cn,
6
- global: q.global
1
+ import { a as R, V as v, c as k, i as Y } from "./errors-C7DfLKcF.js";
2
+ import { a as W, B as $ } from "./build-endpoints-NrDmg6jf.js";
3
+ import { S as Q, A as X } from "./version-CAPPYmfK.js";
4
+ const J = /* @__PURE__ */ new Set(["cn", "global"]), Z = {
5
+ cn: W.cn,
6
+ global: W.global
7
7
  };
8
- function pe(t) {
9
- return z[t];
8
+ function Ee(t) {
9
+ return Z[t];
10
10
  }
11
- function B(t) {
11
+ function ee(t) {
12
12
  return typeof t == "string" && /^wrk_(?:test|live)_[A-Za-z0-9_-]{4,119}$/.test(t);
13
13
  }
14
- function Y(t) {
15
- return typeof t == "string" && V.has(t);
14
+ function te(t) {
15
+ return typeof t == "string" && J.has(t);
16
16
  }
17
- function ye(t) {
17
+ function Se(t) {
18
18
  if (typeof t != "object" || t === null)
19
- throw L("createViceMe expects a configuration object.");
19
+ throw R("createViceMe expects a configuration object.");
20
20
  const e = t, i = /* @__PURE__ */ new Set(["workKey", "region", "signal"]);
21
21
  for (const r of Object.keys(e))
22
22
  if (!i.has(r))
23
- throw L(`Unknown configuration field "${r}".`);
24
- if (!B(e.workKey))
25
- throw L(
23
+ throw R(`Unknown configuration field "${r}".`);
24
+ if (!ee(e.workKey))
25
+ throw R(
26
26
  'Configuration field "workKey" must start with "wrk_test_" or "wrk_live_".'
27
27
  );
28
- if (!Y(e.region))
29
- throw L('Configuration field "region" must be "cn" or "global".');
28
+ if (!te(e.region))
29
+ throw R('Configuration field "region" must be "cn" or "global".');
30
30
  if (e.signal !== void 0 && !(e.signal instanceof AbortSignal))
31
- throw L('Configuration field "signal" must be an AbortSignal.');
31
+ throw R('Configuration field "signal" must be an AbortSignal.');
32
32
  return {
33
33
  workKey: e.workKey,
34
34
  region: e.region,
35
35
  signal: e.signal
36
36
  };
37
37
  }
38
- const $ = {
38
+ const ie = {
39
39
  CREATED: ["READY", "DESTROYED"],
40
40
  READY: ["DEGRADED", "DESTROYED"],
41
41
  DEGRADED: ["DESTROYED"],
42
42
  DESTROYED: []
43
43
  };
44
- class Q {
44
+ class re {
45
45
  #e = "CREATED";
46
46
  #t = /* @__PURE__ */ new Set();
47
47
  get state() {
@@ -52,8 +52,8 @@ class Q {
52
52
  }
53
53
  transition(e) {
54
54
  if (e !== this.#e) {
55
- if (!$[this.#e].includes(e))
56
- throw new b({
55
+ if (!ie[this.#e].includes(e))
56
+ throw new v({
57
57
  code: "INTERNAL_ERROR",
58
58
  message: `Illegal lifecycle transition ${this.#e} -> ${e}.`,
59
59
  retryable: !1
@@ -64,7 +64,7 @@ class Q {
64
64
  }
65
65
  /** Any operation on a destroyed client must fail closed with this guard. */
66
66
  assertAlive() {
67
- if (this.destroyed) throw v();
67
+ if (this.destroyed) throw k();
68
68
  }
69
69
  subscribe(e) {
70
70
  return this.#t.add(e), () => {
@@ -75,14 +75,14 @@ class Q {
75
75
  this.#t.clear();
76
76
  }
77
77
  }
78
- function X(t, e) {
78
+ function ae(t, e) {
79
79
  if (typeof t != "object" || t === null)
80
- throw R();
80
+ throw C();
81
81
  const i = t;
82
- if (typeof i.workKey != "string" || !Array.isArray(i.capabilities) || !i.capabilities.every((c) => typeof c == "string"))
83
- throw R();
82
+ if (typeof i.workKey != "string" || !Array.isArray(i.capabilities) || !i.capabilities.every((s) => typeof s == "string"))
83
+ throw C();
84
84
  if (i.workKey !== e)
85
- throw new b({
85
+ throw new v({
86
86
  code: "WORK_NOT_FOUND",
87
87
  message: "Work-session response did not match the requested work key.",
88
88
  retryable: !1
@@ -93,32 +93,59 @@ function X(t, e) {
93
93
  capabilities: i.capabilities
94
94
  }
95
95
  };
96
+ if (i.creator !== void 0 || i.work !== void 0) {
97
+ const s = j(i.creator), w = j(i.work);
98
+ if (typeof s.displayName != "string" || s.displayName.length === 0 || !z(s.avatarUrl) || !Number.isInteger(s.publishedWorkCount) || s.publishedWorkCount < 0 || typeof w.title != "string" || w.title.length === 0 || typeof w.summary != "string" || !z(w.coverUrl))
99
+ throw C();
100
+ r.work.creator = {
101
+ displayName: s.displayName,
102
+ avatarUrl: s.avatarUrl,
103
+ publishedWorkCount: s.publishedWorkCount
104
+ }, r.work.details = {
105
+ title: w.title,
106
+ summary: w.summary,
107
+ coverUrl: w.coverUrl
108
+ };
109
+ }
96
110
  if (typeof i.token == "string" && (r.token = i.token), typeof i.expiresAt == "string") {
97
- const c = new Date(i.expiresAt).getTime();
98
- Number.isNaN(c) || (r.expiresAt = c);
111
+ const s = new Date(i.expiresAt).getTime();
112
+ Number.isNaN(s) || (r.expiresAt = s);
99
113
  }
100
114
  return r;
101
115
  }
102
- function R() {
103
- return new b({
116
+ function j(t) {
117
+ if (typeof t != "object" || t === null) throw C();
118
+ return t;
119
+ }
120
+ function z(t) {
121
+ if (t === null) return !0;
122
+ if (typeof t != "string") return !1;
123
+ try {
124
+ return new URL(t), !0;
125
+ } catch {
126
+ return !1;
127
+ }
128
+ }
129
+ function C() {
130
+ return new v({
104
131
  code: "INTERNAL_ERROR",
105
132
  message: "Malformed work-session response.",
106
133
  retryable: !0
107
134
  });
108
135
  }
109
- function J() {
110
- return new b({
136
+ function oe() {
137
+ return new v({
111
138
  code: "SESSION_EXPIRED",
112
139
  message: "The work session was invalidated before it completed.",
113
140
  retryable: !0
114
141
  });
115
142
  }
116
- class Z {
143
+ class ne {
117
144
  #e;
118
145
  #t;
119
146
  #i;
120
147
  #r;
121
- #n = 0;
148
+ #o = 0;
122
149
  #a = !1;
123
150
  constructor(e) {
124
151
  this.#e = e, this.#t = e.now ?? (() => Date.now());
@@ -139,13 +166,13 @@ class Z {
139
166
  * in-flight request (single flight).
140
167
  */
141
168
  establish() {
142
- if (this.#a) return Promise.reject(v());
169
+ if (this.#a) return Promise.reject(k());
143
170
  if (this.#i) {
144
171
  if (!this.#s()) return Promise.resolve(this.#i);
145
172
  this.#i = void 0;
146
173
  }
147
174
  if (this.#r) return this.#r;
148
- const e = this.#n, i = this.#e.transport.request({
175
+ const e = this.#o, i = this.#e.transport.request({
149
176
  method: "POST",
150
177
  path: "/v1/public/work-sdk/sessions",
151
178
  body: { workKey: this.#e.workKey },
@@ -153,8 +180,8 @@ class Z {
153
180
  timeoutMs: this.#e.timeoutMs
154
181
  }).then((r) => {
155
182
  this.#c(e);
156
- const c = X(r.body, this.#e.workKey);
157
- return this.#c(e), this.#i = c, c;
183
+ const s = ae(r.body, this.#e.workKey);
184
+ return this.#c(e), this.#i = s, s;
158
185
  }).finally(() => {
159
186
  this.#r === i && (this.#r = void 0);
160
187
  });
@@ -162,20 +189,20 @@ class Z {
162
189
  }
163
190
  async request(e) {
164
191
  const i = await this.establish();
165
- if (!i.token) throw R();
192
+ if (!i.token) throw C();
166
193
  try {
167
194
  return await this.#l(e, i);
168
195
  } catch (r) {
169
- if (this.#a) throw v();
170
- if (!(r instanceof b) || r.code !== "SESSION_EXPIRED") throw r;
196
+ if (this.#a) throw k();
197
+ if (!(r instanceof v) || r.code !== "SESSION_EXPIRED") throw r;
171
198
  this.#i === i && this.invalidate();
172
- const c = await this.establish();
173
- if (!c.token) throw R();
174
- return this.#l(e, c);
199
+ const s = await this.establish();
200
+ if (!s.token) throw C();
201
+ return this.#l(e, s);
175
202
  }
176
203
  }
177
204
  authenticate(e) {
178
- if (this.#o(), !this.#i) throw R();
205
+ if (this.#n(), !this.#i) throw C();
179
206
  this.#i = {
180
207
  ...this.#i,
181
208
  userToken: e.userToken,
@@ -183,24 +210,24 @@ class Z {
183
210
  };
184
211
  }
185
212
  async signOut() {
186
- this.#o(), this.invalidate(), await this.establish();
213
+ this.#n(), this.invalidate(), await this.establish();
187
214
  }
188
215
  /** Drop the token; next `establish()` re-authenticates. */
189
216
  invalidate() {
190
- this.#n += 1, this.#i = void 0, this.#r = void 0;
217
+ this.#o += 1, this.#i = void 0, this.#r = void 0;
191
218
  }
192
219
  /** Hard cleanup: forget the token and pending work. */
193
220
  destroy() {
194
- this.#a || (this.#a = !0, this.#n += 1, this.#i = void 0, this.#r = void 0);
221
+ this.#a || (this.#a = !0, this.#o += 1, this.#i = void 0, this.#r = void 0);
195
222
  }
196
- #o() {
197
- if (this.#a) throw v();
223
+ #n() {
224
+ if (this.#a) throw k();
198
225
  }
199
226
  #c(e) {
200
- if (this.#o(), e !== this.#n) throw J();
227
+ if (this.#n(), e !== this.#o) throw oe();
201
228
  }
202
229
  async #l(e, i) {
203
- this.#o();
230
+ this.#n();
204
231
  try {
205
232
  const r = await this.#e.transport.request({
206
233
  ...e,
@@ -208,14 +235,14 @@ class Z {
208
235
  userAuthorization: i.userToken,
209
236
  signal: this.#e.signal
210
237
  });
211
- return this.#o(), r;
238
+ return this.#n(), r;
212
239
  } catch (r) {
213
- throw this.#a ? v() : r;
240
+ throw this.#a ? k() : r;
214
241
  }
215
242
  }
216
243
  }
217
- const K = "viceme-access-layer", P = 50;
218
- function ee(t) {
244
+ const q = "viceme-access-layer", M = 50;
245
+ function se(t) {
219
246
  switch (t) {
220
247
  case "SIGN_IN":
221
248
  return {
@@ -234,8 +261,8 @@ function ee(t) {
234
261
  };
235
262
  }
236
263
  }
237
- function te(t) {
238
- if (!G(t)) return "操作未完成,请重试。";
264
+ function ce(t) {
265
+ if (!Y(t)) return "操作未完成,请重试。";
239
266
  switch (t.code) {
240
267
  case "CONFIG_INVALID":
241
268
  return "微信授权配置无效,请稍后重试。";
@@ -249,12 +276,12 @@ function te(t) {
249
276
  return t.requestId ? `操作未完成,请重试。请求 ID:${t.requestId}` : "操作未完成,请重试。";
250
277
  }
251
278
  }
252
- function ie() {
253
- if (customElements.get(K)) return;
279
+ function le() {
280
+ if (customElements.get(q)) return;
254
281
  class t extends HTMLElement {
255
282
  interaction;
256
283
  connectedCallback() {
257
- const i = ee(this.interaction.action), r = this.attachShadow({ mode: "open" });
284
+ const i = se(this.interaction.action), r = this.attachShadow({ mode: "open" });
258
285
  r.innerHTML = `
259
286
  <style>
260
287
  :host {
@@ -374,8 +401,43 @@ function ie() {
374
401
  font-size: 1.125rem;
375
402
  }
376
403
  [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='profile-description'] {
377
- margin-top: 0.75rem;
378
- line-height: 1.625;
404
+ display: none;
405
+ }
406
+ [data-viceme='work'] {
407
+ display: none;
408
+ overflow: hidden;
409
+ margin-top: 1.25rem;
410
+ border: 1px solid #e4e4e7;
411
+ border-radius: 1rem;
412
+ background: #fafafa;
413
+ text-align: left;
414
+ }
415
+ [data-viceme='work'][data-visible='true'] { display: block; }
416
+ [data-viceme='work-cover'] {
417
+ display: block;
418
+ width: 100%;
419
+ aspect-ratio: 16 / 9;
420
+ object-fit: cover;
421
+ background: #f4f4f5;
422
+ }
423
+ [data-viceme='work-cover'][hidden] { display: none; }
424
+ [data-viceme='work-copy'] { padding: 1rem; }
425
+ [data-viceme='work-title'] {
426
+ margin: 0;
427
+ color: #18181b;
428
+ font-size: 1rem;
429
+ font-weight: 700;
430
+ line-height: 1.5;
431
+ }
432
+ [data-viceme='work-summary'] {
433
+ display: -webkit-box;
434
+ overflow: hidden;
435
+ margin: 0.375rem 0 0;
436
+ color: #71717a;
437
+ font-size: 0.875rem;
438
+ line-height: 1.5;
439
+ -webkit-box-orient: vertical;
440
+ -webkit-line-clamp: 2;
379
441
  }
380
442
  [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='action'] {
381
443
  width: 100%;
@@ -462,6 +524,13 @@ function ie() {
462
524
  </div>
463
525
  <p data-viceme="profile-description"></p>
464
526
  </section>
527
+ <article data-viceme="work">
528
+ <img data-viceme="work-cover" hidden />
529
+ <div data-viceme="work-copy">
530
+ <p data-viceme="work-title"></p>
531
+ <p data-viceme="work-summary"></p>
532
+ </div>
533
+ </article>
465
534
  <p data-viceme="error" role="alert" aria-live="polite"></p>
466
535
  <div data-viceme="actions">
467
536
  <button data-viceme="action" type="button"></button>
@@ -470,74 +539,76 @@ function ie() {
470
539
  <iframe data-viceme="frame" title="" referrerpolicy="no-referrer" allow="payment"></iframe>
471
540
  </section>
472
541
  `;
473
- const c = r.querySelector("[data-viceme='panel']");
474
- c.dataset.action = this.interaction.action, c.dataset.frame = "false";
475
- const O = r.querySelector("[data-viceme='description']");
476
- O.textContent = i.description;
477
- const f = r.querySelector("[data-viceme='action']"), U = f.parentElement, N = r.querySelector("[data-viceme='close']"), T = r.querySelector("[data-viceme='backdrop']"), C = r.querySelector("[data-viceme='error']"), S = r.querySelector("[data-viceme='frame']"), M = r.querySelector("[data-viceme='profile']"), x = r.querySelector("[data-viceme='avatar']"), n = r.querySelector("[data-viceme='avatar-fallback']"), o = r.querySelector("[data-viceme='profile-name']"), l = r.querySelector(
542
+ const s = r.querySelector("[data-viceme='panel']");
543
+ s.dataset.action = this.interaction.action, s.dataset.frame = "false";
544
+ const w = r.querySelector("[data-viceme='description']");
545
+ w.textContent = i.description;
546
+ const f = r.querySelector("[data-viceme='action']"), L = f.parentElement, D = r.querySelector("[data-viceme='close']"), T = r.querySelector("[data-viceme='backdrop']"), O = r.querySelector("[data-viceme='error']"), N = r.querySelector("[data-viceme='frame']"), U = r.querySelector("[data-viceme='profile']"), _ = r.querySelector("[data-viceme='avatar']"), K = r.querySelector("[data-viceme='avatar-fallback']"), a = r.querySelector("[data-viceme='profile-name']"), n = r.querySelector(
478
547
  "[data-viceme='profile-description']"
479
- ), a = r.querySelector("[data-viceme='profile-stats']");
480
- f.textContent = i.label, f.hidden = !1, U.dataset.single = "true";
481
- const d = i.label;
482
- S.title = this.interaction.action === "SIGN_IN" ? "登录授权" : "支付";
483
- const u = this.interaction.followTarget;
484
- if (u) {
485
- c.setAttribute(
548
+ ), d = r.querySelector("[data-viceme='profile-stats']"), o = r.querySelector("[data-viceme='work']"), l = r.querySelector("[data-viceme='work-cover']"), g = r.querySelector("[data-viceme='work-title']"), S = r.querySelector("[data-viceme='work-summary']");
549
+ f.textContent = i.label, f.hidden = !1, L.dataset.single = "true";
550
+ const A = i.label;
551
+ N.title = this.interaction.action === "SIGN_IN" ? "登录授权" : "支付";
552
+ const m = this.interaction.followTarget;
553
+ if (m) {
554
+ s.setAttribute(
486
555
  "aria-label",
487
- this.interaction.action === "SIGN_IN" ? `授权 ${u.displayName}` : `关注 ${u.displayName}`
488
- ), M.dataset.visible = "true", o.textContent = u.displayName;
489
- const s = [...u.description ?? ""];
490
- l.textContent = s.length > P ? `${s.slice(0, P).join("")}…` : s.join(""), s.length > P && (l.title = u.description), a.textContent = `${u.workCount} 个作品`, n.textContent = u.displayName.trim().slice(0, 1) || "V", u.avatarUrl && (x.src = u.avatarUrl, x.alt = `${u.displayName}的头像`, x.hidden = !1, n.hidden = !0);
556
+ this.interaction.action === "SIGN_IN" ? `授权 ${m.displayName}` : `关注 ${m.displayName}`
557
+ ), U.dataset.visible = "true", a.textContent = m.displayName;
558
+ const c = [...m.description ?? ""];
559
+ n.textContent = c.length > M ? `${c.slice(0, M).join("")}…` : c.join(""), c.length > M && (n.title = m.description), d.textContent = `${m.workCount} 个作品`, K.textContent = m.displayName.trim().slice(0, 1) || "V", m.avatarUrl && (_.src = m.avatarUrl, _.alt = `${m.displayName}的头像`, _.hidden = !1, K.hidden = !0);
491
560
  }
492
- let p = null, w = !1;
493
- const I = (s) => {
494
- w || (w = !0, this.interaction.signal?.removeEventListener("abort", y), this.dispatchEvent(new CustomEvent("viceme:access-layer-close", { detail: s })));
495
- }, y = () => {
496
- p?.cancel(), I("dismissed");
561
+ const p = this.interaction.work;
562
+ p && (o.dataset.visible = "true", g.textContent = p.title, S.textContent = p.summary, p.coverUrl && (l.src = p.coverUrl, l.alt = p.title, l.hidden = !1));
563
+ let b = null, E = !1;
564
+ const y = (c) => {
565
+ E || (E = !0, this.interaction.signal?.removeEventListener("abort", u), this.dispatchEvent(new CustomEvent("viceme:access-layer-close", { detail: c })));
566
+ }, u = () => {
567
+ b?.cancel(), y("dismissed");
497
568
  };
498
- this.interaction.signal?.addEventListener("abort", y, { once: !0 }), this.interaction.signal?.aborted && queueMicrotask(y), T.addEventListener("click", y), N.addEventListener("click", y), this.addEventListener("keydown", (s) => {
499
- if (s.key === "Escape" && y(), s.key === "Tab") {
500
- if (s.preventDefault(), p?.type === "frame") {
501
- S.focus();
569
+ this.interaction.signal?.addEventListener("abort", u, { once: !0 }), this.interaction.signal?.aborted && queueMicrotask(u), T.addEventListener("click", u), D.addEventListener("click", u), this.addEventListener("keydown", (c) => {
570
+ if (c.key === "Escape" && u(), c.key === "Tab") {
571
+ if (c.preventDefault(), b?.type === "frame") {
572
+ N.focus();
502
573
  return;
503
574
  }
504
- const m = [N, ...f.hidden ? [] : [f]].filter((_) => !_.disabled && !_.hidden);
505
- if (m.length === 0) return;
506
- const D = m.indexOf(r.activeElement), E = s.shiftKey ? -1 : 1;
507
- m[(D + E + m.length) % m.length]?.focus();
575
+ const x = [D, ...f.hidden ? [] : [f]].filter((G) => !G.disabled && !G.hidden);
576
+ if (x.length === 0) return;
577
+ const V = x.indexOf(r.activeElement), B = c.shiftKey ? -1 : 1;
578
+ x[(V + B + x.length) % x.length]?.focus();
508
579
  }
509
580
  });
510
- const A = async () => {
511
- f.disabled = !0, f.setAttribute("aria-busy", "true"), f.textContent = "正在打开…", C.textContent = "";
581
+ const P = async () => {
582
+ f.disabled = !0, f.setAttribute("aria-busy", "true"), f.textContent = "正在打开…", O.textContent = "";
512
583
  try {
513
- const s = await this.interaction.perform();
514
- if (w || this.interaction.signal?.aborted) {
515
- s.type !== "completed" && s.cancel();
584
+ const c = await this.interaction.perform();
585
+ if (E || this.interaction.signal?.aborted) {
586
+ c.type !== "completed" && c.cancel();
516
587
  return;
517
588
  }
518
- s.type === "frame" ? (p = s, c.dataset.frame = "true", S.src = s.url, S.focus(), await s.completion) : s.type === "external" && (p = s, await s.completion), I("acted");
519
- } catch (s) {
520
- if (w) return;
521
- p?.cancel(), p = null, c.dataset.frame = "false", S.removeAttribute("src"), C.textContent = te(s), f.hidden = !1, f.disabled = !1, f.removeAttribute("aria-busy"), f.textContent = d, f.focus();
589
+ c.type === "frame" ? (b = c, s.dataset.frame = "true", N.src = c.url, N.focus(), await c.completion) : c.type === "external" && (b = c, await c.completion), y("acted");
590
+ } catch (c) {
591
+ if (E) return;
592
+ b?.cancel(), b = null, s.dataset.frame = "false", N.removeAttribute("src"), O.textContent = ce(c), f.hidden = !1, f.disabled = !1, f.removeAttribute("aria-busy"), f.textContent = A, f.focus();
522
593
  }
523
594
  };
524
- f.addEventListener("click", A), queueMicrotask(() => f.focus());
595
+ f.addEventListener("click", P), queueMicrotask(() => f.focus());
525
596
  }
526
597
  }
527
- customElements.define(K, t);
598
+ customElements.define(q, t);
528
599
  }
529
- const re = async (t) => {
600
+ const de = async (t) => {
530
601
  if (typeof document > "u" || typeof customElements > "u" || t.signal?.aborted) return "dismissed";
531
- ie();
532
- const e = document.createElement(K);
602
+ le();
603
+ const e = document.createElement(q);
533
604
  e.interaction = t;
534
605
  const i = document.documentElement.style.overflow, r = document.activeElement instanceof HTMLElement ? document.activeElement : null;
535
606
  document.documentElement.style.overflow = "hidden", document.body.append(e);
536
607
  try {
537
- return await new Promise((c) => {
608
+ return await new Promise((s) => {
538
609
  e.addEventListener(
539
610
  "viceme:access-layer-close",
540
- (O) => c(O.detail),
611
+ (w) => s(w.detail),
541
612
  { once: !0 }
542
613
  );
543
614
  });
@@ -545,19 +616,19 @@ const re = async (t) => {
545
616
  e.remove(), document.documentElement.style.overflow = i, r?.focus();
546
617
  }
547
618
  };
548
- function k(t) {
619
+ function I(t) {
549
620
  if (typeof t != "object" || t === null) throw h();
550
621
  return t;
551
622
  }
552
623
  function h() {
553
- return new b({
624
+ return new v({
554
625
  code: "INTERNAL_ERROR",
555
626
  message: "Malformed public API response.",
556
627
  retryable: !0
557
628
  });
558
629
  }
559
- function ae(t) {
560
- const e = k(t);
630
+ function ue(t) {
631
+ const e = I(t);
561
632
  if (typeof e.id != "string" || !(typeof e.displayName == "string" || e.displayName === null) || !(typeof e.avatarUrl == "string" || e.avatarUrl === null))
562
633
  throw h();
563
634
  return {
@@ -566,11 +637,11 @@ function ae(t) {
566
637
  avatarUrl: e.avatarUrl
567
638
  };
568
639
  }
569
- function F(t) {
570
- const e = k(t);
640
+ function H(t) {
641
+ const e = I(t);
571
642
  if (typeof e.following != "boolean" || !(typeof e.followedAt == "string" || e.followedAt === null))
572
643
  throw h();
573
- const i = k(e.creator);
644
+ const i = I(e.creator);
574
645
  if (typeof i.displayName != "string" || !(typeof i.avatarUrl == "string" || i.avatarUrl === null) || !(typeof i.description == "string" || i.description === null) || !Number.isInteger(i.publishedWorkCount) || i.publishedWorkCount < 0)
575
646
  throw h();
576
647
  return {
@@ -585,8 +656,8 @@ function F(t) {
585
656
  }
586
657
  };
587
658
  }
588
- function ne(t) {
589
- const e = k(t), i = /* @__PURE__ */ new Set([
659
+ function fe(t) {
660
+ const e = I(t), i = /* @__PURE__ */ new Set([
590
661
  "PUBLIC",
591
662
  "OWNER",
592
663
  "FOLLOWING",
@@ -605,11 +676,11 @@ function ne(t) {
605
676
  nextAction: e.nextAction
606
677
  };
607
678
  }
608
- function oe(t) {
609
- const e = k(t);
679
+ function me(t) {
680
+ const e = I(t);
610
681
  if (typeof e.featureKey != "string" || !/^[a-z][a-z0-9_-]{1,63}$/.test(e.featureKey) || typeof e.title != "string" || e.title.trim().length === 0 || e.title.length > 120 || !(e.policyType === "PUBLIC" || e.policyType === "FOLLOW_OWNER" || e.policyType === "WORK_ENTITLEMENT"))
611
682
  throw h();
612
- const i = e.price === null ? null : k(e.price);
683
+ const i = e.price === null ? null : I(e.price);
613
684
  if (i !== null && (!Number.isInteger(i.amountCents) || i.amountCents <= 0 || i.currency !== "CNY") || e.policyType === "WORK_ENTITLEMENT" != (i !== null))
614
685
  throw h();
615
686
  return {
@@ -619,334 +690,349 @@ function oe(t) {
619
690
  price: i === null ? null : { amountCents: i.amountCents, currency: "CNY" }
620
691
  };
621
692
  }
622
- function se() {
693
+ function he() {
623
694
  const t = crypto.getRandomValues(new Uint8Array(32));
624
- return ce(t);
695
+ return pe(t);
625
696
  }
626
- function ce(t) {
697
+ function pe(t) {
627
698
  let e = "";
628
699
  for (const i of t) e += String.fromCharCode(i);
629
700
  return btoa(e).replaceAll("+", "-").replaceAll("/", "_").replace(/=+$/, "");
630
701
  }
631
- function le() {
702
+ function ye() {
632
703
  return typeof document < "u" && document.documentElement.lang.toLowerCase() === "en-us" ? "en-US" : "zh-CN";
633
704
  }
634
- function de(t) {
635
- const e = () => new b({
705
+ function we(t) {
706
+ const e = () => new v({
636
707
  code: "AUTH_CANCELLED",
637
708
  message: "The interactive action was cancelled.",
638
709
  retryable: !1
639
- }), i = (n) => {
640
- if (t.signal.aborted) return Promise.reject(v());
641
- let o;
642
- const l = new Promise((d, u) => {
643
- o = () => u(v()), t.signal.addEventListener("abort", o, { once: !0 }), t.signal.aborted && o();
710
+ }), i = (a) => {
711
+ if (t.signal.aborted) return Promise.reject(k());
712
+ let n;
713
+ const d = new Promise((l, g) => {
714
+ n = () => g(k()), t.signal.addEventListener("abort", n, { once: !0 }), t.signal.aborted && n();
644
715
  });
645
- let a;
716
+ let o;
646
717
  try {
647
- a = (t.presenter ?? re)({
648
- ...n,
718
+ o = (t.presenter ?? de)({
719
+ ...a,
649
720
  signal: t.signal
650
721
  });
651
- } catch (d) {
652
- a = Promise.reject(d);
722
+ } catch (l) {
723
+ o = Promise.reject(l);
653
724
  }
654
- return Promise.race([a, l]).then((d) => {
655
- if (t.signal.aborted) throw v();
656
- return d;
725
+ return Promise.race([o, d]).then((l) => {
726
+ if (t.signal.aborted) throw k();
727
+ return l;
657
728
  }).finally(() => {
658
- o && t.signal.removeEventListener("abort", o);
729
+ n && t.signal.removeEventListener("abort", n);
659
730
  });
660
- }, r = (n, o, l, a, d, u) => {
731
+ }, r = (a, n, d, o, l, g) => {
661
732
  if (typeof window > "u")
662
- throw new b({
733
+ throw new v({
663
734
  code: "CONFIG_INVALID",
664
735
  message: "Interactive access requires a browser window.",
665
736
  retryable: !1
666
737
  });
667
- let p = !0, w, I;
668
- const y = () => {
669
- p && (p = !1, window.removeEventListener("message", s));
670
- }, A = new Promise((g, m) => {
671
- w = g, I = m;
672
- }), s = (g) => {
673
- if (!p || g.origin !== o || typeof g.data != "object" || g.data === null) return;
674
- const m = g.data;
675
- if (!(m.workKey !== t.workKey || m.channel !== l)) {
676
- if (m.type === `viceme:${a}:ready`) {
677
- g.source && "postMessage" in g.source && g.source.postMessage(
738
+ let S = !0, A, m;
739
+ const p = () => {
740
+ S && (S = !1, window.removeEventListener("message", E));
741
+ }, b = new Promise((y, u) => {
742
+ A = y, m = u;
743
+ }), E = (y) => {
744
+ if (!S || y.origin !== n || typeof y.data != "object" || y.data === null) return;
745
+ const u = y.data;
746
+ if (!(u.workKey !== t.workKey || u.channel !== d)) {
747
+ if (u.type === `viceme:${o}:ready`) {
748
+ y.source && "postMessage" in y.source && y.source.postMessage(
678
749
  {
679
- type: `viceme:${a}:init`,
750
+ type: `viceme:${o}:init`,
680
751
  workKey: t.workKey,
681
- channel: l,
682
- ...d
752
+ channel: d,
753
+ ...l
683
754
  },
684
- o
755
+ n
685
756
  );
686
757
  return;
687
758
  }
688
- if (m.type === `viceme:${a}:cancelled`) {
689
- y(), I(e());
759
+ if (u.type === `viceme:${o}:cancelled`) {
760
+ p(), m(e());
690
761
  return;
691
762
  }
692
- m.type === `viceme:${a}:complete` && (y(), u(m).then(w, I));
763
+ u.type === `viceme:${o}:complete` && (p(), g(u).then(A, m));
693
764
  }
694
765
  };
695
- return window.addEventListener("message", s), {
766
+ return window.addEventListener("message", E), {
696
767
  type: "frame",
697
- url: n,
698
- completion: A,
768
+ url: a,
769
+ completion: b,
699
770
  cancel() {
700
- y(), w();
771
+ p(), A();
701
772
  }
702
773
  };
703
- }, c = async () => {
774
+ }, s = async () => {
704
775
  if (await t.ready(), typeof window > "u")
705
- throw new b({
776
+ throw new v({
706
777
  code: "CONFIG_INVALID",
707
778
  message: "Interactive access requires a browser window.",
708
779
  retryable: !1
709
780
  });
710
- const n = se(), o = new URL("/sdk/login", t.widgetOrigin);
711
- o.search = new URLSearchParams({
781
+ const a = he(), n = new URL("/sdk/login", t.widgetOrigin);
782
+ n.search = new URLSearchParams({
712
783
  workKey: t.workKey,
713
- channel: n,
784
+ channel: a,
714
785
  parentOrigin: window.location.origin,
715
- locale: le()
786
+ locale: ye()
716
787
  }).toString();
717
- const l = t.session.snapshot?.token;
718
- if (!l) throw h();
788
+ const d = t.session.snapshot?.token;
789
+ if (!d) throw h();
719
790
  return r(
720
- o.toString(),
791
+ n.toString(),
721
792
  t.widgetOrigin,
722
- n,
793
+ a,
723
794
  "auth",
724
- { workSessionToken: l },
725
- async (a) => {
726
- if (typeof a.userToken != "string")
795
+ { workSessionToken: d },
796
+ async (o) => {
797
+ if (typeof o.userToken != "string")
727
798
  throw h();
728
- t.session.authenticate({ userToken: a.userToken, user: ae(a.user) });
799
+ t.session.authenticate({ userToken: o.userToken, user: ue(o.user) });
729
800
  }
730
801
  );
731
- }, O = async () => (await t.ready(), F(
802
+ }, w = async () => (await t.ready(), H(
732
803
  (await t.session.request({ method: "GET", path: "/v1/public/work-sdk/follow" })).body
733
- )), f = async () => (await t.ready(), F(
804
+ )), f = async () => (await t.ready(), H(
734
805
  (await t.session.request({ method: "PUT", path: "/v1/public/work-sdk/follow" })).body
735
- )), U = {
806
+ )), L = () => {
807
+ const a = t.session.snapshot?.work;
808
+ return {
809
+ ...a?.creator ? {
810
+ followTarget: {
811
+ kind: "CREATOR",
812
+ displayName: a.creator.displayName,
813
+ avatarUrl: a.creator.avatarUrl,
814
+ description: null,
815
+ workCount: a.creator.publishedWorkCount
816
+ }
817
+ } : {},
818
+ ...a?.details ? { work: a.details } : {}
819
+ };
820
+ }, D = {
736
821
  async getState() {
737
822
  await t.ready();
738
- const n = t.session.snapshot?.user ?? null;
739
- return { authenticated: n !== null, user: n };
823
+ const a = t.session.snapshot?.user ?? null;
824
+ return { authenticated: a !== null, user: a };
740
825
  },
741
826
  async signIn() {
742
- if (await i({
827
+ if (await t.ready(), await i({
743
828
  featureKey: "auth",
744
829
  reason: "AUTH_REQUIRED",
745
830
  action: "SIGN_IN",
746
- perform: c
831
+ ...L(),
832
+ perform: s
747
833
  }) === "dismissed") throw e();
748
834
  return this.getState();
749
835
  },
750
836
  async signOut() {
751
837
  await t.ready(), await t.session.signOut();
752
838
  }
753
- }, N = {
754
- getState: O,
839
+ }, T = {
840
+ getState: w,
755
841
  follow: f,
756
842
  unfollow: async () => {
757
- throw new b({
843
+ throw new v({
758
844
  code: "CAPABILITY_DISABLED",
759
845
  message: "Unfollow is not exposed by website access.",
760
846
  retryable: !1
761
847
  });
762
848
  }
763
- }, T = async (n) => {
849
+ }, O = async (a) => {
764
850
  await t.ready();
765
- const o = k(
851
+ const n = I(
766
852
  (await t.session.request({
767
853
  method: "POST",
768
854
  path: "/v1/public/work-sdk/access/check",
769
- body: { featureKeys: n }
855
+ body: { featureKeys: a }
770
856
  })).body
771
- ), l = k(o.decisions);
857
+ ), d = I(n.decisions);
772
858
  return Object.fromEntries(
773
- Object.entries(l).map(([a, d]) => [a, ne(d)])
859
+ Object.entries(d).map(([o, l]) => [o, fe(l)])
774
860
  );
775
- }, C = async (n, o = {}) => {
861
+ }, N = async (a, n = {}) => {
776
862
  await t.ready();
777
- const l = {
778
- featureKey: n,
779
- locale: o.locale ?? "zh-CN"
780
- }, a = k(
863
+ const d = {
864
+ featureKey: a,
865
+ locale: n.locale ?? "zh-CN"
866
+ }, o = I(
781
867
  (await t.session.request({
782
868
  method: "POST",
783
869
  path: "/v1/public/work-sdk/checkout",
784
- body: l
870
+ body: d
785
871
  })).body
786
872
  );
787
- if (typeof a.checkoutUrl != "string" || typeof a.alreadyOwned != "boolean" || !(a.expiresAt === null || typeof a.expiresAt == "string" && !Number.isNaN(Date.parse(a.expiresAt))) || a.alreadyOwned !== (a.expiresAt === null))
873
+ if (typeof o.checkoutUrl != "string" || typeof o.alreadyOwned != "boolean" || !(o.expiresAt === null || typeof o.expiresAt == "string" && !Number.isNaN(Date.parse(o.expiresAt))) || o.alreadyOwned !== (o.expiresAt === null))
788
874
  throw h();
789
- let d;
875
+ let l;
790
876
  try {
791
- d = new URL(a.checkoutUrl);
877
+ l = new URL(o.checkoutUrl);
792
878
  } catch {
793
879
  throw h();
794
880
  }
795
- if (!a.alreadyOwned && (d.protocol !== "https:" || d.origin !== t.widgetOrigin))
881
+ if (!o.alreadyOwned && (l.protocol !== "https:" || l.origin !== t.widgetOrigin))
796
882
  throw h();
797
883
  return {
798
- checkoutUrl: a.checkoutUrl,
799
- alreadyOwned: a.alreadyOwned,
800
- expiresAt: a.expiresAt
884
+ checkoutUrl: o.checkoutUrl,
885
+ alreadyOwned: o.alreadyOwned,
886
+ expiresAt: o.expiresAt
801
887
  };
802
- }, S = (n, o) => {
803
- if (n.alreadyOwned) return { type: "completed" };
804
- const l = Date.parse(n.expiresAt);
888
+ }, U = (a, n) => {
889
+ if (a.alreadyOwned) return { type: "completed" };
890
+ const d = Date.parse(a.expiresAt);
805
891
  if (typeof window > "u")
806
- throw new b({
892
+ throw new v({
807
893
  code: "CONFIG_INVALID",
808
894
  message: "Hosted checkout requires a browser window.",
809
895
  retryable: !1
810
896
  });
811
- let a = !0, d, u, p, w;
812
- const I = new Promise((E, _) => {
813
- p = E, w = _;
814
- }), y = () => {
815
- d && clearTimeout(d), u && clearTimeout(u), document.removeEventListener("visibilitychange", m);
816
- }, A = () => {
817
- a && (a = !1, y(), w(
818
- new b({
897
+ let o = !0, l, g, S, A;
898
+ const m = new Promise((c, F) => {
899
+ S = c, A = F;
900
+ }), p = () => {
901
+ l && clearTimeout(l), g && clearTimeout(g), document.removeEventListener("visibilitychange", u);
902
+ }, b = () => {
903
+ o && (o = !1, p(), A(
904
+ new v({
819
905
  code: "SESSION_EXPIRED",
820
906
  message: "Hosted checkout session expired.",
821
907
  retryable: !0
822
908
  })
823
909
  ));
824
- }, s = () => {
825
- if (!a || document.visibilityState === "hidden") return;
826
- const E = l - t.now();
827
- if (E <= 0) {
828
- A();
910
+ }, E = () => {
911
+ if (!o || document.visibilityState === "hidden") return;
912
+ const c = d - t.now();
913
+ if (c <= 0) {
914
+ b();
829
915
  return;
830
916
  }
831
- d = setTimeout(() => {
832
- g();
833
- }, Math.min(1500, E));
834
- }, g = async () => {
835
- if (a)
917
+ l = setTimeout(() => {
918
+ y();
919
+ }, Math.min(1500, c));
920
+ }, y = async () => {
921
+ if (o)
836
922
  try {
837
- const E = (await T([o]))[o];
838
- if (!E) throw h();
839
- if (E.allowed) {
840
- a = !1, y(), p();
923
+ const c = (await O([n]))[n];
924
+ if (!c) throw h();
925
+ if (c.allowed) {
926
+ o = !1, p(), S();
841
927
  return;
842
928
  }
843
- s();
844
- } catch (E) {
845
- a = !1, y(), w(E);
929
+ E();
930
+ } catch (c) {
931
+ o = !1, p(), A(c);
846
932
  }
847
933
  };
848
- function m() {
849
- if (a) {
934
+ function u() {
935
+ if (o) {
850
936
  if (document.visibilityState === "hidden") {
851
- d && clearTimeout(d), d = void 0;
937
+ l && clearTimeout(l), l = void 0;
852
938
  return;
853
939
  }
854
- s();
940
+ E();
855
941
  }
856
942
  }
857
- document.addEventListener("visibilitychange", m);
858
- const D = l - t.now();
859
- return D <= 0 ? A() : (u = setTimeout(A, D), s()), {
943
+ document.addEventListener("visibilitychange", u);
944
+ const P = d - t.now();
945
+ return P <= 0 ? b() : (g = setTimeout(b, P), E()), {
860
946
  type: "frame",
861
- url: n.checkoutUrl,
862
- completion: I,
947
+ url: a.checkoutUrl,
948
+ completion: m,
863
949
  cancel() {
864
- a && (a = !1, y(), p());
950
+ o && (o = !1, p(), S());
865
951
  }
866
952
  };
867
953
  };
868
- return { auth: U, follow: N, access: {
954
+ return { auth: D, follow: T, access: {
869
955
  async getFeatures() {
870
956
  await t.ready();
871
- const n = k(
957
+ const a = I(
872
958
  (await t.session.request({
873
959
  method: "GET",
874
960
  path: "/v1/public/work-sdk/access/features"
875
961
  })).body
876
962
  );
877
- if (!Array.isArray(n.features) || n.features.length > 100)
963
+ if (!Array.isArray(a.features) || a.features.length > 100)
878
964
  throw h();
879
- return n.features.map(oe);
965
+ return a.features.map(me);
880
966
  },
881
- async check(n) {
882
- const l = (await T([n]))[n];
883
- if (!l) throw h();
884
- return l;
967
+ async check(a) {
968
+ const d = (await O([a]))[a];
969
+ if (!d) throw h();
970
+ return d;
885
971
  },
886
- checkMany: T,
887
- async require(n) {
888
- let o = await this.check(n);
889
- for (let l = 0; !o.allowed && o.nextAction && l < 3; l += 1) {
890
- const a = o.nextAction, d = a === "FOLLOW" ? (await N.getState()).target : void 0, u = a === "CHECKOUT" ? await C(n) : void 0;
891
- if (u?.alreadyOwned) {
892
- o = await this.check(n);
972
+ checkMany: O,
973
+ async require(a) {
974
+ let n = await this.check(a);
975
+ for (let d = 0; !n.allowed && n.nextAction && d < 3; d += 1) {
976
+ const o = n.nextAction, l = o === "FOLLOW" ? (await T.getState()).target : void 0, g = o === "CHECKOUT" ? await N(a) : void 0;
977
+ if (g?.alreadyOwned) {
978
+ n = await this.check(a);
893
979
  continue;
894
980
  }
895
981
  if (await i({
896
- featureKey: n,
897
- reason: o.reason,
898
- action: a,
899
- ...d ? { followTarget: d } : {},
900
- perform: async () => a === "SIGN_IN" ? c() : a === "FOLLOW" ? (await N.follow(), { type: "completed" }) : S(u, n)
901
- }) === "dismissed") return o;
902
- o = await this.check(n);
982
+ featureKey: a,
983
+ reason: n.reason,
984
+ action: o,
985
+ ...o === "SIGN_IN" ? L() : l ? { followTarget: l } : {},
986
+ perform: async () => o === "SIGN_IN" ? s() : o === "FOLLOW" ? (await T.follow(), { type: "completed" }) : U(g, a)
987
+ }) === "dismissed") return n;
988
+ n = await this.check(a);
903
989
  }
904
- return o;
990
+ return n;
905
991
  },
906
992
  async refresh() {
907
993
  await t.ready();
908
994
  }
909
995
  }, checkout: {
910
- async open(n) {
911
- const o = await C(n.featureKey, n);
912
- if (o.alreadyOwned) return o;
996
+ async open(a) {
997
+ const n = await N(a.featureKey, a);
998
+ if (n.alreadyOwned) return n;
913
999
  if (await i({
914
- featureKey: n.featureKey,
1000
+ featureKey: a.featureKey,
915
1001
  reason: "PURCHASE_REQUIRED",
916
1002
  action: "CHECKOUT",
917
- perform: async () => S(o, n.featureKey)
1003
+ perform: async () => U(n, a.featureKey)
918
1004
  }) === "dismissed") throw e();
919
- return o;
1005
+ return n;
920
1006
  }
921
1007
  } };
922
1008
  }
923
- class ue extends DOMException {
1009
+ class ge extends DOMException {
924
1010
  constructor() {
925
1011
  super("ViceMe client destroyed.", "AbortError");
926
1012
  }
927
1013
  }
928
- class we {
929
- #e = new Q();
1014
+ class Ie {
1015
+ #e = new re();
930
1016
  #t;
931
1017
  #i;
932
1018
  #r = new AbortController();
933
- #n;
1019
+ #o;
934
1020
  auth;
935
1021
  access;
936
1022
  checkout;
937
1023
  /** Detaches the caller-signal listener; undefined when none was attached. */
938
1024
  #a;
939
1025
  constructor(e) {
940
- this.#i = e.config, this.#t = new Z({
1026
+ this.#i = e.config, this.#t = new ne({
941
1027
  workKey: e.config.workKey,
942
1028
  transport: e.transport,
943
1029
  signal: this.#r.signal,
944
1030
  ...e.now !== void 0 ? { now: e.now } : {}
945
1031
  });
946
- const i = de({
1032
+ const i = we({
947
1033
  session: this.#t,
948
1034
  workKey: e.config.workKey,
949
- widgetOrigin: j[e.config.region],
1035
+ widgetOrigin: $[e.config.region],
950
1036
  now: e.now ?? (() => Date.now()),
951
1037
  presenter: e.presenter,
952
1038
  signal: this.#r.signal,
@@ -955,18 +1041,18 @@ class we {
955
1041
  this.auth = i.auth, this.access = i.access, this.checkout = i.checkout;
956
1042
  const r = e.config.signal;
957
1043
  if (r) {
958
- const c = () => {
1044
+ const s = () => {
959
1045
  this.#r.abort(
960
1046
  r.reason instanceof Error ? r.reason : new DOMException("Caller signal aborted.", "AbortError")
961
1047
  );
962
1048
  };
963
- r.aborted ? c() : (r.addEventListener("abort", c, { once: !0 }), this.#a = () => {
964
- r.removeEventListener("abort", c);
1049
+ r.aborted ? s() : (r.addEventListener("abort", s, { once: !0 }), this.#a = () => {
1050
+ r.removeEventListener("abort", s);
965
1051
  });
966
1052
  }
967
1053
  }
968
1054
  get version() {
969
- return W;
1055
+ return Q;
970
1056
  }
971
1057
  get workKey() {
972
1058
  return this.#i.workKey;
@@ -979,18 +1065,18 @@ class we {
979
1065
  }
980
1066
  /** Internal: public API major, used by the loader registry namespace. */
981
1067
  get apiMajor() {
982
- return H;
1068
+ return X;
983
1069
  }
984
1070
  ready() {
985
- return this.#e.destroyed ? Promise.reject(v()) : (this.#n || (this.#e.transition("READY"), this.#n = Promise.resolve()), this.#n);
1071
+ return this.#e.destroyed ? Promise.reject(k()) : (this.#o || (this.#e.transition("READY"), this.#o = Promise.resolve()), this.#o);
986
1072
  }
987
1073
  async #s() {
988
- if (this.#e.destroyed) throw v();
1074
+ if (this.#e.destroyed) throw k();
989
1075
  await this.ready();
990
1076
  try {
991
- if (await this.#t.establish(), this.#e.destroyed) throw v();
1077
+ if (await this.#t.establish(), this.#e.destroyed) throw k();
992
1078
  } catch (e) {
993
- throw this.#e.destroyed ? v() : (this.#t.invalidate(), e);
1079
+ throw this.#e.destroyed ? k() : (this.#t.invalidate(), e);
994
1080
  }
995
1081
  }
996
1082
  hasCapability(e) {
@@ -1014,14 +1100,14 @@ class we {
1014
1100
  return this.#t.snapshot;
1015
1101
  }
1016
1102
  destroy() {
1017
- this.#e.destroyed || (this.#e.transition("DESTROYED"), this.#r.abort(new ue()), this.#t.destroy(), this.#e.clearListeners(), this.#n = void 0, this.#a?.(), this.#a = void 0);
1103
+ this.#e.destroyed || (this.#e.transition("DESTROYED"), this.#r.abort(new ge()), this.#t.destroy(), this.#e.clearListeners(), this.#o = void 0, this.#a?.(), this.#a = void 0);
1018
1104
  }
1019
1105
  }
1020
1106
  export {
1021
- we as V,
1022
- Y as a,
1023
- B as i,
1024
- pe as r,
1025
- ye as v
1107
+ Ie as V,
1108
+ te as a,
1109
+ ee as i,
1110
+ Ee as r,
1111
+ Se as v
1026
1112
  };
1027
- //# sourceMappingURL=client-DEg6YouY.js.map
1113
+ //# sourceMappingURL=client-C1Sw400H.js.map