@huyooo/ui 0.11.2 → 0.11.6

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 (100) hide show
  1. package/dist/AuthkitAppSetting-CjQiWZab.js +1914 -0
  2. package/dist/{Clipboard---tG2Zxz.js → Clipboard-ChMNfcO5.js} +1 -1
  3. package/dist/{Contact-BEUbBGiB.js → Contact-Yqmjh47e.js} +8 -7
  4. package/dist/{CustomTable-CVZ4mFzi.js → CustomTable-BUkwlbzN.js} +3 -2
  5. package/dist/{FeedbackItem-CN041vTm.js → FeedbackItem-DHp_C0pN.js} +3 -3
  6. package/dist/FeedbackModal-Dzl0Alp7.js +1050 -0
  7. package/dist/LandingPageFAQ-CZJXvor9.js +80 -0
  8. package/dist/LandingPageLinkGroup-DDNRivMt.js +521 -0
  9. package/dist/LandingPageSectionHeader-D_74W4My.js +69 -0
  10. package/dist/{LandingPageSectionTabs-B6ZVxR47.js → LandingPageSectionTabs-Ce3_Rc2L.js} +354 -426
  11. package/dist/MessageHandle-BcRjYeVi.js +924 -0
  12. package/dist/MessageList-Bo6YCfRO.js +233 -0
  13. package/dist/{MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-F6neJUg3.js → MessageNoticeNotificationsDetails.vue_vue_type_script_setup_true_lang-BOtgTje-.js} +2 -2
  14. package/dist/PaySubscriptions-BsU0XmXf.js +515 -0
  15. package/dist/PricingPlans-BfVy4xU0.js +210 -0
  16. package/dist/ReferrerReferees-CHSoGrE1.js +106 -0
  17. package/dist/{Upload.vue_vue_type_script_setup_true_lang-D_-oMTOo.js → Upload.vue_vue_type_script_setup_true_lang-CDWyo3RL.js} +1 -1
  18. package/dist/UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-B4tD8pIE.js +508 -0
  19. package/dist/WidthContainer-BzS-A143.js +693 -0
  20. package/dist/{apiClients-9b4zNZ2S.js → apiClients-KFp-rs-C.js} +79 -73
  21. package/dist/authkit.d.ts +7 -0
  22. package/dist/authkit.js +52 -45
  23. package/dist/common/globalConfig.d.ts +4 -2
  24. package/dist/common/userMenuModal.d.ts +1 -0
  25. package/dist/common.js +2 -2
  26. package/dist/components/Authkit/AppSetting/AuthkitOAuthBinding.vue.d.ts +31 -0
  27. package/dist/components/Authkit/AppSetting/AuthkitPhoneBinding.vue.d.ts +14 -0
  28. package/dist/components/Authkit/AppSetting/AuthkitPhoneVerify.vue.d.ts +66 -0
  29. package/dist/components/Authkit/Auth/AuthkitBindPhone.vue.d.ts +27 -0
  30. package/dist/components/Authkit/Auth/AuthkitEmailUpdate.vue.d.ts +11 -1
  31. package/dist/components/Authkit/Auth/AuthkitOauthCallback.vue.d.ts +2 -2
  32. package/dist/components/Authkit/Auth/AuthkitOauthItem.vue.d.ts +1 -1
  33. package/dist/components/Authkit/Auth/AuthkitPasswordAuth.vue.d.ts +11 -1
  34. package/dist/components/Authkit/Auth/AuthkitPhonePasswordUpdateAndVerify.vue.d.ts +68 -0
  35. package/dist/components/Authkit/Auth/AuthkitSignInEmailCode.vue.d.ts +68 -0
  36. package/dist/components/Authkit/Auth/AuthkitSwitchSignUpOrResetPassword.vue.d.ts +15 -3
  37. package/dist/components/Authkit/AuthkitOAuthCallbackProvider.vue.d.ts +11 -0
  38. package/dist/components/Authkit/AuthkitProvider.vue.d.ts +45 -0
  39. package/dist/components/Feedback/FeedbackBubbleEnd.vue.d.ts +9 -0
  40. package/dist/components/Feedback/FeedbackBubbleStart.vue.d.ts +11 -6
  41. package/dist/components/LandingPage/LandingPageSections.vue.d.ts +1 -1
  42. package/dist/components/Pay/PaySubscriptions.vue.d.ts +2 -1
  43. package/dist/components/Pay/PricingFAQ.vue.d.ts +17 -0
  44. package/dist/components/Pay/PricingPlans.vue.d.ts +12 -0
  45. package/dist/components/UserMenu/UserMenuModals.vue.d.ts +2 -2
  46. package/dist/components/UserMenu/parts/UserSubscriptionBaseInformation.vue.d.ts +8 -0
  47. package/dist/composables/Authkit/useAuthkitAppsAuthPageInfo.d.ts +26 -0
  48. package/dist/composables/Authkit/useAuthkitAuth.d.ts +21 -9
  49. package/dist/composables/Authkit/useEnsureAuthenticated.d.ts +26 -0
  50. package/dist/composables/Authkit/useOauth.d.ts +4 -1
  51. package/dist/composables/Billing/useBillingPlans.d.ts +201 -0
  52. package/dist/composables/Billing/useBillingSubscriptionSummary.d.ts +280 -0
  53. package/dist/composables/Billing/useSubscriptionCheckout.d.ts +12 -0
  54. package/dist/composables/UserMenu/useUserMenu.d.ts +5 -1
  55. package/dist/composables.d.ts +2 -0
  56. package/dist/composables.js +25 -22
  57. package/dist/feedback.js +3 -3
  58. package/dist/index-D3Kp6R4z.js +4 -0
  59. package/dist/landingPage.js +42 -40
  60. package/dist/main.d.ts +1 -0
  61. package/dist/main.js +677 -631
  62. package/dist/message.js +19 -18
  63. package/dist/pay.d.ts +5 -0
  64. package/dist/pay.js +9 -2
  65. package/dist/privateCom.js +1 -1
  66. package/dist/referrer.js +1 -1
  67. package/dist/style.css +1 -1
  68. package/dist/types/api/auth.generated.d.ts +103 -39
  69. package/dist/types/api/billing.generated.d.ts +61 -28
  70. package/dist/types/api.d.ts +1 -1
  71. package/dist/types/app.d.ts +14 -0
  72. package/dist/upload.js +2 -2
  73. package/dist/{useAuthkitAppsAuthPageInfo-494yLvsu.js → useAuthkitAppsAuthPageInfo-B9_VzVkQ.js} +20 -7
  74. package/dist/{useAuthkitCreateAndUpdate-DyRtFxZS.js → useAuthkitCreateAndUpdate-DomftQMK.js} +1 -1
  75. package/dist/useAuthkitUsersProfile-D4h6OOdR.js +201 -0
  76. package/dist/{useDownloads-DaeIY0E9.js → useDownloads-CzC3gLUV.js} +1 -1
  77. package/dist/useEnsureAuthenticated-C_Ss0e9n.js +2247 -0
  78. package/dist/{useLegalLinks-CPbWqlu6.js → useLegalLinks-OGVbqXVy.js} +2 -2
  79. package/dist/{useMessageNotifications-Dg5q-C_o.js → useMessageNotifications-DeHFJFcX.js} +1 -1
  80. package/dist/{useSEO-CXX9dcBx.js → useSEO--jTDDkXk.js} +2 -2
  81. package/dist/useSubscriptionCheckout-CQ6wHuLI.js +345 -0
  82. package/dist/{useTableHandle-Cjq4gcC0.js → useTableHandle-jw0P7-2a.js} +1 -1
  83. package/dist/{useUploadCos-DiJmmbRf.js → useUploadCos-keDKcs0j.js} +501 -515
  84. package/dist/useUserMenu-ClPBlvaM.js +44 -0
  85. package/dist/user.js +12 -13
  86. package/dist/utils/apiMiddlewares.d.ts +6 -0
  87. package/dist/utils/legacyApi.d.ts +18 -0
  88. package/package.json +1 -1
  89. package/dist/AuthkitAppSetting-BCrLMpLg.js +0 -1322
  90. package/dist/AuthkitSignInPhone-DmCQ2fWs.js +0 -1721
  91. package/dist/FeedbackModal-aI28o-w5.js +0 -1053
  92. package/dist/LandingPageSectionHeader-Cs1x8i3q.js +0 -584
  93. package/dist/MessageHandle-BV1nKlxs.js +0 -1147
  94. package/dist/PaySubscriptions-B3gI1Eme.js +0 -408
  95. package/dist/ReferrerReferees-DJzPo7X5.js +0 -106
  96. package/dist/UserAccountMenu-CJ9KKVYa.js +0 -371
  97. package/dist/UserMenuInvitationsItem.vue_vue_type_script_setup_true_lang-ClAXNSgl.js +0 -81
  98. package/dist/WidthContainer-BG10rumn.js +0 -669
  99. package/dist/useAuthkitUsersProfile-lGlQP54m.js +0 -186
  100. package/dist/useUserMenu-B3HKZKJ4.js +0 -43
