1/*! LICENSE: 4661.774fbc840c.js.LICENSE.txt */ 2"use strict";(self.rspackChunknewapi_web=self.rspackChunknewapi_web||[]).push([[4661],{97140(e,s,r){var t=r(72361),n=r(71114),o=r(6702),a=r(97785),i=r(57129);function l(e){let{children:s}=e,{t:r}=(0,o.Bd)(),{systemName:l,logo:c,loading:d}=(0,i.R)();return(0,t.jsxs)("div",{className:"relative grid h-svh max-w-none",children:[(0,t.jsxs)(n.N_,{to:"/",className:"absolute top-4 left-4 z-10 flex items-center gap-2 transition-opacity hover:opacity-80 sm:top-8 sm:left-8",children:[(0,t.jsx)("div",{className:"relative h-8 w-8",children:d?(0,t.jsx)(a.E,{className:"absolute inset-0 rounded-full"}):(0,t.jsx)("img",{src:c,alt:r("Logo"),className:"h-8 w-8 rounded-full object-cover"})}),d?(0,t.jsx)(a.E,{className:"h-6 w-24"}):(0,t.jsx)("h1",{className:"text-xl font-medium",children:l})]}),(0,t.jsx)("div",{className:"container flex items-center pt-16 sm:pt-0",children:(0,t.jsx)("div",{className:"mx-auto flex w-full flex-col justify-center space-y-2 px-4 py-8 sm:w-[480px] sm:p-8",children:s})})]})}r.d(s,{D:()=>l})},12370(e,s,r){var t=r(25732);let n=t.Ik({username:t.Yj().min(1,"Please enter your username or email"),password:t.Yj().min(1,"Please enter your password")}),o=t.Ik({username:t.Yj().min(1,"Please enter your username"),email:t.Yj().optional(),password:t.Yj().min(1,"Please enter your password").min(8,"Password must be between 8 and 20 characters").max(20,"Password must be at most 20 characters long"),confirmPassword:t.Yj().min(1,"Please confirm your password")}).refine(e=>e.password===e.confirmPassword,{message:"Passwords don't match.",path:["confirmPassword"]}),a=t.Ik({email:t.Yj().email({message:"Please enter a valid email address"})}),i=t.Ik({otp:t.Yj().min(1,"Please enter a code.")});r.d(s,{},{RW:/^[A-Z0-9]{4}-[A-Z0-9]{4}$/i,Ru:o,ar:a,bg:i,eK:"oauth:binding:callback",eX:/^\d{6}$/,ni:n,oP:"telegram:binding:result",qr:"oauth:binding:result"})},29607(e,s,r){var t=r(12370);let n={schedule:(e,s)=>globalThis.setTimeout(e,s),cancel:e=>globalThis.clearTimeout(e)},o={schedule:(e,s)=>globalThis.setInterval(e,s),cancel:e=>globalThis.clearInterval(e)};function a(e){return"success"!==e.telegram_bind&&"error"!==e.telegram_bind?null:e.flow_token?"success"===e.telegram_bind?{kind:"result",flowToken:e.flow_token,success:!0}:{kind:"result",flowToken:e.flow_token,success:!1,code:e.error_code}:{kind:"invalid"}}function i(e,s,r){return e?.kind==="result"&&!!s&&!s.closed&&(s.postMessage({type:t.oP,flow_token:e.flowToken,success:e.success,code:e.code},r),!0)}function l(e){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3e4,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:n,t=!0,o=r.schedule(()=>{t&&(t=!1,e())},s);return()=>{t&&(t=!1,r.cancel(o))}}function c(e,s){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:500,t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o,n=!0,a=t.schedule(()=>{n&&e.closed&&(n=!1,t.cancel(a),s())},r);return()=>{n&&(n=!1,t.cancel(a))}}r.d(s,{AC:()=>i,HK:()=>c,cG:()=>l,r0:()=>a})},13636(e,s,r){let t="oauth_bind_flow:";function n(e){try{return e?.sessionStorage??null}catch{return null}}function o(e,s,r){if(!e||!s||!r)return!1;try{let n=`${t}${s}`;return e.setItem(n,r),e.getItem(n)===r}catch{return!1}}function a(e,s,r){let{opener:n,storage:o}=r;if(!n||n.closed||!o||!s)return"login";let a=null;try{a=o.getItem(`${t}${e}`)}catch{return"login"}return a===s?"bind":"login"}r.d(s,{Vf:()=>n,aX:()=>o,ab:()=>a})},99092(e,s,r){r.r(s),r.d(s,{component:()=>N});var t=r(72361),n=r(82799),o=r(17034),a=r(45064),i=r(19376),l=r(68413),c=r(20598),d=r(63881),u=r(38384),m=r(83940),w=r(55724),h=r(6702),f=r(6433),g=r(97140);let p={github:{label:"GitHub",Icon:e=>(0,t.jsx)(f.SiGithub,{className:e.className,focusable:"false"})},oidc:{label:"OIDC",Icon:d.A},linuxdo:{label:"LinuxDO",Icon:e=>(0,t.jsx)(f.SiLinux,{className:e.className,focusable:"false"})},telegram:{label:"Telegram",Icon:u.A},wechat:{label:"WeChat",Icon:e=>(0,t.jsx)(f.SiWechat,{className:e.className,focusable:"false"})}};function x(e){let{provider:s,mode:r}=e,{t:n}=(0,h.Bd)(),{label:o,Icon:a}=(0,l.useMemo)(()=>p[s?.toLowerCase()??""]||{label:"account",Icon:m.A},[s]),i=n(o),c="bind"===r,d=n(c?"Binding your {{provider}} account":"Signing you in with {{provider}}",{provider:i}),u=n(c?"Hang tight while we securely link this account to your profile.":"Hang tight while we finish connecting your account."),f=n(c?"You can close this tab once the binding completes or a success message appears in the original window.":"You'll be redirected automatically. You can return to the previous page if nothing happens after a few seconds.");return(0,t.jsx)(g.D,{children:(0,t.jsxs)("div",{className:"w-full space-y-8",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center space-y-4 text-center",children:[(0,t.jsx)("div",{className:"bg-muted flex h-16 w-16 items-center justify-center rounded-2xl",children:(0,t.jsx)(a,{className:"h-8 w-8"})}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("h2",{className:"text-center text-2xl font-semibold tracking-tight",children:d}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm sm:text-base",children:u})]})]}),(0,t.jsxs)("div",{className:"space-y-4 text-center",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-2 text-sm font-medium",children:[(0,t.jsx)(w.A,{className:"h-4 w-4 animate-spin"}),(0,t.jsx)("span",{children:n("Processing OAuth response...")})]}),(0,t.jsx)("p",{className:"text-muted-foreground text-sm",children:f}),(0,t.jsx)("p",{className:"text-muted-foreground text-xs",children:n("This may take a few moments while we validate the request and update your session.")})]})]})})}var y=r(12370),b=r(21798),v=r(29607),j=r(13636),k=r(22990),A=r(46006);function N(){let e=(0,n.Z)(),{provider:s}=(0,o.g)({from:"/oauth/$provider"}),r=(0,a.S)({from:"/oauth/$provider"}),d=r.state??"",u="telegram"===s&&("success"===r.telegram_bind||"error"===r.telegram_bind),m="login";return u?m="bind":"u">typeof window&&(m=(0,j.ab)(s,d,{opener:window.opener,storage:(0,j.Vf)(window)})),(0,l.useEffect)(()=>
2{if("u"<typeof window)return;let t=r.code??"",n="telegram"===s?(0,v.r0)({telegram_bind:r.telegram_bind,flow_token:r.flow_token,error_code:r.error_code}):null;if(n){let e=window.opener;if(!(0,v.AC)(n,e,window.location.origin)){c.oR.error(i.Ay.t("Telegram binding failed. Please try again."));let e=window.setTimeout(()=>window.close(),1500);return()=>window.clearTimeout(e)}return void window.close()}if("bind"===m){let e,n=window.opener;if(!n||n.closed)return void c.oR.error(i.Ay.t("OAuth binding window is no longer available"));let o=()=>void 0,a=r=>{if(r.origin!==window.location.origin||r.source!==n)return;let t=r.data;if(t&&t.type===y.qr&&t.provider===s&&t.state===d){if(o(),t.success){c.oR.success(i.Ay.t("Binding successful!")),window.close();return}c.oR.error(t.message||i.Ay.t("OAuth failed")),e=window.setTimeout(()=>window.close(),1500)}};return window.addEventListener("message",a),o=(0,v.cG)(()=>{c.oR.error(i.Ay.t("OAuth binding timed out. Please try again.")),e=window.setTimeout(()=>window.close(),1500)}),n.postMessage({type:y.eK,provider:s,code:t,state:d,error:r.error,errorDescription:r.error_description},window.location.origin),()=>{window.removeEventListener("message",a),o(),void 0!==e&&window.clearTimeout(e)}}let o=function(s){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"/dashboard";e({href:(0,b.r)(s,window.location.origin)??r,replace:!0})};if(!t&&!r.error){c.oR.error(i.Ay.t("Missing code")),o("/sign-in","/sign-in");return}(async()=>{try{let e={params:{code:t||void 0,state:d,error:r.error,error_description:r.error_description},skipBusinessError:!0},n=await k.FH.get(`/api/oauth/${s}`,e);if(n.data?.success&&(0,k.lV)(n.data?.data)){(0,k.F4)(n.data.data),o(r.redirect),c.oR.success(i.Ay.t("Signed in successfully!"));return}let a=(0,A.I)(n.data);c.oR.error(a?i.Ay.t(a):n.data?.message||i.Ay.t("OAuth failed"))}catch(r){let e=(0,A.I)(r),s=r.response?.data?.message;e||c.oR.error(s||(r instanceof Error?r.message:i.Ay.t("OAuth failed")))}o("/sign-in","/sign-in")})()},[d,m,e,s,r.code,r.error,r.error_code,r.error_description,r.flow_token,r.redirect,r.telegram_bind]),(0,t.jsx)(x,{provider:s,mode:m})}},38384(e,s,r){let t=(0,r(9781).A)("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);r.d(s,{},{A:t})},63881(e,s,r){let t=(0,r(9781).A)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);r.d(s,{},{A:t})},83940(e,s,r){let t=(0,r(9781).A)("user-round",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);r.d(s,{},{A:t})}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.