1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4665],{3626:function(e,t,r){Promise.resolve().then(r.t.bind(r,1749,23)),Promise.resolve().then(r.t.bind(r,5250,23)),Promise.resolve().then(r.bind(r,4429)),Promise.resolve().then(r.bind(r,5654)),Promise.resolve().then(r.bind(r,6173)),Promise.resolve().then(r.bind(r,5623))},5654:function(e,t,r){"use strict";r.r(t);var n=r(7437),o=r(7208),a=r(3293),s=r(7380),i=r(2763),l=r(1237),c=r(846),u=r(9134),d=r(7496),f=r(3771),h=r(1396),m=r.n(h),p=r(4033),g=r(2265);let w={Authorization:"srfRyLxGZahkzJJQKrWopXjgMpeiaerjoNIbVeVnfXiMMlOmKZwPkgiCdyHmwVpUXxIammzZQMPSieqt=="};t.default=()=>{let[e,t]=(0,g.useState)(""),[r,h]=(0,g.useState)(""),[b,v]=(0,g.useState)("email"),[x,y]=(0,g.useState)(""),[S,k]=(0,g.useState)(!1),[j,C]=(0,g.useState)(!1),[N,E]=(0,g.useState)(null),[$,P]=(0,g.useState)(null),[_,I]=(0,g.useState)(null),[L,z]=(0,g.useState)(null),[W,Z]=(0,g.useState)(void 0),[R,O]=(0,g.useState)(!1),A=(0,p.useRouter)(),{setToken:U,setUserEmail:T,setUserId:J,setIsSocial:M,setMessage:q,setMessageType:D,setPlatform:F,setExpirationDate:H}=(0,c.default)();(0,g.useEffect)(()=>{let e=new URLSearchParams(window.location.search);E(e.get("id")),P(e.get("source")),I(e.get("state")),z(e.get("redirect"))},[]);let V="https://stripe.vpn-duo.com/users/sign-in",B=new URLSearchParams;$&&B.append("source",$),N&&B.append("id",N);let X=B.toString();X&&(V+=`?${X}`);let{fetchData:K,loading:Q}=(0,u.Z)(V,{manual:!0,fetchOptions:{method:"POST",headers:{...w}}}),G=async t=>{t.preventDefault(),y(""),k(!1),C(!0);try{let t=await fetch("https://stripe.vpn-duo.com/users/login-check",{method:"POST",headers:{"Content-Type":"application/json",...w},body:JSON.stringify({email:e})}),r=await t.json();r?.code==="password_required"?v("password"):r?.code==="set_password_required"?A.push(`/login/check-email?email=${encodeURIComponent(e)}`):r?.code==="account_not_found"?k(!0):y(r?.message||"Something went wrong. Please try again.")}catch{y("Something went wrong. Please try again.")}finally{C(!1)}},Y=async t=>{t.preventDefault();let n=new FormData;n.append("email",e),n.append("password",r);let o=await K(void 0,{body:n});if(o?.data){if(200===o.status){let{token:e}=o.data,t=(0,f.o)(e);if(T(t?.email),U(e),J(t?.userId),M(t?.isSocial??!1),F(t?.platform),H(t?.expirationDate),"vpn-duo-desktop"===$){Z(t?.name),O(!0);let r=new URLSearchParams({token:e});_&&r.append("state",_),window.location.href=`vpn-duo-vpn://login-success?${r.toString()}`}else"firefox-extension"===$?A.push(`/extension-callback?token=${e}`):$&&N?window.location.href=`${$}://${N}/callback.html?token=${e}`:A.push((0,d.u)(L)?L:"/dashboard")}else{let e=o.data?.code==="set_password_required";q(o.data?.message),D(200===o.status||e?"success":"error")}}};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Z,{open:R,name:W}),(Q||j)&&(0,n.jsx)("div",{className:"fixed inset-0 z-[9999] flex items-center justify-center bg-black/50 backdrop-blur-[2px]",children:(0,n.jsx)(l.Z,{})}),"email"===b?(0,n.jsxs)("form",{className:"mt-4",onSubmit:G,children:[(0,n.jsx)(i.Z,{id:"email",type:"email",placeholder:"Enter your email",label:"Email",value:e,onChange:e=>{t(e.target.value),x&&y(""),S&&k(!1)},isRequired:!0,errorMessage:x}),S&&(0,n.jsxs)("p",{className:"mb-3 rounded-control border border-danger/40 bg-danger/10 p-3 text-sm text-danger",role:"alert",children:["We couldn't find an account with that email."," ",(0,n.jsx)(m(),{href:"/register",className:"underline font-medium",children:"Create one"}),"."]}),(0,n.jsx)(a.Z,{loading:!1,className:"w-full",type:"submit",loadingTitle:"Checking...",children:"Continue"})]}):(0,n.jsxs)("form",{className:"mt-4",onSubmit:Y,children:[(0,n.jsxs)("div",{className:"mb-3 md:mb-4 flex items-center justify-between gap-3 rounded-control border-2 border-white/10 bg-surface px-3.5 py-3",children:[(0,n.jsx)("span",{className:"truncate text-base text-textColor",children:e}),(0,n.jsx)("button",{type:"button",onClick:()=>{v("email"),h("")},className:"shrink-0 text-sm underline text-muted hover:text-heading",children:"Change"})]}),(0,n.jsx)(s.Z,{id:"password",placeholder:"Enter your password",label:"Password",onChange:e=>h(e.target.value),isRequired:!0}),(0,n.jsx)(a.Z,{loading:!1,className:"w-full",type:"submit",loadingTitle:"Logging In...",children:"Login"})]})]})}},3293:function(e,t,r){"use strict";var n=r(7437),o=r(9757);r(2265);var a=r(4864);t.Z=e=>{let{children:t,className:r,loading:s,loadingTitle:i="loading",...l}=e;return(0,n.jsx)("button",{className:(0,o.cn)("group relative isolate inline-flex items-center justify-center gap-2 overflow-hidden rounded-control border-2 border-accent bg-accent px-4 py-2 text-base md:text-lg font-semibold text-white transition-all duration-200","hover:bg-accentHover hover:border-accentHover hover:shadow-[0_0_20px_rgba(59,130,246,0.35)] active:scale-[0.97] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-accentLight","disabled:cursor-not-allowed disabled:opacity-60 disabled:hover:bg-accent disabled:hover:border-accent disabled:hover:shadow-none disabled:active:scale-100","before:pointer-events-none before:absolute before:inset-0 before:-translate-x-full before:bg-gradient-to-r before:from-transparent before:via-white/25 before:to-transparent before:transition-transform before:duration-700 before:ease-out hover:before:translate-x-full",r),disabled:s,...l,children:(0,n.jsx)("span",{className:"relative z-10 inline-flex items-center justify-center gap-2",children:s?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(a.Ap,{})," ",i]}):t})})}},4864:function(e,t,r){"use strict";r.d(t,{Ap:function(){return o},JO:function(){return a},jR:function(){return s}});var n=r(7437),o=e=>(0,n.jsxs)("svg",{className:"animate-spin -ml-1 mr-3 h-5 w-5 text-white",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...e,children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),a=e=>{let{as:t,size:r=20,strokeWidth:o=1.5,className:a}=e;return(0,n.jsx)(t,{size:r,strokeWidth:o,className:a})},s=e=>(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",fill:"
1currentColor","aria-hidden":"true",...e,children:(0,n.jsx)("path",{d:"M12.504 0c-.155 0-.315.008-.48.021-4.226.333-3.105 4.807-3.17 6.298-.076 1.092-.3 1.953-1.05 3.02-.885 1.051-2.127 2.75-2.716 4.521-.278.832-.41 1.684-.287 2.489a.424.424 0 00-.11.135c-.26.268-.45.6-.663.839-.199.199-.485.267-.797.4-.313.136-.658.269-.864.68-.09.189-.136.394-.132.602 0 .199.027.4.055.6.058.399.116.777.04 1.02-.249.68-.28 1.145-.106 1.484.174.334.535.47.94.601.81.2 1.91.135 2.774.6.926.466 1.866.67 2.616.47.526-.116.97-.464 1.208-.946.587-.003 1.23-.269 2.26-.334.699-.058 1.574.267 2.577.2.025.134.063.198.114.333l.003.003c.391.778 1.113 1.132 1.884 1.071.771-.06 1.592-.536 2.257-1.306.631-.765 1.683-1.084 2.378-1.503.348-.199.629-.469.649-.853.023-.4-.2-.811-.714-1.376v-.097l-.003-.003c-.17-.2-.25-.535-.338-.926-.085-.401-.182-.786-.492-1.046h-.003c-.059-.054-.123-.067-.188-.135a.357.357 0 00-.19-.064c.431-1.278.264-2.55-.173-3.694-.533-1.41-1.465-2.638-2.175-3.483-.796-1.005-1.576-1.957-1.56-3.368.026-2.152.236-6.133-3.544-6.139z"})})},846:function(e,t,r){"use strict";r.r(t),r.d(t,{LoginProvider:function(){return l},default:function(){return c}});var n=r(7437),o=r(2265);function a(e,t){let[r,n]=(0,o.useState)(t),[a,s]=(0,o.useState)(!1);return(0,o.useEffect)(()=>{try{let t=window.localStorage.getItem(e);null!==t&&"undefined"!==t&&"null"!==t&&n(JSON.parse(t))}catch(t){console.error(`Error reading localStorage key "${e}":`,t),window.localStorage.removeItem(e)}s(!0)},[e]),(0,o.useEffect)(()=>{if(a)try{void 0===r?window.localStorage.removeItem(e):window.localStorage.setItem(e,JSON.stringify(r))}catch(t){console.error(`Error writing to localStorage key "${e}":`,t)}},[e,r,a]),[r,t=>{try{let e=t instanceof Function?t(r):t;n(e)}catch(t){return console.error(`Error setting localStorage key "${e}":`,t),t}}]}var s=r(3771);let i=(0,o.createContext)(null),l=e=>{let{children:t}=e,[r,l]=a("authToken",null),[c,u]=a("email",null),[d,f]=a("userId",null),[h,m]=a("isSocial",null),[p,g]=a("platform",null),[w,b]=a("expirationDate",null),[v,x]=(0,o.useState)(null),[y,S]=(0,o.useState)(null),[k,j]=(0,o.useState)(!1);(0,o.useEffect)(()=>{j(!0)},[]);let C=!!r,N=(0,o.useCallback)(()=>{l(null),u(null),m(null),f(null),x(null),S(null),g(null)},[l,u,m,f,x,S,g]);return(0,o.useEffect)(()=>{if(r)try{let e=(0,s.o)(r);if(e.exp){let t=1e3*e.exp-Date.now();if(t<=0)N();else{let e=setTimeout(()=>{N()},t);return()=>clearTimeout(e)}}}catch(e){N()}},[r,N]),(0,n.jsx)(i.Provider,{value:{isLoggedIn:C,authHydrated:k,token:r,setToken:l,userEmail:c,setUserEmail:u,message:v,setMessage:x,messageType:y,setMessageType:S,userId:d,setUserId:f,logout:N,isSocial:h,setIsSocial:m,platform:p,setPlatform:g,expirationDate:w,setExpirationDate:b},children:t})};function c(){let e=(0,o.useContext)(i);if(!e)throw Error("useLoginContext must be used inside LoginProvider");return e}},9757:function(e,t,r){"use strict";r.d(t,{cn:function(){return a}});var n=r(7042),o=r(4769);function a(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,o.m6)((0,n.W)(t))}},7496:function(e,t,r){"use strict";r.d(t,{u:function(){return o}});let n=["/login","/register","/verify-email","/forgot-password","/forget-password-reset","/reset-password","/set-password"];function o(e){if(!e||"string"!=typeof e||!e.startsWith("/")||e.startsWith("//")||e.startsWith("/\\"))return!1;let t=e.split("?")[0].split("#")[0];if(n.some(e=>t===e||t.startsWith(`${e}/`)))return!1;try{return new URL(e,window.location.origin).origin===window.location.origin}catch{return!1}}},4033:function(e,t,r){e.exports=r(5313)},3771:function(e,t,r){"use strict";r.d(t,{o:function(){return o}});class n extends Error{}function o(e,t){let r;if("string"!=typeof e)throw new n("Invalid token specified: must be a string");t||(t={});let o=!0===t.header?0:1,a=e.split(".")[o];if("string"!=typeof a)throw new n(`Invalid token specified: missing part #${o+1}`);try{r=function(e){let t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw Error("base64 string is not of the correct length")}try{var r;
1return r=t,decodeURIComponent(atob(r).replace(/(.)/g,(e,t)=>{let r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}catch(e){return atob(t)}}(a)}catch(e){throw new n(`Invalid token specified: invalid base64 for part #${o+1} (${e.message})`)}try{return JSON.parse(r)}catch(e){throw new n(`Invalid token specified: invalid json for part #${o+1} (${e.message})`)}}n.prototype.name="InvalidTokenError"},8792:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return c}});var n=r(2265),o={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** 2 * @license lucide-react v1.24.0 - ISC 3 * 4 * This source code is licensed under the ISC license. 5 * See the LICENSE file in the root directory of this source tree. 6 */let a=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1};var s=r(2963);/** 7 * @license lucide-react v1.24.0 - ISC 8 * 9 * This source code is licensed under the ISC license. 10 * See the LICENSE file in the root directory of this source tree. 11 */let i=(0,n.createContext)({}),l=()=>(0,n.useContext)(i),c=(0,n.forwardRef)(({color:e,size:t,strokeWidth:r,absoluteStrokeWidth:i,className:c="",children:u,iconNode:d,...f},h)=>{let{size:m=24,strokeWidth:p=2,absoluteStrokeWidth:g=!1,color:w="currentColor",className:b=""}=l()??{},v=i??g?24*Number(r??p)/Number(t??m):r??p;return(0,n.createElement)("svg",{ref:h,...o,width:t??m??o.width,height:t??m??o.height,stroke:e??w,strokeWidth:v,className:(0,s.z)("lucide",b,c),...!u&&!a(f)&&{"aria-hidden":"true"},...f},[...d.map(([e,t])=>(0,n.createElement)(e,t)),...Array.isArray(u)?u:[u]])})},5582:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(2265),o=r(2963);/** 12 * @license lucide-react v1.24.0 - ISC 13 * 14 * This source code is licensed under the ISC license. 15 * See the LICENSE file in the root directory of this source tree. 16 */let a=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),s=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),i=e=>{let t=s(e);return t.charAt(0).toUpperCase()+t.slice(1)};var l=r(8792);/** 17 * @license lucide-react v1.24.0 - ISC 18 * 19 * This source code is licensed under the ISC license. 20 * See the LICENSE file in the root directory of this source tree. 21 */let c=(e,t)=>{let r=(0,n.forwardRef)(({className:r,...s},c)=>(0,n.createElement)(l.default,{ref:c,iconNode:t,className:(0,o.z)(`lucide-${a(i(e))}`,`lucide-${e}`,r),...s}));return r.displayName=i(e),r}},2963:function(e,t,r){"use strict";r.d(t,{z:function(){return n}});/** 22 * @license lucide-react v1.24.0 - ISC 23 * 24 * This source code is licensed under the ISC license. 25 * See the LICENSE file in the root directory of this source tree. 26 */let n=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()}},function(e){e.O(0,[5250,7895,1749,6032,2971,4938,1744],function(){return e(e.s=3626)}),_N_E=e.O()}]);
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.