@@ -0,0 +1,2247 @@
1
+ import { defineComponent as z, openBlock as c, createElementBlock as b, normalizeClass as he, createVNode as s, unref as t, computed as C, createElementVNode as y, createCommentVNode as I, createBlock as k, ref as S, withCtx as m, createTextVNode as $, watchEffect as te, Fragment as D, renderList as ie, toDisplayString as O, useSlots as ce, renderSlot as N, normalizeStyle as Q, onMounted as j, onUnmounted as oe } from "vue";
2
+ /* empty css */
3
+ /* empty css */
4
+ import "./index-D3Kp6R4z.js";
5
+ import { Form as M, FormItem as A, Input as V, Button as B, Link as E, Tabs as se, TabPane as ne, Divider as ae, Modal as ye, Message as ee, List as we, ListItem as X, ListItemMeta as Z, Avatar as H, Alert as re } from "@arco-design/web-vue";
6
+ import { u as x, a as J } from "./useAuthkitUsersProfile-D4h6OOdR.js";
7
+ import { e as T, u as pe, s as _e, g as be } from "./apiClients-KFp-rs-C.js";
8
+ import { u as F } from "./useAuthkitAppsAuthPageInfo-B9_VzVkQ.js";
9
+ import { u as fe, S as G, a as Se, b as ke } from "./AuthkitAppSetting-CjQiWZab.js";
10
+ import { Icon as me } from "@iconify/vue";
11
+ import { _ as P } from "./_plugin-vue_export-helper-CHgC5LLL.js";
12
+ /* empty css */
13
+ /* empty css */
14
+ /* empty css */
15
+ import { u as Ie } from "./useLegalLinks-OGVbqXVy.js";
16
+ /* empty css */
17
+ /* empty css */
18
+ /* empty css */
19
+ const ze = ["title", "aria-label"], Pe = /* @__PURE__ */ z({
20
+ __name: "AuthkitOauthItem",
21
+ props: {
22
+ size: {
23
+ type: String,
24
+ required: !0
25
+ },
26
+ icon: {
27
+ type: String,
28
+ required: !0,
29
+ default: () => ""
30
+ },
31
+ label: {
32
+ type: String,
33
+ required: !0,
34
+ default: () => ""
35
+ }
36
+ },
37
+ setup(g) {
38
+ const r = g;
39
+ return (n, i) => (c(), b("button", {
40
+ class: he(["OAuthItem", {
41
+ "OAuthItem--wechat": r.label === "微信"
42
+ }]),
43
+ type: "button",
44
+ title: r.label,
45
+ "aria-label": r.label
46
+ }, [s(t(me), {
47
+ icon: r.icon
48
+ }, null, 8, ["icon"])], 10, ze));
49
+ }
50
+ }), W = /* @__PURE__ */ P(Pe, [["__scopeId", "data-v-61ace547"]]), Ae = {
51
+ class: "OAuthList"
52
+ }, Ve = {
53
+ key: 0,
54
+ class: "OAuthDivider"
55
+ }, Ue = {
56
+ class: "OAuthIcons"
57
+ }, $e = /* @__PURE__ */ z({
58
+ __name: "AuthkitOauthList",
59
+ props: {
60
+ size: {
61
+ type: String,
62
+ default: () => "large"
63
+ },
64
+ appId: {
65
+ type: String,
66
+ default: () => ""
67
+ }
68
+ },
69
+ setup(g) {
70
+ const {
71
+ appsData: r
72
+ } = F(), n = g, {
73
+ githubAuth: i,
74
+ googleAuth: v,
75
+ microsoftAuth: l,
76
+ wechatAuth: u
77
+ } = fe(), e = C(() => !(!r.value.oauth.google.enabled && !r.value.oauth.microsoft.enabled && !r.value.oauth.github.enabled && !r.value.oauth.wechat.enabled));
78
+ return (h, o) => (c(), b("div", Ae, [e.value ? (c(), b("div", Ve, [...o[4] || (o[4] = [y("span", null, "其他登录方式", -1)])])) : I("", !0), y("div", Ue, [t(r).oauth.google.enabled ? (c(), k(W, {
79
+ key: 0,
80
+ icon: "logos:google-icon",
81
+ label: "Google",
82
+ size: n.size,
83
+ onClick: o[0] || (o[0] = (d) => t(v)())
84
+ }, null, 8, ["size"])) : I("", !0), t(r).oauth.github.enabled ? (c(), k(W, {
85
+ key: 1,
86
+ icon: "logos:github-icon",
87
+ label: "Github",
88
+ size: n.size,
89
+ onClick: o[1] || (o[1] = (d) => t(i)())
90
+ }, null, 8, ["size"])) : I("", !0), t(r).oauth.microsoft.enabled ? (c(), k(W, {
91
+ key: 2,
92
+ icon: "logos:microsoft-icon",
93
+ label: "Microsoft",
94
+ size: n.size,
95
+ onClick: o[2] || (o[2] = (d) => t(l)())
96
+ }, null, 8, ["size"])) : I("", !0), t(r).oauth.wechat.enabled ? (c(), k(W, {
97
+ key: 3,
98
+ icon: "ri:wechat-fill",
99
+ label: "微信",
100
+ size: n.size,
101
+ onClick: o[3] || (o[3] = (d) => t(u)())
102
+ }, null, 8, ["size"])) : I("", !0)])]));
103
+ }
104
+ }), Ce = /* @__PURE__ */ P($e, [["__scopeId", "data-v-4ff27a11"]]), Re = {
105
+ class: "content"
106
+ }, qe = {
107
+ class: "sendVerifyCodeItem"
108
+ }, Be = {
109
+ class: "handle"
110
+ }, Te = /* @__PURE__ */ z({
111
+ __name: "AuthkitPasswordUpdateAndVerify",
112
+ props: {
113
+ size: {
114
+ type: String,
115
+ required: !0
116
+ },
117
+ loading: {
118
+ type: Boolean,
119
+ required: !0,
120
+ default: () => !0
121
+ }
122
+ },
123
+ emits: ["signIn", "submit"],
124
+ setup(g, {
125
+ emit: r
126
+ }) {
127
+ const n = r, i = g, v = S(), l = S(!1), u = S(), e = S({
128
+ email: void 0,
129
+ userToken: void 0,
130
+ emailVerifyId: void 0,
131
+ password: void 0,
132
+ confirmPassword: void 0
133
+ });
134
+ async function h() {
135
+ if (!await u.value.validateField(["email"])) {
136
+ l.value = !0;
137
+ const {
138
+ data: f
139
+ } = await T.verify.email.retry.post({
140
+ email: e.value.email,
141
+ purpose: "resetPassword"
142
+ });
143
+ l.value = !1, f && (e.value.emailVerifyId = f.emailVerifyId, v.value.startCountFn());
144
+ }
145
+ }
146
+ async function o() {
147
+ u.value.validate().then((d) => {
148
+ d || n("submit", e.value);
149
+ });
150
+ }
151
+ return (d, f) => (c(), b("div", Re, [s(t(M), {
152
+ ref_key: "formRef",
153
+ ref: u,
154
+ model: e.value,
155
+ size: i.size,
156
+ "auto-label-width": ""
157
+ }, {
158
+ default: m(() => [s(t(A), {
159
+ field: "email",
160
+ label: "邮箱",
161
+ "hide-label": "",
162
+ rules: [{
163
+ required: !0,
164
+ message: "请输入邮箱"
165
+ }, {
166
+ type: "email",
167
+ message: "请输入有效的邮箱"
168
+ }]
169
+ }, {
170
+ default: m(() => [s(t(V), {
171
+ modelValue: e.value.email,
172
+ "onUpdate:modelValue": f[0] || (f[0] = (a) => e.value.email = a),
173
+ placeholder: "请输入邮箱"
174
+ }, null, 8, ["modelValue"])]),
175
+ _: 1
176
+ }), s(t(A), {
177
+ field: "userToken",
178
+ label: "验证码",
179
+ "hide-label": "",
180
+ rules: [{
181
+ required: !0,
182
+ message: "请输入验证码"
183
+ }]
184
+ }, {
185
+ default: m(() => [y("div", qe, [s(t(V), {
186
+ modelValue: e.value.userToken,
187
+ "onUpdate:modelValue": f[1] || (f[1] = (a) => e.value.userToken = a),
188
+ placeholder: "请输入验证码"
189
+ }, null, 8, ["modelValue"]), s(G, {
190
+ ref_key: "SendVerifyCodeRef",
191
+ ref: v,
192
+ size: i.size,
193
+ loading: l.value,
194
+ style: {
195
+ "margin-left": "10px"
196
+ },
197
+ onSend: h
198
+ }, null, 8, ["size", "loading"])])]),
199
+ _: 1
200
+ }), s(t(A), {
201
+ field: "password",
202
+ label: "密码",
203
+ "hide-label": "",
204
+ rules: [{
205
+ required: !0,
206
+ message: "密码请输入"
207
+ }, {
208
+ minLength: 10,
209
+ message: "密码不能少于10字符"
210
+ }]
211
+ }, {
212
+ default: m(() => [s(t(V), {
213
+ modelValue: e.value.password,
214
+ "onUpdate:modelValue": f[2] || (f[2] = (a) => e.value.password = a),
215
+ placeholder: "请输入密码",
216
+ type: "password",
217
+ autocomplete: ""
218
+ }, null, 8, ["modelValue"])]),
219
+ _: 1
220
+ }), s(t(A), {
221
+ field: "confirmPassword",
222
+ label: "确认密码",
223
+ "hide-label": "",
224
+ rules: [{
225
+ required: !0,
226
+ message: "请输入确认密码"
227
+ }, {
228
+ minLength: 10,
229
+ message: "确认密码不能少于10字符"
230
+ }, {
231
+ validator: (a, p) => {
232
+ a !== e.value.password ? p("两次密码输入不一致,请重新输入") : p();
233
+ }
234
+ }]
235
+ }, {
236
+ default: m(() => [s(t(V), {
237
+ modelValue: e.value.confirmPassword,
238
+ "onUpdate:modelValue": f[3] || (f[3] = (a) => e.value.confirmPassword = a),
239
+ placeholder: "请输入确认密码密码",
240
+ type: "password",
241
+ autocomplete: ""
242
+ }, null, 8, ["modelValue"])]),
243
+ _: 1
244
+ }, 8, ["rules"]), y("div", Be, [s(t(B), {
245
+ type: "primary",
246
+ loading: i.loading,
247
+ long: "",
248
+ size: i.size,
249
+ onClick: o
250
+ }, {
251
+ default: m(() => [...f[4] || (f[4] = [$(" 提交 ", -1)])]),
252
+ _: 1
253
+ }, 8, ["loading", "size"])])]),
254
+ _: 1
255
+ }, 8, ["model", "size"])]));
256
+ }
257
+ }), Oe = /* @__PURE__ */ P(Te, [["__scopeId", "data-v-6748c8cb"]]), xe = {
258
+ class: "content"
259
+ }, Le = {
260
+ class: "sendVerifyCodeItem"
261
+ }, Me = /* @__PURE__ */ z({
262
+ __name: "AuthkitPhonePasswordUpdateAndVerify",
263
+ props: {
264
+ size: {
265
+ type: String,
266
+ required: !0
267
+ },
268
+ loading: {
269
+ type: Boolean,
270
+ required: !0,
271
+ default: () => !0
272
+ }
273
+ },
274
+ emits: ["submit"],
275
+ setup(g, {
276
+ emit: r
277
+ }) {
278
+ const n = r, i = g, v = S(), l = S(!1), u = S(), e = S({
279
+ phone: void 0,
280
+ code: void 0,
281
+ password: void 0,
282
+ confirmPassword: void 0
283
+ }), h = [{
284
+ required: !0,
285
+ message: "请输入确认密码"
286
+ }, {
287
+ minLength: 10,
288
+ message: "确认密码不能少于10字符"
289
+ }, {
290
+ validator: (f, a) => {
291
+ if (f !== e.value.password) {
292
+ a("两次密码输入不一致,请重新输入");
293
+ return;
294
+ }
295
+ a();
296
+ }
297
+ }];
298
+ async function o() {
299
+ if (!await u.value.validateField(["phone"])) {
300
+ l.value = !0;
301
+ const {
302
+ error: a
303
+ } = await T.verify.sms.send.post({
304
+ phone: e.value.phone,
305
+ purpose: "resetPassword"
306
+ });
307
+ l.value = !1, a || v.value.startCountFn();
308
+ }
309
+ }
310
+ async function d() {
311
+ u.value.validate().then((f) => {
312
+ f || n("submit", {
313
+ method: "phone",
314
+ phone: e.value.phone,
315
+ code: e.value.code,
316
+ password: e.value.password
317
+ });
318
+ });
319
+ }
320
+ return (f, a) => (c(), b("div", xe, [s(t(M), {
321
+ ref_key: "formRef",
322
+ ref: u,
323
+ model: e.value,
324
+ size: i.size,
325
+ "auto-label-width": ""
326
+ }, {
327
+ default: m(() => [s(t(A), {
328
+ field: "phone",
329
+ label: "手机号",
330
+ "hide-label": "",
331
+ rules: [{
332
+ required: !0,
333
+ message: "请输入手机号"
334
+ }, {
335
+ match: /^1[3-9]\d{9}$/,
336
+ message: "请输入有效的手机号"
337
+ }]
338
+ }, {
339
+ default: m(() => [s(t(V), {
340
+ modelValue: e.value.phone,
341
+ "onUpdate:modelValue": a[0] || (a[0] = (p) => e.value.phone = p),
342
+ placeholder: "请输入手机号",
343
+ autocomplete: "tel",
344
+ type: "tel"
345
+ }, null, 8, ["modelValue"])]),
346
+ _: 1
347
+ }), s(t(A), {
348
+ field: "code",
349
+ label: "验证码",
350
+ "hide-label": "",
351
+ rules: [{
352
+ required: !0,
353
+ message: "请输入验证码"
354
+ }]
355
+ }, {
356
+ default: m(() => [y("div", Le, [s(t(V), {
357
+ modelValue: e.value.code,
358
+ "onUpdate:modelValue": a[1] || (a[1] = (p) => e.value.code = p),
359
+ placeholder: "请输入验证码",
360
+ autocomplete: "one-time-code"
361
+ }, null, 8, ["modelValue"]), s(G, {
362
+ ref_key: "SendVerifyCodeRef",
363
+ ref: v,
364
+ size: i.size,
365
+ loading: l.value,
366
+ style: {
367
+ "margin-left": "10px"
368
+ },
369
+ onSend: o
370
+ }, null, 8, ["size", "loading"])])]),
371
+ _: 1
372
+ }), s(t(A), {
373
+ field: "password",
374
+ label: "密码",
375
+ "hide-label": "",
376
+ rules: [{
377
+ required: !0,
378
+ message: "密码请输入"
379
+ }, {
380
+ minLength: 10,
381
+ message: "密码不能少于10字符"
382
+ }]
383
+ }, {
384
+ default: m(() => [s(t(V), {
385
+ modelValue: e.value.password,
386
+ "onUpdate:modelValue": a[2] || (a[2] = (p) => e.value.password = p),
387
+ placeholder: "请输入密码",
388
+ type: "password",
389
+ autocomplete: "new-password"
390
+ }, null, 8, ["modelValue"])]),
391
+ _: 1
392
+ }), s(t(A), {
393
+ field: "confirmPassword",
394
+ label: "确认密码",
395
+ "hide-label": "",
396
+ rules: h
397
+ }, {
398
+ default: m(() => [s(t(V), {
399
+ modelValue: e.value.confirmPassword,
400
+ "onUpdate:modelValue": a[3] || (a[3] = (p) => e.value.confirmPassword = p),
401
+ placeholder: "请输入确认密码",
402
+ type: "password",
403
+ autocomplete: "new-password"
404
+ }, null, 8, ["modelValue"])]),
405
+ _: 1
406
+ }), s(t(B), {
407
+ type: "primary",
408
+ loading: i.loading,
409
+ long: "",
410
+ size: i.size,
411
+ onClick: d
412
+ }, {
413
+ default: m(() => [...a[4] || (a[4] = [$(" 提交 ", -1)])]),
414
+ _: 1
415
+ }, 8, ["loading", "size"])]),
416
+ _: 1
417
+ }, 8, ["model", "size"])]));
418
+ }
419
+ }), Fe = /* @__PURE__ */ P(Me, [["__scopeId", "data-v-717c5c0f"]]), Ee = {
420
+ class: "SwitchSignIn"
421
+ }, Ge = /* @__PURE__ */ z({
422
+ __name: "AuthkitSwitchSignIn",
423
+ emits: ["switchSignIn"],
424
+ setup(g, {
425
+ emit: r
426
+ }) {
427
+ const n = r;
428
+ function i() {
429
+ n("switchSignIn");
430
+ }
431
+ return (v, l) => (c(), b("div", Ee, [y("span", null, [l[1] || (l[1] = y("span", null, "已经有账号?", -1)), s(t(E), {
432
+ style: {
433
+ padding: "0px"
434
+ },
435
+ onClick: i
436
+ }, {
437
+ default: m(() => [...l[0] || (l[0] = [$("去登陆", -1)])]),
438
+ _: 1
439
+ })])]));
440
+ }
441
+ }), le = /* @__PURE__ */ P(Ge, [["__scopeId", "data-v-fc1d3903"]]), He = {
442
+ class: "ResetPassword"
443
+ }, De = {
444
+ key: 0,
445
+ class: "tabsContainer"
446
+ }, Ne = {
447
+ key: 3,
448
+ class: "empty"
449
+ }, je = /* @__PURE__ */ z({
450
+ __name: "AuthkitResetPassword",
451
+ props: {
452
+ size: {
453
+ type: String,
454
+ required: !0,
455
+ default: () => "large"
456
+ },
457
+ loading: {
458
+ type: Boolean,
459
+ required: !0,
460
+ default: () => !0
461
+ }
462
+ },
463
+ emits: ["switchSignIn", "submit"],
464
+ setup(g, {
465
+ emit: r
466
+ }) {
467
+ const n = r, i = g, {
468
+ appsData: v
469
+ } = F(), l = C(() => v.value.authMethods), u = C(() => {
470
+ const d = [];
471
+ return l.value.login.emailPassword && d.push({
472
+ key: "email",
473
+ title: "邮箱找回"
474
+ }), l.value.login.phonePassword && d.push({
475
+ key: "phone",
476
+ title: "手机号找回"
477
+ }), d;
478
+ }), e = S("email");
479
+ te(() => {
480
+ var d;
481
+ u.value.some((f) => f.key === e.value) || (e.value = ((d = u.value[0]) == null ? void 0 : d.key) || "email");
482
+ });
483
+ function h() {
484
+ n("switchSignIn");
485
+ }
486
+ async function o(d) {
487
+ n("submit", {
488
+ method: e.value,
489
+ ...d
490
+ });
491
+ }
492
+ return (d, f) => (c(), b("div", He, [u.value.length > 1 ? (c(), b("div", De, [s(t(se), {
493
+ "active-key": e.value,
494
+ "onUpdate:activeKey": f[0] || (f[0] = (a) => e.value = a)
495
+ }, {
496
+ default: m(() => [(c(!0), b(D, null, ie(u.value, (a) => (c(), k(t(ne), {
497
+ key: a.key,
498
+ title: a.title
499
+ }, null, 8, ["title"]))), 128))]),
500
+ _: 1
501
+ }, 8, ["active-key"]), s(t(ae), {
502
+ class: "tabsDivider",
503
+ style: {
504
+ margin: "0"
505
+ }
506
+ })])) : I("", !0), e.value === "email" && l.value.login.emailPassword ? (c(), k(Oe, {
507
+ key: 1,
508
+ loading: g.loading,
509
+ size: i.size,
510
+ onSubmit: o
511
+ }, null, 8, ["loading", "size"])) : e.value === "phone" && l.value.login.phonePassword ? (c(), k(Fe, {
512
+ key: 2,
513
+ loading: g.loading,
514
+ size: i.size,
515
+ onSubmit: o
516
+ }, null, 8, ["loading", "size"])) : (c(), b("div", Ne, "当前应用未开放找回密码")), s(le, {
517
+ onSwitchSignIn: h
518
+ })]));
519
+ }
520
+ }), Ke = /* @__PURE__ */ P(je, [["__scopeId", "data-v-ca18289f"]]), We = {
521
+ key: 0,
522
+ class: "ServiceAgreementAndPrivacyProtection"
523
+ }, Qe = {
524
+ key: 1
525
+ }, Ye = /* @__PURE__ */ z({
526
+ __name: "AuthkitServiceAgreementAndPrivacyProtection",
527
+ emits: ["toUserServiceAgreement", "toPrivacyPolicy"],
528
+ setup(g, {
529
+ emit: r
530
+ }) {
531
+ const n = r, {
532
+ getLink: i
533
+ } = Ie(), v = C(() => {
534
+ const o = i("userServiceAgreement");
535
+ return o != null && o.configured ? o : void 0;
536
+ }), l = C(() => {
537
+ const o = i("privacyPolicy");
538
+ return o != null && o.configured ? o : void 0;
539
+ }), u = C(() => !!(v.value || l.value));
540
+ function e() {
541
+ n("toUserServiceAgreement");
542
+ }
543
+ function h() {
544
+ n("toPrivacyPolicy");
545
+ }
546
+ return (o, d) => u.value ? (c(), b("div", We, [d[0] || (d[0] = y("span", null, "注册登陆即表示同意", -1)), v.value ? (c(), k(t(E), {
547
+ key: 0,
548
+ onClick: e
549
+ }, {
550
+ default: m(() => [$(O(v.value.label), 1)]),
551
+ _: 1
552
+ })) : I("", !0), v.value && l.value ? (c(), b("span", Qe, "和")) : I("", !0), l.value ? (c(), k(t(E), {
553
+ key: 2,
554
+ onClick: h
555
+ }, {
556
+ default: m(() => [$(O(l.value.label), 1)]),
557
+ _: 1
558
+ })) : I("", !0)])) : I("", !0);
559
+ }
560
+ }), Je = /* @__PURE__ */ P(Ye, [["__scopeId", "data-v-c45a9ad9"]]), Xe = {
561
+ class: "content"
562
+ }, Ze = {
563
+ class: "handle"
564
+ }, et = /* @__PURE__ */ z({
565
+ __name: "AuthkitPasswordAuth",
566
+ props: {
567
+ size: {
568
+ type: String,
569
+ required: !0
570
+ },
571
+ loading: {
572
+ type: Boolean,
573
+ required: !0,
574
+ default: () => !0
575
+ },
576
+ allowPhone: {
577
+ type: Boolean,
578
+ default: !1
579
+ }
580
+ },
581
+ emits: ["submit"],
582
+ setup(g, {
583
+ emit: r
584
+ }) {
585
+ const n = r, i = g, v = S(), l = S({
586
+ identifier: void 0,
587
+ password: void 0
588
+ });
589
+ async function u() {
590
+ v.value.validate().then((e) => {
591
+ e || n("submit", l.value);
592
+ });
593
+ }
594
+ return (e, h) => (c(), b("div", Xe, [s(t(M), {
595
+ ref_key: "formRef",
596
+ ref: v,
597
+ model: l.value,
598
+ size: i.size,
599
+ "auto-label-width": ""
600
+ }, {
601
+ default: m(() => [s(t(A), {
602
+ field: "identifier",
603
+ label: "邮箱或手机号",
604
+ "hide-label": "",
605
+ rules: [{
606
+ required: !0,
607
+ message: "请输入邮箱或手机号"
608
+ }]
609
+ }, {
610
+ default: m(() => [s(t(V), {
611
+ modelValue: l.value.identifier,
612
+ "onUpdate:modelValue": h[0] || (h[0] = (o) => l.value.identifier = o),
613
+ placeholder: i.allowPhone ? "请输入邮箱或手机号" : "请输入邮箱",
614
+ autocomplete: "email username"
615
+ }, null, 8, ["modelValue", "placeholder"])]),
616
+ _: 1
617
+ }), s(t(A), {
618
+ field: "password",
619
+ label: "密码",
620
+ "hide-label": "",
621
+ rules: [{
622
+ required: !0,
623
+ message: "请输入密码"
624
+ }]
625
+ }, {
626
+ default: m(() => [s(t(V), {
627
+ modelValue: l.value.password,
628
+ "onUpdate:modelValue": h[1] || (h[1] = (o) => l.value.password = o),
629
+ placeholder: "请输入密码",
630
+ type: "password",
631
+ autocomplete: "current-password"
632
+ }, null, 8, ["modelValue"])]),
633
+ _: 1
634
+ }), y("div", Ze, [s(t(B), {
635
+ type: "primary",
636
+ loading: i.loading,
637
+ long: "",
638
+ size: i.size,
639
+ onClick: u
640
+ }, {
641
+ default: m(() => [...h[2] || (h[2] = [$(" 登陆 ", -1)])]),
642
+ _: 1
643
+ }, 8, ["loading", "size"])])]),
644
+ _: 1
645
+ }, 8, ["model", "size"])]));
646
+ }
647
+ }), tt = /* @__PURE__ */ P(et, [["__scopeId", "data-v-f2994068"]]), it = {
648
+ class: "SwitchSignUpOrResetPassword"
649
+ }, ot = {
650
+ key: 0
651
+ }, st = /* @__PURE__ */ z({
652
+ __name: "AuthkitSwitchSignUpOrResetPassword",
653
+ props: {
654
+ showSignUp: {
655
+ type: Boolean,
656
+ default: !0
657
+ }
658
+ },
659
+ emits: ["switchSignUp", "switchResetPassword"],
660
+ setup(g, {
661
+ emit: r
662
+ }) {
663
+ const n = g, i = r;
664
+ function v() {
665
+ i("switchSignUp");
666
+ }
667
+ function l() {
668
+ i("switchResetPassword");
669
+ }
670
+ return (u, e) => (c(), b("div", it, [n.showSignUp ? (c(), b("span", ot, [e[1] || (e[1] = y("span", null, " 还没有账户?", -1)), s(t(E), {
671
+ style: {
672
+ padding: "0px"
673
+ },
674
+ onClick: v
675
+ }, {
676
+ default: m(() => [...e[0] || (e[0] = [$("去注册?", -1)])]),
677
+ _: 1
678
+ })])) : I("", !0), s(t(E), {
679
+ style: {
680
+ padding: "0px"
681
+ },
682
+ onClick: l
683
+ }, {
684
+ default: m(() => [...e[2] || (e[2] = [$(" 忘记密码?", -1)])]),
685
+ _: 1
686
+ })]));
687
+ }
688
+ }), ve = /* @__PURE__ */ P(st, [["__scopeId", "data-v-9d5ae890"]]), nt = {
689
+ class: "SignInPhone"
690
+ }, at = {
691
+ class: "content"
692
+ }, lt = {
693
+ class: "sendVerifyCodeItem"
694
+ }, rt = {
695
+ class: "handle"
696
+ }, ut = /* @__PURE__ */ z({
697
+ __name: "AuthkitSignInPhone",
698
+ props: {
699
+ size: {
700
+ type: String,
701
+ required: !0
702
+ },
703
+ loading: {
704
+ type: Boolean,
705
+ required: !0,
706
+ default: () => !1
707
+ }
708
+ },
709
+ emits: ["submit", "switchSignUp", "switchResetPassword"],
710
+ setup(g, {
711
+ emit: r
712
+ }) {
713
+ const n = r, i = g, v = ce(), l = C(() => !!v.OAuth), u = S(), e = S(!1), h = S(), o = S({
714
+ phone: void 0,
715
+ code: void 0
716
+ });
717
+ function d() {
718
+ n("switchSignUp");
719
+ }
720
+ function f() {
721
+ n("switchResetPassword");
722
+ }
723
+ async function a() {
724
+ if (!await h.value.validateField(["phone"])) {
725
+ e.value = !0;
726
+ const {
727
+ error: w
728
+ } = await T.verify.sms.send.post({
729
+ phone: o.value.phone,
730
+ purpose: "signIn"
731
+ });
732
+ e.value = !1, w || u.value.startCountFn();
733
+ }
734
+ }
735
+ async function p() {
736
+ h.value.validate().then((_) => {
737
+ _ || n("submit", {
738
+ identifier: o.value.phone,
739
+ code: o.value.code,
740
+ method: "code"
741
+ });
742
+ });
743
+ }
744
+ return (_, w) => (c(), b("div", nt, [y("div", at, [s(t(M), {
745
+ ref_key: "formRef",
746
+ ref: h,
747
+ model: o.value,
748
+ size: i.size,
749
+ "auto-label-width": ""
750
+ }, {
751
+ default: m(() => [s(t(A), {
752
+ field: "phone",
753
+ label: "手机号",
754
+ "hide-label": "",
755
+ rules: [{
756
+ required: !0,
757
+ message: "请输入手机号"
758
+ }, {
759
+ match: /^1[3-9]\d{9}$/,
760
+ message: "请输入有效的手机号"
761
+ }]
762
+ }, {
763
+ default: m(() => [s(t(V), {
764
+ modelValue: o.value.phone,
765
+ "onUpdate:modelValue": w[0] || (w[0] = (U) => o.value.phone = U),
766
+ placeholder: "请输入手机号",
767
+ autocomplete: "tel",
768
+ type: "tel"
769
+ }, null, 8, ["modelValue"])]),
770
+ _: 1
771
+ }), s(t(A), {
772
+ field: "code",
773
+ label: "验证码",
774
+ "hide-label": "",
775
+ rules: [{
776
+ required: !0,
777
+ message: "请输入验证码"
778
+ }]
779
+ }, {
780
+ default: m(() => [y("div", lt, [s(t(V), {
781
+ modelValue: o.value.code,
782
+ "onUpdate:modelValue": w[1] || (w[1] = (U) => o.value.code = U),
783
+ placeholder: "请输入验证码",
784
+ autocomplete: "one-time-code"
785
+ }, null, 8, ["modelValue"]), s(G, {
786
+ ref_key: "SendVerifyCodeRef",
787
+ ref: u,
788
+ size: i.size,
789
+ loading: e.value,
790
+ style: {
791
+ "margin-left": "10px"
792
+ },
793
+ onSend: a
794
+ }, null, 8, ["size", "loading"])])]),
795
+ _: 1
796
+ }), y("div", rt, [s(t(B), {
797
+ type: "primary",
798
+ loading: i.loading,
799
+ long: "",
800
+ size: i.size,
801
+ onClick: p
802
+ }, {
803
+ default: m(() => [...w[2] || (w[2] = [$(" 登录 ", -1)])]),
804
+ _: 1
805
+ }, 8, ["loading", "size"])])]),
806
+ _: 1
807
+ }, 8, ["model", "size"])]), l.value ? N(_.$slots, "OAuth", {
808
+ key: 0
809
+ }, void 0, !0) : I("", !0), s(ve, {
810
+ onSwitchSignUp: d,
811
+ onSwitchResetPassword: f
812
+ })]));
813
+ }
814
+ }), dt = /* @__PURE__ */ P(ut, [["__scopeId", "data-v-723d4155"]]), ct = {
815
+ class: "SignInEmailCode"
816
+ }, pt = {
817
+ class: "sendVerifyCodeItem"
818
+ }, ft = /* @__PURE__ */ z({
819
+ __name: "AuthkitSignInEmailCode",
820
+ props: {
821
+ size: {
822
+ type: String,
823
+ required: !0
824
+ },
825
+ loading: {
826
+ type: Boolean,
827
+ required: !0,
828
+ default: () => !1
829
+ }
830
+ },
831
+ emits: ["submit"],
832
+ setup(g, {
833
+ emit: r
834
+ }) {
835
+ const n = r, i = g, v = S(), l = S(!1), u = S(), e = S({
836
+ email: void 0,
837
+ code: void 0,
838
+ emailVerifyId: ""
839
+ });
840
+ async function h() {
841
+ if (!await u.value.validateField(["email"])) {
842
+ l.value = !0;
843
+ const {
844
+ data: f,
845
+ error: a
846
+ } = await T.verify.email.retry.post({
847
+ email: e.value.email,
848
+ purpose: "signIn"
849
+ });
850
+ l.value = !1, !a && (f != null && f.emailVerifyId) && (e.value.emailVerifyId = f.emailVerifyId, v.value.startCountFn());
851
+ }
852
+ }
853
+ async function o() {
854
+ u.value.validate().then((d) => {
855
+ d || n("submit", {
856
+ identifier: e.value.email,
857
+ code: e.value.code,
858
+ emailVerifyId: e.value.emailVerifyId,
859
+ method: "code"
860
+ });
861
+ });
862
+ }
863
+ return (d, f) => (c(), b("div", ct, [s(t(M), {
864
+ ref_key: "formRef",
865
+ ref: u,
866
+ model: e.value,
867
+ size: i.size,
868
+ "auto-label-width": ""
869
+ }, {
870
+ default: m(() => [s(t(A), {
871
+ field: "email",
872
+ "hide-label": "",
873
+ rules: [{
874
+ required: !0,
875
+ message: "请输入邮箱"
876
+ }, {
877
+ type: "email",
878
+ message: "请输入有效的邮箱"
879
+ }]
880
+ }, {
881
+ default: m(() => [s(t(V), {
882
+ modelValue: e.value.email,
883
+ "onUpdate:modelValue": f[0] || (f[0] = (a) => e.value.email = a),
884
+ placeholder: "请输入邮箱",
885
+ autocomplete: "email"
886
+ }, null, 8, ["modelValue"])]),
887
+ _: 1
888
+ }), s(t(A), {
889
+ field: "code",
890
+ "hide-label": "",
891
+ rules: [{
892
+ required: !0,
893
+ message: "请输入验证码"
894
+ }]
895
+ }, {
896
+ default: m(() => [y("div", pt, [s(t(V), {
897
+ modelValue: e.value.code,
898
+ "onUpdate:modelValue": f[1] || (f[1] = (a) => e.value.code = a),
899
+ placeholder: "请输入验证码",
900
+ autocomplete: "one-time-code"
901
+ }, null, 8, ["modelValue"]), s(G, {
902
+ ref_key: "SendVerifyCodeRef",
903
+ ref: v,
904
+ size: i.size,
905
+ loading: l.value,
906
+ style: {
907
+ "margin-left": "10px"
908
+ },
909
+ onSend: h
910
+ }, null, 8, ["size", "loading"])])]),
911
+ _: 1
912
+ }), s(t(B), {
913
+ type: "primary",
914
+ loading: i.loading,
915
+ long: "",
916
+ size: i.size,
917
+ onClick: o
918
+ }, {
919
+ default: m(() => [...f[2] || (f[2] = [$(" 登录 ", -1)])]),
920
+ _: 1
921
+ }, 8, ["loading", "size"])]),
922
+ _: 1
923
+ }, 8, ["model", "size"])]));
924
+ }
925
+ }), mt = /* @__PURE__ */ P(ft, [["__scopeId", "data-v-7d6e80be"]]), vt = {
926
+ class: "SignIn"
927
+ }, gt = {
928
+ key: 0,
929
+ class: "tabsContainer"
930
+ }, ht = /* @__PURE__ */ z({
931
+ __name: "AuthkitSignIn",
932
+ props: {
933
+ size: {
934
+ type: String,
935
+ required: !0
936
+ },
937
+ loading: {
938
+ type: Boolean,
939
+ required: !0,
940
+ default: () => !0
941
+ }
942
+ },
943
+ emits: ["submit", "switchSignUp", "switchResetPassword"],
944
+ setup(g, {
945
+ emit: r
946
+ }) {
947
+ const n = r, i = g, v = ce(), l = C(() => !!v.OAuth), {
948
+ appsData: u
949
+ } = F(), e = C(() => u.value.authMethods), h = C(() => {
950
+ const p = [];
951
+ return (e.value.login.emailPassword || e.value.login.phonePassword) && p.push({
952
+ key: "password",
953
+ title: e.value.login.phonePassword ? "邮箱/手机号密码登录" : "邮箱密码登录"
954
+ }), e.value.login.phoneCode && p.push({
955
+ key: "phoneCode",
956
+ title: "手机验证码登录"
957
+ }), e.value.login.emailCode && p.push({
958
+ key: "emailCode",
959
+ title: "邮箱验证码登录"
960
+ }), p;
961
+ }), o = S("password");
962
+ te(() => {
963
+ var p;
964
+ h.value.some((_) => _.key === o.value) || (o.value = ((p = h.value[0]) == null ? void 0 : p.key) || "password");
965
+ });
966
+ function d() {
967
+ n("switchSignUp");
968
+ }
969
+ function f() {
970
+ n("switchResetPassword");
971
+ }
972
+ async function a(p) {
973
+ n("submit", {
974
+ method: o.value === "password" ? "password" : "code",
975
+ ...p
976
+ });
977
+ }
978
+ return (p, _) => (c(), b("div", vt, [h.value.length > 1 ? (c(), b("div", gt, [s(t(se), {
979
+ "active-key": o.value,
980
+ "onUpdate:activeKey": _[0] || (_[0] = (w) => o.value = w)
981
+ }, {
982
+ default: m(() => [(c(!0), b(D, null, ie(h.value, (w) => (c(), k(t(ne), {
983
+ key: w.key,
984
+ title: w.title
985
+ }, null, 8, ["title"]))), 128))]),
986
+ _: 1
987
+ }, 8, ["active-key"]), s(t(ae), {
988
+ class: "tabsDivider",
989
+ style: {
990
+ margin: "0"
991
+ }
992
+ })])) : I("", !0), o.value === "password" && (e.value.login.emailPassword || e.value.login.phonePassword) ? (c(), k(tt, {
993
+ key: 1,
994
+ loading: i.loading,
995
+ size: i.size,
996
+ "allow-phone": e.value.login.phonePassword,
997
+ onSubmit: a
998
+ }, null, 8, ["loading", "size", "allow-phone"])) : o.value === "phoneCode" ? (c(), k(dt, {
999
+ key: 2,
1000
+ loading: i.loading,
1001
+ size: i.size,
1002
+ onSubmit: a
1003
+ }, null, 8, ["loading", "size"])) : o.value === "emailCode" ? (c(), k(mt, {
1004
+ key: 3,
1005
+ loading: i.loading,
1006
+ size: i.size,
1007
+ onSubmit: a
1008
+ }, null, 8, ["loading", "size"])) : I("", !0), l.value ? N(p.$slots, "OAuth", {
1009
+ key: 4
1010
+ }, void 0, !0) : I("", !0), s(ve, {
1011
+ "show-sign-up": e.value.signUp.email || e.value.signUp.phone,
1012
+ onSwitchSignUp: d,
1013
+ onSwitchResetPassword: f
1014
+ }, null, 8, ["show-sign-up"])]));
1015
+ }
1016
+ }), yt = /* @__PURE__ */ P(ht, [["__scopeId", "data-v-cf331a08"]]), wt = {
1017
+ class: "SignUpPhone"
1018
+ }, _t = {
1019
+ class: "content"
1020
+ }, bt = {
1021
+ class: "sendVerifyCodeItem"
1022
+ }, St = {
1023
+ class: "handle"
1024
+ }, kt = /* @__PURE__ */ z({
1025
+ __name: "AuthkitSignUpPhone",
1026
+ props: {
1027
+ size: {
1028
+ type: String,
1029
+ required: !0
1030
+ },
1031
+ loading: {
1032
+ type: Boolean,
1033
+ required: !0,
1034
+ default: () => !1
1035
+ },
1036
+ /** 是否要求设置密码 */
1037
+ requirePassword: {
1038
+ type: Boolean,
1039
+ default: !1
1040
+ }
1041
+ },
1042
+ emits: ["switchSignIn", "submit"],
1043
+ setup(g, {
1044
+ emit: r
1045
+ }) {
1046
+ const n = r, i = g, v = S(), l = S(!1), u = S(), e = S({
1047
+ phone: void 0,
1048
+ code: void 0,
1049
+ password: void 0,
1050
+ confirmPassword: void 0,
1051
+ referrerId: void 0
1052
+ }), h = [{
1053
+ required: !0,
1054
+ message: "请输入确认密码"
1055
+ }, {
1056
+ validator: (a, p) => {
1057
+ e.value.password && a !== e.value.password ? p("两次密码输入不一致") : p();
1058
+ }
1059
+ }];
1060
+ function o() {
1061
+ n("switchSignIn");
1062
+ }
1063
+ async function d() {
1064
+ if (!await u.value.validateField(["phone"])) {
1065
+ l.value = !0;
1066
+ const {
1067
+ error: p
1068
+ } = await T.verify.sms.send.post({
1069
+ phone: e.value.phone,
1070
+ purpose: "signUp"
1071
+ });
1072
+ l.value = !1, p || v.value.startCountFn();
1073
+ }
1074
+ }
1075
+ async function f() {
1076
+ u.value.validate().then((a) => {
1077
+ a || n("submit", {
1078
+ type: "phone",
1079
+ phone: e.value.phone,
1080
+ code: e.value.code,
1081
+ password: e.value.password,
1082
+ referrerId: e.value.referrerId
1083
+ });
1084
+ });
1085
+ }
1086
+ return (a, p) => (c(), b("div", wt, [y("div", _t, [s(t(M), {
1087
+ ref_key: "formRef",
1088
+ ref: u,
1089
+ model: e.value,
1090
+ size: i.size,
1091
+ "auto-label-width": ""
1092
+ }, {
1093
+ default: m(() => [s(t(A), {
1094
+ field: "phone",
1095
+ label: "手机号",
1096
+ "hide-label": "",
1097
+ rules: [{
1098
+ required: !0,
1099
+ message: "请输入手机号"
1100
+ }, {
1101
+ match: /^1[3-9]\d{9}$/,
1102
+ message: "请输入有效的手机号"
1103
+ }]
1104
+ }, {
1105
+ default: m(() => [s(t(V), {
1106
+ modelValue: e.value.phone,
1107
+ "onUpdate:modelValue": p[0] || (p[0] = (_) => e.value.phone = _),
1108
+ placeholder: "请输入手机号",
1109
+ autocomplete: "tel",
1110
+ type: "tel"
1111
+ }, null, 8, ["modelValue"])]),
1112
+ _: 1
1113
+ }), s(t(A), {
1114
+ field: "code",
1115
+ label: "验证码",
1116
+ "hide-label": "",
1117
+ rules: [{
1118
+ required: !0,
1119
+ message: "请输入验证码"
1120
+ }]
1121
+ }, {
1122
+ default: m(() => [y("div", bt, [s(t(V), {
1123
+ modelValue: e.value.code,
1124
+ "onUpdate:modelValue": p[1] || (p[1] = (_) => e.value.code = _),
1125
+ placeholder: "请输入验证码",
1126
+ autocomplete: "one-time-code"
1127
+ }, null, 8, ["modelValue"]), s(G, {
1128
+ ref_key: "SendVerifyCodeRef",
1129
+ ref: v,
1130
+ size: i.size,
1131
+ loading: l.value,
1132
+ style: {
1133
+ "margin-left": "10px"
1134
+ },
1135
+ onSend: d
1136
+ }, null, 8, ["size", "loading"])])]),
1137
+ _: 1
1138
+ }), i.requirePassword ? (c(), k(t(A), {
1139
+ key: 0,
1140
+ field: "password",
1141
+ label: "密码",
1142
+ "hide-label": "",
1143
+ rules: [{
1144
+ required: i.requirePassword,
1145
+ message: "密码请输入"
1146
+ }, {
1147
+ minLength: 10,
1148
+ message: "密码不能少于10字符"
1149
+ }]
1150
+ }, {
1151
+ default: m(() => [s(t(V), {
1152
+ modelValue: e.value.password,
1153
+ "onUpdate:modelValue": p[2] || (p[2] = (_) => e.value.password = _),
1154
+ placeholder: "请输入密码(可选)",
1155
+ type: "password",
1156
+ autocomplete: "new-password"
1157
+ }, null, 8, ["modelValue"])]),
1158
+ _: 1
1159
+ }, 8, ["rules"])) : I("", !0), i.requirePassword && e.value.password ? (c(), k(t(A), {
1160
+ key: 1,
1161
+ field: "confirmPassword",
1162
+ label: "确认密码",
1163
+ "hide-label": "",
1164
+ rules: h
1165
+ }, {
1166
+ default: m(() => [s(t(V), {
1167
+ modelValue: e.value.confirmPassword,
1168
+ "onUpdate:modelValue": p[3] || (p[3] = (_) => e.value.confirmPassword = _),
1169
+ placeholder: "请输入确认密码",
1170
+ type: "password",
1171
+ autocomplete: "new-password"
1172
+ }, null, 8, ["modelValue"])]),
1173
+ _: 1
1174
+ })) : I("", !0), s(t(A), {
1175
+ field: "referrerId",
1176
+ label: "邀请人",
1177
+ "hide-label": "",
1178
+ rules: [{
1179
+ required: !1
1180
+ }]
1181
+ }, {
1182
+ default: m(() => [s(t(V), {
1183
+ modelValue: e.value.referrerId,
1184
+ "onUpdate:modelValue": p[4] || (p[4] = (_) => e.value.referrerId = _),
1185
+ placeholder: "邀请人ID(可选)",
1186
+ autocomplete: "off"
1187
+ }, null, 8, ["modelValue"])]),
1188
+ _: 1
1189
+ }), y("div", St, [s(t(B), {
1190
+ type: "primary",
1191
+ loading: i.loading,
1192
+ long: "",
1193
+ size: i.size,
1194
+ onClick: f
1195
+ }, {
1196
+ default: m(() => [...p[5] || (p[5] = [$(" 注册 ", -1)])]),
1197
+ _: 1
1198
+ }, 8, ["loading", "size"])])]),
1199
+ _: 1
1200
+ }, 8, ["model", "size"])]), s(le, {
1201
+ onSwitchSignIn: o
1202
+ })]));
1203
+ }
1204
+ }), It = /* @__PURE__ */ P(kt, [["__scopeId", "data-v-fc971294"]]), zt = {
1205
+ class: "SignUp"
1206
+ }, Pt = {
1207
+ key: 0,
1208
+ class: "tabsContainer"
1209
+ }, At = {
1210
+ key: 3,
1211
+ class: "empty"
1212
+ }, Vt = /* @__PURE__ */ z({
1213
+ __name: "AuthkitSignUp",
1214
+ props: {
1215
+ size: {
1216
+ type: String,
1217
+ required: !0
1218
+ },
1219
+ loading: {
1220
+ type: Boolean,
1221
+ required: !0,
1222
+ default: () => !0
1223
+ }
1224
+ },
1225
+ emits: ["switchSignIn", "submit"],
1226
+ setup(g, {
1227
+ emit: r
1228
+ }) {
1229
+ const n = r, i = g, {
1230
+ appsData: v
1231
+ } = F(), l = C(() => v.value.authMethods), u = C(() => {
1232
+ const d = [];
1233
+ return l.value.signUp.email && d.push({
1234
+ key: "email",
1235
+ title: "邮箱注册"
1236
+ }), l.value.signUp.phone && d.push({
1237
+ key: "phone",
1238
+ title: "手机号注册"
1239
+ }), d;
1240
+ }), e = S("email");
1241
+ te(() => {
1242
+ var d;
1243
+ u.value.some((f) => f.key === e.value) || (e.value = ((d = u.value[0]) == null ? void 0 : d.key) || "email");
1244
+ });
1245
+ function h() {
1246
+ n("switchSignIn");
1247
+ }
1248
+ async function o(d) {
1249
+ n("submit", {
1250
+ type: e.value,
1251
+ ...d
1252
+ });
1253
+ }
1254
+ return (d, f) => (c(), b("div", zt, [u.value.length > 1 ? (c(), b("div", Pt, [s(t(se), {
1255
+ "active-key": e.value,
1256
+ "onUpdate:activeKey": f[0] || (f[0] = (a) => e.value = a)
1257
+ }, {
1258
+ default: m(() => [(c(!0), b(D, null, ie(u.value, (a) => (c(), k(t(ne), {
1259
+ key: a.key,
1260
+ title: a.title
1261
+ }, null, 8, ["title"]))), 128))]),
1262
+ _: 1
1263
+ }, 8, ["active-key"]), s(t(ae), {
1264
+ class: "tabsDivider",
1265
+ style: {
1266
+ margin: "0"
1267
+ }
1268
+ })])) : I("", !0), e.value === "email" && l.value.signUp.email ? (c(), k(Se, {
1269
+ key: 1,
1270
+ size: i.size,
1271
+ loading: g.loading,
1272
+ onSubmit: o
1273
+ }, null, 8, ["size", "loading"])) : e.value === "phone" && l.value.signUp.phone ? (c(), k(It, {
1274
+ key: 2,
1275
+ size: i.size,
1276
+ loading: g.loading,
1277
+ onSubmit: o,
1278
+ onSwitchSignIn: h
1279
+ }, null, 8, ["size", "loading"])) : (c(), b("div", At, " 当前应用未开放用户注册 ")), e.value === "email" ? (c(), k(le, {
1280
+ key: 4,
1281
+ onSwitchSignIn: h
1282
+ })) : I("", !0)]));
1283
+ }
1284
+ }), Ut = /* @__PURE__ */ P(Vt, [["__scopeId", "data-v-2a0b239f"]]), $t = ["src"], Ct = /* @__PURE__ */ z({
1285
+ __name: "AuthkitAuthTitle",
1286
+ props: {
1287
+ size: {
1288
+ type: [String, Number],
1289
+ required: !1,
1290
+ default: 30
1291
+ },
1292
+ fontSize: {
1293
+ type: Number,
1294
+ required: !1,
1295
+ default: 18
1296
+ },
1297
+ lineHeight: {
1298
+ type: Number,
1299
+ required: !1,
1300
+ default: 60
1301
+ }
1302
+ },
1303
+ setup(g) {
1304
+ const r = g, n = `${r.size}px`, i = `${r.fontSize}px`, v = `${r.lineHeight}px`, {
1305
+ currentView: l
1306
+ } = x(), {
1307
+ appsData: u
1308
+ } = F(), e = C(() => l.value === "signIn" ? `${u.value.name}登录` : l.value === "signUp" ? `${u.value.name}账号注册` : l.value === "resetPassword" ? `${u.value.name}密码重置` : "");
1309
+ return (h, o) => (c(), b("div", {
1310
+ class: "Title",
1311
+ style: Q({
1312
+ fontSize: i,
1313
+ lineHeight: v
1314
+ })
1315
+ }, [t(u).applicationLogoUrl ? (c(), b("img", {
1316
+ key: 0,
1317
+ src: t(u).applicationLogoUrl,
1318
+ srcset: "",
1319
+ style: Q({
1320
+ width: n
1321
+ })
1322
+ }, null, 12, $t)) : I("", !0), y("span", null, O(e.value), 1), N(h.$slots, "default", {}, void 0, !0)], 4));
1323
+ }
1324
+ }), ge = /* @__PURE__ */ P(Ct, [["__scopeId", "data-v-8ebe7939"]]), Rt = {
1325
+ class: "Auth"
1326
+ }, qt = {
1327
+ class: "body"
1328
+ }, Bt = /* @__PURE__ */ z({
1329
+ __name: "AuthkitAuth",
1330
+ props: {
1331
+ size: {
1332
+ type: String,
1333
+ required: !0
1334
+ },
1335
+ showTitle: {
1336
+ type: Boolean,
1337
+ default: () => !0
1338
+ }
1339
+ },
1340
+ emits: ["toPrivacyPolicy", "toUserServiceAgreement"],
1341
+ setup(g, {
1342
+ emit: r
1343
+ }) {
1344
+ const n = g, i = r, {
1345
+ signInSubmit: v,
1346
+ signUpSubmit: l,
1347
+ resetPasswordSubmit: u,
1348
+ currentView: e,
1349
+ authSignInLoading: h,
1350
+ authSignUpLoading: o,
1351
+ resetPasswordLoading: d,
1352
+ switchSignUp: f,
1353
+ switchResetPassword: a,
1354
+ switchSignIn: p
1355
+ } = x(), {
1356
+ appsAuthPageInfoApi: _
1357
+ } = F();
1358
+ function w() {
1359
+ i("toPrivacyPolicy");
1360
+ }
1361
+ function U() {
1362
+ i("toUserServiceAgreement");
1363
+ }
1364
+ return _(), (L, R) => (c(), b("div", Rt, [g.showTitle ? (c(), k(ge, {
1365
+ key: 0,
1366
+ size: 32,
1367
+ "font-size": 20
1368
+ })) : I("", !0), y("div", qt, [t(e) === "signIn" ? (c(), k(yt, {
1369
+ key: 0,
1370
+ size: n.size,
1371
+ loading: t(h),
1372
+ onSwitchSignUp: t(f),
1373
+ onSwitchResetPassword: t(a),
1374
+ onSubmit: R[0] || (R[0] = (q) => t(v)(q))
1375
+ }, {
1376
+ OAuth: m(() => [s(Ce, {
1377
+ size: n.size
1378
+ }, null, 8, ["size"])]),
1379
+ _: 1
1380
+ }, 8, ["size", "loading", "onSwitchSignUp", "onSwitchResetPassword"])) : t(e) === "signUp" ? (c(), k(Ut, {
1381
+ key: 1,
1382
+ size: n.size,
1383
+ loading: t(o),
1384
+ onSwitchSignIn: t(p),
1385
+ onSubmit: R[1] || (R[1] = (q) => t(l)(q))
1386
+ }, null, 8, ["size", "loading", "onSwitchSignIn"])) : t(e) === "resetPassword" ? (c(), k(Ke, {
1387
+ key: 2,
1388
+ size: n.size,
1389
+ loading: t(d),
1390
+ onSwitchSignIn: t(p),
1391
+ onSubmit: R[2] || (R[2] = (q) => t(u)(q))
1392
+ }, null, 8, ["size", "loading", "onSwitchSignIn"])) : I("", !0), s(Je, {
1393
+ onToPrivacyPolicy: w,
1394
+ onToUserServiceAgreement: U
1395
+ })])]));
1396
+ }
1397
+ }), Tt = /* @__PURE__ */ P(Bt, [["__scopeId", "data-v-99ccec1c"]]), Ot = /* @__PURE__ */ z({
1398
+ __name: "AuthkitAuthModal",
1399
+ props: {
1400
+ size: {
1401
+ default: "large"
1402
+ }
1403
+ },
1404
+ emits: ["close", "toPrivacyPolicy", "toUserServiceAgreement"],
1405
+ setup(g, {
1406
+ emit: r
1407
+ }) {
1408
+ const n = r, {
1409
+ onSignIn: i
1410
+ } = x(), {
1411
+ isOpen: v,
1412
+ close: l
1413
+ } = pe();
1414
+ let u = null;
1415
+ j(() => {
1416
+ u = i(() => l());
1417
+ }), oe(() => {
1418
+ u == null || u(), u = null;
1419
+ });
1420
+ function e(o) {
1421
+ o || l();
1422
+ }
1423
+ function h() {
1424
+ l(), n("close");
1425
+ }
1426
+ return (o, d) => (c(), k(t(ye), {
1427
+ visible: t(v),
1428
+ footer: !1,
1429
+ "mask-closable": !1,
1430
+ "title-align": "center",
1431
+ "unmount-on-close": "",
1432
+ width: "auto",
1433
+ "modal-class": "SignInModalClass",
1434
+ "onUpdate:visible": e,
1435
+ onClose: h
1436
+ }, {
1437
+ title: m(() => [s(ge)]),
1438
+ default: m(() => [s(Tt, {
1439
+ "show-title": !1,
1440
+ size: g.size,
1441
+ onToPrivacyPolicy: d[0] || (d[0] = (f) => n("toPrivacyPolicy")),
1442
+ onToUserServiceAgreement: d[1] || (d[1] = (f) => n("toUserServiceAgreement"))
1443
+ }, null, 8, ["size"])]),
1444
+ _: 1
1445
+ }, 8, ["visible"]));
1446
+ }
1447
+ }), xt = /* @__PURE__ */ P(Ot, [["__scopeId", "data-v-e2b88450"]]), Lt = /* @__PURE__ */ z({
1448
+ __name: "AuthkitOAuthCallbackProvider",
1449
+ props: {
1450
+ bindIdentityRedirect: {
1451
+ default: ""
1452
+ },
1453
+ closePopupOnBindSuccess: {
1454
+ type: Boolean,
1455
+ default: !0
1456
+ },
1457
+ restoreRedirectAfterSignIn: {
1458
+ type: Boolean,
1459
+ default: !0
1460
+ }
1461
+ },
1462
+ setup(g) {
1463
+ const r = g, n = ["token", "userId", "appId", "error", "needBindIdentity", "bindSuccess", "provider"], {
1464
+ completeSignIn: i
1465
+ } = x(), {
1466
+ fetchUserProfile: v
1467
+ } = J();
1468
+ function l(o) {
1469
+ return n.some((d) => o.searchParams.has(d));
1470
+ }
1471
+ function u(o) {
1472
+ n.forEach((f) => o.searchParams.delete(f));
1473
+ const d = `${o.pathname}${o.search}${o.hash}`;
1474
+ window.history.replaceState({}, "", d);
1475
+ }
1476
+ function e() {
1477
+ if (!r.restoreRedirectAfterSignIn) return null;
1478
+ const o = sessionStorage.getItem("auth_redirect");
1479
+ if (sessionStorage.removeItem("auth_redirect"), !o) return null;
1480
+ const d = window.location.pathname + window.location.search + window.location.hash;
1481
+ return o === d ? null : o;
1482
+ }
1483
+ async function h() {
1484
+ if (typeof window > "u") return;
1485
+ const o = new URL(window.location.href);
1486
+ if (!l(o)) return;
1487
+ const d = o.searchParams.get("error");
1488
+ if (d) {
1489
+ u(o), ee.error(d);
1490
+ return;
1491
+ }
1492
+ if (o.searchParams.get("bindSuccess") === "true") {
1493
+ const U = o.searchParams.get("provider");
1494
+ u(o), await v(), ee.success(U ? `${U} 绑定成功` : "绑定成功"), r.closePopupOnBindSuccess && window.opener && setTimeout(() => window.close(), 800);
1495
+ return;
1496
+ }
1497
+ const f = o.searchParams.get("token");
1498
+ if (!f) return;
1499
+ const a = o.searchParams.get("userId"), p = o.searchParams.get("appId"), _ = o.searchParams.get("needBindIdentity") === "true";
1500
+ if (u(o), i({
1501
+ jwtToken: f,
1502
+ userId: a,
1503
+ appId: p,
1504
+ needBindIdentity: _
1505
+ }), await v(), _ && r.bindIdentityRedirect) {
1506
+ window.location.href = r.bindIdentityRedirect;
1507
+ return;
1508
+ }
1509
+ const w = e();
1510
+ w && (window.location.href = w);
1511
+ }
1512
+ return j(() => {
1513
+ h();
1514
+ }), (o, d) => null;
1515
+ }
1516
+ }), Ci = /* @__PURE__ */ z({
1517
+ __name: "AuthkitProvider",
1518
+ props: {
1519
+ config: {},
1520
+ handleOAuthCallback: {
1521
+ type: Boolean,
1522
+ default: !0
1523
+ },
1524
+ restoreSession: {
1525
+ type: Boolean,
1526
+ default: !0
1527
+ },
1528
+ fetchAppInfo: {
1529
+ type: Boolean,
1530
+ default: !0
1531
+ },
1532
+ showAuthModal: {
1533
+ type: Boolean,
1534
+ default: !0
1535
+ },
1536
+ authModalSize: {
1537
+ default: "large"
1538
+ },
1539
+ bindIdentityRedirect: {
1540
+ default: ""
1541
+ },
1542
+ closePopupOnBindSuccess: {
1543
+ type: Boolean,
1544
+ default: !0
1545
+ },
1546
+ restoreRedirectAfterSignIn: {
1547
+ type: Boolean,
1548
+ default: !0
1549
+ }
1550
+ },
1551
+ emits: ["toPrivacyPolicy", "toUserServiceAgreement"],
1552
+ setup(g, {
1553
+ emit: r
1554
+ }) {
1555
+ const n = g, i = r;
1556
+ n.config && _e(n.config);
1557
+ const {
1558
+ restoreSession: v,
1559
+ onSignIn: l
1560
+ } = x(), {
1561
+ fetchUserProfile: u
1562
+ } = J(), {
1563
+ appsAuthPageInfoApi: e
1564
+ } = F(), h = l(() => {
1565
+ u();
1566
+ });
1567
+ return j(async () => {
1568
+ n.fetchAppInfo && await e(), n.restoreSession && v() && u();
1569
+ }), oe(() => {
1570
+ h();
1571
+ }), (o, d) => (c(), b(D, null, [N(o.$slots, "default"), n.handleOAuthCallback ? (c(), k(Lt, {
1572
+ key: 0,
1573
+ "bind-identity-redirect": n.bindIdentityRedirect,
1574
+ "close-popup-on-bind-success": n.closePopupOnBindSuccess,
1575
+ "restore-redirect-after-sign-in": n.restoreRedirectAfterSignIn
1576
+ }, null, 8, ["bind-identity-redirect", "close-popup-on-bind-success", "restore-redirect-after-sign-in"])) : I("", !0), n.showAuthModal ? (c(), k(xt, {
1577
+ key: 1,
1578
+ size: n.authModalSize,
1579
+ onToPrivacyPolicy: d[0] || (d[0] = (f) => i("toPrivacyPolicy")),
1580
+ onToUserServiceAgreement: d[1] || (d[1] = (f) => i("toUserServiceAgreement"))
1581
+ }, null, 8, ["size"])) : I("", !0)], 64));
1582
+ }
1583
+ }), Mt = {
1584
+ class: "header"
1585
+ }, Ft = ["href"], Et = {
1586
+ class: "container"
1587
+ }, Gt = /* @__PURE__ */ z({
1588
+ __name: "AuthkitAuthContainer",
1589
+ props: {
1590
+ applicationLogoUrl: {
1591
+ type: String,
1592
+ required: !0,
1593
+ default: () => ""
1594
+ },
1595
+ name: {
1596
+ type: String,
1597
+ required: !0,
1598
+ default: () => ""
1599
+ },
1600
+ description: {
1601
+ type: String,
1602
+ required: !0,
1603
+ default: () => ""
1604
+ },
1605
+ appHomePage: {
1606
+ type: String,
1607
+ required: !0,
1608
+ default: () => ""
1609
+ },
1610
+ backgroundImage: {
1611
+ type: String,
1612
+ required: !0,
1613
+ default: () => ""
1614
+ },
1615
+ backgroundColor: {
1616
+ type: String,
1617
+ required: !0,
1618
+ default: () => ""
1619
+ },
1620
+ linkColor: {
1621
+ type: String,
1622
+ default: "var(--huyooo-accent-primary)"
1623
+ },
1624
+ backgroundType: {
1625
+ type: String,
1626
+ default: "color"
1627
+ }
1628
+ },
1629
+ setup(g) {
1630
+ const r = g, n = C(() => r.backgroundType === "color" ? {
1631
+ backgroundColor: r.backgroundColor
1632
+ } : {
1633
+ backgroundImage: `url(${r.backgroundImage})`
1634
+ });
1635
+ return (i, v) => (c(), b("div", {
1636
+ class: "auth",
1637
+ style: Q(n.value)
1638
+ }, [y("div", Mt, [r.name ? (c(), b("a", {
1639
+ key: 0,
1640
+ href: r.appHomePage,
1641
+ target: "_self",
1642
+ class: "link",
1643
+ style: Q({
1644
+ color: r.linkColor
1645
+ })
1646
+ }, " 返回主页 ", 12, Ft)) : I("", !0)]), y("div", Et, [N(i.$slots, "default", {}, void 0, !0)])], 4));
1647
+ }
1648
+ }), Ri = /* @__PURE__ */ P(Gt, [["__scopeId", "data-v-0e13d3ff"]]), Ht = {
1649
+ class: "box"
1650
+ }, Dt = {
1651
+ class: "title"
1652
+ }, Nt = {
1653
+ class: "content"
1654
+ }, jt = {
1655
+ class: "redirect"
1656
+ }, Kt = {
1657
+ style: {
1658
+ "font-weight": "bold",
1659
+ "font-size": "12px"
1660
+ }
1661
+ }, Wt = /* @__PURE__ */ z({
1662
+ __name: "AuthkitAuthorize",
1663
+ props: {
1664
+ size: {
1665
+ type: String,
1666
+ required: !0
1667
+ },
1668
+ title: {
1669
+ type: String,
1670
+ required: !0,
1671
+ default: () => "授权登录"
1672
+ },
1673
+ logo: {
1674
+ type: String,
1675
+ required: !0,
1676
+ default: () => ""
1677
+ },
1678
+ clientId: {
1679
+ type: String,
1680
+ required: !0,
1681
+ default: () => ""
1682
+ },
1683
+ responseType: {
1684
+ type: String,
1685
+ required: !0,
1686
+ default: () => ""
1687
+ },
1688
+ scope: {
1689
+ type: String,
1690
+ required: !0,
1691
+ default: () => ""
1692
+ },
1693
+ state: {
1694
+ type: String,
1695
+ required: !0,
1696
+ default: () => ""
1697
+ },
1698
+ redirectUri: {
1699
+ type: String,
1700
+ required: !0,
1701
+ default: () => ""
1702
+ },
1703
+ userInfo: {
1704
+ type: Object,
1705
+ required: !0,
1706
+ default: () => ""
1707
+ }
1708
+ },
1709
+ setup(g) {
1710
+ const r = S(!1), n = g, i = S({
1711
+ appKey: "",
1712
+ name: "",
1713
+ homePageUrl: "",
1714
+ createAt: "",
1715
+ authorizationCallback: ""
1716
+ });
1717
+ async function v() {
1718
+ const {
1719
+ data: u
1720
+ } = await T.apps.findOne.post({
1721
+ id: n.clientId
1722
+ });
1723
+ u && (i.value = u);
1724
+ }
1725
+ v();
1726
+ async function l() {
1727
+ r.value = !0;
1728
+ const {
1729
+ data: u
1730
+ } = await T.oauth2.authorize.post({
1731
+ client_id: n.clientId,
1732
+ response_type: n.responseType,
1733
+ scope: n.scope,
1734
+ state: n.state,
1735
+ redirect_uri: n.redirectUri
1736
+ });
1737
+ r.value = !1, u && (window.location = u.authorizeUrl);
1738
+ }
1739
+ return (u, e) => (c(), b("div", Ht, [y("div", Dt, O(`授权 ${i.value.name}`), 1), y("div", Nt, [s(t(we), null, {
1740
+ default: m(() => [s(t(X), null, {
1741
+ default: m(() => {
1742
+ var h;
1743
+ return [s(t(Z), {
1744
+ title: i.value.name,
1745
+ description: `想要使用您的${(h = n.userInfo) == null ? void 0 : h.nickname}账户`
1746
+ }, {
1747
+ avatar: m(() => {
1748
+ var o;
1749
+ return [s(t(H), {
1750
+ shape: "square",
1751
+ "image-url": (o = n.userInfo) == null ? void 0 : o.avatar
1752
+ }, null, 8, ["image-url"])];
1753
+ }),
1754
+ _: 1
1755
+ }, 8, ["title", "description"])];
1756
+ }),
1757
+ _: 1
1758
+ }), s(t(X), null, {
1759
+ default: m(() => [s(t(Z), {
1760
+ title: "公开信息",
1761
+ description: "头像、昵称"
1762
+ }, {
1763
+ avatar: m(() => [s(t(H), {
1764
+ shape: "square"
1765
+ }, {
1766
+ default: m(() => [...e[0] || (e[0] = [y("img", {
1767
+ alt: "avatar",
1768
+ src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
1769
+ }, null, -1)])]),
1770
+ _: 1
1771
+ })]),
1772
+ _: 1
1773
+ })]),
1774
+ _: 1
1775
+ }), s(t(X), null, {
1776
+ default: m(() => [s(t(Z), {
1777
+ title: "个人用户数据",
1778
+ description: "电子邮件地址"
1779
+ }, {
1780
+ avatar: m(() => [s(t(H), {
1781
+ shape: "square"
1782
+ }, {
1783
+ default: m(() => [...e[1] || (e[1] = [y("img", {
1784
+ alt: "avatar",
1785
+ src: "https://p1-arco.byteimg.com/tos-cn-i-uwbnlip3yd/3ee5f13fb09879ecb5185e440cef6eb9.png~tplv-uwbnlip3yd-webp.webp"
1786
+ }, null, -1)])]),
1787
+ _: 1
1788
+ })]),
1789
+ _: 1
1790
+ })]),
1791
+ _: 1
1792
+ })]),
1793
+ _: 1
1794
+ }), s(t(B), {
1795
+ type: "primary",
1796
+ size: n.size,
1797
+ loading: r.value,
1798
+ onClick: l
1799
+ }, {
1800
+ default: m(() => [...e[2] || (e[2] = [$(" 授权 ", -1)])]),
1801
+ _: 1
1802
+ }, 8, ["size", "loading"]), y("div", jt, [e[3] || (e[3] = y("div", {
1803
+ class: "redirect-hint"
1804
+ }, "授权后将跳转至", -1)), y("div", Kt, O(i.value.authorizationCallback), 1)])])]));
1805
+ }
1806
+ }), qi = /* @__PURE__ */ P(Wt, [["__scopeId", "data-v-5665e1c4"]]), Qt = {
1807
+ class: "oauth-callback"
1808
+ }, Yt = {
1809
+ key: 0,
1810
+ class: "callback-loading"
1811
+ }, Jt = {
1812
+ key: 1,
1813
+ class: "callback-error"
1814
+ }, Xt = {
1815
+ key: 2,
1816
+ class: "callback-success"
1817
+ }, Zt = /* @__PURE__ */ z({
1818
+ __name: "AuthkitOauthCallback",
1819
+ props: {
1820
+ defaultRedirect: {},
1821
+ loadingText: {},
1822
+ bindIdentityRedirect: {}
1823
+ },
1824
+ emits: ["success", "error", "needBindIdentity"],
1825
+ setup(g, {
1826
+ emit: r
1827
+ }) {
1828
+ const n = g, i = r, v = S(!0), l = S(""), u = S("登录成功,正在跳转..."), {
1829
+ completeSignIn: e,
1830
+ restoreSession: h
1831
+ } = x(), {
1832
+ fetchUserProfile: o
1833
+ } = J();
1834
+ async function d() {
1835
+ const a = new URLSearchParams(window.location.search), p = a.get("error");
1836
+ if (p) {
1837
+ l.value = p, v.value = !1, i("error", l.value);
1838
+ return;
1839
+ }
1840
+ if (a.get("bindSuccess") === "true") {
1841
+ u.value = "绑定成功,可以关闭此页面", window.history.replaceState({}, "", window.location.pathname), v.value = !1, setTimeout(() => {
1842
+ window.close();
1843
+ }, 800);
1844
+ return;
1845
+ }
1846
+ const _ = a.get("token"), w = a.get("userId"), U = a.get("appId"), L = a.get("needBindIdentity") === "true";
1847
+ if (!_) {
1848
+ l.value = "登录失败:未收到认证令牌", v.value = !1, i("error", l.value);
1849
+ return;
1850
+ }
1851
+ try {
1852
+ e({
1853
+ jwtToken: _,
1854
+ userId: w,
1855
+ appId: U,
1856
+ needBindIdentity: L
1857
+ }), await o();
1858
+ const R = window.location.pathname;
1859
+ if (window.history.replaceState({}, "", R), L && (i("needBindIdentity", {
1860
+ token: _,
1861
+ userId: w || "",
1862
+ appId: U || ""
1863
+ }), n.bindIdentityRedirect)) {
1864
+ v.value = !1, setTimeout(() => {
1865
+ window.location.href = n.bindIdentityRedirect;
1866
+ }, 300);
1867
+ return;
1868
+ }
1869
+ i("success", {
1870
+ token: _,
1871
+ userId: w || "",
1872
+ appId: U || "",
1873
+ needBindIdentity: L
1874
+ });
1875
+ const q = sessionStorage.getItem("auth_redirect");
1876
+ sessionStorage.removeItem("auth_redirect");
1877
+ const K = q || n.defaultRedirect || "/";
1878
+ v.value = !1, setTimeout(() => {
1879
+ window.location.href = K;
1880
+ }, 500);
1881
+ } catch (R) {
1882
+ console.error("OAuth 回调处理失败:", R), l.value = "登录处理失败,请重试", v.value = !1, i("error", l.value);
1883
+ }
1884
+ }
1885
+ function f() {
1886
+ const a = sessionStorage.getItem("auth_redirect");
1887
+ sessionStorage.removeItem("auth_redirect"), window.location.href = a || n.defaultRedirect || "/";
1888
+ }
1889
+ return j(() => {
1890
+ const a = new URLSearchParams(window.location.search);
1891
+ if (a.has("token") || a.has("error") || a.has("bindSuccess"))
1892
+ d();
1893
+ else if (h()) {
1894
+ const p = sessionStorage.getItem("auth_redirect");
1895
+ sessionStorage.removeItem("auth_redirect"), window.location.href = p || n.defaultRedirect || "/";
1896
+ } else
1897
+ l.value = "无效的访问", v.value = !1;
1898
+ }), (a, p) => (c(), b("div", Qt, [v.value ? (c(), b("div", Yt, [p[0] || (p[0] = y("div", {
1899
+ class: "spinner"
1900
+ }, null, -1)), y("p", null, O(g.loadingText), 1)])) : l.value ? (c(), b("div", Jt, [p[1] || (p[1] = y("div", {
1901
+ class: "error-icon"
1902
+ }, "✕", -1)), p[2] || (p[2] = y("h2", null, "登录失败", -1)), y("p", null, O(l.value), 1), y("button", {
1903
+ class: "retry-btn",
1904
+ onClick: f
1905
+ }, "返回重试")])) : (c(), b("div", Xt, [p[3] || (p[3] = y("div", {
1906
+ class: "success-icon"
1907
+ }, "✓", -1)), y("p", null, O(u.value), 1)]))]));
1908
+ }
1909
+ }), Bi = /* @__PURE__ */ P(Zt, [["__scopeId", "data-v-4b4b59a1"]]), ei = {
1910
+ class: "BindEmail"
1911
+ }, ti = {
1912
+ class: "content"
1913
+ }, ii = {
1914
+ class: "sendVerifyCodeItem"
1915
+ }, oi = {
1916
+ class: "handle"
1917
+ }, si = {
1918
+ key: 0,
1919
+ class: "skip"
1920
+ }, ni = /* @__PURE__ */ z({
1921
+ __name: "AuthkitBindEmail",
1922
+ props: {
1923
+ size: {
1924
+ type: String,
1925
+ required: !0
1926
+ },
1927
+ loading: {
1928
+ type: Boolean,
1929
+ required: !0,
1930
+ default: () => !1
1931
+ },
1932
+ /** 是否显示跳过按钮 */
1933
+ showSkip: {
1934
+ type: Boolean,
1935
+ default: !1
1936
+ }
1937
+ },
1938
+ emits: ["submit", "skip"],
1939
+ setup(g, {
1940
+ emit: r
1941
+ }) {
1942
+ const n = r, i = g, v = S(), l = S(!1), u = S(), e = S({
1943
+ email: void 0,
1944
+ userToken: void 0,
1945
+ emailVerifyId: void 0
1946
+ });
1947
+ async function h() {
1948
+ if (!await u.value.validateField(["email"])) {
1949
+ l.value = !0;
1950
+ const {
1951
+ data: a
1952
+ } = await T.verify.email.retry.post({
1953
+ email: e.value.email,
1954
+ purpose: "bindEmail"
1955
+ });
1956
+ l.value = !1, a && (e.value.emailVerifyId = a.emailVerifyId, v.value.startCountFn());
1957
+ }
1958
+ }
1959
+ async function o() {
1960
+ u.value.validate().then((f) => {
1961
+ f || n("submit", {
1962
+ email: e.value.email,
1963
+ userToken: e.value.userToken,
1964
+ emailVerifyId: e.value.emailVerifyId
1965
+ });
1966
+ });
1967
+ }
1968
+ function d() {
1969
+ n("skip");
1970
+ }
1971
+ return (f, a) => (c(), b("div", ei, [a[4] || (a[4] = y("div", {
1972
+ class: "header"
1973
+ }, [y("h3", {
1974
+ class: "title"
1975
+ }, "绑定邮箱"), y("p", {
1976
+ class: "subtitle"
1977
+ }, "请绑定邮箱以完成账号设置,绑定后可使用邮箱登录")], -1)), y("div", ti, [s(t(M), {
1978
+ ref_key: "formRef",
1979
+ ref: u,
1980
+ model: e.value,
1981
+ size: i.size,
1982
+ "auto-label-width": ""
1983
+ }, {
1984
+ default: m(() => [s(t(A), {
1985
+ field: "email",
1986
+ label: "邮箱",
1987
+ "hide-label": "",
1988
+ rules: [{
1989
+ required: !0,
1990
+ message: "请输入邮箱"
1991
+ }, {
1992
+ type: "email",
1993
+ message: "请输入有效的邮箱"
1994
+ }]
1995
+ }, {
1996
+ default: m(() => [s(t(V), {
1997
+ modelValue: e.value.email,
1998
+ "onUpdate:modelValue": a[0] || (a[0] = (p) => e.value.email = p),
1999
+ placeholder: "请输入邮箱",
2000
+ autocomplete: "email",
2001
+ type: "email"
2002
+ }, null, 8, ["modelValue"])]),
2003
+ _: 1
2004
+ }), s(t(A), {
2005
+ field: "userToken",
2006
+ label: "验证码",
2007
+ "hide-label": "",
2008
+ rules: [{
2009
+ required: !0,
2010
+ message: "请输入验证码"
2011
+ }]
2012
+ }, {
2013
+ default: m(() => [y("div", ii, [s(t(V), {
2014
+ modelValue: e.value.userToken,
2015
+ "onUpdate:modelValue": a[1] || (a[1] = (p) => e.value.userToken = p),
2016
+ placeholder: "请输入验证码",
2017
+ autocomplete: "one-time-code"
2018
+ }, null, 8, ["modelValue"]), s(G, {
2019
+ ref_key: "SendVerifyCodeRef",
2020
+ ref: v,
2021
+ size: i.size,
2022
+ loading: l.value,
2023
+ style: {
2024
+ "margin-left": "10px"
2025
+ },
2026
+ onSend: h
2027
+ }, null, 8, ["size", "loading"])])]),
2028
+ _: 1
2029
+ }), y("div", oi, [s(t(B), {
2030
+ type: "primary",
2031
+ loading: i.loading,
2032
+ long: "",
2033
+ size: i.size,
2034
+ onClick: o
2035
+ }, {
2036
+ default: m(() => [...a[2] || (a[2] = [$(" 绑定邮箱 ", -1)])]),
2037
+ _: 1
2038
+ }, 8, ["loading", "size"])])]),
2039
+ _: 1
2040
+ }, 8, ["model", "size"])]), i.showSkip ? (c(), b("div", si, [s(t(E), {
2041
+ onClick: d
2042
+ }, {
2043
+ default: m(() => [...a[3] || (a[3] = [$("稍后绑定", -1)])]),
2044
+ _: 1
2045
+ })])) : I("", !0)]));
2046
+ }
2047
+ }), Ti = /* @__PURE__ */ P(ni, [["__scopeId", "data-v-2432c885"]]), ai = {
2048
+ class: "oauth-binding-account"
2049
+ }, li = {
2050
+ class: "oauth-binding-account__info"
2051
+ }, ri = {
2052
+ class: "oauth-binding-account__name"
2053
+ }, ui = /* @__PURE__ */ z({
2054
+ __name: "AuthkitGithubBinding",
2055
+ props: {
2056
+ size: {
2057
+ type: String,
2058
+ required: !0
2059
+ }
2060
+ },
2061
+ setup(g) {
2062
+ const {
2063
+ userProfile: r,
2064
+ fetchUserProfile: n
2065
+ } = J(), i = S("hidden"), v = S(!1);
2066
+ let l;
2067
+ const u = g, e = C(() => {
2068
+ var _, w, U;
2069
+ return ((w = (_ = r.value) == null ? void 0 : _.github) == null ? void 0 : w.avatar_url) || ((U = r.value) == null ? void 0 : U.avatar) || "";
2070
+ }), {
2071
+ getOauthCallbackUrl: h
2072
+ } = fe();
2073
+ function o(_) {
2074
+ i.value = _;
2075
+ }
2076
+ async function d() {
2077
+ const _ = be.appId;
2078
+ if (!_) {
2079
+ console.error("GitHub OAuth 失败: appId 未配置");
2080
+ return;
2081
+ }
2082
+ const {
2083
+ data: w
2084
+ } = await T.oauth.github.login.get({
2085
+ appId: _,
2086
+ mode: "bind",
2087
+ redirectUri: h()
2088
+ });
2089
+ if (w) {
2090
+ const {
2091
+ redirectUri: U
2092
+ } = w;
2093
+ v.value = !0, window.open(U, "_blank");
2094
+ }
2095
+ }
2096
+ async function f() {
2097
+ const {
2098
+ error: _
2099
+ } = await T.users.unbind.oauth.post({
2100
+ provider: "github"
2101
+ });
2102
+ _ || (ee.success("解绑成功"), i.value = "hidden", n());
2103
+ }
2104
+ function a() {
2105
+ i.value === "bind" && (i.value = "hidden", d()), i.value === "unbind" && f();
2106
+ }
2107
+ function p() {
2108
+ v.value && n();
2109
+ }
2110
+ return j(() => {
2111
+ r.value || n(), l = setInterval(p, 1e3);
2112
+ }), oe(() => {
2113
+ l && clearInterval(l);
2114
+ }), (_, w) => {
2115
+ var U, L, R;
2116
+ return c(), b(D, null, [!((U = t(r)) != null && U.github) && i.value === "hidden" ? (c(), k(t(re), {
2117
+ key: 0,
2118
+ title: "绑定GitHub"
2119
+ }, {
2120
+ action: m(() => [s(t(B), {
2121
+ size: u.size,
2122
+ type: "primary",
2123
+ onClick: w[0] || (w[0] = (q) => o("bind"))
2124
+ }, {
2125
+ default: m(() => [...w[2] || (w[2] = [$(" 绑定GitHub ", -1)])]),
2126
+ _: 1
2127
+ }, 8, ["size"])]),
2128
+ default: m(() => [w[3] || (w[3] = $(" 您还未绑定GitHub账号,请点击绑定。 ", -1))]),
2129
+ _: 1
2130
+ })) : I("", !0), (L = t(r)) != null && L.github && i.value === "hidden" ? (c(), k(t(re), {
2131
+ key: 1,
2132
+ title: "解绑GitHub"
2133
+ }, {
2134
+ action: m(() => [s(t(B), {
2135
+ size: u.size,
2136
+ type: "primary",
2137
+ onClick: w[1] || (w[1] = (q) => o("unbind"))
2138
+ }, {
2139
+ default: m(() => [...w[5] || (w[5] = [$(" 解绑GitHub ", -1)])]),
2140
+ _: 1
2141
+ }, 8, ["size"])]),
2142
+ default: m(() => {
2143
+ var q, K;
2144
+ return [y("div", ai, [e.value ? (c(), k(t(H), {
2145
+ key: 0,
2146
+ class: "oauth-binding-account__avatar",
2147
+ "image-url": e.value,
2148
+ size: 42
2149
+ }, null, 8, ["image-url"])) : (c(), k(t(H), {
2150
+ key: 1,
2151
+ class: "oauth-binding-account__avatar oauth-binding-account__avatar--placeholder",
2152
+ size: 42
2153
+ }, {
2154
+ default: m(() => [s(t(me), {
2155
+ icon: "bi:github",
2156
+ width: 22
2157
+ })]),
2158
+ _: 1
2159
+ })), y("div", li, [w[4] || (w[4] = y("div", {
2160
+ class: "oauth-binding-account__provider"
2161
+ }, "GitHub", -1)), y("div", ri, O(((K = (q = t(r)) == null ? void 0 : q.github) == null ? void 0 : K.login) || "GitHub"), 1)])])];
2162
+ }),
2163
+ _: 1
2164
+ })) : I("", !0), i.value === "bind" || i.value === "unbind" ? (c(), k(ke, {
2165
+ key: 2,
2166
+ size: u.size,
2167
+ email: (R = t(r)) == null ? void 0 : R.email,
2168
+ onNext: a
2169
+ }, null, 8, ["size", "email"])) : I("", !0)], 64);
2170
+ };
2171
+ }
2172
+ }), Oi = /* @__PURE__ */ P(ui, [["__scopeId", "data-v-6ab8a1f9"]]), di = "jwtToken";
2173
+ let Y = null, ue = !1;
2174
+ async function ci(g) {
2175
+ g.intent && await g.intent();
2176
+ }
2177
+ function pi() {
2178
+ if (ue) return;
2179
+ ue = !0;
2180
+ const {
2181
+ onSignIn: g
2182
+ } = x();
2183
+ g(() => {
2184
+ const r = Y;
2185
+ Y = null, r && ci(r);
2186
+ });
2187
+ }
2188
+ function de() {
2189
+ try {
2190
+ return localStorage.getItem(di);
2191
+ } catch {
2192
+ return null;
2193
+ }
2194
+ }
2195
+ function xi() {
2196
+ pi();
2197
+ const {
2198
+ jwtToken: g
2199
+ } = x(), {
2200
+ open: r
2201
+ } = pe(), n = C(() => !!(g.value || de()));
2202
+ function i() {
2203
+ return !!(g.value || de());
2204
+ }
2205
+ function v(u) {
2206
+ return i() ? !0 : (Y = {
2207
+ intent: u ?? null
2208
+ }, r({
2209
+ view: "signIn"
2210
+ }), !1);
2211
+ }
2212
+ function l() {
2213
+ Y = null;
2214
+ }
2215
+ return {
2216
+ isAuthenticatedRef: n,
2217
+ isAuthenticated: i,
2218
+ ensureAuthenticated: v,
2219
+ clearPendingIntent: l
2220
+ };
2221
+ }
2222
+ export {
2223
+ Tt as A,
2224
+ W as O,
2225
+ tt as P,
2226
+ Ke as R,
2227
+ Je as S,
2228
+ Lt as _,
2229
+ Ri as a,
2230
+ xt as b,
2231
+ ge as c,
2232
+ qi as d,
2233
+ Ti as e,
2234
+ Oi as f,
2235
+ Bi as g,
2236
+ Ce as h,
2237
+ Oe as i,
2238
+ Fe as j,
2239
+ Ci as k,
2240
+ yt as l,
2241
+ dt as m,
2242
+ Ut as n,
2243
+ It as o,
2244
+ le as p,
2245
+ ve as q,
2246
+ xi as u
2247
+ };