@viceme-ai/sdk 0.2.0 → 0.3.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 (44) hide show
  1. package/README.md +49 -45
  2. package/dist/chunks/client-DKsaEtwq.js +941 -0
  3. package/dist/chunks/client-DKsaEtwq.js.map +1 -0
  4. package/dist/chunks/version-C3KVoLNb.js +51 -0
  5. package/dist/chunks/version-C3KVoLNb.js.map +1 -0
  6. package/dist/core/build-endpoints.d.ts +4 -1
  7. package/dist/core/build-endpoints.d.ts.map +1 -1
  8. package/dist/core/capabilities.d.ts +79 -0
  9. package/dist/core/capabilities.d.ts.map +1 -0
  10. package/dist/core/client.d.ts +34 -8
  11. package/dist/core/client.d.ts.map +1 -1
  12. package/dist/core/config.d.ts +14 -4
  13. package/dist/core/config.d.ts.map +1 -1
  14. package/dist/core/errors.d.ts +1 -1
  15. package/dist/core/errors.d.ts.map +1 -1
  16. package/dist/core/lifecycle.d.ts +4 -2
  17. package/dist/core/lifecycle.d.ts.map +1 -1
  18. package/dist/core/presentation.d.ts +24 -0
  19. package/dist/core/presentation.d.ts.map +1 -0
  20. package/dist/danmaku.js +44 -48
  21. package/dist/danmaku.js.map +1 -1
  22. package/dist/generated/public-contract.d.ts +617 -13
  23. package/dist/generated/public-contract.d.ts.map +1 -1
  24. package/dist/index.d.ts +8 -4
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +112 -95
  27. package/dist/index.js.map +1 -1
  28. package/dist/manifest.json +30 -18
  29. package/dist/session/session.d.ts +67 -0
  30. package/dist/session/session.d.ts.map +1 -0
  31. package/dist/testing/test-adapter.d.ts +59 -0
  32. package/dist/testing/test-adapter.d.ts.map +1 -0
  33. package/dist/testing.d.ts +9 -0
  34. package/dist/testing.d.ts.map +1 -0
  35. package/dist/testing.js +75 -0
  36. package/dist/testing.js.map +1 -0
  37. package/dist/transport/transport.d.ts +44 -0
  38. package/dist/transport/transport.d.ts.map +1 -0
  39. package/dist/version.d.ts +1 -1
  40. package/dist/viceme.min.js +232 -1
  41. package/dist/viceme.min.js.map +1 -1
  42. package/package.json +6 -2
  43. package/dist/chunks/version-BbUa2jZV.js +0 -38
  44. package/dist/chunks/version-BbUa2jZV.js.map +0 -1
