(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 s={assign:function(){return o},searchParamsToUrlQuery:function(){return i},urlQueryToSearchParams:function(){return u}};for(var n in s)Object.defineProperty(r,n,{enumerable:!0,get:s[n]});function i(e){let t={};for(let[r,s]of e.entries()){let e=t[r];void 0===e?t[r]=s:Array.isArray(e)?e.push(s):t[r]=[e,s]}return t}function a(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function u(e){let t=new URLSearchParams;for(let[r,s]of Object.entries(e))if(Array.isArray(s))for(let e of s)t.append(r,a(e));else t.set(r,a(s));return t}function o(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,s]of r.entries())e.append(t,s)}return e}},18967,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0});var s={DecodeError:function(){return g},MiddlewareNotFoundError:function(){return O},MissingStaticPage:function(){return v},NormalizeError:function(){return b},PageNotFoundError:function(){return x},SP:function(){return p},ST:function(){return m},WEB_VITALS:function(){return i},execOnce:function(){return a},getDisplayName:function(){return h},getLocationOrigin:function(){return l},getURL:function(){return c},isAbsoluteUrl:function(){return o},isResSent:function(){return f},loadGetInitialProps:function(){return y},normalizeRepeatedSlashes:function(){return d},stringifyError:function(){return q}};for(var n in s)Object.defineProperty(r,n,{enumerable:!0,get:s[n]});let i=["CLS","FCP","FID","INP","LCP","TTFB"];function a(e){let t,r=!1;return(...s)=>(r||(r=!0,t=e(...s)),t)}let u=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,o=e=>u.test(e);function l(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=l();return e.substring(t.length)}function h(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function d(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function y(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await y(t.Component,t.ctx)}:{};let s=await e.getInitialProps(t);if(r&&f(r))return s;if(!s)throw Object.defineProperty(Error(`"${h(e)}.getInitialProps()" should resolve to an object. But found "${s}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return s}let p="u">typeof performance,m=p&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class g extends Error{}class b extends Error{}class x extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class v extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class O extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function q(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 s}});let s=e=>{}},10400,e=>{"use strict";var t=e.i(43476),r=e.i(66027),s=e.i(18566),n=e.i(71645),i=e.i(5125),a=e.i(22858),u=e.i(75254);let o=(0,u.default)("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]),l=(0,u.default)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var c=e.i(22016),h=e.i(75157);let f=[{href:"/",icon:o,label:"Home"},{href:"/fuel/new",icon:a.Fuel,label:"Tanken"},{href:"/vehicles",icon:i.Car,label:"Autos"},{href:"/settings",icon:l,label:"Einstellungen"}];function d(){let e=(0,s.usePathname)();return(0,t.jsx)("nav",{className:"fixed bottom-0 left-0 right-0 z-40 grid h-16 grid-cols-4 border-t border-border bg-surface/95 px-2 backdrop-blur lg:hidden",children:f.map(r=>{let s=r.icon,n=e===r.href;return(0,t.jsxs)(c.default,{href:r.href,className:(0,h.cn)("flex flex-col items-center justify-center gap-1 text-[11px] text-slate-400",n&&"text-primary"),children:[(0,t.jsx)(s,{size:20}),r.label]},`${r.href}-${r.label}`)})})}let y=(0,u.default)("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);var p=e.i(12598),m=e.i(59544),g=e.i(61238);async function b(){let{data:e}=await g.api.get("/api/users/me");return e}var x=e.i(92028);function v(){let e=(0,s.useRouter)(),n=(0,p.useQueryClient)(),i=(0,x.useAuthStore)(e=>e.logout),a=(0,r.useQuery)({queryKey:["current-user"],queryFn:b,retry:!1}),u=async()=>{try{await g.api.post("/api/auth/logout")}catch{}i(),n.clear(),e.replace("/login")};return(0,t.jsxs)("header",{className:"sticky top-0 z-30 flex h-16 items-center justify-between border-b border-border bg-background/80 px-4 backdrop-blur lg:px-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("p",{className:"text-sm text-slate-400",children:["Guten Morgen",a.data?.email?`, ${a.data.email}`:""]}),(0,t.jsx)("h1",{className:"text-lg font-bold text-white",children:"Karrage"})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)(m.Button,{variant:"ghost",onClick:u,"aria-label":"Logout",children:[(0,t.jsx)(y,{size:18})," Abmelden"]})})]})}var O=e.i(17923);let q=[{href:"/",label:"Dashboard",icon:o},{href:"/fuel/new",label:"Tanken",icon:a.Fuel},{href:"/vehicles",label:"Fahrzeuge",icon:i.Car},{href:"/settings",label:"Einstellungen",icon:l}];function C(){let e=(0,s.usePathname)();return(0,t.jsxs)("aside",{className:"fixed inset-y-0 left-0 hidden w-60 border-r border-border bg-surface/95 p-5 lg:block",children:[(0,t.jsxs)(c.default,{href:"/",className:"flex items-center gap-3 text-xl font-bold text-white",children:[(0,t.jsx)("span",{className:"grid h-10 w-10 place-items-center rounded-2xl bg-primary",children:(0,t.jsx)(i.Car,{size:22})}),"Karrage"]}),(0,t.jsx)("nav",{className:"mt-8 space-y-2",children:q.map(r=>{let s=r.icon,n=e===r.href;return(0,t.jsxs)(c.default,{href:r.href,className:(0,h.cn)("flex items-center gap-3 rounded-xl px-3 py-3 text-sm font-medium text-slate-300 transition hover:bg-hover",n&&"bg-elevated text-white"),children:[(0,t.jsx)(s,{size:18}),r.label]},r.href)})}),(0,t.jsxs)("div",{className:"absolute bottom-5 left-5 right-5 rounded-2xl border border-border bg-elevated p-4",children:[(0,t.jsx)(O.BarChart3,{className:"text-secondary",size:20}),(0,t.jsx)("p",{className:"mt-3 text-sm font-semibold text-slate-100",children:"Mai 2026"}),(0,t.jsx)("p",{className:"mt-1 text-xs text-slate-400",children:"Bereit für die nächste Fahrt."})]})]})}let j=new Set(["/login"]);function M({title:e,subtitle:r}){return(0,t.jsx)("main",{className:"grid min-h-screen place-items-center px-4",children:(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("h1",{className:"text-2xl font-bold text-white",children:e}),(0,t.jsx)("p",{className:"mt-2 text-sm text-slate-400",children:r})]})})}e.s(["AppShell",0,function({children:e}){let i=(0,s.usePathname)(),a=(0,s.useRouter)(),u=(0,s.useSearchParams)(),o=(0,x.useAuthStore)(e=>e.authenticated),l=(0,x.useAuthStore)(e=>e.setAuthenticated),c=j.has(i),h=(0,r.useQuery)({queryKey:["current-user"],queryFn:b,retry:!1});return((0,n.useEffect)(()=>{window.localStorage.removeItem("karrage-auth")},[]),(0,n.useEffect)(()=>{h.isSuccess?l(!0):h.isError&&l(!1)},[h.isError,h.isSuccess,l]),(0,n.useEffect)(()=>{if(null!==o){if(!o&&!c){let e=`${i}${u.toString()?`?${u.toString()}`:""}`;a.replace(`/login?next=${encodeURIComponent(e)}`);return}o&&"/login"===i&&a.replace(u.get("next")||"/")}},[o,c,i,a,u]),null===o||h.isLoading)?(0,t.jsx)(M,{title:"Karrage",subtitle:"Session wird geladen..."}):o||c?c?(0,t.jsx)("main",{className:"min-h-screen px-4 py-6",children:e}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(C,{}),(0,t.jsxs)("div",{className:"min-h-screen pb-20 lg:ml-60 lg:pb-0",children:[(0,t.jsx)(v,{}),(0,t.jsx)("main",{className:"mx-auto w-full max-w-7xl px-4 py-6 lg:px-8",children:e})]}),(0,t.jsx)(d,{})]}):(0,t.jsx)(M,{title:"Karrage",subtitle:"Weiterleitung zum Login..."})}],10400)},39948,e=>{"use strict";var t=e.i(43476),r=e.i(19273),s=e.i(86491),n=e.i(40143),i=e.i(15823),a=class extends i.Subscribable{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let i=t.queryKey,a=t.queryHash??(0,r.hashQueryKeyByOptions)(i,t),u=this.get(a);return u||(u=new s.Query({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(u)),u}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,r.matchQuery)(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>(0,r.matchQuery)(e,t)):t}notify(e){n.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){n.notifyManager.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},u=e.i(14272),o=i,l=class extends o.Subscribable{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#r=new Map,this.#s=0}#t;#r;#s;build(e,t,r){let s=new u.Mutation({client:e,mutationCache:this,mutationId:++this.#s,options:e.defaultMutationOptions(t),state:r});return this.add(s),s}add(e){this.#t.add(e);let t=c(e);if("string"==typeof t){let r=this.#r.get(t);r?r.push(e):this.#r.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){let t=c(e);if("string"==typeof t){let r=this.#r.get(t);if(r)if(r.length>1){let t=r.indexOf(e);-1!==t&&r.splice(t,1)}else r[0]===e&&this.#r.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){let t=c(e);if("string"!=typeof t)return!0;{let r=this.#r.get(t),s=r?.find(e=>"pending"===e.state.status);return!s||s===e}}runNext(e){let t=c(e);if("string"!=typeof t)return Promise.resolve();{let r=this.#r.get(t)?.find(t=>t!==e&&t.state.isPaused);return r?.continue()??Promise.resolve()}}clear(){n.notifyManager.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#r.clear()})}getAll(){return Array.from(this.#t)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>(0,r.matchMutation)(t,e))}findAll(e={}){return this.getAll().filter(t=>(0,r.matchMutation)(e,t))}notify(e){n.notifyManager.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return n.notifyManager.batch(()=>Promise.all(e.map(e=>e.continue().catch(r.noop))))}};function c(e){return e.options.scope?.id}var h=e.i(75555),f=e.i(14448),d=class{#n;#i;#a;#u;#o;#l;#c;#h;constructor(e={}){this.#n=e.queryCache||new a,this.#i=e.mutationCache||new l,this.#a=e.defaultOptions||{},this.#u=new Map,this.#o=new Map,this.#l=0}mount(){this.#l++,1===this.#l&&(this.#c=h.focusManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#n.onFocus())}),this.#h=f.onlineManager.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#n.onOnline())}))}unmount(){this.#l--,0===this.#l&&(this.#c?.(),this.#c=void 0,this.#h?.(),this.#h=void 0)}isFetching(e){return this.#n.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#i.findAll({...e,status:"pending"}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#n.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),s=this.#n.build(this,t),n=s.state.data;return void 0===n?this.fetchQuery(e):(e.revalidateIfStale&&s.isStaleByTime((0,r.resolveStaleTime)(t.staleTime,s))&&this.prefetchQuery(t),Promise.resolve(n))}getQueriesData(e){return this.#n.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,s){let n=this.defaultQueryOptions({queryKey:e}),i=this.#n.get(n.queryHash),a=i?.state.data,u=(0,r.functionalUpdate)(t,a);if(void 0!==u)return this.#n.build(this,n).setData(u,{...s,manual:!0})}setQueriesData(e,t,r){return n.notifyManager.batch(()=>this.#n.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,r)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#n.get(t.queryHash)?.state}removeQueries(e){let t=this.#n;n.notifyManager.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let r=this.#n;return n.notifyManager.batch(()=>(r.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){let s={revert:!0,...t};return Promise.all(n.notifyManager.batch(()=>this.#n.findAll(e).map(e=>e.cancel(s)))).then(r.noop).catch(r.noop)}invalidateQueries(e,t={}){return n.notifyManager.batch(()=>(this.#n.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType==="none")?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t))}refetchQueries(e,t={}){let s={...t,cancelRefetch:t.cancelRefetch??!0};return Promise.all(n.notifyManager.batch(()=>this.#n.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,s);return s.throwOnError||(t=t.catch(r.noop)),"paused"===e.state.fetchStatus?Promise.resolve():t}))).then(r.noop)}fetchQuery(e){let t=this.defaultQueryOptions(e);void 0===t.retry&&(t.retry=!1);let s=this.#n.build(this,t);return s.isStaleByTime((0,r.resolveStaleTime)(t.staleTime,s))?s.fetch(t):Promise.resolve(s.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(r.noop).catch(r.noop)}fetchInfiniteQuery(e){return e._type="infinite",this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(r.noop).catch(r.noop)}ensureInfiniteQueryData(e){return e._type="infinite",this.ensureQueryData(e)}resumePausedMutations(){return f.onlineManager.isOnline()?this.#i.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#n}getMutationCache(){return this.#i}getDefaultOptions(){return this.#a}setDefaultOptions(e){this.#a=e}setQueryDefaults(e,t){this.#u.set((0,r.hashKey)(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#u.values()],s={};return t.forEach(t=>{(0,r.partialMatchKey)(e,t.queryKey)&&Object.assign(s,t.defaultOptions)}),s}setMutationDefaults(e,t){this.#o.set((0,r.hashKey)(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#o.values()],s={};return t.forEach(t=>{(0,r.partialMatchKey)(e,t.mutationKey)&&Object.assign(s,t.defaultOptions)}),s}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#a.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=(0,r.hashQueryKeyByOptions)(t.queryKey,t)),void 0===t.refetchOnReconnect&&(t.refetchOnReconnect="always"!==t.networkMode),void 0===t.throwOnError&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===r.skipToken&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#a.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#n.clear(),this.#i.clear()}},y=e.i(12598),p=e.i(71645);e.s(["Providers",0,function({children:e}){let[r]=(0,p.useState)(()=>new d({defaultOptions:{queries:{staleTime:3e4,retry:1}}}));return(0,t.jsx)(y.QueryClientProvider,{client:r,children:e})}],39948)}]);