1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1521],{1521:function(e,s,a){a.r(s),a.d(s,{default:function(){return b}});var l=a(5893),n=a(3645),i=a.n(n),r=a(1302),o=a(726),t=a(6312),c=a(1604),d=a(4177),m=a(4352),u=a(7536),x=a(1664),h=a.n(x),p=a(4150),j=a(6738),f=a(6501),g=a(5158);let w=async(e,s)=>{try{let n={method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)},i=await fetch("".concat("https://dev-api-cms.kmbmedia.id","/api/audience/register"),n),r=await i.json();if("user has been attached to audience"===r.message)f.Am.error("Akun sudah terdaftar",{position:"top-right"});else if(401===i.status)f.Am.error(r.error[0].message,{position:"top-right"});else if(200===i.status||201===i.status){var a,l;localStorage.setItem("token",window.btoa("".concat(null==r?void 0:null===(a=r.data)||void 0===a?void 0:a.token))),localStorage.setItem("session_id",window.btoa("".concat(null==r?void 0:null===(l=r.data)||void 0===l?void 0:l.session_id))),s?window.location.replace("/".concat(s)):window.location.replace("/")}}catch(e){f.Am.error(e.message,{position:"top-right"})}};var v=a(3463);let N=c.Ry({username:c.Z_().min(4),fullname:c.Z_().min(4),email:c.Z_().email(),password:c.Z_().min(8),password_confirmation:c.Z_().min(8)}).refine(e=>e.password===e.password_confirmation,{message:"Password tidak cocok.",path:["password_confirmation"]});function b(){let{recentlyRead:e}=(0,j.b)(),{isLoading:s,setIsLoading:a}=(0,g.Z)(),{isLoading:n,setIsLoading:c}=(0,g.Z)(),x=(0,u.cI)({resolver:(0,t.F)(N),defaultValues:{username:"",fullname:"",email:"",password:"",password_confirmation:""}}),b=async s=>{a(!0);try{let a={...s,portal_id:p.Im};await w(a,e)}catch(e){console.log(e)}finally{a(!1)}},y=async s=>{c(!0);try{var a,l,n,i;let r={username:null==s?void 0:null===(a=s.profileObj)||void 0===a?void 0:null===(l=a.name)||void 0===l?void 0:l.replaceAll(" ",""),email:null==s?void 0:null===(n=s.profileObj)||void 0===n?void 0:n.email,fullname:null==s?void 0:null===(i=s.profileObj)||void 0===i?void 0:i.name,portal_id:p.Im,gmail_id:null==s?void 0:s.googleId};await (0,v.Z)(r,e)}catch(e){console.log(e)}finally{c(!1)}};return(0,l.jsxs)(d.Zb,{className:"mx-4",children:[(0,l.jsxs)(d.Ol,{className:"space-y-1",children:[(0,l.jsx)(d.ll,{className:"text-2xl",children:"Sign Up"}),(0,l.jsx)(d.SZ,{children:"Silahkan Daftar Menggunakan Akun Google Anda"})]}),(0,l.jsxs)(d.aY,{className:"grid gap-4",children:[(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)("div",{className:"w-full",children:(0,l.jsx)(i(),{className:"w-full flex justify-center",clientId:p.wL,buttonText:n?"Loading..":"google",onSuccess:y,onFailure:()=>f.Am.error("google login not Working"),cookiePolicy:"single_host_origin"})})}),(0,l.jsxs)("div",{className:"relative",children:[(0,l.jsx)("div",{className:"absolute inset-0 flex items-center",children:(0,l.jsx)("span",{className:"w-full border-t"})}),(0,l.jsx)("div",{className:"relative flex justify-center text-xs uppercase",children:(0,l.jsx)("span",{className:"bg-background px-2 text-muted-foreground",children:"Or continue with"})})]}),(0,l.jsx)(r.l0,{...x,children:(0,l.jsxs)("form",{onSubmit:x.handleSubmit(b),className:"space-y-4",children:[(0,l.jsx)(r.Wi,{control:x.control,name:"username",render:e=>{let{field:s}=e;return(0,l.jsxs)(r.xJ,{children:[(0,l.jsx)(r.NI,{children:(0,l.jsx)(m.I,{placeholder:"username",...s})}),(0,l.jsx)(r.zG,{})]})}}),(0,l.jsx)(r.Wi,{control:x.control,name:"fullname",render:e=>{let{field:s}=e;return(0,l.jsxs)(r.xJ,{children:[(0,l.jsx)(r.NI,{children:(0,l.jsx)(m.I,{placeholder:"Full Name",...s})}),(0,l.jsx)(r.zG,{})]})}}),(0,l.jsx)(r.Wi,{control:x.control,name:"email",render:e=>{let{field:s}=e;return(0,l.jsxs)(r.xJ,{children:[(0,l.jsx)(r.NI,{children:(0,l.jsx)(m.I,{placeholder:"email",...s})}),(0,l.jsx)(r.zG,{})]})}}),(0,l.jsx)(r.Wi,{control:x.control,name:"password",render:e=>{let{field:s}=e;return(0,l.jsxs)(r.xJ,{children:[(0,l.jsx)(r.NI,{children:(0,l.jsx)(m.I,{placeholder:"password",...s,type:"password"})}),(0,l.jsx)(r.zG,{})]})}}),(0,l.jsx)(r.Wi,{control:x.control,name:"password_confirmation",render:e=>{let{field:s}=e;return(0,l.jsxs)(r.xJ,{children:[(0,l.jsx)(r.NI,{children:(0,l.jsx)(m.I,{placeholder:"Confirm Password",...s,type:"password"})}),(0,l.jsx)(r.zG,{})]})}}),(0,l.jsx)(o.z,{className:"w-full ",type:"submit",variant:"primary",isLoading:s,disabled:s,children:s?"Loading..":"Daftar"})]})}),(0,l.jsxs)("div",{className:"flex text-xs font-sans",children:[(0,l.jsx)("p",{className:"mr-2",children:" Sudah Punya Akun?"})," ",(0,l.jsx)(h(),{href:"/auth/sign-in",className:"text-blue-500",children:"Masuk"})," "]})]})]})}}}]);
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.