@gup-fe/js-sdk 2.4.4 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/js-sdk.bundle.js +25 -22
- package/dist/js-sdk.bundle.umd.js +1 -1
- package/dist/js-sdk.js +25 -22
- package/dist/js-sdk.umd.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -97,10 +97,11 @@ export declare const isLoggedIn: (gameId?: string) => boolean;
|
|
|
97
97
|
|
|
98
98
|
export declare function Login({ open, onOpenChange, sceneId, onPhoneLoginSuccess, onAccountLoginSuccess, onUidLoginSuccess, onLoginSuccess, onLoginError, closeable, mountToaster, toastConfigs, ...props }: Props): JSX.Element;
|
|
99
99
|
|
|
100
|
-
export declare function login({ loginTypes, defaultLoginType, gameId, onLoginSuccess, onLoginError, }: {
|
|
100
|
+
export declare function login({ loginTypes, defaultLoginType, gameId, styleVars, onLoginSuccess, onLoginError, }: {
|
|
101
101
|
loginTypes?: LoginTypes[];
|
|
102
102
|
defaultLoginType?: LoginTypes;
|
|
103
103
|
gameId?: string;
|
|
104
|
+
styleVars?: StyleVars;
|
|
104
105
|
onLoginSuccess?: (data: CallbackLoginData) => void;
|
|
105
106
|
onLoginError?: (error: any) => void;
|
|
106
107
|
}): {
|
package/dist/js-sdk.bundle.js
CHANGED
|
@@ -33540,51 +33540,54 @@ function Xj({
|
|
|
33540
33540
|
loginTypes: e,
|
|
33541
33541
|
defaultLoginType: n,
|
|
33542
33542
|
gameId: o,
|
|
33543
|
-
|
|
33544
|
-
|
|
33543
|
+
styleVars: s,
|
|
33544
|
+
onLoginSuccess: l,
|
|
33545
|
+
onLoginError: c
|
|
33545
33546
|
}) {
|
|
33546
|
-
const
|
|
33547
|
+
const u = ua(o);
|
|
33547
33548
|
if (document.querySelector(".login-sdk-container"))
|
|
33548
33549
|
return console.warn("Login component is already active. Multiple instances are not allowed."), { close: () => {
|
|
33549
33550
|
} };
|
|
33550
|
-
const
|
|
33551
|
-
|
|
33552
|
-
const
|
|
33551
|
+
const f = document.createElement("div");
|
|
33552
|
+
f.className = "login-sdk-container", document.body.appendChild(f);
|
|
33553
|
+
const p = XT.createRoot(f), h = () => {
|
|
33553
33554
|
setTimeout(() => {
|
|
33554
|
-
|
|
33555
|
+
p.unmount(), f.remove();
|
|
33555
33556
|
}, 200);
|
|
33556
|
-
},
|
|
33557
|
-
|
|
33557
|
+
}, g = () => {
|
|
33558
|
+
p.render(
|
|
33558
33559
|
/* @__PURE__ */ D.jsx(
|
|
33559
33560
|
Q1,
|
|
33560
33561
|
{
|
|
33561
|
-
gameId:
|
|
33562
|
+
gameId: u,
|
|
33562
33563
|
loginTypes: e,
|
|
33563
33564
|
defaultLoginType: n,
|
|
33565
|
+
styleVars: s,
|
|
33564
33566
|
open: !1,
|
|
33565
|
-
onOpenChange:
|
|
33566
|
-
onLoginSuccess:
|
|
33567
|
-
onLoginError:
|
|
33567
|
+
onOpenChange: y,
|
|
33568
|
+
onLoginSuccess: l,
|
|
33569
|
+
onLoginError: c
|
|
33568
33570
|
}
|
|
33569
33571
|
)
|
|
33570
|
-
),
|
|
33571
|
-
},
|
|
33572
|
-
|
|
33572
|
+
), h();
|
|
33573
|
+
}, y = (b) => {
|
|
33574
|
+
b || g();
|
|
33573
33575
|
};
|
|
33574
|
-
return
|
|
33576
|
+
return p.render(
|
|
33575
33577
|
/* @__PURE__ */ D.jsx(
|
|
33576
33578
|
Q1,
|
|
33577
33579
|
{
|
|
33578
|
-
gameId:
|
|
33580
|
+
gameId: u,
|
|
33579
33581
|
loginTypes: e,
|
|
33580
33582
|
defaultLoginType: n,
|
|
33583
|
+
styleVars: s,
|
|
33581
33584
|
open: !0,
|
|
33582
|
-
onOpenChange:
|
|
33583
|
-
onLoginSuccess:
|
|
33584
|
-
onLoginError:
|
|
33585
|
+
onOpenChange: y,
|
|
33586
|
+
onLoginSuccess: l,
|
|
33587
|
+
onLoginError: c
|
|
33585
33588
|
}
|
|
33586
33589
|
)
|
|
33587
|
-
), { close:
|
|
33590
|
+
), { close: g };
|
|
33588
33591
|
}
|
|
33589
33592
|
const Kj = {
|
|
33590
33593
|
init: h4,
|
|
@@ -78,4 +78,4 @@ components: `).concat($g(c),"\n```")),[2,u]}})})}}}function zC(){if(!(window.__f
|
|
|
78
78
|
|
|
79
79
|
`)}S.write("payload.value = newResult;"),S.write("return payload;");const L=S.compile();return(j,k)=>L(b,j,k)};let c;const u=tu,f=!_h.jitless,h=f&&SD.value,g=n.catchall;let y;e._zod.parse=(b,S)=>{y??(y=s.value);const x=b.value;return u(x)?f&&h&&S?.async===!1&&S.jitless!==!0?(c||(c=l(n.shape)),b=c(b,S),g?b1([],x,b,S,y,e):b):o(b,S):(b.issues.push({expected:"object",code:"invalid_type",input:x,inst:e}),b)}});function S1(e,n,o,s){for(const c of e)if(c.issues.length===0)return n.value=c.value,n;const l=e.filter(c=>!Ns(c));return l.length===1?(n.value=l[0].value,l[0]):(n.issues.push({code:"invalid_union",input:n.value,inst:o,errors:e.map(c=>c.issues.map(u=>Gi(u,s,Bi())))}),n)}const e6=Se("$ZodUnion",(e,n)=>{bn.init(e,n),Vt(e._zod,"optin",()=>n.options.some(s=>s._zod.optin==="optional")?"optional":void 0),Vt(e._zod,"optout",()=>n.options.some(s=>s._zod.optout==="optional")?"optional":void 0),Vt(e._zod,"values",()=>{if(n.options.every(s=>s._zod.values))return new Set(n.options.flatMap(s=>Array.from(s._zod.values)))}),Vt(e._zod,"pattern",()=>{if(n.options.every(s=>s._zod.pattern)){const s=n.options.map(l=>l._zod.pattern);return new RegExp(`^(${s.map(l=>zh(l.source)).join("|")})$`)}});const o=n.options.length===1?n.options[0]._zod.run:null;e._zod.parse=(s,l)=>{if(o)return o(s,l);let c=!1;const u=[];for(const f of n.options){const p=f._zod.run({value:s.value,issues:[]},l);if(p instanceof Promise)u.push(p),c=!0;else{if(p.issues.length===0)return p;u.push(p)}}return c?Promise.all(u).then(f=>S1(f,s,e,l)):S1(u,s,e,l)}}),t6=Se("$ZodIntersection",(e,n)=>{bn.init(e,n),e._zod.parse=(o,s)=>{const l=o.value,c=n.left._zod.run({value:l,issues:[]},s),u=n.right._zod.run({value:l,issues:[]},s);return c instanceof Promise||u instanceof Promise?Promise.all([c,u]).then(([p,h])=>w1(o,p,h)):w1(o,c,u)}});function Ph(e,n){if(e===n)return{valid:!0,data:e};if(e instanceof Date&&n instanceof Date&&+e==+n)return{valid:!0,data:e};if(Qa(e)&&Qa(n)){const o=Object.keys(n),s=Object.keys(e).filter(c=>o.indexOf(c)!==-1),l={...e,...n};for(const c of s){const u=Ph(e[c],n[c]);if(!u.valid)return{valid:!1,mergeErrorPath:[c,...u.mergeErrorPath]};l[c]=u.data}return{valid:!0,data:l}}if(Array.isArray(e)&&Array.isArray(n)){if(e.length!==n.length)return{valid:!1,mergeErrorPath:[]};const o=[];for(let s=0;s<e.length;s++){const l=e[s],c=n[s],u=Ph(l,c);if(!u.valid)return{valid:!1,mergeErrorPath:[s,...u.mergeErrorPath]};o.push(u.data)}return{valid:!0,data:o}}return{valid:!1,mergeErrorPath:[]}}function w1(e,n,o){const s=new Map;let l;for(const f of n.issues)if(f.code==="unrecognized_keys"){l??(l=f);for(const p of f.keys)s.has(p)||s.set(p,{}),s.get(p).l=!0}else e.issues.push(f);for(const f of o.issues)if(f.code==="unrecognized_keys")for(const p of f.keys)s.has(p)||s.set(p,{}),s.get(p).r=!0;else e.issues.push(f);const c=[...s].filter(([,f])=>f.l&&f.r).map(([f])=>f);if(c.length&&l&&e.issues.push({...l,keys:c}),Ns(e))return e;const u=Ph(n.value,o.value);if(!u.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(u.mergeErrorPath)}`);return e.value=u.data,e}const n6=Se("$ZodEnum",(e,n)=>{bn.init(e,n);const o=r1(n.entries),s=new Set(o);e._zod.values=s,e._zod.pattern=new RegExp(`^(${o.filter(l=>wD.has(typeof l)).map(l=>typeof l=="string"?nu(l):l.toString()).join("|")})$`),e._zod.parse=(l,c)=>{const u=l.value;return s.has(u)||l.issues.push({code:"invalid_value",values:o,input:u,inst:e}),l}}),r6=Se("$ZodTransform",(e,n)=>{bn.init(e,n),e._zod.optin="optional",e._zod.parse=(o,s)=>{if(s.direction==="backward")throw new n1(e.constructor.name);const l=n.transform(o.value,o);if(s.async)return(l instanceof Promise?l:Promise.resolve(l)).then(u=>(o.value=u,o.fallback=!0,o));if(l instanceof Promise)throw new zs;return o.value=l,o.fallback=!0,o}});function x1(e,n){return n===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const E1=Se("$ZodOptional",(e,n)=>{bn.init(e,n),e._zod.optin="optional",e._zod.optout="optional",Vt(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,void 0]):void 0),Vt(e._zod,"pattern",()=>{const o=n.innerType._zod.pattern;return o?new RegExp(`^(${zh(o.source)})?$`):void 0}),e._zod.parse=(o,s)=>{if(n.innerType._zod.optin==="optional"){const l=o.value,c=n.innerType._zod.run(o,s);return c instanceof Promise?c.then(u=>x1(u,l)):x1(c,l)}return o.value===void 0?o:n.innerType._zod.run(o,s)}}),o6=Se("$ZodExactOptional",(e,n)=>{E1.init(e,n),Vt(e._zod,"values",()=>n.innerType._zod.values),Vt(e._zod,"pattern",()=>n.innerType._zod.pattern),e._zod.parse=(o,s)=>n.innerType._zod.run(o,s)}),i6=Se("$ZodNullable",(e,n)=>{bn.init(e,n),Vt(e._zod,"optin",()=>n.innerType._zod.optin),Vt(e._zod,"optout",()=>n.innerType._zod.optout),Vt(e._zod,"pattern",()=>{const o=n.innerType._zod.pattern;return o?new RegExp(`^(${zh(o.source)}|null)$`):void 0}),Vt(e._zod,"values",()=>n.innerType._zod.values?new Set([...n.innerType._zod.values,null]):void 0),e._zod.parse=(o,s)=>o.value===null?o:n.innerType._zod.run(o,s)}),s6=Se("$ZodDefault",(e,n)=>{bn.init(e,n),e._zod.optin="optional",Vt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(o,s)=>{if(s.direction==="backward")return n.innerType._zod.run(o,s);if(o.value===void 0)return o.value=n.defaultValue,o;const l=n.innerType._zod.run(o,s);return l instanceof Promise?l.then(c=>T1(c,n)):T1(l,n)}});function T1(e,n){return e.value===void 0&&(e.value=n.defaultValue),e}const a6=Se("$ZodPrefault",(e,n)=>{bn.init(e,n),e._zod.optin="optional",Vt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(o,s)=>(s.direction==="backward"||o.value===void 0&&(o.value=n.defaultValue),n.innerType._zod.run(o,s))}),l6=Se("$ZodNonOptional",(e,n)=>{bn.init(e,n),Vt(e._zod,"values",()=>{const o=n.innerType._zod.values;return o?new Set([...o].filter(s=>s!==void 0)):void 0}),e._zod.parse=(o,s)=>{const l=n.innerType._zod.run(o,s);return l instanceof Promise?l.then(c=>C1(c,e)):C1(l,e)}});function C1(e,n){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:n}),e}const c6=Se("$ZodCatch",(e,n)=>{bn.init(e,n),e._zod.optin="optional",Vt(e._zod,"optout",()=>n.innerType._zod.optout),Vt(e._zod,"values",()=>n.innerType._zod.values),e._zod.parse=(o,s)=>{if(s.direction==="backward")return n.innerType._zod.run(o,s);const l=n.innerType._zod.run(o,s);return l instanceof Promise?l.then(c=>(o.value=c.value,c.issues.length&&(o.value=n.catchValue({...o,error:{issues:c.issues.map(u=>Gi(u,s,Bi()))},input:o.value}),o.issues=[],o.fallback=!0),o)):(o.value=l.value,l.issues.length&&(o.value=n.catchValue({...o,error:{issues:l.issues.map(c=>Gi(c,s,Bi()))},input:o.value}),o.issues=[],o.fallback=!0),o)}}),u6=Se("$ZodPipe",(e,n)=>{bn.init(e,n),Vt(e._zod,"values",()=>n.in._zod.values),Vt(e._zod,"optin",()=>n.in._zod.optin),Vt(e._zod,"optout",()=>n.out._zod.optout),Vt(e._zod,"propValues",()=>n.in._zod.propValues),e._zod.parse=(o,s)=>{if(s.direction==="backward"){const c=n.out._zod.run(o,s);return c instanceof Promise?c.then(u=>lu(u,n.in,s)):lu(c,n.in,s)}const l=n.in._zod.run(o,s);return l instanceof Promise?l.then(c=>lu(c,n.out,s)):lu(l,n.out,s)}});function lu(e,n,o){return e.issues.length?(e.aborted=!0,e):n._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},o)}const f6=Se("$ZodReadonly",(e,n)=>{bn.init(e,n),Vt(e._zod,"propValues",()=>n.innerType._zod.propValues),Vt(e._zod,"values",()=>n.innerType._zod.values),Vt(e._zod,"optin",()=>n.innerType?._zod?.optin),Vt(e._zod,"optout",()=>n.innerType?._zod?.optout),e._zod.parse=(o,s)=>{if(s.direction==="backward")return n.innerType._zod.run(o,s);const l=n.innerType._zod.run(o,s);return l instanceof Promise?l.then(R1):R1(l)}});function R1(e){return e.value=Object.freeze(e.value),e}const d6=Se("$ZodCustom",(e,n)=>{so.init(e,n),bn.init(e,n),e._zod.parse=(o,s)=>o,e._zod.check=o=>{const s=o.value,l=n.fn(s);if(l instanceof Promise)return l.then(c=>O1(c,o,s,e));O1(l,o,s,e)}});function O1(e,n,o,s){if(!e){const l={code:"custom",input:o,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(l.params=s._zod.def.params),n.issues.push(Ka(l))}}var _1;class h6{constructor(){this._map=new WeakMap,this._idmap=new Map}add(n,...o){const s=o[0];return this._map.set(n,s),s&&typeof s=="object"&&"id"in s&&this._idmap.set(s.id,n),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(n){const o=this._map.get(n);return o&&typeof o=="object"&&"id"in o&&this._idmap.delete(o.id),this._map.delete(n),this}get(n){const o=n._zod.parent;if(o){const s={...this.get(o)??{}};delete s.id;const l={...s,...this._map.get(n)};return Object.keys(l).length?l:void 0}return this._map.get(n)}has(n){return this._map.has(n)}}function p6(){return new h6}(_1=globalThis).__zod_globalRegistry??(_1.__zod_globalRegistry=p6());const Ja=globalThis.__zod_globalRegistry;function m6(e,n){return new e({type:"string",...it(n)})}function g6(e,n){return new e({type:"string",format:"email",check:"string_format",abort:!1,...it(n)})}function A1(e,n){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...it(n)})}function y6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...it(n)})}function v6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...it(n)})}function b6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...it(n)})}function S6(e,n){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...it(n)})}function w6(e,n){return new e({type:"string",format:"url",check:"string_format",abort:!1,...it(n)})}function x6(e,n){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...it(n)})}function E6(e,n){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...it(n)})}function T6(e,n){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...it(n)})}function C6(e,n){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...it(n)})}function R6(e,n){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...it(n)})}function O6(e,n){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...it(n)})}function _6(e,n){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...it(n)})}function A6(e,n){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...it(n)})}function M6(e,n){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...it(n)})}function D6(e,n){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...it(n)})}function z6(e,n){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...it(n)})}function N6(e,n){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...it(n)})}function k6(e,n){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...it(n)})}function j6(e,n){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...it(n)})}function L6(e,n){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...it(n)})}function P6(e,n){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...it(n)})}function I6(e,n){return new e({type:"string",format:"date",check:"string_format",...it(n)})}function U6(e,n){return new e({type:"string",format:"time",check:"string_format",precision:null,...it(n)})}function V6(e,n){return new e({type:"string",format:"duration",check:"string_format",...it(n)})}function H6(e){return new e({type:"unknown"})}function F6(e,n){return new e({type:"never",...it(n)})}function M1(e,n){return new dz({check:"max_length",...it(n),maximum:e})}function cu(e,n){return new hz({check:"min_length",...it(n),minimum:e})}function D1(e,n){return new pz({check:"length_equals",...it(n),length:e})}function B6(e,n){return new mz({check:"string_format",format:"regex",...it(n),pattern:e})}function Z6(e){return new gz({check:"string_format",format:"lowercase",...it(e)})}function G6(e){return new yz({check:"string_format",format:"uppercase",...it(e)})}function Y6(e,n){return new vz({check:"string_format",format:"includes",...it(n),includes:e})}function $6(e,n){return new bz({check:"string_format",format:"starts_with",...it(n),prefix:e})}function q6(e,n){return new Sz({check:"string_format",format:"ends_with",...it(n),suffix:e})}function ks(e){return new wz({check:"overwrite",tx:e})}function X6(e){return ks(n=>n.normalize(e))}function Q6(){return ks(e=>e.trim())}function K6(){return ks(e=>e.toLowerCase())}function W6(){return ks(e=>e.toUpperCase())}function J6(){return ks(e=>bD(e))}function eN(e,n,o){return new e({type:"array",element:n,...it(o)})}function tN(e,n,o){return new e({type:"custom",check:"custom",fn:n,...it(o)})}function nN(e,n){const o=rN(s=>(s.addIssue=l=>{if(typeof l=="string")s.issues.push(Ka(l,s.value,o._zod.def));else{const c=l;c.fatal&&(c.continue=!1),c.code??(c.code="custom"),c.input??(c.input=s.value),c.inst??(c.inst=o),c.continue??(c.continue=!o._zod.def.abort),s.issues.push(Ka(c))}},e(s.value,s)),n);return o}function rN(e,n){const o=new so({check:"custom",...it(n)});return o._zod.check=e,o}function z1(e){let n=e?.target??"draft-2020-12";return n==="draft-4"&&(n="draft-04"),n==="draft-7"&&(n="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Ja,target:n,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function kn(e,n,o={path:[],schemaPath:[]}){var s;const l=e._zod.def,c=n.seen.get(e);if(c)return c.count++,o.schemaPath.includes(e)&&(c.cycle=o.path),c.schema;const u={schema:{},count:1,cycle:void 0,path:o.path};n.seen.set(e,u);const f=e._zod.toJSONSchema?.();if(f)u.schema=f;else{const g={...o,schemaPath:[...o.schemaPath,e],path:o.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(n,u.schema,g);else{const b=u.schema,S=n.processors[l.type];if(!S)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${l.type}`);S(e,n,b,g)}const y=e._zod.parent;y&&(u.ref||(u.ref=y),kn(y,n,g),n.seen.get(y).isParent=!0)}const p=n.metadataRegistry.get(e);return p&&Object.assign(u.schema,p),n.io==="input"&&Qn(e)&&(delete u.schema.examples,delete u.schema.default),n.io==="input"&&"_prefault"in u.schema&&((s=u.schema).default??(s.default=u.schema._prefault)),delete u.schema._prefault,n.seen.get(e).schema}function N1(e,n){const o=e.seen.get(n);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const u of e.seen.entries()){const f=e.metadataRegistry.get(u[0])?.id;if(f){const p=s.get(f);if(p&&p!==u[0])throw new Error(`Duplicate schema id "${f}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(f,u[0])}}const l=u=>{const f=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=e.external.registry.get(u[0])?.id,b=e.external.uri??(x=>x);if(y)return{ref:b(y)};const S=u[1].defId??u[1].schema.id??`schema${e.counter++}`;return u[1].defId=S,{defId:S,ref:`${b("__shared")}#/${f}/${S}`}}if(u[1]===o)return{ref:"#"};const h=`#/${f}/`,g=u[1].schema.id??`__schema${e.counter++}`;return{defId:g,ref:h+g}},c=u=>{if(u[1].schema.$ref)return;const f=u[1],{ref:p,defId:h}=l(u);f.def={...f.schema},h&&(f.defId=h);const g=f.schema;for(const y in g)delete g[y];g.$ref=p};if(e.cycles==="throw")for(const u of e.seen.entries()){const f=u[1];if(f.cycle)throw new Error(`Cycle detected: #/${f.cycle?.join("/")}/<root>
|
|
80
80
|
|
|
81
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(n===u[0]){c(u);continue}if(e.external){const h=e.external.registry.get(u[0])?.id;if(n!==u[0]&&h){c(u);continue}}if(e.metadataRegistry.get(u[0])?.id){c(u);continue}if(f.cycle){c(u);continue}if(f.count>1&&e.reused==="ref"){c(u);continue}}}function k1(e,n){const o=e.seen.get(n);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=f=>{const p=e.seen.get(f);if(p.ref===null)return;const h=p.def??p.schema,g={...h},y=p.ref;if(p.ref=null,y){s(y);const S=e.seen.get(y),x=S.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(x)):Object.assign(h,x),Object.assign(h,g),f._zod.parent===y)for(const C in h)C==="$ref"||C==="allOf"||C in g||delete h[C];if(x.$ref&&S.def)for(const C in h)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(h[C])===JSON.stringify(S.def[C])&&delete h[C]}const b=f._zod.parent;if(b&&b!==y){s(b);const S=e.seen.get(b);if(S?.schema.$ref&&(h.$ref=S.schema.$ref,S.def))for(const x in h)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(h[x])===JSON.stringify(S.def[x])&&delete h[x]}e.override({zodSchema:f,jsonSchema:h,path:p.path??[]})};for(const f of[...e.seen.entries()].reverse())s(f[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const f=e.external.registry.get(n)?.id;if(!f)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(f)}Object.assign(l,o.def??o.schema);const c=e.metadataRegistry.get(n)?.id;c!==void 0&&l.id===c&&delete l.id;const u=e.external?.defs??{};for(const f of e.seen.entries()){const p=f[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,u[p.defId]=p.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?l.$defs=u:l.definitions=u);try{const f=JSON.parse(JSON.stringify(l));return Object.defineProperty(f,"~standard",{value:{...n["~standard"],jsonSchema:{input:uu(n,"input",e.processors),output:uu(n,"output",e.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function Qn(e,n){const o=n??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return Qn(s.element,o);if(s.type==="set")return Qn(s.valueType,o);if(s.type==="lazy")return Qn(s.getter(),o);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return Qn(s.innerType,o);if(s.type==="intersection")return Qn(s.left,o)||Qn(s.right,o);if(s.type==="record"||s.type==="map")return Qn(s.keyType,o)||Qn(s.valueType,o);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Qn(s.in,o)||Qn(s.out,o);if(s.type==="object"){for(const l in s.shape)if(Qn(s.shape[l],o))return!0;return!1}if(s.type==="union"){for(const l of s.options)if(Qn(l,o))return!0;return!1}if(s.type==="tuple"){for(const l of s.items)if(Qn(l,o))return!0;return!!(s.rest&&Qn(s.rest,o))}return!1}const oN=(e,n={})=>o=>{const s=z1({...o,processors:n});return kn(e,s),N1(s,e),k1(s,e)},uu=(e,n,o={})=>s=>{const{libraryOptions:l,target:c}=s??{},u=z1({...l??{},target:c,io:n,processors:o});return kn(e,u),N1(u,e),k1(u,e)},iN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sN=(e,n,o,s)=>{const l=o;l.type="string";const{minimum:c,maximum:u,format:f,patterns:p,contentEncoding:h}=e._zod.bag;if(typeof c=="number"&&(l.minLength=c),typeof u=="number"&&(l.maxLength=u),f&&(l.format=iN[f]??f,l.format===""&&delete l.format,f==="time"&&delete l.format),h&&(l.contentEncoding=h),p&&p.size>0){const g=[...p];g.length===1?l.pattern=g[0].source:g.length>1&&(l.allOf=[...g.map(y=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},aN=(e,n,o,s)=>{o.not={}},lN=(e,n,o,s)=>{},cN=(e,n,o,s)=>{const l=e._zod.def,c=r1(l.entries);c.every(u=>typeof u=="number")&&(o.type="number"),c.every(u=>typeof u=="string")&&(o.type="string"),o.enum=c},uN=(e,n,o,s)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fN=(e,n,o,s)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},dN=(e,n,o,s)=>{const l=o,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(l.minItems=u),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=kn(c.element,n,{...s,path:[...s.path,"items"]})},hN=(e,n,o,s)=>{const l=o,c=e._zod.def;l.type="object",l.properties={};const u=c.shape;for(const h in u)l.properties[h]=kn(u[h],n,{...s,path:[...s.path,"properties",h]});const f=new Set(Object.keys(u)),p=new Set([...f].filter(h=>{const g=c.shape[h]._zod;return n.io==="input"?g.optin===void 0:g.optout===void 0}));p.size>0&&(l.required=Array.from(p)),c.catchall?._zod.def.type==="never"?l.additionalProperties=!1:c.catchall?c.catchall&&(l.additionalProperties=kn(c.catchall,n,{...s,path:[...s.path,"additionalProperties"]})):n.io==="output"&&(l.additionalProperties=!1)},pN=(e,n,o,s)=>{const l=e._zod.def,c=l.inclusive===!1,u=l.options.map((f,p)=>kn(f,n,{...s,path:[...s.path,c?"oneOf":"anyOf",p]}));c?o.oneOf=u:o.anyOf=u},mN=(e,n,o,s)=>{const l=e._zod.def,c=kn(l.left,n,{...s,path:[...s.path,"allOf",0]}),u=kn(l.right,n,{...s,path:[...s.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,p=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];o.allOf=p},gN=(e,n,o,s)=>{const l=e._zod.def,c=kn(l.innerType,n,s),u=n.seen.get(e);n.target==="openapi-3.0"?(u.ref=l.innerType,o.nullable=!0):o.anyOf=[c,{type:"null"}]},yN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType},vN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType,o.default=JSON.parse(JSON.stringify(l.defaultValue))},bN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType,n.io==="input"&&(o._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},SN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType;let u;try{u=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=u},wN=(e,n,o,s)=>{const l=e._zod.def,c=l.in._zod.traits.has("$ZodTransform"),u=n.io==="input"?c?l.out:l.in:l.out;kn(u,n,s);const f=n.seen.get(e);f.ref=u},xN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType,o.readOnly=!0},j1=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType},EN=Se("ZodISODateTime",(e,n)=>{jz.init(e,n),nn.init(e,n)});function TN(e){return P6(EN,e)}const CN=Se("ZodISODate",(e,n)=>{Lz.init(e,n),nn.init(e,n)});function RN(e){return I6(CN,e)}const ON=Se("ZodISOTime",(e,n)=>{Pz.init(e,n),nn.init(e,n)});function _N(e){return U6(ON,e)}const AN=Se("ZodISODuration",(e,n)=>{Iz.init(e,n),nn.init(e,n)});function MN(e){return V6(AN,e)}const _r=Se("ZodError",(e,n)=>{u1.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>DD(e,o)},flatten:{value:o=>Wa(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Ah,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Ah,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),DN=kh(_r),zN=jh(_r),NN=ou(_r),kN=iu(_r),jN=kD(_r),LN=jD(_r),PN=LD(_r),IN=PD(_r),UN=ID(_r),VN=UD(_r),HN=VD(_r),FN=HD(_r),L1=new WeakMap;function fu(e,n,o){const s=Object.getPrototypeOf(e);let l=L1.get(s);if(l||(l=new Set,L1.set(s,l)),!l.has(n)){l.add(n);for(const c in o){const u=o[c];Object.defineProperty(s,c,{configurable:!0,enumerable:!1,get(){const f=u.bind(this);return Object.defineProperty(this,c,{configurable:!0,writable:!0,enumerable:!0,value:f}),f},set(f){Object.defineProperty(this,c,{configurable:!0,writable:!0,enumerable:!0,value:f})}})}}}const Sn=Se("ZodType",(e,n)=>(bn.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:uu(e,"input"),output:uu(e,"output")}}),e.toJSONSchema=oN(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(o,s)=>DN(e,o,s,{callee:e.parse}),e.safeParse=(o,s)=>NN(e,o,s),e.parseAsync=async(o,s)=>zN(e,o,s,{callee:e.parseAsync}),e.safeParseAsync=async(o,s)=>kN(e,o,s),e.spa=e.safeParseAsync,e.encode=(o,s)=>jN(e,o,s),e.decode=(o,s)=>LN(e,o,s),e.encodeAsync=async(o,s)=>PN(e,o,s),e.decodeAsync=async(o,s)=>IN(e,o,s),e.safeEncode=(o,s)=>UN(e,o,s),e.safeDecode=(o,s)=>VN(e,o,s),e.safeEncodeAsync=async(o,s)=>HN(e,o,s),e.safeDecodeAsync=async(o,s)=>FN(e,o,s),fu(e,"ZodType",{check(...o){const s=this.def;return this.clone(ni(s,{checks:[...s.checks??[],...o.map(l=>typeof l=="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,s){return ri(this,o,s)},brand(){return this},register(o,s){return o.add(this,s),this},refine(o,s){return this.check(k5(o,s))},superRefine(o,s){return this.check(j5(o,s))},overwrite(o){return this.check(ks(o))},optional(){return H1(this)},exactOptional(){return w5(this)},nullable(){return F1(this)},nullish(){return H1(F1(this))},nonoptional(o){return O5(this,o)},array(){return f5(this)},or(o){return p5([this,o])},and(o){return g5(this,o)},transform(o){return Z1(this,b5(o))},default(o){return T5(this,o)},prefault(o){return R5(this,o)},catch(o){return A5(this,o)},pipe(o){return Z1(this,o)},readonly(){return z5(this)},describe(o){const s=this.clone();return Ja.add(s,{description:o}),s},meta(...o){if(o.length===0)return Ja.get(this);const s=this.clone();return Ja.add(s,o[0]),s},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return Ja.get(e)?.description},configurable:!0}),e)),P1=Se("_ZodString",(e,n)=>{Lh.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(s,l,c)=>sN(e,s,l);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,fu(e,"_ZodString",{regex(...s){return this.check(B6(...s))},includes(...s){return this.check(Y6(...s))},startsWith(...s){return this.check($6(...s))},endsWith(...s){return this.check(q6(...s))},min(...s){return this.check(cu(...s))},max(...s){return this.check(M1(...s))},length(...s){return this.check(D1(...s))},nonempty(...s){return this.check(cu(1,...s))},lowercase(s){return this.check(Z6(s))},uppercase(s){return this.check(G6(s))},trim(){return this.check(Q6())},normalize(...s){return this.check(X6(...s))},toLowerCase(){return this.check(K6())},toUpperCase(){return this.check(W6())},slugify(){return this.check(J6())}})}),BN=Se("ZodString",(e,n)=>{Lh.init(e,n),P1.init(e,n),e.email=o=>e.check(g6(ZN,o)),e.url=o=>e.check(w6(GN,o)),e.jwt=o=>e.check(L6(s5,o)),e.emoji=o=>e.check(x6(YN,o)),e.guid=o=>e.check(A1(I1,o)),e.uuid=o=>e.check(y6(du,o)),e.uuidv4=o=>e.check(v6(du,o)),e.uuidv6=o=>e.check(b6(du,o)),e.uuidv7=o=>e.check(S6(du,o)),e.nanoid=o=>e.check(E6($N,o)),e.guid=o=>e.check(A1(I1,o)),e.cuid=o=>e.check(T6(qN,o)),e.cuid2=o=>e.check(C6(XN,o)),e.ulid=o=>e.check(R6(QN,o)),e.base64=o=>e.check(N6(r5,o)),e.base64url=o=>e.check(k6(o5,o)),e.xid=o=>e.check(O6(KN,o)),e.ksuid=o=>e.check(_6(WN,o)),e.ipv4=o=>e.check(A6(JN,o)),e.ipv6=o=>e.check(M6(e5,o)),e.cidrv4=o=>e.check(D6(t5,o)),e.cidrv6=o=>e.check(z6(n5,o)),e.e164=o=>e.check(j6(i5,o)),e.datetime=o=>e.check(TN(o)),e.date=o=>e.check(RN(o)),e.time=o=>e.check(_N(o)),e.duration=o=>e.check(MN(o))});function js(e){return m6(BN,e)}const nn=Se("ZodStringFormat",(e,n)=>{en.init(e,n),P1.init(e,n)}),ZN=Se("ZodEmail",(e,n)=>{Rz.init(e,n),nn.init(e,n)}),I1=Se("ZodGUID",(e,n)=>{Tz.init(e,n),nn.init(e,n)}),du=Se("ZodUUID",(e,n)=>{Cz.init(e,n),nn.init(e,n)}),GN=Se("ZodURL",(e,n)=>{Oz.init(e,n),nn.init(e,n)}),YN=Se("ZodEmoji",(e,n)=>{_z.init(e,n),nn.init(e,n)}),$N=Se("ZodNanoID",(e,n)=>{Az.init(e,n),nn.init(e,n)}),qN=Se("ZodCUID",(e,n)=>{Mz.init(e,n),nn.init(e,n)}),XN=Se("ZodCUID2",(e,n)=>{Dz.init(e,n),nn.init(e,n)}),QN=Se("ZodULID",(e,n)=>{zz.init(e,n),nn.init(e,n)}),KN=Se("ZodXID",(e,n)=>{Nz.init(e,n),nn.init(e,n)}),WN=Se("ZodKSUID",(e,n)=>{kz.init(e,n),nn.init(e,n)}),JN=Se("ZodIPv4",(e,n)=>{Uz.init(e,n),nn.init(e,n)}),e5=Se("ZodIPv6",(e,n)=>{Vz.init(e,n),nn.init(e,n)}),t5=Se("ZodCIDRv4",(e,n)=>{Hz.init(e,n),nn.init(e,n)}),n5=Se("ZodCIDRv6",(e,n)=>{Fz.init(e,n),nn.init(e,n)}),r5=Se("ZodBase64",(e,n)=>{Bz.init(e,n),nn.init(e,n)}),o5=Se("ZodBase64URL",(e,n)=>{Gz.init(e,n),nn.init(e,n)}),i5=Se("ZodE164",(e,n)=>{Yz.init(e,n),nn.init(e,n)}),s5=Se("ZodJWT",(e,n)=>{qz.init(e,n),nn.init(e,n)}),a5=Se("ZodUnknown",(e,n)=>{Xz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>lN()});function U1(){return H6(a5)}const l5=Se("ZodNever",(e,n)=>{Qz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>aN(e,o,s)});function c5(e){return F6(l5,e)}const u5=Se("ZodArray",(e,n)=>{Kz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>dN(e,o,s,l),e.element=n.element,fu(e,"ZodArray",{min(o,s){return this.check(cu(o,s))},nonempty(o){return this.check(cu(1,o))},max(o,s){return this.check(M1(o,s))},length(o,s){return this.check(D1(o,s))},unwrap(){return this.element}})});function f5(e,n){return eN(u5,e,n)}const d5=Se("ZodObject",(e,n)=>{Jz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>hN(e,o,s,l),Vt(e,"shape",()=>n.shape),fu(e,"ZodObject",{keyof(){return y5(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:U1()})},loose(){return this.clone({...this._zod.def,catchall:U1()})},strict(){return this.clone({...this._zod.def,catchall:c5()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return CD(this,o)},safeExtend(o){return RD(this,o)},merge(o){return OD(this,o)},pick(o){return ED(this,o)},omit(o){return TD(this,o)},partial(...o){return _D(V1,this,o[0])},required(...o){return AD(B1,this,o[0])}})});function Ih(e,n){const o={type:"object",shape:e??{},...it(n)};return new d5(o)}const h5=Se("ZodUnion",(e,n)=>{e6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>pN(e,o,s,l),e.options=n.options});function p5(e,n){return new h5({type:"union",options:e,...it(n)})}const m5=Se("ZodIntersection",(e,n)=>{t6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>mN(e,o,s,l)});function g5(e,n){return new m5({type:"intersection",left:e,right:n})}const Uh=Se("ZodEnum",(e,n)=>{n6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(s,l,c)=>cN(e,s,l),e.enum=n.entries,e.options=Object.values(n.entries);const o=new Set(Object.keys(n.entries));e.extract=(s,l)=>{const c={};for(const u of s)if(o.has(u))c[u]=n.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Uh({...n,checks:[],...it(l),entries:c})},e.exclude=(s,l)=>{const c={...n.entries};for(const u of s)if(o.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new Uh({...n,checks:[],...it(l),entries:c})}});function y5(e,n){const o=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new Uh({type:"enum",entries:o,...it(n)})}const v5=Se("ZodTransform",(e,n)=>{r6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>fN(e,o),e._zod.parse=(o,s)=>{if(s.direction==="backward")throw new n1(e.constructor.name);o.addIssue=c=>{if(typeof c=="string")o.issues.push(Ka(c,o.value,n));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=o.value),u.inst??(u.inst=e),o.issues.push(Ka(u))}};const l=n.transform(o.value,o);return l instanceof Promise?l.then(c=>(o.value=c,o.fallback=!0,o)):(o.value=l,o.fallback=!0,o)}});function b5(e){return new v5({type:"transform",transform:e})}const V1=Se("ZodOptional",(e,n)=>{E1.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>j1(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function H1(e){return new V1({type:"optional",innerType:e})}const S5=Se("ZodExactOptional",(e,n)=>{o6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>j1(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function w5(e){return new S5({type:"optional",innerType:e})}const x5=Se("ZodNullable",(e,n)=>{i6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>gN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function F1(e){return new x5({type:"nullable",innerType:e})}const E5=Se("ZodDefault",(e,n)=>{s6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>vN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function T5(e,n){return new E5({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():a1(n)}})}const C5=Se("ZodPrefault",(e,n)=>{a6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>bN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function R5(e,n){return new C5({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():a1(n)}})}const B1=Se("ZodNonOptional",(e,n)=>{l6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>yN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function O5(e,n){return new B1({type:"nonoptional",innerType:e,...it(n)})}const _5=Se("ZodCatch",(e,n)=>{c6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>SN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function A5(e,n){return new _5({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const M5=Se("ZodPipe",(e,n)=>{u6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>wN(e,o,s,l),e.in=n.in,e.out=n.out});function Z1(e,n){return new M5({type:"pipe",in:e,out:n})}const D5=Se("ZodReadonly",(e,n)=>{f6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>xN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function z5(e){return new D5({type:"readonly",innerType:e})}const N5=Se("ZodCustom",(e,n)=>{d6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>uN(e,o)});function k5(e,n={}){return tN(N5,e,n)}function j5(e,n){return nN(e,n)}const L5=Ih({account:js().min(1,"请输入账号"),password:js().min(1,"请输入密码")});function P5(){const{gameId:e,onAccountLoginSuccess:n,onLoginSuccess:o,onLoginError:s,triggerRealNameAuth:l,defaultAgreeProtocol:c=!1}=wo(),u=v.useRef(null),[f,p]=v.useState(""),[h,g]=v.useState(""),[y,b]=v.useState(!1),[S,x]=v.useState(c),[T,C]=v.useState(!1),[E,L]=v.useState(!1),[j,k]=v.useState({}),{mutate:R,isPending:N}=Vr({mutationFn:()=>B4({account:f,password:h}),onSuccess:P=>{const K={account:P.account,entity:P.channel_info.entity,token:P.channel_info.token,sign:P.channel_info.sign,accid:P.channel_info.entity.openid,extra_data:P.channel_info.extra_data,gaplaySign:P.channel_info.gaplaySign,realname:P.channel_info.realname};if(Ic(K,P._auth,e),K.realname&&K.realname.reject>=2){l();return}n?.(K),o?.(K)},onError:P=>{s?.(P)}});async function z(P){P.preventDefault();const K=new FormData(P.currentTarget),G=L5.safeParse(Object.fromEntries(K));return G.success?S?(R(),{errors:{}}):(L(!0),{errors:{}}):{errors:Wa(G.error).fieldErrors}}return D.jsxs(D.Fragment,{children:[D.jsxs($c,{ref:u,errors:j,onSubmit:async P=>{const K=await z(P);k(K?.errors||{})},className:"space-y-5",children:[D.jsx(io,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:P=>p(P.currentTarget.value),prefix:e==="5327"?D.jsx(U4,{className:"size-5 text-gray-400"}):D.jsx(J4,{className:"size-5 text-gray-400"})}),D.jsx(io,{name:"password",type:y?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:h,onValueChange:P=>g(P),prefix:D.jsx(eD,{className:"size-5 text-gray-400"}),suffix:D.jsx("button",{onClick:()=>b(!y),type:"button",className:"text-gray-400 hover:text-gray-600 focus:outline-none",children:y?D.jsx(Gb,{className:"size-5"}):D.jsx(Zb,{className:"size-5"})})}),D.jsxs("section",{children:[D.jsx("div",{className:"flex justify-end mb-1",children:D.jsx(Ds,{title:"忘记密码",open:T,onOpenChange:C,trigger:D.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:D.jsx(vD,{onClose:()=>C(!1),defaultAccount:f})})}),D.jsx(Xa,{className:"w-full",type:"primary",htmlType:"submit",disabled:N,children:"登录"})]}),D.jsx(Jc,{}),D.jsx(Rh,{checked:S,onChange:x})]}),D.jsx(Wb,{open:E,onOpenChange:L,onAgree:()=>{x(!0),R()}})]})}const Yi={trigger:"_trigger_1e3h3_1",popup:"_popup_1e3h3_5",item:"_item_1e3h3_24",indicator:"_indicator_1e3h3_40",itemText:"_itemText_1e3h3_44",itemCode:"_itemCode_1e3h3_48",itemLabel:"_itemLabel_1e3h3_52"};function I5({value:e,onValueChange:n}){const{gameId:o}=wo(),s=n3(),l=v.useMemo(()=>s.find(u=>u.id===e||u.value===e)?.id||e,[s,e]);return D.jsxs(m4,{value:l,onValueChange:c=>{const u=s.find(f=>f.id===c);u&&n?.(u.value)},children:[D.jsxs(v4,{className:Yi.trigger,children:[D.jsx("span",{children:s.find(c=>c.id===l)?.value}),D.jsx(Bb,{className:"size-4"})]}),D.jsx(S4,{children:D.jsx(T4,{className:"outline-none z-[999]",sideOffset:-4,align:"start",children:D.jsx(R4,{className:Yi.popup,children:s.map(({label:c,value:u,id:f})=>D.jsxs(_4,{value:f,className:Yi.item,children:[D.jsx(A4,{className:Yi.indicator,children:D.jsx(Th,{className:"size-3"})}),D.jsxs(D4,{className:Yi.itemText,children:[D.jsx("span",{className:Yi.itemCode,children:u}),D.jsx("span",{className:Yi.itemLabel,children:c})]})]},f))})})})]})}const G1=Ih({phoneNumber:js().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:js().length(4,"请输入 6 位验证码")});function Y1(){const{mobileLoginConfig:e={},gameId:n,onPhoneLoginSuccess:o,onLoginSuccess:s,onLoginError:l,triggerRealNameAuth:c,defaultAgreeProtocol:u=!1}=wo(),[f,p]=v.useState("86"),[h,g]=v.useState(""),y=v.useRef(null),[b,S]=v.useState(""),[x,T]=v.useState(),[C,E]=v.useState(u),[L,j]=_i.useState({}),[k,R]=v.useState(!1),[N,z]=v.useState(!1),[P,K]=v.useState("login"),[G]=e1({leftTime:x?x*1e3:void 0,interval:1e3,onEnd(){T(void 0)}}),{mutate:q,isPending:te}=Vr({mutationFn:()=>Z4({mobile:h,countryCode:f,type:e.smsType}),onSuccess:O=>{R(!0),T(O.lock_time),Cn.success("验证码已发送,请注意查收")}}),{mutate:ee,isPending:F}=Vr({mutationFn:async()=>{const O=await G4({mobile:h,countryCode:f,captcha:b});T(void 0);const U={account:O.account,entity:O.channel_info.entity,token:O.channel_info.token,sign:O.channel_info.sign,accid:O.channel_info.entity.openid,extra_data:O.channel_info.extra_data,gaplaySign:O.channel_info.gaplaySign,realname:O.channel_info.realname};if(Ic(U,O._auth,n),U.realname&&U.realname.reject>=2){c();return}return o&&await o(U),s?.(U),O},onError:O=>{l?.(O)}});function I(){const O=new FormData(y.current),U=G1.pick({phoneNumber:!0}).safeParse(Object.fromEntries(O));if(!U.success){j(Wa(U.error).fieldErrors);return}if(!C){K("sendCode"),z(!0);return}q()}async function _(O){O.preventDefault();const U=new FormData(O.currentTarget),B=G1.safeParse(Object.fromEntries(U));return B.success?C?(ee(),{errors:{}}):(K("login"),z(!0),{errors:{}}):{errors:Wa(B.error).fieldErrors}}return D.jsxs(D.Fragment,{children:[D.jsxs($c,{ref:y,errors:L,onSubmit:async O=>{const U=await _(O);j(U.errors)},className:"space-y-5",children:[D.jsx(io,{name:"phoneNumber",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:O=>g(O.currentTarget.value),prefix:D.jsx(I5,{value:f,onValueChange:p})}),D.jsx(io,{name:"verificationCode",placeholder:"请输入验证码",value:b,type:"number",onValueChange:O=>{const U=O;S(U),U.length===4&&k&&setTimeout(()=>{y.current?.requestSubmit()},0)},suffix:D.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>I(),disabled:!!x||te,children:te?"发送中...":x?`${Math.round(G/1e3)}s 后重新获取`:"获取验证码"})}),D.jsx(Xa,{className:ln("my-5 w-full",e.buttonClassName),disabled:F,type:"primary",htmlType:"submit",children:F?"登录中...":e.buttonText||"登录"}),D.jsx(Jc,{}),D.jsx(Rh,{checked:C,onChange:E})]}),D.jsx(Wb,{open:N,onOpenChange:z,onAgree:()=>{E(!0),P==="sendCode"?q():ee()}})]})}function U5(e){return D.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[D.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),D.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function V5({children:e,title:n,description:o,content:s,classNames:l={}}){return D.jsxs(WM,{children:[D.jsx(e4,{className:l.trigger,delay:0,children:e}),D.jsxs(n4,{children:[D.jsx(f4,{className:ln("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",l.backdrop)}),D.jsx(r4,{sideOffset:8,className:l.positioner,children:D.jsxs(l4,{className:ln("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",l.popup),children:[D.jsx(c4,{className:ln("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",l.arrow),children:D.jsx(U5,{})}),n&&D.jsx(d4,{className:"text-base font-medium",children:n}),o&&D.jsx(h4,{className:"text-base text-gray-600",children:o}),s]})})]})]})}const $i={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function $1({onUidLoginSuccess:e,customSendUidMailCaptcha:n,customValidateUidMailCaptcha:o}={}){const{gameId:s,autoLoginConfig:l,sceneId:c,onUidLoginSuccess:u,onLoginSuccess:f,onLoginError:p,uidLoginConfig:h={}}=wo(),g=v.useRef(null),[y,b]=v.useState(""),[S,x]=v.useState(""),[T,C]=v.useState(!0),[E,L]=v.useState(!1),[j,{startCountdown:k,resetCountdown:R}]=iD({countStart:120,intervalMs:1e3}),{mutate:N}=Vr({mutationFn:()=>{const G=l.enabled?l.days:void 0;return o?o({gameId:s,captcha:S,expireInDays:T?G:void 0,accountId:y,sceneId:c}):F4({game_id:s,charid:y,captcha_type:"login",captcha:S,expires_day:T?G:void 0,scene_id:c,...h.uidMailExtraParams})},onSuccess:G=>{u?.(G),e?.(G),f?.(G)},onError:G=>{p?.(G)}}),{mutate:z,isPending:P}=Vr({mutationFn:()=>n?n({gameId:s,accountId:y}):H4({game_id:s,captcha_type:"login",charid:y,scene_id:c,...h.uidMailExtraParams}),onSuccess:G=>{k(),Cn.success(G.error)}});async function K(G){G.preventDefault(),N()}return v.useEffect(()=>{S.length===6&&y&&setTimeout(()=>{g.current?.requestSubmit()},0)},[S,y]),v.useEffect(()=>{j===0&&R(),L(j!==120)},[j,R]),D.jsxs($c,{ref:g,onSubmit:K,className:ln("space-y-6",$i.form),autoComplete:"off",children:[["5199","5012"].includes(s)?D.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,D.jsx(io,{name:"accountId",className:ln($i.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:G=>b(G.currentTarget.value),prefix:D.jsx(V5,{content:D.jsx("div",{className:ln($i.uidGet,h.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:ln("rounded-2xl shadow-lg",$i.uidGetPopup),arrow:$i.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:D.jsx("span",{children:"!"})})}),D.jsx(io,{name:"verificationCode",className:ln($i.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入口令码",value:S,type:"tel",onValueChange:G=>x(G),prefix:D.jsx(Ds,{trigger:D.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:D.jsx("div",{className:ln($i.mailCodeGet,h.mailCodeGetterImageClassName)})}),suffix:D.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:G=>{G.preventDefault()},onClick:()=>z(),disabled:E||P||!y,children:E?`${j}s`:P?"发送中...":"发送口令码"})}),l.enabled?D.jsx($a,{name:"rememberLogin",children:D.jsxs(Tb,{className:"flex items-center gap-2 text-gray-500",onMouseDown:G=>{G.preventDefault()},children:[D.jsx(Xv,{checked:T,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:G=>C(!!G),children:D.jsx(Qv,{children:D.jsx(Th,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),D.jsxs("div",{children:[D.jsx("span",{className:"mr-0.5",children:l.days}),D.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(s)?D.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,D.jsx(Jc,{})]})}const Jn={quickLogin:"_quickLogin_1ibz1_1",quickAccounts:"_quickAccounts_1ibz1_5",selectedAccount:"_selectedAccount_1ibz1_9",accountInfo:"_accountInfo_1ibz1_21",accountName:"_accountName_1ibz1_26",arrow:"_arrow_1ibz1_31",arrowRotate:"_arrowRotate_1ibz1_37",accountList:"_accountList_1ibz1_41",listScroll:"_listScroll_1ibz1_49",accountItem:"_accountItem_1ibz1_58",active:"_active_1ibz1_77",itemName:"_itemName_1ibz1_81",itemInfo:"_itemInfo_1ibz1_86",deleteBtn:"_deleteBtn_1ibz1_97"};function H5(){const{gameId:e,onLoginSuccess:n,triggerRealNameAuth:o,setCurrentLoginType:s,defaultLoginType:l}=wo(),[c,u]=v.useState([]),[f,p]=v.useState(null),[h,g]=v.useState(!1),[y,b]=v.useState(!1),[S,x]=v.useState(!1),[T,C]=v.useState(-1);v.useEffect(()=>{E()},[e]);const E=()=>{const N=Cs(e);u(N),N.length>0?(!f||!N.find(z=>z.openid===f.openid))&&p(N[0]):p(null)},L=N=>{p(c[N]),g(!1)},j=(N,z)=>{N.stopPropagation(),C(z),x(!0)},k=()=>{const N=c[T];if(N){gv(N.openid,e);const z=Cs(e);if(z.length===0){s(l);return}u(z),z.find(P=>P.openid===f?.openid)||p(z[0])}x(!1),C(-1)},R=async()=>{if(f){b(!0);try{uv(f.authorization);const N=await $b(),z={account:N.account,entity:N.channel_info.entity,token:N.channel_info.token,sign:N.channel_info.sign,accid:N.channel_info.entity.openid,extra_data:N.channel_info.extra_data,gaplaySign:N.channel_info.gaplaySign,realname:N.channel_info.realname};if(Ic(z,f.authorization,e),z.realname&&z.realname.reject>=2){o();return}n?.(z)}catch(N){Cn.error(N?.detail),console.error("Quick login failed:",N)}finally{b(!1)}}};return c.length===0?null:D.jsxs("div",{className:Jn.quickLogin,children:[D.jsxs("div",{className:Jn.quickAccounts,children:[D.jsxs("div",{className:Jn.selectedAccount,onClick:()=>g(!h),children:[D.jsx("div",{className:Jn.accountInfo,children:D.jsx("span",{className:Jn.accountName,children:f?.username})}),D.jsx(Bb,{className:ln(Jn.arrow,h&&Jn.arrowRotate)})]}),h&&D.jsx("div",{className:Jn.accountList,children:D.jsx("div",{className:Jn.listScroll,children:c.map((N,z)=>D.jsxs("div",{className:ln(Jn.accountItem,N.openid===f?.openid&&Jn.active),onClick:()=>L(z),children:[D.jsx("div",{className:Jn.itemInfo,children:D.jsx("span",{className:Jn.itemName,children:N.username})}),D.jsx("div",{className:Jn.deleteBtn,onClick:P=>j(P,z),children:D.jsx(I4,{className:"size-4 text-gray-400 hover:text-red-500"})})]},N.openid))})})]}),D.jsx(Xn,{className:"w-full h-10 mt-4 mb-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",disabled:y,onClick:R,children:y?"登录中...":"登录"}),D.jsx(Jc,{}),D.jsx(Ds,{open:S,onOpenChange:x,showCloseIcon:!1,classNames:{popup:"w-[300px] p-6"},children:D.jsxs("div",{className:"text-center",children:[D.jsxs("div",{className:"mb-4",children:[D.jsx("p",{className:"text-base font-medium text-gray-900",children:"是否确认删除该条账号登录记录?"}),D.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"删除后登录记录将不会保存。"})]}),D.jsxs("div",{className:"flex gap-3 mt-6",children:[D.jsx(Xn,{className:"flex-1 h-9 border border-gray-300 rounded-full text-gray-600",onClick:()=>x(!1),children:"取消"}),D.jsx(Xn,{className:"flex-1 h-9 bg-gradient-to-r from-[#497efe] to-[#947afa] text-white rounded-full",onClick:k,children:"确认删除"})]})]})})]})}const F5=Ih({name:js().refine(e=>e.length>=1,{error:"请输入真实姓名",abort:!0}).refine(e=>/^[\u4e00-\u9fa5]{2,6}$/.test(e),{error:"姓名须由 2-6 个汉字组成",abort:!0}),idcard:js().refine(e=>e.length>=1,{error:"请输入身份证号",abort:!0}).refine(e=>/^\d{17}(\d|X|x)$/.test(e),{error:"身份证号格式不正确",abort:!0})});function B5(){const{gameId:e,onLoginSuccess:n,onAccountLoginSuccess:o,onPhoneLoginSuccess:s,showRealNameModal:l,setShowRealNameModal:c,onClose:u}=wo(),[f,p]=v.useState({}),{mutate:h,isPending:g}=Vr({mutationFn:async b=>{const x=Cs(e)[0];if(!x)throw new Error("未找到登录账号信息");await Y4({uid:x.uid,authorization:x.authorization,name:b.name,idcard:b.idcard});const T=await $4(x.authorization),C={account:T.account,entity:T.channel_info.entity,token:T.channel_info.token,sign:T.channel_info.sign,accid:T.channel_info.entity.openid,extra_data:T.channel_info.extra_data,gaplaySign:T.channel_info.gaplaySign,realname:T.channel_info.realname};Cn.success("实名认证成功"),c(!1),C.account?.mobile?s?.(C):o?.(C),n?.(C)},onError:b=>{Cn.error(b.message||"实名认证失败")}}),y=b=>{const S=F5.safeParse(b);if(!S.success){p(Wa(S.error).fieldErrors);return}p({}),h(S.data)};return D.jsxs(Ds,{open:l,onOpenChange:c,title:"实名认证",showCloseIcon:!1,disablePointerDismissal:!0,classNames:{popup:"w-[400px] p-6 rounded-2xl",title:"text-center text-xl mb-3"},children:[D.jsx("div",{className:"text-sm text-gray-500 mb-6 text-center",children:"根据《关于防止未成年人沉迷网络游戏的通知》,游戏用户需使用有效身份证进行实名认证。"}),D.jsxs($c,{onFormSubmit:y,errors:f,className:"space-y-4",children:[D.jsxs($a,{name:"name",children:[D.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:D.jsx(wh,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的真实姓名"})}),D.jsx(Sh,{className:"mt-1 ml-2 text-xs text-red-500"})]}),D.jsxs($a,{name:"idcard",children:[D.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:D.jsx(wh,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的身份证号",maxLength:18})}),D.jsx(Sh,{className:"mt-1 ml-2 text-xs text-red-500"})]}),D.jsx(Xn,{type:"submit",className:"w-full h-12 mt-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full font-bold shadow-lg disabled:opacity-50",disabled:g,children:g?"提交中...":"提交认证"}),D.jsx("button",{type:"button",className:"w-full mt-4 text-sm text-gray-400 hover:text-gray-600 transition-colors",onClick:u,children:"退出游戏"})]})]})}const q1={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"},hu={autoLoginHint:"_autoLoginHint_h58ls_1",left:"_left_h58ls_22",loading:"_loading_h58ls_28",switchBtn:"_switchBtn_h58ls_37"};function Z5({onSwitch:e}){const{autoLoginAccountName:n,setIsAutoLoggingIn:o}=wo(),s=()=>{o(!1),e()};return D.jsxs("div",{className:hu.autoLoginHint,children:[D.jsxs("div",{className:hu.left,children:[D.jsx("div",{className:hu.loading}),D.jsxs("span",{children:[n," 正在登录..."]})]}),D.jsx("button",{className:hu.switchBtn,onClick:s,children:"切换账号"})]})}function G5({open:e,onOpenChange:n}){const{gameId:o,loginTypes:s,currentLoginType:l,closeable:c,isShowGiantLogo:u,onLoginSuccess:f,triggerRealNameAuth:p,showRealNameModal:h,setIsAutoLoggingIn:g,setAutoLoginAccountName:y}=wo(),[b,S]=_i.useState(!1),x=_i.useMemo(()=>Cs(o),[o,e]),T=e&&x.length>0&&!b;v.useEffect(()=>{if(!e){S(!1),g(!1);return}if(T){const j=x[0];(async()=>{if(!j){S(!0);return}g(!0),y(j.username);try{uv(j.authorization);const R=await $b(),N={account:R.account,entity:R.channel_info.entity,token:R.channel_info.token,sign:R.channel_info.sign,accid:R.channel_info.entity.openid,extra_data:R.channel_info.extra_data,gaplaySign:R.channel_info.gaplaySign,realname:R.channel_info.realname};if(Ic(N,j.authorization,o),N.realname&&N.realname.reject>=2){g(!1),S(!0),p();return}g(!1),S(!0),n?.(!1),f?.(N)}catch(R){console.error("Auto quick login failed:",R),g(!1),S(!0)}})()}},[e,o,T]);const C=dv({loginTypes:s,gameId:o}),E=hv({loginTypes:s,gameId:o}),L=fv({loginTypes:s,gameId:o});return D.jsxs(D.Fragment,{children:[T&&D.jsx(Z5,{onSwitch:()=>S(!0)}),D.jsxs(Ds,{open:e&&!T&&!h,onOpenChange:n,classNames:{popup:ln("w-[400px] p-5",q1.modal),close:q1.close,backdrop:"!bg-[var(--jssdk-backdrop-bg-color,rgba(0,0,0,0.7))]"},showCloseIcon:c,children:[u&&!KA(o)&&D.jsx("section",{className:"flex items-center justify-center mb-6",children:D.jsx("img",{src:o==="5327"?"https://cdn-imgs.sdk.mobileztgame.com/paycenter/260511150749961295.png":"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),D.jsxs("section",{children:[l==="quick"&&D.jsx(H5,{}),l===Gt.MOBILE&&E&&D.jsx(Y1,{}),l===Gt.ROLE_ID&&C&&D.jsx($1,{}),l===Gt.GIANT&&L&&D.jsx(P5,{})]})]}),D.jsx(B5,{})]})}class Y5 extends v.Component{constructor(n){super(n),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){console.error("[Login SDK] Uncaught error:",n)}render(){return this.state.hasError?null:this.props.children}}function Vh({open:e,onOpenChange:n,sceneId:o,onPhoneLoginSuccess:s,onAccountLoginSuccess:l,onUidLoginSuccess:c,onLoginSuccess:u,onLoginError:f,closeable:p=!0,mountToaster:h=!0,toastConfigs:g,...y}){const[b]=v.useState(()=>new b2);return D.jsxs(_i.StrictMode,{children:[D.jsx(x2,{client:b,children:D.jsx(wv,{value:{sceneId:o,onPhoneLoginSuccess:s,onAccountLoginSuccess:l,onUidLoginSuccess:c,onLoginSuccess:S=>{s3(o3({gameId:Ui(y.gameId),serverUserInfo:S})),u?.(S)},onLoginError:f,closeable:p,onClose:()=>n?.(!1),...y},children:D.jsx(Y5,{children:D.jsx(G5,{open:e,onOpenChange:n})})})}),h&&D.jsx($A,{toastConfigs:g})]})}const X1=e=>Jd(Ui(e)),Q1=e=>i3(Ui(e)),K1=e=>!!Jd(Ui(e));function W1({loginTypes:e,defaultLoginType:n,gameId:o,onLoginSuccess:s,onLoginError:l}){const c=Ui(o);if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const u=document.createElement("div");u.className="login-sdk-container",document.body.appendChild(u);const f=XE.createRoot(u),p=()=>{setTimeout(()=>{f.unmount(),u.remove()},200)},h=()=>{f.render(D.jsx(Vh,{gameId:c,loginTypes:e,defaultLoginType:n,open:!1,onOpenChange:g,onLoginSuccess:s,onLoginError:l})),p()},g=y=>{y||h()};return f.render(D.jsx(Vh,{gameId:c,loginTypes:e,defaultLoginType:n,open:!0,onOpenChange:g,onLoginSuccess:s,onLoginError:l})),{close:h}}const $5={init:vv,login:W1,logout:Q1,getUserInfo:X1,isLoggedIn:K1};Un.ConfigProvider=wv,Un.Login=Vh,Un.MobileLogin=Y1,Un.SDK=$5,Un.UidLogin=$1,Un.getGameId=Ui,Un.getUserInfo=X1,Un.init=vv,Un.isLoggedIn=K1,Un.login=W1,Un.logout=Q1,Object.defineProperty(Un,Symbol.toStringTag,{value:"Module"})}));
|
|
81
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const u of e.seen.entries()){const f=u[1];if(n===u[0]){c(u);continue}if(e.external){const h=e.external.registry.get(u[0])?.id;if(n!==u[0]&&h){c(u);continue}}if(e.metadataRegistry.get(u[0])?.id){c(u);continue}if(f.cycle){c(u);continue}if(f.count>1&&e.reused==="ref"){c(u);continue}}}function k1(e,n){const o=e.seen.get(n);if(!o)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=f=>{const p=e.seen.get(f);if(p.ref===null)return;const h=p.def??p.schema,g={...h},y=p.ref;if(p.ref=null,y){s(y);const S=e.seen.get(y),x=S.schema;if(x.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(h.allOf=h.allOf??[],h.allOf.push(x)):Object.assign(h,x),Object.assign(h,g),f._zod.parent===y)for(const C in h)C==="$ref"||C==="allOf"||C in g||delete h[C];if(x.$ref&&S.def)for(const C in h)C==="$ref"||C==="allOf"||C in S.def&&JSON.stringify(h[C])===JSON.stringify(S.def[C])&&delete h[C]}const b=f._zod.parent;if(b&&b!==y){s(b);const S=e.seen.get(b);if(S?.schema.$ref&&(h.$ref=S.schema.$ref,S.def))for(const x in h)x==="$ref"||x==="allOf"||x in S.def&&JSON.stringify(h[x])===JSON.stringify(S.def[x])&&delete h[x]}e.override({zodSchema:f,jsonSchema:h,path:p.path??[]})};for(const f of[...e.seen.entries()].reverse())s(f[0]);const l={};if(e.target==="draft-2020-12"?l.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?l.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?l.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const f=e.external.registry.get(n)?.id;if(!f)throw new Error("Schema is missing an `id` property");l.$id=e.external.uri(f)}Object.assign(l,o.def??o.schema);const c=e.metadataRegistry.get(n)?.id;c!==void 0&&l.id===c&&delete l.id;const u=e.external?.defs??{};for(const f of e.seen.entries()){const p=f[1];p.def&&p.defId&&(p.def.id===p.defId&&delete p.def.id,u[p.defId]=p.def)}e.external||Object.keys(u).length>0&&(e.target==="draft-2020-12"?l.$defs=u:l.definitions=u);try{const f=JSON.parse(JSON.stringify(l));return Object.defineProperty(f,"~standard",{value:{...n["~standard"],jsonSchema:{input:uu(n,"input",e.processors),output:uu(n,"output",e.processors)}},enumerable:!1,writable:!1}),f}catch{throw new Error("Error converting schema to JSON.")}}function Qn(e,n){const o=n??{seen:new Set};if(o.seen.has(e))return!1;o.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return Qn(s.element,o);if(s.type==="set")return Qn(s.valueType,o);if(s.type==="lazy")return Qn(s.getter(),o);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return Qn(s.innerType,o);if(s.type==="intersection")return Qn(s.left,o)||Qn(s.right,o);if(s.type==="record"||s.type==="map")return Qn(s.keyType,o)||Qn(s.valueType,o);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:Qn(s.in,o)||Qn(s.out,o);if(s.type==="object"){for(const l in s.shape)if(Qn(s.shape[l],o))return!0;return!1}if(s.type==="union"){for(const l of s.options)if(Qn(l,o))return!0;return!1}if(s.type==="tuple"){for(const l of s.items)if(Qn(l,o))return!0;return!!(s.rest&&Qn(s.rest,o))}return!1}const oN=(e,n={})=>o=>{const s=z1({...o,processors:n});return kn(e,s),N1(s,e),k1(s,e)},uu=(e,n,o={})=>s=>{const{libraryOptions:l,target:c}=s??{},u=z1({...l??{},target:c,io:n,processors:o});return kn(e,u),N1(u,e),k1(u,e)},iN={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},sN=(e,n,o,s)=>{const l=o;l.type="string";const{minimum:c,maximum:u,format:f,patterns:p,contentEncoding:h}=e._zod.bag;if(typeof c=="number"&&(l.minLength=c),typeof u=="number"&&(l.maxLength=u),f&&(l.format=iN[f]??f,l.format===""&&delete l.format,f==="time"&&delete l.format),h&&(l.contentEncoding=h),p&&p.size>0){const g=[...p];g.length===1?l.pattern=g[0].source:g.length>1&&(l.allOf=[...g.map(y=>({...n.target==="draft-07"||n.target==="draft-04"||n.target==="openapi-3.0"?{type:"string"}:{},pattern:y.source}))])}},aN=(e,n,o,s)=>{o.not={}},lN=(e,n,o,s)=>{},cN=(e,n,o,s)=>{const l=e._zod.def,c=r1(l.entries);c.every(u=>typeof u=="number")&&(o.type="number"),c.every(u=>typeof u=="string")&&(o.type="string"),o.enum=c},uN=(e,n,o,s)=>{if(n.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},fN=(e,n,o,s)=>{if(n.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},dN=(e,n,o,s)=>{const l=o,c=e._zod.def,{minimum:u,maximum:f}=e._zod.bag;typeof u=="number"&&(l.minItems=u),typeof f=="number"&&(l.maxItems=f),l.type="array",l.items=kn(c.element,n,{...s,path:[...s.path,"items"]})},hN=(e,n,o,s)=>{const l=o,c=e._zod.def;l.type="object",l.properties={};const u=c.shape;for(const h in u)l.properties[h]=kn(u[h],n,{...s,path:[...s.path,"properties",h]});const f=new Set(Object.keys(u)),p=new Set([...f].filter(h=>{const g=c.shape[h]._zod;return n.io==="input"?g.optin===void 0:g.optout===void 0}));p.size>0&&(l.required=Array.from(p)),c.catchall?._zod.def.type==="never"?l.additionalProperties=!1:c.catchall?c.catchall&&(l.additionalProperties=kn(c.catchall,n,{...s,path:[...s.path,"additionalProperties"]})):n.io==="output"&&(l.additionalProperties=!1)},pN=(e,n,o,s)=>{const l=e._zod.def,c=l.inclusive===!1,u=l.options.map((f,p)=>kn(f,n,{...s,path:[...s.path,c?"oneOf":"anyOf",p]}));c?o.oneOf=u:o.anyOf=u},mN=(e,n,o,s)=>{const l=e._zod.def,c=kn(l.left,n,{...s,path:[...s.path,"allOf",0]}),u=kn(l.right,n,{...s,path:[...s.path,"allOf",1]}),f=h=>"allOf"in h&&Object.keys(h).length===1,p=[...f(c)?c.allOf:[c],...f(u)?u.allOf:[u]];o.allOf=p},gN=(e,n,o,s)=>{const l=e._zod.def,c=kn(l.innerType,n,s),u=n.seen.get(e);n.target==="openapi-3.0"?(u.ref=l.innerType,o.nullable=!0):o.anyOf=[c,{type:"null"}]},yN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType},vN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType,o.default=JSON.parse(JSON.stringify(l.defaultValue))},bN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType,n.io==="input"&&(o._prefault=JSON.parse(JSON.stringify(l.defaultValue)))},SN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType;let u;try{u=l.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}o.default=u},wN=(e,n,o,s)=>{const l=e._zod.def,c=l.in._zod.traits.has("$ZodTransform"),u=n.io==="input"?c?l.out:l.in:l.out;kn(u,n,s);const f=n.seen.get(e);f.ref=u},xN=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType,o.readOnly=!0},j1=(e,n,o,s)=>{const l=e._zod.def;kn(l.innerType,n,s);const c=n.seen.get(e);c.ref=l.innerType},EN=Se("ZodISODateTime",(e,n)=>{jz.init(e,n),nn.init(e,n)});function TN(e){return P6(EN,e)}const CN=Se("ZodISODate",(e,n)=>{Lz.init(e,n),nn.init(e,n)});function RN(e){return I6(CN,e)}const ON=Se("ZodISOTime",(e,n)=>{Pz.init(e,n),nn.init(e,n)});function _N(e){return U6(ON,e)}const AN=Se("ZodISODuration",(e,n)=>{Iz.init(e,n),nn.init(e,n)});function MN(e){return V6(AN,e)}const _r=Se("ZodError",(e,n)=>{u1.init(e,n),e.name="ZodError",Object.defineProperties(e,{format:{value:o=>DD(e,o)},flatten:{value:o=>Wa(e,o)},addIssue:{value:o=>{e.issues.push(o),e.message=JSON.stringify(e.issues,Ah,2)}},addIssues:{value:o=>{e.issues.push(...o),e.message=JSON.stringify(e.issues,Ah,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),DN=kh(_r),zN=jh(_r),NN=ou(_r),kN=iu(_r),jN=kD(_r),LN=jD(_r),PN=LD(_r),IN=PD(_r),UN=ID(_r),VN=UD(_r),HN=VD(_r),FN=HD(_r),L1=new WeakMap;function fu(e,n,o){const s=Object.getPrototypeOf(e);let l=L1.get(s);if(l||(l=new Set,L1.set(s,l)),!l.has(n)){l.add(n);for(const c in o){const u=o[c];Object.defineProperty(s,c,{configurable:!0,enumerable:!1,get(){const f=u.bind(this);return Object.defineProperty(this,c,{configurable:!0,writable:!0,enumerable:!0,value:f}),f},set(f){Object.defineProperty(this,c,{configurable:!0,writable:!0,enumerable:!0,value:f})}})}}}const Sn=Se("ZodType",(e,n)=>(bn.init(e,n),Object.assign(e["~standard"],{jsonSchema:{input:uu(e,"input"),output:uu(e,"output")}}),e.toJSONSchema=oN(e,{}),e.def=n,e.type=n.type,Object.defineProperty(e,"_def",{value:n}),e.parse=(o,s)=>DN(e,o,s,{callee:e.parse}),e.safeParse=(o,s)=>NN(e,o,s),e.parseAsync=async(o,s)=>zN(e,o,s,{callee:e.parseAsync}),e.safeParseAsync=async(o,s)=>kN(e,o,s),e.spa=e.safeParseAsync,e.encode=(o,s)=>jN(e,o,s),e.decode=(o,s)=>LN(e,o,s),e.encodeAsync=async(o,s)=>PN(e,o,s),e.decodeAsync=async(o,s)=>IN(e,o,s),e.safeEncode=(o,s)=>UN(e,o,s),e.safeDecode=(o,s)=>VN(e,o,s),e.safeEncodeAsync=async(o,s)=>HN(e,o,s),e.safeDecodeAsync=async(o,s)=>FN(e,o,s),fu(e,"ZodType",{check(...o){const s=this.def;return this.clone(ni(s,{checks:[...s.checks??[],...o.map(l=>typeof l=="function"?{_zod:{check:l,def:{check:"custom"},onattach:[]}}:l)]}),{parent:!0})},with(...o){return this.check(...o)},clone(o,s){return ri(this,o,s)},brand(){return this},register(o,s){return o.add(this,s),this},refine(o,s){return this.check(k5(o,s))},superRefine(o,s){return this.check(j5(o,s))},overwrite(o){return this.check(ks(o))},optional(){return H1(this)},exactOptional(){return w5(this)},nullable(){return F1(this)},nullish(){return H1(F1(this))},nonoptional(o){return O5(this,o)},array(){return f5(this)},or(o){return p5([this,o])},and(o){return g5(this,o)},transform(o){return Z1(this,b5(o))},default(o){return T5(this,o)},prefault(o){return R5(this,o)},catch(o){return A5(this,o)},pipe(o){return Z1(this,o)},readonly(){return z5(this)},describe(o){const s=this.clone();return Ja.add(s,{description:o}),s},meta(...o){if(o.length===0)return Ja.get(this);const s=this.clone();return Ja.add(s,o[0]),s},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(o){return o(this)}}),Object.defineProperty(e,"description",{get(){return Ja.get(e)?.description},configurable:!0}),e)),P1=Se("_ZodString",(e,n)=>{Lh.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(s,l,c)=>sN(e,s,l);const o=e._zod.bag;e.format=o.format??null,e.minLength=o.minimum??null,e.maxLength=o.maximum??null,fu(e,"_ZodString",{regex(...s){return this.check(B6(...s))},includes(...s){return this.check(Y6(...s))},startsWith(...s){return this.check($6(...s))},endsWith(...s){return this.check(q6(...s))},min(...s){return this.check(cu(...s))},max(...s){return this.check(M1(...s))},length(...s){return this.check(D1(...s))},nonempty(...s){return this.check(cu(1,...s))},lowercase(s){return this.check(Z6(s))},uppercase(s){return this.check(G6(s))},trim(){return this.check(Q6())},normalize(...s){return this.check(X6(...s))},toLowerCase(){return this.check(K6())},toUpperCase(){return this.check(W6())},slugify(){return this.check(J6())}})}),BN=Se("ZodString",(e,n)=>{Lh.init(e,n),P1.init(e,n),e.email=o=>e.check(g6(ZN,o)),e.url=o=>e.check(w6(GN,o)),e.jwt=o=>e.check(L6(s5,o)),e.emoji=o=>e.check(x6(YN,o)),e.guid=o=>e.check(A1(I1,o)),e.uuid=o=>e.check(y6(du,o)),e.uuidv4=o=>e.check(v6(du,o)),e.uuidv6=o=>e.check(b6(du,o)),e.uuidv7=o=>e.check(S6(du,o)),e.nanoid=o=>e.check(E6($N,o)),e.guid=o=>e.check(A1(I1,o)),e.cuid=o=>e.check(T6(qN,o)),e.cuid2=o=>e.check(C6(XN,o)),e.ulid=o=>e.check(R6(QN,o)),e.base64=o=>e.check(N6(r5,o)),e.base64url=o=>e.check(k6(o5,o)),e.xid=o=>e.check(O6(KN,o)),e.ksuid=o=>e.check(_6(WN,o)),e.ipv4=o=>e.check(A6(JN,o)),e.ipv6=o=>e.check(M6(e5,o)),e.cidrv4=o=>e.check(D6(t5,o)),e.cidrv6=o=>e.check(z6(n5,o)),e.e164=o=>e.check(j6(i5,o)),e.datetime=o=>e.check(TN(o)),e.date=o=>e.check(RN(o)),e.time=o=>e.check(_N(o)),e.duration=o=>e.check(MN(o))});function js(e){return m6(BN,e)}const nn=Se("ZodStringFormat",(e,n)=>{en.init(e,n),P1.init(e,n)}),ZN=Se("ZodEmail",(e,n)=>{Rz.init(e,n),nn.init(e,n)}),I1=Se("ZodGUID",(e,n)=>{Tz.init(e,n),nn.init(e,n)}),du=Se("ZodUUID",(e,n)=>{Cz.init(e,n),nn.init(e,n)}),GN=Se("ZodURL",(e,n)=>{Oz.init(e,n),nn.init(e,n)}),YN=Se("ZodEmoji",(e,n)=>{_z.init(e,n),nn.init(e,n)}),$N=Se("ZodNanoID",(e,n)=>{Az.init(e,n),nn.init(e,n)}),qN=Se("ZodCUID",(e,n)=>{Mz.init(e,n),nn.init(e,n)}),XN=Se("ZodCUID2",(e,n)=>{Dz.init(e,n),nn.init(e,n)}),QN=Se("ZodULID",(e,n)=>{zz.init(e,n),nn.init(e,n)}),KN=Se("ZodXID",(e,n)=>{Nz.init(e,n),nn.init(e,n)}),WN=Se("ZodKSUID",(e,n)=>{kz.init(e,n),nn.init(e,n)}),JN=Se("ZodIPv4",(e,n)=>{Uz.init(e,n),nn.init(e,n)}),e5=Se("ZodIPv6",(e,n)=>{Vz.init(e,n),nn.init(e,n)}),t5=Se("ZodCIDRv4",(e,n)=>{Hz.init(e,n),nn.init(e,n)}),n5=Se("ZodCIDRv6",(e,n)=>{Fz.init(e,n),nn.init(e,n)}),r5=Se("ZodBase64",(e,n)=>{Bz.init(e,n),nn.init(e,n)}),o5=Se("ZodBase64URL",(e,n)=>{Gz.init(e,n),nn.init(e,n)}),i5=Se("ZodE164",(e,n)=>{Yz.init(e,n),nn.init(e,n)}),s5=Se("ZodJWT",(e,n)=>{qz.init(e,n),nn.init(e,n)}),a5=Se("ZodUnknown",(e,n)=>{Xz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>lN()});function U1(){return H6(a5)}const l5=Se("ZodNever",(e,n)=>{Qz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>aN(e,o,s)});function c5(e){return F6(l5,e)}const u5=Se("ZodArray",(e,n)=>{Kz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>dN(e,o,s,l),e.element=n.element,fu(e,"ZodArray",{min(o,s){return this.check(cu(o,s))},nonempty(o){return this.check(cu(1,o))},max(o,s){return this.check(M1(o,s))},length(o,s){return this.check(D1(o,s))},unwrap(){return this.element}})});function f5(e,n){return eN(u5,e,n)}const d5=Se("ZodObject",(e,n)=>{Jz.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>hN(e,o,s,l),Vt(e,"shape",()=>n.shape),fu(e,"ZodObject",{keyof(){return y5(Object.keys(this._zod.def.shape))},catchall(o){return this.clone({...this._zod.def,catchall:o})},passthrough(){return this.clone({...this._zod.def,catchall:U1()})},loose(){return this.clone({...this._zod.def,catchall:U1()})},strict(){return this.clone({...this._zod.def,catchall:c5()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(o){return CD(this,o)},safeExtend(o){return RD(this,o)},merge(o){return OD(this,o)},pick(o){return ED(this,o)},omit(o){return TD(this,o)},partial(...o){return _D(V1,this,o[0])},required(...o){return AD(B1,this,o[0])}})});function Ih(e,n){const o={type:"object",shape:e??{},...it(n)};return new d5(o)}const h5=Se("ZodUnion",(e,n)=>{e6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>pN(e,o,s,l),e.options=n.options});function p5(e,n){return new h5({type:"union",options:e,...it(n)})}const m5=Se("ZodIntersection",(e,n)=>{t6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>mN(e,o,s,l)});function g5(e,n){return new m5({type:"intersection",left:e,right:n})}const Uh=Se("ZodEnum",(e,n)=>{n6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(s,l,c)=>cN(e,s,l),e.enum=n.entries,e.options=Object.values(n.entries);const o=new Set(Object.keys(n.entries));e.extract=(s,l)=>{const c={};for(const u of s)if(o.has(u))c[u]=n.entries[u];else throw new Error(`Key ${u} not found in enum`);return new Uh({...n,checks:[],...it(l),entries:c})},e.exclude=(s,l)=>{const c={...n.entries};for(const u of s)if(o.has(u))delete c[u];else throw new Error(`Key ${u} not found in enum`);return new Uh({...n,checks:[],...it(l),entries:c})}});function y5(e,n){const o=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new Uh({type:"enum",entries:o,...it(n)})}const v5=Se("ZodTransform",(e,n)=>{r6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>fN(e,o),e._zod.parse=(o,s)=>{if(s.direction==="backward")throw new n1(e.constructor.name);o.addIssue=c=>{if(typeof c=="string")o.issues.push(Ka(c,o.value,n));else{const u=c;u.fatal&&(u.continue=!1),u.code??(u.code="custom"),u.input??(u.input=o.value),u.inst??(u.inst=e),o.issues.push(Ka(u))}};const l=n.transform(o.value,o);return l instanceof Promise?l.then(c=>(o.value=c,o.fallback=!0,o)):(o.value=l,o.fallback=!0,o)}});function b5(e){return new v5({type:"transform",transform:e})}const V1=Se("ZodOptional",(e,n)=>{E1.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>j1(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function H1(e){return new V1({type:"optional",innerType:e})}const S5=Se("ZodExactOptional",(e,n)=>{o6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>j1(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function w5(e){return new S5({type:"optional",innerType:e})}const x5=Se("ZodNullable",(e,n)=>{i6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>gN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function F1(e){return new x5({type:"nullable",innerType:e})}const E5=Se("ZodDefault",(e,n)=>{s6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>vN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function T5(e,n){return new E5({type:"default",innerType:e,get defaultValue(){return typeof n=="function"?n():a1(n)}})}const C5=Se("ZodPrefault",(e,n)=>{a6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>bN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function R5(e,n){return new C5({type:"prefault",innerType:e,get defaultValue(){return typeof n=="function"?n():a1(n)}})}const B1=Se("ZodNonOptional",(e,n)=>{l6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>yN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function O5(e,n){return new B1({type:"nonoptional",innerType:e,...it(n)})}const _5=Se("ZodCatch",(e,n)=>{c6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>SN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function A5(e,n){return new _5({type:"catch",innerType:e,catchValue:typeof n=="function"?n:()=>n})}const M5=Se("ZodPipe",(e,n)=>{u6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>wN(e,o,s,l),e.in=n.in,e.out=n.out});function Z1(e,n){return new M5({type:"pipe",in:e,out:n})}const D5=Se("ZodReadonly",(e,n)=>{f6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>xN(e,o,s,l),e.unwrap=()=>e._zod.def.innerType});function z5(e){return new D5({type:"readonly",innerType:e})}const N5=Se("ZodCustom",(e,n)=>{d6.init(e,n),Sn.init(e,n),e._zod.processJSONSchema=(o,s,l)=>uN(e,o)});function k5(e,n={}){return tN(N5,e,n)}function j5(e,n){return nN(e,n)}const L5=Ih({account:js().min(1,"请输入账号"),password:js().min(1,"请输入密码")});function P5(){const{gameId:e,onAccountLoginSuccess:n,onLoginSuccess:o,onLoginError:s,triggerRealNameAuth:l,defaultAgreeProtocol:c=!1}=wo(),u=v.useRef(null),[f,p]=v.useState(""),[h,g]=v.useState(""),[y,b]=v.useState(!1),[S,x]=v.useState(c),[T,C]=v.useState(!1),[E,L]=v.useState(!1),[j,k]=v.useState({}),{mutate:R,isPending:N}=Vr({mutationFn:()=>B4({account:f,password:h}),onSuccess:P=>{const K={account:P.account,entity:P.channel_info.entity,token:P.channel_info.token,sign:P.channel_info.sign,accid:P.channel_info.entity.openid,extra_data:P.channel_info.extra_data,gaplaySign:P.channel_info.gaplaySign,realname:P.channel_info.realname};if(Ic(K,P._auth,e),K.realname&&K.realname.reject>=2){l();return}n?.(K),o?.(K)},onError:P=>{s?.(P)}});async function z(P){P.preventDefault();const K=new FormData(P.currentTarget),G=L5.safeParse(Object.fromEntries(K));return G.success?S?(R(),{errors:{}}):(L(!0),{errors:{}}):{errors:Wa(G.error).fieldErrors}}return D.jsxs(D.Fragment,{children:[D.jsxs($c,{ref:u,errors:j,onSubmit:async P=>{const K=await z(P);k(K?.errors||{})},className:"space-y-5",children:[D.jsx(io,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:P=>p(P.currentTarget.value),prefix:e==="5327"?D.jsx(U4,{className:"size-5 text-gray-400"}):D.jsx(J4,{className:"size-5 text-gray-400"})}),D.jsx(io,{name:"password",type:y?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:h,onValueChange:P=>g(P),prefix:D.jsx(eD,{className:"size-5 text-gray-400"}),suffix:D.jsx("button",{onClick:()=>b(!y),type:"button",className:"text-gray-400 hover:text-gray-600 focus:outline-none",children:y?D.jsx(Gb,{className:"size-5"}):D.jsx(Zb,{className:"size-5"})})}),D.jsxs("section",{children:[D.jsx("div",{className:"flex justify-end mb-1",children:D.jsx(Ds,{title:"忘记密码",open:T,onOpenChange:C,trigger:D.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:D.jsx(vD,{onClose:()=>C(!1),defaultAccount:f})})}),D.jsx(Xa,{className:"w-full",type:"primary",htmlType:"submit",disabled:N,children:"登录"})]}),D.jsx(Jc,{}),D.jsx(Rh,{checked:S,onChange:x})]}),D.jsx(Wb,{open:E,onOpenChange:L,onAgree:()=>{x(!0),R()}})]})}const Yi={trigger:"_trigger_1e3h3_1",popup:"_popup_1e3h3_5",item:"_item_1e3h3_24",indicator:"_indicator_1e3h3_40",itemText:"_itemText_1e3h3_44",itemCode:"_itemCode_1e3h3_48",itemLabel:"_itemLabel_1e3h3_52"};function I5({value:e,onValueChange:n}){const{gameId:o}=wo(),s=n3(),l=v.useMemo(()=>s.find(u=>u.id===e||u.value===e)?.id||e,[s,e]);return D.jsxs(m4,{value:l,onValueChange:c=>{const u=s.find(f=>f.id===c);u&&n?.(u.value)},children:[D.jsxs(v4,{className:Yi.trigger,children:[D.jsx("span",{children:s.find(c=>c.id===l)?.value}),D.jsx(Bb,{className:"size-4"})]}),D.jsx(S4,{children:D.jsx(T4,{className:"outline-none z-[999]",sideOffset:-4,align:"start",children:D.jsx(R4,{className:Yi.popup,children:s.map(({label:c,value:u,id:f})=>D.jsxs(_4,{value:f,className:Yi.item,children:[D.jsx(A4,{className:Yi.indicator,children:D.jsx(Th,{className:"size-3"})}),D.jsxs(D4,{className:Yi.itemText,children:[D.jsx("span",{className:Yi.itemCode,children:u}),D.jsx("span",{className:Yi.itemLabel,children:c})]})]},f))})})})]})}const G1=Ih({phoneNumber:js().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:js().length(4,"请输入 6 位验证码")});function Y1(){const{mobileLoginConfig:e={},gameId:n,onPhoneLoginSuccess:o,onLoginSuccess:s,onLoginError:l,triggerRealNameAuth:c,defaultAgreeProtocol:u=!1}=wo(),[f,p]=v.useState("86"),[h,g]=v.useState(""),y=v.useRef(null),[b,S]=v.useState(""),[x,T]=v.useState(),[C,E]=v.useState(u),[L,j]=_i.useState({}),[k,R]=v.useState(!1),[N,z]=v.useState(!1),[P,K]=v.useState("login"),[G]=e1({leftTime:x?x*1e3:void 0,interval:1e3,onEnd(){T(void 0)}}),{mutate:q,isPending:te}=Vr({mutationFn:()=>Z4({mobile:h,countryCode:f,type:e.smsType}),onSuccess:O=>{R(!0),T(O.lock_time),Cn.success("验证码已发送,请注意查收")}}),{mutate:ee,isPending:F}=Vr({mutationFn:async()=>{const O=await G4({mobile:h,countryCode:f,captcha:b});T(void 0);const U={account:O.account,entity:O.channel_info.entity,token:O.channel_info.token,sign:O.channel_info.sign,accid:O.channel_info.entity.openid,extra_data:O.channel_info.extra_data,gaplaySign:O.channel_info.gaplaySign,realname:O.channel_info.realname};if(Ic(U,O._auth,n),U.realname&&U.realname.reject>=2){c();return}return o&&await o(U),s?.(U),O},onError:O=>{l?.(O)}});function I(){const O=new FormData(y.current),U=G1.pick({phoneNumber:!0}).safeParse(Object.fromEntries(O));if(!U.success){j(Wa(U.error).fieldErrors);return}if(!C){K("sendCode"),z(!0);return}q()}async function _(O){O.preventDefault();const U=new FormData(O.currentTarget),B=G1.safeParse(Object.fromEntries(U));return B.success?C?(ee(),{errors:{}}):(K("login"),z(!0),{errors:{}}):{errors:Wa(B.error).fieldErrors}}return D.jsxs(D.Fragment,{children:[D.jsxs($c,{ref:y,errors:L,onSubmit:async O=>{const U=await _(O);j(U.errors)},className:"space-y-5",children:[D.jsx(io,{name:"phoneNumber",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:O=>g(O.currentTarget.value),prefix:D.jsx(I5,{value:f,onValueChange:p})}),D.jsx(io,{name:"verificationCode",placeholder:"请输入验证码",value:b,type:"number",onValueChange:O=>{const U=O;S(U),U.length===4&&k&&setTimeout(()=>{y.current?.requestSubmit()},0)},suffix:D.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>I(),disabled:!!x||te,children:te?"发送中...":x?`${Math.round(G/1e3)}s 后重新获取`:"获取验证码"})}),D.jsx(Xa,{className:ln("my-5 w-full",e.buttonClassName),disabled:F,type:"primary",htmlType:"submit",children:F?"登录中...":e.buttonText||"登录"}),D.jsx(Jc,{}),D.jsx(Rh,{checked:C,onChange:E})]}),D.jsx(Wb,{open:N,onOpenChange:z,onAgree:()=>{E(!0),P==="sendCode"?q():ee()}})]})}function U5(e){return D.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[D.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),D.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function V5({children:e,title:n,description:o,content:s,classNames:l={}}){return D.jsxs(WM,{children:[D.jsx(e4,{className:l.trigger,delay:0,children:e}),D.jsxs(n4,{children:[D.jsx(f4,{className:ln("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",l.backdrop)}),D.jsx(r4,{sideOffset:8,className:l.positioner,children:D.jsxs(l4,{className:ln("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",l.popup),children:[D.jsx(c4,{className:ln("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",l.arrow),children:D.jsx(U5,{})}),n&&D.jsx(d4,{className:"text-base font-medium",children:n}),o&&D.jsx(h4,{className:"text-base text-gray-600",children:o}),s]})})]})]})}const $i={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function $1({onUidLoginSuccess:e,customSendUidMailCaptcha:n,customValidateUidMailCaptcha:o}={}){const{gameId:s,autoLoginConfig:l,sceneId:c,onUidLoginSuccess:u,onLoginSuccess:f,onLoginError:p,uidLoginConfig:h={}}=wo(),g=v.useRef(null),[y,b]=v.useState(""),[S,x]=v.useState(""),[T,C]=v.useState(!0),[E,L]=v.useState(!1),[j,{startCountdown:k,resetCountdown:R}]=iD({countStart:120,intervalMs:1e3}),{mutate:N}=Vr({mutationFn:()=>{const G=l.enabled?l.days:void 0;return o?o({gameId:s,captcha:S,expireInDays:T?G:void 0,accountId:y,sceneId:c}):F4({game_id:s,charid:y,captcha_type:"login",captcha:S,expires_day:T?G:void 0,scene_id:c,...h.uidMailExtraParams})},onSuccess:G=>{u?.(G),e?.(G),f?.(G)},onError:G=>{p?.(G)}}),{mutate:z,isPending:P}=Vr({mutationFn:()=>n?n({gameId:s,accountId:y}):H4({game_id:s,captcha_type:"login",charid:y,scene_id:c,...h.uidMailExtraParams}),onSuccess:G=>{k(),Cn.success(G.error)}});async function K(G){G.preventDefault(),N()}return v.useEffect(()=>{S.length===6&&y&&setTimeout(()=>{g.current?.requestSubmit()},0)},[S,y]),v.useEffect(()=>{j===0&&R(),L(j!==120)},[j,R]),D.jsxs($c,{ref:g,onSubmit:K,className:ln("space-y-6",$i.form),autoComplete:"off",children:[["5199","5012"].includes(s)?D.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,D.jsx(io,{name:"accountId",className:ln($i.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:G=>b(G.currentTarget.value),prefix:D.jsx(V5,{content:D.jsx("div",{className:ln($i.uidGet,h.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:ln("rounded-2xl shadow-lg",$i.uidGetPopup),arrow:$i.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:D.jsx("span",{children:"!"})})}),D.jsx(io,{name:"verificationCode",className:ln($i.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入口令码",value:S,type:"tel",onValueChange:G=>x(G),prefix:D.jsx(Ds,{trigger:D.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:D.jsx("div",{className:ln($i.mailCodeGet,h.mailCodeGetterImageClassName)})}),suffix:D.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:G=>{G.preventDefault()},onClick:()=>z(),disabled:E||P||!y,children:E?`${j}s`:P?"发送中...":"发送口令码"})}),l.enabled?D.jsx($a,{name:"rememberLogin",children:D.jsxs(Tb,{className:"flex items-center gap-2 text-gray-500",onMouseDown:G=>{G.preventDefault()},children:[D.jsx(Xv,{checked:T,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:G=>C(!!G),children:D.jsx(Qv,{children:D.jsx(Th,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),D.jsxs("div",{children:[D.jsx("span",{className:"mr-0.5",children:l.days}),D.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(s)?D.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,D.jsx(Jc,{})]})}const Jn={quickLogin:"_quickLogin_1ibz1_1",quickAccounts:"_quickAccounts_1ibz1_5",selectedAccount:"_selectedAccount_1ibz1_9",accountInfo:"_accountInfo_1ibz1_21",accountName:"_accountName_1ibz1_26",arrow:"_arrow_1ibz1_31",arrowRotate:"_arrowRotate_1ibz1_37",accountList:"_accountList_1ibz1_41",listScroll:"_listScroll_1ibz1_49",accountItem:"_accountItem_1ibz1_58",active:"_active_1ibz1_77",itemName:"_itemName_1ibz1_81",itemInfo:"_itemInfo_1ibz1_86",deleteBtn:"_deleteBtn_1ibz1_97"};function H5(){const{gameId:e,onLoginSuccess:n,triggerRealNameAuth:o,setCurrentLoginType:s,defaultLoginType:l}=wo(),[c,u]=v.useState([]),[f,p]=v.useState(null),[h,g]=v.useState(!1),[y,b]=v.useState(!1),[S,x]=v.useState(!1),[T,C]=v.useState(-1);v.useEffect(()=>{E()},[e]);const E=()=>{const N=Cs(e);u(N),N.length>0?(!f||!N.find(z=>z.openid===f.openid))&&p(N[0]):p(null)},L=N=>{p(c[N]),g(!1)},j=(N,z)=>{N.stopPropagation(),C(z),x(!0)},k=()=>{const N=c[T];if(N){gv(N.openid,e);const z=Cs(e);if(z.length===0){s(l);return}u(z),z.find(P=>P.openid===f?.openid)||p(z[0])}x(!1),C(-1)},R=async()=>{if(f){b(!0);try{uv(f.authorization);const N=await $b(),z={account:N.account,entity:N.channel_info.entity,token:N.channel_info.token,sign:N.channel_info.sign,accid:N.channel_info.entity.openid,extra_data:N.channel_info.extra_data,gaplaySign:N.channel_info.gaplaySign,realname:N.channel_info.realname};if(Ic(z,f.authorization,e),z.realname&&z.realname.reject>=2){o();return}n?.(z)}catch(N){Cn.error(N?.detail),console.error("Quick login failed:",N)}finally{b(!1)}}};return c.length===0?null:D.jsxs("div",{className:Jn.quickLogin,children:[D.jsxs("div",{className:Jn.quickAccounts,children:[D.jsxs("div",{className:Jn.selectedAccount,onClick:()=>g(!h),children:[D.jsx("div",{className:Jn.accountInfo,children:D.jsx("span",{className:Jn.accountName,children:f?.username})}),D.jsx(Bb,{className:ln(Jn.arrow,h&&Jn.arrowRotate)})]}),h&&D.jsx("div",{className:Jn.accountList,children:D.jsx("div",{className:Jn.listScroll,children:c.map((N,z)=>D.jsxs("div",{className:ln(Jn.accountItem,N.openid===f?.openid&&Jn.active),onClick:()=>L(z),children:[D.jsx("div",{className:Jn.itemInfo,children:D.jsx("span",{className:Jn.itemName,children:N.username})}),D.jsx("div",{className:Jn.deleteBtn,onClick:P=>j(P,z),children:D.jsx(I4,{className:"size-4 text-gray-400 hover:text-red-500"})})]},N.openid))})})]}),D.jsx(Xn,{className:"w-full h-10 mt-4 mb-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",disabled:y,onClick:R,children:y?"登录中...":"登录"}),D.jsx(Jc,{}),D.jsx(Ds,{open:S,onOpenChange:x,showCloseIcon:!1,classNames:{popup:"w-[300px] p-6"},children:D.jsxs("div",{className:"text-center",children:[D.jsxs("div",{className:"mb-4",children:[D.jsx("p",{className:"text-base font-medium text-gray-900",children:"是否确认删除该条账号登录记录?"}),D.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"删除后登录记录将不会保存。"})]}),D.jsxs("div",{className:"flex gap-3 mt-6",children:[D.jsx(Xn,{className:"flex-1 h-9 border border-gray-300 rounded-full text-gray-600",onClick:()=>x(!1),children:"取消"}),D.jsx(Xn,{className:"flex-1 h-9 bg-gradient-to-r from-[#497efe] to-[#947afa] text-white rounded-full",onClick:k,children:"确认删除"})]})]})})]})}const F5=Ih({name:js().refine(e=>e.length>=1,{error:"请输入真实姓名",abort:!0}).refine(e=>/^[\u4e00-\u9fa5]{2,6}$/.test(e),{error:"姓名须由 2-6 个汉字组成",abort:!0}),idcard:js().refine(e=>e.length>=1,{error:"请输入身份证号",abort:!0}).refine(e=>/^\d{17}(\d|X|x)$/.test(e),{error:"身份证号格式不正确",abort:!0})});function B5(){const{gameId:e,onLoginSuccess:n,onAccountLoginSuccess:o,onPhoneLoginSuccess:s,showRealNameModal:l,setShowRealNameModal:c,onClose:u}=wo(),[f,p]=v.useState({}),{mutate:h,isPending:g}=Vr({mutationFn:async b=>{const x=Cs(e)[0];if(!x)throw new Error("未找到登录账号信息");await Y4({uid:x.uid,authorization:x.authorization,name:b.name,idcard:b.idcard});const T=await $4(x.authorization),C={account:T.account,entity:T.channel_info.entity,token:T.channel_info.token,sign:T.channel_info.sign,accid:T.channel_info.entity.openid,extra_data:T.channel_info.extra_data,gaplaySign:T.channel_info.gaplaySign,realname:T.channel_info.realname};Cn.success("实名认证成功"),c(!1),C.account?.mobile?s?.(C):o?.(C),n?.(C)},onError:b=>{Cn.error(b.message||"实名认证失败")}}),y=b=>{const S=F5.safeParse(b);if(!S.success){p(Wa(S.error).fieldErrors);return}p({}),h(S.data)};return D.jsxs(Ds,{open:l,onOpenChange:c,title:"实名认证",showCloseIcon:!1,disablePointerDismissal:!0,classNames:{popup:"w-[400px] p-6 rounded-2xl",title:"text-center text-xl mb-3"},children:[D.jsx("div",{className:"text-sm text-gray-500 mb-6 text-center",children:"根据《关于防止未成年人沉迷网络游戏的通知》,游戏用户需使用有效身份证进行实名认证。"}),D.jsxs($c,{onFormSubmit:y,errors:f,className:"space-y-4",children:[D.jsxs($a,{name:"name",children:[D.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:D.jsx(wh,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的真实姓名"})}),D.jsx(Sh,{className:"mt-1 ml-2 text-xs text-red-500"})]}),D.jsxs($a,{name:"idcard",children:[D.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:D.jsx(wh,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的身份证号",maxLength:18})}),D.jsx(Sh,{className:"mt-1 ml-2 text-xs text-red-500"})]}),D.jsx(Xn,{type:"submit",className:"w-full h-12 mt-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full font-bold shadow-lg disabled:opacity-50",disabled:g,children:g?"提交中...":"提交认证"}),D.jsx("button",{type:"button",className:"w-full mt-4 text-sm text-gray-400 hover:text-gray-600 transition-colors",onClick:u,children:"退出游戏"})]})]})}const q1={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"},hu={autoLoginHint:"_autoLoginHint_h58ls_1",left:"_left_h58ls_22",loading:"_loading_h58ls_28",switchBtn:"_switchBtn_h58ls_37"};function Z5({onSwitch:e}){const{autoLoginAccountName:n,setIsAutoLoggingIn:o}=wo(),s=()=>{o(!1),e()};return D.jsxs("div",{className:hu.autoLoginHint,children:[D.jsxs("div",{className:hu.left,children:[D.jsx("div",{className:hu.loading}),D.jsxs("span",{children:[n," 正在登录..."]})]}),D.jsx("button",{className:hu.switchBtn,onClick:s,children:"切换账号"})]})}function G5({open:e,onOpenChange:n}){const{gameId:o,loginTypes:s,currentLoginType:l,closeable:c,isShowGiantLogo:u,onLoginSuccess:f,triggerRealNameAuth:p,showRealNameModal:h,setIsAutoLoggingIn:g,setAutoLoginAccountName:y}=wo(),[b,S]=_i.useState(!1),x=_i.useMemo(()=>Cs(o),[o,e]),T=e&&x.length>0&&!b;v.useEffect(()=>{if(!e){S(!1),g(!1);return}if(T){const j=x[0];(async()=>{if(!j){S(!0);return}g(!0),y(j.username);try{uv(j.authorization);const R=await $b(),N={account:R.account,entity:R.channel_info.entity,token:R.channel_info.token,sign:R.channel_info.sign,accid:R.channel_info.entity.openid,extra_data:R.channel_info.extra_data,gaplaySign:R.channel_info.gaplaySign,realname:R.channel_info.realname};if(Ic(N,j.authorization,o),N.realname&&N.realname.reject>=2){g(!1),S(!0),p();return}g(!1),S(!0),n?.(!1),f?.(N)}catch(R){console.error("Auto quick login failed:",R),g(!1),S(!0)}})()}},[e,o,T]);const C=dv({loginTypes:s,gameId:o}),E=hv({loginTypes:s,gameId:o}),L=fv({loginTypes:s,gameId:o});return D.jsxs(D.Fragment,{children:[T&&D.jsx(Z5,{onSwitch:()=>S(!0)}),D.jsxs(Ds,{open:e&&!T&&!h,onOpenChange:n,classNames:{popup:ln("w-[400px] p-5",q1.modal),close:q1.close,backdrop:"!bg-[var(--jssdk-backdrop-bg-color,rgba(0,0,0,0.7))]"},showCloseIcon:c,children:[u&&!KA(o)&&D.jsx("section",{className:"flex items-center justify-center mb-6",children:D.jsx("img",{src:o==="5327"?"https://cdn-imgs.sdk.mobileztgame.com/paycenter/260511150749961295.png":"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),D.jsxs("section",{children:[l==="quick"&&D.jsx(H5,{}),l===Gt.MOBILE&&E&&D.jsx(Y1,{}),l===Gt.ROLE_ID&&C&&D.jsx($1,{}),l===Gt.GIANT&&L&&D.jsx(P5,{})]})]}),D.jsx(B5,{})]})}class Y5 extends v.Component{constructor(n){super(n),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(n){console.error("[Login SDK] Uncaught error:",n)}render(){return this.state.hasError?null:this.props.children}}function Vh({open:e,onOpenChange:n,sceneId:o,onPhoneLoginSuccess:s,onAccountLoginSuccess:l,onUidLoginSuccess:c,onLoginSuccess:u,onLoginError:f,closeable:p=!0,mountToaster:h=!0,toastConfigs:g,...y}){const[b]=v.useState(()=>new b2);return D.jsxs(_i.StrictMode,{children:[D.jsx(x2,{client:b,children:D.jsx(wv,{value:{sceneId:o,onPhoneLoginSuccess:s,onAccountLoginSuccess:l,onUidLoginSuccess:c,onLoginSuccess:S=>{s3(o3({gameId:Ui(y.gameId),serverUserInfo:S})),u?.(S)},onLoginError:f,closeable:p,onClose:()=>n?.(!1),...y},children:D.jsx(Y5,{children:D.jsx(G5,{open:e,onOpenChange:n})})})}),h&&D.jsx($A,{toastConfigs:g})]})}const X1=e=>Jd(Ui(e)),Q1=e=>i3(Ui(e)),K1=e=>!!Jd(Ui(e));function W1({loginTypes:e,defaultLoginType:n,gameId:o,styleVars:s,onLoginSuccess:l,onLoginError:c}){const u=Ui(o);if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const f=document.createElement("div");f.className="login-sdk-container",document.body.appendChild(f);const p=XE.createRoot(f),h=()=>{setTimeout(()=>{p.unmount(),f.remove()},200)},g=()=>{p.render(D.jsx(Vh,{gameId:u,loginTypes:e,defaultLoginType:n,styleVars:s,open:!1,onOpenChange:y,onLoginSuccess:l,onLoginError:c})),h()},y=b=>{b||g()};return p.render(D.jsx(Vh,{gameId:u,loginTypes:e,defaultLoginType:n,styleVars:s,open:!0,onOpenChange:y,onLoginSuccess:l,onLoginError:c})),{close:g}}const $5={init:vv,login:W1,logout:Q1,getUserInfo:X1,isLoggedIn:K1};Un.ConfigProvider=wv,Un.Login=Vh,Un.MobileLogin=Y1,Un.SDK=$5,Un.UidLogin=$1,Un.getGameId=Ui,Un.getUserInfo=X1,Un.init=vv,Un.isLoggedIn=K1,Un.login=W1,Un.logout=Q1,Object.defineProperty(Un,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/js-sdk.js
CHANGED
|
@@ -23004,51 +23004,54 @@ function fT({
|
|
|
23004
23004
|
loginTypes: e,
|
|
23005
23005
|
defaultLoginType: t,
|
|
23006
23006
|
gameId: n,
|
|
23007
|
-
|
|
23008
|
-
|
|
23007
|
+
styleVars: r,
|
|
23008
|
+
onLoginSuccess: o,
|
|
23009
|
+
onLoginError: s
|
|
23009
23010
|
}) {
|
|
23010
|
-
const
|
|
23011
|
+
const i = Xr(n);
|
|
23011
23012
|
if (document.querySelector(".login-sdk-container"))
|
|
23012
23013
|
return console.warn("Login component is already active. Multiple instances are not allowed."), { close: () => {
|
|
23013
23014
|
} };
|
|
23014
|
-
const
|
|
23015
|
-
|
|
23016
|
-
const
|
|
23015
|
+
const a = document.createElement("div");
|
|
23016
|
+
a.className = "login-sdk-container", document.body.appendChild(a);
|
|
23017
|
+
const c = ah.createRoot(a), u = () => {
|
|
23017
23018
|
setTimeout(() => {
|
|
23018
|
-
|
|
23019
|
+
c.unmount(), a.remove();
|
|
23019
23020
|
}, 200);
|
|
23020
|
-
},
|
|
23021
|
-
|
|
23021
|
+
}, l = () => {
|
|
23022
|
+
c.render(
|
|
23022
23023
|
/* @__PURE__ */ k(
|
|
23023
23024
|
Pl,
|
|
23024
23025
|
{
|
|
23025
|
-
gameId:
|
|
23026
|
+
gameId: i,
|
|
23026
23027
|
loginTypes: e,
|
|
23027
23028
|
defaultLoginType: t,
|
|
23029
|
+
styleVars: r,
|
|
23028
23030
|
open: !1,
|
|
23029
|
-
onOpenChange:
|
|
23030
|
-
onLoginSuccess:
|
|
23031
|
-
onLoginError:
|
|
23031
|
+
onOpenChange: f,
|
|
23032
|
+
onLoginSuccess: o,
|
|
23033
|
+
onLoginError: s
|
|
23032
23034
|
}
|
|
23033
23035
|
)
|
|
23034
|
-
),
|
|
23035
|
-
},
|
|
23036
|
-
|
|
23036
|
+
), u();
|
|
23037
|
+
}, f = (d) => {
|
|
23038
|
+
d || l();
|
|
23037
23039
|
};
|
|
23038
|
-
return
|
|
23040
|
+
return c.render(
|
|
23039
23041
|
/* @__PURE__ */ k(
|
|
23040
23042
|
Pl,
|
|
23041
23043
|
{
|
|
23042
|
-
gameId:
|
|
23044
|
+
gameId: i,
|
|
23043
23045
|
loginTypes: e,
|
|
23044
23046
|
defaultLoginType: t,
|
|
23047
|
+
styleVars: r,
|
|
23045
23048
|
open: !0,
|
|
23046
|
-
onOpenChange:
|
|
23047
|
-
onLoginSuccess:
|
|
23048
|
-
onLoginError:
|
|
23049
|
+
onOpenChange: f,
|
|
23050
|
+
onLoginSuccess: o,
|
|
23051
|
+
onLoginError: s
|
|
23049
23052
|
}
|
|
23050
23053
|
)
|
|
23051
|
-
), { close:
|
|
23054
|
+
), { close: l };
|
|
23052
23055
|
}
|
|
23053
23056
|
const gT = {
|
|
23054
23057
|
init: Iw,
|
package/dist/js-sdk.umd.js
CHANGED
|
@@ -70,4 +70,4 @@ components: `).concat(Jc(s),"\n```")),[2,i]}})})}}}function Ug(){if(!(window.__f
|
|
|
70
70
|
|
|
71
71
|
`)}h.write("payload.value = newResult;"),h.write("return payload;");const E=h.compile();return(C,S)=>E(d,C,S)};let s;const i=Zs,a=!qa.jitless,l=a&&Dx.value,u=t.catchall;let f;e._zod.parse=(d,h)=>{f??(f=r.value);const m=d.value;return i(m)?a&&l&&h?.async===!1&&h.jitless!==!0?(s||(s=o(t.shape)),d=s(d,h),u?Pp([],m,d,h,f,e):d):n(d,h):(d.issues.push({expected:"object",code:"invalid_type",input:m,inst:e}),d)}});function Tp(e,t,n,r){for(const s of e)if(s.issues.length===0)return t.value=s.value,t;const o=e.filter(s=>!Br(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>vr(i,r,gr())))}),t)}const hC=ee("$ZodUnion",(e,t)=>{St.init(e,t),ot(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),ot(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),ot(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),ot(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>ec(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1;const i=[];for(const a of t.options){const c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Tp(a,r,e,o)):Tp(i,r,e,o)}}),mC=ee("$ZodIntersection",(e,t)=>{St.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,l])=>kp(n,c,l)):kp(n,s,i)}});function sc(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ko(e)&&ko(t)){const n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(const s of r){const i=sc(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],s=t[r],i=sc(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function kp(e,t,n){const r=new Map;let o;for(const a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(const a of n.issues)if(a.code==="unrecognized_keys")for(const c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);const s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),Br(e))return e;const i=sc(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}const gC=ee("$ZodEnum",(e,t)=>{St.init(e,t);const n=lp(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>Nx.has(typeof o)).map(o=>typeof o=="string"?Ws(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{const i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),yC=ee("$ZodTransform",(e,t)=>{St.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cp(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n.fallback=!0,n));if(o instanceof Promise)throw new Ur;return n.value=o,n.fallback=!0,n}});function Ip(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Op=ee("$ZodOptional",(e,t)=>{St.init(e,t),e._zod.optin="optional",e._zod.optout="optional",ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),ot(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ec(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>Ip(i,o)):Ip(s,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),vC=ee("$ZodExactOptional",(e,t)=>{Op.init(e,t),ot(e._zod,"values",()=>t.innerType._zod.values),ot(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),bC=ee("$ZodNullable",(e,t)=>{St.init(e,t),ot(e._zod,"optin",()=>t.innerType._zod.optin),ot(e._zod,"optout",()=>t.innerType._zod.optout),ot(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${ec(n.source)}|null)$`):void 0}),ot(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),wC=ee("$ZodDefault",(e,t)=>{St.init(e,t),e._zod.optin="optional",ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>_p(s,t)):_p(o,t)}});function _p(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const SC=ee("$ZodPrefault",(e,t)=>{St.init(e,t),e._zod.optin="optional",ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),xC=ee("$ZodNonOptional",(e,t)=>{St.init(e,t),ot(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Rp(s,e)):Rp(o,e)}});function Rp(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const EC=ee("$ZodCatch",(e,t)=>{St.init(e,t),e._zod.optin="optional",ot(e._zod,"optout",()=>t.innerType._zod.optout),ot(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>vr(i,r,gr()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>vr(s,r,gr()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),CC=ee("$ZodPipe",(e,t)=>{St.init(e,t),ot(e._zod,"values",()=>t.in._zod.values),ot(e._zod,"optin",()=>t.in._zod.optin),ot(e._zod,"optout",()=>t.out._zod.optout),ot(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>qs(i,t.in,r)):qs(s,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>qs(s,t.out,r)):qs(o,t.out,r)}});function qs(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const PC=ee("$ZodReadonly",(e,t)=>{St.init(e,t),ot(e._zod,"propValues",()=>t.innerType._zod.propValues),ot(e._zod,"values",()=>t.innerType._zod.values),ot(e._zod,"optin",()=>t.innerType?._zod?.optin),ot(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Mp):Mp(o)}});function Mp(e){return e.value=Object.freeze(e.value),e}const TC=ee("$ZodCustom",(e,t)=>{Pn.init(e,t),St.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Ap(s,n,r,e));Ap(o,n,r,e)}});function Ap(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Io(o))}}var Dp;class kC{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function IC(){return new kC}(Dp=globalThis).__zod_globalRegistry??(Dp.__zod_globalRegistry=IC());const _o=globalThis.__zod_globalRegistry;function OC(e,t){return new e({type:"string",..._e(t)})}function _C(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,..._e(t)})}function Np(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,..._e(t)})}function RC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,..._e(t)})}function MC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",..._e(t)})}function AC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",..._e(t)})}function DC(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",..._e(t)})}function NC(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,..._e(t)})}function FC(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,..._e(t)})}function LC(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,..._e(t)})}function zC(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,..._e(t)})}function $C(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,..._e(t)})}function VC(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,..._e(t)})}function jC(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,..._e(t)})}function HC(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,..._e(t)})}function ZC(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,..._e(t)})}function WC(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,..._e(t)})}function UC(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,..._e(t)})}function BC(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,..._e(t)})}function GC(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,..._e(t)})}function YC(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,..._e(t)})}function XC(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,..._e(t)})}function qC(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,..._e(t)})}function KC(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,..._e(t)})}function JC(e,t){return new e({type:"string",format:"date",check:"string_format",..._e(t)})}function QC(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,..._e(t)})}function eP(e,t){return new e({type:"string",format:"duration",check:"string_format",..._e(t)})}function tP(e){return new e({type:"unknown"})}function nP(e,t){return new e({type:"never",..._e(t)})}function Fp(e,t){return new TE({check:"max_length",..._e(t),maximum:e})}function Ks(e,t){return new kE({check:"min_length",..._e(t),minimum:e})}function Lp(e,t){return new IE({check:"length_equals",..._e(t),length:e})}function rP(e,t){return new OE({check:"string_format",format:"regex",..._e(t),pattern:e})}function oP(e){return new _E({check:"string_format",format:"lowercase",..._e(e)})}function sP(e){return new RE({check:"string_format",format:"uppercase",..._e(e)})}function iP(e,t){return new ME({check:"string_format",format:"includes",..._e(t),includes:e})}function aP(e,t){return new AE({check:"string_format",format:"starts_with",..._e(t),prefix:e})}function cP(e,t){return new DE({check:"string_format",format:"ends_with",..._e(t),suffix:e})}function Gr(e){return new NE({check:"overwrite",tx:e})}function lP(e){return Gr(t=>t.normalize(e))}function uP(){return Gr(e=>e.trim())}function fP(){return Gr(e=>e.toLowerCase())}function dP(){return Gr(e=>e.toUpperCase())}function pP(){return Gr(e=>Ax(e))}function hP(e,t,n){return new e({type:"array",element:t,..._e(n)})}function mP(e,t,n){return new e({type:"custom",check:"custom",fn:t,..._e(n)})}function gP(e,t){const n=yP(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(Io(o,r.value,n._zod.def));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(Io(s))}},e(r.value,r)),t);return n}function yP(e,t){const n=new Pn({check:"custom",..._e(t)});return n._zod.check=e,n}function zp(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??_o,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function Ot(e,t,n={path:[],schemaPath:[]}){var r;const o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{const u={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,u);else{const d=i.schema,h=t.processors[o.type];if(!h)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);h(e,t,d,u)}const f=e._zod.parent;f&&(i.ref||(i.ref=f),Ot(f,t,u),t.seen.get(f).isParent=!0)}const c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&$t(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function $p(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const i of e.seen.entries()){const a=e.metadataRegistry.get(i[0])?.id;if(a){const c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}const o=i=>{const a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const f=e.external.registry.get(i[0])?.id,d=e.external.uri??(m=>m);if(f)return{ref:d(f)};const h=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=h,{defId:h,ref:`${d("__shared")}#/${a}/${h}`}}if(i[1]===n)return{ref:"#"};const l=`#/${a}/`,u=i[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+u}},s=i=>{if(i[1].schema.$ref)return;const a=i[1],{ref:c,defId:l}=o(i);a.def={...a.schema},l&&(a.defId=l);const u=a.schema;for(const f in u)delete u[f];u.$ref=c};if(e.cycles==="throw")for(const i of e.seen.entries()){const a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
72
72
|
|
|
73
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Vp(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const c=e.seen.get(a);if(c.ref===null)return;const l=c.def??c.schema,u={...l},f=c.ref;if(c.ref=null,f){r(f);const h=e.seen.get(f),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,u),a._zod.parent===f)for(const v in l)v==="$ref"||v==="allOf"||v in u||delete l[v];if(m.$ref&&h.def)for(const v in l)v==="$ref"||v==="allOf"||v in h.def&&JSON.stringify(l[v])===JSON.stringify(h.def[v])&&delete l[v]}const d=a._zod.parent;if(d&&d!==f){r(d);const h=e.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(const m in l)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(l[m])===JSON.stringify(h.def[m])&&delete l[m]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const i=e.external?.defs??{};for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Js(t,"input",e.processors),output:Js(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function $t(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return $t(r.element,n);if(r.type==="set")return $t(r.valueType,n);if(r.type==="lazy")return $t(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return $t(r.innerType,n);if(r.type==="intersection")return $t(r.left,n)||$t(r.right,n);if(r.type==="record"||r.type==="map")return $t(r.keyType,n)||$t(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:$t(r.in,n)||$t(r.out,n);if(r.type==="object"){for(const o in r.shape)if($t(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if($t(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if($t(o,n))return!0;return!!(r.rest&&$t(r.rest,n))}return!1}const vP=(e,t={})=>n=>{const r=zp({...n,processors:t});return Ot(e,r),$p(r,e),Vp(r,e)},Js=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=zp({...o??{},target:s,io:t,processors:n});return Ot(e,i),$p(i,e),Vp(i,e)},bP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wP=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=bP[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),l&&(o.contentEncoding=l),c&&c.size>0){const u=[...c];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},SP=(e,t,n,r)=>{n.not={}},xP=(e,t,n,r)=>{},EP=(e,t,n,r)=>{const o=e._zod.def,s=lp(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},CP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},PP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},TP=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Ot(s.element,t,{...r,path:[...r.path,"items"]})},kP=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const l in i)o.properties[l]=Ot(i[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(l=>{const u=s.shape[l]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Ot(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},IP=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ot(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},OP=(e,t,n,r)=>{const o=e._zod.def,s=Ot(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ot(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},_P=(e,t,n,r)=>{const o=e._zod.def,s=Ot(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},RP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},MP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},AP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},DP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},NP=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;Ot(i,t,r);const a=t.seen.get(e);a.ref=i},FP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},jp=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},LP=ee("ZodISODateTime",(e,t)=>{XE.init(e,t),ht.init(e,t)});function zP(e){return KC(LP,e)}const $P=ee("ZodISODate",(e,t)=>{qE.init(e,t),ht.init(e,t)});function VP(e){return JC($P,e)}const jP=ee("ZodISOTime",(e,t)=>{KE.init(e,t),ht.init(e,t)});function HP(e){return QC(jP,e)}const ZP=ee("ZodISODuration",(e,t)=>{JE.init(e,t),ht.init(e,t)});function WP(e){return eP(ZP,e)}const nn=ee("ZodError",(e,t)=>{gp.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Ux(e,n)},flatten:{value:n=>Oo(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ka,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ka,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),UP=nc(nn),BP=rc(nn),GP=Bs(nn),YP=Gs(nn),XP=Yx(nn),qP=Xx(nn),KP=qx(nn),JP=Kx(nn),QP=Jx(nn),eT=Qx(nn),tT=eE(nn),nT=tE(nn),Hp=new WeakMap;function Qs(e,t,n){const r=Object.getPrototypeOf(e);let o=Hp.get(r);if(o||(o=new Set,Hp.set(r,o)),!o.has(t)){o.add(t);for(const s in n){const i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const xt=ee("ZodType",(e,t)=>(St.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Js(e,"input"),output:Js(e,"output")}}),e.toJSONSchema=vP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>UP(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>GP(e,n,r),e.parseAsync=async(n,r)=>BP(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>YP(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>XP(e,n,r),e.decode=(n,r)=>qP(e,n,r),e.encodeAsync=async(n,r)=>KP(e,n,r),e.decodeAsync=async(n,r)=>JP(e,n,r),e.safeEncode=(n,r)=>QP(e,n,r),e.safeDecode=(n,r)=>eT(e,n,r),e.safeEncodeAsync=async(n,r)=>tT(e,n,r),e.safeDecodeAsync=async(n,r)=>nT(e,n,r),Qs(e,"ZodType",{check(...n){const r=this.def;return this.clone(Jn(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Qn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(YT(n,r))},superRefine(n,r){return this.check(XT(n,r))},overwrite(n){return this.check(Gr(n))},optional(){return Gp(this)},exactOptional(){return NT(this)},nullable(){return Yp(this)},nullish(){return Gp(Yp(this))},nonoptional(n){return jT(this,n)},array(){return PT(this)},or(n){return IT([this,n])},and(n){return _T(this,n)},transform(n){return qp(this,AT(n))},default(n){return zT(this,n)},prefault(n){return VT(this,n)},catch(n){return ZT(this,n)},pipe(n){return qp(this,n)},readonly(){return BT(this)},describe(n){const r=this.clone();return _o.add(r,{description:n}),r},meta(...n){if(n.length===0)return _o.get(this);const r=this.clone();return _o.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return _o.get(e)?.description},configurable:!0}),e)),Zp=ee("_ZodString",(e,t)=>{oc.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>wP(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Qs(e,"_ZodString",{regex(...r){return this.check(rP(...r))},includes(...r){return this.check(iP(...r))},startsWith(...r){return this.check(aP(...r))},endsWith(...r){return this.check(cP(...r))},min(...r){return this.check(Ks(...r))},max(...r){return this.check(Fp(...r))},length(...r){return this.check(Lp(...r))},nonempty(...r){return this.check(Ks(1,...r))},lowercase(r){return this.check(oP(r))},uppercase(r){return this.check(sP(r))},trim(){return this.check(uP())},normalize(...r){return this.check(lP(...r))},toLowerCase(){return this.check(fP())},toUpperCase(){return this.check(dP())},slugify(){return this.check(pP())}})}),rT=ee("ZodString",(e,t)=>{oc.init(e,t),Zp.init(e,t),e.email=n=>e.check(_C(oT,n)),e.url=n=>e.check(NC(sT,n)),e.jwt=n=>e.check(qC(wT,n)),e.emoji=n=>e.check(FC(iT,n)),e.guid=n=>e.check(Np(Wp,n)),e.uuid=n=>e.check(RC(ei,n)),e.uuidv4=n=>e.check(MC(ei,n)),e.uuidv6=n=>e.check(AC(ei,n)),e.uuidv7=n=>e.check(DC(ei,n)),e.nanoid=n=>e.check(LC(aT,n)),e.guid=n=>e.check(Np(Wp,n)),e.cuid=n=>e.check(zC(cT,n)),e.cuid2=n=>e.check($C(lT,n)),e.ulid=n=>e.check(VC(uT,n)),e.base64=n=>e.check(GC(yT,n)),e.base64url=n=>e.check(YC(vT,n)),e.xid=n=>e.check(jC(fT,n)),e.ksuid=n=>e.check(HC(dT,n)),e.ipv4=n=>e.check(ZC(pT,n)),e.ipv6=n=>e.check(WC(hT,n)),e.cidrv4=n=>e.check(UC(mT,n)),e.cidrv6=n=>e.check(BC(gT,n)),e.e164=n=>e.check(XC(bT,n)),e.datetime=n=>e.check(zP(n)),e.date=n=>e.check(VP(n)),e.time=n=>e.check(HP(n)),e.duration=n=>e.check(WP(n))});function Yr(e){return OC(rT,e)}const ht=ee("ZodStringFormat",(e,t)=>{pt.init(e,t),Zp.init(e,t)}),oT=ee("ZodEmail",(e,t)=>{VE.init(e,t),ht.init(e,t)}),Wp=ee("ZodGUID",(e,t)=>{zE.init(e,t),ht.init(e,t)}),ei=ee("ZodUUID",(e,t)=>{$E.init(e,t),ht.init(e,t)}),sT=ee("ZodURL",(e,t)=>{jE.init(e,t),ht.init(e,t)}),iT=ee("ZodEmoji",(e,t)=>{HE.init(e,t),ht.init(e,t)}),aT=ee("ZodNanoID",(e,t)=>{ZE.init(e,t),ht.init(e,t)}),cT=ee("ZodCUID",(e,t)=>{WE.init(e,t),ht.init(e,t)}),lT=ee("ZodCUID2",(e,t)=>{UE.init(e,t),ht.init(e,t)}),uT=ee("ZodULID",(e,t)=>{BE.init(e,t),ht.init(e,t)}),fT=ee("ZodXID",(e,t)=>{GE.init(e,t),ht.init(e,t)}),dT=ee("ZodKSUID",(e,t)=>{YE.init(e,t),ht.init(e,t)}),pT=ee("ZodIPv4",(e,t)=>{QE.init(e,t),ht.init(e,t)}),hT=ee("ZodIPv6",(e,t)=>{eC.init(e,t),ht.init(e,t)}),mT=ee("ZodCIDRv4",(e,t)=>{tC.init(e,t),ht.init(e,t)}),gT=ee("ZodCIDRv6",(e,t)=>{nC.init(e,t),ht.init(e,t)}),yT=ee("ZodBase64",(e,t)=>{rC.init(e,t),ht.init(e,t)}),vT=ee("ZodBase64URL",(e,t)=>{sC.init(e,t),ht.init(e,t)}),bT=ee("ZodE164",(e,t)=>{iC.init(e,t),ht.init(e,t)}),wT=ee("ZodJWT",(e,t)=>{cC.init(e,t),ht.init(e,t)}),ST=ee("ZodUnknown",(e,t)=>{lC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xP()});function Up(){return tP(ST)}const xT=ee("ZodNever",(e,t)=>{uC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>SP(e,n,r)});function ET(e){return nP(xT,e)}const CT=ee("ZodArray",(e,t)=>{fC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>TP(e,n,r,o),e.element=t.element,Qs(e,"ZodArray",{min(n,r){return this.check(Ks(n,r))},nonempty(n){return this.check(Ks(1,n))},max(n,r){return this.check(Fp(n,r))},length(n,r){return this.check(Lp(n,r))},unwrap(){return this.element}})});function PT(e,t){return hP(CT,e,t)}const TT=ee("ZodObject",(e,t)=>{pC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kP(e,n,r,o),ot(e,"shape",()=>t.shape),Qs(e,"ZodObject",{keyof(){return RT(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Up()})},loose(){return this.clone({...this._zod.def,catchall:Up()})},strict(){return this.clone({...this._zod.def,catchall:ET()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return $x(this,n)},safeExtend(n){return Vx(this,n)},merge(n){return jx(this,n)},pick(n){return Lx(this,n)},omit(n){return zx(this,n)},partial(...n){return Hx(Bp,this,n[0])},required(...n){return Zx(Xp,this,n[0])}})});function ic(e,t){const n={type:"object",shape:e??{},..._e(t)};return new TT(n)}const kT=ee("ZodUnion",(e,t)=>{hC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>IP(e,n,r,o),e.options=t.options});function IT(e,t){return new kT({type:"union",options:e,..._e(t)})}const OT=ee("ZodIntersection",(e,t)=>{mC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>OP(e,n,r,o)});function _T(e,t){return new OT({type:"intersection",left:e,right:t})}const ac=ee("ZodEnum",(e,t)=>{gC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>EP(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ac({...t,checks:[],..._e(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ac({...t,checks:[],..._e(o),entries:s})}});function RT(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ac({type:"enum",entries:n,..._e(t)})}const MT=ee("ZodTransform",(e,t)=>{yC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>PP(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cp(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Io(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Io(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function AT(e){return new MT({type:"transform",transform:e})}const Bp=ee("ZodOptional",(e,t)=>{Op.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gp(e){return new Bp({type:"optional",innerType:e})}const DT=ee("ZodExactOptional",(e,t)=>{vC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function NT(e){return new DT({type:"optional",innerType:e})}const FT=ee("ZodNullable",(e,t)=>{bC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_P(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yp(e){return new FT({type:"nullable",innerType:e})}const LT=ee("ZodDefault",(e,t)=>{wC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>MP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zT(e,t){return new LT({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pp(t)}})}const $T=ee("ZodPrefault",(e,t)=>{SC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>AP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function VT(e,t){return new $T({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pp(t)}})}const Xp=ee("ZodNonOptional",(e,t)=>{xC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>RP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jT(e,t){return new Xp({type:"nonoptional",innerType:e,..._e(t)})}const HT=ee("ZodCatch",(e,t)=>{EC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>DP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ZT(e,t){return new HT({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const WT=ee("ZodPipe",(e,t)=>{CC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>NP(e,n,r,o),e.in=t.in,e.out=t.out});function qp(e,t){return new WT({type:"pipe",in:e,out:t})}const UT=ee("ZodReadonly",(e,t)=>{PC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>FP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function BT(e){return new UT({type:"readonly",innerType:e})}const GT=ee("ZodCustom",(e,t)=>{TC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>CP(e,n)});function YT(e,t={}){return mP(GT,e,t)}function XT(e,t){return gP(e,t)}const qT=ic({account:Yr().min(1,"请输入账号"),password:Yr().min(1,"请输入密码")});function KT(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r,triggerRealNameAuth:o,defaultAgreeProtocol:s=!1}=Nn(),i=re.useRef(null),[a,c]=re.useState(""),[l,u]=re.useState(""),[f,d]=re.useState(!1),[h,m]=re.useState(s),[y,v]=re.useState(!1),[g,E]=re.useState(!1),[C,S]=re.useState({}),{mutate:b,isPending:x}=sn({mutationFn:()=>rx({account:a,password:l}),onSuccess:I=>{const z={account:I.account,entity:I.channel_info.entity,token:I.channel_info.token,sign:I.channel_info.sign,accid:I.channel_info.entity.openid,extra_data:I.channel_info.extra_data,gaplaySign:I.channel_info.gaplaySign,realname:I.channel_info.realname};if(Ts(z,I._auth,e),z.realname&&z.realname.reject>=2){o();return}t?.(z),n?.(z)},onError:I=>{r?.(I)}});async function T(I){I.preventDefault();const z=new FormData(I.currentTarget),A=qT.safeParse(Object.fromEntries(z));return A.success?h?(b(),{errors:{}}):(E(!0),{errors:{}}):{errors:Oo(A.error).fieldErrors}}return w.jsxs(w.Fragment,{children:[w.jsxs(Ns,{ref:i,errors:C,onSubmit:async I=>{const z=await T(I);S(z?.errors||{})},className:"space-y-5",children:[w.jsx(Cn,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:I=>c(I.currentTarget.value),prefix:e==="5327"?w.jsx(Q1,{className:"size-5 text-gray-400"}):w.jsx(px,{className:"size-5 text-gray-400"})}),w.jsx(Cn,{name:"password",type:f?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:l,onValueChange:I=>u(I),prefix:w.jsx(hx,{className:"size-5 text-gray-400"}),suffix:w.jsx("button",{onClick:()=>d(!f),type:"button",className:"text-gray-400 hover:text-gray-600 focus:outline-none",children:f?w.jsx(Kd,{className:"size-5"}):w.jsx(qd,{className:"size-5"})})}),w.jsxs("section",{children:[w.jsx("div",{className:"flex justify-end mb-1",children:w.jsx(Wr,{title:"忘记密码",open:y,onOpenChange:v,trigger:w.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:w.jsx(Mx,{onClose:()=>v(!1),defaultAccount:a})})}),w.jsx(To,{className:"w-full",type:"primary",htmlType:"submit",disabled:x,children:"登录"})]}),w.jsx(js,{}),w.jsx(Ya,{checked:h,onChange:m})]}),w.jsx(op,{open:g,onOpenChange:E,onAgree:()=>{m(!0),b()}})]})}const br={trigger:"_trigger_1e3h3_1",popup:"_popup_1e3h3_5",item:"_item_1e3h3_24",indicator:"_indicator_1e3h3_40",itemText:"_itemText_1e3h3_44",itemCode:"_itemCode_1e3h3_48",itemLabel:"_itemLabel_1e3h3_52"};function JT({value:e,onValueChange:t}){const{gameId:n}=Nn(),r=gw(),o=p.useMemo(()=>r.find(i=>i.id===e||i.value===e)?.id||e,[r,e]);return w.jsxs(O1,{value:o,onValueChange:s=>{const i=r.find(a=>a.id===s);i&&t?.(i.value)},children:[w.jsxs(M1,{className:br.trigger,children:[w.jsx("span",{children:r.find(s=>s.id===o)?.value}),w.jsx(Xd,{className:"size-4"})]}),w.jsx(D1,{children:w.jsx(z1,{className:"outline-none z-[999]",sideOffset:-4,align:"start",children:w.jsx(V1,{className:br.popup,children:r.map(({label:s,value:i,id:a})=>w.jsxs(H1,{value:a,className:br.item,children:[w.jsx(Z1,{className:br.indicator,children:w.jsx(Ba,{className:"size-3"})}),w.jsxs(U1,{className:br.itemText,children:[w.jsx("span",{className:br.itemCode,children:i}),w.jsx("span",{className:br.itemLabel,children:s})]})]},a))})})})]})}const Kp=ic({phoneNumber:Yr().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:Yr().length(4,"请输入 6 位验证码")});function Jp(){const{mobileLoginConfig:e={},gameId:t,onPhoneLoginSuccess:n,onLoginSuccess:r,onLoginError:o,triggerRealNameAuth:s,defaultAgreeProtocol:i=!1}=Nn(),[a,c]=re.useState("86"),[l,u]=re.useState(""),f=re.useRef(null),[d,h]=re.useState(""),[m,y]=re.useState(),[v,g]=re.useState(i),[E,C]=re.useState({}),[S,b]=re.useState(!1),[x,T]=re.useState(!1),[I,z]=re.useState("login"),[A]=ip({leftTime:m?m*1e3:void 0,interval:1e3,onEnd(){y(void 0)}}),{mutate:F,isPending:V}=sn({mutationFn:()=>ox({mobile:l,countryCode:a,type:e.smsType}),onSuccess:P=>{b(!0),y(P.lock_time),Ct.success("验证码已发送,请注意查收")}}),{mutate:$,isPending:M}=sn({mutationFn:async()=>{const P=await sx({mobile:l,countryCode:a,captcha:d});y(void 0);const R={account:P.account,entity:P.channel_info.entity,token:P.channel_info.token,sign:P.channel_info.sign,accid:P.channel_info.entity.openid,extra_data:P.channel_info.extra_data,gaplaySign:P.channel_info.gaplaySign,realname:P.channel_info.realname};if(Ts(R,P._auth,t),R.realname&&R.realname.reject>=2){s();return}return n&&await n(R),r?.(R),P},onError:P=>{o?.(P)}});function k(){const P=new FormData(f.current),R=Kp.pick({phoneNumber:!0}).safeParse(Object.fromEntries(P));if(!R.success){C(Oo(R.error).fieldErrors);return}if(!v){z("sendCode"),T(!0);return}F()}async function O(P){P.preventDefault();const R=new FormData(P.currentTarget),D=Kp.safeParse(Object.fromEntries(R));return D.success?v?($(),{errors:{}}):(z("login"),T(!0),{errors:{}}):{errors:Oo(D.error).fieldErrors}}return w.jsxs(w.Fragment,{children:[w.jsxs(Ns,{ref:f,errors:E,onSubmit:async P=>{const R=await O(P);C(R.errors)},className:"space-y-5",children:[w.jsx(Cn,{name:"phoneNumber",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:P=>u(P.currentTarget.value),prefix:w.jsx(JT,{value:a,onValueChange:c})}),w.jsx(Cn,{name:"verificationCode",placeholder:"请输入验证码",value:d,type:"number",onValueChange:P=>{const R=P;h(R),R.length===4&&S&&setTimeout(()=>{f.current?.requestSubmit()},0)},suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>k(),disabled:!!m||V,children:V?"发送中...":m?`${Math.round(A/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(To,{className:gt("my-5 w-full",e.buttonClassName),disabled:M,type:"primary",htmlType:"submit",children:M?"登录中...":e.buttonText||"登录"}),w.jsx(js,{}),w.jsx(Ya,{checked:v,onChange:g})]}),w.jsx(op,{open:x,onOpenChange:T,onAgree:()=>{g(!0),I==="sendCode"?F():$()}})]})}function QT(e){return w.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[w.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),w.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function e2({children:e,title:t,description:n,content:r,classNames:o={}}){return w.jsxs(d1,{children:[w.jsx(h1,{className:o.trigger,delay:0,children:e}),w.jsxs(g1,{children:[w.jsx(P1,{className:gt("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",o.backdrop)}),w.jsx(y1,{sideOffset:8,className:o.positioner,children:w.jsxs(x1,{className:gt("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",o.popup),children:[w.jsx(E1,{className:gt("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",o.arrow),children:w.jsx(QT,{})}),t&&w.jsx(T1,{className:"text-base font-medium",children:t}),n&&w.jsx(k1,{className:"text-base text-gray-600",children:n}),r]})})]})]})}const wr={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function Qp({onUidLoginSuccess:e,customSendUidMailCaptcha:t,customValidateUidMailCaptcha:n}={}){const{gameId:r,autoLoginConfig:o,sceneId:s,onUidLoginSuccess:i,onLoginSuccess:a,onLoginError:c,uidLoginConfig:l={}}=Nn(),u=re.useRef(null),[f,d]=re.useState(""),[h,m]=re.useState(""),[y,v]=re.useState(!0),[g,E]=re.useState(!1),[C,{startCountdown:S,resetCountdown:b}]=bx({countStart:120,intervalMs:1e3}),{mutate:x}=sn({mutationFn:()=>{const A=o.enabled?o.days:void 0;return n?n({gameId:r,captcha:h,expireInDays:y?A:void 0,accountId:f,sceneId:s}):nx({game_id:r,charid:f,captcha_type:"login",captcha:h,expires_day:y?A:void 0,scene_id:s,...l.uidMailExtraParams})},onSuccess:A=>{i?.(A),e?.(A),a?.(A)},onError:A=>{c?.(A)}}),{mutate:T,isPending:I}=sn({mutationFn:()=>t?t({gameId:r,accountId:f}):tx({game_id:r,captcha_type:"login",charid:f,scene_id:s,...l.uidMailExtraParams}),onSuccess:A=>{S(),Ct.success(A.error)}});async function z(A){A.preventDefault(),x()}return re.useEffect(()=>{h.length===6&&f&&setTimeout(()=>{u.current?.requestSubmit()},0)},[h,f]),re.useEffect(()=>{C===0&&b(),E(C!==120)},[C,b]),w.jsxs(Ns,{ref:u,onSubmit:z,className:gt("space-y-6",wr.form),autoComplete:"off",children:[["5199","5012"].includes(r)?w.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,w.jsx(Cn,{name:"accountId",className:gt(wr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:A=>d(A.currentTarget.value),prefix:w.jsx(e2,{content:w.jsx("div",{className:gt(wr.uidGet,l.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:gt("rounded-2xl shadow-lg",wr.uidGetPopup),arrow:wr.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:w.jsx("span",{children:"!"})})}),w.jsx(Cn,{name:"verificationCode",className:gt(wr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入口令码",value:h,type:"tel",onValueChange:A=>m(A),prefix:w.jsx(Wr,{trigger:w.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:w.jsx("div",{className:gt(wr.mailCodeGet,l.mailCodeGetterImageClassName)})}),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:A=>{A.preventDefault()},onClick:()=>T(),disabled:g||I||!f,children:g?`${C}s`:I?"发送中...":"发送口令码"})}),o.enabled?w.jsx(Co,{name:"rememberLogin",children:w.jsxs(_d,{className:"flex items-center gap-2 text-gray-500",onMouseDown:A=>{A.preventDefault()},children:[w.jsx(td,{checked:y,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:A=>v(!!A),children:w.jsx(nd,{children:w.jsx(Ba,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsxs("div",{children:[w.jsx("span",{className:"mr-0.5",children:o.days}),w.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(r)?w.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,w.jsx(js,{})]})}const Ht={quickLogin:"_quickLogin_1ibz1_1",quickAccounts:"_quickAccounts_1ibz1_5",selectedAccount:"_selectedAccount_1ibz1_9",accountInfo:"_accountInfo_1ibz1_21",accountName:"_accountName_1ibz1_26",arrow:"_arrow_1ibz1_31",arrowRotate:"_arrowRotate_1ibz1_37",accountList:"_accountList_1ibz1_41",listScroll:"_listScroll_1ibz1_49",accountItem:"_accountItem_1ibz1_58",active:"_active_1ibz1_77",itemName:"_itemName_1ibz1_81",itemInfo:"_itemInfo_1ibz1_86",deleteBtn:"_deleteBtn_1ibz1_97"};function t2(){const{gameId:e,onLoginSuccess:t,triggerRealNameAuth:n,setCurrentLoginType:r,defaultLoginType:o}=Nn(),[s,i]=re.useState([]),[a,c]=re.useState(null),[l,u]=re.useState(!1),[f,d]=re.useState(!1),[h,m]=re.useState(!1),[y,v]=re.useState(-1);re.useEffect(()=>{g()},[e]);const g=()=>{const x=zr(e);i(x),x.length>0?(!a||!x.find(T=>T.openid===a.openid))&&c(x[0]):c(null)},E=x=>{c(s[x]),u(!1)},C=(x,T)=>{x.stopPropagation(),v(T),m(!0)},S=()=>{const x=s[y];if(x){xf(x.openid,e);const T=zr(e);if(T.length===0){r(o);return}i(T),T.find(I=>I.openid===a?.openid)||c(T[0])}m(!1),v(-1)},b=async()=>{if(a){d(!0);try{gf(a.authorization);const x=await Qd(),T={account:x.account,entity:x.channel_info.entity,token:x.channel_info.token,sign:x.channel_info.sign,accid:x.channel_info.entity.openid,extra_data:x.channel_info.extra_data,gaplaySign:x.channel_info.gaplaySign,realname:x.channel_info.realname};if(Ts(T,a.authorization,e),T.realname&&T.realname.reject>=2){n();return}t?.(T)}catch(x){Ct.error(x?.detail),console.error("Quick login failed:",x)}finally{d(!1)}}};return s.length===0?null:w.jsxs("div",{className:Ht.quickLogin,children:[w.jsxs("div",{className:Ht.quickAccounts,children:[w.jsxs("div",{className:Ht.selectedAccount,onClick:()=>u(!l),children:[w.jsx("div",{className:Ht.accountInfo,children:w.jsx("span",{className:Ht.accountName,children:a?.username})}),w.jsx(Xd,{className:gt(Ht.arrow,l&&Ht.arrowRotate)})]}),l&&w.jsx("div",{className:Ht.accountList,children:w.jsx("div",{className:Ht.listScroll,children:s.map((x,T)=>w.jsxs("div",{className:gt(Ht.accountItem,x.openid===a?.openid&&Ht.active),onClick:()=>E(T),children:[w.jsx("div",{className:Ht.itemInfo,children:w.jsx("span",{className:Ht.itemName,children:x.username})}),w.jsx("div",{className:Ht.deleteBtn,onClick:I=>C(I,T),children:w.jsx(J1,{className:"size-4 text-gray-400 hover:text-red-500"})})]},x.openid))})})]}),w.jsx(zt,{className:"w-full h-10 mt-4 mb-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",disabled:f,onClick:b,children:f?"登录中...":"登录"}),w.jsx(js,{}),w.jsx(Wr,{open:h,onOpenChange:m,showCloseIcon:!1,classNames:{popup:"w-[300px] p-6"},children:w.jsxs("div",{className:"text-center",children:[w.jsxs("div",{className:"mb-4",children:[w.jsx("p",{className:"text-base font-medium text-gray-900",children:"是否确认删除该条账号登录记录?"}),w.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"删除后登录记录将不会保存。"})]}),w.jsxs("div",{className:"flex gap-3 mt-6",children:[w.jsx(zt,{className:"flex-1 h-9 border border-gray-300 rounded-full text-gray-600",onClick:()=>m(!1),children:"取消"}),w.jsx(zt,{className:"flex-1 h-9 bg-gradient-to-r from-[#497efe] to-[#947afa] text-white rounded-full",onClick:S,children:"确认删除"})]})]})})]})}const n2=ic({name:Yr().refine(e=>e.length>=1,{error:"请输入真实姓名",abort:!0}).refine(e=>/^[\u4e00-\u9fa5]{2,6}$/.test(e),{error:"姓名须由 2-6 个汉字组成",abort:!0}),idcard:Yr().refine(e=>e.length>=1,{error:"请输入身份证号",abort:!0}).refine(e=>/^\d{17}(\d|X|x)$/.test(e),{error:"身份证号格式不正确",abort:!0})});function r2(){const{gameId:e,onLoginSuccess:t,onAccountLoginSuccess:n,onPhoneLoginSuccess:r,showRealNameModal:o,setShowRealNameModal:s,onClose:i}=Nn(),[a,c]=p.useState({}),{mutate:l,isPending:u}=sn({mutationFn:async d=>{const m=zr(e)[0];if(!m)throw new Error("未找到登录账号信息");await ix({uid:m.uid,authorization:m.authorization,name:d.name,idcard:d.idcard});const y=await ax(m.authorization),v={account:y.account,entity:y.channel_info.entity,token:y.channel_info.token,sign:y.channel_info.sign,accid:y.channel_info.entity.openid,extra_data:y.channel_info.extra_data,gaplaySign:y.channel_info.gaplaySign,realname:y.channel_info.realname};Ct.success("实名认证成功"),s(!1),v.account?.mobile?r?.(v):n?.(v),t?.(v)},onError:d=>{Ct.error(d.message||"实名认证失败")}}),f=d=>{const h=n2.safeParse(d);if(!h.success){c(Oo(h.error).fieldErrors);return}c({}),l(h.data)};return w.jsxs(Wr,{open:o,onOpenChange:s,title:"实名认证",showCloseIcon:!1,disablePointerDismissal:!0,classNames:{popup:"w-[400px] p-6 rounded-2xl",title:"text-center text-xl mb-3"},children:[w.jsx("div",{className:"text-sm text-gray-500 mb-6 text-center",children:"根据《关于防止未成年人沉迷网络游戏的通知》,游戏用户需使用有效身份证进行实名认证。"}),w.jsxs(Ns,{onFormSubmit:f,errors:a,className:"space-y-4",children:[w.jsxs(Co,{name:"name",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Za,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的真实姓名"})}),w.jsx(Ha,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsxs(Co,{name:"idcard",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Za,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的身份证号",maxLength:18})}),w.jsx(Ha,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsx(zt,{type:"submit",className:"w-full h-12 mt-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full font-bold shadow-lg disabled:opacity-50",disabled:u,children:u?"提交中...":"提交认证"}),w.jsx("button",{type:"button",className:"w-full mt-4 text-sm text-gray-400 hover:text-gray-600 transition-colors",onClick:i,children:"退出游戏"})]})]})}const eh={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"},ti={autoLoginHint:"_autoLoginHint_h58ls_1",left:"_left_h58ls_22",loading:"_loading_h58ls_28",switchBtn:"_switchBtn_h58ls_37"};function o2({onSwitch:e}){const{autoLoginAccountName:t,setIsAutoLoggingIn:n}=Nn(),r=()=>{n(!1),e()};return w.jsxs("div",{className:ti.autoLoginHint,children:[w.jsxs("div",{className:ti.left,children:[w.jsx("div",{className:ti.loading}),w.jsxs("span",{children:[t," 正在登录..."]})]}),w.jsx("button",{className:ti.switchBtn,onClick:r,children:"切换账号"})]})}function s2({open:e,onOpenChange:t}){const{gameId:n,loginTypes:r,currentLoginType:o,closeable:s,isShowGiantLogo:i,onLoginSuccess:a,triggerRealNameAuth:c,showRealNameModal:l,setIsAutoLoggingIn:u,setAutoLoginAccountName:f}=Nn(),[d,h]=re.useState(!1),m=re.useMemo(()=>zr(n),[n,e]),y=e&&m.length>0&&!d;re.useEffect(()=>{if(!e){h(!1),u(!1);return}if(y){const C=m[0];(async()=>{if(!C){h(!0);return}u(!0),f(C.username);try{gf(C.authorization);const b=await Qd(),x={account:b.account,entity:b.channel_info.entity,token:b.channel_info.token,sign:b.channel_info.sign,accid:b.channel_info.entity.openid,extra_data:b.channel_info.extra_data,gaplaySign:b.channel_info.gaplaySign,realname:b.channel_info.realname};if(Ts(x,C.authorization,n),x.realname&&x.realname.reject>=2){u(!1),h(!0),c();return}u(!1),h(!0),t?.(!1),a?.(x)}catch(b){console.error("Auto quick login failed:",b),u(!1),h(!0)}})()}},[e,n,y]);const v=vf({loginTypes:r,gameId:n}),g=bf({loginTypes:r,gameId:n}),E=yf({loginTypes:r,gameId:n});return w.jsxs(w.Fragment,{children:[y&&w.jsx(o2,{onSwitch:()=>h(!0)}),w.jsxs(Wr,{open:e&&!y&&!l,onOpenChange:t,classNames:{popup:gt("w-[400px] p-5",eh.modal),close:eh.close,backdrop:"!bg-[var(--jssdk-backdrop-bg-color,rgba(0,0,0,0.7))]"},showCloseIcon:s,children:[i&&!fw(n)&&w.jsx("section",{className:"flex items-center justify-center mb-6",children:w.jsx("img",{src:n==="5327"?"https://cdn-imgs.sdk.mobileztgame.com/paycenter/260511150749961295.png":"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),w.jsxs("section",{children:[o==="quick"&&w.jsx(t2,{}),o===at.MOBILE&&g&&w.jsx(Jp,{}),o===at.ROLE_ID&&v&&w.jsx(Qp,{}),o===at.GIANT&&E&&w.jsx(KT,{})]})]}),w.jsx(r2,{})]})}class i2 extends re.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("[Login SDK] Uncaught error:",t)}render(){return this.state.hasError?null:this.props.children}}function cc({open:e,onOpenChange:t,sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:c=!0,mountToaster:l=!0,toastConfigs:u,...f}){const[d]=re.useState(()=>new Mh);return w.jsxs(re.StrictMode,{children:[w.jsx(Nh,{client:d,children:w.jsx(kf,{value:{sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:h=>{ww(vw({gameId:dr(f.gameId),serverUserInfo:h})),i?.(h)},onLoginError:a,closeable:c,onClose:()=>t?.(!1),...f},children:w.jsx(i2,{children:w.jsx(s2,{open:e,onOpenChange:t})})})}),l&&w.jsx(aw,{toastConfigs:u})]})}const th=e=>Sa(dr(e)),nh=e=>bw(dr(e)),rh=e=>!!Sa(dr(e));function oh({loginTypes:e,defaultLoginType:t,gameId:n,onLoginSuccess:r,onLoginError:o}){const s=dr(n);if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const i=document.createElement("div");i.className="login-sdk-container",document.body.appendChild(i);const a=ah.createRoot(i),c=()=>{setTimeout(()=>{a.unmount(),i.remove()},200)},l=()=>{a.render(w.jsx(cc,{gameId:s,loginTypes:e,defaultLoginType:t,open:!1,onOpenChange:u,onLoginSuccess:r,onLoginError:o})),c()},u=f=>{f||l()};return a.render(w.jsx(cc,{gameId:s,loginTypes:e,defaultLoginType:t,open:!0,onOpenChange:u,onLoginSuccess:r,onLoginError:o})),{close:l}}const a2={init:Cf,login:oh,logout:nh,getUserInfo:th,isLoggedIn:rh};yt.ConfigProvider=kf,yt.Login=cc,yt.MobileLogin=Jp,yt.SDK=a2,yt.UidLogin=Qp,yt.getGameId=dr,yt.getUserInfo=th,yt.init=Cf,yt.isLoggedIn=rh,yt.login=oh,yt.logout=nh,Object.defineProperty(yt,Symbol.toStringTag,{value:"Module"})}));
|
|
73
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const a=i[1];if(t===i[0]){s(i);continue}if(e.external){const l=e.external.registry.get(i[0])?.id;if(t!==i[0]&&l){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Vp(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=a=>{const c=e.seen.get(a);if(c.ref===null)return;const l=c.def??c.schema,u={...l},f=c.ref;if(c.ref=null,f){r(f);const h=e.seen.get(f),m=h.schema;if(m.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(l.allOf=l.allOf??[],l.allOf.push(m)):Object.assign(l,m),Object.assign(l,u),a._zod.parent===f)for(const v in l)v==="$ref"||v==="allOf"||v in u||delete l[v];if(m.$ref&&h.def)for(const v in l)v==="$ref"||v==="allOf"||v in h.def&&JSON.stringify(l[v])===JSON.stringify(h.def[v])&&delete l[v]}const d=a._zod.parent;if(d&&d!==f){r(d);const h=e.seen.get(d);if(h?.schema.$ref&&(l.$ref=h.schema.$ref,h.def))for(const m in l)m==="$ref"||m==="allOf"||m in h.def&&JSON.stringify(l[m])===JSON.stringify(h.def[m])&&delete l[m]}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};for(const a of[...e.seen.entries()].reverse())r(a[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);const s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;const i=e.external?.defs??{};for(const a of e.seen.entries()){const c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Js(t,"input",e.processors),output:Js(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function $t(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return $t(r.element,n);if(r.type==="set")return $t(r.valueType,n);if(r.type==="lazy")return $t(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return $t(r.innerType,n);if(r.type==="intersection")return $t(r.left,n)||$t(r.right,n);if(r.type==="record"||r.type==="map")return $t(r.keyType,n)||$t(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:$t(r.in,n)||$t(r.out,n);if(r.type==="object"){for(const o in r.shape)if($t(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if($t(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if($t(o,n))return!0;return!!(r.rest&&$t(r.rest,n))}return!1}const vP=(e,t={})=>n=>{const r=zp({...n,processors:t});return Ot(e,r),$p(r,e),Vp(r,e)},Js=(e,t,n={})=>r=>{const{libraryOptions:o,target:s}=r??{},i=zp({...o??{},target:s,io:t,processors:n});return Ot(e,i),$p(i,e),Vp(i,e)},bP={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wP=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=bP[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),l&&(o.contentEncoding=l),c&&c.size>0){const u=[...c];u.length===1?o.pattern=u[0].source:u.length>1&&(o.allOf=[...u.map(f=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:f.source}))])}},SP=(e,t,n,r)=>{n.not={}},xP=(e,t,n,r)=>{},EP=(e,t,n,r)=>{const o=e._zod.def,s=lp(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},CP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},PP=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},TP=(e,t,n,r)=>{const o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=Ot(s.element,t,{...r,path:[...r.path,"items"]})},kP=(e,t,n,r)=>{const o=n,s=e._zod.def;o.type="object",o.properties={};const i=s.shape;for(const l in i)o.properties[l]=Ot(i[l],t,{...r,path:[...r.path,"properties",l]});const a=new Set(Object.keys(i)),c=new Set([...a].filter(l=>{const u=s.shape[l]._zod;return t.io==="input"?u.optin===void 0:u.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=Ot(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},IP=(e,t,n,r)=>{const o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>Ot(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},OP=(e,t,n,r)=>{const o=e._zod.def,s=Ot(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=Ot(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=l=>"allOf"in l&&Object.keys(l).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c},_P=(e,t,n,r)=>{const o=e._zod.def,s=Ot(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},RP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},MP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},AP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},DP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},NP=(e,t,n,r)=>{const o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;Ot(i,t,r);const a=t.seen.get(e);a.ref=i},FP=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0},jp=(e,t,n,r)=>{const o=e._zod.def;Ot(o.innerType,t,r);const s=t.seen.get(e);s.ref=o.innerType},LP=ee("ZodISODateTime",(e,t)=>{XE.init(e,t),ht.init(e,t)});function zP(e){return KC(LP,e)}const $P=ee("ZodISODate",(e,t)=>{qE.init(e,t),ht.init(e,t)});function VP(e){return JC($P,e)}const jP=ee("ZodISOTime",(e,t)=>{KE.init(e,t),ht.init(e,t)});function HP(e){return QC(jP,e)}const ZP=ee("ZodISODuration",(e,t)=>{JE.init(e,t),ht.init(e,t)});function WP(e){return eP(ZP,e)}const nn=ee("ZodError",(e,t)=>{gp.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Ux(e,n)},flatten:{value:n=>Oo(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,Ka,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,Ka,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),UP=nc(nn),BP=rc(nn),GP=Bs(nn),YP=Gs(nn),XP=Yx(nn),qP=Xx(nn),KP=qx(nn),JP=Kx(nn),QP=Jx(nn),eT=Qx(nn),tT=eE(nn),nT=tE(nn),Hp=new WeakMap;function Qs(e,t,n){const r=Object.getPrototypeOf(e);let o=Hp.get(r);if(o||(o=new Set,Hp.set(r,o)),!o.has(t)){o.add(t);for(const s in n){const i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){const a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}const xt=ee("ZodType",(e,t)=>(St.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Js(e,"input"),output:Js(e,"output")}}),e.toJSONSchema=vP(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>UP(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>GP(e,n,r),e.parseAsync=async(n,r)=>BP(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>YP(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>XP(e,n,r),e.decode=(n,r)=>qP(e,n,r),e.encodeAsync=async(n,r)=>KP(e,n,r),e.decodeAsync=async(n,r)=>JP(e,n,r),e.safeEncode=(n,r)=>QP(e,n,r),e.safeDecode=(n,r)=>eT(e,n,r),e.safeEncodeAsync=async(n,r)=>tT(e,n,r),e.safeDecodeAsync=async(n,r)=>nT(e,n,r),Qs(e,"ZodType",{check(...n){const r=this.def;return this.clone(Jn(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Qn(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(YT(n,r))},superRefine(n,r){return this.check(XT(n,r))},overwrite(n){return this.check(Gr(n))},optional(){return Gp(this)},exactOptional(){return NT(this)},nullable(){return Yp(this)},nullish(){return Gp(Yp(this))},nonoptional(n){return jT(this,n)},array(){return PT(this)},or(n){return IT([this,n])},and(n){return _T(this,n)},transform(n){return qp(this,AT(n))},default(n){return zT(this,n)},prefault(n){return VT(this,n)},catch(n){return ZT(this,n)},pipe(n){return qp(this,n)},readonly(){return BT(this)},describe(n){const r=this.clone();return _o.add(r,{description:n}),r},meta(...n){if(n.length===0)return _o.get(this);const r=this.clone();return _o.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return _o.get(e)?.description},configurable:!0}),e)),Zp=ee("_ZodString",(e,t)=>{oc.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>wP(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Qs(e,"_ZodString",{regex(...r){return this.check(rP(...r))},includes(...r){return this.check(iP(...r))},startsWith(...r){return this.check(aP(...r))},endsWith(...r){return this.check(cP(...r))},min(...r){return this.check(Ks(...r))},max(...r){return this.check(Fp(...r))},length(...r){return this.check(Lp(...r))},nonempty(...r){return this.check(Ks(1,...r))},lowercase(r){return this.check(oP(r))},uppercase(r){return this.check(sP(r))},trim(){return this.check(uP())},normalize(...r){return this.check(lP(...r))},toLowerCase(){return this.check(fP())},toUpperCase(){return this.check(dP())},slugify(){return this.check(pP())}})}),rT=ee("ZodString",(e,t)=>{oc.init(e,t),Zp.init(e,t),e.email=n=>e.check(_C(oT,n)),e.url=n=>e.check(NC(sT,n)),e.jwt=n=>e.check(qC(wT,n)),e.emoji=n=>e.check(FC(iT,n)),e.guid=n=>e.check(Np(Wp,n)),e.uuid=n=>e.check(RC(ei,n)),e.uuidv4=n=>e.check(MC(ei,n)),e.uuidv6=n=>e.check(AC(ei,n)),e.uuidv7=n=>e.check(DC(ei,n)),e.nanoid=n=>e.check(LC(aT,n)),e.guid=n=>e.check(Np(Wp,n)),e.cuid=n=>e.check(zC(cT,n)),e.cuid2=n=>e.check($C(lT,n)),e.ulid=n=>e.check(VC(uT,n)),e.base64=n=>e.check(GC(yT,n)),e.base64url=n=>e.check(YC(vT,n)),e.xid=n=>e.check(jC(fT,n)),e.ksuid=n=>e.check(HC(dT,n)),e.ipv4=n=>e.check(ZC(pT,n)),e.ipv6=n=>e.check(WC(hT,n)),e.cidrv4=n=>e.check(UC(mT,n)),e.cidrv6=n=>e.check(BC(gT,n)),e.e164=n=>e.check(XC(bT,n)),e.datetime=n=>e.check(zP(n)),e.date=n=>e.check(VP(n)),e.time=n=>e.check(HP(n)),e.duration=n=>e.check(WP(n))});function Yr(e){return OC(rT,e)}const ht=ee("ZodStringFormat",(e,t)=>{pt.init(e,t),Zp.init(e,t)}),oT=ee("ZodEmail",(e,t)=>{VE.init(e,t),ht.init(e,t)}),Wp=ee("ZodGUID",(e,t)=>{zE.init(e,t),ht.init(e,t)}),ei=ee("ZodUUID",(e,t)=>{$E.init(e,t),ht.init(e,t)}),sT=ee("ZodURL",(e,t)=>{jE.init(e,t),ht.init(e,t)}),iT=ee("ZodEmoji",(e,t)=>{HE.init(e,t),ht.init(e,t)}),aT=ee("ZodNanoID",(e,t)=>{ZE.init(e,t),ht.init(e,t)}),cT=ee("ZodCUID",(e,t)=>{WE.init(e,t),ht.init(e,t)}),lT=ee("ZodCUID2",(e,t)=>{UE.init(e,t),ht.init(e,t)}),uT=ee("ZodULID",(e,t)=>{BE.init(e,t),ht.init(e,t)}),fT=ee("ZodXID",(e,t)=>{GE.init(e,t),ht.init(e,t)}),dT=ee("ZodKSUID",(e,t)=>{YE.init(e,t),ht.init(e,t)}),pT=ee("ZodIPv4",(e,t)=>{QE.init(e,t),ht.init(e,t)}),hT=ee("ZodIPv6",(e,t)=>{eC.init(e,t),ht.init(e,t)}),mT=ee("ZodCIDRv4",(e,t)=>{tC.init(e,t),ht.init(e,t)}),gT=ee("ZodCIDRv6",(e,t)=>{nC.init(e,t),ht.init(e,t)}),yT=ee("ZodBase64",(e,t)=>{rC.init(e,t),ht.init(e,t)}),vT=ee("ZodBase64URL",(e,t)=>{sC.init(e,t),ht.init(e,t)}),bT=ee("ZodE164",(e,t)=>{iC.init(e,t),ht.init(e,t)}),wT=ee("ZodJWT",(e,t)=>{cC.init(e,t),ht.init(e,t)}),ST=ee("ZodUnknown",(e,t)=>{lC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xP()});function Up(){return tP(ST)}const xT=ee("ZodNever",(e,t)=>{uC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>SP(e,n,r)});function ET(e){return nP(xT,e)}const CT=ee("ZodArray",(e,t)=>{fC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>TP(e,n,r,o),e.element=t.element,Qs(e,"ZodArray",{min(n,r){return this.check(Ks(n,r))},nonempty(n){return this.check(Ks(1,n))},max(n,r){return this.check(Fp(n,r))},length(n,r){return this.check(Lp(n,r))},unwrap(){return this.element}})});function PT(e,t){return hP(CT,e,t)}const TT=ee("ZodObject",(e,t)=>{pC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kP(e,n,r,o),ot(e,"shape",()=>t.shape),Qs(e,"ZodObject",{keyof(){return RT(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Up()})},loose(){return this.clone({...this._zod.def,catchall:Up()})},strict(){return this.clone({...this._zod.def,catchall:ET()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return $x(this,n)},safeExtend(n){return Vx(this,n)},merge(n){return jx(this,n)},pick(n){return Lx(this,n)},omit(n){return zx(this,n)},partial(...n){return Hx(Bp,this,n[0])},required(...n){return Zx(Xp,this,n[0])}})});function ic(e,t){const n={type:"object",shape:e??{},..._e(t)};return new TT(n)}const kT=ee("ZodUnion",(e,t)=>{hC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>IP(e,n,r,o),e.options=t.options});function IT(e,t){return new kT({type:"union",options:e,..._e(t)})}const OT=ee("ZodIntersection",(e,t)=>{mC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>OP(e,n,r,o)});function _T(e,t){return new OT({type:"intersection",left:e,right:t})}const ac=ee("ZodEnum",(e,t)=>{gC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(r,o,s)=>EP(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const s={};for(const i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new ac({...t,checks:[],..._e(o),entries:s})},e.exclude=(r,o)=>{const s={...t.entries};for(const i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new ac({...t,checks:[],..._e(o),entries:s})}});function RT(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ac({type:"enum",entries:n,..._e(t)})}const MT=ee("ZodTransform",(e,t)=>{yC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>PP(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new cp(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(Io(s,n.value,t));else{const i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Io(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function AT(e){return new MT({type:"transform",transform:e})}const Bp=ee("ZodOptional",(e,t)=>{Op.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gp(e){return new Bp({type:"optional",innerType:e})}const DT=ee("ZodExactOptional",(e,t)=>{vC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>jp(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function NT(e){return new DT({type:"optional",innerType:e})}const FT=ee("ZodNullable",(e,t)=>{bC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_P(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yp(e){return new FT({type:"nullable",innerType:e})}const LT=ee("ZodDefault",(e,t)=>{wC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>MP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function zT(e,t){return new LT({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pp(t)}})}const $T=ee("ZodPrefault",(e,t)=>{SC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>AP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function VT(e,t){return new $T({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():pp(t)}})}const Xp=ee("ZodNonOptional",(e,t)=>{xC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>RP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function jT(e,t){return new Xp({type:"nonoptional",innerType:e,..._e(t)})}const HT=ee("ZodCatch",(e,t)=>{EC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>DP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function ZT(e,t){return new HT({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const WT=ee("ZodPipe",(e,t)=>{CC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>NP(e,n,r,o),e.in=t.in,e.out=t.out});function qp(e,t){return new WT({type:"pipe",in:e,out:t})}const UT=ee("ZodReadonly",(e,t)=>{PC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>FP(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function BT(e){return new UT({type:"readonly",innerType:e})}const GT=ee("ZodCustom",(e,t)=>{TC.init(e,t),xt.init(e,t),e._zod.processJSONSchema=(n,r,o)=>CP(e,n)});function YT(e,t={}){return mP(GT,e,t)}function XT(e,t){return gP(e,t)}const qT=ic({account:Yr().min(1,"请输入账号"),password:Yr().min(1,"请输入密码")});function KT(){const{gameId:e,onAccountLoginSuccess:t,onLoginSuccess:n,onLoginError:r,triggerRealNameAuth:o,defaultAgreeProtocol:s=!1}=Nn(),i=re.useRef(null),[a,c]=re.useState(""),[l,u]=re.useState(""),[f,d]=re.useState(!1),[h,m]=re.useState(s),[y,v]=re.useState(!1),[g,E]=re.useState(!1),[C,S]=re.useState({}),{mutate:b,isPending:x}=sn({mutationFn:()=>rx({account:a,password:l}),onSuccess:I=>{const z={account:I.account,entity:I.channel_info.entity,token:I.channel_info.token,sign:I.channel_info.sign,accid:I.channel_info.entity.openid,extra_data:I.channel_info.extra_data,gaplaySign:I.channel_info.gaplaySign,realname:I.channel_info.realname};if(Ts(z,I._auth,e),z.realname&&z.realname.reject>=2){o();return}t?.(z),n?.(z)},onError:I=>{r?.(I)}});async function T(I){I.preventDefault();const z=new FormData(I.currentTarget),A=qT.safeParse(Object.fromEntries(z));return A.success?h?(b(),{errors:{}}):(E(!0),{errors:{}}):{errors:Oo(A.error).fieldErrors}}return w.jsxs(w.Fragment,{children:[w.jsxs(Ns,{ref:i,errors:C,onSubmit:async I=>{const z=await T(I);S(z?.errors||{})},className:"space-y-5",children:[w.jsx(Cn,{name:"account",placeholder:e==="5327"?"请输入账号":"请输入巨人通行证账号",autoFocus:!0,onChange:I=>c(I.currentTarget.value),prefix:e==="5327"?w.jsx(Q1,{className:"size-5 text-gray-400"}):w.jsx(px,{className:"size-5 text-gray-400"})}),w.jsx(Cn,{name:"password",type:f?"text":"password",autoComplete:"off",placeholder:"请输入密码",value:l,onValueChange:I=>u(I),prefix:w.jsx(hx,{className:"size-5 text-gray-400"}),suffix:w.jsx("button",{onClick:()=>d(!f),type:"button",className:"text-gray-400 hover:text-gray-600 focus:outline-none",children:f?w.jsx(Kd,{className:"size-5"}):w.jsx(qd,{className:"size-5"})})}),w.jsxs("section",{children:[w.jsx("div",{className:"flex justify-end mb-1",children:w.jsx(Wr,{title:"忘记密码",open:y,onOpenChange:v,trigger:w.jsx("button",{type:"button",className:"text-[var(--jssdk-primary-color)] text-sm",children:"忘记密码"}),children:w.jsx(Mx,{onClose:()=>v(!1),defaultAccount:a})})}),w.jsx(To,{className:"w-full",type:"primary",htmlType:"submit",disabled:x,children:"登录"})]}),w.jsx(js,{}),w.jsx(Ya,{checked:h,onChange:m})]}),w.jsx(op,{open:g,onOpenChange:E,onAgree:()=>{m(!0),b()}})]})}const br={trigger:"_trigger_1e3h3_1",popup:"_popup_1e3h3_5",item:"_item_1e3h3_24",indicator:"_indicator_1e3h3_40",itemText:"_itemText_1e3h3_44",itemCode:"_itemCode_1e3h3_48",itemLabel:"_itemLabel_1e3h3_52"};function JT({value:e,onValueChange:t}){const{gameId:n}=Nn(),r=gw(),o=p.useMemo(()=>r.find(i=>i.id===e||i.value===e)?.id||e,[r,e]);return w.jsxs(O1,{value:o,onValueChange:s=>{const i=r.find(a=>a.id===s);i&&t?.(i.value)},children:[w.jsxs(M1,{className:br.trigger,children:[w.jsx("span",{children:r.find(s=>s.id===o)?.value}),w.jsx(Xd,{className:"size-4"})]}),w.jsx(D1,{children:w.jsx(z1,{className:"outline-none z-[999]",sideOffset:-4,align:"start",children:w.jsx(V1,{className:br.popup,children:r.map(({label:s,value:i,id:a})=>w.jsxs(H1,{value:a,className:br.item,children:[w.jsx(Z1,{className:br.indicator,children:w.jsx(Ba,{className:"size-3"})}),w.jsxs(U1,{className:br.itemText,children:[w.jsx("span",{className:br.itemCode,children:i}),w.jsx("span",{className:br.itemLabel,children:s})]})]},a))})})})]})}const Kp=ic({phoneNumber:Yr().regex(/^[1-9]\d{10}$/,"请输入正确的手机号"),verificationCode:Yr().length(4,"请输入 6 位验证码")});function Jp(){const{mobileLoginConfig:e={},gameId:t,onPhoneLoginSuccess:n,onLoginSuccess:r,onLoginError:o,triggerRealNameAuth:s,defaultAgreeProtocol:i=!1}=Nn(),[a,c]=re.useState("86"),[l,u]=re.useState(""),f=re.useRef(null),[d,h]=re.useState(""),[m,y]=re.useState(),[v,g]=re.useState(i),[E,C]=re.useState({}),[S,b]=re.useState(!1),[x,T]=re.useState(!1),[I,z]=re.useState("login"),[A]=ip({leftTime:m?m*1e3:void 0,interval:1e3,onEnd(){y(void 0)}}),{mutate:F,isPending:V}=sn({mutationFn:()=>ox({mobile:l,countryCode:a,type:e.smsType}),onSuccess:P=>{b(!0),y(P.lock_time),Ct.success("验证码已发送,请注意查收")}}),{mutate:$,isPending:M}=sn({mutationFn:async()=>{const P=await sx({mobile:l,countryCode:a,captcha:d});y(void 0);const R={account:P.account,entity:P.channel_info.entity,token:P.channel_info.token,sign:P.channel_info.sign,accid:P.channel_info.entity.openid,extra_data:P.channel_info.extra_data,gaplaySign:P.channel_info.gaplaySign,realname:P.channel_info.realname};if(Ts(R,P._auth,t),R.realname&&R.realname.reject>=2){s();return}return n&&await n(R),r?.(R),P},onError:P=>{o?.(P)}});function k(){const P=new FormData(f.current),R=Kp.pick({phoneNumber:!0}).safeParse(Object.fromEntries(P));if(!R.success){C(Oo(R.error).fieldErrors);return}if(!v){z("sendCode"),T(!0);return}F()}async function O(P){P.preventDefault();const R=new FormData(P.currentTarget),D=Kp.safeParse(Object.fromEntries(R));return D.success?v?($(),{errors:{}}):(z("login"),T(!0),{errors:{}}):{errors:Oo(D.error).fieldErrors}}return w.jsxs(w.Fragment,{children:[w.jsxs(Ns,{ref:f,errors:E,onSubmit:async P=>{const R=await O(P);C(R.errors)},className:"space-y-5",children:[w.jsx(Cn,{name:"phoneNumber",placeholder:"请输入手机号码",autoFocus:!0,type:"tel",onChange:P=>u(P.currentTarget.value),prefix:w.jsx(JT,{value:a,onValueChange:c})}),w.jsx(Cn,{name:"verificationCode",placeholder:"请输入验证码",value:d,type:"number",onValueChange:P=>{const R=P;h(R),R.length===4&&S&&setTimeout(()=>{f.current?.requestSubmit()},0)},suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-white inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onClick:()=>k(),disabled:!!m||V,children:V?"发送中...":m?`${Math.round(A/1e3)}s 后重新获取`:"获取验证码"})}),w.jsx(To,{className:gt("my-5 w-full",e.buttonClassName),disabled:M,type:"primary",htmlType:"submit",children:M?"登录中...":e.buttonText||"登录"}),w.jsx(js,{}),w.jsx(Ya,{checked:v,onChange:g})]}),w.jsx(op,{open:x,onOpenChange:T,onAgree:()=>{g(!0),I==="sendCode"?F():$()}})]})}function QT(e){return w.jsxs("svg",{width:"20",height:"10",viewBox:"0 0 20 10",fill:"none",...e,children:[w.jsx("path",{d:"M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z",className:"fill-current"}),w.jsx("path",{d:"M8.99542 1.85876C9.75604 1.17425 10.9106 1.17422 11.6713 1.85878L16.5281 6.22989C17.0789 6.72568 17.7938 7.00001 18.5349 7.00001L15.89 7L11.0023 2.60207C10.622 2.2598 10.0447 2.2598 9.66436 2.60207L4.77734 7L2.13171 7.00001C2.87284 7.00001 3.58774 6.72568 4.13861 6.22989L8.99542 1.85876Z",className:"fill-current"})]})}function e2({children:e,title:t,description:n,content:r,classNames:o={}}){return w.jsxs(d1,{children:[w.jsx(h1,{className:o.trigger,delay:0,children:e}),w.jsxs(g1,{children:[w.jsx(P1,{className:gt("fixed inset-0 bg-black/20 transition-all duration-150 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0",o.backdrop)}),w.jsx(y1,{sideOffset:8,className:o.positioner,children:w.jsxs(x1,{className:gt("origin-[var(--transform-origin)] bg-white p-1 rounded shadow-sm text-gray-900 transition-[transform,scale,opacity] data-[ending-style]:scale-90 data-[ending-style]:opacity-0 data-[starting-style]:scale-90 data-[starting-style]:opacity-0 dark:shadow-none dark:-outline-offset-1 dark:outline-gray-300",o.popup),children:[w.jsx(E1,{className:gt("data-[side=bottom]:top-[-8px] data-[side=left]:right-[-13px] data-[side=left]:rotate-90 data-[side=right]:left-[-13px] data-[side=right]:-rotate-90 data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",o.arrow),children:w.jsx(QT,{})}),t&&w.jsx(T1,{className:"text-base font-medium",children:t}),n&&w.jsx(k1,{className:"text-base text-gray-600",children:n}),r]})})]})]})}const wr={uidGet:"_uidGet_os9yc_1",mailCodeGet:"_mailCodeGet_os9yc_5",uidGetPopup:"_uidGetPopup_os9yc_79",uidGetArrow:"_uidGetArrow_os9yc_83",inputControl:"_inputControl_os9yc_86",form:"_form_os9yc_89"};function Qp({onUidLoginSuccess:e,customSendUidMailCaptcha:t,customValidateUidMailCaptcha:n}={}){const{gameId:r,autoLoginConfig:o,sceneId:s,onUidLoginSuccess:i,onLoginSuccess:a,onLoginError:c,uidLoginConfig:l={}}=Nn(),u=re.useRef(null),[f,d]=re.useState(""),[h,m]=re.useState(""),[y,v]=re.useState(!0),[g,E]=re.useState(!1),[C,{startCountdown:S,resetCountdown:b}]=bx({countStart:120,intervalMs:1e3}),{mutate:x}=sn({mutationFn:()=>{const A=o.enabled?o.days:void 0;return n?n({gameId:r,captcha:h,expireInDays:y?A:void 0,accountId:f,sceneId:s}):nx({game_id:r,charid:f,captcha_type:"login",captcha:h,expires_day:y?A:void 0,scene_id:s,...l.uidMailExtraParams})},onSuccess:A=>{i?.(A),e?.(A),a?.(A)},onError:A=>{c?.(A)}}),{mutate:T,isPending:I}=sn({mutationFn:()=>t?t({gameId:r,accountId:f}):tx({game_id:r,captcha_type:"login",charid:f,scene_id:s,...l.uidMailExtraParams}),onSuccess:A=>{S(),Ct.success(A.error)}});async function z(A){A.preventDefault(),x()}return re.useEffect(()=>{h.length===6&&f&&setTimeout(()=>{u.current?.requestSubmit()},0)},[h,f]),re.useEffect(()=>{C===0&&b(),E(C!==120)},[C,b]),w.jsxs(Ns,{ref:u,onSubmit:z,className:gt("space-y-6",wr.form),autoComplete:"off",children:[["5199","5012"].includes(r)?w.jsx("p",{className:"text-center text-xs text-white/80",children:"请点击游戏右上角“设置”查看账号ID"}):null,w.jsx(Cn,{name:"accountId",className:gt(wr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入账号 ID",autoFocus:!0,type:"tel",onChange:A=>d(A.currentTarget.value),prefix:w.jsx(e2,{content:w.jsx("div",{className:gt(wr.uidGet,l.uidGetterImageClassName)}),classNames:{backdrop:"z-[992]",positioner:"z-[992]",popup:gt("rounded-2xl shadow-lg",wr.uidGetPopup),arrow:wr.uidGetArrow,trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2"},children:w.jsx("span",{children:"!"})})}),w.jsx(Cn,{name:"verificationCode",className:gt(wr.inputControl,"bg-[var(--jssdk-input-bg-color)]"),inputClassName:"bg-inherit",placeholder:"请输入口令码",value:h,type:"tel",onValueChange:A=>m(A),prefix:w.jsx(Wr,{trigger:w.jsx("span",{children:"!"}),classNames:{trigger:"size-5 lg:size-6 lg:text-2xl rounded-full bg-[var(--jssdk-icon-color)] inline-flex items-center justify-center text-white focus:outline focus:outline-2",popup:"w-full lg:w-4/5 lg:max-w-5xl p-0 bg-transparent"},children:w.jsx("div",{className:gt(wr.mailCodeGet,l.mailCodeGetterImageClassName)})}),suffix:w.jsx("button",{type:"button",className:"enabled:text-[var(--jssdk-primary-color)] text-sm rounded-full h-4/6 px-2 enabled:hover:bg-[var(--jssdk-primary-color)] enabled:hover:text-[var(--jssdk-primary-foregroud-color)] inline-flex items-center disabled:cursor-not-allowed disabled:text-gray-500",onMouseDown:A=>{A.preventDefault()},onClick:()=>T(),disabled:g||I||!f,children:g?`${C}s`:I?"发送中...":"发送口令码"})}),o.enabled?w.jsx(Co,{name:"rememberLogin",children:w.jsxs(_d,{className:"flex items-center gap-2 text-gray-500",onMouseDown:A=>{A.preventDefault()},children:[w.jsx(td,{checked:y,className:"size-5 flex items-center justify-center rounded-full border-2 data-[checked]:border-[var(--jssdk-primary-color)] data-[unchecked]:border-gray-300",onCheckedChange:A=>v(!!A),children:w.jsx(nd,{children:w.jsx(Ba,{className:"size-3 text-[var(--jssdk-primary-color)]",strokeWidth:4})})}),w.jsxs("div",{children:[w.jsx("span",{className:"mr-0.5",children:o.days}),w.jsx("span",{children:"天内自动登录"})]})]})}):null,["5199","5012"].includes(r)?w.jsx("div",{className:"text-[#f59e9e] text-center text-[11px]",children:"请点击游戏内“邮件”查收口令码,未收到请重启游戏再次查看"}):null,w.jsx(js,{})]})}const Ht={quickLogin:"_quickLogin_1ibz1_1",quickAccounts:"_quickAccounts_1ibz1_5",selectedAccount:"_selectedAccount_1ibz1_9",accountInfo:"_accountInfo_1ibz1_21",accountName:"_accountName_1ibz1_26",arrow:"_arrow_1ibz1_31",arrowRotate:"_arrowRotate_1ibz1_37",accountList:"_accountList_1ibz1_41",listScroll:"_listScroll_1ibz1_49",accountItem:"_accountItem_1ibz1_58",active:"_active_1ibz1_77",itemName:"_itemName_1ibz1_81",itemInfo:"_itemInfo_1ibz1_86",deleteBtn:"_deleteBtn_1ibz1_97"};function t2(){const{gameId:e,onLoginSuccess:t,triggerRealNameAuth:n,setCurrentLoginType:r,defaultLoginType:o}=Nn(),[s,i]=re.useState([]),[a,c]=re.useState(null),[l,u]=re.useState(!1),[f,d]=re.useState(!1),[h,m]=re.useState(!1),[y,v]=re.useState(-1);re.useEffect(()=>{g()},[e]);const g=()=>{const x=zr(e);i(x),x.length>0?(!a||!x.find(T=>T.openid===a.openid))&&c(x[0]):c(null)},E=x=>{c(s[x]),u(!1)},C=(x,T)=>{x.stopPropagation(),v(T),m(!0)},S=()=>{const x=s[y];if(x){xf(x.openid,e);const T=zr(e);if(T.length===0){r(o);return}i(T),T.find(I=>I.openid===a?.openid)||c(T[0])}m(!1),v(-1)},b=async()=>{if(a){d(!0);try{gf(a.authorization);const x=await Qd(),T={account:x.account,entity:x.channel_info.entity,token:x.channel_info.token,sign:x.channel_info.sign,accid:x.channel_info.entity.openid,extra_data:x.channel_info.extra_data,gaplaySign:x.channel_info.gaplaySign,realname:x.channel_info.realname};if(Ts(T,a.authorization,e),T.realname&&T.realname.reject>=2){n();return}t?.(T)}catch(x){Ct.error(x?.detail),console.error("Quick login failed:",x)}finally{d(!1)}}};return s.length===0?null:w.jsxs("div",{className:Ht.quickLogin,children:[w.jsxs("div",{className:Ht.quickAccounts,children:[w.jsxs("div",{className:Ht.selectedAccount,onClick:()=>u(!l),children:[w.jsx("div",{className:Ht.accountInfo,children:w.jsx("span",{className:Ht.accountName,children:a?.username})}),w.jsx(Xd,{className:gt(Ht.arrow,l&&Ht.arrowRotate)})]}),l&&w.jsx("div",{className:Ht.accountList,children:w.jsx("div",{className:Ht.listScroll,children:s.map((x,T)=>w.jsxs("div",{className:gt(Ht.accountItem,x.openid===a?.openid&&Ht.active),onClick:()=>E(T),children:[w.jsx("div",{className:Ht.itemInfo,children:w.jsx("span",{className:Ht.itemName,children:x.username})}),w.jsx("div",{className:Ht.deleteBtn,onClick:I=>C(I,T),children:w.jsx(J1,{className:"size-4 text-gray-400 hover:text-red-500"})})]},x.openid))})})]}),w.jsx(zt,{className:"w-full h-10 mt-4 mb-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full shadow-lg",disabled:f,onClick:b,children:f?"登录中...":"登录"}),w.jsx(js,{}),w.jsx(Wr,{open:h,onOpenChange:m,showCloseIcon:!1,classNames:{popup:"w-[300px] p-6"},children:w.jsxs("div",{className:"text-center",children:[w.jsxs("div",{className:"mb-4",children:[w.jsx("p",{className:"text-base font-medium text-gray-900",children:"是否确认删除该条账号登录记录?"}),w.jsx("p",{className:"text-xs text-gray-500 mt-2",children:"删除后登录记录将不会保存。"})]}),w.jsxs("div",{className:"flex gap-3 mt-6",children:[w.jsx(zt,{className:"flex-1 h-9 border border-gray-300 rounded-full text-gray-600",onClick:()=>m(!1),children:"取消"}),w.jsx(zt,{className:"flex-1 h-9 bg-gradient-to-r from-[#497efe] to-[#947afa] text-white rounded-full",onClick:S,children:"确认删除"})]})]})})]})}const n2=ic({name:Yr().refine(e=>e.length>=1,{error:"请输入真实姓名",abort:!0}).refine(e=>/^[\u4e00-\u9fa5]{2,6}$/.test(e),{error:"姓名须由 2-6 个汉字组成",abort:!0}),idcard:Yr().refine(e=>e.length>=1,{error:"请输入身份证号",abort:!0}).refine(e=>/^\d{17}(\d|X|x)$/.test(e),{error:"身份证号格式不正确",abort:!0})});function r2(){const{gameId:e,onLoginSuccess:t,onAccountLoginSuccess:n,onPhoneLoginSuccess:r,showRealNameModal:o,setShowRealNameModal:s,onClose:i}=Nn(),[a,c]=p.useState({}),{mutate:l,isPending:u}=sn({mutationFn:async d=>{const m=zr(e)[0];if(!m)throw new Error("未找到登录账号信息");await ix({uid:m.uid,authorization:m.authorization,name:d.name,idcard:d.idcard});const y=await ax(m.authorization),v={account:y.account,entity:y.channel_info.entity,token:y.channel_info.token,sign:y.channel_info.sign,accid:y.channel_info.entity.openid,extra_data:y.channel_info.extra_data,gaplaySign:y.channel_info.gaplaySign,realname:y.channel_info.realname};Ct.success("实名认证成功"),s(!1),v.account?.mobile?r?.(v):n?.(v),t?.(v)},onError:d=>{Ct.error(d.message||"实名认证失败")}}),f=d=>{const h=n2.safeParse(d);if(!h.success){c(Oo(h.error).fieldErrors);return}c({}),l(h.data)};return w.jsxs(Wr,{open:o,onOpenChange:s,title:"实名认证",showCloseIcon:!1,disablePointerDismissal:!0,classNames:{popup:"w-[400px] p-6 rounded-2xl",title:"text-center text-xl mb-3"},children:[w.jsx("div",{className:"text-sm text-gray-500 mb-6 text-center",children:"根据《关于防止未成年人沉迷网络游戏的通知》,游戏用户需使用有效身份证进行实名认证。"}),w.jsxs(Ns,{onFormSubmit:f,errors:a,className:"space-y-4",children:[w.jsxs(Co,{name:"name",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Za,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的真实姓名"})}),w.jsx(Ha,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsxs(Co,{name:"idcard",children:[w.jsx("div",{className:"flex items-center border border-gray-300 rounded-full px-4 h-12 focus-within:border-[#787bf4] transition-colors",children:w.jsx(Za,{className:"flex-1 outline-none text-base bg-transparent",placeholder:"请输入您的身份证号",maxLength:18})}),w.jsx(Ha,{className:"mt-1 ml-2 text-xs text-red-500"})]}),w.jsx(zt,{type:"submit",className:"w-full h-12 mt-6 text-white bg-gradient-to-r from-[#497efe] to-[#947afa] rounded-full font-bold shadow-lg disabled:opacity-50",disabled:u,children:u?"提交中...":"提交认证"}),w.jsx("button",{type:"button",className:"w-full mt-4 text-sm text-gray-400 hover:text-gray-600 transition-colors",onClick:i,children:"退出游戏"})]})]})}const eh={modal:"_modal_1pbx2_2",close:"_close_1pbx2_8"},ti={autoLoginHint:"_autoLoginHint_h58ls_1",left:"_left_h58ls_22",loading:"_loading_h58ls_28",switchBtn:"_switchBtn_h58ls_37"};function o2({onSwitch:e}){const{autoLoginAccountName:t,setIsAutoLoggingIn:n}=Nn(),r=()=>{n(!1),e()};return w.jsxs("div",{className:ti.autoLoginHint,children:[w.jsxs("div",{className:ti.left,children:[w.jsx("div",{className:ti.loading}),w.jsxs("span",{children:[t," 正在登录..."]})]}),w.jsx("button",{className:ti.switchBtn,onClick:r,children:"切换账号"})]})}function s2({open:e,onOpenChange:t}){const{gameId:n,loginTypes:r,currentLoginType:o,closeable:s,isShowGiantLogo:i,onLoginSuccess:a,triggerRealNameAuth:c,showRealNameModal:l,setIsAutoLoggingIn:u,setAutoLoginAccountName:f}=Nn(),[d,h]=re.useState(!1),m=re.useMemo(()=>zr(n),[n,e]),y=e&&m.length>0&&!d;re.useEffect(()=>{if(!e){h(!1),u(!1);return}if(y){const C=m[0];(async()=>{if(!C){h(!0);return}u(!0),f(C.username);try{gf(C.authorization);const b=await Qd(),x={account:b.account,entity:b.channel_info.entity,token:b.channel_info.token,sign:b.channel_info.sign,accid:b.channel_info.entity.openid,extra_data:b.channel_info.extra_data,gaplaySign:b.channel_info.gaplaySign,realname:b.channel_info.realname};if(Ts(x,C.authorization,n),x.realname&&x.realname.reject>=2){u(!1),h(!0),c();return}u(!1),h(!0),t?.(!1),a?.(x)}catch(b){console.error("Auto quick login failed:",b),u(!1),h(!0)}})()}},[e,n,y]);const v=vf({loginTypes:r,gameId:n}),g=bf({loginTypes:r,gameId:n}),E=yf({loginTypes:r,gameId:n});return w.jsxs(w.Fragment,{children:[y&&w.jsx(o2,{onSwitch:()=>h(!0)}),w.jsxs(Wr,{open:e&&!y&&!l,onOpenChange:t,classNames:{popup:gt("w-[400px] p-5",eh.modal),close:eh.close,backdrop:"!bg-[var(--jssdk-backdrop-bg-color,rgba(0,0,0,0.7))]"},showCloseIcon:s,children:[i&&!fw(n)&&w.jsx("section",{className:"flex items-center justify-center mb-6",children:w.jsx("img",{src:n==="5327"?"https://cdn-imgs.sdk.mobileztgame.com/paycenter/260511150749961295.png":"https://h5.sdk.mobileztgame.com/dist/bg_logo.png",className:"aspect-[240/85] w-32"})}),w.jsxs("section",{children:[o==="quick"&&w.jsx(t2,{}),o===at.MOBILE&&g&&w.jsx(Jp,{}),o===at.ROLE_ID&&v&&w.jsx(Qp,{}),o===at.GIANT&&E&&w.jsx(KT,{})]})]}),w.jsx(r2,{})]})}class i2 extends re.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t){console.error("[Login SDK] Uncaught error:",t)}render(){return this.state.hasError?null:this.props.children}}function cc({open:e,onOpenChange:t,sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:i,onLoginError:a,closeable:c=!0,mountToaster:l=!0,toastConfigs:u,...f}){const[d]=re.useState(()=>new Mh);return w.jsxs(re.StrictMode,{children:[w.jsx(Nh,{client:d,children:w.jsx(kf,{value:{sceneId:n,onPhoneLoginSuccess:r,onAccountLoginSuccess:o,onUidLoginSuccess:s,onLoginSuccess:h=>{ww(vw({gameId:dr(f.gameId),serverUserInfo:h})),i?.(h)},onLoginError:a,closeable:c,onClose:()=>t?.(!1),...f},children:w.jsx(i2,{children:w.jsx(s2,{open:e,onOpenChange:t})})})}),l&&w.jsx(aw,{toastConfigs:u})]})}const th=e=>Sa(dr(e)),nh=e=>bw(dr(e)),rh=e=>!!Sa(dr(e));function oh({loginTypes:e,defaultLoginType:t,gameId:n,styleVars:r,onLoginSuccess:o,onLoginError:s}){const i=dr(n);if(document.querySelector(".login-sdk-container"))return console.warn("Login component is already active. Multiple instances are not allowed."),{close:()=>{}};const a=document.createElement("div");a.className="login-sdk-container",document.body.appendChild(a);const c=ah.createRoot(a),l=()=>{setTimeout(()=>{c.unmount(),a.remove()},200)},u=()=>{c.render(w.jsx(cc,{gameId:i,loginTypes:e,defaultLoginType:t,styleVars:r,open:!1,onOpenChange:f,onLoginSuccess:o,onLoginError:s})),l()},f=d=>{d||u()};return c.render(w.jsx(cc,{gameId:i,loginTypes:e,defaultLoginType:t,styleVars:r,open:!0,onOpenChange:f,onLoginSuccess:o,onLoginError:s})),{close:u}}const a2={init:Cf,login:oh,logout:nh,getUserInfo:th,isLoggedIn:rh};yt.ConfigProvider=kf,yt.Login=cc,yt.MobileLogin=Jp,yt.SDK=a2,yt.UidLogin=Qp,yt.getGameId=dr,yt.getUserInfo=th,yt.init=Cf,yt.isLoggedIn=rh,yt.login=oh,yt.logout=nh,Object.defineProperty(yt,Symbol.toStringTag,{value:"Module"})}));
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gup-fe/js-sdk",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.5.0",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"vite-plugin-dts": "^4.5.4",
|
|
59
59
|
"@gup-fe/lib": "1.0.0",
|
|
60
60
|
"@gup-fe/tailwind-config": "0.0.0",
|
|
61
|
-
"@gup-fe/typescript-config": "0.0.0",
|
|
62
61
|
"@gup-fe/ui": "1.0.0",
|
|
62
|
+
"@gup-fe/typescript-config": "0.0.0",
|
|
63
63
|
"@gup-fe/eslint-config": "0.0.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|