import{r as o,c as L,a as F,l as z,j as e,N as n,m as H,o as T,d as A,C as N,q as P,s as C,t as y,D as W,O as D}from"./index-7c7a558c.js";import{P as M}from"./PageLoader-31c46f94.js";const O=()=>{var u,v;const[m,b]=o.useState(""),x=L(),r=t=>{const l=t.target.value;b(l),x(`/student/${l}`)},{data:a,isError:d,error:g}=F("getAuth",H);o.useEffect(()=>{var t;((t=a==null?void 0:a.data)==null?void 0:t.is_lock)==1&&(localStorage.removeItem("user"),localStorage.removeItem("token"),x("/"),z.error("You can't continue using your account. The account is locked!"))},[a,x]),o.useEffect(()=>{var t;((t=g==null?void 0:g.response)==null?void 0:t.status)==401&&(localStorage.removeItem("user"),localStorage.removeItem("token"),x("/"))},[d,g,x]);const p=(()=>{const[t,l]=o.useState(window.innerWidth);return o.useEffect(()=>{const s=()=>l(window.innerWidth);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]),t})(),w=[{path:"/student/dashboard",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
  </svg>`,name:"Dashboard",pending:!0},{path:"/student/passbook",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 3v11.25A2.25 2.25 0 006 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0118 16.5h-2.25m-7.5 0h7.5m-7.5 0l-1 3m8.5-3l1 3m0 0l.5 1.5m-.5-1.5h-9.5m0 0l-.5 1.5m.75-9l3-3 2.148 2.148A12.061 12.061 0 0116.5 7.605" />
  </svg>`,name:"Passbook"},{path:"/student/courses",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" />
  </svg>`,name:"Courses"},{path:"/student/referral",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z" />
  </svg>`,name:"Referral"},{path:"/student/withdrawal",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
  </svg>`,name:"Withdrawal"},{path:"/student/fast_withdrawal",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
  </svg>`,name:"Fast Withdraw"},{path:"/student/profile",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5zm6-10.125a1.875 1.875 0 11-3.75 0 1.875 1.875 0 013.75 0zm1.294 6.336a6.721 6.721 0 01-3.17.789 6.721 6.721 0 01-3.168-.789 3.376 3.376 0 016.338 0z" />
  </svg>`,name:"My Profile",pending:!0},{path:"/student/edit_profile",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
  </svg>`,name:"Edit Profile",pending:!0},{path:"/student/affiliate_program",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
  </svg>`,name:"Affiliate Program"}];return e.jsx(e.Fragment,{children:p>1024?e.jsx("div",{className:"text-white font-bold p-5 bg-mainBg",children:e.jsx("div",{className:"flex justify-center items-center gap-4",children:w.map(t=>{var l,s,j,h;return e.jsx(e.Fragment,{children:((s=(l=a==null?void 0:a.data)==null?void 0:l.student)==null?void 0:s.status)==1?e.jsxs(n,{to:t.path,className:"flex items-center text-sm gap-1 bg-gradient-to-r from-main to-second border-b text-white px-2 py-2 shadow-md rounded-md hover:bg-gray-500 hover:to-main hover:from-second",children:[e.jsx("span",{dangerouslySetInnerHTML:{__html:t.icon}}),e.jsxs("span",{children:[" ",t.name]})]},t.path):((h=(j=a==null?void 0:a.data)==null?void 0:j.student)==null?void 0:h.status)!=1&&(t==null?void 0:t.pending)&&e.jsxs(n,{to:t.path,className:"flex items-center text-sm gap-1 bg-gradient-to-r from-main to-second border-b text-white px-2 py-2 shadow-md rounded-md hover:bg-gray-500 hover:to-main hover:from-second",children:[e.jsx("span",{dangerouslySetInnerHTML:{__html:t.icon}}),e.jsxs("span",{children:[" ",t.name]})]},t.path)})})})}):e.jsx(e.Fragment,{children:e.jsx("div",{className:"p-3 bg-mainBg hidden",children:e.jsxs("select",{className:"w-full shadow rounded-lg bg-mainBg text-gray-300",value:m,onChange:r,children:[e.jsx("option",{value:"dashboard",children:"Dashboard"}),((v=(u=a==null?void 0:a.data)==null?void 0:u.student)==null?void 0:v.status)==1&&e.jsxs(e.Fragment,{children:[e.jsx("option",{value:"passbook",children:"Passbook"}),e.jsx("option",{value:"courses",children:"Courses"}),e.jsx("option",{value:"referral",children:"Referral"}),e.jsx("option",{value:"withdrawal",children:"Withdrawal"}),e.jsx("option",{value:"fast_withdrawal",children:"Fast Withdrawal"}),e.jsx("option",{value:"affiliate_program",children:"Affiliate Program"})]}),e.jsx("option",{value:"profile",children:"My Profile"})]})})})})},R=()=>{const[m,{open:b,close:x}]=T(!1),[r,a]=o.useState({}),[d,g]=o.useState({}),[c,p]=o.useState(!1);o.useState(!1);const[w,u]=o.useState(!1),v=window.innerWidth,t=L(),l=()=>{m==!0?x():b()};o.useEffect(()=>{const i=localStorage.getItem("token"),k=localStorage.getItem("user");if(d&&k){const I=A.AES.decrypt(i,"token-secret-key").toString(N.enc.Utf8),B=A.AES.decrypt(k,"user-secret-key").toString(N.enc.Utf8);g(I),a(JSON.parse(B)),p(!0)}},[d,t]),o.useEffect(()=>{const i=()=>{window.scrollY>1?u(!0):u(!1)};return window.addEventListener("scroll",i),()=>{window.removeEventListener("scroll",i)}},[]);const s=()=>{window.scrollTo({top:0,behavior:"smooth"}),x()},j=i=>{i.preventDefault(),localStorage.removeItem("user"),localStorage.removeItem("token"),t("/")},[h,E]=o.useState(JSON.parse(localStorage.getItem("cart")));o.useEffect(()=>{E(JSON.parse(localStorage.getItem("cart")))},[]);const f=P(),S=[{path:"/student/dashboard",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M17.982 18.725A7.488 7.488 0 0012 15.75a7.488 7.488 0 00-5.982 2.975m11.963 0a9 9 0 10-11.963 0m11.963 0A8.966 8.966 0 0112 21a8.966 8.966 0 01-5.982-2.275M15 9.75a3 3 0 11-6 0 3 3 0 016 0z" />
  </svg>`,name:"Dashboard"},{path:"/student/passbook",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M3.75 3v11.25A2.25 2.25 0 006 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0118 16.5h-2.25m-7.5 0h7.5m-7.5 0l-1 3m8.5-3l1 3m0 0l.5 1.5m-.5-1.5h-9.5m0 0l-.5 1.5m.75-9l3-3 2.148 2.148A12.061 12.061 0 0116.5 7.605" />
  </svg>`,name:"Passbook"},{path:"/student/courses",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M12 6.042A8.967 8.967 0 006 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 016 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 016-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0018 18a8.967 8.967 0 00-6 2.292m0-14.25v14.25" />
  </svg>`,name:"Courses"},{path:"/student/profile",icon:'<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAACXBIWXMAAAsTAAALEwEAmpwYAAABR0lEQVR4nNXTP0tcQRSG8VUbURErYa2MaUT8CCIidhYJIcFCErTxgwiiIH6DBStFBEVTBEKKmEKx0CKCjRYWljYiCP6DnwxecVlm7l7XygdOc8/Lw8yZe0qlgqA/VNF8nqgHc1jAphc2sm+hV25E/Fl9PjUibsVljvQKba8WBzCOmUSNlxoFZfQlqtyodAL3OaO4w7fXSodwU+DxbjFSVPoBFxHJA05wlAmfCdneetJm/ItI59FVlftf0/+Lpjzxj4i0kvW+4xDnNSd+ZjIlbcFpTThcewDd+I0/OEvMO4ypOSYeiYS30IHBbI1D7UszHBMvRYKzaEcnRjGGtRzxYkz8MxFertrCHRzjOpHdjon3ck5Swceq7EEitxsTr6vPdfZ44Z+OsRYTf/V2vsTETVh9g3QluSSe5NP4lc2xSIXsVO7mvQseAd5Q9WudJPnRAAAAAElFTkSuQmCC">',name:"Balance"},{path:"/student/referral",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M18 18.72a9.094 9.094 0 003.741-.479 3 3 0 00-4.682-2.72m.94 3.198l.001.031c0 .225-.012.447-.037.666A11.944 11.944 0 0112 21c-2.17 0-4.207-.576-5.963-1.584A6.062 6.062 0 016 18.719m12 0a5.971 5.971 0 00-.941-3.197m0 0A5.995 5.995 0 0012 12.75a5.995 5.995 0 00-5.058 2.772m0 0a3 3 0 00-4.681 2.72 8.986 8.986 0 003.74.477m.94-3.197a5.971 5.971 0 00-.94 3.197M15 6.75a3 3 0 11-6 0 3 3 0 016 0zm6 3a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0zm-13.5 0a2.25 2.25 0 11-4.5 0 2.25 2.25 0 014.5 0z" />
  </svg>`,name:"Referral"},{path:"/student/withdrawal",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
  </svg>`,name:"Withdrawal"},{path:"/student/fast_withdrawal",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
  </svg>`,name:"Fast Withdrawal"},{path:"/student/affiliate_program",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M7.5 21L3 16.5m0 0L7.5 12M3 16.5h13.5m0-13.5L21 7.5m0 0L16.5 12M21 7.5H7.5" />
  </svg>`,name:"Affiliate Program"},{path:"/student/profile",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M15 9h3.75M15 12h3.75M15 15h3.75M4.5 19.5h15a2.25 2.25 0 002.25-2.25V6.75A2.25 2.25 0 0019.5 4.5h-15a2.25 2.25 0 00-2.25 2.25v10.5A2.25 2.25 0 004.5 19.5zm6-10.125a1.875 1.875 0 11-3.75 0 1.875 1.875 0 013.75 0zm1.294 6.336a6.721 6.721 0 01-3.17.789 6.721 6.721 0 01-3.168-.789 3.376 3.376 0 016.338 0z" />
  </svg>`,name:"My Profile"},{path:"/student/edit_profile",icon:`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="w-6 h-6">
    <path stroke-linecap="round" stroke-linejoin="round" d="M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10" />
  </svg>`,name:"Edit Profile"}];return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:`${f.pathname=="/"&&!w?"bg-transparent fixed":"bg-[#2f2f2f]"} ${w?"fixed top-0":""}  w-full z-50`,children:e.jsxs("div",{className:"container  mx-auto px-4 flex items-center justify-between",children:[e.jsx(n,{to:"/",className:"flex jusify-center items-center",children:e.jsx("img",{className:` h-20 ${d&&r&&c?"":"mx-auto md:mx-0 "}`,src:C,alt:"Logo"})}),e.jsx("nav",{className:"hidden sm:hidden lg:block",children:e.jsxs("ul",{className:"flex space-x-4 items-center",children:[e.jsx("li",{children:e.jsx(n,{onClick:s,to:"/",className:"text-white hover:text-gray-300",children:"Home"})}),e.jsx("li",{children:e.jsx(n,{onClick:s,to:"/about",className:"text-white hover:text-gray-300",children:"About"})}),e.jsx("li",{children:e.jsx(n,{onClick:s,to:"/courses",className:"text-white hover:text-gray-300",children:"Courses"})}),e.jsx("li",{children:e.jsx(n,{onClick:s,to:"/contact",className:"text-white hover:text-gray-300",children:"Contact"})})]})}),d&&r&&c?e.jsx("div",{className:"w-full sm:w-auto",children:v>1024?e.jsxs("div",{className:"hidden lg:flex gap-8 justify-center items-center text-white font-bold hover:text-gray-300",children:[e.jsx("div",{children:d&&r&&c&&e.jsx(y,{bodyClass:"bg-gray-100 text-black",classes:"w-8 h-8 text-gray-1000 dark:text-white cursor-pointer",white:!0})}),e.jsx(n,{onClick:s,to:"/student/dashboard",className:"bg-main hover:bg-btnHover text-white font-bold py-2 px-4 mr-2 rounded",children:"Dashboard"}),e.jsx(n,{onClick:j,className:"bg-btn hover:bg-btnHover text-white font-bold py-2 px-4 rounded",children:"Logout"}),e.jsx(n,{onClick:s,to:"/subadmin/apply",className:"bg-main hover:bg-btnHover text-white font-bold py-2 px-4 mr-2 rounded",children:"Subadmin Apply"})]}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"flex items-center flex-row-reverse justify-start gap-4 text-white lg:hidden",children:[e.jsx("div",{children:d&&r&&c&&e.jsx(y,{bodyClass:"bg-gray-100 text-white",classes:"w-8 h-8 text-gray-100 dark:text-white cursor-pointer",white:!0})}),e.jsx("div",{className:"block lg:hidden",children:e.jsxs("button",{onClick:l,children:[e.jsx("div",{className:"w-10 h-1 bg-white mb-2"}),e.jsx("div",{className:"w-10 h-1 bg-white mb-2"}),e.jsx("div",{className:"w-10 h-1 bg-white"})]})})]})})}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"hidden lg:block flex justify-center items-center",children:[e.jsx(n,{to:"/subadmin/login",className:"bg-main hover:bg-btnHover text-white font-bold py-2 px-4 mr-2 rounded",children:"SubAdmin Login"}),e.jsx(n,{to:"/admin/login",className:"bg-btn hover:bg-btnHover text-white font-bold py-2 px-4 rounded",children:"Admin Login"})]}),e.jsx("div",{className:"flex items-center lg:hidden",children:e.jsx("div",{className:"block lg:hidden",children:e.jsxs("button",{onClick:l,children:[e.jsx("div",{className:"w-7 h-1 bg-white mb-2"}),e.jsx("div",{className:"w-7 h-1 bg-white mb-2"}),e.jsx("div",{className:"w-7 h-1 bg-white"})]})})})]})]})}),e.jsx(W,{opened:m,onClose:x,left:!0,size:"xs",title:"Menu",style:{backgroundColor:"#212529"},children:e.jsx("div",{className:"fixed bg-black top-20 md:top-20 right-0 w-full md:w-8/12 z-20",children:e.jsx("div",{className:"p-5 pl-8",children:e.jsx("div",{children:d&&r&&c?e.jsx(e.Fragment,{children:e.jsx("div",{children:e.jsx("div",{className:"pb-24",children:e.jsxs("div",{children:[e.jsx("div",{className:"flex justify-center",children:e.jsxs(n,{to:"/",className:"text-center",children:[e.jsx("img",{className:"w-40",src:C,alt:"Logo"}),e.jsx("p",{className:" md:block text-white font-bold mt-4",children:"Bd Skill Tech"})]})}),e.jsxs("div",{className:"p-2 my-6",children:[e.jsxs("div",{className:"flex gap-2 text-white my-2",children:[e.jsx("p",{children:"Student ID : "}),e.jsx("p",{children:r==null?void 0:r.referral_code})]}),e.jsxs("div",{className:"flex gap-2 text-white my-2",children:[e.jsx("p",{children:"Name : "}),e.jsx("p",{children:r==null?void 0:r.name})]}),e.jsxs("div",{className:"flex gap-2 text-white my-2",children:[e.jsx("p",{children:"Phone Number : "}),e.jsx("p",{children:r==null?void 0:r.mobile_number})]})]}),e.jsx(n,{onClick:s,to:"/student/profile",children:e.jsx("div",{className:"text-[#EF8011] p-2 rounded-md text-xl font-silmbold mb-3 text-center border border-[#EF8011] mb-8",children:e.jsx("p",{children:"Complete Profile"})})}),d&&r&&c?e.jsxs(e.Fragment,{children:[S==null?void 0:S.map((i,k)=>e.jsx(n,{onClick:s,to:i==null?void 0:i.path,children:e.jsxs("div",{className:`${(i==null?void 0:i.path)==(f==null?void 0:f.pathname)?"text-[#EF8011]":"text-white"} p-2 rounded-md text-xl font-silmbold mb-3 flex gap-2`,children:[e.jsx("span",{dangerouslySetInnerHTML:{__html:i.icon}}),e.jsx("p",{children:i==null?void 0:i.name})]})},k)),e.jsx(n,{onClick:j,to:"/",children:e.jsx("div",{className:"bg-yellow-300 p-2 rounded-md text-center text-xl font-silmbold mb-3",children:e.jsx("p",{children:"Logout"})})})]}):e.jsxs(e.Fragment,{children:[e.jsx(n,{onClick:s,to:"/login",children:e.jsx("div",{className:" border border-white p-2 text-center text-white text-xl font-silmbold mb-3",children:e.jsx("p",{children:"Student Login"})})}),e.jsx(n,{onClick:s,to:"/subadmin/login",children:e.jsx("div",{className:" border border-white p-2 text-center text-white text-xl font-silmbold mb-3",children:e.jsx("p",{children:"SubAdmin Login"})})}),e.jsx(n,{onClick:s,to:"/admin/login",children:e.jsx("div",{className:" border border-white p-2 text-center text-white text-xl font-silmbold mb-3",children:e.jsx("p",{children:"Admin Login"})})}),e.jsx(n,{onClick:s,to:"/subadmin/apply",children:e.jsx("div",{className:" border border-white p-2 text-center text-white text-xl font-silmbold mb-3",children:e.jsx("p",{children:"Subadmin Apply"})})})]})]})})})}):e.jsxs(e.Fragment,{children:[e.jsx(n,{onClick:s,to:"/subadmin/login",children:e.jsx("div",{className:"bg-black border border-white p-2 rounded-md text-center text-white text-2xl font-silmbold mb-3",children:e.jsx("p",{children:"SubAdmin Login"})})}),e.jsx(n,{onClick:s,to:"/admin/login",children:e.jsx("div",{className:"bg-black border border-white p-2 rounded-md text-center text-white text-2xl font-silmbold mb-3",children:e.jsx("p",{children:"Admin Login"})})}),e.jsx(n,{onClick:s,to:"/subadmin/apply",children:e.jsx("div",{className:"bg-black border border-white p-2 rounded-md text-center text-white text-2xl font-silmbold mb-3",children:e.jsx("p",{children:"Subadmin Apply"})})})]})})})})})]})};function U(){const m=L(),[b,x]=o.useState(""),[r,a]=o.useState({}),[d,g]=o.useState(!1),[c,p]=o.useState(""),[w,u]=o.useState(!1);return o.useEffect(()=>{var l,s;const v=localStorage.getItem("token"),t=localStorage.getItem("user");if(v&&t){const j=A.AES.decrypt(v,"token-secret-key").toString(N.enc.Utf8),h=JSON.parse(A.AES.decrypt(t,"user-secret-key").toString(N.enc.Utf8));h.role==3?(x(j),a(h),u(!0)):h.role==2?(g(!0),p("Trainer Logged In. Redirect Dashboard"),m("/trainer/dashboard")):h.role==1&&((s=(l=h==null?void 0:h.roles)==null?void 0:l[0])==null?void 0:s.name)=="Super Admin"?(g(!0),p("Admin Logged In. Redirect Dashboard"),m("/admin/dashboard")):h.role==1?(g(!0),p("Admin Logged In. Redirect Dashboard"),m("/subadmin/dashboard")):m("/login")}else m("/login")},[m]),e.jsx(o.Suspense,{fallback:e.jsx(M,{title:c||"Student Login"}),children:d?e.jsx(M,{title:c||"Student Login"}):e.jsxs(e.Fragment,{children:[e.jsx(R,{}),w&&e.jsxs(e.Fragment,{children:[e.jsx(O,{context:[r,b,w]}),e.jsx("div",{className:"bg-mainBg student-main",children:e.jsx("div",{className:"p-4 pt-16",children:e.jsx(D,{context:[r,b,w]})})})]})]})})}export{U as default};
