@seayoo-web/gamer-api 1.1.15 → 1.1.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,75 +1,75 @@
1
- var V = Object.defineProperty;
2
- var Q = (e, t, r) => t in e ? V(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r;
3
- var u = (e, t, r) => Q(e, typeof t != "symbol" ? t + "" : t, r);
4
- import { isComboWebView as T } from "@seayoo-web/combo-webview";
5
- import { isPlainObject as n, useConsole as M, Support as m, usePromise as H, pruneURL as j, queryString as h, pruneObject as s, isArray as o, isString as z, isValuedString as J, parseJSON as K, removePara as A } from "@seayoo-web/utils";
1
+ var se = Object.defineProperty;
2
+ var oe = (e, r, n) => r in e ? se(e, r, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[r] = n;
3
+ var c = (e, r, n) => oe(e, typeof r != "symbol" ? r + "" : r, n);
4
+ import { isComboWebView as ae } from "@seayoo-web/combo-webview";
5
+ import { isPlainObject as i, useConsole as ue, Support as d, usePromise as ce, pruneURL as me, queryString as A, pruneObject as a, v as t, typedObjectGuard as o, isArray as _, parseJSON as le, removePara as D } from "@seayoo-web/utils";
6
6
  import "@seayoo-web/request";
7
- function N(e) {
8
- return n(e, "gamer_token") && typeof e.gamer_token == "string";
7
+ function ge(e) {
8
+ return i(e, "gamer_token") && typeof e.gamer_token == "string";
9
9
  }
10
- function L(e) {
11
- return n(e);
10
+ function V(e) {
11
+ return i(e);
12
12
  }
13
- const l = M("GamerApiSDK");
14
- function O(e) {
13
+ const p = ue("GamerApiSDK");
14
+ function de(e) {
15
15
  return /^\/[a-z\d-]+$/.test(e);
16
16
  }
17
- async function X() {
18
- const { promise: e, resolve: t } = H();
17
+ async function _e() {
18
+ const { promise: e, resolve: r } = ce();
19
19
  return wx.login({
20
- success(r) {
21
- t(r);
20
+ success(n) {
21
+ r(n);
22
22
  },
23
23
  fail() {
24
- t("");
24
+ r("");
25
25
  }
26
26
  }), await e;
27
27
  }
28
- const Y = {
28
+ const pe = {
29
29
  get(e) {
30
30
  return localStorage.getItem(e) || "";
31
31
  },
32
- set(e, t) {
33
- localStorage.setItem(e, t);
32
+ set(e, r) {
33
+ localStorage.setItem(e, r);
34
34
  },
35
35
  remove(e) {
36
36
  localStorage.removeItem(e);
37
37
  }
38
- }, Z = {
38
+ }, ye = {
39
39
  get(e) {
40
40
  try {
41
- if (m.wx) return wx.getStorageSync(e) || "";
42
- } catch (t) {
43
- l.error("getStorageSyncError", t);
41
+ if (d.wx) return wx.getStorageSync(e) || "";
42
+ } catch (r) {
43
+ p.error("getStorageSyncError", r);
44
44
  }
45
45
  return "";
46
46
  },
47
- set(e, t) {
47
+ set(e, r) {
48
48
  try {
49
- m.wx && wx.setStorageSync(e, t);
50
- } catch (r) {
51
- l.error("setStorageSyncError", r);
49
+ d.wx && wx.setStorageSync(e, r);
50
+ } catch (n) {
51
+ p.error("setStorageSyncError", n);
52
52
  }
53
53
  },
54
54
  remove(e) {
55
55
  try {
56
- m.wx && wx.removeStorageSync(e);
57
- } catch (t) {
58
- l.error("removeStorageSync", t);
56
+ d.wx && wx.removeStorageSync(e);
57
+ } catch (r) {
58
+ p.error("removeStorageSync", r);
59
59
  }
60
60
  }
61
- }, _ = "gamer_token";
62
- class rr {
63
- constructor(t, r) {
64
- u(this, "$idToken", "");
65
- u(this, "$weixinToken", "");
66
- u(this, "$gamerToken", "");
67
- u(this, "req");
68
- u(this, "storage");
69
- this.storage = m.wx ? Z : Y;
70
- const i = O(t) ? t : `https://${j(t)}`;
71
- this.req = r({
72
- baseURL: `${i}/v1`,
61
+ }, y = "gamer_token";
62
+ class wr {
63
+ constructor(r, n) {
64
+ c(this, "$idToken", "");
65
+ c(this, "$weixinToken", "");
66
+ c(this, "$gamerToken", "");
67
+ c(this, "req");
68
+ c(this, "storage");
69
+ this.storage = d.wx ? ye : pe;
70
+ const s = de(r) ? r : `https://${me(r)}`;
71
+ this.req = n({
72
+ baseURL: `${s}/v1`,
73
73
  timeout: 1e4,
74
74
  responseRule: {
75
75
  ok: { resolve: "body" },
@@ -80,21 +80,21 @@ class rr {
80
80
  }
81
81
  },
82
82
  // 使用箭头函数绑定执行上下文
83
- requestTransformer: (c) => {
84
- this.$gamerToken && (c.headers.Authorization = `Bearer ${this.$gamerToken}`);
83
+ requestTransformer: (l) => {
84
+ this.$gamerToken && (l.headers.Authorization = `Bearer ${this.$gamerToken}`);
85
85
  }
86
- }), T() ? this.$gamerToken = h("gamer_token") : this.loadGamerTokenCache();
86
+ }), ae() ? this.$gamerToken = A("gamer_token") : this.loadGamerTokenCache();
87
87
  }
88
88
  loadGamerTokenCache() {
89
- const r = this.storage.get(_).match(/^(\d{12,})#(.{8,})$/);
90
- if (r) {
91
- const i = parseInt(r[1]), c = r[2];
92
- if (i > Date.now() - (24 * 3600 - 10) * 1e3) {
93
- this.$gamerToken = c;
89
+ const n = this.storage.get(y).match(/^(\d{12,})#(.{8,})$/);
90
+ if (n) {
91
+ const s = parseInt(n[1]), l = n[2];
92
+ if (s > Date.now() - (24 * 3600 - 10) * 1e3) {
93
+ this.$gamerToken = l;
94
94
  return;
95
95
  }
96
96
  }
97
- this.storage.remove(_);
97
+ this.storage.remove(y);
98
98
  }
99
99
  /** 当前是否为登录状态,即是否拥有 gamerToken */
100
100
  get isLogined() {
@@ -105,8 +105,8 @@ class rr {
105
105
  return this.$idToken;
106
106
  }
107
107
  /** 设置从登录组件获取的 Id Token,用于后续请求自动置换 Gamer Token */
108
- set idToken(t) {
109
- this.$idToken !== t && (this.$idToken = t, this.gamerToken = "");
108
+ set idToken(r) {
109
+ this.$idToken !== r && (this.$idToken = r, this.gamerToken = "");
110
110
  }
111
111
  /** 读取设置 wexinToken */
112
112
  get weixinToken() {
@@ -117,8 +117,8 @@ class rr {
117
117
  *
118
118
  * 仅仅在微信小程序模式下有效
119
119
  */
120
- set weixinToken(t) {
121
- this.$weixinToken !== t && (this.$weixinToken = t, this.gamerToken = "");
120
+ set weixinToken(r) {
121
+ this.$weixinToken !== r && (this.$weixinToken = r, this.gamerToken = "");
122
122
  }
123
123
  /** 读取自动置换的 gamerToken */
124
124
  get gamerToken() {
@@ -127,8 +127,8 @@ class rr {
127
127
  /**
128
128
  * 直接写入 Gamer Token,并更新缓存
129
129
  */
130
- set gamerToken(t) {
131
- this.$gamerToken = t, t ? this.storage.set(_, `${Date.now()}#${t}`) : this.storage.remove(_);
130
+ set gamerToken(r) {
131
+ this.$gamerToken = r, r ? this.storage.set(y, `${Date.now()}#${r}`) : this.storage.remove(y);
132
132
  }
133
133
  /**
134
134
  * 退出登录,销毁相关 Token
@@ -156,16 +156,16 @@ class rr {
156
156
  if (this.gamerToken)
157
157
  return !0;
158
158
  if (!this.idToken)
159
- return l.error("Missing idToken when call autoLogin()"), !1;
160
- if (m.wx && !this.weixinToken)
161
- return l.error("Missing weixinToken when call autoLogin()"), !1;
162
- const { code: t, data: r } = await this.req.post(
159
+ return p.error("Missing idToken when call autoLogin()"), !1;
160
+ if (d.wx && !this.weixinToken)
161
+ return p.error("Missing weixinToken when call autoLogin()"), !1;
162
+ const { code: r, data: n } = await this.req.post(
163
163
  "login-with-token",
164
- s({ id_token: this.idToken, weixin_token: m.wx ? this.weixinToken : null }),
165
- N,
164
+ a({ id_token: this.idToken, weixin_token: d.wx ? this.weixinToken : null }),
165
+ ge,
166
166
  { message: !1 }
167
167
  );
168
- switch (t) {
168
+ switch (r) {
169
169
  case "invalid_id_token":
170
170
  this.idToken = "";
171
171
  break;
@@ -173,7 +173,7 @@ class rr {
173
173
  this.weixinToken = "";
174
174
  break;
175
175
  }
176
- return this.gamerToken = (r == null ? void 0 : r.gamer_token) || "", !!this.gamerToken;
176
+ return this.gamerToken = (n == null ? void 0 : n.gamer_token) || "", !!this.gamerToken;
177
177
  }
178
178
  /**
179
179
  * 获取当前登录用户的 Session 的信息
@@ -184,224 +184,218 @@ class rr {
184
184
  */
185
185
  async getSession() {
186
186
  if (!await this.autoLogin()) return null;
187
- const { data: t } = await this.req.get("session", L, {
187
+ const { data: r } = await this.req.get("session", V, {
188
188
  message: !1
189
189
  });
190
- return t;
190
+ return r;
191
191
  }
192
192
  /**
193
193
  * 实名认证
194
194
  *
195
195
  * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=kZYnwX6RcF
196
196
  */
197
- async authRealName(t) {
197
+ async authRealName(r) {
198
198
  if (!await this.autoLogin()) return null;
199
- const { data: r } = await this.req.post("auth-real-name", s(t), L);
200
- return r;
201
- }
202
- }
203
- function W(e) {
204
- return n(
205
- e,
206
- "default_avatar_url",
207
- "official_avatar_urls",
208
- "default_nickname",
209
- "default_bio",
210
- "default_role_avatar_url",
211
- "level_configs",
212
- "level_valid_days",
213
- "benefit_description",
214
- "exp_description",
215
- "credit_description",
216
- "send_role_mail_rate_limit"
217
- ) && Array.isArray(e.level_configs) && e.level_configs.every(
218
- (t) => n(t, "exp", "level", "title")
219
- );
220
- }
221
- function ee(e) {
222
- return n(
223
- e,
224
- "member_id",
225
- "player_id",
226
- "type",
227
- "exp",
228
- "level",
229
- "credit",
230
- "credit_expiring",
231
- "level_change_time",
232
- "level_expire_time"
233
- ) && typeof e.player_id == "string";
234
- }
235
- function C(e) {
236
- return n(e, "player") && ee(e.player);
237
- }
238
- function D(e) {
239
- return n(
240
- e,
241
- "role_id",
242
- "role_name",
243
- "role_level",
244
- "server_id",
245
- "server_name",
246
- "last_login_time"
247
- ) && z(e.server_id) && J(e.role_id);
248
- }
249
- function te(e) {
250
- return n(e, "roles") && o(e.roles, D);
251
- }
252
- function re(e) {
253
- return D(e) && n(e, "role_fighting");
254
- }
255
- function f(e) {
256
- return n(e, "role_card") && re(e.role_card);
257
- }
258
- function U(e) {
259
- return n(e, "name", "avatar_url", "bio", "gender", "birthday") && n(e.birthday, "year", "month", "day");
260
- }
261
- function v(e) {
262
- return n(
263
- e,
264
- "address_id",
265
- "recipient",
266
- "mobile",
267
- "province",
268
- "city",
269
- "district",
270
- "address",
271
- "is_default"
272
- );
273
- }
274
- function ne(e) {
275
- return n(e, "addresses") && o(e.addresses, v);
276
- }
277
- function ie(e) {
278
- return n(
279
- e,
280
- "increased_credit",
281
- "decreased_credit",
282
- "expired_credit",
283
- "balance_credit"
284
- );
285
- }
286
- function se(e) {
287
- return n(
288
- e,
289
- "id",
290
- "change_time",
291
- "change_type",
292
- "change_credit",
293
- "balance",
294
- "change_scene"
295
- );
296
- }
297
- function oe(e) {
298
- return n(e, "credit_logs") && o(e.credit_logs, se);
299
- }
300
- function ae(e) {
301
- return n(
302
- e,
303
- "benefit_id",
304
- "name",
305
- "img_url",
306
- "description",
307
- "min_level",
308
- "max_level",
309
- "product_id",
310
- "tag"
311
- );
312
- }
313
- function ue(e) {
314
- return n(e, "benefits") && o(e.benefits, ae);
315
- }
316
- function ce(e) {
317
- return n(
318
- e,
319
- "benefit_id",
320
- "name",
321
- "img_url",
322
- "description",
323
- "min_level",
324
- "max_level",
325
- "product_id"
326
- ) && ("product" in e ? E(e.product) : !0);
327
- }
328
- function me(e) {
329
- return n(e, "benefit") && ce(e.benefit);
330
- }
331
- function E(e) {
332
- return n(
333
- e,
334
- "product_id",
335
- "catalog_id",
336
- "catalog_name",
337
- "item_type",
338
- "name",
339
- "img_url",
340
- "description",
341
- "tag",
342
- "price",
343
- "stock",
344
- "redeem_quantity",
345
- "not_visible_after",
346
- "not_visible_before",
347
- "not_after",
348
- "not_before",
349
- "min_level",
350
- "max_level",
351
- "limit_daily",
352
- "limit_monthly",
353
- "limit_yearly",
354
- "limit_total",
355
- "weight",
356
- "created_at",
357
- "updated_at"
358
- );
359
- }
360
- function le(e) {
361
- return n(e, "products") && o(e.products, E);
362
- }
363
- function _e(e) {
364
- return n(
365
- e,
366
- "redemption_id",
367
- "player_id",
368
- "product_id",
369
- "name",
370
- "img_url",
371
- "item_type",
372
- "catalog_id",
373
- "catalog_name",
374
- "quantity",
375
- "amount",
376
- "status",
377
- "created_at"
378
- ) && ("extra_data" in e ? ge(e.extra_data) || de(e.extra_data) : !0);
379
- }
380
- function ge(e) {
381
- return n(
382
- e,
383
- "address",
384
- "recipient",
385
- "mobile",
386
- "province",
387
- "city",
388
- "district",
389
- "express_company",
390
- "express_number"
391
- );
392
- }
393
- function de(e) {
394
- return n(e, "server_id", "role_id", "role_name");
395
- }
396
- function pe(e) {
397
- return n(e, "redemptions") && o(e.redemptions, _e);
398
- }
399
- var fe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Male = "male", e.Female = "female", e))(fe || {}), we = /* @__PURE__ */ ((e) => (e.Increase = "increase", e.Decrease = "decrease", e.Expired = "expired", e))(we || {}), ye = /* @__PURE__ */ ((e) => (e.Order = "order", e.Consumption = "consumption", e.Redeem = "redeem", e.Expire = "expire", e.Admin = "admin", e.Event = "event", e))(ye || {}), he = /* @__PURE__ */ ((e) => (e.GameReward = "game_reward", e.Physical = "physical", e.Virtual = "virtual", e))(he || {}), ve = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.issued = "issued", e.failed = "failed", e))(ve || {});
400
- class nr {
401
- constructor(t) {
402
- u(this, "token");
403
- u(this, "req");
404
- this.token = t, this.req = t.req;
199
+ const { data: n } = await this.req.post("auth-real-name", a(r), V);
200
+ return n;
201
+ }
202
+ }
203
+ var fe = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Male = "male", e.Female = "female", e))(fe || {});
204
+ const we = t.string().enum(
205
+ "unknown",
206
+ "male",
207
+ "female"
208
+ /* Female */
209
+ );
210
+ var he = /* @__PURE__ */ ((e) => (e.Increase = "increase", e.Decrease = "decrease", e.Expired = "expired", e))(he || {});
211
+ const be = t.string().enum(
212
+ "increase",
213
+ "decrease",
214
+ "expired"
215
+ /* Expired */
216
+ );
217
+ var ke = /* @__PURE__ */ ((e) => (e.Order = "order", e.Consumption = "consumption", e.Redeem = "redeem", e.Expire = "expire", e.Admin = "admin", e.Event = "event", e))(ke || {});
218
+ const ve = t.string().enum(
219
+ "order",
220
+ "consumption",
221
+ "redeem",
222
+ "expire",
223
+ "admin",
224
+ "event"
225
+ /* Event */
226
+ );
227
+ var qe = /* @__PURE__ */ ((e) => (e.GameReward = "game_reward", e.Physical = "physical", e.Virtual = "virtual", e))(qe || {});
228
+ const T = t.string().enum(
229
+ "game_reward",
230
+ "physical",
231
+ "virtual"
232
+ /* Virtual */
233
+ );
234
+ var Re = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Issued = "issued", e.Failed = "failed", e))(Re || {});
235
+ const xe = t.string().enum(
236
+ "pending",
237
+ "issued",
238
+ "failed"
239
+ /* Failed */
240
+ ), Ce = o({
241
+ default_avatar_url: t.string(),
242
+ official_avatar_urls: t.array(t.string()),
243
+ default_nickname: t.string(),
244
+ default_bio: t.string(),
245
+ default_role_avatar_url: t.string(),
246
+ level_configs: t.array(t.object({ exp: t.number(), level: t.number(), title: t.string() })),
247
+ level_valid_days: t.number(),
248
+ benefit_description: t.string(),
249
+ exp_description: t.string(),
250
+ credit_description: t.string(),
251
+ send_role_mail_rate_limit: t.number()
252
+ }), M = t.object({
253
+ member_id: t.string(),
254
+ player_id: t.string(),
255
+ exp: t.number(),
256
+ level: t.number(),
257
+ credit: t.number(),
258
+ credit_expiring: t.number(),
259
+ level_change_time: t.number(),
260
+ level_expire_time: t.number()
261
+ });
262
+ t.guard(M);
263
+ const E = o({ player: M }), Q = t.shape({
264
+ role_id: t.string().disallow(""),
265
+ role_name: t.string(),
266
+ role_level: t.number(),
267
+ server_id: t.string(),
268
+ server_name: t.string(),
269
+ last_login_time: t.number()
270
+ }), H = t.object(Q);
271
+ t.guard(H);
272
+ const Le = o({ roles: t.array(H) }), N = t.object({
273
+ ...Q,
274
+ role_fighting: t.number(),
275
+ kin_id: t.string().optional(),
276
+ kin_name: t.string().optional(),
277
+ kin_position: t.string().optional()
278
+ });
279
+ t.guard(N);
280
+ const q = o({ role_card: N }), G = o({
281
+ name: t.string(),
282
+ avatar_url: t.string(),
283
+ bio: t.string(),
284
+ gender: we,
285
+ birthday: t.object({
286
+ year: t.number(),
287
+ month: t.number(),
288
+ day: t.number()
289
+ })
290
+ }), z = t.object({
291
+ address_id: t.number(),
292
+ recipient: t.string(),
293
+ mobile: t.string(),
294
+ province: t.string(),
295
+ city: t.string(),
296
+ district: t.string(),
297
+ address: t.string(),
298
+ is_default: t.bool()
299
+ }), I = t.guard(z), Ae = o({ addresses: t.array(z) }), Pe = o({
300
+ increased_credit: t.number(),
301
+ decreased_credit: t.number(),
302
+ expired_credit: t.number(),
303
+ balance_credit: t.number()
304
+ }), J = t.object({
305
+ id: t.number(),
306
+ change_time: t.number(),
307
+ change_type: be,
308
+ change_credit: t.number(),
309
+ balance: t.number(),
310
+ change_scene: ve
311
+ });
312
+ t.guard(J);
313
+ const Ue = o({
314
+ credit_logs: t.array(J),
315
+ next_token: t.string().optional()
316
+ }), P = t.shape({
317
+ product_id: t.number(),
318
+ catalog_id: t.number(),
319
+ catalog_name: t.string(),
320
+ item_type: T,
321
+ name: t.string(),
322
+ img_url: t.string(),
323
+ description: t.string(),
324
+ tag: t.string(),
325
+ price: t.number(),
326
+ stock: t.number(),
327
+ redeem_quantity: t.number(),
328
+ not_visible_after: t.number(),
329
+ not_visible_before: t.number(),
330
+ not_after: t.number(),
331
+ not_before: t.number(),
332
+ min_level: t.number(),
333
+ max_level: t.number(),
334
+ limit_daily: t.number(),
335
+ limit_monthly: t.number(),
336
+ limit_yearly: t.number(),
337
+ limit_total: t.number(),
338
+ weight: t.number(),
339
+ created_at: t.number(),
340
+ updated_at: t.number()
341
+ });
342
+ o(P);
343
+ const $e = o({ products: t.array(t.object(P)) }), K = t.shape({
344
+ benefit_id: t.number(),
345
+ name: t.string(),
346
+ img_url: t.string(),
347
+ description: t.string(),
348
+ min_level: t.number(),
349
+ max_level: t.number(),
350
+ product_id: t.number()
351
+ }), O = t.object({ ...K, tag: t.string() });
352
+ t.guard(O);
353
+ const je = o({ benefits: t.array(O) }), X = t.object({
354
+ ...K,
355
+ product: t.object(P).optional()
356
+ });
357
+ t.guard(X);
358
+ const Se = o({ benefit: X }), Y = t.object({
359
+ redemption_id: t.number(),
360
+ player_id: t.string(),
361
+ product_id: t.number(),
362
+ name: t.string(),
363
+ img_url: t.string(),
364
+ item_type: T,
365
+ catalog_id: t.number(),
366
+ catalog_name: t.string(),
367
+ quantity: t.number(),
368
+ amount: t.number(),
369
+ status: xe,
370
+ created_at: t.number(),
371
+ extra_data: t.union(
372
+ t.object({
373
+ recipient: t.string(),
374
+ mobile: t.string(),
375
+ province: t.string(),
376
+ city: t.string(),
377
+ district: t.string(),
378
+ express_company: t.string(),
379
+ express_number: t.string(),
380
+ address: t.string()
381
+ }),
382
+ t.object({
383
+ server_id: t.string(),
384
+ role_id: t.string(),
385
+ role_name: t.string()
386
+ })
387
+ ).optional()
388
+ });
389
+ t.guard(Y);
390
+ const De = o({
391
+ redemptions: t.array(Y),
392
+ next_token: t.string().optional()
393
+ });
394
+ class hr {
395
+ constructor(r) {
396
+ c(this, "token");
397
+ c(this, "req");
398
+ this.token = r, this.req = r.req;
405
399
  }
406
400
  /**
407
401
  * 获取俱乐部配置
@@ -409,8 +403,8 @@ class nr {
409
403
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=tuhsPt3ihp
410
404
  */
411
405
  async getConfig() {
412
- const { data: t } = await this.req.get("club/config", W);
413
- return t;
406
+ const { data: r } = await this.req.get("club/config", Ce);
407
+ return r;
414
408
  }
415
409
  /**
416
410
  * 用于游戏内嵌 Web 页面和微信小程序获取当前登录的游戏账号在俱乐部中的信息。
@@ -419,8 +413,8 @@ class nr {
419
413
  */
420
414
  async getCurrentPlayer() {
421
415
  await this.token.autoLogin();
422
- const { data: t, code: r } = await this.req.get("club/current-player", C);
423
- return (t == null ? void 0 : t.player) ?? { error: r };
416
+ const { data: r, code: n } = await this.req.get("club/current-player", E);
417
+ return (r == null ? void 0 : r.player) ?? { error: n };
424
418
  }
425
419
  /**
426
420
  * 俱乐部用户关联游戏账号
@@ -429,15 +423,15 @@ class nr {
429
423
  */
430
424
  async linkPlayer() {
431
425
  await this.token.autoLogin();
432
- const { data: t, code: r } = await this.req.post(
426
+ const { data: r, code: n } = await this.req.post(
433
427
  "club/link-player",
434
428
  {
435
429
  id_token: this.token.idToken
436
430
  },
437
- C
431
+ E
438
432
  );
439
- return (t == null ? void 0 : t.player) ?? {
440
- error: r
433
+ return (r == null ? void 0 : r.player) ?? {
434
+ error: n
441
435
  };
442
436
  }
443
437
  /**
@@ -445,33 +439,33 @@ class nr {
445
439
  *
446
440
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=nwu4FiGM9V
447
441
  */
448
- async getRoles(t, r) {
442
+ async getRoles(r, n) {
449
443
  if (!await this.token.autoLogin()) return [];
450
- const { data: i } = await this.req.get("club/roles", te, {
451
- params: s({ player_id: t, refresh: r })
444
+ const { data: s } = await this.req.get("club/roles", Le, {
445
+ params: a({ player_id: r, refresh: n })
452
446
  });
453
- return (i == null ? void 0 : i.roles) || [];
447
+ return (s == null ? void 0 : s.roles) || [];
454
448
  }
455
449
  /**
456
450
  * 获取俱乐部会员的角色卡片数据
457
451
  *
458
452
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=A1Wr7kUXnS
459
453
  */
460
- async getRoleCard(t) {
461
- const { data: r } = await this.req.get("club/role-card", f, {
462
- params: { member_id: t }
454
+ async getRoleCard(r) {
455
+ const { data: n } = await this.req.get("club/role-card", q, {
456
+ params: { member_id: r }
463
457
  });
464
- return (r == null ? void 0 : r.role_card) ?? null;
458
+ return (n == null ? void 0 : n.role_card) ?? null;
465
459
  }
466
460
  /**
467
461
  * 设置自己的角色卡片
468
462
  *
469
463
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=XgMf6OFE5i
470
464
  */
471
- async setRoleCard(t) {
465
+ async setRoleCard(r) {
472
466
  if (!await this.token.autoLogin()) return null;
473
- const { data: r } = await this.req.post("club/role-card", t, f);
474
- return (r == null ? void 0 : r.role_card) ?? null;
467
+ const { data: n } = await this.req.post("club/role-card", r, q);
468
+ return (n == null ? void 0 : n.role_card) ?? null;
475
469
  }
476
470
  /**
477
471
  * 强制刷新自己的角色卡片,从游戏内获取最新数据
@@ -480,30 +474,30 @@ class nr {
480
474
  */
481
475
  async refreshRoleCard() {
482
476
  if (!await this.token.autoLogin()) return null;
483
- const { data: t } = await this.req.post("club/refresh-role-card", {}, f);
484
- return (t == null ? void 0 : t.role_card) ?? null;
477
+ const { data: r } = await this.req.post("club/refresh-role-card", {}, q);
478
+ return (r == null ? void 0 : r.role_card) ?? null;
485
479
  }
486
480
  /**
487
481
  * 获取俱乐部用户的信息
488
482
  *
489
483
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TMWBCFcOr2
490
484
  */
491
- async getUserProfile(t) {
492
- const { data: r } = await this.req.get("club/user-profile", U, {
493
- params: { member_id: t }
485
+ async getUserProfile(r) {
486
+ const { data: n } = await this.req.get("club/user-profile", G, {
487
+ params: { member_id: r }
494
488
  });
495
- return r;
489
+ return n;
496
490
  }
497
491
  /**
498
492
  * 修改自己的俱乐部用户信息
499
493
  *
500
494
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Qt822A57jd
501
495
  */
502
- async updateUserProfile(t) {
496
+ async updateUserProfile(r) {
503
497
  await this.token.autoLogin();
504
- const { data: r, code: i } = await this.req.post("club/user-profile", t, U);
505
- return r ?? {
506
- error: i
498
+ const { data: n, code: s } = await this.req.post("club/user-profile", r, G);
499
+ return n ?? {
500
+ error: s
507
501
  };
508
502
  }
509
503
  /**
@@ -513,60 +507,60 @@ class nr {
513
507
  */
514
508
  async getAddresses() {
515
509
  if (!await this.token.autoLogin()) return [];
516
- const { data: t } = await this.req.get("club/addresses", ne);
517
- return (t == null ? void 0 : t.addresses) ?? [];
510
+ const { data: r } = await this.req.get("club/addresses", Ae);
511
+ return (r == null ? void 0 : r.addresses) ?? [];
518
512
  }
519
513
  /**
520
514
  * 增加俱乐部收货地址
521
515
  *
522
516
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=TaGIIYDRYA
523
517
  */
524
- async addAddress(t) {
518
+ async addAddress(r) {
525
519
  if (!await this.token.autoLogin()) return null;
526
- const { data: r } = await this.req.post("/club/add-address", s(t), v);
527
- return r;
520
+ const { data: n } = await this.req.post("/club/add-address", a(r), I);
521
+ return n;
528
522
  }
529
523
  /**
530
524
  * 修改自己的俱乐部收货地址
531
525
  *
532
526
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=p9FlJhHnWN
533
527
  */
534
- async updateAddress(t) {
528
+ async updateAddress(r) {
535
529
  await this.token.autoLogin();
536
- const { data: r, code: i } = await this.req.post("club/update-address", s(t), v);
537
- return r ?? { error: i };
530
+ const { data: n, code: s } = await this.req.post("club/update-address", a(r), I);
531
+ return n ?? { error: s };
538
532
  }
539
533
  /**
540
534
  * 删除自己的俱乐部收货地址
541
535
  *
542
536
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=MEEOBdf8rm
543
537
  */
544
- async deleteAddress(t) {
538
+ async deleteAddress(r) {
545
539
  if (!await this.token.autoLogin()) return null;
546
- const { ok: r } = await this.req.post("club/delete-address", { address_id: t });
547
- return r;
540
+ const { ok: n } = await this.req.post("club/delete-address", { address_id: r });
541
+ return n;
548
542
  }
549
543
  /**
550
544
  * 获取俱乐部积分统计信息
551
545
  *
552
546
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=x4uxtGstRL
553
547
  */
554
- async getUserCredit(t) {
548
+ async getUserCredit(r) {
555
549
  await this.token.autoLogin();
556
- const { data: r, code: i } = await this.req.get("club/user-credit", ie, { params: s(t) });
557
- return r ?? { error: i };
550
+ const { data: n, code: s } = await this.req.get("club/user-credit", Pe, { params: a(r) });
551
+ return n ?? { error: s };
558
552
  }
559
553
  /**
560
554
  * 获取自己的俱乐部积分变动记录
561
555
  *
562
556
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=lQFgF689P8
563
557
  */
564
- async getCreditLogs(t) {
558
+ async getCreditLogs(r) {
565
559
  await this.token.autoLogin();
566
- const { data: r } = await this.req.get("club/credit-logs", oe, {
567
- params: s({ max_results: 20, ...t })
560
+ const { data: n } = await this.req.get("club/credit-logs", Ue, {
561
+ params: a({ max_results: 20, ...r })
568
562
  });
569
- return r || { credit_logs: [] };
563
+ return { credit_logs: (n == null ? void 0 : n.credit_logs) || [], next_token: n == null ? void 0 : n.next_token };
570
564
  }
571
565
  /**
572
566
  * 获取自己的俱乐部权益列表
@@ -575,20 +569,20 @@ class nr {
575
569
  */
576
570
  async getBenefits() {
577
571
  if (!await this.token.autoLogin()) return [];
578
- const { data: t } = await this.req.get("club/benefits", ue);
579
- return (t == null ? void 0 : t.benefits) || [];
572
+ const { data: r } = await this.req.get("club/benefits", je);
573
+ return (r == null ? void 0 : r.benefits) || [];
580
574
  }
581
575
  /**
582
576
  * 获取某个权益详细信息
583
577
  *
584
578
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=XKto0MeaHF
585
579
  */
586
- async getBenefit(t) {
580
+ async getBenefit(r) {
587
581
  if (!await this.token.autoLogin()) return null;
588
- const { data: r } = await this.req.get("club/benefit", me, {
589
- params: { benefit_id: t }
582
+ const { data: n } = await this.req.get("club/benefit", Se, {
583
+ params: { benefit_id: r }
590
584
  });
591
- return (r == null ? void 0 : r.benefit) || null;
585
+ return (n == null ? void 0 : n.benefit) || null;
592
586
  }
593
587
  /**
594
588
  * 获取商城商品列表
@@ -596,19 +590,19 @@ class nr {
596
590
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=r3vC3PzfMQ
597
591
  */
598
592
  async getProducts() {
599
- const { data: t } = await this.req.get("club/products", le);
600
- return (t == null ? void 0 : t.products) || [];
593
+ const { data: r } = await this.req.get("club/products", $e);
594
+ return (r == null ? void 0 : r.products) || [];
601
595
  }
602
596
  /**
603
597
  * 兑换商城商品
604
598
  *
605
599
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=LWcMVwX3OY
606
600
  */
607
- async redeemProduct(t) {
601
+ async redeemProduct(r) {
608
602
  await this.token.autoLogin();
609
- const { ok: r, code: i } = await this.req.post("club/redeem-product", s(t));
610
- return r || {
611
- error: i
603
+ const { ok: n, code: s } = await this.req.post("club/redeem-product", a(r));
604
+ return n || {
605
+ error: s
612
606
  };
613
607
  }
614
608
  /**
@@ -616,59 +610,60 @@ class nr {
616
610
  *
617
611
  * https://kdocs.cn/l/cgp4gSBMbOf1?linkname=Ml6mLgT4cM
618
612
  */
619
- async getRedemptions(t) {
613
+ async getRedemptions(r) {
620
614
  await this.token.autoLogin();
621
- const { data: r } = await this.req.get("club/redemptions", pe, {
622
- params: s({ max_results: 20, ...t })
615
+ const { data: n } = await this.req.get("club/redemptions", De, {
616
+ params: a({ max_results: 20, ...r })
623
617
  });
624
- return r || { redemptions: [] };
618
+ return { redemptions: (n == null ? void 0 : n.redemptions) || [], next_token: n == null ? void 0 : n.next_token };
625
619
  }
626
620
  }
627
- var ke = /* @__PURE__ */ ((e) => (e.EventItem = "event_item", e.GameItem = "game_item", e.PhysicalItem = "physical_item", e.WeixinHongbao = "weixin_hongbao", e.GiftCode = "gift_code", e.LotteryTicket = "lottery_ticket", e.VoidItem = "void_item", e))(ke || {}), be = /* @__PURE__ */ ((e) => (e.UserId = "user_id", e.RoleId = "role_id", e))(be || {}), qe = /* @__PURE__ */ ((e) => (e.None = "none", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e))(qe || {}), a = /* @__PURE__ */ ((e) => (e.Preregister = "preregister", e.Lottery = "lottery", e.Survey = "survey", e.Invite = "invite", e.Share = "share", e.Follow = "follow", e.Subscribe = "weixin_subscribe", e.Comment = "comment", e.Vote = "vote", e.GiftCode = "gift_code", e.Register = "register", e.InvitedRegister = "invited_register", e.ClaimRewards = "claim_rewards", e.Cashback = "cashback", e.Quest = "quest", e.Team = "team", e.LotteryDraw = "lottery_draw", e))(a || {}), Re = /* @__PURE__ */ ((e) => (e.Active = "player_active_points", e.Login = "player_login_days", e.OrderAmount = "order_total_amount", e.Posts = "community_posts", e.Comments = "community_comments", e))(Re || {}), xe = /* @__PURE__ */ ((e) => (e.System = "system", e.UserSubmission = "user_submission", e.Shortlisted = "shortlisted", e))(xe || {}), Ae = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unclaimed = "unaccalimed", e.Received = "received", e))(Ae || {}), Le = /* @__PURE__ */ ((e) => (e.Unclaimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Le || {}), Ce = /* @__PURE__ */ ((e) => (e.Unclaimed = "unclaimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Ce || {}), Ue = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e))(Ue || {}), $e = /* @__PURE__ */ ((e) => (e.Output = "output", e.Engage = "engage", e))($e || {}), Pe = /* @__PURE__ */ ((e) => (e.Private = "private", e.Public = "public", e))(Pe || {}), De = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Pending = "pending", e.Drawn = "drawn", e.Claimed = "claimed", e.Fail = "fail", e))(De || {}), Ee = /* @__PURE__ */ ((e) => (e.Assemble = "assemble", e.Join = "join", e.Disband = "disband", e.ChangeVisibility = "change_visibility", e.Query = "query", e))(Ee || {}), Se = /* @__PURE__ */ ((e) => (e.Query = "query", e.Draw = "draw", e.Claim = "claim", e))(Se || {});
628
- function Ge(e) {
629
- return n(e, "event_name", "rules", "since", "until", "features") && Array.isArray(e.features) && e.features.every(Fe);
621
+ var Ve = /* @__PURE__ */ ((e) => (e.EventItem = "event_item", e.GameItem = "game_item", e.PhysicalItem = "physical_item", e.WeixinHongbao = "weixin_hongbao", e.GiftCode = "gift_code", e.LotteryTicket = "lottery_ticket", e.VoidItem = "void_item", e))(Ve || {}), Ee = /* @__PURE__ */ ((e) => (e.UserId = "user_id", e.RoleId = "role_id", e))(Ee || {}), Ge = /* @__PURE__ */ ((e) => (e.None = "none", e.Daily = "daily", e.Weekly = "weekly", e.Monthly = "monthly", e))(Ge || {}), u = /* @__PURE__ */ ((e) => (e.Preregister = "preregister", e.Lottery = "lottery", e.Survey = "survey", e.Invite = "invite", e.Share = "share", e.Follow = "follow", e.Subscribe = "weixin_subscribe", e.Comment = "comment", e.Vote = "vote", e.GiftCode = "gift_code", e.Register = "register", e.InvitedRegister = "invited_register", e.ClaimRewards = "claim_rewards", e.Cashback = "cashback", e.Quest = "quest", e.Team = "team", e.LotteryDraw = "lottery_draw", e.CheckIn = "check_in", e))(u || {}), Ie = /* @__PURE__ */ ((e) => (e.Active = "player_active_points", e.Login = "player_login_days", e.OrderAmount = "order_total_amount", e.Posts = "community_posts", e.Comments = "community_comments", e))(Ie || {}), Fe = /* @__PURE__ */ ((e) => (e.System = "system", e.UserSubmission = "user_submission", e.Shortlisted = "shortlisted", e))(Fe || {}), Be = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unclaimed = "unaccalimed", e.Received = "received", e))(Be || {}), Te = /* @__PURE__ */ ((e) => (e.Unclaimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Te || {}), Me = /* @__PURE__ */ ((e) => (e.Unclaimed = "unclaimed", e.Received = "received", e.Failed = "failed", e.Delivered = "delivered", e))(Me || {}), Qe = /* @__PURE__ */ ((e) => (e.Ineligible = "ineligible", e.Unaccalimed = "unaccalimed", e.Received = "received", e.Failed = "failed", e))(Qe || {}), He = /* @__PURE__ */ ((e) => (e.Output = "output", e.Engage = "engage", e))(He || {}), Ne = /* @__PURE__ */ ((e) => (e.Private = "private", e.Public = "public", e))(Ne || {}), ze = /* @__PURE__ */ ((e) => (e.Unknown = "unknown", e.Pending = "pending", e.Drawn = "drawn", e.Claimed = "claimed", e.Fail = "fail", e))(ze || {}), Je = /* @__PURE__ */ ((e) => (e.Assemble = "assemble", e.Join = "join", e.Disband = "disband", e.ChangeVisibility = "change_visibility", e.Query = "query", e))(Je || {}), Ke = /* @__PURE__ */ ((e) => (e.Query = "query", e.Draw = "draw", e.Claim = "claim", e))(Ke || {});
622
+ function Oe(e) {
623
+ return i(e, "event_name", "rules", "since", "until", "features") && Array.isArray(e.features) && e.features.every(Xe);
630
624
  }
631
- function Fe(e) {
632
- if (!Ve(e))
625
+ function Xe(e) {
626
+ if (!We(e))
633
627
  return !1;
634
628
  switch (e.feature_type) {
635
- case a.Preregister:
636
- case a.ClaimRewards:
637
- case a.Register:
638
- case a.InvitedRegister:
629
+ case u.Preregister:
630
+ case u.ClaimRewards:
631
+ case u.Register:
632
+ case u.InvitedRegister:
633
+ case u.CheckIn:
639
634
  return !0;
640
- case a.Lottery:
641
- return Te(e.config);
642
- case a.Survey:
643
- return Me(e.config);
644
- case a.Invite:
645
- return He(e.config);
646
- case a.Share:
647
- return je(e.config);
648
- case a.Follow:
649
- return ze(e.config);
650
- case a.Subscribe:
651
- return Je(e.config);
652
- case a.Comment:
653
- return Ke(e.config);
654
- case a.Vote:
655
- return Ne(e.config);
656
- case a.Cashback:
657
- return Xe(e.config);
658
- case a.GiftCode:
659
- return Ye(e.config);
660
- case a.Quest:
661
- return We(e.config);
662
- case a.Team:
663
- return et(e.config);
664
- case a.LotteryDraw:
635
+ case u.Lottery:
665
636
  return tt(e.config);
637
+ case u.Survey:
638
+ return rt(e.config);
639
+ case u.Invite:
640
+ return nt(e.config);
641
+ case u.Share:
642
+ return it(e.config);
643
+ case u.Follow:
644
+ return st(e.config);
645
+ case u.Subscribe:
646
+ return ot(e.config);
647
+ case u.Comment:
648
+ return at(e.config);
649
+ case u.Vote:
650
+ return ut(e.config);
651
+ case u.Cashback:
652
+ return mt(e.config);
653
+ case u.GiftCode:
654
+ return lt(e.config);
655
+ case u.Quest:
656
+ return dt(e.config);
657
+ case u.Team:
658
+ return _t(e.config);
659
+ case u.LotteryDraw:
660
+ return pt(e.config);
666
661
  default:
667
662
  return !1;
668
663
  }
669
664
  }
670
- function k(e) {
671
- return n(
665
+ function U(e) {
666
+ return i(
672
667
  e,
673
668
  "reward_item_id",
674
669
  "reward_amount",
@@ -678,14 +673,14 @@ function k(e) {
678
673
  "reward_item_rating"
679
674
  );
680
675
  }
681
- function Ie(e) {
682
- return n(e, "engage_count", "rewards") && Array.isArray(e.rewards) && e.rewards.every(k);
676
+ function Ye(e) {
677
+ return i(e, "engage_count", "rewards") && Array.isArray(e.rewards) && e.rewards.every(U);
683
678
  }
684
- function Be(e) {
685
- return n(e, "feature_reward_type", "reward_details") && (e.feature_reward_type === "every" ? Array.isArray(e.reward_details) && e.reward_details.every(k) : e.feature_reward_type === "regular" ? Array.isArray(e.reward_details) && e.reward_details.every(Ie) : !1);
679
+ function Ze(e) {
680
+ return i(e, "feature_reward_type", "reward_details") && (e.feature_reward_type === "every" ? Array.isArray(e.reward_details) && e.reward_details.every(U) : e.feature_reward_type === "regular" ? Array.isArray(e.reward_details) && e.reward_details.every(Ye) : !1);
686
681
  }
687
- function Ve(e) {
688
- return n(
682
+ function We(e) {
683
+ return i(
689
684
  e,
690
685
  "feature_id",
691
686
  "feature_name",
@@ -696,10 +691,10 @@ function Ve(e) {
696
691
  "since",
697
692
  "until",
698
693
  "engage_account"
699
- ) && ("feature_rewards" in e ? Be(e.feature_rewards) : !0);
694
+ ) && ("feature_rewards" in e ? Ze(e.feature_rewards) : !0);
700
695
  }
701
- function Qe(e) {
702
- return n(
696
+ function et(e) {
697
+ return i(
703
698
  e,
704
699
  "reward_item_id",
705
700
  "reward_item_name",
@@ -709,36 +704,36 @@ function Qe(e) {
709
704
  "reward_remaining_stock"
710
705
  );
711
706
  }
712
- function Te(e) {
713
- return n(
707
+ function tt(e) {
708
+ return i(
714
709
  e,
715
710
  "consume_item_id",
716
711
  "consume_item_name",
717
712
  "consume_item_icon_url",
718
713
  "consume_item_count",
719
714
  "rewards"
720
- ) && Array.isArray(e.rewards) && e.rewards.every(Qe);
715
+ ) && Array.isArray(e.rewards) && e.rewards.every(et);
721
716
  }
722
- function Me(e) {
723
- return n(e, "survey_id", "survey_url");
717
+ function rt(e) {
718
+ return i(e, "survey_id", "survey_url");
724
719
  }
725
- function He(e) {
726
- return n(e, "share_url");
720
+ function nt(e) {
721
+ return i(e, "share_url");
727
722
  }
728
- function je(e) {
729
- return n(e, "share_platform");
723
+ function it(e) {
724
+ return i(e, "share_platform");
730
725
  }
731
- function ze(e) {
732
- return n(e, "platform");
726
+ function st(e) {
727
+ return i(e, "platform");
733
728
  }
734
- function Je(e) {
735
- return n(e, "weixin_template_ids") && Array.isArray(e.weixin_template_ids) && e.weixin_template_ids.every((t) => typeof t == "string");
729
+ function ot(e) {
730
+ return i(e, "weixin_template_ids") && Array.isArray(e.weixin_template_ids) && e.weixin_template_ids.every((r) => typeof r == "string");
736
731
  }
737
- function Ke(e) {
738
- return n(e, "comments", "send_rate") && Array.isArray(e.comments) && e.comments.every((t) => typeof t == "string");
732
+ function at(e) {
733
+ return i(e, "comments", "send_rate") && Array.isArray(e.comments) && e.comments.every((r) => typeof r == "string");
739
734
  }
740
- function Ne(e) {
741
- return n(
735
+ function ut(e) {
736
+ return i(
742
737
  e,
743
738
  "vote_feature_ids",
744
739
  "submission_feature_ids",
@@ -746,13 +741,13 @@ function Ne(e) {
746
741
  "source",
747
742
  "options",
748
743
  "rewards"
749
- ) && Array.isArray(e.vote_feature_ids) && Array.isArray(e.submission_feature_ids) && Array.isArray(e.options) && e.options.every(Oe) && Array.isArray(e.rewards) && e.rewards.every(k);
744
+ ) && Array.isArray(e.vote_feature_ids) && Array.isArray(e.submission_feature_ids) && Array.isArray(e.options) && e.options.every(ct) && Array.isArray(e.rewards) && e.rewards.every(U);
750
745
  }
751
- function Oe(e) {
752
- return n(e, "sn", "name", "amount", "jump_url", "last_vote_time", "finalists") && ("img_urls" in e ? Array.isArray(e.img_urls) : !0) && ("video_urls" in e ? Array.isArray(e.video_urls) : !0) && ("descriptions" in e ? Array.isArray(e.descriptions) : !0);
746
+ function ct(e) {
747
+ return i(e, "sn", "name", "amount", "jump_url", "last_vote_time", "finalists") && ("img_urls" in e ? Array.isArray(e.img_urls) : !0) && ("video_urls" in e ? Array.isArray(e.video_urls) : !0) && ("descriptions" in e ? Array.isArray(e.descriptions) : !0);
753
748
  }
754
- function Xe(e) {
755
- return n(
749
+ function mt(e) {
750
+ return i(
756
751
  e,
757
752
  "order_start_time",
758
753
  "order_end_time",
@@ -760,43 +755,43 @@ function Xe(e) {
760
755
  "claim_rewards_end_time"
761
756
  );
762
757
  }
763
- function Ye(e) {
764
- return n(e, "gift_items") && Array.isArray(e.gift_items) && e.gift_items.every(Ze);
758
+ function lt(e) {
759
+ return i(e, "gift_items") && Array.isArray(e.gift_items) && e.gift_items.every(gt);
765
760
  }
766
- function Ze(e) {
767
- return n(e, "name", "count", "icon_url");
761
+ function gt(e) {
762
+ return i(e, "name", "count", "icon_url");
768
763
  }
769
- function We(e) {
770
- return n(e, "objective", "completion_value") && ("team" in e ? n(e.team, "completion_value") : !0);
764
+ function dt(e) {
765
+ return i(e, "objective", "completion_value") && ("team" in e ? i(e.team, "completion_value") : !0);
771
766
  }
772
- function et(e) {
773
- return n(e, "min_members", "max_members");
767
+ function _t(e) {
768
+ return i(e, "min_members", "max_members");
774
769
  }
775
- function tt(e) {
776
- return n(e, "draw_not_after", "draw_not_before");
770
+ function pt(e) {
771
+ return i(e, "draw_not_after", "draw_not_before");
777
772
  }
778
- function rt(e) {
779
- return n(e, "allowed", "registered");
773
+ function yt(e) {
774
+ return i(e, "allowed", "registered");
780
775
  }
781
- function w(e) {
782
- return n(e, "count");
776
+ function R(e) {
777
+ return i(e, "count");
783
778
  }
784
- function nt(e) {
785
- return n(e, "engagements") && Array.isArray(e.engagements) && (e.engagements.every(
786
- (t) => n(t, "user_id", "name", "avatar_url", "comment", "video_note", "created_at")
787
- ) || e.engagements.every((t) => n(t, "team_code", "leader_name", "total_members")));
779
+ function ft(e) {
780
+ return i(e, "engagements") && Array.isArray(e.engagements) && (e.engagements.every(
781
+ (r) => i(r, "user_id", "name", "avatar_url", "comment", "video_note", "created_at")
782
+ ) || e.engagements.every((r) => i(r, "team_code", "leader_name", "total_members")));
788
783
  }
789
- function it(e) {
790
- return n(e, "first_visit") && typeof e.first_visit == "boolean";
784
+ function wt(e) {
785
+ return i(e, "first_visit") && typeof e.first_visit == "boolean";
791
786
  }
792
- function st(e) {
793
- return n(e, "status") && Array.isArray(e.status) && e.status.every((t) => n(t, "feature_id", "can_engage", "has_unclaimed_rewards"));
787
+ function ht(e) {
788
+ return i(e, "status") && Array.isArray(e.status) && e.status.every((r) => i(r, "feature_id", "can_engage", "has_unclaimed_rewards"));
794
789
  }
795
- function ot(e) {
796
- return n(e, "engagements") && o(e.engagements, S);
790
+ function bt(e) {
791
+ return i(e, "engagements") && _(e.engagements, Z);
797
792
  }
798
- function S(e) {
799
- if (!n(
793
+ function Z(e) {
794
+ if (!i(
800
795
  e,
801
796
  "engagement_id",
802
797
  "sequence",
@@ -814,17 +809,17 @@ function S(e) {
814
809
  return !1;
815
810
  if (!("data" in e))
816
811
  return !0;
817
- const t = e.data;
818
- return mt(t) || lt(t) || _t(t) || gt(t) || dt(t) || pt(t) || ft(t) || wt(t) || yt(t) || ht(t) || vt(t) || kt(t);
812
+ const r = e.data;
813
+ return Rt(r) || xt(r) || Ct(r) || Lt(r) || At(r) || Pt(r) || Ut(r) || $t(r) || jt(r) || St(r) || Dt(r) || Vt(r);
819
814
  }
820
- function at(e) {
821
- return n(e, "engagements") && o(e.engagements, ut);
815
+ function kt(e) {
816
+ return i(e, "engagements") && _(e.engagements, vt);
822
817
  }
823
- function ut(e) {
824
- return n(e, "engagement_id", "sequence", "feature_id", "created_at", "user_id") && ("rewards" in e ? o(e.rewards, ct) : !0);
818
+ function vt(e) {
819
+ return i(e, "engagement_id", "sequence", "feature_id", "created_at", "user_id") && ("rewards" in e ? _(e.rewards, qt) : !0);
825
820
  }
826
- function ct(e) {
827
- return n(
821
+ function qt(e) {
822
+ return i(
828
823
  e,
829
824
  "reward_id",
830
825
  "reward_item_id",
@@ -835,52 +830,52 @@ function ct(e) {
835
830
  "reward_count",
836
831
  "reward_status",
837
832
  "receive_time"
838
- ) && ("extra_data" in e ? n(e.extra_data) : !0);
833
+ ) && ("extra_data" in e ? i(e.extra_data) : !0);
839
834
  }
840
- function mt(e) {
841
- return n(e, "platforms") && Array.isArray(e.platforms);
835
+ function Rt(e) {
836
+ return i(e, "platforms") && Array.isArray(e.platforms);
842
837
  }
843
- function lt(e) {
844
- return n(e, "lottery_count");
838
+ function xt(e) {
839
+ return i(e, "lottery_count");
845
840
  }
846
- function _t(e) {
847
- return n(e, "serial_number");
841
+ function Ct(e) {
842
+ return i(e, "serial_number");
848
843
  }
849
- function gt(e) {
850
- return n(e, "user_id");
844
+ function Lt(e) {
845
+ return i(e, "user_id");
851
846
  }
852
- function dt(e) {
853
- return n(e, "platform");
847
+ function At(e) {
848
+ return i(e, "platform");
854
849
  }
855
- function pt(e) {
856
- return n(e, "option_sn");
850
+ function Pt(e) {
851
+ return i(e, "option_sn");
857
852
  }
858
- function ft(e) {
859
- return n(e, "weixin_openid");
853
+ function Ut(e) {
854
+ return i(e, "weixin_openid");
860
855
  }
861
- function wt(e) {
862
- return n(e, "cashback_total_amount", "game_item_count", "order_total_amount");
856
+ function $t(e) {
857
+ return i(e, "cashback_total_amount", "game_item_count", "order_total_amount");
863
858
  }
864
- function yt(e) {
865
- return n(e, "gift_code");
859
+ function jt(e) {
860
+ return i(e, "gift_code");
866
861
  }
867
- function ht(e) {
868
- return n(e, "team_code", "visibility", "members") && Array.isArray(e.members) && e.members.every(
869
- (t) => n(t, "is_leader", "role_name", "server_name")
862
+ function St(e) {
863
+ return i(e, "team_code", "visibility", "members") && Array.isArray(e.members) && e.members.every(
864
+ (r) => i(r, "is_leader", "role_name", "server_name")
870
865
  );
871
866
  }
872
- function vt(e) {
873
- return n(e, "objective", "progress") ? "team" in e ? n(e.team, "progress", "players") && Array.isArray(e.team.players) && e.team.players.every(
874
- (t) => n(
875
- t,
867
+ function Dt(e) {
868
+ return i(e, "objective", "progress") ? "team" in e ? i(e.team, "progress", "players") && Array.isArray(e.team.players) && e.team.players.every(
869
+ (r) => i(
870
+ r,
876
871
  "user_id",
877
872
  "role_name",
878
873
  "is_leader"
879
874
  )
880
875
  ) : !0 : !1;
881
876
  }
882
- function G(e) {
883
- return n(
877
+ function W(e) {
878
+ return i(
884
879
  e,
885
880
  "reward_id",
886
881
  "reward_item_id",
@@ -896,13 +891,13 @@ function G(e) {
896
891
  "engagement_id",
897
892
  "feature_type",
898
893
  "receive_time"
899
- ) && ("extra_data" in e ? n(e.extra_data) : !0);
894
+ ) && ("extra_data" in e ? i(e.extra_data) : !0);
900
895
  }
901
- function kt(e) {
902
- return !n(e, "tickets") || !("status" in e) ? !1 : e.status === "unknown" || e.status === "pending" ? !0 : "reward" in e ? G(e.reward) : !1;
896
+ function Vt(e) {
897
+ return !i(e, "tickets") || !("status" in e) ? !1 : e.status === "unknown" || e.status === "pending" ? !0 : "reward" in e ? W(e.reward) : !1;
903
898
  }
904
- function bt(e) {
905
- return n(
899
+ function Et(e) {
900
+ return i(
906
901
  e,
907
902
  "reward_id",
908
903
  "reward_item_id",
@@ -914,47 +909,47 @@ function bt(e) {
914
909
  "reward_source"
915
910
  );
916
911
  }
917
- function qt(e) {
918
- return n(e, "engagement_id") && ("engagement" in e ? S(e.engagement) : !0) && ("rewards" in e ? o(e.rewards, bt) : !0);
912
+ function Gt(e) {
913
+ return i(e, "engagement_id") && ("engagement" in e ? Z(e.engagement) : !0) && ("rewards" in e ? _(e.rewards, Et) : !0);
919
914
  }
920
- function Rt(e) {
921
- return n(e, "reward_id", "reward_status");
915
+ function It(e) {
916
+ return i(e, "reward_id", "reward_status");
922
917
  }
923
- function xt(e) {
924
- return n(e, "claimed_items") && o(e.claimed_items, Rt);
918
+ function Ft(e) {
919
+ return i(e, "claimed_items") && _(e.claimed_items, It);
925
920
  }
926
- function At(e) {
927
- return n(e, "reward_status");
921
+ function Bt(e) {
922
+ return i(e, "reward_status");
928
923
  }
929
- function Lt(e) {
930
- return n(e, "user_rewards") && o(e.user_rewards, G);
924
+ function Tt(e) {
925
+ return i(e, "user_rewards") && _(e.user_rewards, W);
931
926
  }
932
- function Ct(e) {
933
- return n(e, "scene");
927
+ function Mt(e) {
928
+ return i(e, "scene");
934
929
  }
935
- function Ut(e) {
936
- return n(e, "params");
930
+ function Qt(e) {
931
+ return i(e, "params");
937
932
  }
938
- function $t(e) {
939
- return n(e, "img") && typeof e.img == "string";
933
+ function Ht(e) {
934
+ return i(e, "img") && typeof e.img == "string";
940
935
  }
941
- class ir {
942
- constructor(t, r) {
943
- u(this, "token");
944
- u(this, "event", 0);
945
- u(this, "req");
946
- this.token = t, this.event = r, this.req = t.req;
936
+ class br {
937
+ constructor(r, n) {
938
+ c(this, "token");
939
+ c(this, "event", 0);
940
+ c(this, "req");
941
+ this.token = r, this.event = n, this.req = r.req;
947
942
  }
948
943
  /**
949
944
  * 根据手机号白名单,检查手机号是否允许登录某个游戏
950
945
  *
951
946
  * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=OWGSPF3Ysl
952
947
  */
953
- async verifyMobileAllowed(t) {
954
- const { data: r } = await this.req.get("verify-mobile-allowed", rt, {
955
- params: { mobile: t }
948
+ async verifyMobileAllowed(r) {
949
+ const { data: n } = await this.req.get("verify-mobile-allowed", yt, {
950
+ params: { mobile: r }
956
951
  });
957
- return r;
952
+ return n;
958
953
  }
959
954
  /**
960
955
  * 获取运营活动的基础配置信息
@@ -962,56 +957,56 @@ class ir {
962
957
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=wFXxtdNKPm
963
958
  */
964
959
  async getConfig() {
965
- const { data: t } = await this.req.get(`event/${this.event}/event-config`, Ge);
966
- return t;
960
+ const { data: r } = await this.req.get(`event/${this.event}/event-config`, Oe);
961
+ return r;
967
962
  }
968
963
  /**
969
964
  * 获取某个玩法参与用户数量
970
965
  *
971
966
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
972
967
  */
973
- async getEngagementsUserCount(t) {
974
- const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, w, {
975
- params: { feature_id: t, type: "user" }
968
+ async getEngagementsUserCount(r) {
969
+ const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, R, {
970
+ params: { feature_id: r, type: "user" }
976
971
  });
977
- return (r == null ? void 0 : r.count) ?? null;
972
+ return (n == null ? void 0 : n.count) ?? null;
978
973
  }
979
974
  /**
980
975
  * 获取某个玩法参与次数
981
976
  *
982
977
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=ejPOcWMvT1
983
978
  */
984
- async getEngagementsCount(t) {
985
- const { data: r } = await this.req.get(`event/${this.event}/feature-engagement-count`, w, {
986
- params: { feature_id: t, type: "engagement" }
979
+ async getEngagementsCount(r) {
980
+ const { data: n } = await this.req.get(`event/${this.event}/feature-engagement-count`, R, {
981
+ params: { feature_id: r, type: "engagement" }
987
982
  });
988
- return (r == null ? void 0 : r.count) ?? null;
983
+ return (n == null ? void 0 : n.count) ?? null;
989
984
  }
990
985
  /**
991
986
  * 获取某个玩法的参与记录(和特定用户无关)
992
987
  *
993
988
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=THtZ4ewIQW
994
989
  */
995
- async getEngagements(t) {
996
- const { data: r } = await this.req.get(`event/${this.event}/feature-engagements`, nt, {
997
- params: { feature_id: t }
990
+ async getEngagements(r) {
991
+ const { data: n } = await this.req.get(`event/${this.event}/feature-engagements`, ft, {
992
+ params: { feature_id: r }
998
993
  });
999
- return (r == null ? void 0 : r.engagements) || [];
994
+ return (n == null ? void 0 : n.engagements) || [];
1000
995
  }
1001
996
  /**
1002
997
  * 用户访问某个活动或玩法
1003
998
  *
1004
999
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=DWtJrnrBCn
1005
1000
  */
1006
- async visit(t) {
1001
+ async visit(r) {
1007
1002
  await this.token.autoLogin();
1008
- const { data: r, code: i } = await this.req.post(
1003
+ const { data: n, code: s } = await this.req.post(
1009
1004
  `event/${this.event}/visit`,
1010
- s(t || {}),
1011
- it
1005
+ a(r || {}),
1006
+ wt
1012
1007
  );
1013
- return r ?? {
1014
- error: i
1008
+ return n ?? {
1009
+ error: s
1015
1010
  };
1016
1011
  }
1017
1012
  /**
@@ -1023,13 +1018,13 @@ class ir {
1023
1018
  *
1024
1019
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=WzX5BrMNpL
1025
1020
  */
1026
- async getUserFeatureStatus(t) {
1021
+ async getUserFeatureStatus(r) {
1027
1022
  if (!await this.token.autoLogin()) return [];
1028
- const { data: r } = await this.req.get("event/user-feature-status", st, {
1029
- params: s({ ...t, event_id: this.event }),
1023
+ const { data: n } = await this.req.get("event/user-feature-status", ht, {
1024
+ params: a({ ...r, event_id: this.event }),
1030
1025
  message: !1
1031
1026
  });
1032
- return (r == null ? void 0 : r.status) || [];
1027
+ return (n == null ? void 0 : n.status) || [];
1033
1028
  }
1034
1029
  /**
1035
1030
  * 获取当前登录用户参与某个玩法的记录
@@ -1038,35 +1033,35 @@ class ir {
1038
1033
  *
1039
1034
  * @deprecated 请改用 getUserEngagementsV2
1040
1035
  */
1041
- async getUserEngagements(t) {
1036
+ async getUserEngagements(r) {
1042
1037
  if (!await this.token.autoLogin()) return [];
1043
- const { data: r } = await this.req.get(`event/${this.event}/user-engagements`, ot, {
1044
- params: { feature_id: t }
1038
+ const { data: n } = await this.req.get(`event/${this.event}/user-engagements`, bt, {
1039
+ params: { feature_id: r }
1045
1040
  });
1046
- return (r == null ? void 0 : r.engagements) || [];
1041
+ return (n == null ? void 0 : n.engagements) || [];
1047
1042
  }
1048
1043
  /**
1049
1044
  * 获取当前登录用户参与某个玩法的记录
1050
1045
  *
1051
1046
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=NFDdV1dwWb
1052
1047
  */
1053
- async getUserEngagementsV2(t, r) {
1048
+ async getUserEngagementsV2(r, n) {
1054
1049
  if (!await this.token.autoLogin()) return [];
1055
- const { data: i } = await this.req.get("event/user-engagements", at, {
1056
- params: s({ max_results: 10, ...r, event_id: this.event, feature_id: t })
1050
+ const { data: s } = await this.req.get("event/user-engagements", kt, {
1051
+ params: a({ max_results: 10, ...n, event_id: this.event, feature_id: r })
1057
1052
  });
1058
- return (i == null ? void 0 : i.engagements) || [];
1053
+ return (s == null ? void 0 : s.engagements) || [];
1059
1054
  }
1060
1055
  /**
1061
1056
  * 用户参与某个玩法(需要先调用 visit 接口)
1062
1057
  *
1063
1058
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=vuOyrcry3S
1064
1059
  */
1065
- async engage(t) {
1060
+ async engage(r) {
1066
1061
  await this.token.autoLogin();
1067
- const { data: r, code: i } = await this.req.post(`event/${this.event}/engage`, s(t), qt);
1068
- return r ?? {
1069
- error: i
1062
+ const { data: n, code: s } = await this.req.post(`event/${this.event}/engage`, a(r), Gt);
1063
+ return n ?? {
1064
+ error: s
1070
1065
  };
1071
1066
  }
1072
1067
  /**
@@ -1074,11 +1069,11 @@ class ir {
1074
1069
  *
1075
1070
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=lCGuqgvUDP
1076
1071
  */
1077
- async claimRewards(t) {
1072
+ async claimRewards(r) {
1078
1073
  await this.token.autoLogin();
1079
- const { data: r, code: i } = await this.req.post("event/claim-rewards", s(t), xt);
1080
- return (r == null ? void 0 : r.claimed_items) ?? {
1081
- error: i
1074
+ const { data: n, code: s } = await this.req.post("event/claim-rewards", a(r), Ft);
1075
+ return (n == null ? void 0 : n.claimed_items) ?? {
1076
+ error: s
1082
1077
  };
1083
1078
  }
1084
1079
  /**
@@ -1086,15 +1081,15 @@ class ir {
1086
1081
  *
1087
1082
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=aQLhlOAB4Q
1088
1083
  */
1089
- async claimWeixinHongbao(t) {
1084
+ async claimWeixinHongbao(r) {
1090
1085
  await this.token.autoLogin();
1091
- const { data: r, code: i } = await this.req.post(
1086
+ const { data: n, code: s } = await this.req.post(
1092
1087
  `event/${this.event}/claim-weixin-hongbao`,
1093
- { reward_id: t },
1094
- At
1088
+ { reward_id: r },
1089
+ Bt
1095
1090
  );
1096
- return r ?? {
1097
- error: i
1091
+ return n ?? {
1092
+ error: s
1098
1093
  };
1099
1094
  }
1100
1095
  /**
@@ -1102,36 +1097,36 @@ class ir {
1102
1097
  *
1103
1098
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=qj12eIgYQG
1104
1099
  */
1105
- async getUserRewards(t) {
1100
+ async getUserRewards(r) {
1106
1101
  if (!await this.token.autoLogin()) return [];
1107
- const { data: r } = await this.req.post(
1102
+ const { data: n } = await this.req.post(
1108
1103
  "event/user-rewards",
1109
- s({ ...t, event_id: this.event }),
1110
- Lt
1104
+ a({ ...r, event_id: this.event }),
1105
+ Tt
1111
1106
  );
1112
- return (r == null ? void 0 : r.user_rewards) || [];
1107
+ return (n == null ? void 0 : n.user_rewards) || [];
1113
1108
  }
1114
1109
  /**
1115
1110
  * 查询用户活动道具数量。注意,这里只能是活动道具
1116
1111
  *
1117
1112
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=mnGCTeTgMb
1118
1113
  */
1119
- async getUserItemCount(t) {
1114
+ async getUserItemCount(r) {
1120
1115
  if (!await this.token.autoLogin()) return null;
1121
- const { data: r } = await this.req.get(`event/${this.event}/user-item-count`, w, {
1122
- params: { item_id: t }
1116
+ const { data: n } = await this.req.get(`event/${this.event}/user-item-count`, R, {
1117
+ params: { item_id: r }
1123
1118
  });
1124
- return (r == null ? void 0 : r.count) ?? null;
1119
+ return (n == null ? void 0 : n.count) ?? null;
1125
1120
  }
1126
1121
  /**
1127
1122
  * 填写实物奖励收货地址
1128
1123
  *
1129
1124
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=QIwGhnaexb
1130
1125
  */
1131
- async submitUserRewardAddress(t) {
1126
+ async submitUserRewardAddress(r) {
1132
1127
  if (!await this.token.autoLogin()) return null;
1133
- const { ok: r } = await this.req.post(`event/${this.event}/user-reward-address`, t);
1134
- return r;
1128
+ const { ok: n } = await this.req.post(`event/${this.event}/user-reward-address`, r);
1129
+ return n;
1135
1130
  }
1136
1131
  /**
1137
1132
  * 小程序码携带参数最多 32 个可见字符,若前端携带参数过长,则将参数保存在 api 中,并返回符合小程序码要求的 scene
@@ -1140,12 +1135,12 @@ class ir {
1140
1135
  *
1141
1136
  * @param params - 前端扫描二维码打开小程序所需参数
1142
1137
  */
1143
- async getUnlimitQrcodeScene(t) {
1138
+ async getUnlimitQrcodeScene(r) {
1144
1139
  if (!await this.token.autoLogin()) return null;
1145
- const { data: r } = await this.req.get("event/unlimit-qrcode-scene", Ct, {
1146
- params: { params: t }
1140
+ const { data: n } = await this.req.get("event/unlimit-qrcode-scene", Mt, {
1141
+ params: { params: r }
1147
1142
  });
1148
- return (r == null ? void 0 : r.scene) ?? null;
1143
+ return (n == null ? void 0 : n.scene) ?? null;
1149
1144
  }
1150
1145
  /**
1151
1146
  * 根据小程序码携带 scene 值,获取对应的前端所需参数
@@ -1154,152 +1149,250 @@ class ir {
1154
1149
  *
1155
1150
  * @param scene - 小程序码 scene 值
1156
1151
  */
1157
- async getParamsByQrcodeScene(t) {
1158
- const { data: r } = await this.req.get("event/params-by-qrcode-scene", Ut, {
1159
- params: { scene: t }
1152
+ async getParamsByQrcodeScene(r) {
1153
+ const { data: n } = await this.req.get("event/params-by-qrcode-scene", Qt, {
1154
+ params: { scene: r }
1160
1155
  });
1161
- return (r == null ? void 0 : r.params) ?? null;
1156
+ return (n == null ? void 0 : n.params) ?? null;
1162
1157
  }
1163
1158
  /**
1164
1159
  * 生成不限制的带参数的小程序码(data URI格式的小程序码)
1165
1160
  *
1166
1161
  * https://kdocs.cn/l/ckWFDcOsYEUA?linkname=Rvmoq8iIy0
1167
1162
  */
1168
- async generateUnlimitQrcode(t) {
1163
+ async generateUnlimitQrcode(r) {
1169
1164
  if (!await this.token.autoLogin()) return null;
1170
- const { data: r } = await this.req.post("event/unlimit-qrcode", s(t), $t);
1171
- return (r == null ? void 0 : r.img) ?? null;
1172
- }
1173
- }
1174
- function F(e) {
1175
- return n(e, "forum_id", "icon_url", "name", "tags", "sort", "mode", "member_ids") && Array.isArray(e.tags) && Array.isArray(e.member_ids);
1176
- }
1177
- function Pt(e) {
1178
- return n(e, "forums") && o(e.forums, F);
1179
- }
1180
- function b(e) {
1181
- return n(e, "topic_id", "cover_url", "name", "description", "tags", "post_num") && Array.isArray(e.tags);
1182
- }
1183
- function Dt(e) {
1184
- return n(e, "topics") && o(e.topics, b);
1185
- }
1186
- function Et(e) {
1187
- return n(e, "topic") && b(e.topic);
1188
- }
1189
- function q(e) {
1190
- return n(
1191
- e,
1192
- "post_id",
1193
- "forum",
1194
- "posted_by",
1195
- "nickname",
1196
- "avatar_url",
1197
- "content",
1198
- "summary",
1199
- "like_num",
1200
- "comments_num",
1201
- "liked",
1202
- "image_urls",
1203
- "topics",
1204
- "event_ids",
1205
- "is_pinned",
1206
- "is_highlighted",
1207
- "status",
1208
- "create_time"
1209
- ) && o(e.topics, b) && F(e.forum);
1210
- }
1211
- function $(e) {
1212
- return n(e, "next_token", "posts") && o(e.posts, q);
1213
- }
1214
- function St(e) {
1215
- return n(e, "post") && q(e.post);
1216
- }
1217
- function R(e) {
1218
- return n(e);
1219
- }
1220
- function Gt(e) {
1221
- return n(e) && ("post" in e ? q(e.post) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1222
- }
1223
- function g(e) {
1224
- return n(
1225
- e,
1226
- "comment_id",
1227
- "post_id",
1228
- "commented_by",
1229
- "nickname",
1230
- "avatar_url",
1231
- "content",
1232
- "like_num",
1233
- "reply_num",
1234
- "liked",
1235
- "image_url",
1236
- "create_time",
1237
- "status"
1238
- ) && ("replies" in e ? o(e.replies, x) : !0);
1239
- }
1240
- function Ft(e) {
1241
- return n(e, "comment") && g(e.comment);
1242
- }
1243
- function It(e) {
1244
- return n(e, "comments") && o(e.comments, g);
1245
- }
1246
- function x(e) {
1247
- return n(
1248
- e,
1249
- "reply_id",
1250
- "comment_id",
1251
- "replied_by",
1252
- "nickname",
1253
- "avatar_url",
1254
- "content",
1255
- "like_num",
1256
- "liked",
1257
- "reply_to",
1258
- "create_time"
1259
- ) && Bt(e.reply_to);
1260
- }
1261
- function Bt(e) {
1262
- return n(e, "reply_id", "replied_by", "avatar_url", "nickname");
1263
- }
1264
- function Vt(e) {
1265
- return n(e) && ("comment" in e ? g(e.comment) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1266
- }
1267
- function Qt(e) {
1268
- return n(e, "replies") && o(e.replies, x);
1269
- }
1270
- function Tt(e) {
1271
- return n(e, "reply") && x(e.reply);
1272
- }
1273
- function Mt(e) {
1274
- return n(e) && ("reply" in e ? g(e.comment) : !0) && ("antispam" in e ? R(e.antispam) : !0);
1275
- }
1276
- function Ht(e) {
1277
- return n(e, "image_url", "upload_url", "existed") && typeof e.existed == "boolean";
1278
- }
1279
- function jt(e) {
1280
- return n(
1281
- e,
1282
- "notification_id",
1283
- "notification_type",
1284
- "is_read",
1285
- "create_time",
1286
- "origin_user_id",
1287
- "origin_user_name",
1288
- "origin_user_avatar_url"
1289
- );
1290
- }
1291
- function zt(e) {
1292
- return n(e, "notifications") && o(e.notifications, jt);
1293
- }
1294
- function Jt(e) {
1295
- return n(e, "system", "comment", "like");
1296
- }
1297
- var Kt = /* @__PURE__ */ ((e) => (e.All = "all", e.Limit = "limit", e))(Kt || {}), Nt = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Approved = "approved", e.Failed = "failed", e.Suspect = "suspect", e))(Nt || {}), Ot = /* @__PURE__ */ ((e) => (e.System = "system", e.Comment = "comment", e.Like = "like", e))(Ot || {}), Xt = /* @__PURE__ */ ((e) => (e.System = "system", e.PostPinned = "post_pinned", e.PostHighlighted = "post_highlighted", e.PostDeleted = "post_deleted", e.PostCommented = "post_commented", e.PostLiked = "post_liked", e.CommentReplied = "comment_replied", e.CommentLiked = "comment_liked", e.CommentDeleted = "comment_deleted", e.ReplyReplied = "reply_replied", e.ReplyLiked = "reply_liked", e.ReplyDeleted = "reply_deleted", e))(Xt || {});
1298
- class sr {
1299
- constructor(t) {
1300
- u(this, "token");
1301
- u(this, "req");
1302
- this.token = t, this.req = t.req;
1165
+ const { data: n } = await this.req.post("event/unlimit-qrcode", a(r), Ht);
1166
+ return (n == null ? void 0 : n.img) ?? null;
1167
+ }
1168
+ }
1169
+ var Nt = /* @__PURE__ */ ((e) => (e.All = "all", e.Limit = "limit", e))(Nt || {});
1170
+ const zt = t.string().enum(
1171
+ "all",
1172
+ "limit"
1173
+ /* Limit */
1174
+ );
1175
+ var Jt = /* @__PURE__ */ ((e) => (e.Pending = "pending", e.Approved = "approved", e.Failed = "failed", e.Suspect = "suspect", e))(Jt || {});
1176
+ const ee = t.string().enum(
1177
+ "pending",
1178
+ "approved",
1179
+ "failed",
1180
+ "suspect"
1181
+ /* Suspect */
1182
+ );
1183
+ var Kt = /* @__PURE__ */ ((e) => (e.System = "system", e.Comment = "comment", e.Like = "like", e))(Kt || {});
1184
+ const kr = t.string().enum(
1185
+ "system",
1186
+ "comment",
1187
+ "like"
1188
+ /* Like */
1189
+ );
1190
+ var m = /* @__PURE__ */ ((e) => (e.System = "system", e.PostPinned = "post_pinned", e.PostHighlighted = "post_highlighted", e.PostDeleted = "post_deleted", e.PostCommented = "post_commented", e.PostLiked = "post_liked", e.CommentReplied = "comment_replied", e.CommentLiked = "comment_liked", e.CommentDeleted = "comment_deleted", e.ReplyReplied = "reply_replied", e.ReplyLiked = "reply_liked", e.ReplyDeleted = "reply_deleted", e))(m || {});
1191
+ const Ot = t.string().enum(
1192
+ "system",
1193
+ "post_pinned",
1194
+ "post_highlighted",
1195
+ "post_deleted",
1196
+ "post_commented",
1197
+ "post_liked",
1198
+ "comment_replied",
1199
+ "comment_liked",
1200
+ "comment_deleted",
1201
+ "reply_replied",
1202
+ "reply_liked",
1203
+ "reply_deleted"
1204
+ /* ReplyDeleted */
1205
+ ), $ = t.object({
1206
+ forum_id: t.number(),
1207
+ icon_url: t.string(),
1208
+ name: t.string(),
1209
+ tags: t.array(t.string()),
1210
+ sort: t.number(),
1211
+ mode: zt,
1212
+ member_ids: t.array(t.number())
1213
+ });
1214
+ t.guard($);
1215
+ const Xt = o({ forums: t.array($) }), w = t.object({
1216
+ topic_id: t.number(),
1217
+ cover_url: t.string(),
1218
+ name: t.string(),
1219
+ description: t.string(),
1220
+ tags: t.array(t.string()),
1221
+ post_num: t.number()
1222
+ });
1223
+ t.guard(w);
1224
+ const Yt = o({ topics: t.array(w) }), Zt = o({ topic: w }), te = t.shape({
1225
+ post_id: t.number(),
1226
+ forum: $,
1227
+ posted_by: t.string(),
1228
+ nickname: t.string(),
1229
+ avatar_url: t.string(),
1230
+ title: t.string().optional(),
1231
+ content: t.string(),
1232
+ summary: t.string(),
1233
+ like_num: t.number(),
1234
+ comments_num: t.number(),
1235
+ liked: t.bool(),
1236
+ image_urls: t.array(t.string()),
1237
+ topics: t.array(w),
1238
+ event_ids: t.array(t.number()),
1239
+ is_pinned: t.bool(),
1240
+ is_highlighted: t.bool(),
1241
+ status: ee,
1242
+ create_time: t.number()
1243
+ }), j = t.object(te);
1244
+ t.guard(j);
1245
+ const F = o({
1246
+ posts: t.array(j),
1247
+ next_token: t.string().optional()
1248
+ }), Wt = o({ post: j }), S = t.object({ err_msg: t.string().optional() }), er = t.guard(S), tr = o({
1249
+ post: t.object(te).optional(),
1250
+ antispam: S
1251
+ }), re = t.object({
1252
+ reply_id: t.number(),
1253
+ reply_content: t.string().optional(),
1254
+ replied_by: t.string(),
1255
+ nickname: t.string(),
1256
+ avatar_url: t.string()
1257
+ });
1258
+ t.guard(re);
1259
+ const h = t.object({
1260
+ reply_id: t.number(),
1261
+ comment_id: t.number(),
1262
+ comment_content: t.string().optional(),
1263
+ commented_by: t.string().optional(),
1264
+ commented_by_nickname: t.string().optional(),
1265
+ commented_by_avatar_url: t.string().optional(),
1266
+ replied_by: t.string(),
1267
+ nickname: t.string(),
1268
+ avatar_url: t.string(),
1269
+ content: t.string(),
1270
+ like_num: t.number(),
1271
+ liked: t.bool(),
1272
+ reply_to: re,
1273
+ create_time: t.number()
1274
+ });
1275
+ t.guard(h);
1276
+ const rr = o({
1277
+ replies: t.array(h),
1278
+ next_token: t.string().optional()
1279
+ }), nr = o({ reply: h });
1280
+ function ir(e) {
1281
+ return i(e) && ("reply" in e ? sr(e.comment) : !0) && ("antispam" in e ? er(e.antispam) : !0);
1282
+ }
1283
+ const b = t.object({
1284
+ comment_id: t.number(),
1285
+ post_id: t.number(),
1286
+ post_subject: t.string().optional(),
1287
+ post_summary: t.string().optional(),
1288
+ post_image_url: t.string().optional(),
1289
+ posted_by: t.string().optional(),
1290
+ posted_by_nickname: t.string().optional(),
1291
+ posted_by_avatar_url: t.string().optional(),
1292
+ commented_by: t.string(),
1293
+ nickname: t.string(),
1294
+ avatar_url: t.string(),
1295
+ content: t.string(),
1296
+ like_num: t.number(),
1297
+ reply_num: t.number(),
1298
+ liked: t.bool(),
1299
+ image_url: t.string(),
1300
+ create_time: t.number(),
1301
+ status: ee,
1302
+ replies: t.array(h).optional()
1303
+ }), sr = t.guard(b), or = o({ comment: b }), ar = o({
1304
+ comments: t.array(b),
1305
+ next_token: t.string().optional()
1306
+ }), ur = o({
1307
+ comment: b.clone().optional(),
1308
+ antispam: S.clone().optional()
1309
+ }), cr = o({
1310
+ image_url: t.string(),
1311
+ upload_url: t.string(),
1312
+ existed: t.bool()
1313
+ }), g = t.shape({
1314
+ notification_id: t.string(),
1315
+ notification_type: Ot,
1316
+ is_read: t.bool(),
1317
+ create_time: t.number(),
1318
+ origin_user_id: t.string(),
1319
+ origin_user_name: t.string(),
1320
+ origin_user_avatar_url: t.string()
1321
+ }), x = t.shape({
1322
+ post_id: t.number(),
1323
+ post_subject: t.string(),
1324
+ post_summary: t.string(),
1325
+ post_image_url: t.string()
1326
+ }), f = t.shape({
1327
+ comment_id: t.number(),
1328
+ comment_content: t.string()
1329
+ }), C = t.shape({
1330
+ reply_id: t.number(),
1331
+ reply_content: t.string()
1332
+ }), mr = t.guard(
1333
+ t.union(
1334
+ t.object({
1335
+ ...g,
1336
+ notification_type: t.string().enum(m.System),
1337
+ system_message_content: t.string(),
1338
+ system_message_subject: t.string()
1339
+ }),
1340
+ t.object({
1341
+ ...g,
1342
+ ...x,
1343
+ notification_type: t.string().enum(
1344
+ m.PostPinned,
1345
+ m.PostHighlighted,
1346
+ m.PostDeleted,
1347
+ m.PostLiked
1348
+ )
1349
+ }),
1350
+ t.object({
1351
+ ...g,
1352
+ ...x,
1353
+ ...f,
1354
+ notification_type: t.string().enum(m.PostCommented)
1355
+ }),
1356
+ t.object({
1357
+ ...g,
1358
+ ...f,
1359
+ ...C,
1360
+ notification_type: t.string().enum(m.CommentReplied)
1361
+ }),
1362
+ t.object({
1363
+ ...g,
1364
+ ...f,
1365
+ ...x,
1366
+ notification_type: t.string().enum(m.CommentLiked, m.CommentDeleted)
1367
+ }),
1368
+ t.object({
1369
+ ...g,
1370
+ ...C,
1371
+ reply_to_reply_content: t.string(),
1372
+ reply_to_reply_id: t.number(),
1373
+ comment_id: t.number(),
1374
+ notification_type: t.string().enum(m.ReplyReplied)
1375
+ }),
1376
+ t.object({
1377
+ ...g,
1378
+ ...C,
1379
+ ...f,
1380
+ notification_type: t.string().enum(m.ReplyLiked, m.ReplyDeleted)
1381
+ })
1382
+ )
1383
+ ), lr = o({
1384
+ notifications: t.array(t.custom("Notification", mr)),
1385
+ next_token: t.string().optional()
1386
+ }), gr = o({
1387
+ system: t.number(),
1388
+ comment: t.number(),
1389
+ like: t.number()
1390
+ });
1391
+ class vr {
1392
+ constructor(r) {
1393
+ c(this, "token");
1394
+ c(this, "req");
1395
+ this.token = r, this.req = r.req;
1303
1396
  }
1304
1397
  /**
1305
1398
  * 获取社区版块列表,仅返回启用状态的版块
@@ -1307,8 +1400,8 @@ class sr {
1307
1400
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=QaqUa2K0z0
1308
1401
  */
1309
1402
  async getForums() {
1310
- const { data: t } = await this.req.get("community/forums", Pt);
1311
- return (t == null ? void 0 : t.forums) || [];
1403
+ const { data: r } = await this.req.get("community/forums", Xt);
1404
+ return (r == null ? void 0 : r.forums) || [];
1312
1405
  }
1313
1406
  /**
1314
1407
  * 获取社区话题列表,仅返回启用状态的话题
@@ -1316,62 +1409,62 @@ class sr {
1316
1409
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=mIwpymAQom
1317
1410
  */
1318
1411
  async getTopics() {
1319
- const { data: t } = await this.req.get("community/topics", Dt);
1320
- return (t == null ? void 0 : t.topics) || [];
1412
+ const { data: r } = await this.req.get("community/topics", Yt);
1413
+ return (r == null ? void 0 : r.topics) || [];
1321
1414
  }
1322
1415
  /**
1323
1416
  * 根据话题 ID 获取社区话题信息
1324
1417
  *
1325
1418
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=Jvw7xMK31K
1326
1419
  */
1327
- async getTopic(t) {
1328
- const { data: r, code: i } = await this.req.get("community/topic", Et, {
1329
- params: { topic_id: t }
1420
+ async getTopic(r) {
1421
+ const { data: n, code: s } = await this.req.get("community/topic", Zt, {
1422
+ params: { topic_id: r }
1330
1423
  });
1331
- return (r == null ? void 0 : r.topic) ?? { error: i };
1424
+ return (n == null ? void 0 : n.topic) ?? { error: s };
1332
1425
  }
1333
1426
  /**
1334
1427
  * 获取社区帖子列表
1335
1428
  *
1336
1429
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=XKI9lDVrPq
1337
1430
  */
1338
- async getPosts(t) {
1339
- const { data: r, code: i } = await this.req.get("community/posts", $, {
1340
- params: s(t)
1431
+ async getPosts(r) {
1432
+ const { data: n, code: s } = await this.req.get("community/posts", F, {
1433
+ params: a(r)
1341
1434
  });
1342
- return r ?? { error: i };
1435
+ return n ?? { error: s };
1343
1436
  }
1344
1437
  /**
1345
1438
  * 获取社区置顶帖子列表
1346
1439
  *
1347
1440
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=yXubbZuDlC
1348
1441
  */
1349
- async getPinnedPosts(t, r, i) {
1350
- const { data: c, code: d } = await this.req.get("community/pinned-posts", $, {
1351
- params: s({ forum_id: t, max_results: r, next_token: i })
1442
+ async getPinnedPosts(r, n, s) {
1443
+ const { data: l, code: k } = await this.req.get("community/pinned-posts", F, {
1444
+ params: a({ forum_id: r, max_results: n, next_token: s })
1352
1445
  });
1353
- return c ?? { error: d };
1446
+ return l ?? { error: k };
1354
1447
  }
1355
1448
  /**
1356
1449
  * 根据帖子 id 获取帖子详情
1357
1450
  *
1358
1451
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=hj1AZy5rcP
1359
1452
  */
1360
- async getPost(t) {
1361
- const { data: r, code: i } = await this.req.get("community/post", St, {
1362
- params: { post_id: t }
1453
+ async getPost(r) {
1454
+ const { data: n, code: s } = await this.req.get("community/post", Wt, {
1455
+ params: { post_id: r }
1363
1456
  });
1364
- return (r == null ? void 0 : r.post) ?? { error: i };
1457
+ return (n == null ? void 0 : n.post) ?? { error: s };
1365
1458
  }
1366
1459
  /**
1367
1460
  * 发布帖子
1368
1461
  *
1369
1462
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=M5okHBuaVk
1370
1463
  */
1371
- async post(t) {
1372
- const { data: r, code: i } = await this.req.post("community/post", s(t), Gt);
1373
- return r ?? {
1374
- error: i
1464
+ async post(r) {
1465
+ const { data: n, code: s } = await this.req.post("community/post", a(r), tr);
1466
+ return n ?? {
1467
+ error: s
1375
1468
  };
1376
1469
  }
1377
1470
  /**
@@ -1379,33 +1472,33 @@ class sr {
1379
1472
  *
1380
1473
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=djKbX7lFdp
1381
1474
  */
1382
- async getComments(t) {
1383
- const { data: r, code: i } = await this.req.get("community/comments", It, {
1384
- params: s(t)
1475
+ async getComments(r) {
1476
+ const { data: n, code: s } = await this.req.get("community/comments", ar, {
1477
+ params: a(r)
1385
1478
  });
1386
- return r ?? { error: i };
1479
+ return n ?? { error: s };
1387
1480
  }
1388
1481
  /**
1389
1482
  * 根据评论 id 获取评论详情
1390
1483
  *
1391
1484
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=RIc7oxVGae
1392
1485
  */
1393
- async getComment(t) {
1394
- const { data: r, code: i } = await this.req.get("community/comment", Ft, {
1395
- params: { comment_id: t }
1486
+ async getComment(r) {
1487
+ const { data: n, code: s } = await this.req.get("community/comment", or, {
1488
+ params: { comment_id: r }
1396
1489
  });
1397
- return (r == null ? void 0 : r.comment) ?? { error: i };
1490
+ return (n == null ? void 0 : n.comment) ?? { error: s };
1398
1491
  }
1399
1492
  /**
1400
1493
  * 帖子下发表评论
1401
1494
  *
1402
1495
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=Nv7lk0nTmr
1403
1496
  */
1404
- async comment(t) {
1497
+ async comment(r) {
1405
1498
  await this.token.autoLogin();
1406
- const { data: r, code: i } = await this.req.post("community/comment", s(t), Vt);
1407
- return r ?? {
1408
- error: i
1499
+ const { data: n, code: s } = await this.req.post("community/comment", a(r), ur);
1500
+ return n ?? {
1501
+ error: s
1409
1502
  };
1410
1503
  }
1411
1504
  /**
@@ -1413,33 +1506,33 @@ class sr {
1413
1506
  *
1414
1507
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=sVKBbY83MY
1415
1508
  */
1416
- async getReplies(t) {
1417
- const { data: r } = await this.req.get("community/replies", Qt, {
1418
- params: s({ max_results: 20, ...t })
1509
+ async getReplies(r) {
1510
+ const { data: n } = await this.req.get("community/replies", rr, {
1511
+ params: a({ max_results: 20, ...r })
1419
1512
  });
1420
- return r ?? { replies: [] };
1513
+ return n ?? { replies: [] };
1421
1514
  }
1422
1515
  /**
1423
1516
  * 根据回复 id 获取回复详情
1424
1517
  *
1425
1518
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=kxhcSXD3MG
1426
1519
  */
1427
- async getReply(t) {
1428
- const { data: r, code: i } = await this.req.get("community/reply", Tt, {
1429
- params: { reply_id: t }
1520
+ async getReply(r) {
1521
+ const { data: n, code: s } = await this.req.get("community/reply", nr, {
1522
+ params: { reply_id: r }
1430
1523
  });
1431
- return (r == null ? void 0 : r.reply) ?? { error: i };
1524
+ return (n == null ? void 0 : n.reply) ?? { error: s };
1432
1525
  }
1433
1526
  /**
1434
1527
  * 回复帖子评论或回复
1435
1528
  *
1436
1529
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=KA8WpTX2pg
1437
1530
  */
1438
- async reply(t) {
1531
+ async reply(r) {
1439
1532
  await this.token.autoLogin();
1440
- const { data: r, code: i } = await this.req.post("community/reply", s(t), Mt);
1441
- return r ?? {
1442
- error: i
1533
+ const { data: n, code: s } = await this.req.post("community/reply", a(r), ir);
1534
+ return n ?? {
1535
+ error: s
1443
1536
  };
1444
1537
  }
1445
1538
  /**
@@ -1447,11 +1540,11 @@ class sr {
1447
1540
  *
1448
1541
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
1449
1542
  */
1450
- async like(t) {
1543
+ async like(r) {
1451
1544
  await this.token.autoLogin();
1452
- const { ok: r, code: i } = await this.req.post("community/like", { ...t, action: "like" });
1453
- return r || {
1454
- error: i
1545
+ const { ok: n, code: s } = await this.req.post("community/like", { ...r, action: "like" });
1546
+ return n || {
1547
+ error: s
1455
1548
  };
1456
1549
  }
1457
1550
  /**
@@ -1459,11 +1552,11 @@ class sr {
1459
1552
  *
1460
1553
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=CR3m6PyXfZ
1461
1554
  */
1462
- async unlike(t) {
1555
+ async unlike(r) {
1463
1556
  await this.token.autoLogin();
1464
- const { ok: r, code: i } = await this.req.post("community/like", { ...t, action: "unlike" });
1465
- return r || {
1466
- error: i
1557
+ const { ok: n, code: s } = await this.req.post("community/like", { ...r, action: "unlike" });
1558
+ return n || {
1559
+ error: s
1467
1560
  };
1468
1561
  }
1469
1562
  /**
@@ -1471,12 +1564,12 @@ class sr {
1471
1564
  *
1472
1565
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=dWWhpoShxZ
1473
1566
  */
1474
- async getMediaPresignUrl(t) {
1567
+ async getMediaPresignUrl(r) {
1475
1568
  await this.token.autoLogin();
1476
- const { data: r } = await this.req.get("community/media-presign-url", Ht, {
1477
- params: t
1569
+ const { data: n } = await this.req.get("community/media-presign-url", cr, {
1570
+ params: r
1478
1571
  });
1479
- return r;
1572
+ return n;
1480
1573
  }
1481
1574
  /**
1482
1575
  * 获取用户社区通知
@@ -1485,12 +1578,12 @@ class sr {
1485
1578
  *
1486
1579
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=W5lceDgbBG
1487
1580
  */
1488
- async getNotifications(t) {
1581
+ async getNotifications(r) {
1489
1582
  await this.token.autoLogin();
1490
- const { data: r } = await this.req.get("community/notifications", zt, {
1491
- params: s({ max_results: 20, ...t })
1583
+ const { data: n } = await this.req.get("community/notifications", lr, {
1584
+ params: a({ max_results: 20, ...r })
1492
1585
  });
1493
- return r || { notifications: [] };
1586
+ return n || { notifications: [] };
1494
1587
  }
1495
1588
  /**
1496
1589
  * 获取用户未读通知数量
@@ -1499,26 +1592,26 @@ class sr {
1499
1592
  */
1500
1593
  async getUnreadNotificationsCount() {
1501
1594
  if (!await this.token.autoLogin()) return null;
1502
- const { data: t } = await this.req.get("community/unread-notifications-count", Jt);
1503
- return t;
1595
+ const { data: r } = await this.req.get("community/unread-notifications-count", gr);
1596
+ return r;
1504
1597
  }
1505
1598
  /**
1506
1599
  * 社区用户将通知标为已读
1507
1600
  *
1508
1601
  * https://kdocs.cn/l/cbggfJodHLIz?linkname=TCJQxnOjJe
1509
1602
  */
1510
- async clearUnreadNotifications(t) {
1603
+ async clearUnreadNotifications(r) {
1511
1604
  if (!await this.token.autoLogin()) return !1;
1512
- const { ok: r } = await this.req.post("community/clear-unread-notifications", { category: t });
1513
- return r;
1605
+ const { ok: n } = await this.req.post("community/clear-unread-notifications", { category: r });
1606
+ return n;
1514
1607
  }
1515
1608
  }
1516
- function y(e) {
1517
- return n(e, "openid", "unionid", "weixin_token");
1609
+ function L(e) {
1610
+ return i(e, "openid", "unionid", "weixin_token");
1518
1611
  }
1519
- var Yt = /* @__PURE__ */ ((e) => (e.RedirectUriDisMatch = "10003", e.AppidError = "10016", e.AuthorizationError = "10015", e.NoRightForScope = "10005", e.Frequently = "10009", e.AppBanded = "10004", e.ShouldFllow = "10006", e.ScopeNull = "10010", e.RedirectUriNull = "10011", e.AppidNull = "10012", e.StateNull = "10013", e))(Yt || {});
1520
- const P = "wx_login_cache";
1521
- class or {
1612
+ var dr = /* @__PURE__ */ ((e) => (e.RedirectUriDisMatch = "10003", e.AppidError = "10016", e.AuthorizationError = "10015", e.NoRightForScope = "10005", e.Frequently = "10009", e.AppBanded = "10004", e.ShouldFllow = "10006", e.ScopeNull = "10010", e.RedirectUriNull = "10011", e.AppidNull = "10012", e.StateNull = "10013", e))(dr || {});
1613
+ const B = "wx_login_cache";
1614
+ class qr {
1522
1615
  /**
1523
1616
  * 创建微信相关功能接口
1524
1617
  *
@@ -1532,11 +1625,11 @@ class or {
1532
1625
  *
1533
1626
  * https://developers.weixin.qq.com/miniprogram/dev/api/open-api/account-info/wx.getAccountInfoSync.html
1534
1627
  */
1535
- constructor(t, r) {
1536
- u(this, "token");
1537
- u(this, "appid");
1538
- u(this, "req");
1539
- this.token = t, this.req = t.req, this.appid = r, this.getLoginCache();
1628
+ constructor(r, n) {
1629
+ c(this, "token");
1630
+ c(this, "appid");
1631
+ c(this, "req");
1632
+ this.token = r, this.req = r.req, this.appid = n, this.getLoginCache();
1540
1633
  }
1541
1634
  /**
1542
1635
  * 检查缓存中的登录数据
@@ -1546,11 +1639,11 @@ class or {
1546
1639
  * 也可以直接调用 login 方法,并传入 wxcode 的读取函数
1547
1640
  */
1548
1641
  async getLoginCache() {
1549
- const t = this.token.storage.get(P);
1550
- if (!t)
1642
+ const r = this.token.storage.get(B);
1643
+ if (!r)
1551
1644
  return null;
1552
- const r = K(t);
1553
- return y(r) ? (this.token.weixinToken = r.weixin_token, await this.token.autoLogin(), r) : null;
1645
+ const n = le(r);
1646
+ return L(n) ? (this.token.weixinToken = n.weixin_token, await this.token.autoLogin(), n) : null;
1554
1647
  }
1555
1648
  /**
1556
1649
  * 小程序页面微信静默登录,获取 weixinToken / openid / unionid。
@@ -1570,18 +1663,18 @@ class or {
1570
1663
  * https://kdocs.cn/l/cf2mO2uRLqh9?linkname=GwIZ0givCb
1571
1664
  */
1572
1665
  async login() {
1573
- if (!m.wx)
1666
+ if (!d.wx)
1574
1667
  throw new Error("当前环境非微信小程序");
1575
- const t = await this.getLoginCache();
1576
- if (t)
1577
- return t;
1578
- const r = await X(), { data: i, code: c } = await this.req.post(
1668
+ const r = await this.getLoginCache();
1669
+ if (r)
1670
+ return r;
1671
+ const n = await _e(), { data: s, code: l } = await this.req.post(
1579
1672
  "weixin/login",
1580
- { code: r, appid: this.appid },
1581
- y,
1673
+ { code: n, appid: this.appid },
1674
+ L,
1582
1675
  { message: !1 }
1583
1676
  );
1584
- return i && (this.token.weixinToken = i.weixin_token, this.token.storage.set(P, JSON.stringify(i)), await this.token.autoLogin()), i ?? { error: c };
1677
+ return s && (this.token.weixinToken = s.weixin_token, this.token.storage.set(B, JSON.stringify(s)), await this.token.autoLogin()), s ?? { error: l };
1585
1678
  }
1586
1679
  /**
1587
1680
  * 在微信内嵌网页中调用微信公众号授权登录【暂未启用】
@@ -1599,28 +1692,28 @@ class or {
1599
1692
  * - snsapi_base 不弹出授权页面,用户无感知,只能获取用户 openid,如果需要获取 unionid 则需要 snsapi_userinfo
1600
1693
  * - snsapi_userinfo 【默认】弹出授权页面,可拿到 openid、unionid、昵称、头像等信息,但用户也可能会拒绝授权
1601
1694
  */
1602
- async webLogin(t = "snsapi_userinfo") {
1603
- const r = h("code"), i = Date.now(), c = +h("state");
1604
- if (!r || !c || c < i - 1e3 * 60 * 5 || c > i) {
1605
- const B = A(["code", "state"]);
1695
+ async webLogin(r = "snsapi_userinfo") {
1696
+ const n = A("code"), s = Date.now(), l = +A("state");
1697
+ if (!n || !l || l < s - 1e3 * 60 * 5 || l > s) {
1698
+ const ie = D(["code", "state"]);
1606
1699
  location.replace(
1607
- `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(B)}&response_type=code&scope=${t}&state=${i}#wechat_redirect`
1700
+ `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${this.appid}&redirect_uri=${encodeURIComponent(ie)}&response_type=code&scope=${r}&state=${s}#wechat_redirect`
1608
1701
  );
1609
1702
  return;
1610
1703
  }
1611
- if (/^100\d{2}$/.test(r))
1612
- return { error: r };
1613
- const d = A(["code", "state"]);
1614
- "replaceState" in history && history.replaceState({}, "", d);
1615
- const { data: p, code: I } = await this.req.post(
1704
+ if (/^100\d{2}$/.test(n))
1705
+ return { error: n };
1706
+ const k = D(["code", "state"]);
1707
+ "replaceState" in history && history.replaceState({}, "", k);
1708
+ const { data: v, code: ne } = await this.req.post(
1616
1709
  "weixin/login",
1617
1710
  {
1618
- code: r,
1711
+ code: n,
1619
1712
  appid: this.appid
1620
1713
  },
1621
- y
1714
+ L
1622
1715
  );
1623
- return p && (this.token.weixinToken = p.weixin_token, await this.token.autoLogin()), p ?? { error: I };
1716
+ return v && (this.token.weixinToken = v.weixin_token, await this.token.autoLogin()), v ?? { error: ne };
1624
1717
  }
1625
1718
  /**
1626
1719
  * 关联游戏账号,无返回值,全程静默
@@ -1634,42 +1727,51 @@ class or {
1634
1727
  * @param weixinToken 调用 login 后,得到的 weixinToken,如果 weixinToken 为空则跳过不处理
1635
1728
  * @param gameCode 从游戏内跳转至小程序时,通过请求参数 query 携带的 game_code,如果值为空则跳过不处理
1636
1729
  */
1637
- async linkPlayer(t, r) {
1638
- !t || !r || await this.req.post("weixin/link-player", { weixin_token: t, game_code: r }, null, {
1730
+ async linkPlayer(r, n) {
1731
+ !r || !n || await this.req.post("weixin/link-player", { weixin_token: r, game_code: n }, null, {
1639
1732
  message: !1
1640
1733
  });
1641
1734
  }
1642
1735
  }
1643
1736
  export {
1644
- rr as AuthToken,
1645
- Ue as CliamRewardStatus,
1646
- nr as ClubApi,
1647
- ye as ClubCreditChangeSence,
1648
- we as ClubCreditChangeType,
1649
- he as ClubItemType,
1650
- ve as ClubRedemptionStatus,
1651
- sr as CommunityApi,
1652
- be as EngageAccountType,
1653
- ir as EventApi,
1654
- qe as EventPeriodType,
1655
- a as FeatureType,
1656
- Kt as ForumMode,
1657
- ke as GamerItemType,
1737
+ wr as AuthToken,
1738
+ Qe as CliamRewardStatus,
1739
+ hr as ClubApi,
1740
+ ke as ClubCreditChangeSence,
1741
+ ve as ClubCreditChangeSenceValidator,
1742
+ he as ClubCreditChangeType,
1743
+ be as ClubCreditChangeTypeValidator,
1744
+ qe as ClubItemType,
1745
+ T as ClubItemTypeValidator,
1746
+ Re as ClubRedemptionStatus,
1747
+ xe as ClubRedemptionStatusValidator,
1748
+ vr as CommunityApi,
1749
+ Ee as EngageAccountType,
1750
+ br as EventApi,
1751
+ Ge as EventPeriodType,
1752
+ u as FeatureType,
1753
+ Nt as ForumMode,
1754
+ zt as ForumModeValidator,
1755
+ Ve as GamerItemType,
1658
1756
  fe as Gender,
1659
- Se as LotteryDrawAction,
1660
- De as LotteryTicketStatus,
1661
- Ot as NotificationCategory,
1662
- Xt as NotificationType,
1663
- Nt as PostStatus,
1664
- Re as QuestObjective,
1665
- $e as RewardSoure,
1666
- Ae as RewardStatusPrefix,
1667
- Le as RewardStatusSuffix,
1668
- Ce as RewardStatusSuffixV2,
1669
- Ee as TeamAction,
1670
- Pe as TeamVisibility,
1671
- xe as VoteOptionSource,
1672
- or as WeixinApi,
1673
- Yt as WeixinWebLoginErrorCode,
1674
- Ge as isEventConfig
1757
+ we as GenderValidator,
1758
+ Ke as LotteryDrawAction,
1759
+ ze as LotteryTicketStatus,
1760
+ Kt as NotificationCategory,
1761
+ kr as NotificationCategoryValidator,
1762
+ m as NotificationType,
1763
+ Ot as NotificationTypeValidator,
1764
+ Jt as PostStatus,
1765
+ ee as PostStatusValidator,
1766
+ Ie as QuestObjective,
1767
+ He as RewardSoure,
1768
+ Be as RewardStatusPrefix,
1769
+ Te as RewardStatusSuffix,
1770
+ Me as RewardStatusSuffixV2,
1771
+ Je as TeamAction,
1772
+ Ne as TeamVisibility,
1773
+ Fe as VoteOptionSource,
1774
+ qr as WeixinApi,
1775
+ dr as WeixinWebLoginErrorCode,
1776
+ Oe as isEventConfig
1675
1777
  };