@@ -0,0 +1,75 @@
1
+ import { c as s } from "./chunks/version-C3KVoLNb.js";
2
+ import { i as w, a as u, V as f } from "./chunks/client-DKsaEtwq.js";
3
+ function g(e) {
4
+ const i = [], o = [...e.sessionFailures ?? []], a = e.latencyMs ?? 0;
5
+ return {
6
+ requests: i,
7
+ async request(t) {
8
+ if (t.signal?.aborted)
9
+ throw new DOMException("Aborted", "AbortError");
10
+ if (i.push(t), await new Promise((r, n) => {
11
+ const c = t.signal, l = setTimeout(() => r(), a);
12
+ c?.addEventListener(
13
+ "abort",
14
+ () => {
15
+ clearTimeout(l), n(new DOMException("Aborted", "AbortError"));
16
+ },
17
+ { once: !0 }
18
+ );
19
+ }), t.path === "/v1/public/v1/work-sessions" && t.method === "POST") {
20
+ const r = o.shift();
21
+ if (r) {
22
+ if (r instanceof Error) throw r;
23
+ return {
24
+ status: r.status,
25
+ body: {
26
+ error: { code: r.code, message: r.message ?? "Simulated failure." }
27
+ }
28
+ };
29
+ }
30
+ return {
31
+ status: 201,
32
+ body: {
33
+ work: { key: e.work.key, capabilities: [...e.work.capabilities] },
34
+ ...e.work.token !== void 0 ? { token: e.work.token } : {},
35
+ ...e.work.expiresAt !== void 0 ? { expiresAt: e.work.expiresAt } : {}
36
+ },
37
+ requestId: `test-${i.length}`
38
+ };
39
+ }
40
+ return {
41
+ status: 404,
42
+ body: { error: { code: "CONFIG_INVALID", message: `No fixture for ${t.path}.` } }
43
+ };
44
+ }
45
+ };
46
+ }
47
+ function m(e) {
48
+ if (!w(e.workKey))
49
+ throw s('Test client requires a valid workKey ("wrk_…").');
50
+ if (!u(e.region))
51
+ throw s('Test client requires region "cn" or "global".');
52
+ if (typeof e.transport?.request != "function")
53
+ throw s("Test client requires a transport with a request() method.");
54
+ return new f({
55
+ config: {
56
+ workKey: e.workKey,
57
+ region: e.region,
58
+ signal: e.signal
59
+ },
60
+ transport: e.transport,
61
+ presenter: e.presenter,
62
+ ...e.now !== void 0 ? { now: e.now } : {}
63
+ });
64
+ }
65
+ const y = {
66
+ key: "wrk_test",
67
+ capabilities: ["fixture"],
68
+ token: "test-session-token"
69
+ };
70
+ export {
71
+ y as FIXTURE_WORK,
72
+ g as createMemoryTransport,
73
+ m as createTestViceMe
74
+ };
75
+ //# sourceMappingURL=testing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"testing.js","sources":["../src/testing/test-adapter.ts"],"sourcesContent":["/**\n * `@viceme-ai/sdk/testing` — explicit test adapter.\n *\n * Deterministic fixture helpers for SDK consumers and capability authors.\n * This code must never be imported from production core, loader, or capability\n * bundles; it is excluded from them at build time and only exported via the\n * `./testing` subpath.\n *\n * The test client runs the exact same config, lifecycle, error, and contract\n * validation as production `createViceMe()` — it is not a bypass mock.\n */\n\nimport { configInvalid } from '../core/errors.ts';\nimport { isValidWorkKey, isValidRegion } from '../core/config.ts';\nimport { ViceMeClientImpl } from '../core/client.ts';\nimport type { ViceMeClient } from '../core/client.ts';\nimport type { ViceMeRegion } from '../core/config.ts';\nimport type { AccessPresenter } from '../core/presentation.ts';\nimport type { Transport, TransportRequest, TransportResponse } from '../transport/transport.ts';\n\nexport interface MemoryTransportWorkFixture {\n key: string;\n capabilities: string[];\n token?: string;\n expiresAt?: number;\n}\n\nexport interface MemoryTransportOptions {\n /** Work descriptor served for `POST /v1/public/v1/work-sessions`. */\n work: MemoryTransportWorkFixture;\n /** Artificial response latency in milliseconds (default 0). */\n latencyMs?: number;\n /**\n * Queue of failures thrown before the fixture response is served; each\n * entry is consumed by one session request. Use for retry/timeout tests.\n */\n sessionFailures?: Array<Error | { status: number; code: string; message?: string }>;\n}\n\nexport interface MemoryTransport extends Transport {\n /** Every request seen so far, for assertions. */\n readonly requests: TransportRequest[];\n}\n\nexport function createMemoryTransport(options: MemoryTransportOptions): MemoryTransport {\n const requests: TransportRequest[] = [];\n const failures = [...(options.sessionFailures ?? [])];\n const latencyMs = options.latencyMs ?? 0;\n\n return {\n requests,\n async request(request: TransportRequest): Promise<TransportResponse> {\n // A pre-aborted signal never counts as an issued request.\n if (request.signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n requests.push(request);\n await new Promise<void>((resolve, reject) => {\n const signal = request.signal;\n const timer = setTimeout(() => resolve(), latencyMs);\n signal?.addEventListener(\n 'abort',\n () => {\n clearTimeout(timer);\n reject(new DOMException('Aborted', 'AbortError'));\n },\n { once: true },\n );\n });\n if (request.path === '/v1/public/v1/work-sessions' && request.method === 'POST') {\n const failure = failures.shift();\n if (failure) {\n if (failure instanceof Error) throw failure;\n return {\n status: failure.status,\n body: {\n error: { code: failure.code, message: failure.message ?? 'Simulated failure.' },\n },\n };\n }\n return {\n status: 201,\n body: {\n work: { key: options.work.key, capabilities: [...options.work.capabilities] },\n ...(options.work.token !== undefined ? { token: options.work.token } : {}),\n ...(options.work.expiresAt !== undefined ? { expiresAt: options.work.expiresAt } : {}),\n },\n requestId: `test-${requests.length}`,\n };\n }\n return {\n status: 404,\n body: { error: { code: 'CONFIG_INVALID', message: `No fixture for ${request.path}.` } },\n };\n },\n };\n}\n\nexport interface CreateTestViceMeOptions {\n workKey: string;\n region: ViceMeRegion;\n /** Mock transport serving the fixture contract. */\n transport: Transport;\n signal?: AbortSignal;\n presenter?: AccessPresenter;\n /** Stable virtual clock for deterministic time-based assertions. */\n now?: () => number;\n}\n\n/**\n * Create a client backed by an injected transport. Runs identical validation\n * and lifecycle logic to `createViceMe()`.\n */\nexport function createTestViceMe(options: CreateTestViceMeOptions): ViceMeClient {\n if (!isValidWorkKey(options.workKey)) {\n throw configInvalid('Test client requires a valid workKey (\"wrk_…\").');\n }\n if (!isValidRegion(options.region)) {\n throw configInvalid('Test client requires region \"cn\" or \"global\".');\n }\n if (typeof options.transport?.request !== 'function') {\n throw configInvalid('Test client requires a transport with a request() method.');\n }\n return new ViceMeClientImpl({\n config: {\n workKey: options.workKey,\n region: options.region,\n signal: options.signal,\n },\n transport: options.transport,\n presenter: options.presenter,\n ...(options.now !== undefined ? { now: options.now } : {}),\n });\n}\n\n/** Standard fixture work used across repo tests and examples. */\nexport const FIXTURE_WORK: MemoryTransportWorkFixture = {\n key: 'wrk_test',\n capabilities: ['fixture'],\n token: 'test-session-token',\n};\n"],"names":["createMemoryTransport","options","requests","failures","latencyMs","request","resolve","reject","signal","timer","failure","createTestViceMe","isValidWorkKey","configInvalid","isValidRegion","ViceMeClientImpl","FIXTURE_WORK"],"mappings":";;AA4CO,SAASA,EAAsBC,GAAkD;AACtF,QAAMC,IAA+B,CAAA,GAC/BC,IAAW,CAAC,GAAIF,EAAQ,mBAAmB,CAAA,CAAG,GAC9CG,IAAYH,EAAQ,aAAa;AAEvC,SAAO;AAAA,IACL,UAAAC;AAAA,IACA,MAAM,QAAQG,GAAuD;AAEnE,UAAIA,EAAQ,QAAQ;AAClB,cAAM,IAAI,aAAa,WAAW,YAAY;AAehD,UAbAH,EAAS,KAAKG,CAAO,GACrB,MAAM,IAAI,QAAc,CAACC,GAASC,MAAW;AAC3C,cAAMC,IAASH,EAAQ,QACjBI,IAAQ,WAAW,MAAMH,EAAA,GAAWF,CAAS;AACnD,QAAAI,GAAQ;AAAA,UACN;AAAA,UACA,MAAM;AACJ,yBAAaC,CAAK,GAClBF,EAAO,IAAI,aAAa,WAAW,YAAY,CAAC;AAAA,UAClD;AAAA,UACA,EAAE,MAAM,GAAA;AAAA,QAAK;AAAA,MAEjB,CAAC,GACGF,EAAQ,SAAS,iCAAiCA,EAAQ,WAAW,QAAQ;AAC/E,cAAMK,IAAUP,EAAS,MAAA;AACzB,YAAIO,GAAS;AACX,cAAIA,aAAmB,MAAO,OAAMA;AACpC,iBAAO;AAAA,YACL,QAAQA,EAAQ;AAAA,YAChB,MAAM;AAAA,cACJ,OAAO,EAAE,MAAMA,EAAQ,MAAM,SAASA,EAAQ,WAAW,qBAAA;AAAA,YAAqB;AAAA,UAChF;AAAA,QAEJ;AACA,eAAO;AAAA,UACL,QAAQ;AAAA,UACR,MAAM;AAAA,YACJ,MAAM,EAAE,KAAKT,EAAQ,KAAK,KAAK,cAAc,CAAC,GAAGA,EAAQ,KAAK,YAAY,EAAA;AAAA,YAC1E,GAAIA,EAAQ,KAAK,UAAU,SAAY,EAAE,OAAOA,EAAQ,KAAK,MAAA,IAAU,CAAA;AAAA,YACvE,GAAIA,EAAQ,KAAK,cAAc,SAAY,EAAE,WAAWA,EAAQ,KAAK,cAAc,CAAA;AAAA,UAAC;AAAA,UAEtF,WAAW,QAAQC,EAAS,MAAM;AAAA,QAAA;AAAA,MAEtC;AACA,aAAO;AAAA,QACL,QAAQ;AAAA,QACR,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,SAAS,kBAAkBG,EAAQ,IAAI,IAAA,EAAI;AAAA,MAAE;AAAA,IAE1F;AAAA,EAAA;AAEJ;AAiBO,SAASM,EAAiBV,GAAgD;AAC/E,MAAI,CAACW,EAAeX,EAAQ,OAAO;AACjC,UAAMY,EAAc,iDAAiD;AAEvE,MAAI,CAACC,EAAcb,EAAQ,MAAM;AAC/B,UAAMY,EAAc,+CAA+C;AAErE,MAAI,OAAOZ,EAAQ,WAAW,WAAY;AACxC,UAAMY,EAAc,2DAA2D;AAEjF,SAAO,IAAIE,EAAiB;AAAA,IAC1B,QAAQ;AAAA,MACN,SAASd,EAAQ;AAAA,MACjB,QAAQA,EAAQ;AAAA,MAChB,QAAQA,EAAQ;AAAA,IAAA;AAAA,IAElB,WAAWA,EAAQ;AAAA,IACnB,WAAWA,EAAQ;AAAA,IACnB,GAAIA,EAAQ,QAAQ,SAAY,EAAE,KAAKA,EAAQ,QAAQ,CAAA;AAAA,EAAC,CACzD;AACH;AAGO,MAAMe,IAA2C;AAAA,EACtD,KAAK;AAAA,EACL,cAAc,CAAC,SAAS;AAAA,EACxB,OAAO;AACT;"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * HTTP transport for the public API.
3
+ *
4
+ * Responsibilities: request execution with timeout, abort, client request ids,
5
+ * and normalization of every failure into the public `ViceMeError` model.
6
+ * Capabilities and the loader never build their own `fetch` calls — they go
7
+ * through a Transport so tests can swap in `createMemoryTransport`.
8
+ */
9
+ export interface TransportRequest {
10
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
11
+ /** Absolute path under the public API base, e.g. `/v1/public/v1/work-sessions`. */
12
+ path: string;
13
+ /** JSON-serializable request body. */
14
+ body?: unknown;
15
+ /** Work-session token. It is never persisted by the transport. */
16
+ authorization?: string;
17
+ signal?: AbortSignal;
18
+ /** Per-request timeout; defaults to the transport default. */
19
+ timeoutMs?: number;
20
+ }
21
+ export interface TransportResponse {
22
+ status: number;
23
+ body?: unknown;
24
+ /** Echoed server request id, when provided. */
25
+ requestId?: string;
26
+ }
27
+ export interface Transport {
28
+ request(request: TransportRequest): Promise<TransportResponse>;
29
+ }
30
+ export interface FetchTransportOptions {
31
+ apiBaseUrl: string;
32
+ /** Injectable for tests; defaults to global `fetch`. */
33
+ fetchImpl?: typeof fetch;
34
+ defaultTimeoutMs?: number;
35
+ /** Injectable id generator (default: `crypto.randomUUID`). */
36
+ generateRequestId?: () => string;
37
+ }
38
+ export declare class FetchTransport implements Transport {
39
+ #private;
40
+ constructor(options: FetchTransportOptions);
41
+ request(request: TransportRequest): Promise<TransportResponse>;
42
+ }
43
+ export declare function createFetchTransport(options: FetchTransportOptions): Transport;
44
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;IAC1C,mFAAmF;IACnF,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kEAAkE;IAClE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,iBAAiB,CAAC,EAAE,MAAM,MAAM,CAAC;CAClC;AAqED,qBAAa,cAAe,YAAW,SAAS;;gBAMlC,OAAO,EAAE,qBAAqB;IAOpC,OAAO,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAuGrE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,qBAAqB,GAAG,SAAS,CAE9E"}
package/dist/version.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * Kept in sync with `packages/sdk/package.json#version`; a unit test enforces
5
5
  * the match so the loader, release manifest, and npm metadata can never drift.
6
6
  */
7
- export declare const SDK_VERSION = "0.2.0";
7
+ export declare const SDK_VERSION = "0.3.0";
8
8
  /** Public API major carried by this build (loader namespace `v1`). */
9
9
  export declare const API_MAJOR = 1;
10
10
  //# sourceMappingURL=version.d.ts.map
