1 line
17 KiB
JavaScript
1 line
17 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,98183,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={assign:function(){return l},searchParamsToUrlQuery:function(){return s},urlQueryToSearchParams:function(){return i}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});function s(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function a(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function i(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,a(e));else t.set(r,a(n));return t}function l(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},18967,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return v},MissingStaticPage:function(){return j},NormalizeError:function(){return b},PageNotFoundError:function(){return y},SP:function(){return x},ST:function(){return m},WEB_VITALS:function(){return s},execOnce:function(){return a},getDisplayName:function(){return d},getLocationOrigin:function(){return u},getURL:function(){return c},isAbsoluteUrl:function(){return l},isResSent:function(){return f},loadGetInitialProps:function(){return h},normalizeRepeatedSlashes:function(){return p},stringifyError:function(){return w}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let s=["CLS","FCP","FID","INP","LCP","TTFB"];function a(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let i=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,l=e=>i.test(e);function u(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=u();return e.substring(t.length)}function d(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function p(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function h(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await h(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${d(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return n}let x="u">typeof performance,m=x&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class b extends Error{}class y extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class j extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class v extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function w(e){return JSON.stringify({message:e.message,stack:e.stack})}},33525,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"warnOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},6655,e=>{"use strict";let t=e.i(47167).default.env.NEXT_PUBLIC_API_URL??"/admin/api/v1";e.s(["ADMIN_API_BASE",0,t])},95057,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={formatUrl:function(){return i},formatWithValidation:function(){return u},urlObjectKeys:function(){return l}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let s=e.r(51836)._(e.r(98183)),a=/https?|ftp|gopher|file/;function i(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",i=e.hash||"",l=e.query||"",u=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?u=t+e.host:r&&(u=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(u+=":"+e.port)),l&&"object"==typeof l&&(l=String(s.urlQueryToSearchParams(l)));let c=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||a.test(n))&&!1!==u?(u="//"+(u||""),o&&"/"!==o[0]&&(o="/"+o)):u||(u=""),i&&"#"!==i[0]&&(i="#"+i),c&&"?"!==c[0]&&(c="?"+c),o=o.replace(/[?#]/g,encodeURIComponent),c=c.replace("#","%23"),`${n}${u}${o}${c}${i}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function u(e){return i(e)}},18581,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=e.r(71645);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=s(e,n)),t&&(o.current=s(t,n))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},73668,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"isLocalURL",{enumerable:!0,get:function(){return s}});let n=e.r(18967),o=e.r(52817);function s(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},84508,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},22016,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var n={default:function(){return g},useLinkStatus:function(){return y}};for(var o in n)Object.defineProperty(r,o,{enumerable:!0,get:n[o]});let s=e.r(51836),a=e.r(43476),i=s._(e.r(71645)),l=e.r(95057),u=e.r(8372),c=e.r(18581),d=e.r(18967),f=e.r(5550);e.r(33525);let p=e.r(88540),h=e.r(91949),x=e.r(73668),m=e.r(9396);function g(t){var r,n;let o,s,g,[y,j]=(0,i.useOptimistic)(h.IDLE_LINK_STATUS),v=(0,i.useRef)(null),{href:w,as:N,children:k,prefetch:P=null,passHref:_,replace:S,shallow:E,scroll:O,onClick:C,onMouseEnter:R,onTouchStart:L,legacyBehavior:T=!1,onNavigate:A,transitionTypes:I,ref:M,unstable_dynamicOnHover:U,...$}=t;o=k,T&&("string"==typeof o||"number"==typeof o)&&(o=(0,a.jsx)("a",{children:o}));let B=i.default.useContext(u.AppRouterContext),D=!1!==P,z=!1!==P?null===(n=P)||"auto"===n?m.FetchStrategy.PPR:m.FetchStrategy.Full:m.FetchStrategy.PPR,F="string"==typeof(r=N||w)?r:(0,l.formatUrl)(r);if(T){if(o?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});s=i.default.Children.only(o)}let K=T?s&&"object"==typeof s&&s.ref:M,q=i.default.useCallback(e=>(null!==B&&(v.current=(0,h.mountLinkInstance)(e,F,B,z,D,j)),()=>{v.current&&((0,h.unmountLinkForCurrentNavigation)(v.current),v.current=null),(0,h.unmountPrefetchableInstance)(e)}),[D,F,B,z,j]),W={ref:(0,c.useMergedRef)(q,K),onClick(t){T||"function"!=typeof C||C(t),T&&s.props&&"function"==typeof s.props.onClick&&s.props.onClick(t),!B||t.defaultPrevented||function(t,r,n,o,s,a,l){if("u">typeof window){let u,{nodeName:c}=t.currentTarget;if("A"===c.toUpperCase()&&((u=t.currentTarget.getAttribute("target"))&&"_self"!==u||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.nativeEvent&&2===t.nativeEvent.which)||t.currentTarget.hasAttribute("download"))return;if(!(0,x.isLocalURL)(r)){o&&(t.preventDefault(),location.replace(r));return}if(t.preventDefault(),a){let e=!1;if(a({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:d}=e.r(99781);i.default.startTransition(()=>{d(r,o?"replace":"push",!1===s?p.ScrollBehavior.NoScroll:p.ScrollBehavior.Default,n.current,l)})}}(t,F,v,S,O,A,I)},onMouseEnter(e){T||"function"!=typeof R||R(e),T&&s.props&&"function"==typeof s.props.onMouseEnter&&s.props.onMouseEnter(e),B&&D&&(0,h.onNavigationIntent)(e.currentTarget,!0===U)},onTouchStart:function(e){T||"function"!=typeof L||L(e),T&&s.props&&"function"==typeof s.props.onTouchStart&&s.props.onTouchStart(e),B&&D&&(0,h.onNavigationIntent)(e.currentTarget,!0===U)}};return(0,d.isAbsoluteUrl)(F)?W.href=F:T&&!_&&("a"!==s.type||"href"in s.props)||(W.href=(0,f.addBasePath)(F)),g=T?i.default.cloneElement(s,W):(0,a.jsx)("a",{...$,...W,children:o}),(0,a.jsx)(b.Provider,{value:y,children:g})}e.r(84508);let b=(0,i.createContext)(h.IDLE_LINK_STATUS),y=()=>(0,i.useContext)(b);("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},18566,(e,t,r)=>{t.exports=e.r(76562)},13460,e=>{"use strict";var t=e.i(43476),r=e.i(51224);let n={en:{flag:"🇺🇸",shortLabel:"EN"},fr:{flag:"🇫🇷",shortLabel:"FR"},ar:{flag:"🇲🇦",shortLabel:"AR"}};function o(){let{language:e}=(0,r.useAdminI18n)(),o=n[e];return(0,t.jsx)("footer",{className:"border-t border-stone-200/80 bg-white/72 px-4 py-4 backdrop-blur-xl transition-colors dark:border-blue-900 dark:bg-[#07101e]/72",children:(0,t.jsxs)("div",{className:"mx-auto flex max-w-6xl flex-col items-center justify-between gap-3 lg:flex-row",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 text-xs font-medium uppercase tracking-[0.16em] text-stone-400 dark:text-stone-500",children:[(0,t.jsx)("p",{children:{en:{preferences:"Admin preferences"},fr:{preferences:"Préférences d’administration"},ar:{preferences:"تفضيلات الإدارة"}}[e].preferences}),(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-stone-200/80 bg-white/95 px-2.5 py-1 text-stone-700 dark:border-blue-800 dark:bg-[#0d1b38]/85 dark:text-stone-200",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:o.flag}),(0,t.jsx)("span",{children:o.shortLabel})]})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 sm:flex-row",children:[(0,t.jsx)(r.AdminLanguageSwitcher,{}),(0,t.jsx)(r.AdminThemeSwitcher,{})]})]})})}var s=e.i(22016);let a={en:{flag:"🇺🇸",shortLabel:"EN"},fr:{flag:"🇫🇷",shortLabel:"FR"},ar:{flag:"🇲🇦",shortLabel:"AR"}};function i(){let{language:e}=(0,r.useAdminI18n)(),n=a[e],o={en:{admin:"Admin Console",signIn:"Sign in"},fr:{admin:"Console admin",signIn:"Connexion"},ar:{admin:"لوحة الإدارة",signIn:"تسجيل الدخول"}}[e];return(0,t.jsx)("header",{className:"sticky top-0 z-30 border-b border-stone-200/80 bg-white/78 backdrop-blur-xl transition-colors dark:border-blue-900 dark:bg-[#07101e]/76",children:(0,t.jsxs)("div",{className:"mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-4",children:[(0,t.jsxs)(s.default,{href:"/",className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"text-xs font-semibold uppercase tracking-[0.24em] text-orange-700 dark:text-orange-300",children:"RentalDriveGo"}),(0,t.jsx)("span",{className:"hidden text-sm font-semibold text-stone-500 dark:text-stone-400 sm:inline",children:o.admin})]}),(0,t.jsxs)("nav",{className:"flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"inline-flex min-w-[3.5rem] items-center justify-center gap-1 rounded-full border border-stone-200/80 bg-white/95 px-2.5 py-2 text-xs font-semibold text-stone-700 dark:border-blue-800 dark:bg-[#0d1b38]/85 dark:text-stone-200",children:[(0,t.jsx)("span",{"aria-hidden":"true",children:n.flag}),(0,t.jsx)("span",{children:n.shortLabel})]}),(0,t.jsx)(s.default,{href:"/login",className:"rounded-full bg-blue-900 px-4 py-2 text-sm font-semibold text-white transition hover:bg-orange-700 dark:bg-orange-400 dark:text-white dark:hover:bg-orange-300",children:o.signIn})]})]})})}e.s(["default",0,function({children:e}){return(0,t.jsxs)("div",{className:"flex min-h-screen flex-col bg-[linear-gradient(180deg,#ffffff_0%,#f5f8ff_28%,#eef4ff_58%,#ffffff_100%)] text-blue-950 transition-colors dark:bg-[linear-gradient(180deg,#0a1128_0%,#0d1b38_35%,#07101e_100%)] dark:text-slate-100",children:[(0,t.jsx)(i,{}),(0,t.jsx)("div",{className:"flex flex-1 flex-col",children:e}),(0,t.jsx)(o,{})]})}],13460)},36115,e=>{"use strict";var t=e.i(43476),r=e.i(22016),n=e.i(71645),o=e.i(18566),s=e.i(13460),a=e.i(6655);function i(){let e=(0,o.useSearchParams)(),s=(0,o.useRouter)(),i=e.get("token"),[u,c]=(0,n.useState)(""),[d,f]=(0,n.useState)(""),[p,h]=(0,n.useState)(!1),[x,m]=(0,n.useState)(!1),[g,b]=(0,n.useState)(null);async function y(e){if(e.preventDefault(),u.length<8)return void b("Password must be at least 8 characters.");if(u!==d)return void b("Passwords do not match.");h(!0),b(null);try{let e=await fetch(`${a.ADMIN_API_BASE}/admin/auth/reset-password`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({token:i,password:u})}),t=await e.json();if(!e.ok){if(t?.error==="invalid_token")throw Error("This reset link is invalid or has expired.");throw Error("Something went wrong. Please try again.")}m(!0)}catch(e){b(e.message??"Something went wrong.")}finally{h(!1)}}return i?x?(0,t.jsx)(l,{children:(0,t.jsxs)("div",{className:"space-y-3 text-center",children:[(0,t.jsx)("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-emerald-900/40",children:(0,t.jsx)("svg",{className:"h-6 w-6 text-emerald-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),(0,t.jsx)("p",{className:"text-sm text-zinc-300 font-semibold",children:"Password updated"}),(0,t.jsx)("p",{className:"text-xs text-zinc-500",children:"You can now sign in with your new password."}),(0,t.jsx)("button",{type:"button",onClick:()=>s.push("/login"),className:"mt-2 inline-flex w-full justify-center rounded-full bg-stone-900 px-6 py-3 text-sm font-semibold text-white transition hover:bg-orange-700 dark:bg-orange-400 dark:text-white dark:hover:bg-orange-300",children:"Sign in"})]})}):(0,t.jsxs)(l,{children:[(0,t.jsxs)("form",{onSubmit:y,className:"space-y-5",children:[g&&(0,t.jsx)("div",{className:"rounded-xl border border-red-900/50 bg-red-950/50 px-4 py-3 text-sm text-red-400",children:g}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"New password"}),(0,t.jsx)("input",{type:"password",required:!0,minLength:8,value:u,onChange:e=>c(e.target.value),placeholder:"••••••••",className:"w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm text-stone-900 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"mb-1.5 block text-sm font-medium text-zinc-300",children:"Confirm password"}),(0,t.jsx)("input",{type:"password",required:!0,minLength:8,value:d,onChange:e=>f(e.target.value),placeholder:"••••••••",className:"w-full rounded-2xl border border-stone-200 bg-white px-4 py-3 text-sm text-stone-900 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-orange-500 dark:border-blue-800 dark:bg-[#07101e]/80 dark:text-stone-100"})]}),(0,t.jsx)("button",{type:"submit",disabled:p,className:"inline-flex w-full justify-center rounded-full bg-stone-900 px-6 py-3 text-sm font-semibold text-white transition hover:bg-orange-700 disabled:opacity-50 dark:bg-orange-400 dark:text-white dark:hover:bg-orange-300",children:p?"Resetting…":"Reset password"})]}),(0,t.jsx)("div",{className:"mt-6 text-center",children:(0,t.jsx)(r.default,{href:"/login",className:"text-sm text-zinc-500 hover:text-zinc-300 transition-colors",children:"Back to sign in"})})]}):(0,t.jsxs)(l,{children:[(0,t.jsx)("p",{className:"text-sm text-zinc-400 text-center",children:"No reset token found."}),(0,t.jsx)("div",{className:"mt-4 text-center",children:(0,t.jsx)(r.default,{href:"/forgot-password",className:"text-sm text-emerald-400 hover:text-emerald-300",children:"Request a new reset link"})})]})}function l({children:e}){return(0,t.jsx)(s.default,{children:(0,t.jsx)("main",{className:"flex flex-1 items-center justify-center px-4",children:(0,t.jsxs)("div",{className:"w-full max-w-md",children:[(0,t.jsxs)("div",{className:"mb-8 text-center",children:[(0,t.jsx)(r.default,{href:"/",className:"text-xs font-semibold uppercase tracking-[0.2em] text-orange-700 dark:text-orange-300",children:"RentalDriveGo"}),(0,t.jsx)("h1",{className:"mt-3 text-3xl font-black tracking-tight",children:"Reset password"})]}),(0,t.jsx)("div",{className:"panel p-8",children:e})]})})})}e.s(["default",0,function(){return(0,t.jsx)(n.Suspense,{children:(0,t.jsx)(i,{})})}])}]); |