(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[177],{25062:(e,t,s)=>{"use strict";s.d(t,{Toaster:()=>v});var r=s(69298),a=s(92839),n=s(83130),o=s(39302),i=s(22554),d=s(97069),l=s(26164);let c=o.Kq,u=n.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(o.LM,{ref:t,className:(0,l.cn)("fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]",s),...a})});u.displayName=o.LM.displayName;let f=(0,i.F)("group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"border bg-background text-foreground",destructive:"destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),m=n.forwardRef((e,t)=>{let{className:s,variant:a,...n}=e;return(0,r.jsx)(o.bL,{ref:t,className:(0,l.cn)(f({variant:a}),s),...n})});m.displayName=o.bL.displayName,n.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(o.rc,{ref:t,className:(0,l.cn)("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",s),...a})}).displayName=o.rc.displayName;let p=n.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(o.bm,{ref:t,className:(0,l.cn)("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",s),"toast-close":"",...a,children:(0,r.jsx)(d.A,{className:"h-4 w-4"})})});p.displayName=o.bm.displayName;let x=n.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(o.hE,{ref:t,className:(0,l.cn)("text-sm font-semibold",s),...a})});x.displayName=o.hE.displayName;let h=n.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(o.VY,{ref:t,className:(0,l.cn)("text-sm opacity-90",s),...a})});function v(){let{toasts:e}=(0,a.dj)();return(0,r.jsxs)(c,{children:[e.map(function(e){let{id:t,title:s,description:a,action:n,...o}=e;return(0,r.jsxs)(m,{...o,children:[(0,r.jsxs)("div",{className:"grid gap-1",children:[s&&(0,r.jsx)(x,{children:s}),a&&(0,r.jsx)(h,{children:a})]}),n,(0,r.jsx)(p,{})]},t)}),(0,r.jsx)(u,{})]})}h.displayName=o.VY.displayName},26086:(e,t,s)=>{Promise.resolve().then(s.t.bind(s,80623,23)),Promise.resolve().then(s.t.bind(s,44583,23)),Promise.resolve().then(s.bind(s,46207)),Promise.resolve().then(s.bind(s,25062)),Promise.resolve().then(s.bind(s,38240))},26164:(e,t,s)=>{"use strict";s.d(t,{cn:()=>n});var r=s(61512),a=s(58520);function n(){for(var e=arguments.length,t=Array(e),s=0;s{"use strict";s.d(t,{SessionProvider:()=>o,w:()=>i});var r=s(69298),a=s(83130);let n=(0,a.createContext)(void 0);function o(e){let{children:t,session:s}=e,[o,i]=(0,a.useState)(s),[d,l]=(0,a.useState)(!0);return(0,a.useEffect)(()=>{i(s),l(!1)},[s]),(0,r.jsx)(n.Provider,{value:{session:o,loading:d},children:t})}function i(){let e=(0,a.useContext)(n);if(void 0===e)throw Error("useSession must be used within a SessionProvider");return e}},46207:(e,t,s)=>{"use strict";s.d(t,{ConditionalHeader:()=>T});var r=s(69298),a=s(12488),n=s(40567),o=s.n(n),i=s(46583),d=s(83130),l=s(35440),c=s(14081),u=s(42077),f=s(7883),m=s(26164);let p=l.bL,x=l.l9;l.YJ,l.ZL,l.Pb,l.z6,d.forwardRef((e,t)=>{let{className:s,inset:a,children:n,...o}=e;return(0,r.jsxs)(l.ZP,{ref:t,className:(0,m.cn)("flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",s),...o,children:[n,(0,r.jsx)(c.A,{className:"ml-auto"})]})}).displayName=l.ZP.displayName,d.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(l.G5,{ref:t,className:(0,m.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...a})}).displayName=l.G5.displayName;let h=d.forwardRef((e,t)=>{let{className:s,sideOffset:a=4,...n}=e;return(0,r.jsx)(l.ZL,{children:(0,r.jsx)(l.UC,{ref:t,sideOffset:a,className:(0,m.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",s),...n})})});h.displayName=l.UC.displayName;let v=d.forwardRef((e,t)=>{let{className:s,inset:a,...n}=e;return(0,r.jsx)(l.q7,{ref:t,className:(0,m.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",a&&"pl-8",s),...n})});v.displayName=l.q7.displayName,d.forwardRef((e,t)=>{let{className:s,children:a,checked:n,...o}=e;return(0,r.jsxs)(l.H_,{ref:t,className:(0,m.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),checked:n,...o,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(l.VF,{children:(0,r.jsx)(u.A,{className:"h-4 w-4"})})}),a]})}).displayName=l.H_.displayName,d.forwardRef((e,t)=>{let{className:s,children:a,...n}=e;return(0,r.jsxs)(l.hN,{ref:t,className:(0,m.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",s),...n,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(l.VF,{children:(0,r.jsx)(f.A,{className:"h-2 w-2 fill-current"})})}),a]})}).displayName=l.hN.displayName;let g=d.forwardRef((e,t)=>{let{className:s,inset:a,...n}=e;return(0,r.jsx)(l.JU,{ref:t,className:(0,m.cn)("px-2 py-1.5 text-sm font-semibold",a&&"pl-8",s),...n})});g.displayName=l.JU.displayName;let b=d.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(l.wv,{ref:t,className:(0,m.cn)("-mx-1 my-1 h-px bg-muted",s),...a})});b.displayName=l.wv.displayName;var N=s(71424),j=s(32568),y=s(46844),w=s(28926),S=s(7290);let _=(0,S.createServerReference)("00c2a6b77c32fc6bb73ffe0adf09587fb7b3a5f067",S.callServer,void 0,S.findSourceMapURL,"logout");var A=s(38240);function R(){var e;(0,a.useRouter)();let{session:t}=(0,A.w)(),s=null==t?void 0:t.user,n=async()=>{await _(),window.location.href="/login"},d=(null==s?void 0:s.isAdmin)||!1,l=()=>s?d?"/admin":"/dashboard":"/";return(0,r.jsx)("header",{className:"bg-background/80 backdrop-blur-sm sticky top-0 z-40 border-b",children:(0,r.jsxs)("div",{className:"container mx-auto flex h-14 sm:h-16 items-center justify-between px-4 md:px-6",children:[(0,r.jsx)(o(),{href:l(),className:"text-lg sm:text-xl font-bold text-foreground tracking-tight",children:"ScreenWise"}),(0,r.jsx)("div",{className:"flex items-center gap-2 sm:gap-4",children:s?(0,r.jsxs)(p,{children:[(0,r.jsx)(x,{asChild:!0,children:(0,r.jsx)(i.$,{variant:"ghost",className:"relative h-8 w-8 sm:h-10 sm:w-10 rounded-full",children:(0,r.jsxs)(N.eu,{className:"h-8 w-8 sm:h-10 sm:w-10",children:[(0,r.jsx)(N.BK,{src:s.photo||void 0,alt:null!=(e=s.name)?e:""}),(0,r.jsx)(N.q5,{className:"text-xs sm:text-sm",children:(e=>{if(!e)return"P";let t=e.split(" ");return t.length>1?t[0][0]+t[t.length-1][0]:e.substring(0,2).toUpperCase()})(s.name)})]})})}),(0,r.jsxs)(h,{className:"w-56",align:"end",forceMount:!0,children:[(0,r.jsx)(g,{className:"font-normal",children:(0,r.jsxs)("div",{className:"flex flex-col space-y-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium leading-none truncate",children:s.name}),(0,r.jsx)("p",{className:"text-xs leading-none text-muted-foreground truncate",children:s.email})]})}),(0,r.jsx)(b,{}),(0,r.jsx)(v,{asChild:!0,className:"cursor-pointer",children:(0,r.jsxs)(o(),{href:l(),children:[(0,r.jsx)(j.A,{className:"mr-2 h-4 w-4"}),(0,r.jsx)("span",{children:"Dasbor"})]})}),(0,r.jsx)(v,{asChild:!0,className:"cursor-pointer",children:(0,r.jsxs)(o(),{href:"/profile",children:[(0,r.jsx)(y.A,{className:"mr-2 h-4 w-4"}),(0,r.jsx)("span",{children:"Profil"})]})}),(0,r.jsx)(b,{}),(0,r.jsxs)(v,{onClick:n,className:"cursor-pointer",children:[(0,r.jsx)(w.A,{className:"mr-2 h-4 w-4"}),(0,r.jsx)("span",{children:"Keluar"})]})]})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(i.$,{variant:"ghost",size:"sm",asChild:!0,className:"text-sm",children:(0,r.jsx)(o(),{href:"/login",children:"Masuk"})}),(0,r.jsx)(i.$,{size:"sm",asChild:!0,className:"text-sm",children:(0,r.jsx)(o(),{href:"/signup",children:"Daftar"})})]})})]})})}function T(){return"/"===(0,a.usePathname)()?null:(0,r.jsx)(R,{})}},46583:(e,t,s)=>{"use strict";s.d(t,{$:()=>l,r:()=>d});var r=s(69298),a=s(83130),n=s(80182),o=s(22554),i=s(26164);let d=(0,o.F)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),l=a.forwardRef((e,t)=>{let{className:s,variant:a,size:o,asChild:l=!1,...c}=e,u=l?n.DX:"button";return(0,r.jsx)(u,{className:(0,i.cn)(d({variant:a,size:o,className:s})),ref:t,...c})});l.displayName="Button"},71424:(e,t,s)=>{"use strict";s.d(t,{BK:()=>d,eu:()=>i,q5:()=>l});var r=s(69298),a=s(83130),n=s(57423),o=s(26164);let i=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.bL,{ref:t,className:(0,o.cn)("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",s),...a})});i.displayName=n.bL.displayName;let d=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n._V,{ref:t,className:(0,o.cn)("aspect-square h-full w-full",s),...a})});d.displayName=n._V.displayName;let l=a.forwardRef((e,t)=>{let{className:s,...a}=e;return(0,r.jsx)(n.H4,{ref:t,className:(0,o.cn)("flex h-full w-full items-center justify-center rounded-full bg-muted",s),...a})});l.displayName=n.H4.displayName},80623:()=>{},92839:(e,t,s)=>{"use strict";s.d(t,{dj:()=>f});var r=s(83130);let a=0,n=new Map,o=e=>{if(n.has(e))return;let t=setTimeout(()=>{n.delete(e),c({type:"REMOVE_TOAST",toastId:e})},1e6);n.set(e,t)},i=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,1)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case"DISMISS_TOAST":{let{toastId:s}=t;return s?o(s):e.toasts.forEach(e=>{o(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===s||void 0===s?{...e,open:!1}:e)}}case"REMOVE_TOAST":if(void 0===t.toastId)return{...e,toasts:[]};return{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},d=[],l={toasts:[]};function c(e){l=i(l,e),d.forEach(e=>{e(l)})}function u(e){let{...t}=e,s=(a=(a+1)%Number.MAX_SAFE_INTEGER).toString(),r=()=>c({type:"DISMISS_TOAST",toastId:s});return c({type:"ADD_TOAST",toast:{...t,id:s,open:!0,onOpenChange:e=>{e||r()}}}),{id:s,dismiss:r,update:e=>c({type:"UPDATE_TOAST",toast:{...e,id:s}})}}function f(){let[e,t]=r.useState(l);return r.useEffect(()=>(d.push(t),()=>{let e=d.indexOf(t);e>-1&&d.splice(e,1)}),[e]),{...e,toast:u,dismiss:e=>c({type:"DISMISS_TOAST",toastId:e})}}}},e=>{var t=t=>e(e.s=t);e.O(0,[874,348,250,678,156,756,128,521,801,358],()=>t(26086)),_N_E=e.O()}]);