@@ -1,2 +1,233 @@
1
- (function(){"use strict";const O=new Set(["INTERNAL_ERROR"]);class y extends Error{code;retryable;requestId;capability;constructor(e){super(e.message),this.name="ViceMeError",this.code=e.code,this.retryable=e.retryable??O.has(e.code),this.requestId=e.requestId,this.capability=e.capability}toJSON(){const e={code:this.code,retryable:this.retryable};return this.requestId!==void 0&&(e.requestId=this.requestId),this.capability!==void 0&&(e.capability=this.capability),e}}function ae(t){return t instanceof y}function c(t){return new y({code:"CONFIG_INVALID",message:t,retryable:!1})}function p(){return new y({code:"CLIENT_DESTROYED",message:"ViceMe client has been destroyed.",retryable:!1})}const M=new Set(["cn","global"]);function R(t){return typeof t=="string"&&/^wrk_[A-Za-z0-9_-]{4,124}$/.test(t)}function k(t){return typeof t=="string"&&M.has(t)}function _(t){if(typeof t!="object"||t===null)throw c("createViceMe expects a configuration object.");const e=t,r=new Set(["workKey","region"]);for(const i of Object.keys(e))if(!r.has(i))throw c(`Unknown configuration field "${i}".`);if(!R(e.workKey))throw c('Configuration field "workKey" must be a public work key ("wrk_…").');if(!k(e.region))throw c('Configuration field "region" must be "cn" or "global".');return{workKey:e.workKey,region:e.region}}const N=new Set(["data-viceme-work","data-viceme-region","data-viceme-features","data-viceme-target","data-viceme-theme","data-viceme-loader"]),$=new Set(["light","dark","auto"]);function j(t){for(const a of t.getAttributeNames())if(a.startsWith("data-viceme-")&&!N.has(a))throw c(`Unknown loader attribute "${a}".`);const e=t.getAttribute("data-viceme-work");if(!R(e))throw c('Loader attribute "data-viceme-work" must be a public work key ("wrk_…").');const r=t.getAttribute("data-viceme-region");if(!k(r))throw c('Loader attribute "data-viceme-region" must be "cn" or "global".');if(t.getAttribute("data-viceme-features")!=="danmaku")throw c('Loader attribute "data-viceme-features" must be exactly "danmaku".');const d=["danmaku"],o=t.getAttribute("data-viceme-target");if(o==="")throw c('Loader attribute "data-viceme-target" must be a CSS selector.');if(o===null)throw c('Loader attribute "data-viceme-target" is required when features are declared.');try{t.matches(o)}catch{throw c('Loader attribute "data-viceme-target" is not a valid CSS selector.')}const n=t.getAttribute("data-viceme-theme");if(n!==null&&!$.has(n))throw c('Loader attribute "data-viceme-theme" must be "light", "dark", or "auto".');return{workKey:e,region:r,features:d,target:o,theme:n??"auto"}}function b(t,e,r){return`v${t}+${e}+${r}`}class q{#e=new Map;#t=new Map;#r=new Map;#n=0;getClient(e){return this.#e.get(e)}registerClient(e){this.#e.set(e.clientKey,e)}unregisterClient(e){this.#e.delete(e)}getInstance(e){return this.#t.get(e)}findInstance(e,r,i){return this.#r.get(`${e}::${r}`)?.get(i)}registerInstance(e,r,i,d){const o=`${e}::${r}`;let n=this.#r.get(o);n===void 0&&(n=new WeakMap,this.#r.set(o,n));const a=n.get(i);if(a)return a;this.#n+=1;const l={instanceKey:`${e}::${r}::el${this.#n}`,clientKey:e,capability:r,host:i,raw:d,destroyed:!1};return this.#t.set(l.instanceKey,l),n.set(i,l),l}removeInstance(e){const r=this.#t.get(e);if(r)return this.#t.delete(e),this.#r.get(`${r.clientKey}::${r.capability}`)?.delete(r.host),r}instancesForClient(e){return[...this.#t.values()].filter(r=>r.clientKey===e)}}const Y=new Map([["viceme:ready",new Set(["clientKey","workKey","capabilities","version"])],["viceme:capability-ready",new Set(["clientKey","instanceKey","capability","version"])],["viceme:error",new Set(["clientKey","instanceKey","capability","code","retryable","requestId"])],["viceme:destroyed",new Set(["clientKey","instanceKey","capability"])]]);function V(t,e){const r=Y.get(t),i={};for(const[d,o]of Object.entries(e))r.has(d)&&o!==void 0&&(i[d]=o);return i}function h(t,e,r){const i=new CustomEvent(e,{detail:V(e,r),bubbles:!0,composed:!0,cancelable:!1});t.dispatchEvent(i)}const P={CREATED:["READY","DESTROYED"],READY:["DEGRADED","DESTROYED"],DEGRADED:["DESTROYED"],DESTROYED:[]};class U{#e="CREATED";#t=new Set;get state(){return this.#e}get destroyed(){return this.#e==="DESTROYED"}transition(e){if(e!==this.#e){if(!P[this.#e].includes(e))throw new y({code:"INTERNAL_ERROR",message:`Illegal lifecycle transition ${this.#e} -> ${e}.`,retryable:!1});this.#e=e;for(const r of this.#t)r(e)}}assertAlive(){if(this.destroyed)throw p()}subscribe(e){return this.#t.add(e),()=>{this.#t.delete(e)}}clearListeners(){this.#t.clear()}}const w=Symbol("ViceMeClient.markDegraded");function D(t){w in t&&t[w]()}class F{#e=new U;#t;#r;constructor(e){this.#t=e}get workKey(){return this.#t.workKey}get region(){return this.#t.region}get state(){return this.#e.state}ready(){return this.#e.destroyed?Promise.reject(p()):(this.#r||(this.#e.transition("READY"),this.#r=Promise.resolve()),this.#r)}hasCapability(e){return!this.#e.destroyed&&e==="danmaku"}[w](){this.#e.state==="READY"&&this.#e.transition("DEGRADED")}destroy(){this.#e.destroyed||(this.#e.transition("DESTROYED"),this.#e.clearListeners(),this.#r=void 0)}}const B="0.2.0",g=1;function W(t){const e=_(t);return new F(e)}const G=8e3,x="danmaku.js",A=Symbol.for("viceme.loader.state.v1");function u(){const e=globalThis[A];if(e)return e;const r={registry:new q,queue:{current:Promise.resolve()}};return Object.defineProperty(globalThis,A,{value:r,writable:!0,configurable:!0,enumerable:!1}),r}function E(t){if(!t.destroyed){t.destroyed=!0,u().registry.removeInstance(t.instanceKey);try{t.raw.destroy()}finally{h(t.host,"viceme:destroyed",{clientKey:t.clientKey,instanceKey:t.instanceKey,capability:t.capability})}}}function H(t){return{instanceKey:t.instanceKey,capability:t.capability,destroy:()=>E(t)}}function v(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0,enumerable:!1})}function z(t){let r=globalThis.ViceMe;r||(r={},v(globalThis,"ViceMe",r));let i=r.versions;i||(i={},v(r,"versions",i));const d=i[`v${g}`];if(d)return d;const o={version:t,whenReady(n){const a=u().registry.getClient(n);return a?a.ready.then(()=>a.client):Promise.reject(c(`Unknown clientKey "${n}".`))},getInstance(n){const a=u().registry.getInstance(n);return a?H(a):void 0},destroyInstance(n){const a=u().registry.getInstance(n);a&&E(a)},destroyClient(n){for(const l of u().registry.instancesForClient(n))E(l);const a=u().registry.getClient(n);u().registry.unregisterClient(n),a?.client.destroy()}};return v(i,`v${g}`,o),o}function J(){return document.readyState!=="loading"?Promise.resolve():new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})})}async function Z(t){let e;try{e=await Q(t)}catch{e={ok:!1,status:0}}return{manifest:await X(e),baseUrl:t}}function Q(t){const e=typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"?AbortSignal.timeout(G):void 0;return fetch(t,{credentials:"omit",signal:e})}async function X(t){if(!t.ok)throw c(`Release manifest is not available (HTTP ${t.status}).`);const e=await t.json();if(typeof e!="object"||e===null||typeof e.version!="string"||typeof e.apiMajor!="number"||typeof e.features!="object"||e.features===null)throw c("Release manifest is malformed.");const r=e;if(r.version!==B)throw c("Release manifest version does not match this loader.");if(r.apiMajor!==g)throw c("Release manifest major version does not match this loader.");const i=Object.keys(r.features);if(i.length!==1||i[0]!=="danmaku"||r.features.danmaku!==x)throw c("Release manifest features must be exactly danmaku.js.");return r}const ee=new Set(["CONFIG_INVALID","CAPABILITY_DISABLED","CLIENT_DESTROYED","INTERNAL_ERROR"]);function te(t){if(typeof t=="object"&&t!==null){const e=t;if(typeof e.code=="string"&&ee.has(e.code)&&typeof e.retryable=="boolean"){const r={code:e.code,retryable:e.retryable};return typeof e.requestId=="string"&&(r.requestId=e.requestId),typeof e.capability=="string"&&(r.capability=e.capability),r}}return{code:"INTERNAL_ERROR",retryable:!0}}function f(t,e,r={}){h(t,"viceme:error",{...te(e),...r})}async function re(t){let e;try{e=j(t)}catch(s){f(document,s);return}if(!t.src){f(document,c("Loader script requires a src URL."));return}const r=new URL("manifest.json",t.src);let i,d;try{({manifest:i,baseUrl:d}=await Z(r))}catch(s){f(document,s,{clientKey:b(g,e.region,e.workKey)});return}await J();let o;try{const s=document.querySelectorAll(e.target);if(s.length===0)throw c(`Loader target "${e.target}" matched no element; no node was created.`);if(s.length>1)throw c(`Loader target "${e.target}" matched ${s.length} elements; exactly one is required.`);o=s[0]}catch(s){f(document,s,{clientKey:b(i.apiMajor,e.region,e.workKey)});return}const n=b(i.apiMajor,e.region,e.workKey);z(i.version);let a=u().registry.getClient(n),l;if(a)l=a.client;else{try{l=W({workKey:e.workKey,region:e.region})}catch(m){f(o,m,{clientKey:n});return}const s=l.ready();s.catch(()=>{}),a={clientKey:n,client:l,ready:s},u().registry.registerClient(a)}try{await a.ready}catch(s){u().registry.unregisterClient(n),l.destroy(),f(o,s,{clientKey:n});return}if(u().registry.getClient(n)!==a)return;let S=!1;const K=[];for(const s of e.features){if(u().registry.findInstance(n,s,o))continue;const m=i.features[s];if(typeof m!="string"){D(l),f(o,new y({code:"CAPABILITY_DISABLED",message:`Capability "${s}" is not part of this release.`,retryable:!1,capability:s}),{clientKey:n,capability:s});continue}try{const C=await import(new URL(m,d).href);if(typeof C.mountDanmaku!="function")throw c(`Capability chunk "${s}" does not export mountDanmaku().`);if(u().registry.getClient(n)!==a)return;const L=await C.mountDanmaku(l,{target:o,theme:e.theme});if(u().registry.getClient(n)!==a){L.destroy();return}const ie=u().registry.registerInstance(n,s,o,L);S=!0,K.push(s),h(o,"viceme:capability-ready",{clientKey:n,instanceKey:ie.instanceKey,capability:s,version:i.version})}catch(T){if(u().registry.getClient(n)!==a)return;D(l),f(o,T,{clientKey:n,capability:s})}}S&&u().registry.getClient(n)===a&&h(o,"viceme:ready",{clientKey:n,workKey:e.workKey,capabilities:K,version:i.version})}function ne(t){const{queue:e}=u(),r=e.current.then(()=>re(t));return e.current=r.catch(()=>{}),r}function I(){if(typeof document>"u")return;let t=document.currentScript instanceof HTMLScriptElement?document.currentScript:null;if(!t){const e=document.querySelectorAll("script[data-viceme-loader]");e.length===1&&(t=e[0]??null)}t&&ne(t).catch(e=>{f(document,e)})}I();const se=I})();
1
+ (function(){"use strict";const ae=new Set(["RATE_LIMITED","NETWORK_TIMEOUT","CHECKOUT_UNAVAILABLE","INTERNAL_ERROR"]);class v extends Error{code;retryable;requestId;capability;constructor(e){super(e.message),this.name="ViceMeError",this.code=e.code,this.retryable=e.retryable??ae.has(e.code),this.requestId=e.requestId,this.capability=e.capability}toJSON(){const e={code:this.code,retryable:this.retryable};return this.requestId!==void 0&&(e.requestId=this.requestId),this.capability!==void 0&&(e.capability=this.capability),e}}function ne(t){return t instanceof v}function y(t){return new v({code:"CONFIG_INVALID",message:t,retryable:!1})}function _(){return new v({code:"CLIENT_DESTROYED",message:"ViceMe client has been destroyed.",retryable:!1})}const B={cn:"https://api.viceme.cn",global:"https://api.viceme.ai"},Ze={cn:"https://viceme.cn",global:"https://viceme.ai"},oe=new Set(["cn","global"]),se={cn:B.cn,global:B.global};function ce(t){return se[t]}function H(t){return typeof t=="string"&&/^wrk_[A-Za-z0-9_-]{4,124}$/.test(t)}function W(t){return typeof t=="string"&&oe.has(t)}function le(t){if(typeof t!="object"||t===null)throw y("createViceMe expects a configuration object.");const e=t,r=new Set(["workKey","region","signal"]);for(const i of Object.keys(e))if(!r.has(i))throw y(`Unknown configuration field "${i}".`);if(!H(e.workKey))throw y('Configuration field "workKey" must be a public work key ("wrk_…").');if(!W(e.region))throw y('Configuration field "region" must be "cn" or "global".');if(e.signal!==void 0&&!(e.signal instanceof AbortSignal))throw y('Configuration field "signal" must be an AbortSignal.');return{workKey:e.workKey,region:e.region,signal:e.signal}}const de=new Set(["data-viceme-work","data-viceme-region","data-viceme-features","data-viceme-target","data-viceme-theme","data-viceme-loader"]),ue=new Set(["light","dark","auto"]);function fe(t){for(const c of t.getAttributeNames())if(c.startsWith("data-viceme-")&&!de.has(c))throw y(`Unknown loader attribute "${c}".`);const e=t.getAttribute("data-viceme-work");if(!H(e))throw y('Loader attribute "data-viceme-work" must be a public work key ("wrk_…").');const r=t.getAttribute("data-viceme-region");if(!W(r))throw y('Loader attribute "data-viceme-region" must be "cn" or "global".');if(t.getAttribute("data-viceme-features")!=="danmaku")throw y('Loader attribute "data-viceme-features" must be exactly "danmaku".');const n=["danmaku"],l=t.getAttribute("data-viceme-target");if(l==="")throw y('Loader attribute "data-viceme-target" must be a CSS selector.');if(l===null)throw y('Loader attribute "data-viceme-target" is required when features are declared.');try{t.matches(l)}catch{throw y('Loader attribute "data-viceme-target" is not a valid CSS selector.')}const a=t.getAttribute("data-viceme-theme");if(a!==null&&!ue.has(a))throw y('Loader attribute "data-viceme-theme" must be "light", "dark", or "auto".');return{workKey:e,region:r,features:n,target:l,theme:a??"auto"}}function P(t,e,r){return`v${t}+${e}+${r}`}class me{#e=new Map;#t=new Map;#r=new Map;#i=0;getClient(e){return this.#e.get(e)}registerClient(e){this.#e.set(e.clientKey,e)}unregisterClient(e){this.#e.delete(e)}getInstance(e){return this.#t.get(e)}findInstance(e,r,i){return this.#r.get(`${e}::${r}`)?.get(i)}registerInstance(e,r,i,n){const l=`${e}::${r}`;let a=this.#r.get(l);a===void 0&&(a=new WeakMap,this.#r.set(l,a));const c=a.get(i);if(c)return c;this.#i+=1;const d={instanceKey:`${e}::${r}::el${this.#i}`,clientKey:e,capability:r,host:i,raw:n,destroyed:!1};return this.#t.set(d.instanceKey,d),a.set(i,d),d}removeInstance(e){const r=this.#t.get(e);if(r)return this.#t.delete(e),this.#r.get(`${r.clientKey}::${r.capability}`)?.delete(r.host),r}instancesForClient(e){return[...this.#t.values()].filter(r=>r.clientKey===e)}}const he=new Map([["viceme:ready",new Set(["clientKey","workKey","capabilities","version"])],["viceme:capability-ready",new Set(["clientKey","instanceKey","capability","version"])],["viceme:error",new Set(["clientKey","instanceKey","capability","code","retryable","requestId"])],["viceme:destroyed",new Set(["clientKey","instanceKey","capability"])]]);function ye(t,e){const r=he.get(t),i={};for(const[n,l]of Object.entries(e))r.has(n)&&l!==void 0&&(i[n]=l);return i}function K(t,e,r){const i=new CustomEvent(e,{detail:ye(e,r),bubbles:!0,composed:!0,cancelable:!1});t.dispatchEvent(i)}const pe={CREATED:["INITIALIZING","DESTROYED"],INITIALIZING:["READY","FAILED","DESTROYED"],READY:["DEGRADED","DESTROYED"],DEGRADED:["DESTROYED"],FAILED:["INITIALIZING","DESTROYED"],DESTROYED:[]};class ge{#e="CREATED";#t=new Set;get state(){return this.#e}get destroyed(){return this.#e==="DESTROYED"}transition(e){if(e!==this.#e){if(!pe[this.#e].includes(e))throw new v({code:"INTERNAL_ERROR",message:`Illegal lifecycle transition ${this.#e} -> ${e}.`,retryable:!1});this.#e=e;for(const r of this.#t)r(e)}}assertAlive(){if(this.destroyed)throw _()}subscribe(e){return this.#t.add(e),()=>{this.#t.delete(e)}}clearListeners(){this.#t.clear()}}function be(t,e){if(typeof t!="object"||t===null)throw U();const r=t,i=r.work;if(typeof i!="object"||i===null||typeof i.key!="string"||!Array.isArray(i.capabilities)||!i.capabilities.every(l=>typeof l=="string"))throw U();if(i.key!==e)throw new v({code:"WORK_NOT_FOUND",message:"Work-session response did not match the requested work key.",retryable:!1});const n={work:{key:i.key,capabilities:i.capabilities}};return typeof r.token=="string"&&(n.token=r.token),typeof r.expiresAt=="number"&&(n.expiresAt=r.expiresAt),n}function U(){return new v({code:"INTERNAL_ERROR",message:"Malformed work-session response.",retryable:!0})}class we{#e;#t;#r;#i;constructor(e){this.#e=e,this.#t=e.now??(()=>Date.now())}get snapshot(){return this.#r}#a(){const e=this.#r?.expiresAt;return e!==void 0&&e<=this.#t()}establish(){if(this.#r){if(!this.#a())return Promise.resolve(this.#r);this.#r=void 0}return this.#i??=this.#e.transport.request({method:"POST",path:"/v1/public/v1/work-sessions",body:{workKey:this.#e.workKey},signal:this.#e.signal,timeoutMs:this.#e.timeoutMs}).then(e=>{const r=be(e.body,this.#e.workKey);return this.#r=r,r}).finally(()=>{this.#i=void 0}),this.#i}async request(e){const r=await this.establish();if(!r.token)throw U();try{return await this.#e.transport.request({...e,authorization:r.token,signal:this.#e.signal})}catch(i){if(!(i instanceof v)||i.code!=="SESSION_EXPIRED")throw i;this.#r===r&&this.invalidate();const n=await this.establish();if(!n.token)throw U();return this.#e.transport.request({...e,authorization:n.token,signal:this.#e.signal})}}authenticate(e){if(!this.#r)throw U();this.#r={...this.#r,token:e.token,expiresAt:e.expiresAt,user:e.user}}async signOut(){this.invalidate(),await this.establish()}invalidate(){this.#r=void 0}destroy(){this.invalidate(),this.#i=void 0}}const Y="0.3.0",x=1,F="viceme-access-layer",j=50;function ve(t){switch(t){case"SIGN_IN":return{description:"",label:"授权"};case"CHECKOUT":return{description:"",label:"重新打开"}}}function Ee(t){if(!ne(t))return"操作未完成,请重试。";switch(t.code){case"CONFIG_INVALID":return"微信授权配置无效,请稍后重试。";case"AUTH_CANCELLED":return"微信授权已取消,请重试。";case"SESSION_EXPIRED":return"授权会话已过期,请重试。";case"NETWORK_TIMEOUT":return"网络连接超时,请重试。";default:return t.requestId?`操作未完成,请重试。请求 ID:${t.requestId}`:"操作未完成,请重试。"}}function Ie(){if(customElements.get(F))return;class t extends HTMLElement{interaction;connectedCallback(){const r=ve(this.interaction.action),i=this.attachShadow({mode:"open"});i.innerHTML=`
2
+ <style>
3
+ :host {
4
+ position: fixed;
5
+ inset: 0;
6
+ z-index: 2147483000;
7
+ display: grid;
8
+ align-items: end;
9
+ color: #18181b;
10
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
11
+ font-size: 16px;
12
+ line-height: 1.5;
13
+ }
14
+ [data-viceme='backdrop'] {
15
+ position: absolute;
16
+ inset: 0;
17
+ border: 0;
18
+ border-radius: 0;
19
+ background: transparent;
20
+ }
21
+ [data-viceme='panel'] {
22
+ position: relative;
23
+ box-sizing: border-box;
24
+ display: flex;
25
+ width: 100%;
26
+ max-height: min(92dvh, 46rem);
27
+ flex-direction: column;
28
+ overflow: auto;
29
+ border-radius: 1.25rem 1.25rem 0 0;
30
+ background: #ffffff;
31
+ color: #18181b;
32
+ padding: 3.75rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
33
+ box-shadow: 0 -1rem 3rem rgb(0 0 0 / 18%);
34
+ }
35
+ [data-viceme='content'] { display: flex; min-height: 0; flex-direction: column; }
36
+ [data-viceme='close'] {
37
+ position: absolute;
38
+ top: 0.75rem;
39
+ left: 0.75rem;
40
+ width: 2.75rem;
41
+ height: 2.75rem;
42
+ border: 0;
43
+ border-radius: 999px;
44
+ padding: 0;
45
+ background: transparent;
46
+ color: #52525b;
47
+ font-size: 2rem;
48
+ font-weight: 400;
49
+ line-height: 1;
50
+ }
51
+ [data-viceme='description'] { margin: 0.75rem 0 1.25rem; color: #71717a; line-height: 1.6; }
52
+ [data-viceme='profile'] {
53
+ display: none;
54
+ margin: 0;
55
+ border: 1px solid #e4e4e7;
56
+ border-radius: 1rem;
57
+ padding: 1.5rem;
58
+ background: #ffffff;
59
+ box-shadow: 0 0.75rem 2rem rgb(0 0 0 / 6%);
60
+ text-align: center;
61
+ }
62
+ [data-viceme='profile'][data-visible='true'] { display: block; }
63
+ [data-viceme='avatar'] {
64
+ display: block;
65
+ width: 5.5rem;
66
+ height: 5.5rem;
67
+ margin: 0 auto 1rem;
68
+ border-radius: 999px;
69
+ object-fit: cover;
70
+ background: #f4f4f5;
71
+ }
72
+ [data-viceme='avatar-fallback'] {
73
+ display: grid;
74
+ width: 5.5rem;
75
+ height: 5.5rem;
76
+ margin: 0 auto 1rem;
77
+ place-items: center;
78
+ border-radius: 999px;
79
+ background: #f4f4f5;
80
+ color: #18181b;
81
+ font-size: 2rem;
82
+ font-weight: 700;
83
+ }
84
+ [data-viceme='avatar'][hidden], [data-viceme='avatar-fallback'][hidden] { display: none; }
85
+ [data-viceme='profile-summary'] {
86
+ display: flex;
87
+ min-width: 0;
88
+ align-items: baseline;
89
+ justify-content: center;
90
+ gap: 0.5rem;
91
+ }
92
+ [data-viceme='profile-name'] { margin: 0; font-size: 1.375rem; font-weight: 700; }
93
+ [data-viceme='profile-separator'], [data-viceme='profile-stats'] {
94
+ color: #71717a;
95
+ }
96
+ [data-viceme='profile-description'] {
97
+ margin: 0.25rem 0 0;
98
+ overflow-wrap: anywhere;
99
+ color: #71717a;
100
+ }
101
+ [data-viceme='profile-description']:empty { display: none; }
102
+ [data-viceme='profile-stats'] {
103
+ margin: 0;
104
+ font-size: 0.875rem;
105
+ }
106
+ [data-viceme='profile-header'] { min-width: 0; }
107
+ [data-viceme='profile-covers'] {
108
+ display: none;
109
+ grid-template-columns: repeat(2, minmax(0, 1fr));
110
+ gap: 0.75rem;
111
+ margin-top: 1.25rem;
112
+ border-radius: 0.875rem;
113
+ padding: 0.75rem;
114
+ background: #f4f4f5;
115
+ }
116
+ [data-viceme='profile-covers'][data-visible='true'] { display: grid; }
117
+ [data-viceme='profile-cover'] {
118
+ display: block;
119
+ width: 100%;
120
+ aspect-ratio: 16 / 9;
121
+ border: 1px solid #e4e4e7;
122
+ border-radius: 0.625rem;
123
+ object-fit: cover;
124
+ background: #ffffff;
125
+ }
126
+ [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='description'] { display: none; }
127
+ [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='profile'][data-visible='true'] {
128
+ display: block;
129
+ border: 0;
130
+ padding: 0;
131
+ background: transparent;
132
+ box-shadow: none;
133
+ text-align: center;
134
+ }
135
+ [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='profile-name'] {
136
+ font-size: 1.125rem;
137
+ }
138
+ [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='profile-description'] {
139
+ margin-top: 0.75rem;
140
+ line-height: 1.625;
141
+ }
142
+ [data-viceme='panel'][data-action='SIGN_IN'] [data-viceme='action'] {
143
+ width: 100%;
144
+ }
145
+ [data-viceme='actions'] {
146
+ display: flex;
147
+ justify-content: flex-end;
148
+ gap: 0.75rem;
149
+ margin-top: 1.25rem;
150
+ }
151
+ button {
152
+ box-sizing: border-box;
153
+ display: inline-flex;
154
+ height: 3.25rem;
155
+ align-items: center;
156
+ justify-content: center;
157
+ border-radius: 0.75rem;
158
+ padding: 0.625rem 1rem;
159
+ font: 600 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
160
+ cursor: pointer;
161
+ }
162
+ button:focus-visible, iframe:focus-visible { outline: 2px solid #18181b; outline-offset: 2px; }
163
+ [data-viceme='action'] {
164
+ width: min(11rem, 48%);
165
+ border: 1px solid #18181b;
166
+ background: #18181b;
167
+ color: #ffffff;
168
+ }
169
+ [data-viceme='action']:hover { background: #3f3f46; border-color: #3f3f46; }
170
+ [data-viceme='actions'][data-single='true'] [data-viceme='action'] { width: 100%; }
171
+ button:disabled { cursor: wait; opacity: 0.5; }
172
+ button[hidden] { display: none; }
173
+ [data-viceme='error'] { margin: 0.75rem 0 0; color: #b91c1c; font-size: 0.875rem; }
174
+ [data-viceme='error']:empty { display: none; }
175
+ [data-viceme='frame'] {
176
+ display: none;
177
+ width: 100%;
178
+ min-height: 0;
179
+ flex: 1 1 auto;
180
+ border: 0;
181
+ border-radius: 0.75rem;
182
+ background: #ffffff;
183
+ }
184
+ [data-viceme='panel'][data-frame='true'] {
185
+ height: min(92dvh, 46rem);
186
+ max-height: 92dvh;
187
+ overflow: hidden;
188
+ }
189
+ [data-viceme='panel'][data-frame='true'] [data-viceme='content'] { display: none; }
190
+ [data-viceme='panel'][data-frame='true'] [data-viceme='frame'] { display: block; }
191
+ @media (min-width: 48rem) {
192
+ :host { place-items: center; padding: 1.5rem; }
193
+ [data-viceme='panel'] {
194
+ width: min(24rem, 100%);
195
+ border-radius: 1.25rem;
196
+ padding: 3.75rem 1.25rem 1.25rem;
197
+ box-shadow: 0 1.5rem 4rem rgb(0 0 0 / 24%);
198
+ }
199
+ [data-viceme='panel'][data-frame='true'] { width: min(30rem, 100%); }
200
+ [data-viceme='panel'][data-action='SIGN_IN'] { width: min(30rem, 100%); }
201
+ }
202
+ @media (prefers-reduced-motion: no-preference) {
203
+ [data-viceme='panel'] { animation: viceme-enter 160ms ease-out; }
204
+ @keyframes viceme-enter { from { opacity: 0; transform: translateY(1rem); } }
205
+ }
206
+ </style>
207
+ <button data-viceme="backdrop" type="button" tabindex="-1" aria-label="关闭"></button>
208
+ <section data-viceme="panel" role="dialog" aria-modal="true" aria-label="ViceMe 授权">
209
+ <button data-viceme="close" type="button" aria-label="关闭">×</button>
210
+ <div data-viceme="content">
211
+ <p data-viceme="description"></p>
212
+ <section data-viceme="profile" aria-label="创作者">
213
+ <div data-viceme="profile-header">
214
+ <img data-viceme="avatar" hidden />
215
+ <span data-viceme="avatar-fallback" aria-hidden="true"></span>
216
+ <div data-viceme="profile-summary">
217
+ <p data-viceme="profile-name"></p>
218
+ <span data-viceme="profile-separator" aria-hidden="true">·</span>
219
+ <p data-viceme="profile-stats"></p>
220
+ </div>
221
+ </div>
222
+ <p data-viceme="profile-description"></p>
223
+ <div data-viceme="profile-covers" aria-label="作品封面"></div>
224
+ </section>
225
+ <p data-viceme="error" role="alert" aria-live="polite"></p>
226
+ <div data-viceme="actions">
227
+ <button data-viceme="action" type="button"></button>
228
+ </div>
229
+ </div>
230
+ <iframe data-viceme="frame" title="" referrerpolicy="no-referrer" allow="payment"></iframe>
231
+ </section>
232
+ `;const n=i.querySelector("[data-viceme='panel']");n.dataset.action=this.interaction.action,n.dataset.frame=String(this.interaction.action==="CHECKOUT");const l=i.querySelector("[data-viceme='description']");l.textContent=r.description;const a=i.querySelector("[data-viceme='action']"),c=a.parentElement,d=i.querySelector("[data-viceme='close']"),I=i.querySelector("[data-viceme='backdrop']"),k=i.querySelector("[data-viceme='error']"),o=i.querySelector("[data-viceme='frame']"),N=i.querySelector("[data-viceme='profile']"),s=i.querySelector("[data-viceme='avatar']"),u=i.querySelector("[data-viceme='avatar-fallback']"),f=i.querySelector("[data-viceme='profile-name']"),p=i.querySelector("[data-viceme='profile-description']"),h=i.querySelector("[data-viceme='profile-stats']"),A=i.querySelector("[data-viceme='profile-covers']");a.textContent=r.label,a.hidden=this.interaction.action==="CHECKOUT",c.dataset.single="true";const S=r.label;o.title=this.interaction.action==="SIGN_IN"?"微信授权":"支付";const b=this.interaction.followTarget;if(b){n.setAttribute("aria-label",this.interaction.action==="SIGN_IN"?`授权 ${b.displayName}`:`关注 ${b.displayName}`),N.dataset.visible="true",f.textContent=b.displayName;const m=[...b.description??""];if(p.textContent=m.length>j?`${m.slice(0,j).join("")}…`:m.join(""),m.length>j&&(p.title=b.description),h.textContent=`${b.workCount} 个作品`,b.coverUrls.length===0)A.remove();else{for(const[M,L]of b.coverUrls.entries()){const D=document.createElement("img");D.dataset.viceme="profile-cover",D.src=L,D.alt=`${b.displayName}的作品封面 ${M+1}`,A.append(D)}A.dataset.visible="true"}u.textContent=b.displayName.trim().slice(0,1)||"V",b.avatarUrl&&(s.src=b.avatarUrl,s.alt=`${b.displayName}的头像`,s.hidden=!1,u.hidden=!0)}let R=null;const q=m=>{this.dispatchEvent(new CustomEvent("viceme:access-layer-close",{detail:m}))},C=()=>{R?.cancel(),q("dismissed")};I.addEventListener("click",C),d.addEventListener("click",C),this.addEventListener("keydown",m=>{if(m.key==="Escape"&&C(),m.key==="Tab"){if(m.preventDefault(),R){o.focus();return}const L=[d,...a.hidden?[]:[a]].filter(ie=>!ie.disabled&&!ie.hidden);if(L.length===0)return;const D=L.indexOf(i.activeElement),Qe=m.shiftKey?-1:1;L[(D+Qe+L.length)%L.length]?.focus()}});const O=async()=>{a.disabled=!0,a.setAttribute("aria-busy","true"),a.textContent="正在打开…",k.textContent="";try{const m=await this.interaction.perform();if(m.type==="frame"){if(R=m,this.interaction.action==="SIGN_IN"){const M=n.getBoundingClientRect().height;M>0&&(n.style.height=`${M}px`)}n.dataset.frame="true",o.src=m.url,o.focus(),await m.completion}q("acted")}catch(m){R?.cancel(),R=null,n.dataset.frame="false",o.removeAttribute("src"),k.textContent=Ee(m),a.hidden=!1,a.disabled=!1,a.removeAttribute("aria-busy"),a.textContent=S,a.focus()}};a.addEventListener("click",O),this.interaction.action==="CHECKOUT"?queueMicrotask(()=>{O()}):queueMicrotask(()=>a.focus())}}customElements.define(F,t)}const $=async t=>{if(typeof document>"u"||typeof customElements>"u")return"dismissed";Ie();const e=document.createElement(F);e.interaction=t;const r=document.documentElement.style.overflow,i=document.activeElement instanceof HTMLElement?document.activeElement:null;document.documentElement.style.overflow="hidden",document.body.append(e);try{return await new Promise(n=>{e.addEventListener("viceme:access-layer-close",l=>n(l.detail),{once:!0})})}finally{e.remove(),document.documentElement.style.overflow=r,i?.focus()}};function E(t){if(typeof t!="object"||t===null)throw w();return t}function w(){return new v({code:"INTERNAL_ERROR",message:"Malformed public API response.",retryable:!0})}function Ae(t){const e=E(t);if(typeof e.subject!="string"||!(typeof e.nickname=="string"||e.nickname===null)||!(typeof e.avatarUrl=="string"||e.avatarUrl===null))throw w();return{subject:e.subject,nickname:e.nickname,avatarUrl:e.avatarUrl}}function z(t){const e=E(t);if(typeof e.following!="boolean"||!(typeof e.followedAt=="string"||e.followedAt===null))throw w();const r=E(e.target);if(!(r.kind==="CREATOR"||r.kind==="USER")||typeof r.displayName!="string"||!(typeof r.avatarUrl=="string"||r.avatarUrl===null)||!(typeof r.description=="string"||r.description===null)||!Number.isInteger(r.workCount)||r.workCount<0||!Array.isArray(r.coverUrls)||r.coverUrls.length>2||!r.coverUrls.every(i=>typeof i=="string"))throw w();return{following:e.following,followedAt:e.followedAt,target:{kind:r.kind,displayName:r.displayName,avatarUrl:r.avatarUrl,description:r.description,workCount:r.workCount,coverUrls:r.coverUrls}}}function ke(t){const e=E(t),r=new Set(["OWNER","FOLLOWING","PURCHASED","ENTITLED","AUTH_REQUIRED","FOLLOW_REQUIRED","PURCHASE_REQUIRED","FEATURE_NOT_FOUND","FEATURE_DISABLED","POLICY_UNSUPPORTED"]),i=new Set([null,"SIGN_IN","FOLLOW","CHECKOUT"]);if(typeof e.allowed!="boolean"||typeof e.reason!="string"||!r.has(e.reason)||!i.has(e.nextAction))throw w();return{allowed:e.allowed,reason:e.reason,nextAction:e.nextAction}}function Se(t){const e=E(t),r=E(e.policy);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||!(r.type==="PUBLIC"||r.type==="FOLLOW_OWNER"||r.type==="WORK_ENTITLEMENT"))throw w();const i=e.price===null?null:E(e.price);if(i!==null&&(!Number.isInteger(i.amountCents)||i.amountCents<=0||i.currency!=="CNY")||r.type==="WORK_ENTITLEMENT"!=(i!==null))throw w();return{featureKey:e.featureKey,title:e.title,policy:{type:r.type},price:i===null?null:{amountCents:i.amountCents,currency:"CNY"}}}function Q(t){if(typeof t!="string")throw w();try{const e=new URL(t).origin;if(e!==t)throw w();return e}catch(e){throw e instanceof v?e:w()}}function Z(){const t=crypto.getRandomValues(new Uint8Array(32));return Te(t)}function Te(t){let e="";for(const r of t)e+=String.fromCharCode(r);return btoa(e).replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function Ne(){return typeof document<"u"&&document.documentElement.lang.toLowerCase()==="en-us"?"en-US":"zh-CN"}function Re(t){const e=async(s,u)=>{const f=E((await t.session.request({method:"POST",path:"/v1/public/v1/auth/exchange",body:{code:s,codeVerifier:u}})).body);if(typeof f.token!="string"||typeof f.expiresAt!="number")throw w();const p=Ae(f.user);return t.session.authenticate({token:f.token,expiresAt:f.expiresAt,user:p}),{authenticated:!0,user:p}},r=()=>new v({code:"AUTH_CANCELLED",message:"The interactive action was cancelled.",retryable:!1}),i=(s,u,f,p,h)=>{if(typeof window>"u")throw new v({code:"CONFIG_INVALID",message:"Interactive access requires a browser window.",retryable:!1});let A=!0,S,b;const R=()=>{A&&(A=!1,window.removeEventListener("message",C))},q=new Promise((O,m)=>{S=O,b=m}),C=O=>{if(!A||O.origin!==u||typeof O.data!="object"||O.data===null)return;const m=O.data;if(!(m.workKey!==t.workKey||m.channel!==f)){if(m.type===`viceme:${p}:cancelled`){R(),b(r());return}m.type===`viceme:${p}:complete`&&(R(),h(m).then(S,b))}};return window.addEventListener("message",C),{type:"frame",url:s,completion:q,cancel(){R(),S()}}},n=async s=>{await t.ready();const u=Z(),f=await t.session.request({method:"POST",path:"/v1/public/v1/auth/wechat/authorize",body:{channel:u,clientType:"pc",locale:Ne()}}),p=E(f.body);if(typeof p.authorizationUrl!="string")throw w();return i(p.authorizationUrl,Q(p.completionOrigin),u,"auth",async h=>{if(typeof h.code!="string"||typeof h.codeVerifier!="string")throw w();await e(h.code,h.codeVerifier),await s?.()})},l=async()=>(await t.ready(),z((await t.session.request({method:"GET",path:"/v1/public/v1/follow"})).body)),a=async s=>(await t.ready(),z((await t.session.request({method:s,path:"/v1/public/v1/follow"})).body)),c={async getState(){await t.ready();const s=t.session.snapshot?.user??null;return{authenticated:s!==null,user:s}},async signIn(){const s=t.presenter??$,u=(await l()).target;if(await s({featureKey:"auth",reason:"AUTH_REQUIRED",action:"SIGN_IN",followTarget:u,perform:()=>n(async()=>{await a("PUT")})})==="dismissed")throw r();return this.getState()},async signOut(){await t.ready(),await t.session.signOut()}},d={getState:l,follow:()=>a("PUT"),unfollow:()=>a("DELETE")},I=async s=>{await t.ready();const u=E((await t.session.request({method:"POST",path:"/v1/public/v1/access/check",body:{featureKeys:s}})).body),f=E(u.decisions);return Object.fromEntries(Object.entries(f).map(([p,h])=>[p,ke(h)]))},k=async(s,u={})=>{await t.ready();const f=Z(),p={featureKey:s,locale:u.locale??"zh-CN",channel:f},h=E((await t.session.request({method:"POST",path:"/v1/public/v1/checkout/sessions",body:p})).body);if(typeof h.checkoutUrl!="string"||typeof h.alreadyOwned!="boolean")throw w();const A=Q(h.completionOrigin),S={checkoutUrl:h.checkoutUrl,alreadyOwned:h.alreadyOwned};return{result:S,action:S.alreadyOwned?{type:"completed"}:i(S.checkoutUrl,A,f,"checkout",async()=>{})}};return{auth:c,follow:d,access:{async getFeatures(){await t.ready();const s=E((await t.session.request({method:"GET",path:"/v1/public/v1/access/features"})).body);if(!Array.isArray(s.features)||s.features.length>100)throw w();return s.features.map(Se)},async check(s){const f=(await I([s]))[s];if(!f)throw w();return f},checkMany:I,async require(s){let u=await this.check(s);const f=t.presenter??$;for(let p=0;!u.allowed&&u.nextAction&&p<3;p+=1){const h=u.nextAction;if(h==="FOLLOW"){await d.follow(),u=await this.check(s);continue}const A=h==="SIGN_IN"?(await d.getState()).target:void 0;if(await f({featureKey:s,reason:u.reason,action:h,...A?{followTarget:A}:{},perform:async()=>h==="SIGN_IN"?n(async()=>{await d.follow()}):(await k(s)).action})==="dismissed")return u;u=await this.check(s)}return u},async refresh(){await t.ready()}},checkout:{async open(s){const u=t.presenter??$;let f;if(await u({featureKey:s.featureKey,reason:"PURCHASE_REQUIRED",action:"CHECKOUT",perform:async()=>{const h=await k(s.featureKey,s);return f=h.result,h.action}})==="dismissed"||!f)throw r();return f}}}}function X(t){t instanceof J&&t.markDegraded()}class Oe extends DOMException{constructor(){super("ViceMe client destroyed.","AbortError")}}class J{#e=new ge;#t;#r;#i=new AbortController;#a;auth;access;checkout;#n;constructor(e){this.#r=e.config,this.#t=new we({workKey:e.config.workKey,transport:e.transport,signal:this.#i.signal,...e.now!==void 0?{now:e.now}:{}});const r=Re({session:this.#t,workKey:e.config.workKey,presenter:e.presenter,ready:()=>this.ready()});this.auth=r.auth,this.access=r.access,this.checkout=r.checkout;const i=e.config.signal;if(i){const n=()=>{this.#i.abort(i.reason instanceof Error?i.reason:new DOMException("Caller signal aborted.","AbortError"))};i.aborted?n():(i.addEventListener("abort",n,{once:!0}),this.#n=()=>{i.removeEventListener("abort",n)})}}get version(){return Y}get workKey(){return this.#r.workKey}get region(){return this.#r.region}get state(){return this.#e.state}get apiMajor(){return x}ready(){return this.#e.destroyed?Promise.reject(_()):(this.#a??=this.#o(),this.#a)}async#o(){if(this.#e.destroyed)throw _();this.#e.transition("INITIALIZING");try{if(await this.#t.establish(),this.#e.destroyed)throw _();this.#e.transition("READY")}catch(e){throw this.#e.destroyed?_():(this.#e.transition("FAILED"),this.#a=void 0,this.#t.invalidate(),e)}}hasCapability(e){if(this.#e.destroyed)return!1;const r=this.#t.snapshot?.work.capabilities;return r!==void 0&&r.includes(e)}get capabilities(){return this.#t.snapshot?.work.capabilities??[]}markDegraded(){this.#e.state==="READY"&&this.#e.transition("DEGRADED")}get sessionSnapshot(){return this.#t.snapshot}destroy(){this.#e.destroyed||(this.#e.transition("DESTROYED"),this.#i.abort(new Oe),this.#t.destroy(),this.#e.clearListeners(),this.#a=void 0,this.#n?.(),this.#n=void 0)}}const Le=1e4,Ce=new Map([[400,"CONFIG_INVALID"],[401,"SESSION_EXPIRED"],[403,"CAPABILITY_DISABLED"],[404,"WORK_NOT_FOUND"],[409,"CONFIG_INVALID"],[422,"CONFIG_INVALID"],[429,"RATE_LIMITED"]]),De=new Set(["CONFIG_INVALID","WORK_NOT_FOUND","CAPABILITY_DISABLED","SESSION_EXPIRED","AUTH_REQUIRED","AUTH_CANCELLED","RETURN_URL_NOT_ALLOWED","RATE_LIMITED","NETWORK_TIMEOUT","CHECKOUT_UNAVAILABLE","INTERNAL_ERROR"]);function _e(t){if(typeof t!="object"||t===null)return{};const e=t,r=typeof e.error=="object"&&e.error!==null?e.error:e,i={};return typeof r.code=="string"&&De.has(r.code)&&(i.code=r.code),typeof r.message=="string"&&(i.message=r.message.slice(0,200)),typeof r.retryable=="boolean"&&(i.retryable=r.retryable),typeof r.requestId=="string"&&(i.requestId=r.requestId),i}function Ue(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`req-${Math.random().toString(36).slice(2)}`}class xe{#e;#t;#r;#i;constructor(e){this.#e=e.apiBaseUrl.replace(/\/+$/,""),this.#t=e.fetchImpl??globalThis.fetch.bind(globalThis),this.#r=e.defaultTimeoutMs??Le,this.#i=e.generateRequestId??Ue}async request(e){if(e.signal?.aborted)throw this.#a(e.signal);const r=e.timeoutMs??this.#r,i=new AbortController;let n=!1;const l=setTimeout(()=>{n=!0,i.abort(new ee)},r),a=()=>i.abort(new ee(!1));e.signal?.addEventListener("abort",a,{once:!0});const c=this.#i();try{const d=await this.#t(`${this.#e}${e.path}`,{method:e.method,credentials:"omit",mode:"cors",headers:{"content-type":"application/json","x-client-request-id":c,...e.authorization!==void 0?{authorization:`Bearer ${e.authorization}`}:{}},body:e.body!==void 0?JSON.stringify(e.body):void 0,signal:i.signal});let I;try{I=await d.json()}catch(o){if(e.signal?.aborted||n)throw o;I=void 0}const k=d.headers.get("x-request-id")??void 0;if(!d.ok){const o=_e(I),N=o.code??Ce.get(d.status)??"INTERNAL_ERROR";throw new v({code:N,message:o.message??"Public API request failed.",retryable:o.retryable,requestId:o.requestId??k})}return{status:d.status,body:I,requestId:k}}catch(d){throw e.signal?.aborted?this.#a(e.signal):n?new v({code:"NETWORK_TIMEOUT",message:"Public API request timed out.",retryable:!0,requestId:c}):d instanceof v?d:d instanceof DOMException&&d.name==="AbortError"?new DOMException("ViceMe request aborted by caller.","AbortError"):new v({code:"INTERNAL_ERROR",message:"Public API request failed.",retryable:!0,requestId:c})}finally{clearTimeout(l),e.signal?.removeEventListener("abort",a)}}#a(e){return e.reason instanceof Error?e.reason:new DOMException("ViceMe request aborted by caller.","AbortError")}}function Me(t){return new xe(t)}class ee extends DOMException{constructor(e=!0){super(e?"ViceMe request timed out.":"ViceMe request aborted.","AbortError")}}function Ke(t){const e=le(t),r=ce(e.region),i=Me({apiBaseUrl:r});return new J({config:e,transport:i})}const qe=8e3,Pe="danmaku.js",te=Symbol.for("viceme.loader.state.v1");function g(){const e=globalThis[te];if(e)return e;const r={registry:new me,queue:{current:Promise.resolve()}};return Object.defineProperty(globalThis,te,{value:r,writable:!0,configurable:!0,enumerable:!1}),r}function G(t){if(!t.destroyed){t.destroyed=!0,g().registry.removeInstance(t.instanceKey);try{t.raw.destroy()}finally{K(t.host,"viceme:destroyed",{clientKey:t.clientKey,instanceKey:t.instanceKey,capability:t.capability})}}}function Fe(t){return{instanceKey:t.instanceKey,capability:t.capability,destroy:()=>G(t)}}function V(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,configurable:!0,enumerable:!1})}function je(t){let r=globalThis.ViceMe;r||(r={},V(globalThis,"ViceMe",r));let i=r.versions;i||(i={},V(r,"versions",i));const n=i[`v${x}`];if(n)return n;const l={version:t,whenReady(a){const c=g().registry.getClient(a);return c?c.ready.then(()=>c.client):Promise.reject(y(`Unknown clientKey "${a}".`))},getInstance(a){const c=g().registry.getInstance(a);return c?Fe(c):void 0},destroyInstance(a){const c=g().registry.getInstance(a);c&&G(c)},destroyClient(a){for(const d of g().registry.instancesForClient(a))G(d);const c=g().registry.getClient(a);g().registry.unregisterClient(a),c?.client.destroy()}};return V(i,`v${x}`,l),l}function $e(){return document.readyState!=="loading"?Promise.resolve():new Promise(t=>{document.addEventListener("DOMContentLoaded",()=>t(),{once:!0})})}async function Ge(t){let e;try{e=await Ve(t)}catch{e={ok:!1,status:0}}return{manifest:await Be(e),baseUrl:t}}function Ve(t){const e=typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"?AbortSignal.timeout(qe):void 0;return fetch(t,{credentials:"omit",signal:e})}async function Be(t){if(!t.ok)throw y(`Release manifest is not available (HTTP ${t.status}).`);const e=await t.json();if(typeof e!="object"||e===null||typeof e.version!="string"||typeof e.apiMajor!="number"||typeof e.features!="object"||e.features===null)throw y("Release manifest is malformed.");const r=e;if(r.version!==Y)throw y("Release manifest version does not match this loader.");if(r.apiMajor!==x)throw y("Release manifest major version does not match this loader.");const i=Object.keys(r.features);if(i.length!==1||i[0]!=="danmaku"||r.features.danmaku!==Pe)throw y("Release manifest features must be exactly danmaku.js.");return r}const He=new Set(["CONFIG_INVALID","CAPABILITY_DISABLED","CLIENT_DESTROYED","INTERNAL_ERROR"]);function We(t){if(typeof t=="object"&&t!==null){const e=t;if(typeof e.code=="string"&&He.has(e.code)&&typeof e.retryable=="boolean"){const r={code:e.code,retryable:e.retryable};return typeof e.requestId=="string"&&(r.requestId=e.requestId),typeof e.capability=="string"&&(r.capability=e.capability),r}}return{code:"INTERNAL_ERROR",retryable:!0}}function T(t,e,r={}){K(t,"viceme:error",{...We(e),...r})}async function Ye(t){let e;try{e=fe(t)}catch(o){T(document,o);return}if(!t.src){T(document,y("Loader script requires a src URL."));return}const r=new URL("manifest.json",t.src);let i,n;try{({manifest:i,baseUrl:n}=await Ge(r))}catch(o){T(document,o,{clientKey:P(x,e.region,e.workKey)});return}await $e();let l;try{const o=document.querySelectorAll(e.target);if(o.length===0)throw y(`Loader target "${e.target}" matched no element; no node was created.`);if(o.length>1)throw y(`Loader target "${e.target}" matched ${o.length} elements; exactly one is required.`);l=o[0]}catch(o){T(document,o,{clientKey:P(i.apiMajor,e.region,e.workKey)});return}const a=P(i.apiMajor,e.region,e.workKey);je(i.version);let c=g().registry.getClient(a),d;if(c)d=c.client;else{try{d=Ke({workKey:e.workKey,region:e.region})}catch(N){T(l,N,{clientKey:a});return}const o=d.ready();o.catch(()=>{}),c={clientKey:a,client:d,ready:o},g().registry.registerClient(c)}try{await c.ready}catch(o){g().registry.unregisterClient(a),d.destroy(),T(l,o,{clientKey:a});return}if(g().registry.getClient(a)!==c)return;let I=!1;const k=[];for(const o of e.features){if(g().registry.findInstance(a,o,l))continue;const N=i.features[o];if(typeof N!="string"){X(d),T(l,new v({code:"CAPABILITY_DISABLED",message:`Capability "${o}" is not part of this release.`,retryable:!1,capability:o}),{clientKey:a,capability:o});continue}try{const u=await import(new URL(N,n).href);if(typeof u.mountDanmaku!="function")throw y(`Capability chunk "${o}" does not export mountDanmaku().`);if(g().registry.getClient(a)!==c)return;const f=await u.mountDanmaku(d,{target:l,theme:e.theme});if(g().registry.getClient(a)!==c){f.destroy();return}const p=g().registry.registerInstance(a,o,l,f);I=!0,k.push(o),K(l,"viceme:capability-ready",{clientKey:a,instanceKey:p.instanceKey,capability:o,version:i.version})}catch(s){if(g().registry.getClient(a)!==c)return;X(d),T(l,s,{clientKey:a,capability:o})}}I&&g().registry.getClient(a)===c&&K(l,"viceme:ready",{clientKey:a,workKey:e.workKey,capabilities:k,version:i.version})}function ze(t){const{queue:e}=g(),r=e.current.then(()=>Ye(t));return e.current=r.catch(()=>{}),r}function re(){if(typeof document>"u")return;let t=document.currentScript instanceof HTMLScriptElement?document.currentScript:null;if(!t){const e=document.querySelectorAll("script[data-viceme-loader]");e.length===1&&(t=e[0]??null)}t&&ze(t).catch(e=>{T(document,e)})}re();const Xe=re})();
2
233
  //# sourceMappingURL=viceme.min.js.map