var __defProp = Object.defineProperty;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
import * as React from "react";
import React__default, { useState, useRef, useEffect, useMemo } from "react";
import ReactDOMServer from "react-dom/server";
import require$$0 from "react-router/dom";
import require$$1 from "react-router";
import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector.js";
import { isAction, isPlainObject, combineReducers, applyMiddleware, compose, createStore } from "redux";
import { produce, isDraftable, isDraft } from "immer";
import { thunk, withExtraArgument } from "redux-thunk";
import axios from "axios";
import toast$2, { toast as toast$1, Toaster } from "react-hot-toast";
import i18n from "i18next";
import { initReactI18next, useTranslation } from "react-i18next";
import { GoogleLogin, GoogleOAuthProvider } from "@react-oauth/google";
import { Briefcase, Headphones, User, Tag, Gift, X, Menu, Verified, ChevronDown, MapPin, Plus, Clock, XCircle, Backpack, Camera, AlertCircle, CheckCircle2, Loader, ArrowUpDown, Calendar, Star, Car, ChevronRight, ArrowLeft, MessageSquare, Phone, ChevronUp, Paperclip, Send } from "lucide-react";
import { ChevronUpIcon, ChevronDownIcon } from "@heroicons/react/24/solid";
var dist = { exports: {} };
/**
 * react-router-dom v7.12.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */
(function(module) {
  var __defProp2 = Object.defineProperty;
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
  var __getOwnPropNames = Object.getOwnPropertyNames;
  var __hasOwnProp = Object.prototype.hasOwnProperty;
  var __export = (target, all) => {
    for (var name in all)
      __defProp2(target, name, { get: all[name], enumerable: true });
  };
  var __copyProps = (to, from, except, desc) => {
    if (from && typeof from === "object" || typeof from === "function") {
      for (let key of __getOwnPropNames(from))
        if (!__hasOwnProp.call(to, key) && key !== except)
          __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
    }
    return to;
  };
  var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
  var __toCommonJS = (mod) => __copyProps(__defProp2({}, "__esModule", { value: true }), mod);
  var index_exports = {};
  __export(index_exports, {
    HydratedRouter: () => import_dom2.HydratedRouter,
    RouterProvider: () => import_dom2.RouterProvider
  });
  module.exports = __toCommonJS(index_exports);
  var import_dom2 = require$$0;
  __reExport(index_exports, require$$1, module.exports);
})(dist);
var distExports = dist.exports;
function defaultNoopBatch(callback) {
  callback();
}
function createListenerCollection() {
  let first = null;
  let last = null;
  return {
    clear() {
      first = null;
      last = null;
    },
    notify() {
      defaultNoopBatch(() => {
        let listener = first;
        while (listener) {
          listener.callback();
          listener = listener.next;
        }
      });
    },
    get() {
      const listeners = [];
      let listener = first;
      while (listener) {
        listeners.push(listener);
        listener = listener.next;
      }
      return listeners;
    },
    subscribe(callback) {
      let isSubscribed = true;
      const listener = last = {
        callback,
        next: null,
        prev: last
      };
      if (listener.prev) {
        listener.prev.next = listener;
      } else {
        first = listener;
      }
      return function unsubscribe() {
        if (!isSubscribed || first === null) return;
        isSubscribed = false;
        if (listener.next) {
          listener.next.prev = listener.prev;
        } else {
          last = listener.prev;
        }
        if (listener.prev) {
          listener.prev.next = listener.next;
        } else {
          first = listener.next;
        }
      };
    }
  };
}
var nullListeners = {
  notify() {
  },
  get: () => []
};
function createSubscription(store, parentSub) {
  let unsubscribe;
  let listeners = nullListeners;
  let subscriptionsAmount = 0;
  let selfSubscribed = false;
  function addNestedSub(listener) {
    trySubscribe();
    const cleanupListener = listeners.subscribe(listener);
    let removed = false;
    return () => {
      if (!removed) {
        removed = true;
        cleanupListener();
        tryUnsubscribe();
      }
    };
  }
  function notifyNestedSubs() {
    listeners.notify();
  }
  function handleChangeWrapper() {
    if (subscription.onStateChange) {
      subscription.onStateChange();
    }
  }
  function isSubscribed() {
    return selfSubscribed;
  }
  function trySubscribe() {
    subscriptionsAmount++;
    if (!unsubscribe) {
      unsubscribe = store.subscribe(handleChangeWrapper);
      listeners = createListenerCollection();
    }
  }
  function tryUnsubscribe() {
    subscriptionsAmount--;
    if (unsubscribe && subscriptionsAmount === 0) {
      unsubscribe();
      unsubscribe = void 0;
      listeners.clear();
      listeners = nullListeners;
    }
  }
  function trySubscribeSelf() {
    if (!selfSubscribed) {
      selfSubscribed = true;
      trySubscribe();
    }
  }
  function tryUnsubscribeSelf() {
    if (selfSubscribed) {
      selfSubscribed = false;
      tryUnsubscribe();
    }
  }
  const subscription = {
    addNestedSub,
    notifyNestedSubs,
    handleChangeWrapper,
    isSubscribed,
    trySubscribe: trySubscribeSelf,
    tryUnsubscribe: tryUnsubscribeSelf,
    getListeners: () => listeners
  };
  return subscription;
}
var canUseDOM = () => !!(typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined");
var isDOM = /* @__PURE__ */ canUseDOM();
var isRunningInReactNative = () => typeof navigator !== "undefined" && navigator.product === "ReactNative";
var isReactNative = /* @__PURE__ */ isRunningInReactNative();
var getUseIsomorphicLayoutEffect = () => isDOM || isReactNative ? React.useLayoutEffect : React.useEffect;
var useIsomorphicLayoutEffect = /* @__PURE__ */ getUseIsomorphicLayoutEffect();
var ContextKey = /* @__PURE__ */ Symbol.for(`react-redux-context`);
var gT = typeof globalThis !== "undefined" ? globalThis : (
  /* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */
  {}
);
function getContext() {
  if (!React.createContext) return {};
  const contextMap = gT[ContextKey] ?? (gT[ContextKey] = /* @__PURE__ */ new Map());
  let realContext = contextMap.get(React.createContext);
  if (!realContext) {
    realContext = React.createContext(
      null
    );
    if (process.env.NODE_ENV !== "production") {
      realContext.displayName = "ReactRedux";
    }
    contextMap.set(React.createContext, realContext);
  }
  return realContext;
}
var ReactReduxContext = /* @__PURE__ */ getContext();
function Provider(providerProps) {
  const { children, context, serverState, store } = providerProps;
  const contextValue = React.useMemo(() => {
    const subscription = createSubscription(store);
    const baseContextValue = {
      store,
      subscription,
      getServerState: serverState ? () => serverState : void 0
    };
    if (process.env.NODE_ENV === "production") {
      return baseContextValue;
    } else {
      const { identityFunctionCheck = "once", stabilityCheck = "once" } = providerProps;
      return /* @__PURE__ */ Object.assign(baseContextValue, {
        stabilityCheck,
        identityFunctionCheck
      });
    }
  }, [store, serverState]);
  const previousState = React.useMemo(() => store.getState(), [store]);
  useIsomorphicLayoutEffect(() => {
    const { subscription } = contextValue;
    subscription.onStateChange = subscription.notifyNestedSubs;
    subscription.trySubscribe();
    if (previousState !== store.getState()) {
      subscription.notifyNestedSubs();
    }
    return () => {
      subscription.tryUnsubscribe();
      subscription.onStateChange = void 0;
    };
  }, [contextValue, previousState]);
  const Context = context || ReactReduxContext;
  return /* @__PURE__ */ React.createElement(Context.Provider, { value: contextValue }, children);
}
var Provider_default = Provider;
function createReduxContextHook(context = ReactReduxContext) {
  return function useReduxContext2() {
    const contextValue = React.useContext(context);
    if (process.env.NODE_ENV !== "production" && !contextValue) {
      throw new Error(
        "could not find react-redux context value; please ensure the component is wrapped in a <Provider>"
      );
    }
    return contextValue;
  };
}
var useReduxContext = /* @__PURE__ */ createReduxContextHook();
function createStoreHook(context = ReactReduxContext) {
  const useReduxContext2 = context === ReactReduxContext ? useReduxContext : (
    // @ts-ignore
    createReduxContextHook(context)
  );
  const useStore2 = () => {
    const { store } = useReduxContext2();
    return store;
  };
  Object.assign(useStore2, {
    withTypes: () => useStore2
  });
  return useStore2;
}
var useStore = /* @__PURE__ */ createStoreHook();
function createDispatchHook(context = ReactReduxContext) {
  const useStore2 = context === ReactReduxContext ? useStore : createStoreHook(context);
  const useDispatch2 = () => {
    const store = useStore2();
    return store.dispatch;
  };
  Object.assign(useDispatch2, {
    withTypes: () => useDispatch2
  });
  return useDispatch2;
}
var useDispatch = /* @__PURE__ */ createDispatchHook();
var refEquality = (a, b) => a === b;
function createSelectorHook(context = ReactReduxContext) {
  const useReduxContext2 = context === ReactReduxContext ? useReduxContext : createReduxContextHook(context);
  const useSelector2 = (selector, equalityFnOrOptions = {}) => {
    const { equalityFn = refEquality } = typeof equalityFnOrOptions === "function" ? { equalityFn: equalityFnOrOptions } : equalityFnOrOptions;
    if (process.env.NODE_ENV !== "production") {
      if (!selector) {
        throw new Error(`You must pass a selector to useSelector`);
      }
      if (typeof selector !== "function") {
        throw new Error(`You must pass a function as a selector to useSelector`);
      }
      if (typeof equalityFn !== "function") {
        throw new Error(
          `You must pass a function as an equality function to useSelector`
        );
      }
    }
    const reduxContext = useReduxContext2();
    const { store, subscription, getServerState } = reduxContext;
    const firstRun = React.useRef(true);
    const wrappedSelector = React.useCallback(
      {
        [selector.name](state) {
          const selected = selector(state);
          if (process.env.NODE_ENV !== "production") {
            const { devModeChecks = {} } = typeof equalityFnOrOptions === "function" ? {} : equalityFnOrOptions;
            const { identityFunctionCheck, stabilityCheck } = reduxContext;
            const {
              identityFunctionCheck: finalIdentityFunctionCheck,
              stabilityCheck: finalStabilityCheck
            } = {
              stabilityCheck,
              identityFunctionCheck,
              ...devModeChecks
            };
            if (finalStabilityCheck === "always" || finalStabilityCheck === "once" && firstRun.current) {
              const toCompare = selector(state);
              if (!equalityFn(selected, toCompare)) {
                let stack = void 0;
                try {
                  throw new Error();
                } catch (e) {
                  ({ stack } = e);
                }
                console.warn(
                  "Selector " + (selector.name || "unknown") + " returned a different result when called with the same parameters. This can lead to unnecessary rerenders.\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization",
                  {
                    state,
                    selected,
                    selected2: toCompare,
                    stack
                  }
                );
              }
            }
            if (finalIdentityFunctionCheck === "always" || finalIdentityFunctionCheck === "once" && firstRun.current) {
              if (selected === state) {
                let stack = void 0;
                try {
                  throw new Error();
                } catch (e) {
                  ({ stack } = e);
                }
                console.warn(
                  "Selector " + (selector.name || "unknown") + " returned the root state when called. This can lead to unnecessary rerenders.\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.",
                  { stack }
                );
              }
            }
            if (firstRun.current) firstRun.current = false;
          }
          return selected;
        }
      }[selector.name],
      [selector]
    );
    const selectedState = useSyncExternalStoreWithSelector(
      subscription.addNestedSub,
      store.getState,
      getServerState || store.getState,
      wrappedSelector,
      equalityFn
    );
    React.useDebugValue(selectedState);
    return selectedState;
  };
  Object.assign(useSelector2, {
    withTypes: () => useSelector2
  });
  return useSelector2;
}
var useSelector = /* @__PURE__ */ createSelectorHook();
var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function() {
  if (arguments.length === 0) return void 0;
  if (typeof arguments[0] === "object") return compose;
  return compose.apply(null, arguments);
};
var hasMatchFunction = (v) => {
  return v && typeof v.match === "function";
};
function createAction(type, prepareAction) {
  function actionCreator(...args) {
    if (prepareAction) {
      let prepared = prepareAction(...args);
      if (!prepared) {
        throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(0) : "prepareAction did not return an object");
      }
      return {
        type,
        payload: prepared.payload,
        ..."meta" in prepared && {
          meta: prepared.meta
        },
        ..."error" in prepared && {
          error: prepared.error
        }
      };
    }
    return {
      type,
      payload: args[0]
    };
  }
  actionCreator.toString = () => `${type}`;
  actionCreator.type = type;
  actionCreator.match = (action) => isAction(action) && action.type === type;
  return actionCreator;
}
function isActionCreator(action) {
  return typeof action === "function" && "type" in action && // hasMatchFunction only wants Matchers but I don't see the point in rewriting it
  hasMatchFunction(action);
}
function getMessage(type) {
  const splitType = type ? `${type}`.split("/") : [];
  const actionName = splitType[splitType.length - 1] || "actionCreator";
  return `Detected an action creator with type "${type || "unknown"}" being dispatched. 
Make sure you're calling the action creator before dispatching, i.e. \`dispatch(${actionName}())\` instead of \`dispatch(${actionName})\`. This is necessary even if the action has no payload.`;
}
function createActionCreatorInvariantMiddleware(options = {}) {
  if (process.env.NODE_ENV === "production") {
    return () => (next) => (action) => next(action);
  }
  const {
    isActionCreator: isActionCreator2 = isActionCreator
  } = options;
  return () => (next) => (action) => {
    if (isActionCreator2(action)) {
      console.warn(getMessage(action.type));
    }
    return next(action);
  };
}
function getTimeMeasureUtils(maxDelay, fnName) {
  let elapsed = 0;
  return {
    measureTime(fn) {
      const started = Date.now();
      try {
        return fn();
      } finally {
        const finished = Date.now();
        elapsed += finished - started;
      }
    },
    warnIfExceeded() {
      if (elapsed > maxDelay) {
        console.warn(`${fnName} took ${elapsed}ms, which is more than the warning threshold of ${maxDelay}ms. 
If your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.
It is disabled in production builds, so you don't need to worry about that.`);
      }
    }
  };
}
var Tuple = class _Tuple extends Array {
  constructor(...items) {
    super(...items);
    Object.setPrototypeOf(this, _Tuple.prototype);
  }
  static get [Symbol.species]() {
    return _Tuple;
  }
  concat(...arr) {
    return super.concat.apply(this, arr);
  }
  prepend(...arr) {
    if (arr.length === 1 && Array.isArray(arr[0])) {
      return new _Tuple(...arr[0].concat(this));
    }
    return new _Tuple(...arr.concat(this));
  }
};
function freezeDraftable(val) {
  return isDraftable(val) ? produce(val, () => {
  }) : val;
}
function getOrInsertComputed(map, key, compute) {
  if (map.has(key)) return map.get(key);
  return map.set(key, compute(key)).get(key);
}
function isImmutableDefault(value) {
  return typeof value !== "object" || value == null || Object.isFrozen(value);
}
function trackForMutations(isImmutable, ignoredPaths, obj) {
  const trackedProperties = trackProperties(isImmutable, ignoredPaths, obj);
  return {
    detectMutations() {
      return detectMutations(isImmutable, ignoredPaths, trackedProperties, obj);
    }
  };
}
function trackProperties(isImmutable, ignoredPaths = [], obj, path = "", checkedObjects = /* @__PURE__ */ new Set()) {
  const tracked = {
    value: obj
  };
  if (!isImmutable(obj) && !checkedObjects.has(obj)) {
    checkedObjects.add(obj);
    tracked.children = {};
    const hasIgnoredPaths = ignoredPaths.length > 0;
    for (const key in obj) {
      const nestedPath = path ? path + "." + key : key;
      if (hasIgnoredPaths) {
        const hasMatches = ignoredPaths.some((ignored) => {
          if (ignored instanceof RegExp) {
            return ignored.test(nestedPath);
          }
          return nestedPath === ignored;
        });
        if (hasMatches) {
          continue;
        }
      }
      tracked.children[key] = trackProperties(isImmutable, ignoredPaths, obj[key], nestedPath);
    }
  }
  return tracked;
}
function detectMutations(isImmutable, ignoredPaths = [], trackedProperty, obj, sameParentRef = false, path = "") {
  const prevObj = trackedProperty ? trackedProperty.value : void 0;
  const sameRef = prevObj === obj;
  if (sameParentRef && !sameRef && !Number.isNaN(obj)) {
    return {
      wasMutated: true,
      path
    };
  }
  if (isImmutable(prevObj) || isImmutable(obj)) {
    return {
      wasMutated: false
    };
  }
  const keysToDetect = {};
  for (let key in trackedProperty.children) {
    keysToDetect[key] = true;
  }
  for (let key in obj) {
    keysToDetect[key] = true;
  }
  const hasIgnoredPaths = ignoredPaths.length > 0;
  for (let key in keysToDetect) {
    const nestedPath = path ? path + "." + key : key;
    if (hasIgnoredPaths) {
      const hasMatches = ignoredPaths.some((ignored) => {
        if (ignored instanceof RegExp) {
          return ignored.test(nestedPath);
        }
        return nestedPath === ignored;
      });
      if (hasMatches) {
        continue;
      }
    }
    const result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath);
    if (result.wasMutated) {
      return result;
    }
  }
  return {
    wasMutated: false
  };
}
function createImmutableStateInvariantMiddleware(options = {}) {
  if (process.env.NODE_ENV === "production") {
    return () => (next) => (action) => next(action);
  } else {
    let stringify2 = function(obj, serializer, indent, decycler) {
      return JSON.stringify(obj, getSerialize2(serializer, decycler), indent);
    }, getSerialize2 = function(serializer, decycler) {
      let stack = [], keys = [];
      if (!decycler) decycler = function(_, value) {
        if (stack[0] === value) return "[Circular ~]";
        return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]";
      };
      return function(key, value) {
        if (stack.length > 0) {
          var thisPos = stack.indexOf(this);
          ~thisPos ? stack.splice(thisPos + 1) : stack.push(this);
          ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key);
          if (~stack.indexOf(value)) value = decycler.call(this, key, value);
        } else stack.push(value);
        return serializer == null ? value : serializer.call(this, key, value);
      };
    };
    let {
      isImmutable = isImmutableDefault,
      ignoredPaths,
      warnAfter = 32
    } = options;
    const track = trackForMutations.bind(null, isImmutable, ignoredPaths);
    return ({
      getState
    }) => {
      let state = getState();
      let tracker = track(state);
      let result;
      return (next) => (action) => {
        const measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware");
        measureUtils.measureTime(() => {
          state = getState();
          result = tracker.detectMutations();
          tracker = track(state);
          if (result.wasMutated) {
            throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(19) : `A state mutation was detected between dispatches, in the path '${result.path || ""}'.  This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
          }
        });
        const dispatchedAction = next(action);
        measureUtils.measureTime(() => {
          state = getState();
          result = tracker.detectMutations();
          tracker = track(state);
          if (result.wasMutated) {
            throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(20) : `A state mutation was detected inside a dispatch, in the path: ${result.path || ""}. Take a look at the reducer(s) handling the action ${stringify2(action)}. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)`);
          }
        });
        measureUtils.warnIfExceeded();
        return dispatchedAction;
      };
    };
  }
}
function isPlain(val) {
  const type = typeof val;
  return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val);
}
function findNonSerializableValue(value, path = "", isSerializable = isPlain, getEntries, ignoredPaths = [], cache) {
  let foundNestedSerializable;
  if (!isSerializable(value)) {
    return {
      keyPath: path || "<root>",
      value
    };
  }
  if (typeof value !== "object" || value === null) {
    return false;
  }
  if (cache == null ? void 0 : cache.has(value)) return false;
  const entries = getEntries != null ? getEntries(value) : Object.entries(value);
  const hasIgnoredPaths = ignoredPaths.length > 0;
  for (const [key, nestedValue] of entries) {
    const nestedPath = path ? path + "." + key : key;
    if (hasIgnoredPaths) {
      const hasMatches = ignoredPaths.some((ignored) => {
        if (ignored instanceof RegExp) {
          return ignored.test(nestedPath);
        }
        return nestedPath === ignored;
      });
      if (hasMatches) {
        continue;
      }
    }
    if (!isSerializable(nestedValue)) {
      return {
        keyPath: nestedPath,
        value: nestedValue
      };
    }
    if (typeof nestedValue === "object") {
      foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache);
      if (foundNestedSerializable) {
        return foundNestedSerializable;
      }
    }
  }
  if (cache && isNestedFrozen(value)) cache.add(value);
  return false;
}
function isNestedFrozen(value) {
  if (!Object.isFrozen(value)) return false;
  for (const nestedValue of Object.values(value)) {
    if (typeof nestedValue !== "object" || nestedValue === null) continue;
    if (!isNestedFrozen(nestedValue)) return false;
  }
  return true;
}
function createSerializableStateInvariantMiddleware(options = {}) {
  if (process.env.NODE_ENV === "production") {
    return () => (next) => (action) => next(action);
  } else {
    const {
      isSerializable = isPlain,
      getEntries,
      ignoredActions = [],
      ignoredActionPaths = ["meta.arg", "meta.baseQueryMeta"],
      ignoredPaths = [],
      warnAfter = 32,
      ignoreState = false,
      ignoreActions = false,
      disableCache = false
    } = options;
    const cache = !disableCache && WeakSet ? /* @__PURE__ */ new WeakSet() : void 0;
    return (storeAPI) => (next) => (action) => {
      if (!isAction(action)) {
        return next(action);
      }
      const result = next(action);
      const measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware");
      if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) {
        measureUtils.measureTime(() => {
          const foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache);
          if (foundActionNonSerializableValue) {
            const {
              keyPath,
              value
            } = foundActionNonSerializableValue;
            console.error(`A non-serializable value was detected in an action, in the path: \`${keyPath}\`. Value:`, value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)");
          }
        });
      }
      if (!ignoreState) {
        measureUtils.measureTime(() => {
          const state = storeAPI.getState();
          const foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache);
          if (foundStateNonSerializableValue) {
            const {
              keyPath,
              value
            } = foundStateNonSerializableValue;
            console.error(`A non-serializable value was detected in the state, in the path: \`${keyPath}\`. Value:`, value, `
Take a look at the reducer(s) handling this action type: ${action.type}.
(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)`);
          }
        });
        measureUtils.warnIfExceeded();
      }
      return result;
    };
  }
}
function isBoolean(x) {
  return typeof x === "boolean";
}
var buildGetDefaultMiddleware = () => function getDefaultMiddleware(options) {
  const {
    thunk: thunk$1 = true,
    immutableCheck = true,
    serializableCheck = true,
    actionCreatorCheck = true
  } = options ?? {};
  let middlewareArray = new Tuple();
  if (thunk$1) {
    if (isBoolean(thunk$1)) {
      middlewareArray.push(thunk);
    } else {
      middlewareArray.push(withExtraArgument(thunk$1.extraArgument));
    }
  }
  if (process.env.NODE_ENV !== "production") {
    if (immutableCheck) {
      let immutableOptions = {};
      if (!isBoolean(immutableCheck)) {
        immutableOptions = immutableCheck;
      }
      middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions));
    }
    if (serializableCheck) {
      let serializableOptions = {};
      if (!isBoolean(serializableCheck)) {
        serializableOptions = serializableCheck;
      }
      middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions));
    }
    if (actionCreatorCheck) {
      let actionCreatorOptions = {};
      if (!isBoolean(actionCreatorCheck)) {
        actionCreatorOptions = actionCreatorCheck;
      }
      middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions));
    }
  }
  return middlewareArray;
};
var SHOULD_AUTOBATCH = "RTK_autoBatch";
var createQueueWithTimer = (timeout) => {
  return (notify) => {
    setTimeout(notify, timeout);
  };
};
var autoBatchEnhancer = (options = {
  type: "raf"
}) => (next) => (...args) => {
  const store = next(...args);
  let notifying = true;
  let shouldNotifyAtEndOfTick = false;
  let notificationQueued = false;
  const listeners = /* @__PURE__ */ new Set();
  const queueCallback = options.type === "tick" ? queueMicrotask : options.type === "raf" ? (
    // requestAnimationFrame won't exist in SSR environments. Fall back to a vague approximation just to keep from erroring.
    typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10)
  ) : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout);
  const notifyListeners = () => {
    notificationQueued = false;
    if (shouldNotifyAtEndOfTick) {
      shouldNotifyAtEndOfTick = false;
      listeners.forEach((l) => l());
    }
  };
  return Object.assign({}, store, {
    // Override the base `store.subscribe` method to keep original listeners
    // from running if we're delaying notifications
    subscribe(listener2) {
      const wrappedListener = () => notifying && listener2();
      const unsubscribe = store.subscribe(wrappedListener);
      listeners.add(listener2);
      return () => {
        unsubscribe();
        listeners.delete(listener2);
      };
    },
    // Override the base `store.dispatch` method so that we can check actions
    // for the `shouldAutoBatch` flag and determine if batching is active
    dispatch(action) {
      var _a;
      try {
        notifying = !((_a = action == null ? void 0 : action.meta) == null ? void 0 : _a[SHOULD_AUTOBATCH]);
        shouldNotifyAtEndOfTick = !notifying;
        if (shouldNotifyAtEndOfTick) {
          if (!notificationQueued) {
            notificationQueued = true;
            queueCallback(notifyListeners);
          }
        }
        return store.dispatch(action);
      } finally {
        notifying = true;
      }
    }
  });
};
var buildGetDefaultEnhancers = (middlewareEnhancer) => function getDefaultEnhancers(options) {
  const {
    autoBatch = true
  } = options ?? {};
  let enhancerArray = new Tuple(middlewareEnhancer);
  if (autoBatch) {
    enhancerArray.push(autoBatchEnhancer(typeof autoBatch === "object" ? autoBatch : void 0));
  }
  return enhancerArray;
};
function configureStore(options) {
  const getDefaultMiddleware = buildGetDefaultMiddleware();
  const {
    reducer = void 0,
    middleware,
    devTools = true,
    duplicateMiddlewareCheck = true,
    preloadedState: preloadedState2 = void 0,
    enhancers = void 0
  } = options || {};
  let rootReducer;
  if (typeof reducer === "function") {
    rootReducer = reducer;
  } else if (isPlainObject(reducer)) {
    rootReducer = combineReducers(reducer);
  } else {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(1) : "`reducer` is a required argument, and must be a function or an object of functions that can be passed to combineReducers");
  }
  if (process.env.NODE_ENV !== "production" && middleware && typeof middleware !== "function") {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(2) : "`middleware` field must be a callback");
  }
  let finalMiddleware;
  if (typeof middleware === "function") {
    finalMiddleware = middleware(getDefaultMiddleware);
    if (process.env.NODE_ENV !== "production" && !Array.isArray(finalMiddleware)) {
      throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(3) : "when using a middleware builder function, an array of middleware must be returned");
    }
  } else {
    finalMiddleware = getDefaultMiddleware();
  }
  if (process.env.NODE_ENV !== "production" && finalMiddleware.some((item) => typeof item !== "function")) {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(4) : "each middleware provided to configureStore must be a function");
  }
  if (process.env.NODE_ENV !== "production" && duplicateMiddlewareCheck) {
    let middlewareReferences = /* @__PURE__ */ new Set();
    finalMiddleware.forEach((middleware2) => {
      if (middlewareReferences.has(middleware2)) {
        throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(42) : "Duplicate middleware references found when creating the store. Ensure that each middleware is only included once.");
      }
      middlewareReferences.add(middleware2);
    });
  }
  let finalCompose = compose;
  if (devTools) {
    finalCompose = composeWithDevTools({
      // Enable capture of stack traces for dispatched Redux actions
      trace: process.env.NODE_ENV !== "production",
      ...typeof devTools === "object" && devTools
    });
  }
  const middlewareEnhancer = applyMiddleware(...finalMiddleware);
  const getDefaultEnhancers = buildGetDefaultEnhancers(middlewareEnhancer);
  if (process.env.NODE_ENV !== "production" && enhancers && typeof enhancers !== "function") {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(5) : "`enhancers` field must be a callback");
  }
  let storeEnhancers = typeof enhancers === "function" ? enhancers(getDefaultEnhancers) : getDefaultEnhancers();
  if (process.env.NODE_ENV !== "production" && !Array.isArray(storeEnhancers)) {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(6) : "`enhancers` callback must return an array");
  }
  if (process.env.NODE_ENV !== "production" && storeEnhancers.some((item) => typeof item !== "function")) {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(7) : "each enhancer provided to configureStore must be a function");
  }
  if (process.env.NODE_ENV !== "production" && finalMiddleware.length && !storeEnhancers.includes(middlewareEnhancer)) {
    console.error("middlewares were provided, but middleware enhancer was not included in final enhancers - make sure to call `getDefaultEnhancers`");
  }
  const composedEnhancer = finalCompose(...storeEnhancers);
  return createStore(rootReducer, preloadedState2, composedEnhancer);
}
function executeReducerBuilderCallback(builderCallback) {
  const actionsMap = {};
  const actionMatchers = [];
  let defaultCaseReducer;
  const builder = {
    addCase(typeOrActionCreator, reducer) {
      if (process.env.NODE_ENV !== "production") {
        if (actionMatchers.length > 0) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(26) : "`builder.addCase` should only be called before calling `builder.addMatcher`");
        }
        if (defaultCaseReducer) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(27) : "`builder.addCase` should only be called before calling `builder.addDefaultCase`");
        }
      }
      const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
      if (!type) {
        throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(28) : "`builder.addCase` cannot be called with an empty action type");
      }
      if (type in actionsMap) {
        throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(29) : `\`builder.addCase\` cannot be called with two reducers for the same action type '${type}'`);
      }
      actionsMap[type] = reducer;
      return builder;
    },
    addAsyncThunk(asyncThunk, reducers) {
      if (process.env.NODE_ENV !== "production") {
        if (defaultCaseReducer) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(43) : "`builder.addAsyncThunk` should only be called before calling `builder.addDefaultCase`");
        }
      }
      if (reducers.pending) actionsMap[asyncThunk.pending.type] = reducers.pending;
      if (reducers.rejected) actionsMap[asyncThunk.rejected.type] = reducers.rejected;
      if (reducers.fulfilled) actionsMap[asyncThunk.fulfilled.type] = reducers.fulfilled;
      if (reducers.settled) actionMatchers.push({
        matcher: asyncThunk.settled,
        reducer: reducers.settled
      });
      return builder;
    },
    addMatcher(matcher, reducer) {
      if (process.env.NODE_ENV !== "production") {
        if (defaultCaseReducer) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(30) : "`builder.addMatcher` should only be called before calling `builder.addDefaultCase`");
        }
      }
      actionMatchers.push({
        matcher,
        reducer
      });
      return builder;
    },
    addDefaultCase(reducer) {
      if (process.env.NODE_ENV !== "production") {
        if (defaultCaseReducer) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(31) : "`builder.addDefaultCase` can only be called once");
        }
      }
      defaultCaseReducer = reducer;
      return builder;
    }
  };
  builderCallback(builder);
  return [actionsMap, actionMatchers, defaultCaseReducer];
}
function isStateFunction(x) {
  return typeof x === "function";
}
function createReducer(initialState2, mapOrBuilderCallback) {
  if (process.env.NODE_ENV !== "production") {
    if (typeof mapOrBuilderCallback === "object") {
      throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(8) : "The object notation for `createReducer` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer");
    }
  }
  let [actionsMap, finalActionMatchers, finalDefaultCaseReducer] = executeReducerBuilderCallback(mapOrBuilderCallback);
  let getInitialState;
  if (isStateFunction(initialState2)) {
    getInitialState = () => freezeDraftable(initialState2());
  } else {
    const frozenInitialState = freezeDraftable(initialState2);
    getInitialState = () => frozenInitialState;
  }
  function reducer(state = getInitialState(), action) {
    let caseReducers = [actionsMap[action.type], ...finalActionMatchers.filter(({
      matcher
    }) => matcher(action)).map(({
      reducer: reducer2
    }) => reducer2)];
    if (caseReducers.filter((cr) => !!cr).length === 0) {
      caseReducers = [finalDefaultCaseReducer];
    }
    return caseReducers.reduce((previousState, caseReducer) => {
      if (caseReducer) {
        if (isDraft(previousState)) {
          const draft = previousState;
          const result = caseReducer(draft, action);
          if (result === void 0) {
            return previousState;
          }
          return result;
        } else if (!isDraftable(previousState)) {
          const result = caseReducer(previousState, action);
          if (result === void 0) {
            if (previousState === null) {
              return previousState;
            }
            throw Error("A case reducer on a non-draftable value must not return undefined");
          }
          return result;
        } else {
          return produce(previousState, (draft) => {
            return caseReducer(draft, action);
          });
        }
      }
      return previousState;
    }, state);
  }
  reducer.getInitialState = getInitialState;
  return reducer;
}
var matches = (matcher, action) => {
  if (hasMatchFunction(matcher)) {
    return matcher.match(action);
  } else {
    return matcher(action);
  }
};
function isAnyOf(...matchers) {
  return (action) => {
    return matchers.some((matcher) => matches(matcher, action));
  };
}
var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW";
var nanoid = (size = 21) => {
  let id = "";
  let i = size;
  while (i--) {
    id += urlAlphabet[Math.random() * 64 | 0];
  }
  return id;
};
var commonProperties = ["name", "message", "stack", "code"];
var RejectWithValue = class {
  constructor(payload, meta) {
    /*
    type-only property to distinguish between RejectWithValue and FulfillWithMeta
    does not exist at runtime
    */
    __publicField(this, "_type");
    this.payload = payload;
    this.meta = meta;
  }
};
var FulfillWithMeta = class {
  constructor(payload, meta) {
    /*
    type-only property to distinguish between RejectWithValue and FulfillWithMeta
    does not exist at runtime
    */
    __publicField(this, "_type");
    this.payload = payload;
    this.meta = meta;
  }
};
var miniSerializeError = (value) => {
  if (typeof value === "object" && value !== null) {
    const simpleError = {};
    for (const property of commonProperties) {
      if (typeof value[property] === "string") {
        simpleError[property] = value[property];
      }
    }
    return simpleError;
  }
  return {
    message: String(value)
  };
};
var externalAbortMessage = "External signal was aborted";
var createAsyncThunk = /* @__PURE__ */ (() => {
  function createAsyncThunk2(typePrefix, payloadCreator, options) {
    const fulfilled = createAction(typePrefix + "/fulfilled", (payload, requestId, arg, meta) => ({
      payload,
      meta: {
        ...meta || {},
        arg,
        requestId,
        requestStatus: "fulfilled"
      }
    }));
    const pending = createAction(typePrefix + "/pending", (requestId, arg, meta) => ({
      payload: void 0,
      meta: {
        ...meta || {},
        arg,
        requestId,
        requestStatus: "pending"
      }
    }));
    const rejected = createAction(typePrefix + "/rejected", (error, requestId, arg, payload, meta) => ({
      payload,
      error: (options && options.serializeError || miniSerializeError)(error || "Rejected"),
      meta: {
        ...meta || {},
        arg,
        requestId,
        rejectedWithValue: !!payload,
        requestStatus: "rejected",
        aborted: (error == null ? void 0 : error.name) === "AbortError",
        condition: (error == null ? void 0 : error.name) === "ConditionError"
      }
    }));
    function actionCreator(arg, {
      signal
    } = {}) {
      return (dispatch, getState, extra) => {
        const requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid();
        const abortController = new AbortController();
        let abortHandler;
        let abortReason;
        function abort(reason) {
          abortReason = reason;
          abortController.abort();
        }
        if (signal) {
          if (signal.aborted) {
            abort(externalAbortMessage);
          } else {
            signal.addEventListener("abort", () => abort(externalAbortMessage), {
              once: true
            });
          }
        }
        const promise = async function() {
          var _a, _b;
          let finalAction;
          try {
            let conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, {
              getState,
              extra
            });
            if (isThenable(conditionResult)) {
              conditionResult = await conditionResult;
            }
            if (conditionResult === false || abortController.signal.aborted) {
              throw {
                name: "ConditionError",
                message: "Aborted due to condition callback returning false."
              };
            }
            const abortedPromise = new Promise((_, reject) => {
              abortHandler = () => {
                reject({
                  name: "AbortError",
                  message: abortReason || "Aborted"
                });
              };
              abortController.signal.addEventListener("abort", abortHandler, {
                once: true
              });
            });
            dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, {
              requestId,
              arg
            }, {
              getState,
              extra
            })));
            finalAction = await Promise.race([abortedPromise, Promise.resolve(payloadCreator(arg, {
              dispatch,
              getState,
              extra,
              requestId,
              signal: abortController.signal,
              abort,
              rejectWithValue: (value, meta) => {
                return new RejectWithValue(value, meta);
              },
              fulfillWithValue: (value, meta) => {
                return new FulfillWithMeta(value, meta);
              }
            })).then((result) => {
              if (result instanceof RejectWithValue) {
                throw result;
              }
              if (result instanceof FulfillWithMeta) {
                return fulfilled(result.payload, requestId, arg, result.meta);
              }
              return fulfilled(result, requestId, arg);
            })]);
          } catch (err) {
            finalAction = err instanceof RejectWithValue ? rejected(null, requestId, arg, err.payload, err.meta) : rejected(err, requestId, arg);
          } finally {
            if (abortHandler) {
              abortController.signal.removeEventListener("abort", abortHandler);
            }
          }
          const skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition;
          if (!skipDispatch) {
            dispatch(finalAction);
          }
          return finalAction;
        }();
        return Object.assign(promise, {
          abort,
          requestId,
          arg,
          unwrap() {
            return promise.then(unwrapResult);
          }
        });
      };
    }
    return Object.assign(actionCreator, {
      pending,
      rejected,
      fulfilled,
      settled: isAnyOf(rejected, fulfilled),
      typePrefix
    });
  }
  createAsyncThunk2.withTypes = () => createAsyncThunk2;
  return createAsyncThunk2;
})();
function unwrapResult(action) {
  if (action.meta && action.meta.rejectedWithValue) {
    throw action.payload;
  }
  if (action.error) {
    throw action.error;
  }
  return action.payload;
}
function isThenable(value) {
  return value !== null && typeof value === "object" && typeof value.then === "function";
}
var asyncThunkSymbol = /* @__PURE__ */ Symbol.for("rtk-slice-createasyncthunk");
function getType(slice, actionKey) {
  return `${slice}/${actionKey}`;
}
function buildCreateSlice({
  creators
} = {}) {
  var _a;
  const cAT = (_a = creators == null ? void 0 : creators.asyncThunk) == null ? void 0 : _a[asyncThunkSymbol];
  return function createSlice2(options) {
    const {
      name,
      reducerPath = name
    } = options;
    if (!name) {
      throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(11) : "`name` is a required option for createSlice");
    }
    if (typeof process !== "undefined" && process.env.NODE_ENV === "development") {
      if (options.initialState === void 0) {
        console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`");
      }
    }
    const reducers = (typeof options.reducers === "function" ? options.reducers(buildReducerCreators()) : options.reducers) || {};
    const reducerNames = Object.keys(reducers);
    const context = {
      sliceCaseReducersByName: {},
      sliceCaseReducersByType: {},
      actionCreators: {},
      sliceMatchers: []
    };
    const contextMethods = {
      addCase(typeOrActionCreator, reducer2) {
        const type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type;
        if (!type) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(12) : "`context.addCase` cannot be called with an empty action type");
        }
        if (type in context.sliceCaseReducersByType) {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(13) : "`context.addCase` cannot be called with two reducers for the same action type: " + type);
        }
        context.sliceCaseReducersByType[type] = reducer2;
        return contextMethods;
      },
      addMatcher(matcher, reducer2) {
        context.sliceMatchers.push({
          matcher,
          reducer: reducer2
        });
        return contextMethods;
      },
      exposeAction(name2, actionCreator) {
        context.actionCreators[name2] = actionCreator;
        return contextMethods;
      },
      exposeCaseReducer(name2, reducer2) {
        context.sliceCaseReducersByName[name2] = reducer2;
        return contextMethods;
      }
    };
    reducerNames.forEach((reducerName) => {
      const reducerDefinition = reducers[reducerName];
      const reducerDetails = {
        reducerName,
        type: getType(name, reducerName),
        createNotation: typeof options.reducers === "function"
      };
      if (isAsyncThunkSliceReducerDefinition(reducerDefinition)) {
        handleThunkCaseReducerDefinition(reducerDetails, reducerDefinition, contextMethods, cAT);
      } else {
        handleNormalReducerDefinition(reducerDetails, reducerDefinition, contextMethods);
      }
    });
    function buildReducer() {
      if (process.env.NODE_ENV !== "production") {
        if (typeof options.extraReducers === "object") {
          throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(14) : "The object notation for `createSlice.extraReducers` has been removed. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice");
        }
      }
      const [extraReducers = {}, actionMatchers = [], defaultCaseReducer = void 0] = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers];
      const finalCaseReducers = {
        ...extraReducers,
        ...context.sliceCaseReducersByType
      };
      return createReducer(options.initialState, (builder) => {
        for (let key in finalCaseReducers) {
          builder.addCase(key, finalCaseReducers[key]);
        }
        for (let sM of context.sliceMatchers) {
          builder.addMatcher(sM.matcher, sM.reducer);
        }
        for (let m of actionMatchers) {
          builder.addMatcher(m.matcher, m.reducer);
        }
        if (defaultCaseReducer) {
          builder.addDefaultCase(defaultCaseReducer);
        }
      });
    }
    const selectSelf = (state) => state;
    const injectedSelectorCache = /* @__PURE__ */ new Map();
    const injectedStateCache = /* @__PURE__ */ new WeakMap();
    let _reducer;
    function reducer(state, action) {
      if (!_reducer) _reducer = buildReducer();
      return _reducer(state, action);
    }
    function getInitialState() {
      if (!_reducer) _reducer = buildReducer();
      return _reducer.getInitialState();
    }
    function makeSelectorProps(reducerPath2, injected = false) {
      function selectSlice(state) {
        let sliceState = state[reducerPath2];
        if (typeof sliceState === "undefined") {
          if (injected) {
            sliceState = getOrInsertComputed(injectedStateCache, selectSlice, getInitialState);
          } else if (process.env.NODE_ENV !== "production") {
            throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(15) : "selectSlice returned undefined for an uninjected slice reducer");
          }
        }
        return sliceState;
      }
      function getSelectors(selectState = selectSelf) {
        const selectorCache = getOrInsertComputed(injectedSelectorCache, injected, () => /* @__PURE__ */ new WeakMap());
        return getOrInsertComputed(selectorCache, selectState, () => {
          const map = {};
          for (const [name2, selector] of Object.entries(options.selectors ?? {})) {
            map[name2] = wrapSelector(selector, selectState, () => getOrInsertComputed(injectedStateCache, selectState, getInitialState), injected);
          }
          return map;
        });
      }
      return {
        reducerPath: reducerPath2,
        getSelectors,
        get selectors() {
          return getSelectors(selectSlice);
        },
        selectSlice
      };
    }
    const slice = {
      name,
      reducer,
      actions: context.actionCreators,
      caseReducers: context.sliceCaseReducersByName,
      getInitialState,
      ...makeSelectorProps(reducerPath),
      injectInto(injectable, {
        reducerPath: pathOpt,
        ...config
      } = {}) {
        const newReducerPath = pathOpt ?? reducerPath;
        injectable.inject({
          reducerPath: newReducerPath,
          reducer
        }, config);
        return {
          ...slice,
          ...makeSelectorProps(newReducerPath, true)
        };
      }
    };
    return slice;
  };
}
function wrapSelector(selector, selectState, getInitialState, injected) {
  function wrapper(rootState, ...args) {
    let sliceState = selectState(rootState);
    if (typeof sliceState === "undefined") {
      if (injected) {
        sliceState = getInitialState();
      } else if (process.env.NODE_ENV !== "production") {
        throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(16) : "selectState returned undefined for an uninjected slice reducer");
      }
    }
    return selector(sliceState, ...args);
  }
  wrapper.unwrapped = selector;
  return wrapper;
}
var createSlice = /* @__PURE__ */ buildCreateSlice();
function buildReducerCreators() {
  function asyncThunk(payloadCreator, config) {
    return {
      _reducerDefinitionType: "asyncThunk",
      payloadCreator,
      ...config
    };
  }
  asyncThunk.withTypes = () => asyncThunk;
  return {
    reducer(caseReducer) {
      return Object.assign({
        // hack so the wrapping function has the same name as the original
        // we need to create a wrapper so the `reducerDefinitionType` is not assigned to the original
        [caseReducer.name](...args) {
          return caseReducer(...args);
        }
      }[caseReducer.name], {
        _reducerDefinitionType: "reducer"
        /* reducer */
      });
    },
    preparedReducer(prepare, reducer) {
      return {
        _reducerDefinitionType: "reducerWithPrepare",
        prepare,
        reducer
      };
    },
    asyncThunk
  };
}
function handleNormalReducerDefinition({
  type,
  reducerName,
  createNotation
}, maybeReducerWithPrepare, context) {
  let caseReducer;
  let prepareCallback;
  if ("reducer" in maybeReducerWithPrepare) {
    if (createNotation && !isCaseReducerWithPrepareDefinition(maybeReducerWithPrepare)) {
      throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(17) : "Please use the `create.preparedReducer` notation for prepared action creators with the `create` notation.");
    }
    caseReducer = maybeReducerWithPrepare.reducer;
    prepareCallback = maybeReducerWithPrepare.prepare;
  } else {
    caseReducer = maybeReducerWithPrepare;
  }
  context.addCase(type, caseReducer).exposeCaseReducer(reducerName, caseReducer).exposeAction(reducerName, prepareCallback ? createAction(type, prepareCallback) : createAction(type));
}
function isAsyncThunkSliceReducerDefinition(reducerDefinition) {
  return reducerDefinition._reducerDefinitionType === "asyncThunk";
}
function isCaseReducerWithPrepareDefinition(reducerDefinition) {
  return reducerDefinition._reducerDefinitionType === "reducerWithPrepare";
}
function handleThunkCaseReducerDefinition({
  type,
  reducerName
}, reducerDefinition, context, cAT) {
  if (!cAT) {
    throw new Error(process.env.NODE_ENV === "production" ? formatProdErrorMessage(18) : "Cannot use `create.asyncThunk` in the built-in `createSlice`. Use `buildCreateSlice({ creators: { asyncThunk: asyncThunkCreator } })` to create a customised version of `createSlice`.");
  }
  const {
    payloadCreator,
    fulfilled,
    pending,
    rejected,
    settled,
    options
  } = reducerDefinition;
  const thunk2 = cAT(type, payloadCreator, options);
  context.exposeAction(reducerName, thunk2);
  if (fulfilled) {
    context.addCase(thunk2.fulfilled, fulfilled);
  }
  if (pending) {
    context.addCase(thunk2.pending, pending);
  }
  if (rejected) {
    context.addCase(thunk2.rejected, rejected);
  }
  if (settled) {
    context.addMatcher(thunk2.settled, settled);
  }
  context.exposeCaseReducer(reducerName, {
    fulfilled: fulfilled || noop,
    pending: pending || noop,
    rejected: rejected || noop,
    settled: settled || noop
  });
}
function noop() {
}
function formatProdErrorMessage(code) {
  return `Minified Redux Toolkit error #${code}; visit https://redux-toolkit.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
}
const { hostname } = window.location;
const API_BASE_URL$1 = `https://server.${hostname}/api/v1`;
const api = axios.create({
  baseURL: API_BASE_URL$1,
  headers: {
    "Content-Type": "application/json"
  }
});
let isRefreshing = false;
let failedQueue = [];
const processQueue = (error, token = null) => {
  failedQueue.forEach((prom) => {
    if (error) {
      prom.reject(error);
    } else {
      prom.resolve(token);
    }
  });
  failedQueue = [];
};
api.interceptors.request.use(
  (config) => {
    const token = localStorage.getItem("accessToken");
    if (token) {
      config.headers.Authorization = `Bearer ${token}`;
    }
    const language = localStorage.getItem("app_language") || localStorage.getItem("i18nextLng") || "en";
    config.headers["Accept-Language"] = language;
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);
api.interceptors.response.use(
  (response) => response,
  async (error) => {
    var _a, _b, _c, _d, _e;
    const originalRequest = error.config;
    if (((_a = error.response) == null ? void 0 : _a.status) === 401 && !originalRequest._retry) {
      if (((_b = originalRequest.url) == null ? void 0 : _b.includes("/auth/login")) || ((_c = originalRequest.url) == null ? void 0 : _c.includes("/auth/register")) || ((_d = originalRequest.url) == null ? void 0 : _d.includes("/auth/refresh-token")) || ((_e = originalRequest.url) == null ? void 0 : _e.includes("/auth/send-otp"))) {
        return Promise.reject(error);
      }
      if (isRefreshing) {
        return new Promise((resolve, reject) => {
          failedQueue.push({ resolve, reject });
        }).then((token) => {
          originalRequest.headers.Authorization = `Bearer ${token}`;
          return api(originalRequest);
        }).catch((err) => {
          return Promise.reject(err);
        });
      }
      originalRequest._retry = true;
      isRefreshing = true;
      const refreshToken = localStorage.getItem("refreshToken");
      if (!refreshToken) {
        isRefreshing = false;
        handleLogout();
        return Promise.reject(error);
      }
      try {
        const response = await axios.post(`${API_BASE_URL$1}/auth/refresh-token`, {
          refreshToken
        });
        const { accessToken, refreshToken: newRefreshToken } = response.data.data || response.data;
        if (accessToken) {
          localStorage.setItem("accessToken", accessToken);
        }
        if (newRefreshToken) {
          localStorage.setItem("refreshToken", newRefreshToken);
        }
        api.defaults.headers.common["Authorization"] = `Bearer ${accessToken}`;
        originalRequest.headers.Authorization = `Bearer ${accessToken}`;
        processQueue(null, accessToken);
        isRefreshing = false;
        return api(originalRequest);
      } catch (refreshError) {
        processQueue(refreshError, null);
        isRefreshing = false;
        handleLogout();
        return Promise.reject(refreshError);
      }
    }
    return Promise.reject(error);
  }
);
const handleLogout = () => {
  localStorage.removeItem("accessToken");
  localStorage.removeItem("refreshToken");
  localStorage.removeItem("user");
  if (window.location.pathname !== "/" && !window.location.pathname.includes("/register")) {
    window.location.href = "/";
  }
};
const activeToasts = /* @__PURE__ */ new Set();
const createToast = (type, message, options = {}) => {
  const key = `${type}-${message}`;
  if (activeToasts.has(key)) {
    return;
  }
  activeToasts.add(key);
  const defaultOptions = {
    duration: 4e3,
    position: "top-center",
    ...options
  };
  let toastId;
  switch (type) {
    case "success":
      toastId = toast$1.success(message, defaultOptions);
      break;
    case "error":
      toastId = toast$1.error(message, defaultOptions);
      break;
    case "loading":
      toastId = toast$1.loading(message, defaultOptions);
      break;
    default:
      toastId = toast$1(message, defaultOptions);
  }
  setTimeout(() => {
    activeToasts.delete(key);
  }, defaultOptions.duration + 500);
  return toastId;
};
const toast = {
  success: (message, options) => createToast("success", message, options),
  error: (message, options) => createToast("error", message, options),
  loading: (message, options) => createToast("loading", message, options),
  dismiss: toast$1.dismiss,
  remove: toast$1.remove,
  // Clear all active toasts
  clear: () => {
    activeToasts.clear();
    toast$1.dismiss();
  },
  // Auth-specific toasts with predefined messages
  auth: {
    loginSuccess: () => createToast("success", "Login successful!", { duration: 3e3 }),
    loginError: (error) => createToast("error", error || "Login failed", { duration: 5e3 }),
    otpSent: () => createToast("success", "OTP sent successfully!", { duration: 3e3 }),
    otpError: (error) => createToast("error", error || "Failed to send OTP", { duration: 5e3 }),
    registerSuccess: () => createToast("success", "Registration successful!", { duration: 3e3 }),
    registerError: (error) => createToast("error", error || "Registration failed", { duration: 5e3 }),
    googleLoginSuccess: () => createToast("success", "Login successful with Google!", { duration: 3e3 }),
    googleLoginError: (error) => createToast("error", error || "Google login failed", { duration: 5e3 })
  }
};
const isSSR$4 = typeof window === "undefined";
const getUserFromStorage = () => {
  if (isSSR$4) return null;
  try {
    const user = localStorage.getItem("user");
    return user ? JSON.parse(user) : null;
  } catch (error) {
    return null;
  }
};
const getTokenFromStorage = () => {
  if (isSSR$4) return null;
  return localStorage.getItem("accessToken") || null;
};
const initialState$5 = {
  user: getUserFromStorage(),
  token: getTokenFromStorage(),
  isAuthenticated: !!getTokenFromStorage(),
  loading: false,
  error: null,
  otpSent: false,
  message: null,
  // For success messages
  registerSuccess: false,
  // To trigger redirects after registration
  profileLoading: false,
  // Specific loading states
  passwordLoading: false,
  socialConfig: null
  // For storing enabled providers and client IDs
};
const getCurrentUser = createAsyncThunk(
  "auth/getCurrentUser",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/auth/");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch user" });
    }
  }
);
const registerUser = createAsyncThunk(
  "auth/register",
  async (formData, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/auth/register", formData, {
        headers: {
          "Content-Type": "multipart/form-data"
        }
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Registration failed" });
    }
  }
);
const sendOtp = createAsyncThunk(
  "auth/sendOtp",
  async ({ identifier, type = "phone" }, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/auth/send-otp", {
        identifier,
        type
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to send OTP" });
    }
  }
);
const login = createAsyncThunk(
  "auth/login",
  async ({ phone, otp, email, password }, { rejectWithValue }) => {
    var _a, _b, _c, _d;
    try {
      const payload = {};
      if (phone && otp) {
        payload.phone = phone;
        payload.otp = otp;
      } else if (email && password) {
        payload.email = email;
        payload.password = password;
      }
      const response = await api.post("/auth/login", payload);
      const userRole = ((_b = (_a = response.data) == null ? void 0 : _a.user) == null ? void 0 : _b.role) || ((_c = response.data) == null ? void 0 : _c.role);
      if (userRole && userRole !== "user") {
        return rejectWithValue({ message: "Access denied. This panel is only for User accounts." });
      }
      return response.data;
    } catch (error) {
      return rejectWithValue(((_d = error.response) == null ? void 0 : _d.data) || { message: "Login failed" });
    }
  }
);
const logoutUser = createAsyncThunk(
  "auth/logout",
  async (_, { rejectWithValue }) => {
    try {
      await api.post("/auth/logout");
      return null;
    } catch (error) {
      console.warn("Server logout failed, clearing local state anyway", error);
      return null;
    }
  }
);
createAsyncThunk(
  "auth/refreshToken",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const currentRefreshToken = localStorage.getItem("refreshToken");
      if (!currentRefreshToken) throw new Error("No refresh token");
      const response = await api.post("/auth/refresh-token", {
        refreshToken: currentRefreshToken
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Session expired" });
    }
  }
);
createAsyncThunk(
  "auth/forgotPassword",
  async (email, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/auth/forget-password", { email });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to send reset link" });
    }
  }
);
createAsyncThunk(
  "auth/resetPassword",
  async ({ resetToken, password }, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/auth/reset-password", {
        resetToken,
        password
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Password reset failed" });
    }
  }
);
const getProfile = createAsyncThunk(
  "auth/getProfile",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/auth/profile");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch profile" });
    }
  }
);
const updateProfile = createAsyncThunk(
  "auth/updateProfile",
  async (profileData, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.patch("/auth/profile", profileData);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to update profile" });
    }
  }
);
const changePassword = createAsyncThunk(
  "auth/changePassword",
  async ({ currentPassword, newPassword }, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.patch("/auth/password", {
        currentPassword,
        newPassword
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to change password" });
    }
  }
);
const deleteAccount = createAsyncThunk(
  "auth/deleteAccount",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.delete("/auth/profile");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to delete account" });
    }
  }
);
const getSocialConfig = createAsyncThunk(
  "auth/getSocialConfig",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/auth/social/config");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch social config" });
    }
  }
);
const loginWithGoogle = createAsyncThunk(
  "auth/loginWithGoogle",
  async ({ token }, { rejectWithValue }) => {
    var _a, _b, _c, _d;
    try {
      const response = await api.post("/auth/social/google", {
        token,
        tokenType: "id_token"
      });
      const userRole = ((_b = (_a = response.data) == null ? void 0 : _a.user) == null ? void 0 : _b.role) || ((_c = response.data) == null ? void 0 : _c.role);
      if (userRole && userRole !== "user") {
        return rejectWithValue({ message: "Access denied. This panel is only for User accounts." });
      }
      return response.data;
    } catch (error) {
      return rejectWithValue(((_d = error.response) == null ? void 0 : _d.data) || { message: "Google login failed" });
    }
  }
);
const authSlice = createSlice({
  name: "auth",
  initialState: initialState$5,
  reducers: {
    resetAuth: (state) => {
      state.loading = false;
      state.error = null;
      state.message = null;
      state.otpSent = false;
      state.registerSuccess = false;
    },
    clearErrors: (state) => {
      state.error = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(sendOtp.pending, (state) => {
      state.loading = true;
      state.error = null;
      state.otpSent = false;
    }).addCase(sendOtp.fulfilled, (state) => {
      state.loading = false;
      state.otpSent = true;
      state.message = "OTP sent successfully";
      toast.auth.otpSent();
    }).addCase(sendOtp.rejected, (state, action) => {
      var _a, _b;
      state.loading = false;
      state.error = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to send OTP";
      state.otpSent = false;
      toast.auth.otpError((_b = action.payload) == null ? void 0 : _b.message);
    });
    builder.addCase(login.pending, (state) => {
      state.loading = true;
      state.error = null;
    }).addCase(login.fulfilled, (state, action) => {
      var _a, _b, _c, _d;
      state.loading = false;
      state.isAuthenticated = true;
      state.user = action.payload.user || ((_a = action.payload.data) == null ? void 0 : _a.user);
      state.token = action.payload.accessToken || ((_b = action.payload.data) == null ? void 0 : _b.accessToken);
      if (state.user) localStorage.setItem("user", JSON.stringify(state.user));
      if (state.token) localStorage.setItem("accessToken", state.token);
      if (action.payload.refreshToken || ((_c = action.payload.data) == null ? void 0 : _c.refreshToken)) {
        localStorage.setItem("refreshToken", action.payload.refreshToken || ((_d = action.payload.data) == null ? void 0 : _d.refreshToken));
      }
      toast.auth.loginSuccess();
    }).addCase(login.rejected, (state, action) => {
      var _a, _b;
      state.loading = false;
      state.error = ((_a = action.payload) == null ? void 0 : _a.message) || "Login failed";
      state.isAuthenticated = false;
      toast.auth.loginError((_b = action.payload) == null ? void 0 : _b.message);
    });
    builder.addCase(registerUser.pending, (state) => {
      state.loading = true;
      state.error = null;
      state.registerSuccess = false;
    }).addCase(registerUser.fulfilled, (state, action) => {
      state.loading = false;
      state.registerSuccess = true;
      state.message = "Registration successful! Please login.";
      toast.auth.registerSuccess();
    }).addCase(registerUser.rejected, (state, action) => {
      var _a, _b;
      state.loading = false;
      state.error = ((_a = action.payload) == null ? void 0 : _a.message) || "Registration failed";
      state.registerSuccess = false;
      toast.auth.registerError((_b = action.payload) == null ? void 0 : _b.message);
    });
    builder.addCase(logoutUser.fulfilled, (state) => {
      state.user = null;
      state.token = null;
      state.isAuthenticated = false;
      state.otpSent = false;
      localStorage.removeItem("user");
      localStorage.removeItem("accessToken");
      localStorage.removeItem("refreshToken");
    }).addCase(logoutUser.rejected, (state) => {
      state.user = null;
      state.token = null;
      state.isAuthenticated = false;
      localStorage.removeItem("user");
      localStorage.removeItem("accessToken");
      localStorage.removeItem("refreshToken");
    });
    builder.addCase(getCurrentUser.fulfilled, (state, action) => {
      state.user = action.payload.data || action.payload;
      localStorage.setItem("user", JSON.stringify(state.user));
    }).addCase(getCurrentUser.rejected, (state) => {
    });
    builder.addCase(getProfile.pending, (state) => {
      state.profileLoading = true;
    }).addCase(getProfile.fulfilled, (state, action) => {
      state.profileLoading = false;
      state.user = action.payload.data || action.payload.user || action.payload;
      localStorage.setItem("user", JSON.stringify(state.user));
    }).addCase(getProfile.rejected, (state, action) => {
      var _a;
      state.profileLoading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(updateProfile.pending, (state) => {
      state.profileLoading = true;
    }).addCase(updateProfile.fulfilled, (state, action) => {
      state.profileLoading = false;
      const updatedUser = action.payload.user || action.payload.data || action.payload;
      state.user = { ...state.user, ...updatedUser };
      localStorage.setItem("user", JSON.stringify(state.user));
      state.message = action.payload.message || "Profile updated successfully";
    }).addCase(updateProfile.rejected, (state, action) => {
      var _a;
      state.profileLoading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(changePassword.pending, (state) => {
      state.passwordLoading = true;
    }).addCase(changePassword.fulfilled, (state) => {
      state.passwordLoading = false;
      state.message = "Password changed successfully";
    }).addCase(changePassword.rejected, (state, action) => {
      var _a;
      state.passwordLoading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(deleteAccount.fulfilled, (state) => {
      state.user = null;
      state.token = null;
      state.isAuthenticated = false;
      localStorage.clear();
    });
    builder.addCase(getSocialConfig.fulfilled, (state, action) => {
      state.socialConfig = action.payload.data;
    });
    builder.addCase(loginWithGoogle.pending, (state) => {
      state.loading = true;
      state.error = null;
    }).addCase(loginWithGoogle.fulfilled, (state, action) => {
      state.loading = false;
      state.isAuthenticated = true;
      state.user = action.payload.user;
      state.token = action.payload.accessToken;
      if (state.user) localStorage.setItem("user", JSON.stringify(state.user));
      if (state.token) localStorage.setItem("accessToken", state.token);
      if (action.payload.refreshToken) {
        localStorage.setItem("refreshToken", action.payload.refreshToken);
      }
      toast.auth.googleLoginSuccess();
    }).addCase(loginWithGoogle.rejected, (state, action) => {
      var _a, _b;
      state.loading = false;
      state.error = ((_a = action.payload) == null ? void 0 : _a.message) || "Google login failed";
      state.isAuthenticated = false;
      toast.auth.googleLoginError((_b = action.payload) == null ? void 0 : _b.message);
    });
  }
});
const { resetAuth, clearErrors: clearErrors$2 } = authSlice.actions;
const authReducer = authSlice.reducer;
const searchCabs = createAsyncThunk(
  "booking/searchCabs",
  async (searchParams, { rejectWithValue }) => {
    var _a;
    try {
      const {
        // Coordinates - frontend uses sourceLat/sourceLong but backend expects picklat/picklng
        sourceLat,
        // Will be sent as picklat
        sourceLong,
        // Will be sent as picklng
        destLat,
        // Will be sent as droplat
        destLong,
        // Will be sent as droplng
        // Trip details
        tripType = "oneWay",
        distance,
        // Distance in km
        // Filters
        fuelType = "petrol",
        isAc = true,
        // Backend expects boolean or 'true'/'false'
        // Time
        startTime,
        // Will be sent as scheduledTime
        // Rental package
        rentalPackage,
        // { hours, distance }
        // Pagination
        page = 1,
        limit = 10
      } = searchParams;
      const params = new URLSearchParams();
      params.append("picklat", sourceLat.toString());
      params.append("picklng", sourceLong.toString());
      if (destLat) params.append("droplat", destLat.toString());
      if (destLong) params.append("droplng", destLong.toString());
      if (distance) params.append("distance", distance.toString());
      params.append("tripType", tripType);
      params.append("fuelType", fuelType);
      params.append("isAc", typeof isAc === "boolean" ? isAc.toString() : isAc);
      if (tripType === "rental" && rentalPackage) {
        params.append("rentalPackageHours", rentalPackage.hours.toString());
        params.append("rentalPackageDistance", rentalPackage.distance.toString());
      }
      if (startTime) params.append("scheduledTime", startTime);
      params.append("page", page.toString());
      params.append("limit", limit.toString());
      const response = await api.get(`/booking/search-cabs?${params.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to search cabs" }
      );
    }
  }
);
const getBookingReview = createAsyncThunk(
  "booking/getBookingReview",
  async (reviewParams, { rejectWithValue }) => {
    var _a;
    try {
      const {
        vehicleId,
        picklat,
        picklng,
        pickupAddress,
        pickupCity,
        pickupState,
        droplat,
        droplng,
        dropAddress,
        dropCity,
        dropState,
        distance,
        tripType = "oneWay",
        fuelType = "petrol",
        isAc = true,
        // Can be boolean or string
        scheduledTime,
        promoCode,
        rentalPackage
      } = reviewParams;
      if (!vehicleId || !picklat || !picklng || !distance) {
        return rejectWithValue({ message: "Missing required fields: vehicleId, pickup coordinates, and distance are mandatory" });
      }
      const params = new URLSearchParams();
      params.append("vehicleId", vehicleId);
      params.append("picklat", picklat.toString());
      params.append("picklng", picklng.toString());
      params.append("distance", distance.toString());
      params.append("tripType", tripType);
      params.append("fuelType", fuelType);
      params.append("isAc", typeof isAc === "boolean" ? isAc.toString() : isAc);
      if (rentalPackage) {
        params.append("rentalPackage", JSON.stringify(rentalPackage));
      }
      if (pickupAddress) params.append("pickupAddress", pickupAddress);
      if (pickupCity) params.append("pickupCity", pickupCity);
      if (pickupState) params.append("pickupState", pickupState);
      if (droplat) params.append("droplat", droplat.toString());
      if (droplng) params.append("droplng", droplng.toString());
      if (dropAddress) params.append("dropAddress", dropAddress);
      if (dropCity) params.append("dropCity", dropCity);
      if (dropState) params.append("dropState", dropState);
      if (scheduledTime) params.append("scheduledTime", scheduledTime);
      if (promoCode) params.append("promoCode", promoCode);
      const response = await api.get(`/booking/review?${params.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to get booking review" }
      );
    }
  }
);
const createBooking = createAsyncThunk(
  "booking/createBooking",
  async (bookingData, { rejectWithValue }) => {
    var _a;
    try {
      const {
        pickupLocation,
        // { address: string, coordinates: [lng, lat] }
        dropLocation,
        // { address: string, coordinates: [lng, lat] }
        stops,
        // Array of stop objects
        vehicleId,
        groupId,
        // NEW: Group ID for grouped bookings
        modelId,
        // NEW: Model ID for grouped bookings
        tripType,
        // 'oneWay', 'roundTrip', 'rental', 'airport'
        rentalPackage,
        // { hours: number, distance: number } - for rental trips
        pickupDate,
        // 'YYYY-MM-DD'
        pickupTime,
        // 'HH:MM AM/PM'
        returnDate,
        // 'YYYY-MM-DD' - for roundTrip
        returnTime,
        // 'HH:MM AM/PM' - for roundTrip
        distance,
        // in km
        duration,
        // in minutes
        paymentMode,
        // 'cash', 'online', etc.
        fuelType,
        // 'petrol', 'diesel', 'cng', 'electric'
        isAc
        // boolean
      } = bookingData;
      const payload = {
        pickupLocation,
        vehicleId,
        groupId,
        // Include in payload
        modelId,
        // Include in payload
        tripType,
        pickupDate,
        pickupTime,
        distance,
        duration,
        paymentMode: paymentMode || "cash"
      };
      if (dropLocation) payload.dropLocation = dropLocation;
      if (stops && stops.length > 0) payload.stops = stops;
      if (rentalPackage) payload.rentalPackage = rentalPackage;
      if (returnDate) payload.returnDate = returnDate;
      if (returnTime) payload.returnTime = returnTime;
      if (fuelType) payload.fuelType = fuelType;
      if (isAc !== void 0) payload.isAc = isAc;
      const response = await api.post("/booking/book-ride", payload);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to create booking" }
      );
    }
  }
);
const getAllBookings = createAsyncThunk(
  "booking/getAllBookings",
  async (queryParams = {}, { rejectWithValue }) => {
    var _a;
    try {
      const {
        page = 1,
        limit = 10,
        status,
        date,
        search
      } = queryParams;
      const params = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString()
      });
      if (status) params.append("status", status);
      if (date) params.append("date", date);
      if (search) params.append("search", search);
      const response = await api.get(`/booking/?${params.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch bookings" }
      );
    }
  }
);
const getBookingById = createAsyncThunk(
  "booking/getBookingById",
  async (bookingId, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/booking/${bookingId}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch booking details" }
      );
    }
  }
);
const getBookingTimeline = createAsyncThunk(
  "booking/getBookingTimeline",
  async (bookingId, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/booking/${bookingId}/timeline`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch booking timeline" }
      );
    }
  }
);
const getBookingInvoice = createAsyncThunk(
  "booking/getBookingInvoice",
  async (bookingId, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/booking/${bookingId}/invoice`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch invoice" }
      );
    }
  }
);
const previewCancellation = createAsyncThunk(
  "booking/previewCancellation",
  async (bookingId, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/booking/${bookingId}/cancel/preview`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to preview cancellation" }
      );
    }
  }
);
const cancelBooking = createAsyncThunk(
  "booking/cancelBooking",
  async ({ bookingId, reason }, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post(`/booking/${bookingId}/cancel`, { reason });
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to cancel booking" }
      );
    }
  }
);
const initialState$4 = {
  // Search Cabs
  searchResults: {
    cabs: [],
    route: null,
    tripType: null,
    pagination: null
  },
  searchLoading: false,
  searchError: null,
  // Booking Review
  bookingReview: null,
  reviewLoading: false,
  reviewError: null,
  // Create Booking
  currentBooking: null,
  createLoading: false,
  createError: null,
  createSuccess: false,
  // All Bookings
  bookings: [],
  bookingsLoading: false,
  bookingsError: null,
  bookingsPagination: null,
  // Single Booking Details
  bookingDetails: null,
  detailsLoading: false,
  detailsError: null,
  // Booking Timeline
  timeline: [],
  timelineLoading: false,
  timelineError: null,
  // Invoice
  invoice: null,
  invoiceLoading: false,
  invoiceError: null,
  // Cancellation Preview
  cancellationPreview: null,
  previewCancellationLoading: false,
  previewCancellationError: null,
  // Cancel Booking
  cancellationResult: null,
  cancelLoading: false,
  cancelError: null,
  cancelSuccess: false
};
const bookingSlice = createSlice({
  name: "booking",
  initialState: initialState$4,
  reducers: {
    // Reset search results
    resetSearchResults: (state) => {
      state.searchResults = { cabs: [], route: null, tripType: null, pagination: null };
      state.searchError = null;
    },
    // Reset booking review
    resetBookingReview: (state) => {
      state.bookingReview = null;
      state.reviewError = null;
    },
    // Reset create booking state
    resetCreateBooking: (state) => {
      state.currentBooking = null;
      state.createError = null;
      state.createSuccess = false;
    },
    // Reset booking details
    resetBookingDetails: (state) => {
      state.bookingDetails = null;
      state.detailsError = null;
    },
    // Reset timeline
    resetTimeline: (state) => {
      state.timeline = [];
      state.timelineError = null;
    },
    // Reset invoice
    resetInvoice: (state) => {
      state.invoice = null;
      state.invoiceError = null;
    },
    // Reset cancellation preview
    resetCancellationPreview: (state) => {
      state.cancellationPreview = null;
      state.previewCancellationError = null;
    },
    // Reset cancel booking state
    resetCancelBooking: (state) => {
      state.cancellationResult = null;
      state.cancelError = null;
      state.cancelSuccess = false;
    },
    // Reset all errors
    clearAllErrors: (state) => {
      state.searchError = null;
      state.reviewError = null;
      state.createError = null;
      state.bookingsError = null;
      state.detailsError = null;
      state.timelineError = null;
      state.invoiceError = null;
      state.previewCancellationError = null;
      state.cancelError = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(searchCabs.pending, (state) => {
      state.searchLoading = true;
      state.searchError = null;
    }).addCase(searchCabs.fulfilled, (state, action) => {
      state.searchLoading = false;
      if (action.payload.success && action.payload.data) {
        state.searchResults = {
          cabs: action.payload.data.vehicles || action.payload.data.cabs || [],
          route: action.payload.data.route || null,
          tripType: action.payload.data.tripType || null,
          pagination: action.payload.data.pagination || null,
          distance: action.payload.data.distance || action.payload.data.totalDistance || 0,
          estimatedDuration: action.payload.data.estimatedDuration || 0,
          displayDistanceLabel: action.payload.data.displayDistanceLabel || null
        };
      }
    }).addCase(searchCabs.rejected, (state, action) => {
      var _a;
      state.searchLoading = false;
      state.searchError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to search cabs";
    });
    builder.addCase(getBookingReview.pending, (state) => {
      state.reviewLoading = true;
      state.reviewError = null;
    }).addCase(getBookingReview.fulfilled, (state, action) => {
      state.reviewLoading = false;
      if (action.payload.success) {
        state.bookingReview = action.payload.data;
      }
    }).addCase(getBookingReview.rejected, (state, action) => {
      var _a;
      state.reviewLoading = false;
      state.reviewError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to get booking review";
    });
    builder.addCase(createBooking.pending, (state) => {
      state.createLoading = true;
      state.createError = null;
      state.createSuccess = false;
    }).addCase(createBooking.fulfilled, (state, action) => {
      state.createLoading = false;
      state.createSuccess = true;
      if (action.payload.success) {
        state.currentBooking = action.payload.data;
      }
    }).addCase(createBooking.rejected, (state, action) => {
      var _a;
      state.createLoading = false;
      state.createError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to create booking";
      state.createSuccess = false;
    });
    builder.addCase(getAllBookings.pending, (state) => {
      state.bookingsLoading = true;
      state.bookingsError = null;
    }).addCase(getAllBookings.fulfilled, (state, action) => {
      state.bookingsLoading = false;
      if (action.payload.success) {
        state.bookings = action.payload.data || [];
        state.bookingsPagination = action.payload.pagination || null;
      }
    }).addCase(getAllBookings.rejected, (state, action) => {
      var _a;
      state.bookingsLoading = false;
      state.bookingsError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch bookings";
    });
    builder.addCase(getBookingById.pending, (state) => {
      state.detailsLoading = true;
      state.detailsError = null;
    }).addCase(getBookingById.fulfilled, (state, action) => {
      state.detailsLoading = false;
      if (action.payload.success) {
        state.bookingDetails = action.payload.data;
      }
    }).addCase(getBookingById.rejected, (state, action) => {
      var _a;
      state.detailsLoading = false;
      state.detailsError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch booking details";
    });
    builder.addCase(getBookingTimeline.pending, (state) => {
      state.timelineLoading = true;
      state.timelineError = null;
    }).addCase(getBookingTimeline.fulfilled, (state, action) => {
      state.timelineLoading = false;
      if (action.payload.success) {
        state.timeline = action.payload.data || [];
      }
    }).addCase(getBookingTimeline.rejected, (state, action) => {
      var _a;
      state.timelineLoading = false;
      state.timelineError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch timeline";
    });
    builder.addCase(getBookingInvoice.pending, (state) => {
      state.invoiceLoading = true;
      state.invoiceError = null;
    }).addCase(getBookingInvoice.fulfilled, (state, action) => {
      state.invoiceLoading = false;
      if (action.payload.success) {
        state.invoice = action.payload.data;
      }
    }).addCase(getBookingInvoice.rejected, (state, action) => {
      var _a;
      state.invoiceLoading = false;
      state.invoiceError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch invoice";
    });
    builder.addCase(previewCancellation.pending, (state) => {
      state.previewCancellationLoading = true;
      state.previewCancellationError = null;
    }).addCase(previewCancellation.fulfilled, (state, action) => {
      state.previewCancellationLoading = false;
      if (action.payload.success) {
        state.cancellationPreview = action.payload.data;
      }
    }).addCase(previewCancellation.rejected, (state, action) => {
      var _a;
      state.previewCancellationLoading = false;
      state.previewCancellationError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to preview cancellation";
    });
    builder.addCase(cancelBooking.pending, (state) => {
      state.cancelLoading = true;
      state.cancelError = null;
      state.cancelSuccess = false;
    }).addCase(cancelBooking.fulfilled, (state, action) => {
      state.cancelLoading = false;
      state.cancelSuccess = true;
      if (action.payload.success) {
        state.cancellationResult = action.payload.data;
        if (state.bookingDetails && state.bookingDetails._id === action.payload.data.bookingId) {
          state.bookingDetails.status = "cancelled";
          state.bookingDetails.cancellation = action.payload.data.cancellation;
        }
        const bookingIndex = state.bookings.findIndex((b) => b._id === action.payload.data.bookingId);
        if (bookingIndex !== -1) {
          state.bookings[bookingIndex].status = "cancelled";
          state.bookings[bookingIndex].cancellation = action.payload.data.cancellation;
        }
      }
    }).addCase(cancelBooking.rejected, (state, action) => {
      var _a;
      state.cancelLoading = false;
      state.cancelError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to cancel booking";
      state.cancelSuccess = false;
    });
  }
});
const {
  resetSearchResults: resetSearchResults$1,
  resetBookingReview,
  resetCreateBooking,
  resetBookingDetails,
  resetTimeline,
  resetInvoice,
  resetCancellationPreview,
  resetCancelBooking,
  clearAllErrors: clearAllErrors$2
} = bookingSlice.actions;
const bookingReducer = bookingSlice.reducer;
const getIntercityRoutes = createAsyncThunk(
  "seo/getIntercityRoutes",
  async (params = {}, { rejectWithValue }) => {
    var _a;
    try {
      const { page = 1, limit = 50, search = "" } = params;
      const queryParams = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString()
      });
      if (search) queryParams.append("search", search);
      const response = await api.get(`/seo/intercity-routes?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch intercity routes" });
    }
  }
);
const getIntercityRouteBySlug = createAsyncThunk(
  "seo/getIntercityRouteBySlug",
  async (slug, { rejectWithValue }) => {
    var _a, _b;
    try {
      const response = await api.get(`/seo/intercity-routes/${slug}`);
      return response.data;
    } catch (error) {
      if (((_a = error.response) == null ? void 0 : _a.status) === 404) {
        return { success: false, data: null, message: "Route not found" };
      }
      return rejectWithValue(((_b = error.response) == null ? void 0 : _b.data) || { message: "Failed to fetch route details" });
    }
  }
);
const getAirportRoutes = createAsyncThunk(
  "seo/getAirportRoutes",
  async (params = {}, { rejectWithValue }) => {
    var _a;
    try {
      const { page = 1, limit = 50, search = "", routeType } = params;
      const queryParams = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString()
      });
      if (search) queryParams.append("search", search);
      if (routeType) queryParams.append("routeType", routeType);
      const response = await api.get(`/seo/airport-routes?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch airport routes" });
    }
  }
);
const getAirportRouteBySlug = createAsyncThunk(
  "seo/getAirportRouteBySlug",
  async (slug, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/seo/airport-routes/${slug}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch airport route details" });
    }
  }
);
const getCityServices = createAsyncThunk(
  "seo/getCityServices",
  async (params = {}, { rejectWithValue }) => {
    var _a;
    try {
      const { page = 1, limit = 50, search = "" } = params;
      const queryParams = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString()
      });
      if (search) queryParams.append("search", search);
      const response = await api.get(`/seo/city-services?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch city services" });
    }
  }
);
const getCityServiceBySlug = createAsyncThunk(
  "seo/getCityServiceBySlug",
  async (slug, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/seo/city-services/${slug}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch city service details" });
    }
  }
);
const searchIntercityCabs = createAsyncThunk(
  "seo/searchIntercityCabs",
  async ({ slug, params = {} }, { rejectWithValue }) => {
    var _a;
    try {
      const { startTime, fuelType, isAc = true, page = 1, limit = 10, tripType = "oneWay" } = params;
      const queryParams = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString(),
        isAc: isAc.toString(),
        tripType
      });
      if (startTime) queryParams.append("startTime", startTime);
      if (fuelType) queryParams.append("fuelType", fuelType);
      const response = await api.get(`/seo/search/intercity/${slug}?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to search cabs" });
    }
  }
);
const searchAirportCabs = createAsyncThunk(
  "seo/searchAirportCabs",
  async ({ slug, params = {} }, { rejectWithValue }) => {
    var _a;
    try {
      const { startTime, fuelType, isAc = true, page = 1, limit = 10, sourceLat, sourceLong, destLat, destLong } = params;
      const queryParams = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString(),
        isAc: isAc.toString()
      });
      if (startTime) queryParams.append("startTime", startTime);
      if (fuelType) queryParams.append("fuelType", fuelType);
      if (sourceLat) queryParams.append("sourceLat", sourceLat);
      if (sourceLong) queryParams.append("sourceLong", sourceLong);
      if (destLat) queryParams.append("destLat", destLat);
      if (destLong) queryParams.append("destLong", destLong);
      const response = await api.get(`/seo/search/airport/${slug}?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to search airport cabs" });
    }
  }
);
const searchCityCabs = createAsyncThunk(
  "seo/searchCityCabs",
  async ({ slug, params = {} }, { rejectWithValue }) => {
    var _a;
    try {
      const { startTime, fuelType, isAc = true, page = 1, limit = 10 } = params;
      const queryParams = new URLSearchParams({
        page: page.toString(),
        limit: limit.toString(),
        isAc: isAc.toString()
      });
      if (startTime) queryParams.append("startTime", startTime);
      if (fuelType) queryParams.append("fuelType", fuelType);
      const response = await api.get(`/seo/city-services/${slug}?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to search city cabs" });
    }
  }
);
const initialState$3 = {
  // Intercity Routes
  intercityRoutes: [],
  intercityPagination: null,
  intercityLoading: false,
  intercityError: null,
  // Single Intercity Route
  currentIntercityRoute: null,
  currentIntercityLoading: false,
  currentIntercityError: null,
  // Airport Routes
  airportRoutes: [],
  airportPagination: null,
  airportLoading: false,
  airportError: null,
  // Single Airport Route
  currentAirportRoute: null,
  currentAirportLoading: false,
  currentAirportError: null,
  // City Services
  cityServices: [],
  cityPagination: null,
  cityLoading: false,
  cityError: null,
  // Single City Service
  currentCityService: null,
  currentCityLoading: false,
  currentCityError: null,
  // Real-time Cab Search Results
  searchResults: {
    cabs: [],
    pagination: null,
    route: null
  },
  searchLoading: false,
  searchError: null
};
const seoSlice = createSlice({
  name: "seo",
  initialState: initialState$3,
  reducers: {
    clearCurrentRoute: (state) => {
      state.currentIntercityRoute = null;
      state.currentAirportRoute = null;
      state.currentCityService = null;
    },
    clearSearchResults: (state) => {
      state.searchResults = { cabs: [], pagination: null, route: null };
      state.searchError = null;
    },
    clearAllErrors: (state) => {
      state.intercityError = null;
      state.airportError = null;
      state.cityError = null;
      state.currentIntercityError = null;
      state.currentAirportError = null;
      state.currentCityError = null;
      state.searchError = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(getIntercityRoutes.pending, (state) => {
      state.intercityLoading = true;
      state.intercityError = null;
    }).addCase(getIntercityRoutes.fulfilled, (state, action) => {
      state.intercityLoading = false;
      if (action.payload.success) {
        state.intercityRoutes = action.payload.routes || [];
        state.intercityPagination = action.payload.pagination || null;
      }
    }).addCase(getIntercityRoutes.rejected, (state, action) => {
      var _a;
      state.intercityLoading = false;
      state.intercityError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch routes";
    });
    builder.addCase(getIntercityRouteBySlug.pending, (state) => {
      state.currentIntercityLoading = true;
      state.currentIntercityError = null;
    }).addCase(getIntercityRouteBySlug.fulfilled, (state, action) => {
      state.currentIntercityLoading = false;
      if (action.payload.success && action.payload.data) {
        state.currentIntercityRoute = action.payload.data;
      } else {
        state.currentIntercityRoute = null;
      }
    }).addCase(getIntercityRouteBySlug.rejected, (state, action) => {
      var _a;
      state.currentIntercityLoading = false;
      state.currentIntercityError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch route";
      state.currentIntercityRoute = null;
    });
    builder.addCase(getAirportRoutes.pending, (state) => {
      state.airportLoading = true;
      state.airportError = null;
    }).addCase(getAirportRoutes.fulfilled, (state, action) => {
      state.airportLoading = false;
      if (action.payload.success) {
        state.airportRoutes = action.payload.routes || [];
        state.airportPagination = action.payload.pagination || null;
      }
    }).addCase(getAirportRoutes.rejected, (state, action) => {
      var _a;
      state.airportLoading = false;
      state.airportError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch airport routes";
    });
    builder.addCase(getAirportRouteBySlug.pending, (state) => {
      state.currentAirportLoading = true;
      state.currentAirportError = null;
    }).addCase(getAirportRouteBySlug.fulfilled, (state, action) => {
      state.currentAirportLoading = false;
      if (action.payload.success) {
        state.currentAirportRoute = action.payload.data;
      }
    }).addCase(getAirportRouteBySlug.rejected, (state, action) => {
      var _a;
      state.currentAirportLoading = false;
      state.currentAirportError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch airport route";
    });
    builder.addCase(getCityServices.pending, (state) => {
      state.cityLoading = true;
      state.cityError = null;
    }).addCase(getCityServices.fulfilled, (state, action) => {
      state.cityLoading = false;
      if (action.payload.success) {
        state.cityServices = action.payload.services || [];
        state.cityPagination = action.payload.pagination || null;
      }
    }).addCase(getCityServices.rejected, (state, action) => {
      var _a;
      state.cityLoading = false;
      state.cityError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch city services";
    });
    builder.addCase(getCityServiceBySlug.pending, (state) => {
      state.currentCityLoading = true;
      state.currentCityError = null;
    }).addCase(getCityServiceBySlug.fulfilled, (state, action) => {
      state.currentCityLoading = false;
      if (action.payload.success) {
        state.currentCityService = action.payload.data;
      }
    }).addCase(getCityServiceBySlug.rejected, (state, action) => {
      var _a;
      state.currentCityLoading = false;
      state.currentCityError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch city service";
    });
    builder.addCase(searchIntercityCabs.pending, (state) => {
      state.searchLoading = true;
      state.searchError = null;
    }).addCase(searchIntercityCabs.fulfilled, (state, action) => {
      var _a, _b, _c, _d;
      state.searchLoading = false;
      if (action.payload.success) {
        state.searchResults = {
          cabs: ((_a = action.payload.data) == null ? void 0 : _a.cabs) || ((_b = action.payload.data) == null ? void 0 : _b.vehicles) || [],
          pagination: ((_c = action.payload.data) == null ? void 0 : _c.pagination) || null,
          route: ((_d = action.payload.data) == null ? void 0 : _d.route) || null
        };
      }
    }).addCase(searchIntercityCabs.rejected, (state, action) => {
      var _a;
      state.searchLoading = false;
      state.searchError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to search cabs";
    });
    builder.addCase(searchAirportCabs.pending, (state) => {
      state.searchLoading = true;
      state.searchError = null;
    }).addCase(searchAirportCabs.fulfilled, (state, action) => {
      var _a, _b, _c, _d;
      state.searchLoading = false;
      if (action.payload.success) {
        state.searchResults = {
          cabs: ((_a = action.payload.data) == null ? void 0 : _a.cabs) || ((_b = action.payload.data) == null ? void 0 : _b.vehicles) || [],
          pagination: ((_c = action.payload.data) == null ? void 0 : _c.pagination) || null,
          route: ((_d = action.payload.data) == null ? void 0 : _d.route) || null
        };
      }
    }).addCase(searchAirportCabs.rejected, (state, action) => {
      var _a;
      state.searchLoading = false;
      state.searchError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to search airport cabs";
    });
    builder.addCase(searchCityCabs.pending, (state) => {
      state.searchLoading = true;
      state.searchError = null;
    }).addCase(searchCityCabs.fulfilled, (state, action) => {
      var _a, _b, _c, _d;
      state.searchLoading = false;
      if (action.payload.success) {
        state.searchResults = {
          cabs: ((_a = action.payload.data) == null ? void 0 : _a.cabs) || ((_b = action.payload.data) == null ? void 0 : _b.vehicles) || [],
          pagination: ((_c = action.payload.data) == null ? void 0 : _c.pagination) || null,
          route: ((_d = action.payload.data) == null ? void 0 : _d.route) || null
        };
      }
    }).addCase(searchCityCabs.rejected, (state, action) => {
      var _a;
      state.searchLoading = false;
      state.searchError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to search city cabs";
    });
  }
});
const { clearCurrentRoute, clearSearchResults, clearAllErrors: clearAllErrors$1 } = seoSlice.actions;
const seoReducer = seoSlice.reducer;
const getCategories = createAsyncThunk(
  "support/getCategories",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/tickets/categories");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch categories" });
    }
  }
);
const getCallbackReasons = createAsyncThunk(
  "support/getCallbackReasons",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/tickets/callback-reasons");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch callback reasons" });
    }
  }
);
const getTimeSlots = createAsyncThunk(
  "support/getTimeSlots",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/tickets/time-slots");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch time slots" });
    }
  }
);
const getSupportStats = createAsyncThunk(
  "support/getSupportStats",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/tickets/stats");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch stats" });
    }
  }
);
const getMyOrders = createAsyncThunk(
  "support/getMyOrders",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/tickets/orders");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch orders" });
    }
  }
);
const createTicket = createAsyncThunk(
  "support/createTicket",
  async (ticketData, { rejectWithValue }) => {
    var _a;
    try {
      const formData = new FormData();
      formData.append("category", ticketData.category);
      formData.append("subject", ticketData.subject);
      formData.append("text", ticketData.text);
      if (ticketData.orderId) formData.append("orderId", ticketData.orderId);
      if (ticketData.attachments && ticketData.attachments.length > 0) {
        ticketData.attachments.forEach((file) => {
          formData.append("attachments", file);
        });
      }
      const response = await api.post("/tickets/", formData, {
        headers: {
          "Content-Type": "multipart/form-data"
        }
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to create ticket" });
    }
  }
);
const getMyTickets = createAsyncThunk(
  "support/getMyTickets",
  async (params = {}, { rejectWithValue }) => {
    var _a;
    try {
      const { page = 1, limit = 10, status } = params;
      const queryParams = new URLSearchParams({ page, limit });
      if (status) queryParams.append("status", status);
      const response = await api.get(`/tickets/my?${queryParams}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch tickets" });
    }
  }
);
const getTicketDetails = createAsyncThunk(
  "support/getTicketDetails",
  async (ticketId, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/tickets/${ticketId}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch ticket details" });
    }
  }
);
const addMessage = createAsyncThunk(
  "support/addMessage",
  async ({ ticketId, text, attachments }, { rejectWithValue }) => {
    var _a;
    try {
      const formData = new FormData();
      formData.append("text", text);
      if (attachments && attachments.length > 0) {
        attachments.forEach((file) => {
          formData.append("attachments", file);
        });
      }
      const response = await api.post(`/tickets/${ticketId}/messages`, formData, {
        headers: {
          "Content-Type": "multipart/form-data"
        }
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to send message" });
    }
  }
);
const requestCallback = createAsyncThunk(
  "support/requestCallback",
  async (callbackData, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/tickets/callback", callbackData);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to request callback" });
    }
  }
);
const getMyCallbacks = createAsyncThunk(
  "support/getMyCallbacks",
  async (params = {}, { rejectWithValue }) => {
    var _a;
    try {
      const { page = 1, limit = 10 } = params;
      const response = await api.get(`/tickets/callback?page=${page}&limit=${limit}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch callbacks" });
    }
  }
);
const cancelCallback = createAsyncThunk(
  "support/cancelCallback",
  async (callbackId, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.delete(`/tickets/callback/${callbackId}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to cancel callback" });
    }
  }
);
const initialState$2 = {
  // Categories & Options
  categories: [],
  callbackReasons: [],
  timeSlots: [],
  orders: [],
  optionsLoading: false,
  optionsError: null,
  // Stats
  stats: null,
  statsLoading: false,
  // Tickets
  tickets: [],
  ticketsPagination: null,
  ticketsLoading: false,
  ticketsError: null,
  // Current Ticket
  currentTicket: null,
  ticketLoading: false,
  ticketError: null,
  // Create Ticket
  createLoading: false,
  createSuccess: false,
  createError: null,
  // Message
  messageLoading: false,
  messageError: null,
  // Callbacks
  callbacks: [],
  callbacksLoading: false,
  callbackSuccess: false,
  callbackError: null
};
const supportSlice = createSlice({
  name: "support",
  initialState: initialState$2,
  reducers: {
    resetCreateState: (state) => {
      state.createLoading = false;
      state.createSuccess = false;
      state.createError = null;
    },
    resetCallbackState: (state) => {
      state.callbackSuccess = false;
      state.callbackError = null;
    },
    clearCurrentTicket: (state) => {
      state.currentTicket = null;
      state.ticketError = null;
    },
    clearErrors: (state) => {
      state.optionsError = null;
      state.ticketsError = null;
      state.ticketError = null;
      state.createError = null;
      state.messageError = null;
      state.callbackError = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(getCategories.pending, (state) => {
      state.optionsLoading = true;
    }).addCase(getCategories.fulfilled, (state, action) => {
      state.optionsLoading = false;
      state.categories = action.payload.data || [];
    }).addCase(getCategories.rejected, (state, action) => {
      var _a;
      state.optionsLoading = false;
      state.optionsError = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(getCallbackReasons.fulfilled, (state, action) => {
      state.callbackReasons = action.payload.data || [];
    });
    builder.addCase(getTimeSlots.fulfilled, (state, action) => {
      state.timeSlots = action.payload.data || [];
    });
    builder.addCase(getSupportStats.pending, (state) => {
      state.statsLoading = true;
    }).addCase(getSupportStats.fulfilled, (state, action) => {
      state.statsLoading = false;
      state.stats = action.payload.data;
    });
    builder.addCase(getMyOrders.fulfilled, (state, action) => {
      state.orders = action.payload.data || [];
    });
    builder.addCase(createTicket.pending, (state) => {
      state.createLoading = true;
      state.createError = null;
      state.createSuccess = false;
    }).addCase(createTicket.fulfilled, (state) => {
      state.createLoading = false;
      state.createSuccess = true;
    }).addCase(createTicket.rejected, (state, action) => {
      var _a;
      state.createLoading = false;
      state.createError = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(getMyTickets.pending, (state) => {
      state.ticketsLoading = true;
      state.ticketsError = null;
    }).addCase(getMyTickets.fulfilled, (state, action) => {
      state.ticketsLoading = false;
      state.tickets = action.payload.tickets || action.payload.data || [];
      state.ticketsPagination = action.payload.pagination || null;
    }).addCase(getMyTickets.rejected, (state, action) => {
      var _a;
      state.ticketsLoading = false;
      state.ticketsError = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(getTicketDetails.pending, (state) => {
      state.ticketLoading = true;
      state.ticketError = null;
    }).addCase(getTicketDetails.fulfilled, (state, action) => {
      state.ticketLoading = false;
      state.currentTicket = action.payload.data;
    }).addCase(getTicketDetails.rejected, (state, action) => {
      var _a;
      state.ticketLoading = false;
      state.ticketError = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(addMessage.pending, (state) => {
      state.messageLoading = true;
      state.messageError = null;
    }).addCase(addMessage.fulfilled, (state, action) => {
      state.messageLoading = false;
      if (state.currentTicket && action.payload.data) {
        state.currentTicket = action.payload.data;
      }
    }).addCase(addMessage.rejected, (state, action) => {
      var _a;
      state.messageLoading = false;
      state.messageError = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(requestCallback.pending, (state) => {
      state.callbacksLoading = true;
      state.callbackError = null;
      state.callbackSuccess = false;
    }).addCase(requestCallback.fulfilled, (state) => {
      state.callbacksLoading = false;
      state.callbackSuccess = true;
    }).addCase(requestCallback.rejected, (state, action) => {
      var _a;
      state.callbacksLoading = false;
      state.callbackError = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(getMyCallbacks.fulfilled, (state, action) => {
      state.callbacks = action.payload.data || [];
    });
    builder.addCase(cancelCallback.fulfilled, (state, action) => {
      const cancelledId = action.meta.arg;
      state.callbacks = state.callbacks.filter((cb) => cb._id !== cancelledId);
    });
  }
});
const { resetCreateState, resetCallbackState, clearCurrentTicket, clearErrors: clearErrors$1 } = supportSlice.actions;
const supportReducer = supportSlice.reducer;
const createPaymentOrder = createAsyncThunk(
  "payment/createOrder",
  async ({ bookingId, amount, paymentType }, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/payment/create-order", {
        bookingId,
        amount,
        paymentType
      });
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to create payment order" }
      );
    }
  }
);
const verifyPayment = createAsyncThunk(
  "payment/verify",
  async (paymentData, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post("/payment/verify", paymentData);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Payment verification failed" }
      );
    }
  }
);
const paymentSlice = createSlice({
  name: "payment",
  initialState: {
    loading: false,
    error: null,
    success: false,
    paymentDetails: null
  },
  reducers: {
    resetPaymentState: (state) => {
      state.loading = false;
      state.error = null;
      state.success = false;
      state.paymentDetails = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(createPaymentOrder.pending, (state) => {
      state.loading = true;
      state.error = null;
    });
    builder.addCase(createPaymentOrder.fulfilled, (state, action) => {
      state.loading = false;
      state.error = null;
    });
    builder.addCase(createPaymentOrder.rejected, (state, action) => {
      var _a;
      state.loading = false;
      state.error = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to initiate payment";
    });
    builder.addCase(verifyPayment.pending, (state) => {
      state.loading = true;
      state.error = null;
    });
    builder.addCase(verifyPayment.fulfilled, (state, action) => {
      state.loading = false;
      state.success = true;
      state.paymentDetails = action.payload.data;
    });
    builder.addCase(verifyPayment.rejected, (state, action) => {
      var _a;
      state.loading = false;
      state.error = ((_a = action.payload) == null ? void 0 : _a.message) || "Payment verification failed";
      state.success = false;
    });
  }
});
const { resetPaymentState } = paymentSlice.actions;
const paymentReducer = paymentSlice.reducer;
const fetchSettings = createAsyncThunk(
  "setting/fetchSettings",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/settings/public");
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch settings" }
      );
    }
  }
);
const settingSlice = createSlice({
  name: "setting",
  initialState: {
    settings: null,
    loading: false,
    error: null
  },
  reducers: {
    // ...
  },
  extraReducers: (builder) => {
    builder.addCase(fetchSettings.pending, (state) => {
      state.loading = true;
      state.error = null;
    });
    builder.addCase(fetchSettings.fulfilled, (state, action) => {
      state.loading = false;
      state.settings = action.payload.data;
    });
    builder.addCase(fetchSettings.rejected, (state, action) => {
      var _a;
      state.loading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
  }
});
const settingReducer = settingSlice.reducer;
const getBanners = createAsyncThunk(
  "cms/getBanners",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/cms/banner");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch banners" });
    }
  }
);
const getFAQs = createAsyncThunk(
  "cms/getFAQs",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/faq/grouped");
      return response.data.data || response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch FAQs" });
    }
  }
);
const getFooter = createAsyncThunk(
  "cms/getFooter",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/cms/footer");
      return response.data;
    } catch (error) {
      return rejectWithValue(((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch footer content" });
    }
  },
  {
    condition: (_, { getState }) => {
      const { cms } = getState();
      if (cms.loading || cms.footer && cms.footer.length > 0) {
        return false;
      }
    }
  }
);
const initialState$1 = {
  banners: [],
  faqs: [],
  footer: [],
  loading: false,
  error: null
};
const cmsSlice = createSlice({
  name: "cms",
  initialState: initialState$1,
  reducers: {
    clearErrors: (state) => {
      state.error = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(getBanners.pending, (state) => {
      state.loading = true;
    }).addCase(getBanners.fulfilled, (state, action) => {
      state.loading = false;
      state.banners = action.payload;
    }).addCase(getBanners.rejected, (state, action) => {
      var _a;
      state.loading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(getFAQs.pending, (state) => {
      state.loading = true;
    }).addCase(getFAQs.fulfilled, (state, action) => {
      state.loading = false;
      state.faqs = action.payload;
    }).addCase(getFAQs.rejected, (state, action) => {
      var _a;
      state.loading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
    builder.addCase(getFooter.pending, (state) => {
      state.loading = true;
    }).addCase(getFooter.fulfilled, (state, action) => {
      state.loading = false;
      state.footer = action.payload;
    }).addCase(getFooter.rejected, (state, action) => {
      var _a;
      state.loading = false;
      state.error = (_a = action.payload) == null ? void 0 : _a.message;
    });
  }
});
const { clearErrors } = cmsSlice.actions;
const cmsReducer = cmsSlice.reducer;
const common$1 = {
  save: "Save",
  cancel: "Cancel",
  loading: "Loading...",
  error: "Error",
  success: "Success",
  submit: "Submit",
  back: "Back",
  next: "Next",
  search: "Search",
  noData: "No data available",
  view: "View",
  close: "Close",
  confirm: "Confirm",
  yes: "Yes",
  no: "No",
  ok: "OK",
  readMore: "Read More",
  readLess: "Read Less",
  exploreMore: "Explore More",
  saving: "SAVING...",
  updating: "UPDATING...",
  showDetails: "Show details",
  hideDetails: "Hide details",
  km: "km",
  kms: "kms",
  mins: "mins",
  at: "at",
  "for": "for",
  after: "after",
  useCurrentLocation: "Use Current Location",
  recentSearches: "Recent Searches",
  done: "Done",
  creatingAccount: "Creating Account...",
  updateSearch: "Update Search",
  update: "Update",
  select: "Select",
  selectDate: "Select Date",
  viewDetails: "View Details",
  note: "Note",
  notAvailable: "N/A"
};
const nav$1 = {
  home: "Home",
  bookings: "My Bookings",
  profile: "Profile",
  support: "Support",
  cabBooking: "Cab Booking",
  logout: "Logout",
  manageBooking: "Manage Booking",
  myTrips: "My Trips",
  loginSignup: "Login / Signup"
};
const hero$1 = {
  bookOnlineCab: "Book Online Cab",
  bookAirportTaxi: "Book Airport Taxi",
  hourlyCarRental: "Hourly Car Rental",
  searchCabs: "Search Cabs",
  from: "From",
  to: "To",
  enterPickup: "Enter Pickup location",
  enterDrop: "Enter Drop location",
  pickupDate: "Pickup Date",
  pickupTime: "Pickup Time",
  returnDate: "Return Date",
  returnTime: "Return Time",
  addStops: "+ Add Stops",
  "new": "New",
  experiencedDrivers: "Experienced And Polite Drivers",
  cleanCabs: "Clean And Comfortable Cabs",
  tripType: "Trip Type",
  bookAirportTaxiDynamic: 'Book {{airport}} Taxi & use "GOCAB" for 10% off',
  startsFrom: "Starts from ₹{{price}}"
};
const tripTypes$1 = {
  oneway: "Outstation One-way",
  round: "Outstation Round Trip",
  airport: "Airport Transfer",
  hourly: "Hourly Rental"
};
const booking$1 = {
  title: "Book a Ride",
  pickup: "Pickup",
  dropoff: "Drop-off Location",
  selectVehicle: "Select Vehicle",
  estimatedFare: "Estimated Fare",
  bookNow: "Book Now",
  confirmBooking: "Confirm Booking",
  myBookings: "My Bookings",
  noBookings: "No bookings yet",
  bookingDetails: "Booking Details",
  bookingId: "Booking ID",
  orderId: "Order ID",
  tripDetails: "Trip Details",
  paymentDetails: "Payment Details",
  driverDetails: "Driver Details",
  vehicleDetails: "Vehicle Details",
  status: {
    pending: "Pending",
    confirmed: "Confirmed",
    inProgress: "In Progress",
    completed: "Completed",
    cancelled: "Cancelled",
    created: "Created",
    assigned: "Assigned",
    arrived: "Arrived"
  },
  pickupLocation: "Pickup Location",
  dropLocation: "Drop Location",
  distance: "Distance",
  duration: "Duration",
  baseFare: "Base Fare",
  taxes: "Taxes",
  totalFare: "Total Fare",
  paidAmount: "Paid Amount",
  pendingAmount: "Pending Amount",
  payNow: "Pay Now",
  payLater: "Pay Later",
  cashOnDelivery: "Cash Payment",
  reviewYourBooking: "Review your Booking",
  hurry: "Hurry! Limited cars left",
  goodChoice: "Reasons you've made a good choice",
  cabOperator: "Cab Operator",
  willBeAssigned: "will be assigned",
  bookingComplete: "on booking complete",
  detailsShared: "details will be shared",
  onRegisteredMobile: "on your registered mobile number",
  imagesOfVehicle: "Images of selected vehicle category",
  imageDisclaimer: "The car images shown here are for representation.",
  inclusionsExclusions: "Inclusions & exclusions",
  includedInFare: "Included in your fare",
  stateTaxes: "State Taxes",
  onePickupDrop: "Only One Pickup and Drop",
  tollCharges: "Toll Charges",
  extraCharges: "Extra charges (based on your usage)",
  fareBeyond: "Fare beyond",
  specialRequests: "Special Requests",
  roofCarrier: "Roof Carrier",
  roofCarrierDesc: "Car with roof carrier with extra luggage",
  pickupAddress: "Pickup Address",
  enterPickup: "Enter Pickup Location",
  selectPickup: "Select Pickup Location",
  locationUpdateWarning: "Exact location needs to be updated",
  useAsBilling: "Use this as billing address for text invoice",
  travellerDetails: "Traveller details",
  signInPrompt: "SignIn/SignUp to speed up your booking process",
  emailDisclaimer: "(Your E-ticket and updates will be sent here)",
  afterBookingConfirmed: "After Booking Confirmed",
  afterTime: "After",
  noRefund: "No refund",
  otherInformation: "Other information",
  acOffHilly: "AC will be switched off in hilly areas",
  oneStopIncluded: "Only one pick-up, one drop & one pit stop for meal is included",
  tollStateTax: "Toll & State Tax",
  zoneExtraCharges: "Zone extra charges",
  tripInformation: "Trip Information",
  scheduledTime: "Scheduled Time",
  customerDetails: "Customer Details",
  driverNotAssigned: "Driver not yet assigned",
  bookingTimeline: "Booking Timeline",
  noTimelineEvents: "No timeline events available",
  date: "Date",
  customer: "Customer",
  invoice: "Invoice",
  downloadInvoicePDF: "Download Invoice PDF",
  invoiceNotAvailable: "Invoice not available",
  backToMyTrips: "Back to My Trips",
  drop: "Drop",
  airportPickup: "Airport Pickup",
  airportDrop: "Airport Drop"
};
const cabSearch$1 = {
  title: "Search Cabs",
  searchResults: "Search Results",
  noCabs: "No cabs available in this area",
  tryDifferent: "Please try a different location",
  filters: "Filters",
  sortBy: "Sort By",
  priceLowest: "Lowest Price",
  priceHighest: "Highest Price",
  rating: "Rating",
  seater: "Seater",
  ac: "AC",
  nonAc: "Non AC",
  petrol: "Petrol",
  diesel: "Diesel",
  cng: "CNG",
  electric: "Electric",
  selectCab: "Select Cab",
  viewDetails: "View Details",
  perKm: "per km",
  includedKm: "Included KM",
  extraKmFare: "Extra KM Fare",
  availableCabsFor: "Available Cabs for",
  searchingCabs: "Searching available cabs...",
  fixedFare: "Fixed Fare",
  instantConfirmation: "Instant Confirmation",
  economicalCarDesc: "Economical car with limited luggage",
  comfortableRideDesc: "Comfortable ride with ample space",
  spaciousCarDesc: "Spacious car for large groups",
  kmsIncluded: "{{kms}} kms included. After that ₹{{rate}}/km",
  freeCancellationHour: "Free cancellation until 1 hour before pickup",
  reserveAtOnly: "Reserve this cab at ₹{{amount}} only",
  cngCar: "CNG Car",
  petrolCar: "Petrol Car",
  dieselCar: "Diesel Car",
  ratingsCount: "{{count}} ratings",
  off: "off",
  only: "only",
  afterThat: "After that",
  reserve: "Reserve this cab at"
};
const cabInfo$1 = {
  title: "Online Cab Booking On Easy Ride",
  description: "Most Indian tourists prefer to travel to their favorite destinations by road. This is because road travel allows you to enjoy the natural beauty at your own pace.",
  bookYourCab: "Book Your Cab Online",
  premiumServices: "We provide premium services with high reliability.",
  easyToUse: "Due to the easy-to-use interface and quick menu options of EasyRide, online cab booking is not a difficult process. In fact, cab booking has become a part of our everyday life. You can also opt for intercity car rentals in order to visit other cities.",
  premiumServicesText: "We offer premium services with high reliability. EasyRide is one of the most popular platforms for car booking. You can also use the website for train, flight, and bus tickets. The best part is you get top-notch cars for your preferred destination.",
  roadTrips: "Road trips are one of the most exciting ways to travel across the country, and EasyRide ensures your road trip is enjoyable.",
  cancellationPolicy: "Cancellation Policy",
  freeCancellation: "Free cancellation",
  sanitizers: "Sanitizers installed",
  routeExpert: "Route expert"
};
const weekDays$1 = {
  mon: "MON",
  tue: "TUE",
  wed: "WED",
  thu: "THU",
  fri: "FRI",
  sat: "SAT",
  sun: "SUN"
};
const payment$1 = {
  title: "Payment",
  paymentMethod: "Payment Method",
  online: "Online Payment",
  cash: "Cash Payment",
  wallet: "Wallet",
  upi: "UPI",
  card: "Card",
  netBanking: "Net Banking",
  payNow: "Pay Now",
  processing: "Processing...",
  success: "Payment Successful!",
  failed: "Payment Failed",
  tryAgain: "Try Again",
  totalAmount: "Total Amount",
  partialPayment: "Partial Payment",
  fullPayment: "Full Payment",
  payToConfirm: "Pay to confirm booking",
  timeLeft: "Time Left",
  allPaymentOptions: "All Payment Options",
  upiOptions: "UPI Options",
  getCashback: "Get upto ₹1000 Cashback*",
  creditDebit: "Credit/Debit/ATM Card",
  cardProviders: "Visa, MasterCard, Amex, Rupay and more",
  bookNowPayLater: "Book Now Pay Later",
  bnplProviders: "Lazypay, Simpl, HDFC, ICICI, IDFC",
  grandTotal: "Grand Total",
  cabDriverDetails: "Cab & Driver details will be shared by",
  includedBenefits: "Included Benefits",
  freeCancellation: "Free Cancellation till",
  freeWaiting: "Free waiting up to 45 minutes",
  scanToPay: "Scan to Pay",
  instantRefund: "Instant Refund & High Success Rate",
  creatingBooking: "Creating Booking...",
  initiatingPayment: "Initiating Payment...",
  waitingPayment: "Waiting for Payment...",
  verifying: "Verifying...",
  payAndConfirm: "Pay & Confirm Booking",
  verifyingPayment: "Verifying Payment...",
  doNotClose: "Please do not close this window",
  inclusiveGST: "Inclusive of GST",
  distanceCharge: "Distance Charge",
  nightCharge: "Night Charge",
  airportSurcharge: "Airport Surcharge",
  stopsCharge: "Stops Charge",
  gstTaxes: "GST & Taxes",
  discountApplied: "Discount Applied",
  fareBreakdown: "Fare Breakdown",
  distanceFare: "Distance Fare",
  pendingAmount: "Pending Amount",
  paidAmount: "Paid Amount",
  totalFare: "Total Fare",
  taxes: "Taxes",
  baseFare: "Base Fare",
  driverDetails: "Driver Details",
  waitingCharges: "Waiting charges ₹300/60 mins after 30 minutes",
  minimumBookingCharge: "Minimum booking charge",
  perKilometerCharges: "Per kilometer charges",
  additionalStops: "Additional stops during trip",
  lateNightSurcharge: "Late night/early morning surcharge",
  zoneExtraCharge: "Zone Extra Charge",
  additionalZoneCharges: "Additional zone-based charges",
  governmentTaxes: "Government taxes and service fees",
  subtotal: "Subtotal",
  promotionalDiscount: "Promotional discount",
  finalAmountToPay: "Final amount to be paid",
  onlinePaymentReceived: "Online payment received",
  toBePaidToDriver: "To be paid to driver",
  paymentStatus: "Payment Status",
  fullyPaidOnline: "Fully paid online",
  paid: "PAID",
  noFareInfo: "No fare information available",
  fareCalculationNote: "Fare is calculated based on distance, time, and applicable charges. Additional charges may apply for tolls, parking, or route changes.",
  additionalChargesNote: "Additional charges may apply based on route, time, and stops.",
  saved: "saved"
};
const auth$1 = {
  login: "Login",
  register: "Register",
  phone: "Phone Number",
  email: "Email",
  password: "Password",
  otp: "Enter OTP",
  sendOtp: "Send OTP",
  verifyOtp: "Verify OTP",
  resendOtp: "Resend OTP",
  forgotPassword: "Forgot Password?",
  loginWithGoogle: "Continue with Google",
  createAccount: "Create Account",
  alreadyHaveAccount: "Already have an account?",
  dontHaveAccount: "Don't have an account?",
  signUp: "Sign Up",
  signIn: "Sign In",
  fullName: "Full Name",
  enterPhone: "Enter your phone number",
  enterEmail: "Enter your email",
  enterPassword: "Enter your password",
  enterName: "Enter your name",
  verifying: "Verifying...",
  loggingIn: "Logging In...",
  loginToContinue: "Please login to continue with booking",
  userName: "Username"
};
const profile$1 = {
  title: "My Profile",
  name: "Full Name",
  email: "Email",
  phone: "Phone",
  updateProfile: "Update Profile",
  changePassword: "Change Password",
  savedAddresses: "Saved Addresses",
  addAddress: "Add Address",
  home: "Home",
  work: "Work",
  other: "Other",
  walletBalance: "Wallet Balance",
  myTrips: "My Trips",
  helpCenter: "Help Center",
  myAccount: "MY ACCOUNT",
  security: "Security (Password)",
  deleteAccount: "Delete Account",
  generalInfo: "General Information",
  address: "Address",
  streetAddress: "Street Address",
  city: "City",
  state: "State",
  pincode: "Pincode",
  gender: "Gender",
  male: "Male",
  female: "Female",
  dob: "Date of Birth",
  nationality: "Nationality",
  maritalStatus: "Marital Status",
  actionRequired: "Action Required: Incomplete Profile",
  provideDetails: "Please provide your official email and complete address to ensure smooth bookings and communications.",
  profileComplete: "Profile Complete",
  profileVerified: "Your profile is verified and up to date. You can now enjoy full access to all features.",
  currentPassword: "Current Password",
  newPassword: "New Password",
  confirmPassword: "Confirm New Password",
  passwordSecure: "Ensure your account is using a long, random password to stay secure.",
  deleteConfirm: "Are you sure you want to permanently delete your account? This action cannot be undone.",
  passwordMismatch: "New passwords do not match!",
  profileImage: "Profile Image"
};
const trips$1 = {
  yourTrips: "Your Trips",
  upcomingBookings: "Upcoming Bookings",
  cancelledBookings: "Cancelled Bookings",
  completedBookings: "Completed Bookings",
  loadingTrips: "Loading your trips...",
  noTrips: "Looks like you have no",
  bookingsWithEasyride: "bookings with EasyRide",
  tripsWillShowHere: "When you book, your trips will be shown here.",
  startBookingNow: "Start Booking Now",
  orderId: "Order ID"
};
const support$1 = {
  title: "Support",
  createTicket: "Create Ticket",
  myTickets: "My Tickets",
  subject: "Subject",
  message: "Message",
  priority: "Priority",
  low: "Low",
  medium: "Medium",
  high: "High",
  status: "Status",
  open: "Open",
  closed: "Closed",
  inProgress: "In Progress",
  contactUs: "Contact Us",
  faq: "FAQ",
  helpAndSupport: "Help & Support"
};
const faq$1 = {
  title: "Frequently Asked Questions",
  howToBook: "How to book a cab?",
  cancellationPolicy: "What is the cancellation policy?",
  paymentMethods: "What payment methods are available?",
  driverContact: "How do I contact the driver?",
  economicalCabQ: "Which is the most economical cab available at {{airport}}?",
  economicalCabA: "The most economical cab available at {{airport}} at present is Sedan.",
  optionsQ: "What are the cab booking options available at {{airport}}?",
  optionsA: "You can book following types of cabs from {{airport}}:"
};
const cities$1 = {
  title: "Cities",
  popularCities: "Popular Cities",
  allCities: "All Cities",
  selectCity: "Select City"
};
const routes$1 = {
  title: "Routes",
  popularRoutes: "Popular Routes",
  intercityRoutes: "Intercity Routes",
  airportRoutes: "Airport Routes"
};
const errors$1 = {
  enterPickup: "Please enter pickup location",
  enterDrop: "Please enter drop location",
  locationNotFound: "Location not found",
  searchFailed: "Search failed. Please try again.",
  bookingFailed: "Booking failed. Please try again.",
  paymentFailed: "Payment failed. Please try again.",
  loginRequired: "Please login to continue",
  invalidOtp: "Invalid OTP",
  razorpayFailed: "Razorpay SDK failed to load. Are you online?",
  paymentVerifyFailed: "Payment verification failed. Please contact support.",
  paymentCancelled: "Payment cancelled. You can retry from My Trips."
};
const toasts$1 = {
  findingCabs: "Finding cabs...",
  bookingSuccess: "Booking successful!",
  paymentSuccess: "Payment successful!",
  loginSuccess: "Login successful!",
  logoutSuccess: "Logout successful!",
  profileUpdated: "Profile updated!",
  ticketCreated: "Ticket created!",
  registerSuccess: "Registration Successful!"
};
const footer$1 = {
  aboutUs: "About Us",
  contactUs: "Contact Us",
  termsConditions: "Terms & Conditions",
  privacyPolicy: "Privacy Policy",
  refundPolicy: "Refund Policy",
  careers: "Careers",
  blog: "Blog",
  downloadApp: "Download App",
  followUs: "Follow Us",
  copyright: "© 2025 Easy Ride. All rights reserved."
};
const tripDetails = {
  stop: "Stop"
};
const months$1 = {
  jan: "Jan",
  feb: "Feb",
  mar: "Mar",
  apr: "Apr",
  may: "May",
  jun: "Jun",
  jul: "Jul",
  aug: "Aug",
  sep: "Sep",
  oct: "Oct",
  nov: "Nov",
  dec: "Dec"
};
const en = {
  common: common$1,
  nav: nav$1,
  hero: hero$1,
  tripTypes: tripTypes$1,
  booking: booking$1,
  cabSearch: cabSearch$1,
  cabInfo: cabInfo$1,
  weekDays: weekDays$1,
  payment: payment$1,
  auth: auth$1,
  profile: profile$1,
  trips: trips$1,
  support: support$1,
  faq: faq$1,
  cities: cities$1,
  routes: routes$1,
  errors: errors$1,
  toasts: toasts$1,
  footer: footer$1,
  tripDetails,
  months: months$1
};
const common = {
  save: "सहेजें",
  cancel: "रद्द करें",
  loading: "लोड हो रहा है...",
  error: "त्रुटि",
  success: "सफलता",
  submit: "जमा करें",
  back: "वापस",
  next: "अगला",
  search: "खोजें",
  noData: "कोई डेटा उपलब्ध नहीं",
  view: "देखें",
  close: "बंद करें",
  confirm: "पुष्टि करें",
  yes: "हाँ",
  no: "नहीं",
  ok: "ठीक है",
  readMore: "और पढ़ें",
  readLess: "कम पढ़ें",
  exploreMore: "और देखें",
  saving: "सहेजा जा रहा है...",
  updating: "अपडेट हो रहा है...",
  showDetails: "विवरण देखें",
  hideDetails: "विवरण छुपाएं",
  km: "किमी",
  kms: "किमी",
  mins: "मिनट",
  at: "पर",
  "for": "के लिए",
  after: "के बाद",
  useCurrentLocation: "वर्तमान स्थान का उपयोग करें",
  recentSearches: "हाल की खोजें",
  done: "हो गया",
  creatingAccount: "खाता बनाया जा रहा है...",
  updateSearch: "खोज अपडेट करें",
  update: "अपडेट",
  select: "चुनें",
  selectDate: "तिथि चुनें",
  viewDetails: "विवरण देखें",
  note: "नोट",
  notAvailable: "उपलब्ध नहीं"
};
const nav = {
  home: "होम",
  bookings: "मेरी बुकिंग",
  profile: "प्रोफ़ाइल",
  support: "सहायता",
  cabBooking: "कैब बुकिंग",
  logout: "लॉगआउट",
  manageBooking: "बुकिंग प्रबंधन",
  myTrips: "मेरी यात्राएं",
  loginSignup: "लॉगिन / साइनअप"
};
const hero = {
  bookOnlineCab: "ऑनलाइन कैब बुक करें",
  bookAirportTaxi: "एयरपोर्ट टैक्सी बुक करें",
  hourlyCarRental: "घंटे के अनुसार कार किराया",
  searchCabs: "कैब खोजें",
  from: "से",
  to: "तक",
  enterPickup: "पिकअप स्थान दर्ज करें",
  enterDrop: "ड्रॉप स्थान दर्ज करें",
  pickupDate: "पिकअप दिनांक",
  pickupTime: "पिकअप समय",
  returnDate: "वापसी दिनांक",
  returnTime: "वापसी समय",
  addStops: "+ स्टॉप जोड़ें",
  "new": "नया",
  experiencedDrivers: "अनुभवी और विनम्र ड्राइवर",
  cleanCabs: "स्वच्छ और आरामदायक कैब",
  tripType: "ट्रिप का प्रकार",
  bookAirportTaxiDynamic: "{{airport}} टैक्सी बुक करें और 10% ऑफ पाएं",
  startsFrom: "शुरुआत ₹{{price}} से"
};
const tripTypes = {
  oneway: "एक तरफ़ आउटस्टेशन",
  round: "आउटस्टेशन राउंड ट्रिप",
  airport: "एयरपोर्ट ट्रांसफर",
  hourly: "घंटे के अनुसार किराया"
};
const booking = {
  title: "राइड बुक करें",
  pickup: "पिकअप स्थान",
  dropoff: "ड्रॉप-ऑफ स्थान",
  selectVehicle: "वाहन चुनें",
  estimatedFare: "अनुमानित किराया",
  bookNow: "अभी बुक करें",
  confirmBooking: "बुकिंग पुष्टि करें",
  myBookings: "मेरी बुकिंग",
  noBookings: "अभी तक कोई बुकिंग नहीं",
  bookingDetails: "बुकिंग विवरण",
  bookingId: "बुकिंग ID",
  orderId: "ऑर्डर ID",
  tripDetails: "यात्रा विवरण",
  paymentDetails: "भुगतान विवरण",
  driverDetails: "ड्राइवर विवरण",
  vehicleDetails: "वाहन विवरण",
  status: {
    pending: "लंबित",
    confirmed: "पुष्टि",
    inProgress: "चल रहा है",
    completed: "पूर्ण",
    cancelled: "रद्द",
    created: "बनाया गया",
    assigned: "सौंपा गया",
    arrived: "पहुँच गया"
  },
  pickupLocation: "पिकअप स्थान",
  dropLocation: "ड्रॉप स्थान",
  distance: "दूरी",
  duration: "अवधि",
  baseFare: "बेस किराया",
  taxes: "कर",
  totalFare: "कुल किराया",
  paidAmount: "भुगतान राशि",
  pendingAmount: "लंबित राशि",
  payNow: "अभी भुगतान करें",
  payLater: "बाद में भुगतान करें",
  cashOnDelivery: "नकद भुगतान",
  reviewYourBooking: "अपनी बुकिंग की समीक्षा करें",
  hurry: "जल्दी करें! सीमित कारें बची हैं",
  goodChoice: "आपने एक अच्छा विकल्प चुना है",
  cabOperator: "कैब ऑपरेटर",
  willBeAssigned: "सौंपा जाएगा",
  bookingComplete: "बुकिंग पूरी होने पर",
  detailsShared: "विवरण साझा किए जाएंगे",
  onRegisteredMobile: "आपके पंजीकृत मोबाइल नंबर पर",
  imagesOfVehicle: "चयनित वाहन श्रेणी की छवियां",
  imageDisclaimer: "यहाँ दिखाई गई कार की छवियां केवल प्रतिनिधित्व के लिए हैं।",
  inclusionsExclusions: "समावेशन और बहिष्करण",
  includedInFare: "आपके किराए में शामिल",
  stateTaxes: "राज्य कर",
  onePickupDrop: "केवल एक पिकअप और ड्रॉप",
  tollCharges: "टोल शुल्क",
  extraCharges: "अतिरिक्त शुल्क",
  fareBeyond: "किराया उससे परे",
  specialRequests: "विशेष अनुरोध",
  roofCarrier: "रूफ कैरियर",
  roofCarrierDesc: "अतिरिक्त सामान के लिए रूफ कैरियर वाली कार",
  pickupAddress: "पिकअप पता",
  enterPickup: "पिकअप स्थान दर्ज करें",
  selectPickup: "पिकअप स्थान चुनें",
  locationUpdateWarning: "सटीक स्थान अपडेट करने की आवश्यकता है",
  useAsBilling: "बिलिंग पते के रूप में उपयोग करें",
  travellerDetails: "यात्री विवरण",
  signInPrompt: "तेजी से बुकिंग के लिए साइन इन करें",
  emailDisclaimer: "(आपका ई-टिकट यहाँ भेजा जाएगा)",
  afterBookingConfirmed: "बुकिंग पुष्टि के बाद",
  afterTime: "के बाद",
  noRefund: "कोई रिफंड नहीं",
  otherInformation: "अन्य जानकारी",
  acOffHilly: "पहाड़ी क्षेत्रों में एसी बंद रहेगा",
  oneStopIncluded: "केवल एक स्टॉप शामिल है",
  tollStateTax: "टोल और राज्य कर",
  zoneExtraCharges: "जोन अतिरिक्त शुल्क",
  tripInformation: "यात्रा की जानकारी",
  scheduledTime: "निर्धारित समय",
  customerDetails: "ग्राहक विवरण",
  driverNotAssigned: "ड्राइवर अभी तक नहीं सौंपा गया",
  bookingTimeline: "बुकिंग समयरेखा",
  noTimelineEvents: "कोई घटना नहीं",
  date: "दिनांक",
  customer: "ग्राहक",
  invoice: "चालान",
  downloadInvoicePDF: "PDF डाउनलोड करें",
  invoiceNotAvailable: "चालान उपलब्ध नहीं",
  backToMyTrips: "मेरी यात्राओं पर वापस जाएं",
  airportPickup: "एयरपोर्ट पिकअप",
  airportDrop: "एयरपोर्ट ड्रॉप"
};
const cabSearch = {
  title: "कैब खोजें",
  searchResults: "खोज परिणाम",
  noCabs: "इस क्षेत्र में कोई कैब उपलब्ध नहीं",
  tryDifferent: "कृपया अलग स्थान आज़माएं",
  filters: "फ़िल्टर",
  sortBy: "क्रमबद्ध करें",
  priceLowest: "न्यूनतम कीमत",
  priceHighest: "अधिकतम कीमत",
  rating: "रेटिंग",
  seater: "सीटर",
  ac: "एसी",
  nonAc: "नॉन एसी",
  petrol: "पेट्रोल",
  diesel: "डीज़ल",
  cng: "सीएनजी",
  electric: "इलेक्ट्रिक",
  selectCab: "कैब चुनें",
  viewDetails: "विवरण देखें",
  perKm: "प्रति किमी",
  includedKm: "शामिल किमी",
  extraKmFare: "अतिरिक्त किमी किराया",
  availableCabsFor: "के लिए उपलब्ध कैब",
  searchingCabs: "उपलब्ध कैब खोजी जा रही हैं...",
  fixedFare: "निश्चित किराया",
  instantConfirmation: "तत्काल पुष्टि",
  economicalCarDesc: "सीमित सामान के साथ किफायती कार",
  comfortableRideDesc: "काफी जगह के साथ आरामदायक सवारी",
  spaciousCarDesc: "बड़े समूहों के लिए विशाल कार",
  kmsIncluded: "{{kms}} किमी शामिल। उसके बाद ₹{{rate}}/किमी",
  freeCancellationHour: "पिकअप से 1 घंटे पहले तक निःशुल्क रद्दीकरण",
  reserveAtOnly: "इस कैब को केवल ₹{{amount}} में आरक्षित करें",
  cngCar: "सीएनजी कार",
  petrolCar: "पेट्रोल कार",
  dieselCar: "डीजल कार",
  ratingsCount: "{{count}} रेटिंग्स",
  off: "की छूट",
  only: "मात्र",
  afterThat: "उसके बाद",
  reserve: "इस कैब को आरक्षित करें"
};
const cabInfo = {
  title: "ईज़ी राइड पर ऑनलाइन कैब बुकिंग",
  description: "अधिकांश भारतीय पर्यटक सड़क मार्ग से अपने पसंदीदा गंतव्यों की यात्रा करना पसंद करते हैं। ऐसा इसलिए है क्योंकि सड़क यात्रा आपको अपनी गति से प्राकृतिक सुंदरता का आनंद लेने की अनुमति देती है।",
  bookYourCab: "अपनी कैब ऑनलाइन बुक करें",
  premiumServices: "हम उच्च विश्वसनीयता के साथ प्रीमियम सेवाएं प्रदान करते हैं।",
  easyToUse: "ईज़ी राइड के उपयोग में आसान इंटरफ़ेस और त्वरित मेनू विकल्पों के कारण, ऑनलाइन कैब बुकिंग एक कठिन प्रक्रिया नहीं है। वास्तव में, कैब बुकिंग हमारे रोजमर्रा के जीवन का हिस्सा बन गई है। आप दूसरे शहरों की यात्रा के लिए इंटरसिटी कार रेंटल का विकल्प भी चुन सकते हैं।",
  premiumServicesText: "हम उच्च विश्वसनीयता के साथ प्रीमियम सेवाएं प्रदान करते हैं। ईज़ी राइड कार बुकिंग के लिए सबसे लोकप्रिय प्लेटफार्मों में से एक है। आप ट्रेन, फ्लाइट और बस टिकटों के लिए भी वेबसाइट का उपयोग कर सकते हैं। सबसे अच्छी बात यह है कि आपको अपने पसंदीदा गंतव्य के लिए बेहतरीन कारें मिलती हैं।",
  roadTrips: "सड़क यात्राएं देश भर में यात्रा करने के सबसे रोमांचक तरीकों में से एक हैं, और ईज़ी राइड यह सुनिश्चित करती है कि आपकी सड़क यात्रा सुखद हो।",
  cancellationPolicy: "रद्दीकरण नीति",
  freeCancellation: "निःशुल्क रद्दीकरण",
  sanitizers: "सैनिटाइज़र स्थापित",
  routeExpert: "मार्ग विशेषज्ञ"
};
const weekDays = {
  mon: "सोम",
  tue: "मंग",
  wed: "बुध",
  thu: "गुरु",
  fri: "शुक्र",
  sat: "शनि",
  sun: "रवि"
};
const payment = {
  title: "भुगतान",
  paymentMethod: "भुगतान विधि",
  online: "ऑनलाइन भुगतान",
  cash: "नकद भुगतान",
  wallet: "वॉलेट",
  upi: "UPI",
  card: "कार्ड",
  netBanking: "नेट बैंकिंग",
  payNow: "अभी भुगतान करें",
  processing: "प्रोसेसिंग...",
  success: "भुगतान सफल!",
  failed: "भुगतान विफल",
  tryAgain: "पुनः प्रयास करें",
  totalAmount: "कुल राशि",
  partialPayment: "आंशिक भुगतान",
  fullPayment: "पूर्ण भुगतान",
  payToConfirm: "बुकिंग पुष्टि करने के लिए भुगतान करें",
  timeLeft: "शेष समय",
  allPaymentOptions: "सभी भुगतान विकल्प",
  upiOptions: "UPI विकल्प",
  getCashback: "₹1000 तक कैशबैक पाएं*",
  creditDebit: "क्रेडिट/डेबिट/एटीएम कार्ड",
  cardProviders: "वीज़ा, मास्टरकार्ड, एमेक्स, रुपे और अधिक",
  bookNowPayLater: "अभी बुक करें बाद में भुगतान करें",
  bnplProviders: "लेज़ीपे, सिम्पल, एचडीएफसी, आईसीआईसीआई, आईडीएफसी",
  grandTotal: "कुल योग",
  cabDriverDetails: "कैब और ड्राइवर विवरण",
  includedBenefits: "शामिल लाभ",
  freeCancellation: "मुफ्त रद्दीकरण तक",
  freeWaiting: "45 मिनट तक मुफ्त प्रतीक्षा",
  waitingCharges: "30 मिनट के बाद प्रतीक्षा शुल्क ₹300/60 मिनट",
  scanToPay: "भुगतान के लिए स्कैन करें",
  instantRefund: "तत्काल रिफंड और उच्च सफलता दर",
  creatingBooking: "बुकिंग बनाई जा रही है...",
  initiatingPayment: "भुगतान शुरू हो रहा है...",
  waitingPayment: "भुगतान की प्रतीक्षा...",
  verifying: "सत्यापन हो रहा है...",
  payAndConfirm: "भुगतान करें और बुकिंग पुष्टि करें",
  verifyingPayment: "भुगतान सत्यापित हो रहा है...",
  doNotClose: "कृपया इस विंडो को बंद न करें",
  inclusiveGST: "GST समेत",
  distanceCharge: "दूरी शुल्क",
  nightCharge: "रात्रि शुल्क",
  airportSurcharge: "एयरपोर्ट सरचार्ज",
  stopsCharge: "स्टॉप शुल्क",
  gstTaxes: "GST और कर",
  discountApplied: "छूट लागू",
  fareBreakdown: "किराया ब्रेकडाउन",
  distanceFare: "दूरी किराया",
  pendingAmount: "लंबित राशि",
  paidAmount: "भुगतान राशि",
  totalFare: "कुल किराया",
  taxes: "कर",
  baseFare: "बेस किराया",
  driverDetails: "ड्राइवर विवरण",
  minimumBookingCharge: "न्यूनतम बुकिंग शुल्क",
  perKilometerCharges: "प्रति किलोमीटर शुल्क",
  additionalStops: "यात्रा के दौरान अतिरिक्त स्टॉप",
  lateNightSurcharge: "देर रात/सुबह सरचार्ज",
  zoneExtraCharge: "जोन अतिरिक्त शुल्क",
  additionalZoneCharges: "अतिरिक्त जोन-आधारित शुल्क",
  governmentTaxes: "सरकारी कर और सेवा शुल्क",
  subtotal: "उप-योग",
  promotionalDiscount: "प्रचारक छूट",
  finalAmountToPay: "भुगतान की जाने वाली अंतिम राशि",
  onlinePaymentReceived: "ऑनलाइन भुगतान प्राप्त",
  toBePaidToDriver: "ड्राइवर को भुगतान करना है",
  paymentStatus: "भुगतान स्थिति",
  fullyPaidOnline: "पूर्ण ऑनलाइन भुगतान",
  paid: "भुगतान हो गया",
  noFareInfo: "कोई किराया जानकारी उपलब्ध नहीं",
  fareCalculationNote: "किराया दूरी, समय और लागू शुल्कों के आधार पर गणना की जाती है। टोल, पार्किंग या मार्ग परिवर्तन के लिए अतिरिक्त शुल्क लागू हो सकते हैं।",
  additionalChargesNote: "मार्ग, समय और स्टॉप के आधार पर अतिरिक्त शुल्क लागू हो सकते हैं।",
  saved: "बचत"
};
const auth = {
  login: "लॉगिन",
  register: "रजिस्टर",
  phone: "फ़ोन नंबर",
  email: "ईमेल",
  password: "पासवर्ड",
  otp: "OTP दर्ज करें",
  sendOtp: "OTP भेजें",
  verifyOtp: "OTP सत्यापित करें",
  resendOtp: "OTP पुनः भेजें",
  forgotPassword: "पासवर्ड भूल गए?",
  loginWithGoogle: "Google से जारी रखें",
  createAccount: "खाता बनाएं",
  alreadyHaveAccount: "पहले से खाता है?",
  dontHaveAccount: "खाता नहीं है?",
  signUp: "साइन अप करें",
  signIn: "साइन इन करें",
  fullName: "पूरा नाम",
  enterPhone: "अपना फ़ोन नंबर दर्ज करें",
  enterEmail: "अपना ईमेल दर्ज करें",
  enterPassword: "अपना पासवर्ड दर्ज करें",
  enterName: "अपना नाम दर्ज करें",
  verifying: "सत्यापित हो रहा है...",
  loggingIn: "लॉगिन हो रहा है...",
  loginToContinue: "बुकिंग जारी रखने के लिए कृपया लॉगिन करें",
  userName: "उपयोगकर्ता नाम"
};
const profile = {
  title: "मेरी प्रोफ़ाइल",
  name: "पूरा नाम",
  email: "ईमेल",
  phone: "फ़ोन",
  updateProfile: "प्रोफ़ाइल अपडेट करें",
  changePassword: "पासवर्ड बदलें",
  savedAddresses: "सहेजे गए पते",
  addAddress: "पता जोड़ें",
  home: "घर",
  work: "कार्यस्थल",
  other: "अन्य",
  walletBalance: "वॉलेट बैलेंस",
  myTrips: "मेरी यात्राएं",
  helpCenter: "सहायता केंद्र",
  myAccount: "मेरा खाता",
  security: "सुरक्षा (पासवर्ड)",
  deleteAccount: "खाता हटाएं",
  generalInfo: "सामान्य जानकारी",
  address: "पता",
  streetAddress: "गली का पता",
  city: "शहर",
  state: "राज्य",
  pincode: "पिनकोड",
  gender: "लिंग",
  male: "पुरुष",
  female: "महिला",
  dob: "जन्म तिथि",
  nationality: "राष्ट्रीयता",
  maritalStatus: "वैवाहिक स्थिति",
  actionRequired: "कार्रवाई आवश्यक: अधूरी प्रोफ़ाइल",
  provideDetails: "सुचारू बुकिंग और संचार सुनिश्चित करने के लिए कृपया अपना आधिकारिक ईमेल और पूरा पता प्रदान करें।",
  profileComplete: "प्रोफ़ाइल पूर्ण",
  profileVerified: "आपकी प्रोफ़ाइल सत्यापित और अपडेट है। अब आप सभी सुविधाओं का पूर्ण उपयोग कर सकते हैं।",
  currentPassword: "वर्तमान पासवर्ड",
  newPassword: "नया पासवर्ड",
  confirmPassword: "नया पासवर्ड पुष्टि करें",
  passwordSecure: "सुनिश्चित करें कि आपका खाता एक लंबे, यादृच्छिक पासवर्ड का उपयोग कर रहा है।",
  deleteConfirm: "क्या आप वाकई अपना खाता स्थायी रूप से हटाना चाहते हैं? यह क्रिया पूर्ववत नहीं की जा सकती।",
  passwordMismatch: "नए पासवर्ड मेल नहीं खाते!",
  profileImage: "प्रोफ़ाइल चित्र"
};
const trips = {
  yourTrips: "आपकी यात्राएं",
  upcomingBookings: "आगामी बुकिंग",
  cancelledBookings: "रद्द बुकिंग",
  completedBookings: "पूर्ण बुकिंग",
  loadingTrips: "आपकी यात्राएं लोड हो रही हैं...",
  noTrips: "लगता है कि आपके पास कोई",
  bookingsWithEasyride: "बुकिंग ईज़ीराइड के साथ नहीं है",
  tripsWillShowHere: "जब आप बुक करेंगे, आपकी यात्राएं यहाँ दिखाई देंगी।",
  startBookingNow: "अभी बुकिंग शुरू करें",
  orderId: "ऑर्डर ID"
};
const support = {
  title: "सहायता",
  createTicket: "टिकट बनाएं",
  myTickets: "मेरी टिकट",
  subject: "विषय",
  message: "संदेश",
  priority: "प्राथमिकता",
  low: "कम",
  medium: "मध्यम",
  high: "उच्च",
  status: "स्थिति",
  open: "खुला",
  closed: "बंद",
  inProgress: "प्रगति में",
  contactUs: "हमसे संपर्क करें",
  faq: "अक्सर पूछे जाने वाले प्रश्न",
  helpAndSupport: "सहायता और समर्थन"
};
const faq = {
  title: "अक्सर पूछे जाने वाले प्रश्न",
  howToBook: "कैब कैसे बुक करें?",
  cancellationPolicy: "रद्दीकरण नीति क्या है?",
  paymentMethods: "कौन सी भुगतान विधियां उपलब्ध हैं?",
  driverContact: "मैं ड्राइवर से कैसे संपर्क करूं?",
  economicalCabQ: "{{airport}} पर सबसे किफायती कैब कौन सी उपलब्ध है?",
  economicalCabA: "{{airport}} पर वर्तमान में सबसे किफायती कैब सेडान है।",
  optionsQ: "{{airport}} पर कैब बुकिंग के लिए कौन से विकल्प उपलब्ध हैं?",
  optionsA: "आप {{airport}} से निम्नलिखित प्रकार की कैब बुक कर सकते हैं:"
};
const cities = {
  title: "शहर",
  popularCities: "लोकप्रिय शहर",
  allCities: "सभी शहर",
  selectCity: "शहर चुनें"
};
const routes = {
  title: "मार्ग",
  popularRoutes: "लोकप्रिय मार्ग",
  intercityRoutes: "अंतर-शहर मार्ग",
  airportRoutes: "एयरपोर्ट मार्ग"
};
const errors = {
  enterPickup: "कृपया पिकअप स्थान दर्ज करें",
  enterDrop: "कृपया ड्रॉप स्थान दर्ज करें",
  locationNotFound: "स्थान नहीं मिला",
  searchFailed: "खोज विफल। कृपया पुनः प्रयास करें।",
  bookingFailed: "बुकिंग विफल। कृपया पुनः प्रयास करें।",
  paymentFailed: "भुगतान विफल। कृपया पुनः प्रयास करें।",
  loginRequired: "कृपया जारी रखने के लिए लॉगिन करें",
  invalidOtp: "अमान्य OTP",
  razorpayFailed: "Razorpay SDK लोड करने में विफल। क्या आप ऑनलाइन हैं?",
  paymentVerifyFailed: "भुगतान सत्यापन विफल। कृपया सहायता से संपर्क करें।",
  paymentCancelled: "भुगतान रद्द। आप मेरी यात्राओं से पुनः प्रयास कर सकते हैं।"
};
const toasts = {
  findingCabs: "कैब ढूंढ रहे हैं...",
  bookingSuccess: "बुकिंग सफल!",
  paymentSuccess: "भुगतान सफल!",
  loginSuccess: "लॉगिन सफल!",
  logoutSuccess: "लॉगआउट सफल!",
  profileUpdated: "प्रोफ़ाइल अपडेट हो गई!",
  ticketCreated: "टिकट बनाई गई!",
  registerSuccess: "पंजीकरण सफल!"
};
const footer = {
  aboutUs: "हमारे बारे में",
  contactUs: "संपर्क करें",
  termsConditions: "नियम और शर्तें",
  privacyPolicy: "गोपनीयता नीति",
  refundPolicy: "रिफंड नीति",
  careers: "करियर",
  blog: "ब्लॉग",
  downloadApp: "ऐप डाउनलोड करें",
  followUs: "हमें फॉलो करें",
  copyright: "© 2025 ईज़ी राइड। सभी अधिकार सुरक्षित।"
};
const months = {
  jan: "जनवरी",
  feb: "फ़रवरी",
  mar: "मार्च",
  apr: "अप्रैल",
  may: "मई",
  jun: "जून",
  jul: "जुलाई",
  aug: "अगस्त",
  sep: "सितंबर",
  oct: "अक्टूबर",
  nov: "नवंबर",
  dec: "दिसंबर"
};
const hi = {
  common,
  nav,
  hero,
  tripTypes,
  booking,
  cabSearch,
  cabInfo,
  weekDays,
  payment,
  auth,
  profile,
  trips,
  support,
  faq,
  cities,
  routes,
  errors,
  toasts,
  footer,
  months
};
const isSSR$3 = typeof window === "undefined";
const LANGUAGE_STORAGE_KEY$1 = "app_language";
const API_BASE_URL = "http://localhost:5000";
const resources = {
  en: { translation: en },
  hi: { translation: hi }
};
i18n.use(initReactI18next).init({
  resources,
  lng: !isSSR$3 && localStorage.getItem(LANGUAGE_STORAGE_KEY$1) || "en",
  fallbackLng: "en",
  interpolation: { escapeValue: false },
  react: { useSuspense: false },
  debug: !isSSR$3 && false
});
const loadAndApplyLanguage = async (code) => {
  var _a;
  try {
    if (resources[code]) {
      await i18n.changeLanguage(code);
      if (!isSSR$3) localStorage.setItem(LANGUAGE_STORAGE_KEY$1, code);
      if (!isSSR$3) {
        document.documentElement.dir = code === "ar" ? "rtl" : "ltr";
        document.documentElement.lang = code;
      }
      console.log(`[i18n] Static language applied: ${code}`);
      return true;
    }
    console.log(`[i18n] Fetching dynamic language: ${code}`);
    const response = await fetch(`${API_BASE_URL}/api/v1/app-languages/${code}`);
    const data = await response.json();
    if (data.success && ((_a = data.data) == null ? void 0 : _a.content)) {
      const { content, isRTL } = data.data;
      let translationToApply = content;
      if (content.user || content.vendor || content.zone || content.driver) {
        translationToApply = content.user || {};
      }
      i18n.addResourceBundle(code, "translation", translationToApply, true, true);
      await i18n.changeLanguage(code);
      if (!isSSR$3) localStorage.setItem(LANGUAGE_STORAGE_KEY$1, code);
      if (!isSSR$3) {
        document.documentElement.dir = isRTL ? "rtl" : "ltr";
        document.documentElement.lang = code;
      }
      console.log(`[i18n] Dynamic language "${code}" applied (RTL: ${isRTL})`);
      return true;
    }
  } catch (error) {
    console.error(`[i18n] Error loading language ${code}:`, error);
  }
  return false;
};
const isSSR$2 = typeof window === "undefined";
const LANGUAGE_STORAGE_KEY = "app_language";
const fetchGlobalLanguage = createAsyncThunk(
  "language/fetchGlobal",
  async (_, { rejectWithValue }) => {
    var _a, _b;
    try {
      const response = await api.get("/settings/language");
      const language = ((_b = (_a = response.data) == null ? void 0 : _a.data) == null ? void 0 : _b.language) || "en";
      await loadAndApplyLanguage(language);
      console.log("[LanguageSlice] Global language synced:", language);
      return language;
    } catch (error) {
      console.error("[LanguageSlice] Failed to fetch language:", error);
      const cached = !isSSR$2 && localStorage.getItem(LANGUAGE_STORAGE_KEY) || "en";
      loadAndApplyLanguage(cached);
      return rejectWithValue({ error: error.message, fallback: cached });
    }
  }
);
const getInitialLanguage = () => {
  if (isSSR$2) return "en";
  try {
    return localStorage.getItem(LANGUAGE_STORAGE_KEY) || "en";
  } catch {
    return "en";
  }
};
const languageSlice = createSlice({
  name: "language",
  initialState: {
    language: getInitialLanguage(),
    isLoading: false,
    error: null,
    isFetched: false
  },
  reducers: {
    clearLanguageState: (state) => {
      state.error = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(fetchGlobalLanguage.pending, (state) => {
      state.isLoading = true;
      state.error = null;
    });
    builder.addCase(fetchGlobalLanguage.fulfilled, (state, action) => {
      state.isLoading = false;
      state.language = action.payload;
      state.isFetched = true;
    });
    builder.addCase(fetchGlobalLanguage.rejected, (state, action) => {
      var _a, _b;
      state.isLoading = false;
      state.isFetched = true;
      state.error = (_a = action.payload) == null ? void 0 : _a.error;
      if ((_b = action.payload) == null ? void 0 : _b.fallback) {
        state.language = action.payload.fallback;
      }
    });
  }
});
const { clearLanguageState } = languageSlice.actions;
const languageReducer = languageSlice.reducer;
const getAllFAQs = createAsyncThunk(
  "faq/getAllFAQs",
  async (params = {}, { rejectWithValue }) => {
    var _a;
    try {
      const { category, search, tags, sortBy, page, limit } = params;
      const queryParams = new URLSearchParams();
      if (category) queryParams.append("category", category);
      if (search) queryParams.append("search", search);
      if (tags) queryParams.append("tags", tags);
      if (sortBy) queryParams.append("sortBy", sortBy);
      if (page) queryParams.append("page", page);
      if (limit) queryParams.append("limit", limit);
      const response = await api.get(`/faq?${queryParams.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch FAQs" }
      );
    }
  }
);
const getFAQsByCategory = createAsyncThunk(
  "faq/getFAQsByCategory",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/faq/grouped");
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch FAQs" }
      );
    }
  }
);
const getFAQCategories = createAsyncThunk(
  "faq/getFAQCategories",
  async (_, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get("/faq/categories");
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch categories" }
      );
    }
  }
);
const searchFAQs = createAsyncThunk(
  "faq/searchFAQs",
  async ({ query, limit }, { rejectWithValue }) => {
    var _a;
    try {
      const params = new URLSearchParams();
      params.append("q", query);
      if (limit) params.append("limit", limit);
      const response = await api.get(`/faq/search?${params.toString()}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to search FAQs" }
      );
    }
  }
);
const getFAQById = createAsyncThunk(
  "faq/getFAQById",
  async (id, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.get(`/faq/${id}`);
      return response.data;
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to fetch FAQ" }
      );
    }
  }
);
const markFAQHelpful = createAsyncThunk(
  "faq/markFAQHelpful",
  async ({ id, helpful }, { rejectWithValue }) => {
    var _a;
    try {
      const response = await api.post(`/faq/${id}/helpful`, { helpful });
      return { id, ...response.data };
    } catch (error) {
      return rejectWithValue(
        ((_a = error.response) == null ? void 0 : _a.data) || { message: "Failed to submit feedback" }
      );
    }
  }
);
const initialState = {
  // All FAQs
  faqs: [],
  faqsLoading: false,
  faqsError: null,
  pagination: null,
  // Grouped FAQs
  groupedFAQs: {},
  groupedLoading: false,
  groupedError: null,
  // Categories
  categories: [],
  categoriesLoading: false,
  categoriesError: null,
  // Search
  searchResults: [],
  searchLoading: false,
  searchError: null,
  // Single FAQ
  currentFAQ: null,
  currentLoading: false,
  currentError: null,
  // Feedback
  feedbackLoading: false,
  feedbackError: null
};
const faqSlice = createSlice({
  name: "faq",
  initialState,
  reducers: {
    resetFAQs: (state) => {
      state.faqs = [];
      state.faqsError = null;
      state.pagination = null;
    },
    resetSearchResults: (state) => {
      state.searchResults = [];
      state.searchError = null;
    },
    resetCurrentFAQ: (state) => {
      state.currentFAQ = null;
      state.currentError = null;
    },
    clearAllErrors: (state) => {
      state.faqsError = null;
      state.groupedError = null;
      state.categoriesError = null;
      state.searchError = null;
      state.currentError = null;
      state.feedbackError = null;
    }
  },
  extraReducers: (builder) => {
    builder.addCase(getAllFAQs.pending, (state) => {
      state.faqsLoading = true;
      state.faqsError = null;
    }).addCase(getAllFAQs.fulfilled, (state, action) => {
      state.faqsLoading = false;
      if (action.payload.success) {
        state.faqs = action.payload.data;
        state.pagination = action.payload.pagination;
      }
    }).addCase(getAllFAQs.rejected, (state, action) => {
      var _a;
      state.faqsLoading = false;
      state.faqsError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch FAQs";
    });
    builder.addCase(getFAQsByCategory.pending, (state) => {
      state.groupedLoading = true;
      state.groupedError = null;
    }).addCase(getFAQsByCategory.fulfilled, (state, action) => {
      state.groupedLoading = false;
      if (action.payload.success) {
        state.groupedFAQs = action.payload.data;
      }
    }).addCase(getFAQsByCategory.rejected, (state, action) => {
      var _a;
      state.groupedLoading = false;
      state.groupedError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch FAQs";
    });
    builder.addCase(getFAQCategories.pending, (state) => {
      state.categoriesLoading = true;
      state.categoriesError = null;
    }).addCase(getFAQCategories.fulfilled, (state, action) => {
      state.categoriesLoading = false;
      if (action.payload.success) {
        state.categories = action.payload.data;
      }
    }).addCase(getFAQCategories.rejected, (state, action) => {
      var _a;
      state.categoriesLoading = false;
      state.categoriesError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch categories";
    });
    builder.addCase(searchFAQs.pending, (state) => {
      state.searchLoading = true;
      state.searchError = null;
    }).addCase(searchFAQs.fulfilled, (state, action) => {
      state.searchLoading = false;
      if (action.payload.success) {
        state.searchResults = action.payload.data;
      }
    }).addCase(searchFAQs.rejected, (state, action) => {
      var _a;
      state.searchLoading = false;
      state.searchError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to search FAQs";
    });
    builder.addCase(getFAQById.pending, (state) => {
      state.currentLoading = true;
      state.currentError = null;
    }).addCase(getFAQById.fulfilled, (state, action) => {
      state.currentLoading = false;
      if (action.payload.success) {
        state.currentFAQ = action.payload.data;
      }
    }).addCase(getFAQById.rejected, (state, action) => {
      var _a;
      state.currentLoading = false;
      state.currentError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to fetch FAQ";
    });
    builder.addCase(markFAQHelpful.pending, (state) => {
      state.feedbackLoading = true;
      state.feedbackError = null;
    }).addCase(markFAQHelpful.fulfilled, (state, action) => {
      state.feedbackLoading = false;
      const faqId = action.payload.id;
      const faqIndex = state.faqs.findIndex((f) => f._id === faqId);
      if (faqIndex !== -1 && action.payload.data) {
        state.faqs[faqIndex].helpfulCount = action.payload.data.helpfulCount;
        state.faqs[faqIndex].notHelpfulCount = action.payload.data.notHelpfulCount;
      }
    }).addCase(markFAQHelpful.rejected, (state, action) => {
      var _a;
      state.feedbackLoading = false;
      state.feedbackError = ((_a = action.payload) == null ? void 0 : _a.message) || "Failed to submit feedback";
    });
  }
});
const {
  resetFAQs,
  resetSearchResults,
  resetCurrentFAQ,
  clearAllErrors
} = faqSlice.actions;
const faqReducer = faqSlice.reducer;
const isSSR$1 = typeof window === "undefined";
const preloadedState = !isSSR$1 && window.__PRELOADED_STATE__ ? window.__PRELOADED_STATE__ : void 0;
if (!isSSR$1 && window.__PRELOADED_STATE__) {
  delete window.__PRELOADED_STATE__;
}
const makeStore = (preloadedState2 = {}) => {
  return configureStore({
    reducer: {
      auth: authReducer,
      booking: bookingReducer,
      seo: seoReducer,
      support: supportReducer,
      payment: paymentReducer,
      setting: settingReducer,
      cms: cmsReducer,
      language: languageReducer,
      faq: faqReducer
    },
    preloadedState: preloadedState2,
    // Inject server data here
    middleware: (getDefaultMiddleware) => getDefaultMiddleware({ serializableCheck: false })
  });
};
makeStore(preloadedState);
var DefaultContext = {
  color: void 0,
  size: void 0,
  className: void 0,
  style: void 0,
  attr: void 0
};
var IconContext = React__default.createContext && /* @__PURE__ */ React__default.createContext(DefaultContext);
var _excluded = ["attr", "size", "title"];
function _objectWithoutProperties(source, excluded) {
  if (source == null) return {};
  var target = _objectWithoutPropertiesLoose(source, excluded);
  var key, i;
  if (Object.getOwnPropertySymbols) {
    var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
    for (i = 0; i < sourceSymbolKeys.length; i++) {
      key = sourceSymbolKeys[i];
      if (excluded.indexOf(key) >= 0) continue;
      if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
      target[key] = source[key];
    }
  }
  return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
  if (source == null) return {};
  var target = {};
  for (var key in source) {
    if (Object.prototype.hasOwnProperty.call(source, key)) {
      if (excluded.indexOf(key) >= 0) continue;
      target[key] = source[key];
    }
  }
  return target;
}
function _extends() {
  _extends = Object.assign ? Object.assign.bind() : function(target) {
    for (var i = 1; i < arguments.length; i++) {
      var source = arguments[i];
      for (var key in source) {
        if (Object.prototype.hasOwnProperty.call(source, key)) {
          target[key] = source[key];
        }
      }
    }
    return target;
  };
  return _extends.apply(this, arguments);
}
function ownKeys(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    r && (o = o.filter(function(r2) {
      return Object.getOwnPropertyDescriptor(e, r2).enumerable;
    })), t.push.apply(t, o);
  }
  return t;
}
function _objectSpread(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = null != arguments[r] ? arguments[r] : {};
    r % 2 ? ownKeys(Object(t), true).forEach(function(r2) {
      _defineProperty(e, r2, t[r2]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
      Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
    });
  }
  return e;
}
function _defineProperty(obj, key, value) {
  key = _toPropertyKey(key);
  if (key in obj) {
    Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
  } else {
    obj[key] = value;
  }
  return obj;
}
function _toPropertyKey(t) {
  var i = _toPrimitive(t, "string");
  return "symbol" == typeof i ? i : i + "";
}
function _toPrimitive(t, r) {
  if ("object" != typeof t || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r);
    if ("object" != typeof i) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
function Tree2Element(tree) {
  return tree && tree.map((node, i) => /* @__PURE__ */ React__default.createElement(node.tag, _objectSpread({
    key: i
  }, node.attr), Tree2Element(node.child)));
}
function GenIcon(data) {
  return (props) => /* @__PURE__ */ React__default.createElement(IconBase, _extends({
    attr: _objectSpread({}, data.attr)
  }, props), Tree2Element(data.child));
}
function IconBase(props) {
  var elem = (conf) => {
    var {
      attr,
      size,
      title
    } = props, svgProps = _objectWithoutProperties(props, _excluded);
    var computedSize = size || conf.size || "1em";
    var className;
    if (conf.className) className = conf.className;
    if (props.className) className = (className ? className + " " : "") + props.className;
    return /* @__PURE__ */ React__default.createElement("svg", _extends({
      stroke: "currentColor",
      fill: "currentColor",
      strokeWidth: "0"
    }, conf.attr, attr, svgProps, {
      className,
      style: _objectSpread(_objectSpread({
        color: props.color || conf.color
      }, conf.style), props.style),
      height: computedSize,
      width: computedSize,
      xmlns: "http://www.w3.org/2000/svg"
    }), title && /* @__PURE__ */ React__default.createElement("title", null, title), props.children);
  };
  return IconContext !== void 0 ? /* @__PURE__ */ React__default.createElement(IconContext.Consumer, null, (conf) => elem(conf)) : elem(DefaultContext);
}
const Logo = "/assets/Logo-YbfM7pvu.png";
const Navbar = () => {
  var _a, _b;
  const { t } = useTranslation();
  const [isOpen, setIsOpen] = useState(false);
  const [isLoginOpen, setIsLoginOpen] = useState(false);
  const [showLoginDropdown, setShowLoginDropdown] = useState(false);
  const [loginStep, setLoginStep] = useState("phone");
  const [phoneNumber, setPhoneNumber] = useState("");
  const [otp, setOtp] = useState(["", "", "", "", "", ""]);
  const [countdown, setCountdown] = useState(23);
  const dispatch = useDispatch();
  const { isAuthenticated: isLoggedIn, loading, error, user } = useSelector((state) => state.auth);
  const [showProfileMenu, setShowProfileMenu] = useState(false);
  const otpInputs = useRef([]);
  const navigate = distExports.useNavigate();
  const [showAutoPopup, setShowAutoPopup] = useState(true);
  const profileMenuRef = useRef(null);
  const [intendedRoute, setIntendedRoute] = useState(null);
  const [showMyTripsTooltip, setShowMyTripsTooltip] = useState(false);
  useEffect(() => {
    const handleClickOutside = (event) => {
      if (profileMenuRef.current && !profileMenuRef.current.contains(event.target)) {
        setShowProfileMenu(false);
      }
    };
    if (showProfileMenu) {
      document.addEventListener("mousedown", handleClickOutside);
    }
    return () => {
      document.removeEventListener("mousedown", handleClickOutside);
    };
  }, [showProfileMenu]);
  const handlePhoneSubmit = async () => {
    if (phoneNumber.length >= 10) {
      try {
        await dispatch(sendOtp({ identifier: "+91" + phoneNumber, type: "phone" })).unwrap();
        setLoginStep("otp");
        setCountdown(23);
        setTimeout(() => {
          if (otpInputs.current[0]) {
            otpInputs.current[0].focus();
          }
        }, 100);
      } catch (err) {
        console.error("Failed to send OTP:", err);
      }
    }
  };
  useEffect(() => {
    let timer;
    if (loginStep === "otp" && countdown > 0) {
      timer = setInterval(() => setCountdown((prev) => prev - 1), 1e3);
    }
    return () => clearInterval(timer);
  }, [loginStep, countdown]);
  const handleResendOtp = async () => {
    try {
      await dispatch(sendOtp({ identifier: "+91" + phoneNumber, type: "phone" })).unwrap();
      setCountdown(23);
    } catch (err) {
      console.error("Failed to resend OTP:", err);
    }
  };
  const resetModal = () => {
    setIsLoginOpen(false);
    setLoginStep("phone");
    setPhoneNumber("");
    setOtp(["", "", "", "", "", ""]);
    setCountdown(23);
  };
  const handleVerify = async () => {
    if (otp.join("").length === 6) {
      try {
        await dispatch(login({ phone: "+91" + phoneNumber, otp: otp.join("") })).unwrap();
        resetModal();
        if (intendedRoute) {
          navigate(intendedRoute);
          setIntendedRoute(null);
        } else {
          navigate("/profile");
        }
      } catch (err) {
        console.error("Login failed:", err);
      }
    }
  };
  useEffect(() => {
    const timer = setTimeout(() => {
      setShowAutoPopup(false);
    }, 5e3);
    return () => clearTimeout(timer);
  }, []);
  const { settings } = useSelector((state) => state.setting || {});
  const { socialConfig } = useSelector((state) => state.auth);
  const logoUrl = ((_a = settings == null ? void 0 : settings.design) == null ? void 0 : _a.logo) || (!Logo.startsWith("http") && !Logo.startsWith("data:") ? Logo.startsWith("/") ? Logo : `/${Logo}` : Logo);
  const handleGoogleSuccess = async (credentialResponse) => {
    try {
      await dispatch(loginWithGoogle({ token: credentialResponse.credential })).unwrap();
      resetModal();
      if (intendedRoute) {
        navigate(intendedRoute);
        setIntendedRoute(null);
      } else {
        navigate("/profile");
      }
    } catch (err) {
      console.error("Google login failed:", err);
    }
  };
  const handleGoogleError = () => {
    toast.error("Google login failed. Please try again.");
  };
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx("nav", { className: "bg-white shadow-md fixed top-0 left-0 w-full h-[64px] z-50", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto flex items-center justify-between px-4 sm:px-6 py-3", children: [
      /* @__PURE__ */ jsx("div", { className: "flex items-center h-full", children: /* @__PURE__ */ jsx(distExports.Link, { to: "/", className: "flex items-center", children: /* @__PURE__ */ jsx("img", { src: logoUrl, alt: "Logo", className: "max-h-[52px] w-auto max-w-[200px] object-contain" }) }) }),
      /* @__PURE__ */ jsxs("div", { className: "hidden md:flex items-center space-x-8", children: [
        /* @__PURE__ */ jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => {
                if (isLoggedIn) navigate("/my-trips");
                else {
                  toast.error("Please login to view your trips");
                  setIntendedRoute("/my-trips");
                  setIsLoginOpen(true);
                }
              },
              onMouseEnter: () => setShowMyTripsTooltip(true),
              onMouseLeave: () => setShowMyTripsTooltip(false),
              className: "flex items-center space-x-2 text-gray-700 hover:text-orange-500",
              children: [
                /* @__PURE__ */ jsx(Briefcase, { size: 22, className: "text-gray-500" }),
                /* @__PURE__ */ jsxs("div", { className: "flex flex-col", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-600", children: t("nav.manageBooking", "Manage Booking") }),
                  /* @__PURE__ */ jsx("span", { className: "font-semibold text-base -mt-1 mr-11", children: t("nav.myTrips", "My Trips") })
                ] })
              ]
            }
          ),
          showMyTripsTooltip && /* @__PURE__ */ jsx("div", { className: "absolute top-16 left-1/2 -translate-x-1/2 w-80 p-4 bg-white rounded-xl shadow-2xl border z-50", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
            /* @__PURE__ */ jsx("div", { className: "w-3 h-3 bg-green-500 rounded-full mt-1" }),
            /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700", children: "Access your bookings, easy cancellation, date change and much more." })
          ] }) })
        ] }),
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: () => navigate("/support"),
            className: "flex items-center space-x-2 text-gray-700 hover:text-orange-500",
            children: [
              /* @__PURE__ */ jsx(Headphones, { size: 20, className: "text-gray-500" }),
              /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: t("nav.support", "Support") })
            ]
          }
        ),
        isLoggedIn && /* @__PURE__ */ jsxs(
          "div",
          {
            ref: profileMenuRef,
            className: "relative",
            children: [
              /* @__PURE__ */ jsxs(
                "button",
                {
                  onClick: () => setShowProfileMenu(!showProfileMenu),
                  className: "flex items-center space-x-2 text-gray-700 hover:text-orange-500",
                  children: [
                    /* @__PURE__ */ jsx("div", { className: "w-9 h-9 bg-red-500 rounded-full flex items-center justify-center text-white font-bold", children: (user == null ? void 0 : user.fullName) ? user.fullName.charAt(0).toUpperCase() : "U" }),
                    /* @__PURE__ */ jsx("span", { className: "font-medium text-sm", children: (user == null ? void 0 : user.fullName) || "User" })
                  ]
                }
              ),
              showProfileMenu && /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-full mt-2 w-64 bg-white shadow-2xl rounded-xl border z-50 overflow-hidden", children: [
                /* @__PURE__ */ jsx("div", { className: "bg-gradient-to-r from-blue-500 to-blue-600 p-4 text-white", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
                  /* @__PURE__ */ jsx("div", { className: "w-12 h-12 bg-white rounded-full flex items-center justify-center text-blue-600 font-bold text-lg", children: (user == null ? void 0 : user.fullName) ? user.fullName.charAt(0).toUpperCase() : "U" }),
                  /* @__PURE__ */ jsxs("div", { children: [
                    /* @__PURE__ */ jsx("p", { className: "font-semibold text-base", children: (user == null ? void 0 : user.fullName) || "User" }),
                    /* @__PURE__ */ jsx("p", { className: "text-xs opacity-90", children: (user == null ? void 0 : user.phone) || (user == null ? void 0 : user.email) || "Welcome" })
                  ] })
                ] }) }),
                /* @__PURE__ */ jsxs("div", { className: "py-2", children: [
                  /* @__PURE__ */ jsxs(
                    "button",
                    {
                      onClick: () => {
                        navigate("/profile");
                        setShowProfileMenu(false);
                      },
                      className: "w-full px-4 py-3 text-left hover:bg-gray-50 flex items-center gap-3 transition",
                      children: [
                        /* @__PURE__ */ jsx(User, { size: 18, className: "text-gray-600" }),
                        /* @__PURE__ */ jsxs("div", { children: [
                          /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-800", children: "My Profile" }),
                          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "View and edit profile" })
                        ] })
                      ]
                    }
                  ),
                  /* @__PURE__ */ jsx("div", { className: "border-t my-2" }),
                  /* @__PURE__ */ jsxs(
                    "button",
                    {
                      onClick: async () => {
                        setShowProfileMenu(false);
                        try {
                          await dispatch(logoutUser()).unwrap();
                          navigate("/");
                        } catch (err) {
                          console.error("Logout error:", err);
                          navigate("/");
                        }
                      },
                      className: "w-full px-4 py-3 text-left hover:bg-red-50 flex items-center gap-3 transition text-red-600",
                      children: [
                        /* @__PURE__ */ jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
                          /* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
                          /* @__PURE__ */ jsx("polyline", { points: "16 17 21 12 16 7" }),
                          /* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
                        ] }),
                        /* @__PURE__ */ jsxs("div", { children: [
                          /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: "Logout" }),
                          /* @__PURE__ */ jsx("p", { className: "text-xs opacity-75", children: "Sign out of account" })
                        ] })
                      ]
                    }
                  )
                ] })
              ] })
            ]
          }
        ),
        !isLoggedIn ? /* @__PURE__ */ jsxs(
          "div",
          {
            className: "relative",
            onMouseEnter: () => setShowLoginDropdown(true),
            onMouseLeave: () => setShowLoginDropdown(false),
            children: [
              /* @__PURE__ */ jsxs(
                "button",
                {
                  onClick: () => {
                    setIntendedRoute("/profile");
                    setIsLoginOpen(true);
                  },
                  className: "flex items-center space-x-2 px-3 py-2 mr-6 border border-blue-500 text-blue-500 rounded-md font-medium hover:bg-blue-500 hover:text-white transition",
                  children: [
                    /* @__PURE__ */ jsx(User, { size: 18 }),
                    /* @__PURE__ */ jsx("span", { children: t("nav.loginSignup", "Login / Signup") })
                  ]
                }
              ),
              showLoginDropdown && /* @__PURE__ */ jsxs("div", { className: "absolute right-0 top-full mt-0 w-80 bg-white shadow-2xl rounded-2xl p-5 border z-50", children: [
                /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold text-gray-900", children: "Hey Traveller" }),
                /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1 mb-4", children: "Get exclusive deals & Manage your trips" }),
                /* @__PURE__ */ jsx(
                  "button",
                  {
                    onClick: () => {
                      setIntendedRoute("/profile");
                      setIsLoginOpen(true);
                    },
                    className: "w-full bg-blue-600 text-white py-2.5 rounded-lg font-semibold hover:bg-blue-700 mb-4",
                    children: "Login/Sign Up"
                  }
                ),
                /* @__PURE__ */ jsxs("ul", { className: "space-y-4", children: [
                  /* @__PURE__ */ jsxs("li", { className: "flex gap-3 cursor-pointer", children: [
                    /* @__PURE__ */ jsx(Tag, { size: 18, className: "text-gray-500" }),
                    /* @__PURE__ */ jsxs("div", { children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-gray-600", children: "Offers" }),
                      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 -mt-0.5", children: "Handpicked best deals" })
                    ] })
                  ] }),
                  /* @__PURE__ */ jsxs("li", { className: "flex gap-3 cursor-pointer", children: [
                    /* @__PURE__ */ jsx(Briefcase, { size: 18, className: "text-gray-500" }),
                    /* @__PURE__ */ jsxs("div", { children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-gray-700 ", children: "My Trips" }),
                      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 -mt-0.5", children: "Manage your bookings" })
                    ] })
                  ] }),
                  /* @__PURE__ */ jsxs("li", { className: "flex gap-3 cursor-pointer", children: [
                    /* @__PURE__ */ jsx(Gift, { size: 18, className: "text-gray-500" }),
                    /* @__PURE__ */ jsxs("div", { children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold text-gray-700", children: "Gift Cards" }),
                      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 -mt-0.5", children: "Claim your gift cards" })
                    ] })
                  ] })
                ] })
              ] })
            ]
          }
        ) : null
      ] }),
      /* @__PURE__ */ jsx("div", { className: "md:hidden", children: /* @__PURE__ */ jsx("button", { onClick: () => setIsOpen(!isOpen), children: isOpen ? /* @__PURE__ */ jsx(X, { size: 26 }) : /* @__PURE__ */ jsx(Menu, { size: 26 }) }) })
    ] }) }),
    showAutoPopup && !isLoggedIn && /* @__PURE__ */ jsxs("div", { className: "fixed top-16 right-44 bg-white shadow-2xl rounded-2xl p-4 w-64 z-[9999] border", children: [
      /* @__PURE__ */ jsx(
        "div",
        {
          className: "w-full bg-blue-600 text-white text-center py-2 rounded-lg font-semibold text-sm",
          onClick: () => {
            setIsLoginOpen(true);
            setShowAutoPopup(false);
          },
          children: "LOGIN/SIGNUP"
        }
      ),
      /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 bg-green-50 mt-3 p-3 rounded-lg", children: [
        /* @__PURE__ */ jsx(
          "img",
          {
            src: "https://img.icons8.com/color/48/gift.png",
            alt: "gift",
            className: "w-8 h-8"
          }
        ),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "font-semibold text-green-700 text-sm", children: "Upto 10% OFF*" }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600 -mt-0.5", children: "on your first Cab booking" })
        ] })
      ] })
    ] }),
    isLoginOpen && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 flex items-center justify-center bg-black bg-opacity-50 z-50", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center space-x-0", children: [
      /* @__PURE__ */ jsxs("div", { className: "hidden md:flex flex-col justify-between w-[40%] h-[420px] p-8 text-white bg-gradient-to-b from-[#c1d3ff] via-[#faf0ff] to-[#eaf3f3] rounded-2xl shadow-xl relative left-6", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("h3", { className: "text-xs font-semibold mb-6 tracking-wider text-black", children: "UNLOCK THESE BENEFITS" }),
          /* @__PURE__ */ jsxs("ul", { className: "space-y-6 text-sm", children: [
            /* @__PURE__ */ jsxs("li", { className: "flex items-start space-x-3", children: [
              /* @__PURE__ */ jsx(
                "img",
                {
                  src: "https://img.icons8.com/color/48/000000/money-bag.png",
                  alt: "",
                  className: "w-7 h-7"
                }
              ),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("p", { className: "font-semibold text-lg text-black", children: "Earn goCash" }),
                /* @__PURE__ */ jsx("p", { className: "opacity-90 text-black", children: "Earn 100 goCash on Sign Up & Cashback on Bookings" })
              ] })
            ] }),
            /* @__PURE__ */ jsxs("li", { className: "flex items-start space-x-3", children: [
              /* @__PURE__ */ jsx(
                "img",
                {
                  src: "https://img.icons8.com/color/48/000000/loyalty-card.png",
                  alt: "",
                  className: "w-7 h-7"
                }
              ),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("p", { className: "font-semibold text-lg text-black", children: "Loyalty Benefits" }),
                /* @__PURE__ */ jsx("p", { className: "opacity-90 text-black", children: "Extra Discounts, Free Seat Selection etc." })
              ] })
            ] }),
            /* @__PURE__ */ jsxs("li", { className: "flex items-start space-x-3", children: [
              /* @__PURE__ */ jsx(
                "img",
                {
                  src: "https://img.icons8.com/color/48/000000/gift.png",
                  alt: "",
                  className: "w-7 h-7"
                }
              ),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("p", { className: "font-semibold text-lg text-black", children: "Exclusive Offers" }),
                /* @__PURE__ */ jsx("p", { className: "opacity-90 text-black", children: "Daily Steal Deals & Special Discounts" })
              ] })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "mt-8 bg-white rounded-lg shadow p-4 text-left", children: [
          /* @__PURE__ */ jsx("p", { className: "font-bold text-indigo-600 text-sm", children: "Upto 10% OFF*" }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "on your first Cab booking" })
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "w-[40%] h-[460px] bg-white p-8 relative rounded-2xl shadow-xl", children: [
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: resetModal,
            className: "absolute top-4 right-4 text-gray-500 hover:text-black",
            children: "X"
          }
        ),
        loginStep === "phone" && /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold mb-6 text-black", children: "Login/Signup" }),
          /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium mb-2 text-green-600", children: "Enter your Mobile Number" }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center border-2 border-green-500 rounded-lg px-3 py-2 mb-4", children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://flagcdn.com/w20/in.png",
                alt: "India",
                className: "w-5 h-5 mr-2"
              }
            ),
            /* @__PURE__ */ jsx("span", { className: "mr-2 text-black", children: "+91" }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "text",
                value: phoneNumber,
                onChange: (e) => {
                  const value = e.target.value.replace(/\D/g, "");
                  if (value.length <= 10) setPhoneNumber(value);
                },
                maxLength: 10,
                className: "flex-1 outline-none text-black font-bold",
                placeholder: "0000**0000"
              }
            ),
            phoneNumber.length === 10 && /* @__PURE__ */ jsx("span", { className: "text-green-600 font-bold text-lg", children: /* @__PURE__ */ jsx(Verified, {}) })
          ] }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: handlePhoneSubmit,
              className: "w-full bg-orange-500 text-white py-3 rounded-md font-semibold mt-8",
              disabled: phoneNumber.length < 10,
              children: "Continue"
            }
          ),
          ((_b = socialConfig == null ? void 0 : socialConfig.google) == null ? void 0 : _b.enabled) && /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 my-4", children: [
              /* @__PURE__ */ jsx("div", { className: "flex-1 h-px bg-gray-300" }),
              /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500 font-medium", children: "OR" }),
              /* @__PURE__ */ jsx("div", { className: "flex-1 h-px bg-gray-300" })
            ] }),
            /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsx(
              GoogleLogin,
              {
                onSuccess: handleGoogleSuccess,
                onError: handleGoogleError,
                useOneTap: false,
                theme: "outline",
                size: "large",
                text: "signin_with",
                shape: "rectangular",
                width: "100%"
              }
            ) })
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-700 mt-8", children: [
            "By proceeding, you agree to EasyRide's",
            " ",
            /* @__PURE__ */ jsx("a", { href: "#", className: "text-blue-500 underline", children: "Privacy Policy" }),
            ",",
            " ",
            /* @__PURE__ */ jsx("a", { href: "#", className: "text-blue-500 underline", children: "User Agreement" }),
            " ",
            "and",
            " ",
            /* @__PURE__ */ jsx("a", { href: "#", className: "text-blue-500 underline", children: "Terms of Service" }),
            "."
          ] }),
          /* @__PURE__ */ jsx("div", { className: "mt-6 text-center border-t pt-4", children: /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium text-gray-600", children: [
            "New to EasyRide?",
            /* @__PURE__ */ jsx(
              "span",
              {
                className: "text-orange-600 font-bold ml-1 cursor-pointer hover:underline",
                onClick: () => {
                  resetModal();
                  navigate("/register");
                },
                children: "Create an Account"
              }
            )
          ] }) })
        ] }),
        loginStep === "otp" && /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold mb-4 text-black", children: "Verify OTP" }),
          /* @__PURE__ */ jsxs("p", { className: "mb-3 text-sm text-black", children: [
            "Enter 6 digit OTP sent to",
            " ",
            /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
              "+91-",
              phoneNumber
            ] }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "ml-2 text-blue-500 hover:underline text-xs",
                onClick: () => setLoginStep("phone"),
                children: "Edit"
              }
            )
          ] }),
          /* @__PURE__ */ jsx("div", { className: "flex space-x-2 justify-center mb-6 text-black", children: otp.map((digit, i) => /* @__PURE__ */ jsx(
            "input",
            {
              ref: (el) => otpInputs.current[i] = el,
              type: "text",
              maxLength: 1,
              value: digit,
              onChange: (e) => {
                const val = e.target.value;
                if (/^[0-9]$/.test(val) || val === "") {
                  const newOtp = [...otp];
                  newOtp[i] = val;
                  setOtp(newOtp);
                  if (val !== "" && i < 5) {
                    otpInputs.current[i + 1].focus();
                  }
                }
              },
              onKeyDown: (e) => {
                if (e.key === "Backspace" && !otp[i] && i > 0) {
                  otpInputs.current[i - 1].focus();
                }
              },
              className: "w-10 h-10 md:w-12 md:h-12 text-center border-2 border-blue-400 rounded-md text-lg font-semibold focus:border-blue-500 focus:ring-1 focus:ring-blue-500 outline-none"
            },
            i
          )) }),
          /* @__PURE__ */ jsxs("div", { className: "text-sm mb-4 text-gray-700", children: [
            "Didn't get the OTP?",
            " ",
            countdown > 0 ? /* @__PURE__ */ jsxs("span", { children: [
              "Resend in",
              " ",
              /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
                "00:",
                countdown.toString().padStart(2, "0")
              ] })
            ] }) : /* @__PURE__ */ jsx("span", { className: "font-semibold text-green-600", children: "You can resend now" })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex gap-3 mb-5", children: [
            /* @__PURE__ */ jsxs(
              "button",
              {
                className: `flex items-center gap-2 px-4 py-2 text-sm border rounded-md ${countdown > 0 ? "text-gray-400 border-gray-300 cursor-not-allowed" : "text-green-600 border-green-500 hover:bg-green-50"}`,
                disabled: countdown > 0,
                children: [
                  /* @__PURE__ */ jsx(
                    "img",
                    {
                      src: "https://img.icons8.com/color/20/whatsapp.png",
                      alt: "WhatsApp"
                    }
                  ),
                  "WhatsApp"
                ]
              }
            ),
            /* @__PURE__ */ jsxs(
              "button",
              {
                onClick: handleResendOtp,
                className: `flex items-center gap-2 px-4 py-2 text-sm border rounded-md ${countdown > 0 ? "text-gray-400 border-gray-300 cursor-not-allowed" : "text-blue-600 border-blue-500 hover:bg-blue-50"}`,
                disabled: countdown > 0,
                children: [
                  /* @__PURE__ */ jsx(
                    "img",
                    {
                      src: "https://img.icons8.com/ios-filled/20/1E90FF/sms.png",
                      alt: "SMS"
                    }
                  ),
                  "SMS"
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: handleVerify,
              className: "w-full bg-green-500 hover:bg-green-600 text-white py-3 rounded-md font-semibold mb-4",
              children: "Verify & Login"
            }
          ),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-800 text-center", children: "I agree to receive critical messages such as OTP, booking details on WhatsApp." })
        ] })
      ] })
    ] }) })
  ] });
};
const Footer = () => {
  useDispatch();
  const { footer: footer2 } = useSelector((state) => state.cms);
  return /* @__PURE__ */ jsx("div", { className: "bg-white py-10", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 md:px-12 lg:px-20", children: [
    /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-8 mb-12 text-center sm:text-left", children: footer2.map((section) => /* @__PURE__ */ jsxs("div", { children: [
      /* @__PURE__ */ jsx("h3", { className: "text-black font-semibold text-base mb-4", children: section.title }),
      /* @__PURE__ */ jsx("div", { className: "space-y-2", children: section.links.map((link, index) => link.url.startsWith("http") ? /* @__PURE__ */ jsx(
        "a",
        {
          href: link.url,
          className: "block text-gray-600 text-sm hover:text-gray-800",
          target: "_blank",
          rel: "noopener noreferrer",
          children: link.label
        },
        index
      ) : /* @__PURE__ */ jsx(
        distExports.Link,
        {
          to: link.url,
          className: "block text-gray-600 text-sm hover:text-gray-800",
          children: link.label
        },
        index
      )) })
    ] }, section._id || section.order)) }),
    /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row justify-between items-center pt-6 border-t border-gray-200 gap-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex flex-col sm:flex-row items-center sm:space-x-4 space-y-3 sm:space-y-0", children: [
        /* @__PURE__ */ jsx("span", { className: "text-black font-medium text-sm", children: "FOLLOW US ON" }),
        /* @__PURE__ */ jsxs("div", { className: "flex space-x-3", children: [
          /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-black rounded-full flex items-center justify-center cursor-pointer hover:bg-gray-700 transition", children: /* @__PURE__ */ jsx("span", { className: "text-white text-sm font-bold", children: "f" }) }),
          /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-black rounded-full flex items-center justify-center cursor-pointer hover:bg-gray-700 transition", children: /* @__PURE__ */ jsx("span", { className: "text-white text-sm font-bold", children: "t" }) }),
          /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-black rounded-full flex items-center justify-center cursor-pointer hover:bg-gray-700 transition", children: /* @__PURE__ */ jsx("span", { className: "text-white text-sm font-bold", children: "▶" }) })
        ] })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "text-center sm:text-right", children: /* @__PURE__ */ jsxs("span", { className: "text-black text-sm", children: [
        "© ",
        (/* @__PURE__ */ new Date()).getFullYear(),
        " Easy Ride"
      ] }) })
    ] })
  ] }) });
};
function FaWhatsapp(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z" }, "child": [] }] })(props);
}
function FaArrowDown(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M413.1 222.5l22.2 22.2c9.4 9.4 9.4 24.6 0 33.9L241 473c-9.4 9.4-24.6 9.4-33.9 0L12.7 278.6c-9.4-9.4-9.4-24.6 0-33.9l22.2-22.2c9.5-9.5 25-9.3 34.3.4L184 343.4V56c0-13.3 10.7-24 24-24h32c13.3 0 24 10.7 24 24v287.4l114.8-120.5c9.3-9.8 24.8-10 34.3-.4z" }, "child": [] }] })(props);
}
function FaArrowRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 448 512" }, "child": [{ "tag": "path", "attr": { "d": "M190.5 66.9l22.2-22.2c9.4-9.4 24.6-9.4 33.9 0L441 239c9.4 9.4 9.4 24.6 0 33.9L246.6 467.3c-9.4 9.4-24.6 9.4-33.9 0l-22.2-22.2c-9.5-9.5-9.3-25 .4-34.3L311.4 296H24c-13.3 0-24-10.7-24-24v-32c0-13.3 10.7-24 24-24h287.4L190.9 101.2c-9.8-9.3-10-24.8-.4-34.3z" }, "child": [] }] })(props);
}
function FaCarSide(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 640 512" }, "child": [{ "tag": "path", "attr": { "d": "M544 192h-16L419.22 56.02A64.025 64.025 0 0 0 369.24 32H155.33c-26.17 0-49.7 15.93-59.42 40.23L48 194.26C20.44 201.4 0 226.21 0 256v112c0 8.84 7.16 16 16 16h48c0 53.02 42.98 96 96 96s96-42.98 96-96h128c0 53.02 42.98 96 96 96s96-42.98 96-96h48c8.84 0 16-7.16 16-16v-80c0-53.02-42.98-96-96-96zM160 432c-26.47 0-48-21.53-48-48s21.53-48 48-48 48 21.53 48 48-21.53 48-48 48zm72-240H116.93l38.4-96H232v96zm48 0V96h89.24l76.8 96H280zm200 240c-26.47 0-48-21.53-48-48s21.53-48 48-48 48 21.53 48 48-21.53 48-48 48z" }, "child": [] }] })(props);
}
function FaChevronLeft(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 320 512" }, "child": [{ "tag": "path", "attr": { "d": "M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z" }, "child": [] }] })(props);
}
function FaChevronRight(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 320 512" }, "child": [{ "tag": "path", "attr": { "d": "M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z" }, "child": [] }] })(props);
}
function FaClock(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M256,8C119,8,8,119,8,256S119,504,256,504,504,393,504,256,393,8,256,8Zm92.49,313h0l-20,25a16,16,0,0,1-22.49,2.5h0l-67-49.72a40,40,0,0,1-15-31.23V112a16,16,0,0,1,16-16h32a16,16,0,0,1,16,16V256l58,42.5A16,16,0,0,1,348.49,321Z" }, "child": [] }] })(props);
}
function FaLocationArrow(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M444.52 3.52L28.74 195.42c-47.97 22.39-31.98 92.75 19.19 92.75h175.91v175.91c0 51.17 70.36 67.17 92.75 19.19l191.9-415.78c15.99-38.39-25.59-79.97-63.97-63.97z" }, "child": [] }] })(props);
}
function FaPhoneAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M497.39 361.8l-112-48a24 24 0 0 0-28 6.9l-49.6 60.6A370.66 370.66 0 0 1 130.6 204.11l60.6-49.6a23.94 23.94 0 0 0 6.9-28l-48-112A24.16 24.16 0 0 0 122.6.61l-104 24A24 24 0 0 0 0 48c0 256.5 207.9 464 464 464a24 24 0 0 0 23.4-18.6l24-104a24.29 24.29 0 0 0-14.01-27.6z" }, "child": [] }] })(props);
}
function FaSearch(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z" }, "child": [] }] })(props);
}
function FaShieldAlt(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M466.5 83.7l-192-80a48.15 48.15 0 0 0-36.9 0l-192 80C27.7 91.1 16 108.6 16 128c0 198.5 114.5 335.7 221.5 380.3 11.8 4.9 25.1 4.9 36.9 0C360.1 472.6 496 349.3 496 128c0-19.4-11.7-36.9-29.5-44.3zM256.1 446.3l-.1-381 175.9 73.3c-3.3 151.4-82.1 261.1-175.8 307.7z" }, "child": [] }] })(props);
}
function FaStar(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z" }, "child": [] }] })(props);
}
function FaThumbsUp(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 512 512" }, "child": [{ "tag": "path", "attr": { "d": "M104 224H24c-13.255 0-24 10.745-24 24v240c0 13.255 10.745 24 24 24h80c13.255 0 24-10.745 24-24V248c0-13.255-10.745-24-24-24zM64 472c-13.255 0-24-10.745-24-24s10.745-24 24-24 24 10.745 24 24-10.745 24-24 24zM384 81.452c0 42.416-25.97 66.208-33.277 94.548h101.723c33.397 0 59.397 27.746 59.553 58.098.084 17.938-7.546 37.249-19.439 49.197l-.11.11c9.836 23.337 8.237 56.037-9.308 79.469 8.681 25.895-.069 57.704-16.382 74.757 4.298 17.598 2.244 32.575-6.148 44.632C440.202 511.587 389.616 512 346.839 512l-2.845-.001c-48.287-.017-87.806-17.598-119.56-31.725-15.957-7.099-36.821-15.887-52.651-16.178-6.54-.12-11.783-5.457-11.783-11.998v-213.77c0-3.2 1.282-6.271 3.558-8.521 39.614-39.144 56.648-80.587 89.117-113.111 14.804-14.832 20.188-37.236 25.393-58.902C282.515 39.293 291.817 0 312 0c24 0 72 8 72 81.452z" }, "child": [] }] })(props);
}
function FaTimes(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 352 512" }, "child": [{ "tag": "path", "attr": { "d": "M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z" }, "child": [] }] })(props);
}
function FaTrophy(props) {
  return GenIcon({ "attr": { "viewBox": "0 0 576 512" }, "child": [{ "tag": "path", "attr": { "d": "M552 64H448V24c0-13.3-10.7-24-24-24H152c-13.3 0-24 10.7-24 24v40H24C10.7 64 0 74.7 0 88v56c0 35.7 22.5 72.4 61.9 100.7 31.5 22.7 69.8 37.1 110 41.7C203.3 338.5 240 360 240 360v72h-48c-35.3 0-64 20.7-64 56v12c0 6.6 5.4 12 12 12h296c6.6 0 12-5.4 12-12v-12c0-35.3-28.7-56-64-56h-48v-72s36.7-21.5 68.1-73.6c40.3-4.6 78.6-19 110-41.7 39.3-28.3 61.9-65 61.9-100.7V88c0-13.3-10.7-24-24-24zM99.3 192.8C74.9 175.2 64 155.6 64 144v-16h64.2c1 32.6 5.8 61.2 12.8 86.2-15.1-5.2-29.2-12.4-41.7-21.4zM512 144c0 16.1-17.7 36.1-35.3 48.8-12.5 9-26.7 16.2-41.8 21.4 7-25 11.8-53.6 12.8-86.2H512v16z" }, "child": [] }] })(props);
}
const geocodeLocation = async (locationName) => {
  if (!locationName) return null;
  const apiKey = "AIzaSyApScjr-d4tWLaUijMEzlnGSUIc46MlrZs";
  try {
    const response = await fetch(
      `https://maps.googleapis.com/maps/api/geocode/json?address=${encodeURIComponent(locationName)}&key=${apiKey}`
    );
    const data = await response.json();
    if (data.status === "OK" && data.results && data.results.length > 0) {
      const result = data.results[0];
      const { lat, lng } = result.geometry.location;
      console.log(`Geocoded "${locationName}" via Google Maps:`, result.formatted_address);
      return {
        lat,
        lng,
        displayName: result.formatted_address
      };
    } else {
      console.error("Google Maps Geocoding failed:", data.status, data.error_message || "");
    }
  } catch (error) {
    console.error("Google Maps API error:", error);
  }
  console.warn(`Geocoding failed for "${locationName}".`);
  return null;
};
const calculateDistance = (lat1, lon1, lat2, lon2) => {
  if (!lat1 || !lon1 || !lat2 || !lon2) return 0;
  const R = 6371;
  const dLat = (lat2 - lat1) * Math.PI / 180;
  const dLon = (lon2 - lon1) * Math.PI / 180;
  const a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.cos(lat1 * Math.PI / 180) * Math.cos(lat2 * Math.PI / 180) * Math.sin(dLon / 2) * Math.sin(dLon / 2);
  const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
  return Math.round(R * c);
};
const LocationAutocomplete = ({
  value,
  onChange,
  placeholder = "Enter location",
  label,
  className = "",
  onLocationSelect
}) => {
  const [suggestions, setSuggestions] = useState([]);
  const [showSuggestions, setShowSuggestions] = useState(false);
  const [loading, setLoading] = useState(false);
  const [recentSearches, setRecentSearches] = useState([]);
  const [gettingLocation, setGettingLocation] = useState(false);
  const wrapperRef = useRef(null);
  const autocompleteService = useRef(null);
  const placesService = useRef(null);
  const geocoder = useRef(null);
  useEffect(() => {
    if (window.google && window.google.maps) {
      autocompleteService.current = new window.google.maps.places.AutocompleteService();
      geocoder.current = new window.google.maps.Geocoder();
      const dummyDiv = document.createElement("div");
      placesService.current = new window.google.maps.places.PlacesService(dummyDiv);
    }
  }, []);
  useEffect(() => {
    const saved = localStorage.getItem("recentLocationSearches");
    if (saved) {
      try {
        setRecentSearches(JSON.parse(saved));
      } catch (e) {
        setRecentSearches([]);
      }
    }
  }, []);
  useEffect(() => {
    const handleClickOutside = (event) => {
      if (wrapperRef.current && !wrapperRef.current.contains(event.target)) {
        setShowSuggestions(false);
      }
    };
    document.addEventListener("mousedown", handleClickOutside);
    return () => document.removeEventListener("mousedown", handleClickOutside);
  }, []);
  const saveToRecent = (location) => {
    const newRecent = [
      location,
      ...recentSearches.filter((item) => item.display_name !== location.display_name)
    ].slice(0, 5);
    setRecentSearches(newRecent);
    localStorage.setItem("recentLocationSearches", JSON.stringify(newRecent));
  };
  const getCurrentLocation = () => {
    if (!navigator.geolocation) {
      alert("Geolocation is not supported by your browser");
      return;
    }
    setGettingLocation(true);
    navigator.geolocation.getCurrentPosition(
      async (position) => {
        const { latitude, longitude } = position.coords;
        if (!geocoder.current) {
          alert("Google Maps not loaded");
          setGettingLocation(false);
          return;
        }
        try {
          geocoder.current.geocode(
            { location: { lat: latitude, lng: longitude } },
            (results, status) => {
              setGettingLocation(false);
              if (status === "OK" && results[0]) {
                const locationData = {
                  display_name: results[0].formatted_address,
                  lat: latitude,
                  lon: longitude,
                  type: "current_location",
                  place_id: results[0].place_id
                };
                onChange(results[0].formatted_address);
                saveToRecent(locationData);
                setShowSuggestions(false);
              } else {
                alert("Could not get your location address");
              }
            }
          );
        } catch (error) {
          setGettingLocation(false);
          console.error("Error getting location name:", error);
          alert("Could not get your location address");
        }
      },
      (error) => {
        setGettingLocation(false);
        console.error("Error getting location:", error);
        alert("Could not access your location. Please enable location services.");
      },
      {
        enableHighAccuracy: true,
        timeout: 1e4,
        maximumAge: 0
      }
    );
  };
  const fetchSuggestions = async (query) => {
    if (!query || query.length < 2) {
      setSuggestions([]);
      return;
    }
    if (!autocompleteService.current) {
      console.error("Google Maps AutocompleteService not initialized");
      return;
    }
    setLoading(true);
    try {
      autocompleteService.current.getPlacePredictions(
        {
          input: query,
          componentRestrictions: { country: "in" },
          // Restrict to India
          types: ["geocode", "establishment"]
          // Include cities, addresses, and places
        },
        (predictions, status) => {
          setLoading(false);
          if (status === window.google.maps.places.PlacesServiceStatus.OK && predictions) {
            const formattedSuggestions = predictions.map((prediction) => ({
              display_name: prediction.description,
              place_id: prediction.place_id,
              main_text: prediction.structured_formatting.main_text,
              secondary_text: prediction.structured_formatting.secondary_text,
              types: prediction.types
            }));
            setSuggestions(formattedSuggestions);
            setShowSuggestions(true);
          } else {
            setSuggestions([]);
          }
        }
      );
    } catch (error) {
      setLoading(false);
      console.error("Error fetching suggestions:", error);
      setSuggestions([]);
    }
  };
  useEffect(() => {
    const timer = setTimeout(() => {
      if (value && value.length >= 2) {
        fetchSuggestions(value);
      }
    }, 300);
    return () => clearTimeout(timer);
  }, [value]);
  const handleSelect = (suggestion) => {
    onChange(suggestion.display_name);
    if (onLocationSelect) {
      onLocationSelect(suggestion.display_name);
    }
    if (placesService.current && suggestion.place_id) {
      placesService.current.getDetails(
        { placeId: suggestion.place_id },
        (place, status) => {
          if (status === window.google.maps.places.PlacesServiceStatus.OK && place) {
            const locationData = {
              display_name: suggestion.display_name,
              lat: place.geometry.location.lat(),
              lon: place.geometry.location.lng(),
              place_id: suggestion.place_id,
              types: suggestion.types
            };
            saveToRecent(locationData);
          }
        }
      );
    } else {
      saveToRecent(suggestion);
    }
    setShowSuggestions(false);
    setSuggestions([]);
  };
  const getLocationIcon = (types) => {
    if (!types) return "📍";
    if (types.includes("airport")) return "✈️";
    if (types.includes("locality") || types.includes("administrative_area_level_2")) return "🏙️";
    if (types.includes("train_station") || types.includes("transit_station")) return "🚉";
    if (types.includes("bus_station")) return "🚌";
    if (types.includes("point_of_interest")) return "📌";
    return "📍";
  };
  const handleFocus = () => {
    if (!value || value.length < 2) {
      if (recentSearches.length > 0) {
        setShowSuggestions(true);
      }
    } else if (suggestions.length > 0) {
      setShowSuggestions(true);
    }
  };
  const handleKeyDown = (e) => {
    if (e.key === "Enter") {
      e.preventDefault();
      if (showSuggestions && suggestions.length > 0) {
        handleSelect(suggestions[0]);
      } else {
        setShowSuggestions(false);
      }
    }
  };
  return /* @__PURE__ */ jsxs("div", { ref: wrapperRef, className: "relative", children: [
    label && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-1 ml-3", children: label }),
    /* @__PURE__ */ jsxs("div", { className: "relative", children: [
      /* @__PURE__ */ jsx(
        "input",
        {
          type: "text",
          placeholder,
          value,
          onChange: (e) => {
            onChange(e.target.value);
            if (e.target.value.length >= 2) {
              setShowSuggestions(true);
            }
          },
          onFocus: handleFocus,
          onKeyDown: handleKeyDown,
          className: `w-full text-base font-semibold p-3 pr-10 focus:outline-none border-b text-gray-900 placeholder-gray-500 ${className}`
        }
      ),
      loading && /* @__PURE__ */ jsx("div", { className: "absolute right-3 top-1/2 -translate-y-1/2", children: /* @__PURE__ */ jsx("div", { className: "animate-spin h-4 w-4 border-2 border-blue-500 border-t-transparent rounded-full" }) }),
      !loading && value && /* @__PURE__ */ jsx(FaSearch, { className: "absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 text-sm" })
    ] }),
    showSuggestions && /* @__PURE__ */ jsxs("div", { className: "absolute z-50 w-full mt-1 bg-white border border-gray-200 rounded-lg shadow-lg max-h-80 overflow-y-auto", children: [
      /* @__PURE__ */ jsxs(
        "div",
        {
          onClick: getCurrentLocation,
          className: "px-4 py-3 hover:bg-blue-50 cursor-pointer border-b border-gray-100 transition-colors flex items-center gap-3",
          children: [
            gettingLocation ? /* @__PURE__ */ jsx("div", { className: "animate-spin h-4 w-4 border-2 border-blue-500 border-t-transparent rounded-full" }) : /* @__PURE__ */ jsx(FaLocationArrow, { className: "text-blue-500 text-lg" }),
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsx("div", { className: "font-semibold text-blue-600 text-sm", children: gettingLocation ? "Getting your location..." : "Use Current Location" }),
              /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 mt-0.5", children: "GPS enabled location" })
            ] })
          ]
        }
      ),
      recentSearches.length > 0 && (!value || value.length < 2) && /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsx("div", { className: "px-4 py-2 bg-gray-50 border-b border-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "text-xs font-semibold text-gray-500 uppercase flex items-center gap-2", children: [
          /* @__PURE__ */ jsx(FaClock, { className: "text-gray-400" }),
          "Recent Searches"
        ] }) }),
        recentSearches.map((suggestion, index) => /* @__PURE__ */ jsx(
          "div",
          {
            onClick: () => handleSelect(suggestion),
            className: "px-4 py-3 hover:bg-gray-50 cursor-pointer border-b border-gray-100 last:border-b-0 transition-colors",
            children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
              /* @__PURE__ */ jsx("span", { className: "text-xl mt-0.5", children: suggestion.type === "current_location" ? "📍" : getLocationIcon(suggestion.types) }),
              /* @__PURE__ */ jsx("div", { className: "flex-1", children: /* @__PURE__ */ jsx("div", { className: "font-medium text-gray-900 text-sm line-clamp-1", children: suggestion.display_name }) })
            ] })
          },
          `recent-${index}`
        ))
      ] }),
      value && value.length >= 2 && suggestions.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
        recentSearches.length > 0 && /* @__PURE__ */ jsx("div", { className: "px-4 py-2 bg-gray-50 border-b border-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "text-xs font-semibold text-gray-500 uppercase flex items-center gap-2", children: [
          /* @__PURE__ */ jsx(FaSearch, { className: "text-gray-400" }),
          "Search Results"
        ] }) }),
        suggestions.map((suggestion, index) => /* @__PURE__ */ jsx(
          "div",
          {
            onClick: () => handleSelect(suggestion),
            className: "px-4 py-3 hover:bg-gray-50 cursor-pointer border-b border-gray-100 last:border-b-0 transition-colors",
            children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
              /* @__PURE__ */ jsx("span", { className: "text-xl mt-0.5", children: getLocationIcon(suggestion.types) }),
              /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
                /* @__PURE__ */ jsx("div", { className: "font-medium text-gray-900 text-sm", children: suggestion.main_text }),
                /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500 mt-0.5 line-clamp-1", children: suggestion.secondary_text })
              ] })
            ] })
          },
          `suggestion-${index}`
        ))
      ] }),
      value && value.length >= 2 && !loading && suggestions.length === 0 && /* @__PURE__ */ jsxs("div", { className: "p-4 text-center text-gray-500 text-sm", children: [
        'No locations found for "',
        value,
        '". Try a different search term.'
      ] })
    ] })
  ] });
};
const BACKEND_URL = API_BASE_URL$1.replace("/api/v1", "");
const iconMap = {
  trophy: FaTrophy,
  car: FaCarSide,
  shield: FaShieldAlt,
  star: FaStar,
  clock: FaClock,
  thumbsup: FaThumbsUp
};
const iconColorMap = {
  trophy: "text-yellow-500",
  car: "text-orange-500",
  shield: "text-green-500",
  star: "text-amber-500",
  clock: "text-blue-500",
  thumbsup: "text-indigo-500"
};
const HeroSection = ({ onSearch }) => {
  var _a, _b, _c, _d, _e;
  const { t } = useTranslation();
  const [tripType, setTripType] = useState("oneway");
  const [stops, setStops] = useState([]);
  const formatDate = (date) => {
    const d = new Date(date);
    const day = d.getDate();
    const months2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
    const month = months2[d.getMonth()];
    const year = d.getFullYear().toString().slice(-2);
    return `${day} ${month}' ${year}`;
  };
  const [pickupDate, setPickupDate] = useState(formatDate(/* @__PURE__ */ new Date()));
  const [pickupTime, setPickupTime] = useState("10:00 AM");
  const [returnDate, setReturnDate] = useState(formatDate(new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() + 1))));
  const [returnTime, setReturnTime] = useState("10:00 AM");
  const [from, setFrom] = useState("Bhopal, Madhya Pradesh, India");
  const [to, setTo] = useState("Ujjain mahakal mandir, Mahakal Lok Corridor Road, Bagamb...");
  const [selectedDuration, setSelectedDuration] = useState({ hours: 4, km: 40, label: "4hrs 40km" });
  const [expanded, setExpanded] = useState(false);
  const [showDatePicker, setShowDatePicker] = useState(false);
  const [showTimePicker, setShowTimePicker] = useState(false);
  const [selectedDateType, setSelectedDateType] = useState("");
  const [viewYear, setViewYear] = useState((/* @__PURE__ */ new Date()).getFullYear());
  const [viewMonth, setViewMonth] = useState((/* @__PURE__ */ new Date()).getMonth());
  const dispatch = useDispatch();
  const { banners } = useSelector((state) => state.cms);
  const { settings } = useSelector((state) => state.setting);
  const heroSection = (_a = settings == null ? void 0 : settings.design) == null ? void 0 : _a.heroSection;
  useEffect(() => {
    dispatch(getBanners());
  }, [dispatch]);
  const hourlyBanner = banners.find((b) => b.type === "hourly");
  const offerBanners = banners.filter((b) => b.type === "offer");
  const heroTitle = (heroSection == null ? void 0 : heroSection.heroTitle) || (tripType === "hourly" ? t("hero.hourlyCarRental") : tripType === "airport" ? t("hero.bookAirportTaxi") : t("hero.bookOnlineCab"));
  const promoBanner = ((_b = heroSection == null ? void 0 : heroSection.promoBanner) == null ? void 0 : _b.image) ? heroSection.promoBanner : hourlyBanner ? { image: hourlyBanner.imageUrl, title: hourlyBanner.title, description: hourlyBanner.description } : null;
  const adminOfferBanners = ((_c = heroSection == null ? void 0 : heroSection.offerBanners) == null ? void 0 : _c.length) > 0 ? heroSection.offerBanners : offerBanners.map((b) => ({ image: b.imageUrl, title: b.title, description: b.description }));
  const featureCards = ((_d = heroSection == null ? void 0 : heroSection.featureCards) == null ? void 0 : _d.length) > 0 ? heroSection.featureCards : [
    { icon: "trophy", text: t("hero.experiencedDrivers") },
    { icon: "car", text: t("hero.cleanCabs") }
  ];
  const [offerIndex, setOfferIndex] = useState(0);
  const visibleOffers = 2;
  const [featureIndex, setFeatureIndex] = useState(0);
  const visibleFeatures = 2;
  const cabInfoRef = useRef(null);
  const handleExploreClick = () => {
    cabInfoRef.current.scrollIntoView({ behavior: "smooth" });
  };
  const tripOptions = [
    { value: "oneway", label: t("tripTypes.oneway") },
    { value: "round", label: t("tripTypes.round") },
    { value: "airport", label: t("tripTypes.airport") },
    { value: "hourly", label: t("tripTypes.hourly") }
  ];
  const generateCalendarDays = (year, month) => {
    const firstDay = new Date(year, month, 1).getDay();
    const startDayIndex = (firstDay + 6) % 7;
    const daysInMonth = new Date(year, month + 1, 0).getDate();
    const days = [];
    for (let i = 0; i < startDayIndex; i++) {
      days.push({ day: "", otherMonth: true });
    }
    const today = /* @__PURE__ */ new Date();
    today.setHours(0, 0, 0, 0);
    for (let i = 1; i <= daysInMonth; i++) {
      const current = new Date(year, month, i);
      const isPast = current < today;
      days.push({ day: i, otherMonth: false, isPast });
    }
    return days;
  };
  const calendarDays = generateCalendarDays(viewYear, viewMonth);
  const monthsList = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
  const currentYearVal = (/* @__PURE__ */ new Date()).getFullYear();
  const yearsList = Array.from({ length: 6 }, (_, i) => currentYearVal + i);
  const generateTimeSlots = () => {
    const times = [];
    for (let hour = 0; hour < 24; hour++) {
      for (let minute = 0; minute < 60; minute += 15) {
        const period = hour >= 12 ? "PM" : "AM";
        const displayHour = hour % 12 || 12;
        const timeString = `${displayHour}:${minute.toString().padStart(2, "0")} ${period}`;
        times.push(timeString);
      }
    }
    return times;
  };
  const timeSlots = generateTimeSlots();
  const addStop = () => {
    setStops([...stops, { id: Date.now(), value: "" }]);
  };
  const removeStop = (id) => {
    setStops(stops.filter((stop) => stop.id !== id));
  };
  const handleStopChange = (id, newValue) => {
    setStops(
      stops.map(
        (stop) => stop.id === id ? { ...stop, value: newValue } : stop
      )
    );
  };
  const handleSwap = () => {
    setFrom((prevFrom) => {
      const oldFrom = prevFrom;
      setTo(oldFrom);
      return to;
    });
  };
  const handleDateSelect = (dayObj) => {
    if (dayObj && !dayObj.otherMonth && !dayObj.isPast) {
      const selectedDate = new Date(viewYear, viewMonth, dayObj.day);
      const formatted = formatDate(selectedDate);
      if (selectedDateType === "pickup") {
        setPickupDate(formatted);
      } else if (selectedDateType === "return") {
        setReturnDate(formatted);
      }
      setShowDatePicker(false);
    }
  };
  const handleTimeSelect = (time, type) => {
    if (type === "pickup") {
      setPickupTime(time);
    } else if (type === "return") {
      setReturnTime(time);
    }
    setShowTimePicker(false);
  };
  const openDatePicker = (type) => {
    setSelectedDateType(type);
    setShowDatePicker(true);
  };
  const openTimePicker = (type) => {
    setSelectedDateType(type);
    setShowTimePicker(true);
  };
  return /* @__PURE__ */ jsxs("section", { className: "w-full bg-[#eff3f8] pb-10 font-bold", children: [
    /* @__PURE__ */ jsxs("div", { className: "w-full h-80 bg-[#da6702] rounded-b-[80%] pt-8 px-4 md:px-36 text-black relative font-bold", children: [
      /* @__PURE__ */ jsx("h2", { className: "absolute text-white font-extrabold text-2xl ml-10", children: tripType === "hourly" ? t("hero.hourlyCarRental") : tripType === "airport" ? t("hero.bookAirportTaxi") : heroTitle }),
      /* @__PURE__ */ jsxs(
        "div",
        {
          className: "absolute top-1/2 left-1/2 -translate-x-1/2 \r\n                w-full max-w-7xl px-4 sm:px-6 \r\n                flex flex-col lg:flex-row gap-6 m-auto \r\n                justify-center font-bold",
          children: [
            /* @__PURE__ */ jsxs(
              "div",
              {
                className: "bg-white shadow-xl rounded-xl p-4 sm:p-6 \r\n                  w-full sm:w-[550px] -mt-20 border \r\n                  transform transition-all duration-300 \r\n                  hover:shadow-2xl hover:-translate-y-1 flex flex-col",
                children: [
                  /* @__PURE__ */ jsx("div", { className: "flex gap-6 mb-6 font-extrabold", children: tripOptions.map((option) => /* @__PURE__ */ jsxs(
                    "label",
                    {
                      className: "flex items-center gap-2 cursor-pointer",
                      children: [
                        /* @__PURE__ */ jsx(
                          "input",
                          {
                            type: "radio",
                            name: "tripType",
                            checked: tripType === option.value,
                            onChange: () => setTripType(option.value),
                            className: "text-blue-900 focus:ring-blue-900"
                          }
                        ),
                        /* @__PURE__ */ jsx(
                          "h3",
                          {
                            className: `text-lg sm:text-xl ${tripType === option.value ? "text-blue-600 font-bold" : "text-gray-700 font-bold"}`,
                            children: option.label
                          }
                        )
                      ]
                    },
                    option.value
                  )) }),
                  /* @__PURE__ */ jsxs("div", { className: "mb-3 relative", children: [
                    /* @__PURE__ */ jsx(
                      LocationAutocomplete,
                      {
                        value: from,
                        onChange: setFrom,
                        placeholder: t("hero.enterPickup"),
                        label: t("hero.from")
                      }
                    ),
                    tripType !== "hourly" && /* @__PURE__ */ jsx(
                      "button",
                      {
                        type: "button",
                        onClick: handleSwap,
                        className: "absolute right-3 top-9 rounded-full p-2 transition h-10 w-10 mt-2 z-10",
                        "aria-label": "Swap from and to",
                        children: /* @__PURE__ */ jsx(
                          "svg",
                          {
                            xmlns: "https://www.w3.org/2000/svg",
                            viewBox: "0 0 28 28",
                            fill: "#647a97",
                            width: "3.2rem",
                            height: "3.2rem",
                            className: "SwapIcon-sc-1lqocom-0 jykNmC",
                            children: /* @__PURE__ */ jsx(
                              "path",
                              {
                                d: "M28 14c0-7.732-6.268-14-14-14S0 6.268 0 14s6.268 14 14 14c7.729-.008 13.992-6.271 14-14zm-14.11-3.589c-.192.41-.604.672-1.057.672h-1.458a.292.292 0 00-.292.292v4.375a1.167 1.167 0 11-2.333 0v-4.375a.292.292 0 00-.292-.292H7a1.166 1.166 0 01-.896-1.913l2.917-3.5a1.166 1.166 0 011.793 0l2.916 3.5c.29.348.352.832.16 1.241zm.11 7.672c0-.644.522-1.166 1.167-1.166h1.458c.161 0 .292-.13.292-.292V12.25a1.167 1.167 0 112.333 0v4.375c0 .161.13.292.292.292H21a1.166 1.166 0 01.897 1.913l-2.916 3.5a1.168 1.168 0 01-1.794 0l-2.916-3.5a1.172 1.172 0 01-.271-.747z",
                                fill: "#647A97",
                                fillRule: "nonzero"
                              }
                            )
                          }
                        )
                      }
                    ),
                    /* @__PURE__ */ jsx("hr", { className: "mt-2" })
                  ] }),
                  tripType !== "hourly" && /* @__PURE__ */ jsxs("div", { className: "mb-3", children: [
                    /* @__PURE__ */ jsx(
                      LocationAutocomplete,
                      {
                        value: to,
                        onChange: setTo,
                        placeholder: t("hero.enterDrop"),
                        label: t("hero.to")
                      }
                    ),
                    /* @__PURE__ */ jsx("hr", {})
                  ] }),
                  tripType !== "airport" && tripType !== "hourly" && /* @__PURE__ */ jsxs(Fragment, { children: [
                    stops.map((stop, index) => /* @__PURE__ */ jsxs("div", { className: "relative mb-3", children: [
                      /* @__PURE__ */ jsx(
                        LocationAutocomplete,
                        {
                          value: stop.value,
                          onChange: (newValue) => handleStopChange(stop.id, newValue),
                          placeholder: `${t("tripDetails.stop")} ${index + 1}`,
                          label: `${t("tripDetails.stop")} ${index + 1}`
                        }
                      ),
                      /* @__PURE__ */ jsx(
                        "button",
                        {
                          type: "button",
                          onClick: () => removeStop(stop.id),
                          className: "absolute right-3 top-9 text-gray-400 hover:text-red-500 text-lg z-10",
                          children: "X"
                        }
                      ),
                      /* @__PURE__ */ jsx("hr", { className: "mt-2" })
                    ] }, stop.id)),
                    /* @__PURE__ */ jsxs(
                      "p",
                      {
                        onClick: addStop,
                        className: "text-blue-700 text-sm font-medium cursor-pointer mb-4",
                        children: [
                          t("hero.addStops"),
                          /* @__PURE__ */ jsx("span", { className: "ml-1 bg-pink-600 text-white text-[10px] px-1.5 py-0.5 rounded", children: t("hero.new") })
                        ]
                      }
                    )
                  ] }),
                  /* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
                    /* @__PURE__ */ jsxs("div", { className: "cursor-pointer", onClick: () => openDatePicker("pickup"), children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("hero.pickupDate") }),
                      /* @__PURE__ */ jsx("p", { className: "font-bold text-base", children: pickupDate })
                    ] }),
                    /* @__PURE__ */ jsxs("div", { className: "cursor-pointer", onClick: () => openTimePicker("pickup"), children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("hero.pickupTime") }),
                      /* @__PURE__ */ jsxs("p", { className: "font-bold text-base flex items-center", children: [
                        pickupTime,
                        /* @__PURE__ */ jsx(FaArrowDown, { className: "w-3 h-3 ml-1" })
                      ] })
                    ] })
                  ] }),
                  /* @__PURE__ */ jsx("hr", {}),
                  tripType === "round" && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-4", children: [
                    /* @__PURE__ */ jsxs("div", { className: "cursor-pointer", onClick: () => openDatePicker("return"), children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("hero.returnDate") }),
                      /* @__PURE__ */ jsx("p", { className: "font-bold text-base", children: returnDate })
                    ] }),
                    /* @__PURE__ */ jsxs("div", { className: "cursor-pointer", onClick: () => openTimePicker("return"), children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("hero.returnTime") }),
                      /* @__PURE__ */ jsxs("p", { className: "font-bold text-base flex items-center", children: [
                        returnTime,
                        /* @__PURE__ */ jsx(FaArrowDown, { className: "w-3 h-3 ml-1" })
                      ] })
                    ] })
                  ] }),
                  tripType === "hourly" && /* @__PURE__ */ jsxs("div", { className: "mt-4", children: [
                    /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mb-2", children: t("hero.selectPackage") || "Select Package" }),
                    /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 flex-wrap", children: [
                      { hours: 2, km: 20, label: "2hrs 20km" },
                      { hours: 4, km: 40, label: "4hrs 40km" },
                      { hours: 8, km: 80, label: "8hrs 80km" },
                      { hours: 12, km: 120, label: "12hrs 120km" },
                      { hours: 24, km: 300, label: "24hrs 300km" }
                    ].map((pkg) => /* @__PURE__ */ jsx(
                      "button",
                      {
                        onClick: () => setSelectedDuration(pkg),
                        className: `px-4 py-2 rounded-lg font-bold text-sm border transition-all ${(selectedDuration == null ? void 0 : selectedDuration.hours) === pkg.hours ? "border-2 border-blue-500 text-blue-600 bg-blue-50" : "border-gray-200 text-gray-700 hover:border-gray-300"}`,
                        children: pkg.label
                      },
                      pkg.label
                    )) })
                  ] }),
                  /* @__PURE__ */ jsx("div", { className: "flex justify-center mt-auto -mb-12 pt-4", children: /* @__PURE__ */ jsx(
                    "button",
                    {
                      onClick: async () => {
                        if (!from || from.trim() === "") {
                          toast$1.error("Please enter pickup location");
                          return;
                        }
                        if (tripType !== "hourly" && (!to || to.trim() === "")) {
                          toast$1.error("Please enter drop location");
                          return;
                        }
                        if (tripType === "hourly" && !selectedDuration) {
                          toast$1.error("Please select a rental package");
                          return;
                        }
                        toast$1.loading("Finding cabs...", { id: "search-loading" });
                        try {
                          const sourceCoords = await geocodeLocation(from);
                          if (!sourceCoords) {
                            toast$1.dismiss("search-loading");
                            toast$1.error(`Could not find location: ${from}`);
                            return;
                          }
                          let destCoords = null;
                          let distance = 0;
                          if (tripType !== "hourly") {
                            destCoords = await geocodeLocation(to);
                            if (!destCoords) {
                              toast$1.dismiss("search-loading");
                              toast$1.error(`Could not find location: ${to}`);
                              return;
                            }
                            distance = 0;
                          }
                          toast$1.dismiss("search-loading");
                          onSearch({
                            from,
                            to: tripType === "hourly" ? from : to,
                            // For hourly rental, same city as source
                            tripType: tripType === "oneway" ? "oneWay" : tripType === "round" ? "roundTrip" : tripType === "hourly" ? "rental" : tripType,
                            pickupDate,
                            pickupTime,
                            returnDate: tripType === "round" ? returnDate : void 0,
                            sourceLat: sourceCoords.lat,
                            sourceLong: sourceCoords.lng,
                            destLat: (destCoords == null ? void 0 : destCoords.lat) || sourceCoords.lat,
                            destLong: (destCoords == null ? void 0 : destCoords.lng) || sourceCoords.lng,
                            distance: 0,
                            // Let backend calculate actual road distance
                            fuelType: "petrol",
                            isAc: true,
                            startTime: (/* @__PURE__ */ new Date()).toISOString(),
                            rentalPackage: tripType === "hourly" ? {
                              hours: selectedDuration.hours,
                              distance: selectedDuration.km
                            } : void 0
                          });
                        } catch (error) {
                          toast$1.dismiss("search-loading");
                          toast$1.error("Search failed. Please try again.");
                          console.error("Search error:", error);
                        }
                      },
                      className: "w-full sm:w-52 font-h4 bg-orange-500 hover:bg-orange-600 text-white font-bold py-4 rounded-full transition-all duration-300 flex items-center justify-center gap-2 shadow-md hover:shadow-lg",
                      children: t("hero.searchCabs")
                    }
                  ) })
                ]
              }
            ),
            /* @__PURE__ */ jsxs("div", { className: "w-full lg:w-[600px] flex flex-col gap-4 mt-4 lg:-mt-20", children: [
              promoBanner && promoBanner.image && /* @__PURE__ */ jsxs("div", { className: "relative rounded-xl shadow-lg overflow-hidden", children: [
                /* @__PURE__ */ jsx(
                  "img",
                  {
                    className: "h-[200px] w-full object-cover",
                    src: ((_e = promoBanner.image) == null ? void 0 : _e.startsWith("http")) ? promoBanner.image : `${BACKEND_URL}/${promoBanner.image}`,
                    alt: promoBanner.title || "Promotional Banner"
                  }
                ),
                (promoBanner.title || promoBanner.description) && /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 bg-gradient-to-r from-black/50 to-transparent flex flex-col justify-center p-6", children: [
                  promoBanner.title && /* @__PURE__ */ jsx("h3", { className: "text-white font-bold text-lg mb-1", children: promoBanner.title }),
                  promoBanner.description && /* @__PURE__ */ jsx("p", { className: "text-white/80 text-sm", children: promoBanner.description })
                ] })
              ] }),
              adminOfferBanners.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
                /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 w-full", children: adminOfferBanners.slice(offerIndex, offerIndex + visibleOffers).map((offer, idx) => {
                  var _a2;
                  return /* @__PURE__ */ jsxs("div", { className: "bg-white shadow-md rounded-lg overflow-hidden hover:shadow-lg transition", children: [
                    offer.image && /* @__PURE__ */ jsx("div", { className: "h-24 bg-blue-100 flex items-center justify-center", children: /* @__PURE__ */ jsx(
                      "img",
                      {
                        src: ((_a2 = offer.image) == null ? void 0 : _a2.startsWith("http")) ? offer.image : `${BACKEND_URL}/${offer.image}`,
                        alt: offer.title || "Offer",
                        className: "h-full w-full object-cover"
                      }
                    ) }),
                    /* @__PURE__ */ jsxs("div", { className: "p-3", children: [
                      /* @__PURE__ */ jsx("p", { className: "text-sm font-bold text-gray-800 mt-1", children: offer.title }),
                      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: offer.description })
                    ] })
                  ] }, idx);
                }) }),
                adminOfferBanners.length > visibleOffers && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
                  /* @__PURE__ */ jsx(
                    "button",
                    {
                      type: "button",
                      onClick: () => setOfferIndex(Math.max(0, offerIndex - 1)),
                      disabled: offerIndex === 0,
                      className: "w-8 h-8 rounded-full bg-white shadow flex items-center justify-center disabled:opacity-30 hover:bg-gray-50 transition",
                      children: /* @__PURE__ */ jsx(FaChevronLeft, { size: 12 })
                    }
                  ),
                  /* @__PURE__ */ jsx(
                    "button",
                    {
                      type: "button",
                      onClick: () => setOfferIndex(Math.min(adminOfferBanners.length - visibleOffers, offerIndex + 1)),
                      disabled: offerIndex >= adminOfferBanners.length - visibleOffers,
                      className: "w-8 h-8 rounded-full bg-white shadow flex items-center justify-center disabled:opacity-30 hover:bg-gray-50 transition",
                      children: /* @__PURE__ */ jsx(FaChevronRight, { size: 12 })
                    }
                  )
                ] })
              ] }),
              featureCards.length > 0 && /* @__PURE__ */ jsxs("div", { className: "relative", children: [
                /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-4 w-full", children: featureCards.slice(featureIndex, featureIndex + visibleFeatures).map((card, idx) => {
                  const IconComp = iconMap[card.icon] || FaTrophy;
                  const colorClass = iconColorMap[card.icon] || "text-yellow-500";
                  return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-base bg-white text-black shadow-md font-bold rounded-md px-5 py-2", children: [
                    /* @__PURE__ */ jsx(IconComp, { className: colorClass }),
                    /* @__PURE__ */ jsx("span", { children: card.text })
                  ] }, idx);
                }) }),
                featureCards.length > visibleFeatures && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-2", children: [
                  /* @__PURE__ */ jsx(
                    "button",
                    {
                      type: "button",
                      onClick: () => setFeatureIndex(Math.max(0, featureIndex - 1)),
                      disabled: featureIndex === 0,
                      className: "w-8 h-8 rounded-full bg-white shadow flex items-center justify-center disabled:opacity-30 hover:bg-gray-50 transition",
                      children: /* @__PURE__ */ jsx(FaChevronLeft, { size: 12 })
                    }
                  ),
                  /* @__PURE__ */ jsx(
                    "button",
                    {
                      type: "button",
                      onClick: () => setFeatureIndex(Math.min(featureCards.length - visibleFeatures, featureIndex + 1)),
                      disabled: featureIndex >= featureCards.length - visibleFeatures,
                      className: "w-8 h-8 rounded-full bg-white shadow flex items-center justify-center disabled:opacity-30 hover:bg-gray-50 transition",
                      children: /* @__PURE__ */ jsx(FaChevronRight, { size: 12 })
                    }
                  )
                ] })
              ] })
            ] })
          ]
        }
      )
    ] }),
    showDatePicker && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
      /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-2", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsx(
            "select",
            {
              value: viewMonth,
              onChange: (e) => setViewMonth(parseInt(e.target.value)),
              className: "border border-gray-300 rounded p-1 text-sm font-bold text-gray-700 focus:outline-none focus:ring-2 focus:ring-orange-500",
              children: monthsList.map((m, idx) => /* @__PURE__ */ jsx("option", { value: idx, children: m }, idx))
            }
          ),
          /* @__PURE__ */ jsx(
            "select",
            {
              value: viewYear,
              onChange: (e) => setViewYear(parseInt(e.target.value)),
              className: "border border-gray-300 rounded p-1 text-sm font-bold text-gray-700 focus:outline-none focus:ring-2 focus:ring-orange-500",
              children: yearsList.map((y) => /* @__PURE__ */ jsx("option", { value: y, children: y }, y))
            }
          )
        ] }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => setShowDatePicker(false),
            className: "p-1 text-gray-500 hover:text-gray-700",
            children: /* @__PURE__ */ jsx(FaTimes, { className: "w-5 h-5" })
          }
        )
      ] }) }),
      /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-7 gap-1 p-4", children: [
        [t("weekDays.mon"), t("weekDays.tue"), t("weekDays.wed"), t("weekDays.thu"), t("weekDays.fri"), t("weekDays.sat"), t("weekDays.sun")].map((day) => /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-500 font-medium py-2", children: day }, day)),
        calendarDays.map((dayObj, index) => {
          const dayDate = new Date(viewYear, viewMonth, dayObj.day);
          const formatted = formatDate(dayDate);
          const isSelected = !dayObj.otherMonth && (selectedDateType === "pickup" && pickupDate === formatted || selectedDateType === "return" && returnDate === formatted);
          return /* @__PURE__ */ jsx(
            "button",
            {
              disabled: dayObj.isPast || dayObj.otherMonth,
              className: `h-10 flex items-center justify-center rounded-full text-sm font-medium 
                      ${!dayObj.day || dayObj.otherMonth ? "text-transparent cursor-default" : ""}
                      ${dayObj.isPast ? "text-gray-300 cursor-not-allowed" : "cursor-pointer hover:bg-gray-100"}
                      ${isSelected ? "bg-orange-500 text-white hover:bg-orange-600" : dayObj.isPast ? "" : "text-gray-700"}
                    `,
              onClick: () => handleDateSelect(dayObj),
              children: dayObj.day
            },
            index
          );
        })
      ] })
    ] }) }),
    showTimePicker && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-end justify-center z-50", children: /* @__PURE__ */ jsxs("div", { className: "bg-white w-full max-w-md rounded-t-2xl max-h-[70vh] overflow-hidden", children: [
      /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: t("hero.pickupTime") }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => setShowTimePicker(false),
            className: "p-1 text-gray-500 hover:text-gray-700",
            children: /* @__PURE__ */ jsx(FaTimes, { className: "w-5 h-5" })
          }
        )
      ] }) }),
      /* @__PURE__ */ jsx("div", { className: "max-h-[60vh] overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-2 p-4", children: timeSlots.map((time) => /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => handleTimeSelect(time, selectedDateType),
          className: `p-3 text-center border rounded-lg text-sm font-medium transition-colors
                      ${selectedDateType === "pickup" && pickupTime === time || selectedDateType === "return" && returnTime === time ? "border-orange-500 bg-orange-50 text-orange-500" : "border-gray-200 text-gray-700 hover:border-gray-300"}`,
          children: time
        },
        time
      )) }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto mt-[420px] sm:mt-[380px] px-4 sm:px-6", children: [
      /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: handleExploreClick,
          className: "bg-gradient-to-r from-blue-500 to-blue-400 text-white px-6 sm:px-8 py-3 rounded-full font-bold hover:from-blue-600 hover:to-blue-500 transition-all shadow-md text-sm sm:text-base flex items-center gap-2",
          children: [
            t("common.exploreMore"),
            " ",
            /* @__PURE__ */ jsx(FaArrowDown, { className: "bg-white rounded-3xl h-6 w-6 text-base text-blue-500 " })
          ]
        }
      ) }),
      /* @__PURE__ */ jsxs(
        "div",
        {
          ref: cabInfoRef,
          className: "max-w-6xl mx-auto bg-white p-4 sm:p-6 mt-6 shadow-md rounded-lg",
          children: [
            /* @__PURE__ */ jsx("h2", { className: "font-extrabold text-xl text-gray-800", children: t("cabInfo.title") }),
            /* @__PURE__ */ jsxs("p", { className: "text-sm sm:text-base text-gray-600 mt-2 font-light", children: [
              t("cabInfo.description"),
              !expanded ? " ..." : ""
            ] }),
            expanded && /* @__PURE__ */ jsxs("div", { className: "text-sm sm:text-base text-gray-600 mt-4 space-y-4", children: [
              /* @__PURE__ */ jsx("p", { className: "font-extralight", children: t("cabInfo.easyToUse") }),
              /* @__PURE__ */ jsx("h2", { className: "font-extrabold text-lg text-gray-800", children: t("cabInfo.bookYourCab") }),
              /* @__PURE__ */ jsx("p", { className: "font-extralight", children: t("cabInfo.premiumServicesText") }),
              /* @__PURE__ */ jsx("p", { className: "font-extralight", children: t("cabInfo.roadTrips") })
            ] }),
            /* @__PURE__ */ jsx(
              "button",
              {
                onClick: () => setExpanded(!expanded),
                className: "text-blue-600 text-sm font-bold inline-flex items-center gap-1 hover:text-blue-800 mt-2",
                children: expanded ? /* @__PURE__ */ jsxs(Fragment, { children: [
                  t("common.readLess"),
                  " ",
                  /* @__PURE__ */ jsx(FaArrowRight, { className: "text-xs rotate-180" })
                ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
                  t("common.readMore"),
                  " ",
                  /* @__PURE__ */ jsx(FaArrowRight, { className: "text-xs" })
                ] })
              }
            )
          ]
        }
      )
    ] })
  ] });
};
const CabFaq = () => {
  const dispatch = useDispatch();
  const { faqs } = useSelector((state) => state.cms);
  useEffect(() => {
    dispatch(getFAQs());
  }, [dispatch]);
  const faqArray = React__default.useMemo(() => {
    if (!faqs) return [];
    if (Array.isArray(faqs)) return faqs;
    if (typeof faqs === "object") {
      return Object.values(faqs).flat();
    }
    return [];
  }, [faqs]);
  return /* @__PURE__ */ jsx("section", { className: "w-full min-h-screen bg-[#eff3f8] py-12 px-4 ", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto", children: [
    /* @__PURE__ */ jsx("h2", { className: "font-bold text-2xl text-gray-800 mb-3  relative ", children: "Cabs Booking FAQ" }),
    /* @__PURE__ */ jsx("div", { className: "bg-white rounded-xl shadow-md px-6 py-7 space-y-6", children: faqArray.map((faq2, index) => /* @__PURE__ */ jsxs("div", { children: [
      /* @__PURE__ */ jsx("h3", { className: "font-extrabold text-base text-[#333333] mb-2", children: faq2.question }),
      /* @__PURE__ */ jsx("p", { className: "font-[450] text-sm  text-[#333333] leading-relaxed", children: faq2.answer })
    ] }, faq2._id || index)) })
  ] }) });
};
const FAQMobile = () => {
  const [showMore, setShowMore] = useState(false);
  const carImages = [
    "https://gos3.ibcdn.com/cab-offer-1762537952.jpg",
    "https://gos3.ibcdn.com/img-1759216228.jpg",
    "https://gos3.ibcdn.com/img-1750849890.jpg",
    "https://gos3.ibcdn.com/img-1751978199.jpg",
    "https://gos3.ibcdn.com/img-1755589446.jpg",
    "https://gos3.ibcdn.com/img-1751013438.jpg",
    "https://gos3.ibcdn.com/img-1736155565.jpg",
    "https://gos3.ibcdn.com/offers-1726049519.jpg"
  ];
  const longText = `
You can opt for online cab booking that will make your journey hassle-free. You simply have to visit the GoIbibo portal and select a cab.

Due to the easy-to-use interface and quick menu options of GoIbibo, online cab booking is not a difficult process. In fact, cab booking is something which has become a part of our everyday life. You can also opt for intercity car rentals in order to visit other cities.

The online taxi booking process on GoIbibo can be completed within a couple of minutes. So, if you wish to customize your cab booking package, GoIbibo is your go-to website. All the car booking services available on GoIbibo are geared towards giving you the best-possible experience when it comes to cab booking.

Book Your Cab Online
When you choose us for your cab booking requirements, we offer you premium services, and most importantly, high reliability. GoIbibo is considered one of the most popular car booking platforms. Besides that, you can also visit the website for train, flight, and bus tickets. The best part is you can get top-notch cars for your preferred destination.

Road trips are one of the most exciting ways to travel all across the country. There is so much to experience and explore. GoIbibo ensures that your road trip is an enjoyable experience.

The process of booking a cab on GoIbibo is pretty simple. You just need to log in to GoIbibo's official website and provide all the required details. In order to book your cab, you have to fill in the city of your origin, the destination, your departure date and timings. Once all the details are filled, simply click on the ‘Search’ option.

On the portal, you will get a wide range of cab options available at different prices. The prices depend on a lot of factors such as the type of cab you are choosing, the in-car facilities provided, the route you are taking to travel as well as your date of journey. You can select a cab which meets your travel requirements.

Book a Cab for an Exciting Road Trip
Tourists enjoy the scenic beauty of nature, the smooth highway roads, studying the diverse cultures and tasting the lip-smacking local food once when you are on holiday. There is a lot you can explore on a road trip, and GoIbibo is there to be your travel companion.

You can book outstation cab to visit popular tourist destinations such as Delhi, Manali, Mumbai and Naintal or the unexplored gems such as Khajuraho, Alleppey, Alibag and Tranquebar simply by booking an online cab booking. Planning a trip can be quite a hassle, but choose to make your online cab booking on GoIbibo for an easier process. You can choose from a wide range of cabs such as hatchbacks, sedans, SUVs, MPVs, and more. You can also book an outstation cab for a one-way trip as well as a round trip.

In case you have any booking-related queries, you can reach out to the 24/7 customer service of GoIbibo and talk to the experts regarding your travel. While booking your outstation cab with us, you can also get assistance in discussing the itinerary and planning your trip. Moreover, the option of using the mobile app will further reduce the hassle of booking a cab. All the services offered by GoIbibo are available on a single click. Moreover, you can also get exciting discounts and offers if you make your bookings via GoIbibo.

Choose GoIbibo for Online Cab Booking
GoIbibo can make the process of online cab booking hassle-free. Below, we are mentioning some of the reasons why people choose us over and over again:

Clean cars
Hygiene is the top-most priority for GoIbibo. That’s why, they ensure that the cab you book is absolutely clean. Considering the Covid-19 situation, we ensure that every car is sanitized before the journey and all the safety protocols are followed thoroughly. The temperature of drivers is checked before every trip, and wearing masks is mandatory for the passengers as well as drivers.

Transparent billing
Be assured, when you choose GoIbibo for your cab booking requirements, the services offered are at the most reasonable rates. Besides that, GoIbibo also maintains 100% billing transparency. So, there are zero hidden charges involved from the beginning to end of your journey. You can choose from your preferred payment methods. Some of the payment options available on GoIbibo include debit card, credit card, net banking and UPI.

Reliable services
Every person is looking for a reliable experience that prioritizes their needs and concerns. That’s why, GoIbibo offers an unparalleled experience to users when they are making cab booking online. You can connect with the 24/7 customer support service of GoIbibo and resolve all your booking-related queries. From providing the best services to ensuring a safe trip, GoIbibo makes sure that your trip is enjoyable.

Courteous chauffeurs
Dealing with impolite people is difficult. An encounter with a rude person can ruin our entire trip. That’s why, GoIbibo makes sure that the chauffeur you get is polite and cooperative. You can find the top-rated drivers on GoIbibo who will make your journey smooth and your trip memorable.

Road trip experts
GoIbibo turns you into an expert in planning road trips. The easy access to all the travel services can help you plan your travel accurately. You can reach out to the customer centre of GoIbibo. Our team comprises experts who offer the best solutions for your queries. Therefore, cab booking with GoIbibo is always a hassle-free experience. Whether it is for outstation trips or an airport taxi, GoIbibo can meet all your travel requirements so that you can reach your desired destination safely. GoIbibo believes in assuring safety, reliability, and affordability to travelers.`;
  return /* @__PURE__ */ jsxs("div", { className: "bg-gray-200 min-h-screen p-4 space-y-6", children: [
    /* @__PURE__ */ jsx("div", { className: "text-black font-semibold mt-", children: /* @__PURE__ */ jsx("h1", { children: "Offers for you" }) }),
    /* @__PURE__ */ jsx("div", { className: "flex overflow-x-auto gap-4 snap-x snap-mandatory", children: carImages.map((img, index) => /* @__PURE__ */ jsxs(
      "div",
      {
        className: "min-w-[230px] max-w-[230px] bg-white rounded-xl shadow-sm snap-center",
        children: [
          /* @__PURE__ */ jsx("div", { className: "w-full h-[150px]  overflow-hidden", children: /* @__PURE__ */ jsx(
            "img",
            {
              src: img,
              alt: `car-${index}`,
              className: "w-full h-full object-cover"
            }
          ) }),
          /* @__PURE__ */ jsx("p", { className: "text-[14px] font-semibold text-black mt-2 leading-snug p-1", children: "Get up to ₹500 OFF* on top outstation cab routes!" }),
          /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mt-1 p-1", children: "Limited Period Offer" })
        ]
      },
      index
    )) }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white text-black p-4 rounded-lg shadow-sm space-y-3", children: [
      /* @__PURE__ */ jsx("h2", { className: "font-semibold text-base", children: "Online Cab Booking on Goibibo" }),
      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900 leading-relaxed", children: "Most of the Indian tourists prefer travelling to their preferred destination via road. It is due to the fact that a road trip allows you to enjoy the scenic beauty at your own pace. Moreover, the comfort of travelling in a vehicle with your family and friends is unparalleled." }),
      showMore && /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900 leading-relaxed whitespace-pre-line", children: longText }),
      /* @__PURE__ */ jsx(
        "button",
        {
          className: "text-blue-600 text-sm font-medium",
          onClick: () => setShowMore(!showMore),
          children: showMore ? "Read Less" : "Read More"
        }
      )
    ] }),
    /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-black mt-3", children: "Cabs Booking FAQ" }) }),
    /* @__PURE__ */ jsx("div", { className: "bg-white p-4 rounded-lg shadow-sm space-y-4", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. How can I book cheap cabs online?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Goibibo helps you with online cab booking at the best prices, comparatively much lower than the local vendors. Also you can use promo codes and offers on the Goibibo website & app on online cab booking to get extra discounts." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What are the advantages of online taxi booking?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Online taxi booking not only helps you with best prices but also helps you with the convenience of paying through multiple payment options (like Debit Card, Credit Card, eWallets etc.). You can easily compare prices and choose various categories of cabs like Hatchback cars, Sedan and SUV." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. Why you should book cabs from Goibibo?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "From Goibibo you can get confirmed cheap cabs of your choice and budget. Expert and verified drivers will be taken care of your ride. Easy interface of booking with different payment modes available at Goibibo and finally with no hidden charges, Goibibo is the best option for online taxi booking." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What are the best options available for cab booking?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "While booking cabs online through Goibibo, you can choose the car based on your requirement and preferences. You can book Hatchback like Indica, Swift, Sedan like Dzire, Etios and SUV like Innova, Ertiga." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What kind of cabs you can book from Goibibo?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "You can book following kinds of cabs from Goibibo: airport cabs and intercity cabs / outstation cabs. You can book outstation cabs for both one-way transfers & round-trip transfers." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What are the popular outstation cab booking routes?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Some of the popular outstation cab booking routes are Pune to Mumbai cabs, Delhi to Jaipur cabs, Delhi to Agra cabs, Pondicherry to Chennai cabs, Ahmedabad to Vadodara cabs, Bangalore to Mysore cabs and Mumbai to Pune cabs." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. How can I book cheap cabs online?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Goibibo helps you with online cab booking at the best prices from various cab service providers. Also, you can use promo codes and offers on the Goibibo website & app for online cab booking to get extra discounts." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What are the advantages of online taxi booking?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Online taxi booking not only helps you find the best prices from different service providers but also offers the convenience of paying through multiple payment options (like Debit Card, Credit Card, eWallets, etc.). You can easily compare prices and choose various categories of cabs like Hatchback cars, Sedan, and SUV." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. Why should you book cabs from Goibibo?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Goibibo has a large number of service providers who list their cabs on Goibibo, increasing your chances of obtaining the most competitive prices for your cabs. You also have the added advantage of access to Goibibo's customer care and an easy interface for booking with different payment modes and no hidden charges. While booking cabs online through Goibibo, you can choose the car based on your requirement and preferences, depending on the cars available with the relevant service providers. You can book Hatchback like Indica, Swift, Sedan like Dzire, Etios, and SUV like Innova, Ertiga." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What kind of cabs can you book from Goibibo?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "You can book the following kinds of cabs from Goibibo: airport cabs and rentals / outstation cabs. You can book outstation cabs for both one-way transfers & round-trip transfers." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. Do I need to register on Goibibo to book a cab online?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "No, you can successfully book the cab without registering on our website." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What if the cab doesn't show up?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "If the vehicle you booked does not arrive, we will immediately issue a complete refund." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What happens if the vehicle breaks down?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Since we work with established service providers, the vehicles are usually reliable. In case of a breakdown, it is the service provider's responsibility to replace the vehicle during the journey. In case of any persisting issue, you may reach out to the helpline number provided by Goibibo, and we shall reach out to our vendor to arrange an alternate cab for you." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. How are the Kilometers calculated?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "The 'Kilometers' are calculated based on the return trip distance between the boarding point and the destination." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. Can I book a cab without a credit card or net banking option?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Yes, other payment options available are UPI (gpay, phonepay), wallets (Paytm, Amazon Pay), and debit cards." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. How is the total cab fare calculated for an intercity cab service?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "For outstation trips (intercity), mostly x kms are included in the fare. Route-wise charges will vary. Sometimes tolls and state taxes might be included in the fare. In certain cases, these won't be part of the original fare, and the user would have to pay extra charges at the trip’s end, if applicable. Extra charges can include waiting charges, extra kilometers, extra hours, night charges, airport entry fee, airport parking charges, toll charges, state taxes, driver charges, parking charges, etc." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. How is the total cab fare/price calculated for a local cab service?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Four packages are available (4hrs & 40 kms, 8hrs & 80 kms, 12hrs & 120 kms, 24hrs & 300 kms). Extra kilometers & extra hour charges are applicable if usage exceeds the package taken." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What are the payment terms?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "You can confirm your reservation by paying a small booking fee, typically up to 25% of the base fare. The balance can be paid directly to us through online modes until two days before the start of the journey or to the operator in cash at the time of trip completion." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. What if I need to cancel my trip?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "The cancellation policy is specific to each service provider and is listed against the quotes on the quotations page." })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm mb-1 text-black", children: "Q. How are tolls & taxes calculated?" }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-900", children: "Tolls and interstate taxes are best estimates only. If these amounts are included in the fare, you'll be charged/reimbursed for any difference between the actuals and estimates, as applicable." })
      ] })
    ] }) })
  ] });
};
const CabRoutes = () => {
  const dispatch = useDispatch();
  const {
    intercityRoutes,
    intercityLoading,
    cityServices,
    cityLoading,
    airportRoutes,
    airportLoading
  } = useSelector((state) => state.seo);
  useEffect(() => {
    dispatch(getIntercityRoutes({ limit: 30 }));
    dispatch(getCityServices({ limit: 20 }));
    dispatch(getAirportRoutes({ limit: 20 }));
  }, [dispatch]);
  const distributeInColumns = (items, columnsCount = 5) => {
    const columns = Array.from({ length: columnsCount }, () => []);
    items.forEach((item, index) => {
      columns[index % columnsCount].push(item);
    });
    return columns;
  };
  const intercityColumns = distributeInColumns(intercityRoutes, 5);
  const cityColumns = distributeInColumns(cityServices, 5);
  const airportColumns = distributeInColumns(airportRoutes, 5);
  return /* @__PURE__ */ jsx("div", { className: "bg-[#e8f4fc] py-8 px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl w-full mx-auto", children: [
    /* @__PURE__ */ jsxs("div", { className: "mb-10", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900 mb-5", children: "Top Cab Routes" }),
      intercityLoading ? /* @__PURE__ */ jsx("div", { className: "text-center py-4 text-gray-500", children: "Loading routes..." }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-x-8 gap-y-0", children: intercityColumns.map((column, colIndex) => /* @__PURE__ */ jsx("div", { className: "space-y-2", children: column.map((route) => /* @__PURE__ */ jsxs(
        distExports.Link,
        {
          to: `/top/${route.slug}`,
          state: { route },
          className: "block text-[#0770e3] hover:text-[#0557b5] hover:underline text-sm py-0.5",
          children: [
            route.originCity,
            " To ",
            route.destinationCity,
            " Cab"
          ]
        },
        route._id || route.slug
      )) }, colIndex)) })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "mb-10", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900 mb-5", children: "Cab from Top Cities" }),
      cityLoading ? /* @__PURE__ */ jsx("div", { className: "text-center py-4 text-gray-500", children: "Loading city services..." }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-x-8 gap-y-0", children: cityColumns.map((column, colIndex) => /* @__PURE__ */ jsx("div", { className: "space-y-2", children: column.map((service) => /* @__PURE__ */ jsxs(
        distExports.Link,
        {
          to: `/cities/${service.slug}`,
          state: { service },
          className: "block text-[#0770e3] hover:text-[#0557b5] hover:underline text-sm py-0.5",
          children: [
            service.cityName,
            " Taxi Services"
          ]
        },
        service._id || service.slug
      )) }, colIndex)) })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900 mb-5", children: "Top Airport Cab Routes" }),
      airportLoading ? /* @__PURE__ */ jsx("div", { className: "text-center py-4 text-gray-500", children: "Loading airport routes..." }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-x-8 gap-y-0", children: airportColumns.map((column, colIndex) => /* @__PURE__ */ jsx("div", { className: "space-y-2", children: column.map((route) => /* @__PURE__ */ jsx(
        distExports.Link,
        {
          to: `/airport/${route.slug}`,
          state: { route },
          className: "block text-[#0770e3] hover:text-[#0557b5] hover:underline text-sm py-0.5",
          children: route.routeType === "from_airport" ? `Cab From ${route.airportName}` : `Cab To ${route.airportName}`
        },
        route._id || route.slug
      )) }, colIndex)) })
    ] })
  ] }) });
};
const RoutesMobile = () => {
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const {
    intercityRoutes,
    intercityLoading,
    cityServices,
    cityLoading,
    airportRoutes,
    airportLoading
  } = useSelector((state) => state.seo);
  useEffect(() => {
    dispatch(getIntercityRoutes({ limit: 25 }));
    dispatch(getCityServices({ limit: 20 }));
    dispatch(getAirportRoutes({ limit: 20 }));
  }, [dispatch]);
  const handleTopCabClick = (route) => {
    navigate(`/top/${route.slug}`, { state: { route } });
  };
  const handleCityCabClick = (service) => {
    navigate(`/cities/${service.slug}`, { state: { service } });
  };
  const handleAirportClick = (route) => {
    navigate(`/airport/${route.slug}`, { state: { route } });
  };
  return /* @__PURE__ */ jsxs("div", { className: "p-4 text-gray-700", children: [
    /* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg mb-4", children: "Top Cab Routes" }),
    intercityLoading ? /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children: "Loading routes..." }) : /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: intercityRoutes.map((route) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
      "button",
      {
        onClick: () => handleTopCabClick(route),
        className: "text-blue-600 hover:underline text-sm",
        children: [
          route.originCity,
          " To ",
          route.destinationCity,
          " Cab"
        ]
      }
    ) }, route._id || route.slug)) }),
    /* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg mt-8 mb-4", children: "Cab from Top Cities" }),
    cityLoading ? /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children: "Loading city services..." }) : /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: cityServices.map((service) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(
      "button",
      {
        onClick: () => handleCityCabClick(service),
        className: "text-blue-600 hover:underline text-sm",
        children: [
          service.cityName,
          " Taxi Services"
        ]
      }
    ) }, service._id || service.slug)) }),
    /* @__PURE__ */ jsx("h2", { className: "font-semibold text-lg mt-8 mb-4", children: "Top Airport Cab Routes" }),
    airportLoading ? /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm", children: "Loading airport routes..." }) : /* @__PURE__ */ jsx("ul", { className: "space-y-0.5", children: airportRoutes.map((route) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(
      "button",
      {
        onClick: () => handleAirportClick(route),
        className: "text-blue-600 hover:underline text-sm",
        children: route.routeType === "from_airport" ? `Cab From ${route.airportName}` : `Cab To ${route.airportName}`
      }
    ) }, route._id || route.slug)) }),
    /* @__PURE__ */ jsx("hr", { className: "border border-gray-300 mt-4 mb-6" })
  ] });
};
const CabResults = () => {
  var _a, _b;
  const dispatch = useDispatch();
  const { t } = useTranslation();
  const [showKnowMore, setShowKnowMore] = useState(false);
  const [priceRange, setPriceRange] = useState([2057, 8457]);
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  (_a = location.state) == null ? void 0 : _a.route;
  const { isAuthenticated: isLoggedIn } = useSelector((state) => state.auth);
  const { searchResults, searchLoading, searchError } = useSelector(
    (state) => state.booking
  );
  useEffect(() => {
    var _a2, _b2;
    console.log("CabResults - searchResults updated:", searchResults);
    console.log("CabResults - searchResults.cabs length:", (_a2 = searchResults.cabs) == null ? void 0 : _a2.length);
    console.log("CabResults - searchResults.vehicles length:", (_b2 = searchResults.vehicles) == null ? void 0 : _b2.length);
  }, [searchResults]);
  const [tripType, setTripType] = useState("oneway");
  const [fromLocation, setFromLocation] = useState("MP Nagar, Bhopal");
  const [toLocation, setToLocation] = useState("Indore, MP");
  const [pickupDate, setPickupDate] = useState(
    (/* @__PURE__ */ new Date()).toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" })
  );
  const [returnDate, setReturnDate] = useState(null);
  const [pickupTime, setPickupTime] = useState("10:00 AM");
  const [stops, setStops] = useState([]);
  const [currentUserLocation, setCurrentUserLocation] = useState(null);
  const [selectedRentalPackage, setSelectedRentalPackage] = useState(null);
  const rentalPackages = [
    { hours: 2, distance: 20, label: "2 hrs 20 km" },
    { hours: 4, distance: 40, label: "4 hrs 40 km" },
    { hours: 8, distance: 80, label: "8 hrs 80 km" },
    { hours: 12, distance: 120, label: "12 hrs 120 km" },
    { hours: 24, distance: 300, label: "24 hrs 300 km" }
  ];
  const [searchCoordinates, setSearchCoordinates] = useState({
    source: null,
    dest: null,
    distance: 0,
    duration: 0
  });
  const [showTripTypeDropdown, setShowTripTypeDropdown] = useState(false);
  const [showRentalPackageDropdown, setShowRentalPackageDropdown] = useState(false);
  const [showLocationModal, setShowLocationModal] = useState(false);
  const [showStopsModal, setShowStopsModal] = useState(false);
  const [showDateModal, setShowDateModal] = useState(false);
  const [showTimeModal, setShowTimeModal] = useState(false);
  const [locationType, setLocationType] = useState("");
  const [dateType, setDateType] = useState("pickup");
  const staticCabs = [
    {
      id: 1,
      name: "Indica, Wagon R",
      type: "HATCHBACK",
      ac: true,
      seats: 4,
      description: t("cabSearch.economicalCarDesc"),
      kms: t("cabSearch.kmsIncluded", { kms: 197, rate: 8.5 }),
      cancel: t("cabSearch.freeCancellationHour"),
      reserve: t("cabSearch.reserveAtOnly", { amount: 458 }),
      carType: t("cabSearch.cngCar"),
      price: "₹1589",
      originalPrice: "₹1889",
      discount: `16% ${t("cabSearch.off")}`,
      rating: "4.5/5",
      ratingsCount: t("cabSearch.ratingsCount", { count: 811 }),
      options: 2,
      optionButtons: [
        { type: "DIESEL", price: "₹2315" },
        { type: "PETROL", price: "₹2599" }
      ],
      image: "https://gos3.ibcdn.com/hatchback_v_5_copy-1576142454.png"
    },
    {
      id: 2,
      name: "Swift Dzire, Etios",
      type: "SEDAN",
      ac: true,
      seats: 4,
      description: t("cabSearch.comfortableRideDesc"),
      kms: t("cabSearch.kmsIncluded", { kms: 197, rate: 9 }),
      cancel: t("cabSearch.freeCancellationHour"),
      carType: t("cabSearch.petrolCar"),
      price: "₹1789",
      originalPrice: "₹1989",
      discount: `10% ${t("cabSearch.off")}`,
      rating: "4.2/5",
      ratingsCount: t("cabSearch.ratingsCount", { count: 512 }),
      options: 1,
      optionButtons: [{ type: "AUTO", price: "₹2899" }],
      image: "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png"
    },
    {
      id: 3,
      name: "Innova, Ertiga",
      type: "SUV",
      ac: true,
      seats: 6,
      description: t("cabSearch.spaciousCarDesc"),
      kms: t("cabSearch.kmsIncluded", { kms: 197, rate: 12 }),
      cancel: t("cabSearch.freeCancellationHour"),
      carType: t("cabSearch.dieselCar"),
      price: "₹2499",
      originalPrice: "₹2999",
      discount: `15% ${t("cabSearch.off")}`,
      rating: "4.7/5",
      ratingsCount: t("cabSearch.ratingsCount", { count: 315 }),
      options: 1,
      optionButtons: [{ type: "PREMIUM", price: "₹3499" }],
      image: "https://gos3.ibcdn.com/suv_v_1_copy-1576142510.png"
    }
  ];
  const transformApiCabs = (apiCabs) => {
    if (!apiCabs || apiCabs.length === 0) return [];
    return apiCabs.map((cab, index) => {
      var _a2, _b2, _c;
      const getImage = () => {
        var _a3, _b3, _c2, _d;
        if (cab.primaryImage) return cab.primaryImage;
        if (cab.images && Array.isArray(cab.images) && cab.images.length > 0) {
          const front = cab.images.find((img) => img.view === "front");
          return (front == null ? void 0 : front.url) || ((_a3 = cab.images[0]) == null ? void 0 : _a3.url);
        }
        if ((_b3 = cab.images) == null ? void 0 : _b3.frontView) return cab.images.frontView;
        if ((_d = (_c2 = cab.vehicleDetails) == null ? void 0 : _c2.images) == null ? void 0 : _d.frontView) return cab.vehicleDetails.images.frontView;
        return "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png";
      };
      return {
        id: cab.groupId || cab.vehicleId || index + 1,
        // NEW: Store groupId and modelId for booking
        groupId: cab.groupId,
        modelId: cab.modelId,
        vehicleId: cab.vehicleId || null,
        // May be null in grouped results
        // Display name: use modelNames array or vehicleName
        name: ((_a2 = cab.modelNames) == null ? void 0 : _a2.join(", ")) || cab.vehicleName || "Unknown Vehicle",
        orSimilar: cab.orSimilar || false,
        // Show "Or Similar" badge
        type: (cab.category || "SEDAN").toUpperCase(),
        ac: cab.isAc !== false,
        seats: cab.seats || 4,
        description: cab.description || "Comfortable ride",
        kms: `${cab.includedKm || 10} kms included. After that ₹${cab.extraKmRate || 10}/km`,
        cancel: cab.cancellationPolicy || "Free cancellation until 1 hour before pickup",
        reserve: cab.reserveAmount ? `Reserve this cab at ₹${cab.reserveAmount} only` : null,
        carType: `${cab.tier || "Standard"} Car`,
        price: `₹${cab.finalPrice !== void 0 ? cab.finalPrice : ((_b2 = cab.fare) == null ? void 0 : _b2.total) || 0}`,
        originalPrice: cab.originalPrice ? `₹${cab.originalPrice}` : null,
        discount: ((_c = cab.discount) == null ? void 0 : _c.hasDiscount) ? `${cab.discount.discountValue}% off` : null,
        rating: "4.5/5",
        ratingsCount: `${Math.floor(Math.random() * 500) + 100} ratings`,
        // Availability info (new)
        vendorCount: cab.vendorCount || 0,
        vehicleCount: cab.vehicleCount || 0,
        options: 0,
        optionButtons: [],
        image: getImage(),
        // Store original data for booking
        _original: cab,
        // Rental details (if rental trip)
        rentalDetails: cab.rentalDetails || null
      };
    });
  };
  const cabs = useMemo(() => {
    if (searchResults.cabs) {
      if (searchResults.cabs.length > 0) {
        const transformed = transformApiCabs(searchResults.cabs);
        return transformed;
      }
      console.log("API returned 0 cabs");
      return [];
    }
    console.log("Falling back to static cabs (Initial Load)");
    return staticCabs;
  }, [searchResults.cabs]);
  const [selectedModels, setSelectedModels] = useState([]);
  const [selectedSeats, setSelectedSeats] = useState([]);
  const filterOptions = useMemo(() => {
    if (!cabs || cabs.length === 0) {
      return { models: [], seats: [], minPrice: 0, maxPrice: 1e5 };
    }
    const models = /* @__PURE__ */ new Set();
    const seats = /* @__PURE__ */ new Set();
    let minP = Infinity;
    let maxP = -Infinity;
    cabs.forEach((cab) => {
      if (cab.name) {
        const names = cab.name.replace(/ or similar/gi, "").split(",");
        names.forEach((n) => models.add(n.trim()));
      }
      if (cab.seats) seats.add(cab.seats);
      const priceVal = typeof cab.price === "string" ? parseInt(cab.price.replace(/[^\d]/g, "")) : cab.price;
      if (!isNaN(priceVal)) {
        if (priceVal < minP) minP = priceVal;
        if (priceVal > maxP) maxP = priceVal;
      }
    });
    return {
      models: Array.from(models).sort(),
      seats: Array.from(seats).sort((a, b) => a - b),
      minPrice: minP === Infinity ? 0 : minP,
      maxPrice: maxP === -Infinity ? 1e4 : maxP
    };
  }, [cabs]);
  useEffect(() => {
    if (filterOptions.minPrice !== 0 && filterOptions.maxPrice !== 1e4) {
      setPriceRange([filterOptions.minPrice, filterOptions.maxPrice]);
    }
  }, [filterOptions.minPrice, filterOptions.maxPrice]);
  const filteredCabs = useMemo(() => {
    if (!cabs) return [];
    return cabs.filter((cab) => {
      const priceVal = typeof cab.price === "string" ? parseInt(cab.price.replace(/[^\d]/g, "")) : cab.price;
      if (!isNaN(priceVal)) {
        if (priceVal < priceRange[0] || priceVal > priceRange[1]) return false;
      }
      if (selectedModels.length > 0) {
        let hasMatch = false;
        if (cab.name) {
          const names = cab.name.replace(/ or similar/gi, "").split(",").map((n) => n.trim());
          if (names.some((n) => selectedModels.includes(n))) hasMatch = true;
        }
        if (!hasMatch) return false;
      }
      if (selectedSeats.length > 0) {
        if (!selectedSeats.includes(cab.seats)) return false;
      }
      return true;
    });
  }, [cabs, priceRange, selectedModels, selectedSeats]);
  const toggleModel = (model) => {
    setSelectedModels(
      (prev) => prev.includes(model) ? prev.filter((m) => m !== model) : [...prev, model]
    );
  };
  const toggleSeat = (seat) => {
    setSelectedSeats(
      (prev) => prev.includes(seat) ? prev.filter((s) => s !== seat) : [...prev, seat]
    );
  };
  const resetFilters = () => {
    setSelectedModels([]);
    setSelectedSeats([]);
    setPriceRange([filterOptions.minPrice, filterOptions.maxPrice]);
  };
  useEffect(() => {
    var _a2, _b2, _c, _d, _e, _f, _g, _h, _i;
    if (searchResults.distance && searchResults.distance > 0) {
      setSearchCoordinates((prev) => ({
        ...prev,
        distance: searchResults.distance,
        duration: searchResults.estimatedDuration || prev.duration
      }));
      return;
    }
    if (searchResults.cabs && searchResults.cabs.length > 0) {
      const firstCab = searchResults.cabs[0];
      const apiDistance = ((_a2 = firstCab == null ? void 0 : firstCab.tripDetails) == null ? void 0 : _a2.distance) || ((_b2 = firstCab == null ? void 0 : firstCab.tripDetails) == null ? void 0 : _b2.totalDistance) || ((_d = (_c = firstCab == null ? void 0 : firstCab._original) == null ? void 0 : _c.tripDetails) == null ? void 0 : _d.distance) || ((_f = (_e = firstCab == null ? void 0 : firstCab._original) == null ? void 0 : _e.tripDetails) == null ? void 0 : _f.totalDistance) || 0;
      const apiDuration = ((_g = firstCab == null ? void 0 : firstCab.tripDetails) == null ? void 0 : _g.estimatedDuration) || ((_i = (_h = firstCab == null ? void 0 : firstCab._original) == null ? void 0 : _h.tripDetails) == null ? void 0 : _i.estimatedDuration) || 0;
      if (apiDistance > 0) {
        setSearchCoordinates((prev) => ({
          ...prev,
          distance: apiDistance,
          duration: apiDuration
        }));
        console.log(`Using API distance: ${apiDistance} km, duration: ${apiDuration} mins`);
      }
    }
  }, [searchResults.cabs, searchResults.distance]);
  const formatDuration = (minutes) => {
    if (!minutes || minutes === 0) return "Calculating...";
    const hours = Math.floor(minutes / 60);
    const mins = minutes % 60;
    if (hours > 0) {
      return `${hours}h ${mins}m`;
    }
    return `${mins}m`;
  };
  ({
    totalDistance: searchCoordinates.distance || 0,
    estimatedDuration: formatDuration(searchCoordinates.duration)
  });
  const [currentDisplayDate, setCurrentDisplayDate] = useState(/* @__PURE__ */ new Date());
  const getDaysInMonth = (date) => {
    return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
  };
  const getFirstDayOfMonth = (date) => {
    return new Date(date.getFullYear(), date.getMonth(), 1).getDay();
  };
  const generateCalendarDays = () => {
    const daysInMonth = getDaysInMonth(currentDisplayDate);
    const firstDay = getFirstDayOfMonth(currentDisplayDate);
    const days = [];
    const startOffset = firstDay === 0 ? 6 : firstDay - 1;
    for (let i = 0; i < startOffset; i++) {
      days.push({ day: "", otherMonth: true });
    }
    for (let i = 1; i <= daysInMonth; i++) {
      days.push({
        day: i.toString(),
        date: new Date(currentDisplayDate.getFullYear(), currentDisplayDate.getMonth(), i)
      });
    }
    return days;
  };
  const calendarDays = generateCalendarDays();
  const changeMonth = (offset) => {
    const newDate = new Date(currentDisplayDate);
    newDate.setMonth(newDate.getMonth() + offset);
    setCurrentDisplayDate(newDate);
  };
  const generateTimeSlots = () => {
    const times = [];
    for (let hour = 0; hour < 24; hour++) {
      for (let minute = 0; minute < 60; minute += 15) {
        const period = hour >= 12 ? "PM" : "AM";
        const displayHour = hour % 12 || 12;
        const timeString = `${displayHour}:${minute.toString().padStart(2, "0")} ${period}`;
        times.push(timeString);
      }
    }
    return times;
  };
  const timeSlots = generateTimeSlots();
  const recentSearches = [
    { location: "Bhopal, Madhya Pradesh, India", query: "bhopal" },
    {
      location: "Ujjain Mahakal Mandir, Mahakal Lok Corridor Road, Bagambag Colony, Ujjain, Madhya Pradesh, India",
      query: "ujjain"
    },
    { location: "Bhopal, Madhya Pradesh, India", query: "bhopal" }
  ];
  const tripTypeOptions = [
    { value: "oneway", label: t("tripTypes.oneway") },
    { value: "round", label: t("tripTypes.round") },
    { value: "airport", label: t("tripTypes.airport") },
    { value: "rental", label: t("tripTypes.hourly") }
  ];
  const handleLocationSelect = (location2) => {
    if (locationType === "from") {
      setFromLocation(location2);
    } else if (locationType === "to") {
      setToLocation(location2);
    }
    setShowLocationModal(false);
  };
  const handleDateSelect = (dayObj) => {
    if (dayObj && !dayObj.otherMonth && dayObj.date) {
      const dateStr = dayObj.date.toLocaleDateString("en-GB", {
        day: "numeric",
        month: "short",
        year: "numeric"
      });
      if (dateType === "return") {
        setReturnDate(dateStr);
      } else {
        setPickupDate(dateStr);
      }
      setShowDateModal(false);
    }
  };
  const handleTimeSelect = (time) => {
    setPickupTime(time);
    setShowTimeModal(false);
  };
  const addStop = () => {
    setStops([...stops, { id: Date.now(), value: "" }]);
  };
  const removeStop = (id) => {
    setStops(stops.filter((stop) => stop.id !== id));
  };
  const handleStopChange = (id, value) => {
    setStops(stops.map((stop) => stop.id === id ? { ...stop, value } : stop));
  };
  const handleUpdateSearch = async () => {
    if ((tripType === "round" || tripType === "roundTrip") && !returnDate) {
      toast$2.error("Please select a return date for round trip");
      return;
    }
    let sourceCoords;
    if (fromLocation === "Current Location" && currentUserLocation) {
      sourceCoords = currentUserLocation;
    } else {
      sourceCoords = await geocodeLocation(fromLocation);
    }
    if (!sourceCoords) {
      toast$2.error(`Could not find location: ${fromLocation}`);
      return;
    }
    let destCoords = null;
    if (tripType !== "rental") {
      if (toLocation === "Current Location" && currentUserLocation) {
        destCoords = currentUserLocation;
      } else {
        destCoords = await geocodeLocation(toLocation);
      }
      if (!destCoords) {
        toast$2.error(`Could not find drop location: ${toLocation}`);
        return;
      }
    } else {
      if (!selectedRentalPackage) {
        toast$2.error("Please select a rental package");
        return;
      }
    }
    const validStops = [];
    if (stops.length > 0) {
      for (const stop of stops) {
        if (!stop.value || stop.value.trim() === "") continue;
        const stopCoords = await geocodeLocation(stop.value);
        if (stopCoords) {
          validStops.push({
            address: stop.value,
            coordinates: [stopCoords.lng, stopCoords.lat],
            // GeoJSON order: [lng, lat]
            stopOrder: validStops.length + 1
          });
        }
      }
    }
    setSearchCoordinates({
      source: sourceCoords,
      dest: destCoords,
      distance: 0,
      // Will be updated from API response
      duration: 0
    });
    const searchParams = {
      sourceLat: sourceCoords.lat,
      sourceLong: sourceCoords.lng,
      destLat: destCoords == null ? void 0 : destCoords.lat,
      destLong: destCoords == null ? void 0 : destCoords.lng,
      tripType: tripType === "oneway" ? "oneWay" : tripType === "round" ? "roundTrip" : tripType,
      // distance: distanceParam,
      fuelType: "petrol",
      // Search uses petrol as default, actual fuelType from vehicle not needed for search
      isAc: true,
      pickupDate,
      pickupTime,
      returnDate,
      startTime: (/* @__PURE__ */ new Date()).toISOString(),
      rentalPackage: tripType === "rental" ? selectedRentalPackage : void 0,
      stops: validStops.length > 0 ? validStops : void 0,
      page: 1,
      limit: 10
    };
    dispatch(searchCabs(searchParams));
  };
  useEffect(() => {
    const initSearch = async () => {
      var _a2;
      if ((_a2 = location.state) == null ? void 0 : _a2.searchParams) {
        const params = location.state.searchParams;
        console.log("=== SEARCH PARAMS (Checking Coordinates) ===");
        console.log("Source:", params.from, "Lat:", params.sourceLat, "Lng:", params.sourceLong);
        console.log("Dest:", params.to, "Lat:", params.destLat, "Lng:", params.destLong);
        let finalParams = { ...params };
        let sourceCoords = { lat: params.sourceLat, lng: params.sourceLong };
        let destCoords = { lat: params.destLat, lng: params.destLong };
        if (params.from) setFromLocation(params.from);
        if (params.to) setToLocation(params.to);
        if (params.tripType) {
          const uiTripType = params.tripType === "oneWay" ? "oneway" : params.tripType === "roundTrip" ? "round" : params.tripType;
          setTripType(uiTripType);
        }
        if (params.pickupDate) setPickupDate(params.pickupDate);
        if (params.returnDate) setReturnDate(params.returnDate);
        if (params.pickupTime) setPickupTime(params.pickupTime);
        if (params.rentalPackage) {
          setSelectedRentalPackage(params.rentalPackage);
        }
        if (!params.sourceLat || !params.sourceLong) {
          if (params.from) {
            const coords = await geocodeLocation(params.from);
            if (coords) {
              finalParams.sourceLat = coords.lat;
              finalParams.sourceLong = coords.lng;
              sourceCoords = coords;
            }
          }
        }
        if ((!params.destLat || !params.destLong) && params.to) {
          const coords = await geocodeLocation(params.to);
          if (coords) {
            finalParams.destLat = coords.lat;
            finalParams.destLong = coords.lng;
            destCoords = coords;
          }
        }
        setSearchCoordinates({
          source: sourceCoords,
          dest: destCoords,
          distance: params.distance || 0,
          // Will be updated from API response
          duration: 0
        });
        if (finalParams.sourceLat && finalParams.sourceLong) {
          dispatch(searchCabs(finalParams));
        }
      }
    };
    initSearch();
    return () => {
      dispatch(resetSearchResults$1());
    };
  }, [dispatch, location.state]);
  const [expandedCabId, setExpandedCabId] = useState(null);
  const handleBookingSelect = (cab) => {
    var _a2, _b2, _c, _d, _e, _f, _g;
    if (!isLoggedIn) {
      toast$2.error("Please login to proceed with booking");
      return;
    }
    navigate(`/details/${cab.id}`, {
      state: {
        // NEW: Pass groupId and modelId for new booking system
        groupId: cab.groupId,
        modelId: cab.modelId,
        vehicleId: cab.vehicleId || null,
        // May be null in grouped results
        zoneId: (_b2 = (_a2 = cab._original) == null ? void 0 : _a2.zone) == null ? void 0 : _b2.id,
        // Pass addresses from state
        pickupAddress: fromLocation,
        dropAddress: toLocation,
        picklat: (_c = searchCoordinates.source) == null ? void 0 : _c.lat,
        picklng: (_d = searchCoordinates.source) == null ? void 0 : _d.lng,
        droplat: (_e = searchCoordinates.dest) == null ? void 0 : _e.lat,
        droplng: (_f = searchCoordinates.dest) == null ? void 0 : _f.lng,
        distance: searchCoordinates.distance,
        duration: searchCoordinates.duration,
        tripType: tripType === "oneway" ? "oneWay" : tripType === "round" ? "roundTrip" : tripType,
        pickupDate,
        pickupTime,
        returnDate,
        fuelType: cab.fuelType || ((_g = cab._original) == null ? void 0 : _g.fuelType) || "petrol",
        isAc: cab.isAc !== void 0 ? cab.isAc : true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        vehicleData: cab._original,
        rentalPackage: tripType === "rental" ? selectedRentalPackage : void 0,
        stops: stops.length > 0 ? stops.filter((s) => s.value).map((s, i) => ({
          address: s.value,
          stopOrder: i + 1
        })) : void 0
      }
    });
  };
  const KnowMoreModal = () => {
    return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-8", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-3xl max-w-2xl w-full h-[650px] p-6 text-center", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-black", children: t("cabSearch.title") }),
      /* @__PURE__ */ jsx(
        "img",
        {
          src: "https://gos3.ibcdn.com/cabsOs-1653903067.png",
          alt: "Outstation Cabs",
          className: "mx-auto mb-4  mt-24 object-contain"
        }
      ),
      /* @__PURE__ */ jsx("ul", { className: "space-y-3 text-left mb-6 text-black px-8", children: /* @__PURE__ */ jsxs("li", { className: "flex items-start", children: [
        /* @__PURE__ */ jsx("span", { className: "mr-2 text-3xl text-gray-500", children: "•" }),
        /* @__PURE__ */ jsx("span", { children: t("cabInfo.description") })
      ] }) }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setShowKnowMore(false),
          className: "bg-blue-100 hover:bg-blue-200 text-blue-700 font-medium px-6 py-2 rounded-full transition-all duration-300 shadow-md hover:shadow-lg",
          children: t("common.ok")
        }
      )
    ] }) });
  };
  const LocationModal = () => {
    const [searchText, setSearchText] = useState("");
    const handleCurrentLocation = () => {
      if ("geolocation" in navigator) {
        navigator.geolocation.getCurrentPosition(
          (position) => {
            setCurrentUserLocation({
              lat: position.coords.latitude,
              lng: position.coords.longitude
            });
            handleLocationSelect("Current Location");
          },
          (error) => {
            console.error("Error getting location:", error);
            toast$2.error(t("errors.locationError"));
          }
        );
      } else {
        toast$2.error(t("errors.geolocationNotSupported"));
      }
    };
    return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
      /* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: locationType === "from" ? t("hero.from").toUpperCase() : t("hero.to").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: () => setShowLocationModal(false),
              className: "p-1 text-gray-500 hover:text-gray-700",
              children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
            }
          )
        ] }),
        /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
          LocationAutocomplete,
          {
            value: searchText,
            onChange: (newValue) => {
              setSearchText(newValue);
            },
            onLocationSelect: handleLocationSelect,
            placeholder: `${t("common.search")} ${locationType === "from" ? t("hero.from") : t("hero.to")}...`,
            label: `${t("common.enter")} ${locationType === "from" ? t("hero.from") : t("hero.to")} ${t("common.location")}`
          }
        ) })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: handleCurrentLocation,
            className: "flex items-center gap-2 text-blue-600 text-sm font-medium mb-4 hover:bg-blue-50 p-2 rounded w-full transition-colors",
            children: [
              /* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
              t("common.useCurrentLocation")
            ]
          }
        ),
        /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4", children: [
          /* @__PURE__ */ jsx("h4", { className: "text-sm font-medium text-gray-700 mb-3", children: t("common.recentSearches") }),
          /* @__PURE__ */ jsx("div", { className: "space-y-3", children: recentSearches.map((search, index) => /* @__PURE__ */ jsxs(
            "div",
            {
              className: "flex flex-col cursor-pointer hover:bg-gray-50 p-2 rounded",
              onClick: () => handleLocationSelect(search.location),
              children: [
                /* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-gray-900", children: search.location }),
                /* @__PURE__ */ jsx("span", { className: "text-xs text-gray-500", children: search.query })
              ]
            },
            index
          )) })
        ] })
      ] })
    ] }) });
  };
  const StopsModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: t("hero.addStops") }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setShowStopsModal(false),
          className: "p-1 text-gray-500 hover:text-gray-700",
          children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
        }
      )
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      stops.map((stop, index) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
        /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mb-2", children: [
          t("tripDetails.stop"),
          " ",
          index + 1
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "text",
              value: stop.value,
              onChange: (e) => handleStopChange(stop.id, e.target.value),
              className: "flex-1 border text-black border-gray-300 rounded-lg px-3 py-2 text-sm",
              placeholder: t("hero.enterStop")
            }
          ),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: () => removeStop(stop.id),
              className: "text-gray-500 hover:text-red-500",
              children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
            }
          )
        ] })
      ] }, stop.id)),
      /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: addStop,
          className: "flex items-center gap-2 text-blue-600 text-sm font-medium mt-4",
          children: [
            /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
            t("hero.addStops"),
            /* @__PURE__ */ jsx("span", { className: "ml-1 bg-pink-600 text-white text-[10px] px-1.5 py-0.5 rounded", children: t("hero.new") })
          ]
        }
      )
    ] }),
    /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-gray-200", children: /* @__PURE__ */ jsx(
      "button",
      {
        onClick: () => setShowStopsModal(false),
        className: "w-full bg-blue-600 text-white py-3 rounded-lg font-semibold",
        children: t("common.done") || "DONE"
      }
    ) })
  ] }) });
  const DateModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: dateType === "return" ? "RETURN DATE" : "PICKUP DATE" }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setShowDateModal(false),
          className: "p-1 text-gray-500 hover:text-gray-700",
          children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
        }
      )
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4 text-gray-900", children: [
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(-1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 rotate-90" }) }),
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold uppercase", children: currentDisplayDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 -rotate-90" }) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-2", children: ["MON", "TUE", "WED", "THU", "FRI", "SAT", "SUN"].map((day) => /* @__PURE__ */ jsx(
        "div",
        {
          className: "text-center text-xs text-gray-500 font-medium py-2",
          children: day
        },
        day
      )) }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: calendarDays.map((dayObj, index) => {
        var _a2;
        const currentDateStr = (_a2 = dayObj.date) == null ? void 0 : _a2.toLocaleDateString("en-GB", {
          day: "numeric",
          month: "short",
          year: "numeric"
        });
        const isSelected = currentDateStr === (dateType === "return" ? returnDate : pickupDate);
        return /* @__PURE__ */ jsx(
          "div",
          {
            className: `h-10 flex items-center justify-center rounded-full text-sm font-medium cursor-pointer
                  ${!dayObj.day || dayObj.otherMonth ? "text-transparent pointer-events-none" : "text-gray-700 hover:bg-gray-100"}
                  ${isSelected ? "bg-orange-500 text-white hover:bg-orange-600" : ""}
                `,
            onClick: () => handleDateSelect(dayObj),
            children: dayObj.day
          },
          index
        );
      }) }),
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between mt-4 text-sm font-bold", children: [
        /* @__PURE__ */ jsx("span", { children: "¥2051" }),
        /* @__PURE__ */ jsx("span", { children: "¥1733" })
      ] })
    ] })
  ] }) });
  const TimeModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "PICKUP TIME" }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setShowTimeModal(false),
          className: "p-1 text-gray-500 hover:text-gray-700",
          children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" })
        }
      )
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto", children: /* @__PURE__ */ jsx("div", { className: "p-4", children: timeSlots.map((time, index) => /* @__PURE__ */ jsx(
      "div",
      {
        className: `py-3 border-b text-black border-gray-100 cursor-pointer hover:bg-gray-50 ${pickupTime === time ? "bg-blue-50" : ""}`,
        onClick: () => handleTimeSelect(time),
        children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: time })
      },
      index
    )) }) })
  ] }) });
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-h-screen bg-gray-50", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    showKnowMore && /* @__PURE__ */ jsx(KnowMoreModal, {}),
    showLocationModal && /* @__PURE__ */ jsx(LocationModal, {}),
    showStopsModal && /* @__PURE__ */ jsx(StopsModal, {}),
    showDateModal && /* @__PURE__ */ jsx(DateModal, {}),
    showTimeModal && /* @__PURE__ */ jsx(TimeModal, {}),
    /* @__PURE__ */ jsx("div", { className: "w-full bg-orange-500 py-4 px-4 mt-16", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-8 ml-8", children: [
        /* @__PURE__ */ jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "TRIP TYPE" }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md flex items-center gap-1 text-black min-w-[180px]",
              onClick: () => setShowTripTypeDropdown(!showTripTypeDropdown),
              children: [
                (_b = tripTypeOptions.find((opt) => opt.value === tripType)) == null ? void 0 : _b.label,
                /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
              ]
            }
          ),
          showTripTypeDropdown && /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 mt-1 bg-white text-black border border-gray-200 rounded-md shadow-lg z-10 min-w-[180px]", children: tripTypeOptions.map((option) => /* @__PURE__ */ jsx(
            "div",
            {
              className: `px-4 py-2 cursor-pointer hover:bg-gray-100 ${tripType === option.value ? "bg-blue-50 text-blue-600" : ""}`,
              onClick: () => {
                setTripType(option.value);
                setShowTripTypeDropdown(false);
              },
              children: option.label
            },
            option.value
          )) })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "FROM" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("from");
                setShowLocationModal(true);
              },
              children: fromLocation
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "mt-5 relative inline-block", children: [
          /* @__PURE__ */ jsx(
            "span",
            {
              className: "absolute -top-3 right-2 text-[11px] px-1.5 py-[1px] \r\n                bg-white text-purple-600 border border-black rounded-md \r\n               font-semibold shadow-sm",
              children: "new"
            }
          ),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3] shadow",
              onClick: () => setShowStopsModal(true),
              children: "+ Add Stops"
            }
          )
        ] }),
        tripType === "rental" ? /* @__PURE__ */ jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PACKAGE" }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[150px] flex items-center justify-between",
              onClick: () => setShowRentalPackageDropdown(!showRentalPackageDropdown),
              children: [
                selectedRentalPackage ? selectedRentalPackage.label : "Select Package",
                /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
              ]
            }
          ),
          showRentalPackageDropdown && /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 mt-1 bg-white text-black border border-gray-200 rounded-md shadow-lg z-10 min-w-[180px] max-h-60 overflow-y-auto", children: rentalPackages.map((pkg, idx) => /* @__PURE__ */ jsx(
            "div",
            {
              className: `px-4 py-2 cursor-pointer hover:bg-gray-100 ${selectedRentalPackage === pkg ? "bg-blue-50 text-blue-600" : ""}`,
              onClick: () => {
                setSelectedRentalPackage(pkg);
                setShowRentalPackageDropdown(false);
              },
              children: pkg.label
            },
            idx
          )) })
        ] }) : /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "TO" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("to");
                setShowLocationModal(true);
              },
              children: toLocation
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PICKUP DATE" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setShowDateModal(true);
                setDateType("pickup");
              },
              children: pickupDate
            }
          )
        ] }),
        (tripType === "round" || tripType === "roundTrip") && /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "RETURN DATE" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setShowDateModal(true);
                setDateType("return");
              },
              children: returnDate || "Select Date"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PICKUP TIME" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => setShowTimeModal(true),
              children: pickupTime
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
        "button",
        {
          onClick: handleUpdateSearch,
          disabled: searchLoading,
          className: `text-lg font-semibold bg-white px-4 py-2 rounded-md ${searchLoading ? "text-gray-400" : "text-[#2276e3]"}`,
          children: searchLoading ? "SEARCHING..." : "UPDATE SEARCH"
        }
      ) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "max-w-8xl mx-auto flex flex-col lg:flex-row gap-6 mt-6 px-4 sm:px-6 pb-10", children: [
      /* @__PURE__ */ jsxs("aside", { className: "w-full lg:w-1/4 bg-white p-5 shadow-sm rounded-lg h-fit sticky top-4", children: [
        /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold mb-3 text-black", children: "Why book one-way trip with us?" }),
          /* @__PURE__ */ jsxs("ul", { className: "text-sm text-black font-normal space-y-2", children: [
            /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-[#2276e3] p-1 bg-[#ddeafb] rounded-3xl", children: "✔" }),
              /* @__PURE__ */ jsx("span", { children: "Only one-side fare for your doorstep pickup & drop to destination" })
            ] }),
            /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-[#2276e3] p-1 bg-[#ddeafb] rounded-3xl", children: "✔" }),
              /* @__PURE__ */ jsx("span", { children: "No hidden charges - Pay nothing extra than what's mentioned" })
            ] }),
            /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-[#2276e3] p-1 bg-[#ddeafb] rounded-3xl", children: "✔" }),
              /* @__PURE__ */ jsx("span", { children: "Experienced & polite drivers with clean & comfortable cabs" })
            ] })
          ] }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: () => setShowKnowMore(true),
              className: "text-blue-600 text-sm mt-4 font-normal ml-16 cursor-pointer",
              children: "know more"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
            /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-800", children: "Filters" }),
            /* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-500", children: [
              "Showing ",
              filteredCabs.length,
              " Car variation"
            ] })
          ] }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: resetFilters,
              className: "text-red-500 text-sm font-medium mb-4 hover:underline",
              children: "CLEAR"
            }
          ),
          /* @__PURE__ */ jsxs("div", { className: "mb-6 border-b border-gray-200 pb-4", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-2", children: [
              /* @__PURE__ */ jsx("h4", { className: "font-medium text-gray-700", children: "Price Filter" }),
              /* @__PURE__ */ jsx(
                "button",
                {
                  onClick: () => setPriceRange([filterOptions.minPrice, filterOptions.maxPrice]),
                  className: "text-blue-600 text-sm font-medium hover:underline",
                  children: "RESET"
                }
              )
            ] }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "range",
                min: filterOptions.minPrice,
                max: filterOptions.maxPrice,
                value: priceRange[1],
                onChange: (e) => setPriceRange([priceRange[0], +e.target.value]),
                className: "w-full accent-blue-600 -mt-2"
              }
            ),
            /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-sm mt-2 text-black", children: [
              /* @__PURE__ */ jsxs("span", { children: [
                "₹",
                priceRange[0]
              ] }),
              /* @__PURE__ */ jsxs("span", { children: [
                "₹",
                priceRange[1]
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "mb-6 border-b border-gray-200 pb-4", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-2", children: [
              /* @__PURE__ */ jsx("h4", { className: "font-medium text-gray-700", children: "Car model" }),
              /* @__PURE__ */ jsx(
                "button",
                {
                  onClick: () => setSelectedModels([]),
                  className: "text-blue-600 text-sm font-medium hover:underline",
                  children: "RESET"
                }
              )
            ] }),
            /* @__PURE__ */ jsx("div", { className: "space-y-2 text-sm text-black max-h-48 overflow-y-auto", children: filterOptions.models.length > 0 ? filterOptions.models.map((model, idx) => /* @__PURE__ */ jsxs(
              "label",
              {
                className: "flex items-center gap-2 cursor-pointer hover:bg-gray-50 p-1 rounded",
                children: [
                  /* @__PURE__ */ jsx(
                    "input",
                    {
                      type: "checkbox",
                      className: "accent-blue-600",
                      checked: selectedModels.includes(model),
                      onChange: () => toggleModel(model)
                    }
                  ),
                  model
                ]
              },
              idx
            )) : /* @__PURE__ */ jsx("p", { className: "text-gray-400 text-xs text-center p-2", children: "No models available" }) })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "mb-6 border-b border-gray-200 pb-4", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-2", children: [
              /* @__PURE__ */ jsx("h4", { className: "font-medium text-gray-700", children: "Passenger capacity" }),
              /* @__PURE__ */ jsx(
                "button",
                {
                  onClick: () => setSelectedSeats([]),
                  className: "text-blue-600 text-sm font-medium hover:underline",
                  children: "RESET"
                }
              )
            ] }),
            /* @__PURE__ */ jsx("div", { className: "space-y-2 text-sm", children: filterOptions.seats.length > 0 ? filterOptions.seats.map((seat, idx) => /* @__PURE__ */ jsxs(
              "label",
              {
                className: "flex items-center gap-2 cursor-pointer text-black hover:bg-gray-50 p-1 rounded",
                children: [
                  /* @__PURE__ */ jsx(
                    "input",
                    {
                      type: "checkbox",
                      className: "accent-blue-600",
                      checked: selectedSeats.includes(seat),
                      onChange: () => toggleSeat(seat)
                    }
                  ),
                  seat,
                  " passenger seats"
                ]
              },
              idx
            )) : /* @__PURE__ */ jsx("p", { className: "text-gray-400 text-xs text-center p-2", children: "No options" }) })
          ] }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => window.scrollTo({ top: 0, behavior: "smooth" }),
              className: "w-full bg-[#f4f6fb] text-black font-medium py-3 rounded-lg mt-4 flex justify-center items-center gap-2",
              children: [
                "Back to Top ",
                /* @__PURE__ */ jsx("span", { className: "text-blue-600", children: "↑" })
              ]
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsxs("main", { className: "w-full lg:w-3/4", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-800 mb-4", children: tripType === "rental" ? `Hourly Rental | ${selectedRentalPackage ? `${selectedRentalPackage.hours} hrs ${selectedRentalPackage.distance} km package` : "Select a package"} | Pickup & Drop in same city` : `${tripType === "oneway" ? "One-way" : tripType === "round" || tripType === "roundTrip" ? "Round" : tripType === "airport" ? "Airport" : "One-way"} trip | Estimated distance: ${searchCoordinates.distance} kms | 1 pickup & 1 drop included` }),
        searchLoading && /* @__PURE__ */ jsxs("div", { className: "bg-blue-50 p-8 rounded-lg mb-6 border border-blue-100 text-center", children: [
          /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-10 w-10 border-b-2 border-blue-600 mx-auto mb-4" }),
          /* @__PURE__ */ jsx("p", { className: "text-blue-600 font-medium", children: "Searching for available cabs..." })
        ] }),
        searchError && /* @__PURE__ */ jsxs("div", { className: "bg-red-50 p-4 rounded-lg mb-6 border border-red-200", children: [
          /* @__PURE__ */ jsxs("p", { className: "text-red-600 font-medium", children: [
            "Error: ",
            searchError
          ] }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: handleUpdateSearch,
              className: "mt-2 text-sm text-blue-600 underline",
              children: "Try again"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-blue-50 p-4 rounded-lg mb-6 border border-blue-100", children: [
          /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-1", children: "Our Top Rated Partner" }),
          /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-2", children: [
            /* @__PURE__ */ jsx("span", { className: "text-blue-700 font-semibold", children: "India's Leading Outstation Cab Rentals Since 2006" }),
            /* @__PURE__ */ jsx("span", { className: "text-blue-600 font-bold", children: "SAVAARI" }),
            /* @__PURE__ */ jsx(
              "a",
              {
                href: "https://www.savaari.com",
                className: "text-blue-600 text-sm",
                children: "gosavaari.com"
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "space-y-5", children: !searchLoading && filteredCabs.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "bg-white p-10 rounded-lg shadow-md text-center border border-gray-200", children: [
          /* @__PURE__ */ jsx("div", { className: "text-5xl mb-4", children: "🚖" }),
          /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold text-gray-800", children: "No cabs available" }),
          /* @__PURE__ */ jsx("p", { className: "text-gray-600 mt-2", children: cabs.length > 0 ? "No cabs match your selected filters. Please try resetting filters." : "We couldn't find any vehicles for your selected route and time." }),
          cabs.length > 0 && /* @__PURE__ */ jsx(
            "button",
            {
              onClick: resetFilters,
              className: "mt-4 px-4 py-2 bg-blue-600 text-white rounded font-medium hover:bg-blue-700 transition",
              children: "Reset Filters"
            }
          )
        ] }) : filteredCabs.map((cab) => /* @__PURE__ */ jsxs(
          "div",
          {
            className: "bg-white rounded-lg shadow-md p-5 border border-gray-200 text-black",
            children: [
              /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start mb-4", children: [
                /* @__PURE__ */ jsxs("div", { children: [
                  /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold text-gray-900", children: cab.name }),
                  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-1", children: [
                    /* @__PURE__ */ jsx("span", { className: "text-xs font-medium bg-gray-100 px-2 py-1 rounded", children: cab.type }),
                    cab.ac && /* @__PURE__ */ jsx("span", { className: "text-xs font-medium bg-gray-100 px-2 py-1 rounded", children: "AC" }),
                    /* @__PURE__ */ jsxs("span", { className: "text-xs font-medium bg-gray-100 px-2 py-1 rounded", children: [
                      cab.seats,
                      " seats"
                    ] })
                  ] }),
                  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-2", children: [
                    /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-600", children: cab.ratingsCount }),
                    /* @__PURE__ */ jsx("button", { className: "bg-green-600 text-white text-xs px-2 py-1 rounded", children: cab.rating })
                  ] })
                ] }),
                /* @__PURE__ */ jsx("div", { className: "w-42 h-20 flex-shrink-0", children: /* @__PURE__ */ jsx(
                  "img",
                  {
                    src: cab.image,
                    alt: cab.name,
                    className: "w-full h-full object-cover rounded"
                  }
                ) })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4 mb-4", children: [
                /* @__PURE__ */ jsxs("div", { className: "md:col-span-2", children: [
                  /* @__PURE__ */ jsx("h4", { className: " text-black font-bold mb-2", children: cab.description }),
                  /* @__PURE__ */ jsxs("ul", { className: "text-semibold text-black space-y-1", children: [
                    cab.rentalDetails ? /* @__PURE__ */ jsxs(Fragment, { children: [
                      /* @__PURE__ */ jsxs("li", { children: [
                        "• ",
                        cab.rentalDetails.packageHours,
                        " hrs & ",
                        cab.rentalDetails.packageKm,
                        " km included"
                      ] }),
                      /* @__PURE__ */ jsxs("li", { children: [
                        "• Extra km charges: ₹",
                        cab.rentalDetails.extraFarePerKm,
                        "/km"
                      ] })
                    ] }) : /* @__PURE__ */ jsxs("li", { children: [
                      "• ",
                      cab.kms
                    ] }),
                    /* @__PURE__ */ jsxs("li", { children: [
                      "• ",
                      cab.cancel
                    ] }),
                    cab.reserve && /* @__PURE__ */ jsxs("li", { children: [
                      "• ",
                      cab.reserve
                    ] }),
                    /* @__PURE__ */ jsxs("li", { children: [
                      "• ",
                      cab.carType
                    ] })
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-red-500 text-sm font-medium mb-1", children: cab.discount }),
                  /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                    /* @__PURE__ */ jsx("span", { className: "text-gray-500 line-through text-sm", children: cab.originalPrice }),
                    /* @__PURE__ */ jsx("p", { className: "text-2xl font-bold text-orange-600", children: cab.price })
                  ] }),
                  /* @__PURE__ */ jsx(
                    "button",
                    {
                      onClick: () => handleBookingSelect(cab),
                      className: "bg-orange-500 hover:bg-orange-600 text-white font-medium px-6 py-2 rounded-md mt-2",
                      children: "SELECT"
                    }
                  )
                ] })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "border-t border-gray-200 pt-4 flex justify-between items-center", children: [
                /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
                  /* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-600", children: [
                    cab.options,
                    " more options available"
                  ] }),
                  cab.optionButtons.map((option, index) => /* @__PURE__ */ jsxs(
                    "button",
                    {
                      className: "text-xs border border-gray-300 px-3 py-1 rounded-md bg-white",
                      children: [
                        option.type,
                        " @ ",
                        option.price
                      ]
                    },
                    index
                  ))
                ] }),
                expandedCabId === cab.id ? /* @__PURE__ */ jsx(
                  "button",
                  {
                    onClick: () => setExpandedCabId(null),
                    className: ""
                  }
                ) : /* @__PURE__ */ jsx(
                  "button",
                  {
                    onClick: () => setExpandedCabId(cab.id),
                    className: "text-sm text-blue-600 font-medium border border-blue-600 px-3 py-1 rounded-md",
                    children: "SHOW ALL"
                  }
                )
              ] }),
              expandedCabId === cab.id && /* @__PURE__ */ jsxs("div", { className: "mt-4 space-y-0", children: [
                /* @__PURE__ */ jsxs("div", { className: "bg-white border border-gray-200 rounded-lg overflow-hidden", children: [
                  /* @__PURE__ */ jsx("div", { className: "bg-[#e6faff] text-sm text-[#007baf] font-medium px-4 py-2 border-b border-[#b8eaff]", children: "✨ Roof Carrier available with this car starting @ INR 157" }),
                  /* @__PURE__ */ jsxs("div", { className: "flex justify-between p-5", children: [
                    /* @__PURE__ */ jsxs("div", { className: "w-2/3", children: [
                      /* @__PURE__ */ jsxs("p", { className: "text-xl font-bold text-gray-900 mb-3 flex items-center gap-2", children: [
                        /* @__PURE__ */ jsx("span", { className: "w-1 h-6 bg-blue-600 rounded-sm" }),
                        "Comfortable car"
                      ] }),
                      /* @__PURE__ */ jsxs("ul", { className: "text-[15px] text-gray-800 space-y-3", children: [
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-lg", children: "✔" }),
                          "193 kms included. After that ₹18.5/km"
                        ] }),
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-lg", children: "✔" }),
                          "Free cancellation until 1 hour before pickup"
                        ] }),
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-lg", children: "✔" }),
                          "Reserve this cab at ₹797 only"
                        ] }),
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-gray-700 text-2xl", children: "⛽" }),
                          "Diesel Car"
                        ] })
                      ] })
                    ] }),
                    /* @__PURE__ */ jsxs("div", { className: "w-1/3 flex flex-col items-end justify-between", children: [
                      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-600 mb-4", children: [
                        "9 ratings",
                        /* @__PURE__ */ jsx("span", { className: "bg-green-600 text-white text-xs px-2 py-1 rounded", children: "4.1 / 5" })
                      ] }),
                      /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                        /* @__PURE__ */ jsx("span", { className: "text-red-500 text-xs font-bold bg-red-100 px-2 py-0.5 rounded", children: "15% off" }),
                        /* @__PURE__ */ jsx("div", { className: "text-gray-500 line-through text-sm", children: "₹3068" }),
                        /* @__PURE__ */ jsx("div", { className: "text-3xl font-bold text-gray-900", children: "₹2603" }),
                        /* @__PURE__ */ jsx("div", { className: "text-gray-500 text-xs", children: "+ ₹559 taxes & fees" }),
                        /* @__PURE__ */ jsx(
                          "button",
                          {
                            onClick: () => handleBookingSelect(cab),
                            className: "bg-orange-500 hover:bg-orange-600 text-white font-semibold px-8 py-2 rounded-md mt-3",
                            children: "SELECT"
                          }
                        )
                      ] })
                    ] })
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "bg-white border border-gray-200 rounded-lg overflow-hidden", children: [
                  /* @__PURE__ */ jsx("div", { className: "bg-[#e6faff] text-sm text-[#007baf] font-medium px-4 py-2 border-b border-[#b8eaff]", children: "✨ Roof Carrier available with this car starting @ INR 158" }),
                  /* @__PURE__ */ jsxs("div", { className: "flex justify-between p-5", children: [
                    /* @__PURE__ */ jsxs("div", { className: "w-2/3", children: [
                      /* @__PURE__ */ jsxs("p", { className: "text-xl font-bold text-gray-900 mb-3 flex items-center gap-2", children: [
                        /* @__PURE__ */ jsx("span", { className: "w-1 h-6 bg-blue-600 rounded-sm" }),
                        "Comfortable car"
                      ] }),
                      /* @__PURE__ */ jsxs("ul", { className: "text-[15px] text-gray-800 space-y-3", children: [
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-lg", children: "✔" }),
                          "193 kms included. After that ₹15.0/km"
                        ] }),
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-lg", children: "✔" }),
                          "Free cancellation until 1 hour before pickup"
                        ] }),
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-lg", children: "✔" }),
                          "Reserve this cab at ₹813 only"
                        ] }),
                        /* @__PURE__ */ jsxs("li", { className: "flex items-center gap-3", children: [
                          /* @__PURE__ */ jsx("span", { className: "text-gray-700 text-2xl", children: "⛽" }),
                          "Petrol Car"
                        ] })
                      ] })
                    ] }),
                    /* @__PURE__ */ jsxs("div", { className: "w-1/3 flex flex-col items-end justify-between", children: [
                      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm text-gray-600 mb-4", children: [
                        "35 ratings",
                        /* @__PURE__ */ jsx("span", { className: "bg-green-600 text-white text-xs px-2 py-1 rounded", children: "4.6 / 5" })
                      ] }),
                      /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                        /* @__PURE__ */ jsx("span", { className: "text-red-500 text-xs font-bold bg-red-100 px-2 py-0.5 rounded", children: "15% off" }),
                        /* @__PURE__ */ jsx("div", { className: "text-gray-500 line-through text-sm", children: "₹3163" }),
                        /* @__PURE__ */ jsx("div", { className: "text-3xl font-bold text-gray-900", children: "₹2686" }),
                        /* @__PURE__ */ jsx("div", { className: "text-gray-500 text-xs", children: "+ ₹556 taxes & fees" }),
                        /* @__PURE__ */ jsx(
                          "button",
                          {
                            onClick: () => handleBookingSelect(cab),
                            className: "bg-orange-500 hover:bg-orange-600 text-white font-semibold px-8 py-2 rounded-md mt-3",
                            children: "SELECT"
                          }
                        )
                      ] })
                    ] })
                  ] })
                ] }),
                /* @__PURE__ */ jsx("div", { className: "flex justify-end py-4 pr-2", children: /* @__PURE__ */ jsxs(
                  "button",
                  {
                    onClick: () => setExpandedCabId(null),
                    className: "text-lg font-semibold text-blue-600 flex items-center gap-1",
                    children: [
                      "HIDE ALL ",
                      /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 rotate-180" })
                    ]
                  }
                ) })
              ] })
            ]
          },
          cab.id
        )) })
      ] })
    ] }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const DetailPage = () => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z;
  const { id } = distExports.useParams();
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const dispatch = useDispatch();
  const { t } = useTranslation();
  const { bookingReview, reviewLoading, reviewError } = useSelector(
    (state) => state.booking
  );
  const [activeTab, setActiveTab] = useState("ALL");
  const [showFareBreakdown, setShowFareBreakdown] = useState(false);
  const [showCabDetails, setShowCabDetails] = useState(true);
  const [showCancel, setShowCancel] = useState(false);
  const [showOther, setShowOther] = useState(false);
  const [currentAmount, setCurrentAmount] = useState("");
  const [paymentType, setPaymentType] = useState("partial");
  const [showTraveller, setShowTraveller] = useState(false);
  useEffect(() => {
    const searchParams = location.state;
    if (searchParams && (searchParams.vehicleId || searchParams.groupId)) {
      dispatch(getBookingReview({
        // Pass vehicleId if available, otherwise pass groupId (backend handles groupId fallback)
        vehicleId: searchParams.vehicleId || searchParams.groupId,
        picklat: searchParams.picklat,
        picklng: searchParams.picklng,
        pickupAddress: searchParams.pickupAddress,
        pickupCity: searchParams.pickupCity,
        pickupState: searchParams.pickupState,
        droplat: searchParams.droplat,
        droplng: searchParams.droplng,
        dropAddress: searchParams.dropAddress,
        dropCity: searchParams.dropCity,
        dropState: searchParams.dropState,
        distance: searchParams.distance,
        tripType: searchParams.tripType || "oneWay",
        fuelType: searchParams.fuelType || "petrol",
        isAc: searchParams.isAc !== void 0 ? searchParams.isAc : true,
        scheduledTime: searchParams.scheduledTime,
        promoCode: searchParams.promoCode,
        rentalPackage: searchParams.rentalPackage
      }));
    }
    return () => {
      dispatch(resetBookingReview());
    };
  }, [dispatch, location.state]);
  const cabData = [
    {
      id: 1,
      name: "Indica, Wagon R",
      type: "HATCHBACK",
      ac: true,
      seats: 4,
      kms: "191 kms included. After that ₹18.0/km",
      cancel: "Free cancellation until 1 hour before pickup",
      carType: "CNG Car",
      price: "₹3204",
      partialPayment: "₹688",
      image: "https://gos3.ibcdn.com/hatchback_v_5_copy-1576142454.png"
    },
    {
      id: 2,
      name: "Swift Dzire, Etios",
      type: "SEDAN",
      ac: true,
      seats: 4,
      kms: "197 kms included. After that ₹9/km",
      cancel: "Free cancellation until 1 hour before pickup",
      carType: "Petrol Car",
      price: "₹2789",
      partialPayment: "₹556",
      image: "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png"
    },
    {
      id: 3,
      name: "Innova, Ertiga",
      type: "SUV",
      ac: true,
      seats: 6,
      kms: "197 kms included. After that ₹12/km",
      cancel: "Free cancellation until 1 hour before pickup",
      carType: "Diesel Car",
      price: "₹3499",
      partialPayment: "₹700",
      image: "https://gos3.ibcdn.com/hatchback_v_5_copy-1576142454.png"
    }
  ];
  const imageData = {
    ALL: [
      "https://go-assets.ibcdn.com/u/MMT/images/1732607472482-hatchback_Unknown_Unknown_EXTERIOR_Front_view_.jpeg",
      "https://go-assets.ibcdn.com/u/MMT/images/1732607474462-hatchback_Unknown_Unknown_EXTERIOR_Side_View.jpeg"
    ],
    BOOT: [
      "https://go-assets.ibcdn.com/u/MMT/images/1732607480576-hatchback_Unknown_Unknown_BOOT_Sufficient_boot_space_for_2_bags.jpeg"
    ],
    EXTERIOR: [
      "https://go-assets.ibcdn.com/u/MMT/images/1732607472482-hatchback_Unknown_Unknown_EXTERIOR_Front_view_.jpeg",
      "https://go-assets.ibcdn.com/u/MMT/images/1732607474462-hatchback_Unknown_Unknown_EXTERIOR_Side_View.jpeg"
    ],
    INTERIOR: [
      "https://go-assets.ibcdn.com/u/MMT/images/1732607476045-hatchback_Unknown_Unknown_INTERIOR_Dashboard,_leg_space_in_front_seat.jpeg",
      "https://go-assets.ibcdn.com/u/MMT/images/1732607478924-hatchback_Unknown_Unknown_INTERIOR_Ample_leg_space_in_back_seat.jpeg"
    ]
  };
  let cab = null;
  if (bookingReview && bookingReview.vehicle) {
    const { vehicle, pricing } = bookingReview;
    const partialOption = (_a = bookingReview.paymentOptions) == null ? void 0 : _a.find((p) => p.type === "partial");
    cab = {
      id: vehicle.id,
      registrationNumber: vehicle.registrationNumber,
      name: vehicle.name,
      type: vehicle.category,
      ac: vehicle.isAc,
      seats: vehicle.seats,
      kms: `${vehicle.includedKm} ${t("cabSearch.includedKm") || "included"}. ${t("cabSearch.afterThat")} ₹${vehicle.extraKmRate}/${t("cabSearch.perKm")}`,
      cancel: vehicle.cancellationPolicy,
      carType: `${vehicle.fuelType} Car`,
      price: `₹${pricing.finalTotal}`,
      partialPayment: `₹${(partialOption == null ? void 0 : partialOption.amount) || Math.round(pricing.finalTotal * 0.2)}`,
      image: vehicle.image || ((_c = (_b = bookingReview.categoryImages) == null ? void 0 : _b.images) == null ? void 0 : _c.front) || "https://gos3.ibcdn.com/hatchback_v_5_copy-1576142454.png"
    };
    if ((_d = bookingReview.categoryImages) == null ? void 0 : _d.images) {
      const apiImages = bookingReview.categoryImages.images;
      imageData.ALL = apiImages.all || imageData.ALL;
      imageData.EXTERIOR = [apiImages.front, apiImages.exterior].filter(Boolean);
      imageData.INTERIOR = [apiImages.interior].filter(Boolean);
      imageData.BOOT = [apiImages.boot].filter(Boolean);
    }
  } else {
    cab = cabData.find((c) => c.id.toString() === id);
  }
  useEffect(() => {
    if (cab) {
      setCurrentAmount(paymentType === "partial" ? cab.partialPayment : cab.price);
    }
  }, [cab, paymentType]);
  if (reviewLoading) {
    return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center min-h-screen bg-gray-50", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-orange-500 mb-4" }),
      /* @__PURE__ */ jsx("div", { className: "text-gray-600 font-medium", children: "Loading booking details..." })
    ] });
  }
  if (reviewError) {
    const isNoVehicle = reviewError.includes("No vehicles available") || reviewError.includes("Vehicle not found");
    return /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-h-screen bg-gray-50", children: [
      /* @__PURE__ */ jsx(Navbar, {}),
      /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center justify-center flex-1 px-4 pt-20", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-lg p-8 max-w-md w-full text-center", children: [
        /* @__PURE__ */ jsx("div", { className: "w-16 h-16 mx-auto mb-4 bg-orange-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx("svg", { className: "w-8 h-8 text-orange-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" }) }) }),
        /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-800 mb-2", children: isNoVehicle ? "No Vehicles Available" : "Error Loading Details" }),
        /* @__PURE__ */ jsx("p", { className: "text-gray-600 mb-6", children: isNoVehicle ? "All vehicles in this category are currently booked or unavailable. Please try a different category or check back later." : reviewError }),
        /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: () => navigate(-1),
              className: "bg-orange-500 hover:bg-orange-600 text-white px-6 py-3 rounded-lg font-semibold transition",
              children: "Go Back to Search"
            }
          ),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: () => navigate("/"),
              className: "text-blue-600 hover:text-blue-700 font-medium",
              children: "Return to Home"
            }
          )
        ] })
      ] }) }),
      /* @__PURE__ */ jsx(Footer, {})
    ] });
  }
  if (!cab) {
    return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center min-h-screen bg-gray-50", children: [
      /* @__PURE__ */ jsx("div", { className: "text-gray-800 font-bold text-xl mb-2", children: "Cab not found" }),
      /* @__PURE__ */ jsx("p", { className: "text-gray-600 mb-4", children: "We couldn't find the details for this cab." }),
      /* @__PURE__ */ jsx("button", { onClick: () => navigate(-1), className: "bg-orange-500 text-white px-6 py-2 rounded", children: "Go Back" })
    ] });
  }
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-h-screen text-black bg-[#eef4fd] font-['Rubik']", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "w-full h-80 bg-[#da6702] rounded-b-[80%] pt-8 px-36 text-white", children: [
      /* @__PURE__ */ jsx("div", { className: "mb-8", children: /* @__PURE__ */ jsx("h2", { className: "text-2xl text-white mt-12 font-bold", children: t("booking.reviewYourBooking") }) }),
      /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxs("h3", { className: "text-xl font-medium", children: [
        (_f = (_e = location.state) == null ? void 0 : _e.pickupAddress) == null ? void 0 : _f.split(",")[0],
        " - ",
        (_h = (_g = location.state) == null ? void 0 : _g.dropAddress) == null ? void 0 : _h.split(",")[0]
      ] }) }),
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsxs("h3", { className: "text-xl font-medium", children: [
            (() => {
              var _a2;
              const type = (_a2 = location.state) == null ? void 0 : _a2.tripType;
              if (type === "round" || type === "roundTrip") return t("tripTypes.round");
              if (type === "airport") return t("tripTypes.airport");
              if (type === "rental") return t("tripTypes.hourly");
              return t("tripTypes.oneway");
            })(),
            " |"
          ] }),
          /* @__PURE__ */ jsx("hr", { className: "border-white my-2" }),
          /* @__PURE__ */ jsxs("h3", { className: "text-xl font-medium", children: [
            t("booking.pickup"),
            " : ",
            (_i = location.state) == null ? void 0 : _i.pickupDate,
            " - ",
            (_j = location.state) == null ? void 0 : _j.pickupTime
          ] })
        ] }),
        /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h3", { className: "text-lg font-medium mr-44", children: t("booking.hurry") }) })
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "max-w-7xl mx-auto w-full px-4 -mt-24", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-8", children: [
      /* @__PURE__ */ jsxs("div", { className: "w-8/12", children: [
        /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg p-6 mb-4", children: /* @__PURE__ */ jsxs("div", { className: "flex gap-8", children: [
          /* @__PURE__ */ jsx("div", { className: "w-1/4", children: /* @__PURE__ */ jsx("img", { src: cab.image, alt: cab.name, className: "w-full" }) }),
          /* @__PURE__ */ jsxs("div", { className: "w-3/4", children: [
            /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold mb-4", children: cab.name }),
            /* @__PURE__ */ jsxs("div", { className: "flex gap-5 mb-6", children: [
              /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
                /* @__PURE__ */ jsx("i", { className: "ri-hand-sanitizer-line mr-2" }),
                /* @__PURE__ */ jsx("h4", { className: "text-base", children: t("cabInfo.sanitizers") })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "flex items-center", children: [
                /* @__PURE__ */ jsx(
                  "img",
                  {
                    src: "https://gos3.ibcdn.com/SRP_Premium_Driver_Amenities-1628058339.png",
                    alt: "Route expert",
                    className: "w-5 h-5 mr-2"
                  }
                ),
                /* @__PURE__ */ jsx("h4", { className: "text-base", children: t("cabInfo.routeExpert") })
              ] })
            ] }),
            showCabDetails && /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
              /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxs("h5", { className: "text-sm font-light", children: [
                /* @__PURE__ */ jsx("i", { className: "ri-checkbox-circle-line mr-2 text-green-500" }),
                cab.kms
              ] }) }),
              /* @__PURE__ */ jsx("div", { className: "mb-2", children: /* @__PURE__ */ jsxs("h5", { className: "text-sm font-light", children: [
                /* @__PURE__ */ jsx("i", { className: "ri-checkbox-circle-line mr-2 text-green-500" }),
                cab.cancel
              ] }) }),
              /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("h4", { className: "text-base font-light flex items-center", children: [
                /* @__PURE__ */ jsx(
                  "img",
                  {
                    src: "https://gos3.ibcdn.com/Cab_SRP_SKU_FuelType-1628160479.png",
                    alt: "CNG Car",
                    className: "w-5 h-5 mr-2"
                  }
                ),
                cab.carType
              ] }) })
            ] }),
            /* @__PURE__ */ jsxs(
              "button",
              {
                className: "text-blue-500 text-sm font-light mb-6 flex items-center gap-1",
                onClick: () => setShowCabDetails(!showCabDetails),
                children: [
                  showCabDetails ? t("common.hideDetails") : t("common.showDetails"),
                  showCabDetails ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "h-4 w-4" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4" })
                ]
              }
            ),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("div", { className: "text-green-600 mb-2", children: t("booking.goodChoice") }),
              /* @__PURE__ */ jsxs("div", { className: "flex gap-3  ", children: [
                /* @__PURE__ */ jsx("button", { className: "bg-green-600 text-white text-sm px-3 py-1 rounded", children: t("payment.freeWaiting") || "Free waiting upto 30 minutes" }),
                /* @__PURE__ */ jsx("button", { className: "bg-green-600 text-white text-sm px-3 py-1 rounded", children: t("payment.freeCancellation") || "Free cancellation until 1hr before pickup" })
              ] })
            ] })
          ] })
        ] }) }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 mb-4", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-5 mb-4", children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://gos3.ibcdn.com/CabDriverReviewPageIconMweb-1625479893.png",
                alt: "Cab driver",
                className: "w-20 h-20"
              }
            ),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-2", children: t("payment.cabDriverDetails") }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-700", children: [
                /* @__PURE__ */ jsx("strong", { children: t("booking.cabOperator") }),
                " ",
                t("booking.willBeAssigned"),
                " ",
                t("booking.bookingComplete"),
                ". ",
                t("booking.detailsShared"),
                " ",
                /* @__PURE__ */ jsx("strong", { children: "Whatsapp & SMS" }),
                " ",
                t("booking.onRegisteredMobile"),
                " ",
                /* @__PURE__ */ jsxs("strong", { children: [
                  (_k = location.state) == null ? void 0 : _k.pickupDate,
                  " ",
                  t("common.at"),
                  " ",
                  (_l = location.state) == null ? void 0 : _l.pickupTime
                ] })
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsx("hr", { className: "my-4" }),
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-light mb-2", children: t("booking.imagesOfVehicle") }),
          /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 bg-amber-100 p-2 rounded mb-4", children: t("booking.imageDisclaimer") }),
          /* @__PURE__ */ jsxs("div", { className: "flex gap-3 mb-4", children: [
            /* @__PURE__ */ jsx(
              "button",
              {
                className: `px-3 py-1 rounded-full text-sm ${activeTab === "ALL" ? "bg-gray-200 font-medium" : "bg-white"}`,
                onClick: () => setActiveTab("ALL"),
                children: "ALL (5)"
              }
            ),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: `px-3 py-1 rounded-full text-sm ${activeTab === "BOOT" ? "bg-gray-200 font-medium" : "bg-white"}`,
                onClick: () => setActiveTab("BOOT"),
                children: "BOOT (1)"
              }
            ),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: `px-3 py-1 rounded-full text-sm ${activeTab === "EXTERIOR" ? "bg-gray-200 font-medium" : "bg-white"}`,
                onClick: () => setActiveTab("EXTERIOR"),
                children: "EXTERIOR (2)"
              }
            ),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: `px-3 py-1 rounded-full text-sm ${activeTab === "INTERIOR" ? "bg-gray-200 font-medium" : "bg-white"}`,
                onClick: () => setActiveTab("INTERIOR"),
                children: "INTERIOR (2)"
              }
            )
          ] }),
          /* @__PURE__ */ jsx("div", { className: "flex justify-center gap-4", children: imageData[activeTab].map((src, index) => /* @__PURE__ */ jsx(
            "img",
            {
              src,
              alt: `${activeTab} view`,
              className: "w-72 h-56 rounded-lg border border-gray-200"
            },
            index
          )) })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 mb-4", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-4", children: t("booking.inclusionsExclusions") }),
          /* @__PURE__ */ jsx("hr", { className: "mb-4" }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4 ml-10", children: t("booking.includedInFare") }),
            /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-4", children: [
              /* @__PURE__ */ jsxs("div", { className: "ml-10", children: [
                /* @__PURE__ */ jsxs("h4", { className: "text-sm font-light mb-2 flex items-center", children: [
                  /* @__PURE__ */ jsx("i", { className: "ri-check-line text-green-500 mr-2" }),
                  ((_m = location.state) == null ? void 0 : _m.distance) || 190,
                  " ",
                  t("common.kms")
                ] }),
                /* @__PURE__ */ jsxs("h4", { className: "text-sm font-light flex items-center", children: [
                  /* @__PURE__ */ jsx("i", { className: "ri-check-line text-green-500 mr-2" }),
                  t("booking.stateTaxes")
                ] })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "mr-20", children: [
                /* @__PURE__ */ jsxs("h4", { className: "text-sm font-light mb-2 flex items-center", children: [
                  /* @__PURE__ */ jsx("i", { className: "ri-check-line text-green-500 mr-2" }),
                  t("booking.onePickupDrop")
                ] }),
                /* @__PURE__ */ jsxs("h4", { className: "text-sm font-light flex items-center", children: [
                  /* @__PURE__ */ jsx("i", { className: "ri-check-line text-green-500 mr-2" }),
                  t("booking.tollCharges")
                ] })
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsx("hr", { className: "my-4" }),
          /* @__PURE__ */ jsxs("div", { className: "ml-10", children: [
            /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: t("booking.extraCharges") }),
            /* @__PURE__ */ jsxs("h4", { className: "text-sm font-light mb-1", children: [
              t("booking.fareBeyond"),
              " ",
              ((_n = location.state) == null ? void 0 : _n.distance) || 190,
              " ",
              t("common.kms"),
              ": Rs 18.0/",
              t("common.km")
            ] }),
            /* @__PURE__ */ jsx("h4", { className: "text-sm font-light", children: t("payment.waitingCharges") || "Waiting charges ₹300/60 mins after 30 minutes" })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 mb-4", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-4", children: t("booking.specialRequests") }),
          /* @__PURE__ */ jsx("hr", { className: "mb-4" }),
          /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center ml-10", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsxs("h3", { className: "text-lg font-medium flex items-center", children: [
                /* @__PURE__ */ jsx("i", { className: "ri-checkbox-blank-line mr-2" }),
                t("booking.roofCarrier")
              ] }),
              /* @__PURE__ */ jsx("h4", { className: "text-sm font-light", children: t("booking.roofCarrierDesc") })
            ] }),
            /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("h3", { className: "text-lg font-medium flex items-center", children: [
              /* @__PURE__ */ jsx("i", { className: "ri-money-rupee-circle-line mr-2" }),
              "315"
            ] }) })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 mb-4", children: [
          /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
            /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-2", children: t("booking.pickupAddress") }),
            /* @__PURE__ */ jsx("h3", { className: "text-lg mb-2", children: ((_p = (_o = location.state) == null ? void 0 : _o.pickupAddress) == null ? void 0 : _p.split(",")[0]) || t("booking.enterPickup") }),
            /* @__PURE__ */ jsx("h3", { className: "text-lg font-light mb-2", children: t("booking.enterPickup") }),
            /* @__PURE__ */ jsx("button", { className: "w-full border border-gray-300 rounded-md py-2 text-center", children: ((_q = location.state) == null ? void 0 : _q.pickupAddress) || t("booking.selectPickup") }),
            /* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold text-red-600 mt-2", children: t("booking.locationUpdateWarning") })
          ] }),
          /* @__PURE__ */ jsxs("h3", { className: "text-base font-light flex items-center ml-2", children: [
            /* @__PURE__ */ jsx("i", { className: "ri-checkbox-blank-line mr-2" }),
            t("booking.useAsBilling")
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-6 mb-4 shadow-sm", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => setShowTraveller(!showTraveller),
              className: "w-full flex items-center justify-between",
              children: [
                /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
                  /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: t("booking.travellerDetails") }),
                  /* @__PURE__ */ jsx("div", { className: "bg-green-50 border border-green-100 rounded px-3 py-1 ml-44", children: /* @__PURE__ */ jsx("span", { className: "text-blue-600 text-sm font-medium", children: t("booking.signInPrompt") }) })
                ] }),
                /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center", children: showTraveller ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "w-5 h-5 text-gray-500" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "w-5 h-5 text-gray-500" }) })
              ]
            }
          ),
          /* @__PURE__ */ jsxs(
            "div",
            {
              className: `transition-all duration-300 overflow-hidden ${showTraveller ? "max-h-[900px] mt-4 border-t pt-4" : "max-h-0"}`,
              children: [
                /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
                  /* @__PURE__ */ jsx("label", { className: "block text-sm mb-2", children: t("profile.gender") }),
                  /* @__PURE__ */ jsxs("select", { className: "border border-gray-300 rounded-md px-3 py-2 w-full", children: [
                    /* @__PURE__ */ jsx("option", { children: t("profile.male") }),
                    /* @__PURE__ */ jsx("option", { children: t("profile.female") }),
                    /* @__PURE__ */ jsx("option", { children: t("profile.other") })
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
                  /* @__PURE__ */ jsx("label", { className: "block text-sm mb-2", children: t("profile.name") }),
                  /* @__PURE__ */ jsx(
                    "input",
                    {
                      type: "text",
                      placeholder: t("profile.enterName"),
                      className: "border border-gray-300 rounded-md px-3 py-2 w-full"
                    }
                  )
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
                  /* @__PURE__ */ jsx("label", { className: "block text-sm mb-2", children: t("profile.phone") }),
                  /* @__PURE__ */ jsxs("div", { className: "flex", children: [
                    /* @__PURE__ */ jsx("select", { className: "border border-gray-300 rounded-l-md px-3 py-2", children: /* @__PURE__ */ jsx("option", { children: "91" }) }),
                    /* @__PURE__ */ jsx(
                      "input",
                      {
                        type: "text",
                        placeholder: t("profile.enterPhone"),
                        className: "border border-gray-300 rounded-r-md px-3 py-2 w-full"
                      }
                    )
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { children: [
                  /* @__PURE__ */ jsx("label", { className: "block text-sm mb-2", children: t("profile.email") }),
                  /* @__PURE__ */ jsx(
                    "input",
                    {
                      type: "email",
                      placeholder: t("profile.enterEmail"),
                      className: "border border-gray-300 rounded-md px-3 py-2 w-full"
                    }
                  ),
                  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: t("booking.emailDisclaimer") })
                ] })
              ]
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-5 mb-4 shadow-sm", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => setShowCancel(!showCancel),
              className: "w-full flex justify-between items-center",
              children: [
                /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: t("cabInfo.cancellationPolicy") }),
                /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-gray-600 text-xl", children: showTraveller ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "w-5 h-5 text-gray-500" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "w-5 h-5 text-gray-500" }) }) })
              ]
            }
          ),
          /* @__PURE__ */ jsxs(
            "div",
            {
              className: `transition-all duration-300 overflow-hidden ${showCancel ? "max-h-[500px] mt-4 pt-4 border-t" : "max-h-0"}`,
              children: [
                /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3 mb-5", children: [
                  /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
                    /* @__PURE__ */ jsx("div", { className: "w-10 h-10 bg-green-600 text-white rounded-full flex items-center justify-center text-xl font-bold", children: "₹" }),
                    /* @__PURE__ */ jsx("div", { className: "w-[2px] bg-green-500 h-10" })
                  ] }),
                  /* @__PURE__ */ jsxs("div", { children: [
                    /* @__PURE__ */ jsx("p", { className: "font-semibold text-black", children: t("booking.afterBookingConfirmed") }),
                    /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("cabInfo.freeCancellation") })
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
                  /* @__PURE__ */ jsx("div", { className: "flex flex-col items-center", children: /* @__PURE__ */ jsx("div", { className: "w-10 h-10 bg-red-600 text-white rounded-full flex items-center justify-center text-xl", children: "🚗" }) }),
                  /* @__PURE__ */ jsxs("div", { children: [
                    /* @__PURE__ */ jsxs("p", { className: "font-semibold text-black", children: [
                      t("booking.afterTime"),
                      " 21 Nov 9:00 am"
                    ] }),
                    /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("booking.noRefund") })
                  ] })
                ] })
              ]
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg p-5 mb-4 shadow-sm", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => setShowOther(!showOther),
              className: "w-full flex justify-between items-center",
              children: [
                /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold", children: t("booking.otherInformation") }),
                /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-gray-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-gray-600 text-xl", children: showTraveller ? /* @__PURE__ */ jsx(ChevronUpIcon, { className: "w-5 h-5 text-gray-500" }) : /* @__PURE__ */ jsx(ChevronDownIcon, { className: "w-5 h-5 text-gray-500" }) }) })
              ]
            }
          ),
          /* @__PURE__ */ jsx(
            "div",
            {
              className: `transition-all duration-300 overflow-hidden ${showOther ? "max-h-[500px] mt-4 border-t pt-4" : "max-h-0"}`,
              children: /* @__PURE__ */ jsxs("ul", { className: "text-gray-700 space-y-3", children: [
                /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-3", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-blue-500 text-xl", children: "•" }),
                  t("booking.acOffHilly")
                ] }),
                /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-3", children: [
                  /* @__PURE__ */ jsx("span", { className: "text-blue-500 text-xl", children: "•" }),
                  t("booking.oneStopIncluded")
                ] })
              ] })
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "w-4/12 sticky top-20 h-fit ", children: [
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6 mb-6", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-6", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold", children: t("payment.totalAmount") }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.inclusiveGST") })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-right relative", children: [
              /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold", children: cab.price }),
              /* @__PURE__ */ jsxs(
                "div",
                {
                  className: "text-right relative inline-block",
                  onMouseEnter: () => setShowFareBreakdown(true),
                  onMouseLeave: () => setShowFareBreakdown(false),
                  children: [
                    /* @__PURE__ */ jsx("span", { className: "text-sm text-blue-400 hover:text-orange-500 cursor-pointer font-medium", children: t("common.viewDetails") }),
                    showFareBreakdown && /* @__PURE__ */ jsxs(
                      "div",
                      {
                        className: "absolute right-0 top-full mt-2 w-[350px] bg-white \r\n                                     border-blue-400 shadow-sm p-5 border-[2px] rounded-[2px] z-20",
                        children: [
                          /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsxs("div", { children: [
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mr-[180px]", children: t("payment.baseFare") }),
                              /* @__PURE__ */ jsxs("p", { className: "text-[12px] text-gray-500 mr-20", children: [
                                t("common.for"),
                                " ",
                                ((_r = bookingReview == null ? void 0 : bookingReview.route) == null ? void 0 : _r.distance) || ((_s = location.state) == null ? void 0 : _s.distance) || 190,
                                " ",
                                t("common.kms")
                              ] })
                            ] }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              ((_u = (_t = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _t.fare) == null ? void 0 : _u.base) || 0
                            ] })
                          ] }),
                          /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsxs("div", { children: [
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mr-28", children: t("payment.distanceCharge") }),
                              /* @__PURE__ */ jsxs("p", { className: "text-[12px] text-gray-500", children: [
                                "@₹",
                                ((_v = bookingReview == null ? void 0 : bookingReview.vehicle) == null ? void 0 : _v.extraKmRate) || 0,
                                "/",
                                t("common.km"),
                                " ",
                                t("booking.after"),
                                " ",
                                ((_w = bookingReview == null ? void 0 : bookingReview.vehicle) == null ? void 0 : _w.includedKm) || 0,
                                " ",
                                t("common.kms")
                              ] })
                            ] }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              ((_y = (_x = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _x.fare) == null ? void 0 : _y.distance) || 0
                            ] })
                          ] }),
                          ((_A = (_z = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _z.fare) == null ? void 0 : _A.nightCharge) > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mr-28", children: t("payment.nightCharge") }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              (_C = (_B = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _B.fare) == null ? void 0 : _C.nightCharge
                            ] })
                          ] }),
                          ((_E = (_D = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _D.fare) == null ? void 0 : _E.zoneExtraCharge) > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsxs("div", { children: [
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mr-28", children: t("booking.tollStateTax") }),
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500", children: t("booking.zoneExtraCharges") })
                            ] }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              (_G = (_F = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _F.fare) == null ? void 0 : _G.zoneExtraCharge
                            ] })
                          ] }),
                          ((_I = (_H = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _H.fare) == null ? void 0 : _I.airportCharge) > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsxs("div", { children: [
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mr-28", children: t("payment.airportSurcharge") }),
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 opacity-0", children: "." })
                            ] }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              (_K = (_J = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _J.fare) == null ? void 0 : _K.airportCharge
                            ] })
                          ] }),
                          ((_M = (_L = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _L.fare) == null ? void 0 : _M.stops) > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500 mr-28", children: t("payment.stopsCharge") }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              (_O = (_N = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _N.fare) == null ? void 0 : _O.stops
                            ] })
                          ] }),
                          /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsxs("div", { children: [
                              /* @__PURE__ */ jsx("p", { className: "text-[15px] text-gray-500", children: t("payment.gstTaxes") }),
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-gray-500", children: "@5%" })
                            ] }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold", children: [
                              "₹",
                              ((_Q = (_P = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _P.fare) == null ? void 0 : _Q.taxes) || 0
                            ] })
                          ] }),
                          ((_S = (_R = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _R.discount) == null ? void 0 : _S.discountAmount) > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between mb-3", children: [
                            /* @__PURE__ */ jsxs("div", { children: [
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-green-600 mr-28", children: t("payment.discountApplied") }),
                              /* @__PURE__ */ jsx("p", { className: "text-[12px] text-green-600", children: ((_U = (_T = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _T.discount) == null ? void 0 : _U.description) || "Promo discount" })
                            ] }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold text-green-600", children: [
                              "-₹",
                              (_W = (_V = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _V.discount) == null ? void 0 : _W.discountAmount
                            ] })
                          ] }),
                          /* @__PURE__ */ jsx("hr", { className: "my-3 border-gray-200" }),
                          /* @__PURE__ */ jsxs("div", { className: "flex justify-between", children: [
                            /* @__PURE__ */ jsx("p", { className: "text-[14px] font-semibold text-gray-700", children: "Total Amount" }),
                            /* @__PURE__ */ jsxs("p", { className: "text-[16px] font-bold text-black", children: [
                              "₹",
                              ((_X = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _X.finalTotal) || ((_Z = (_Y = bookingReview == null ? void 0 : bookingReview.pricing) == null ? void 0 : _Y.fare) == null ? void 0 : _Z.total) || 0
                            ] })
                          ] })
                        ]
                      }
                    )
                  ]
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
            /* @__PURE__ */ jsxs(
              "label",
              {
                onClick: () => {
                  setPaymentType("partial");
                  setCurrentAmount(cab.partialPayment);
                },
                className: `flex items-start gap-2 p-3 rounded cursor-pointer ${paymentType === "partial" ? "bg-orange-50 " : "bg-gray-50"}`,
                children: [
                  /* @__PURE__ */ jsx(
                    "input",
                    {
                      type: "radio",
                      name: "payment",
                      checked: paymentType === "partial",
                      readOnly: true
                    }
                  ),
                  /* @__PURE__ */ jsxs("div", { children: [
                    /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
                      "Pay ",
                      cab.partialPayment,
                      " Now"
                    ] }),
                    /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "Remaining to driver" })
                  ] })
                ]
              }
            ),
            /* @__PURE__ */ jsxs(
              "label",
              {
                onClick: () => {
                  setPaymentType("full");
                  setCurrentAmount(cab.price);
                },
                className: `flex items-start gap-2 p-3 rounded cursor-pointer 
      ${paymentType === "full" ? "bg-orange-50 b" : "bg-gray-50"}`,
                children: [
                  /* @__PURE__ */ jsx(
                    "input",
                    {
                      type: "radio",
                      name: "payment",
                      checked: paymentType === "full",
                      readOnly: true
                    }
                  ),
                  /* @__PURE__ */ jsxs("div", { children: [
                    /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
                      "Pay ",
                      cab.price,
                      " Now"
                    ] }),
                    /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "Full payment" })
                  ] })
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => {
                var _a2;
                const searchParams = location.state || {};
                const amountValue = currentAmount ? currentAmount.replace(/[^0-9.]/g, "") : "0";
                const totalValue = cab.price ? cab.price.replace(/[^0-9.]/g, "") : "0";
                navigate(`/payment/${cab.id}`, {
                  state: {
                    // Forward search params
                    ...searchParams,
                    // Vehicle details override
                    vehicleId: cab.id,
                    registrationNumber: cab.registrationNumber,
                    vehicleName: cab.name,
                    category: cab.type,
                    isAc: cab.ac,
                    fuelType: ((_a2 = cab.carType) == null ? void 0 : _a2.split(" ")[0].toLowerCase()) || "petrol",
                    // Payment specifics
                    amount: amountValue,
                    totalFare: totalValue,
                    paymentType,
                    // Ensure these exist if not in searchParams
                    // Format date as YYYY-MM-DD for backend
                    pickupDate: searchParams.scheduledTime ? new Date(searchParams.scheduledTime).toISOString().split("T")[0] : (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
                    pickupTime: "10:00 AM",
                    // Default if not in params
                    returnDate: searchParams.returnDate,
                    distance: searchParams.distance || 190
                  }
                });
              },
              className: "mt-5 w-full bg-[#ff6200] text-white py-2 rounded-lg",
              children: [
                "Pay ",
                currentAmount,
                " & confirm now"
              ]
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6 mb-5", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold mb-4", children: "Offers" }),
          /* @__PURE__ */ jsxs("div", { className: "bg-green-50 border border-green-100 rounded-md px-4 py-3 flex items-center gap-2 mb-4", children: [
            /* @__PURE__ */ jsx("span", { className: "text-yellow-500 text-xl font-bold", children: "go" }),
            /* @__PURE__ */ jsx("p", { className: "text-sm text-green-700 font-medium", children: "Sign in and use your goCash" })
          ] }),
          /* @__PURE__ */ jsxs("label", { className: "flex items-start gap-3 border rounded-lg px-4 py-3 mb-4 cursor-pointer", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "radio",
                name: "offer",
                className: "mt-1 h-4 w-4 accent-blue-600"
              }
            ),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "font-semibold text-[15px]", children: "GODEAL" }),
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "Get up-to Rs.200 Off" })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2 font-bold text-[15px]", children: [
            /* @__PURE__ */ jsx("span", { className: "text-gray-600 text-xl", children: "🏷️" }),
            "ENTER PROMO CODE"
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "border rounded-lg flex items-center overflow-hidden", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "text",
                placeholder: "Got A Promocode? Enter",
                className: "px-3 py-3 w-full text-sm outline-none"
              }
            ),
            /* @__PURE__ */ jsx("button", { className: "bg-gray-200 px-4 py-3 flex items-center justify-center", children: /* @__PURE__ */ jsx("span", { className: "text-gray-600 text-lg", children: ">" }) })
          ] })
        ] }),
        /* @__PURE__ */ jsx("div", {})
      ] })
    ] }) }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const PaymentPage = () => {
  var _a, _b, _c, _d, _e;
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const { id } = distExports.useParams();
  const dispatch = useDispatch();
  const { t } = useTranslation();
  const { createLoading, createError } = useSelector((state) => state.booking);
  const { loading: paymentLoading } = useSelector((state) => state.payment);
  const { isAuthenticated, user } = useSelector((state) => state.auth);
  const [timeLeft, setTimeLeft] = useState(20 * 60);
  const [showDetails, setShowDetails] = useState(false);
  const [processingStep, setProcessingStep] = useState("");
  const bookingData = location.state || {};
  const displayAmount = bookingData.amount || ((_a = bookingData.fare) == null ? void 0 : _a.total) || 465;
  const pickupLocation = bookingData.pickupAddress || ((_b = bookingData.pickupLocation) == null ? void 0 : _b.address) || "Bhopal";
  const dropLocation = bookingData.dropAddress || ((_c = bookingData.dropLocation) == null ? void 0 : _c.address) || "Ujjain";
  const distance = bookingData.distance || 201;
  const pickupDateDisplay = bookingData.pickupDate || "4 Sep 2025";
  const pickupTimeDisplay = bookingData.pickupTime || "10:00 AM";
  const vehicleName = bookingData.vehicleName || "Indica, Wagon R Or Similar";
  const customerName = (user == null ? void 0 : user.fullName) || bookingData.customerName || "Guest User";
  const customerEmail = (user == null ? void 0 : user.email) || bookingData.customerEmail || "xyz@gmail.com";
  const customerPhone = (user == null ? void 0 : user.phone) || bookingData.customerPhone || "+91**********";
  useEffect(() => {
    const timer = setInterval(() => {
      setTimeLeft((prev) => prev > 0 ? prev - 1 : 0);
    }, 1e3);
    return () => clearInterval(timer);
  }, []);
  useEffect(() => {
    return () => {
      dispatch(resetCreateBooking());
      if (typeof resetPaymentState === "function") {
        dispatch(resetPaymentState());
      }
    };
  }, [dispatch]);
  const loadRazorpay = () => {
    return new Promise((resolve) => {
      const script = document.createElement("script");
      script.src = "https://checkout.razorpay.com/v1/checkout.js";
      script.onload = () => resolve(true);
      script.onerror = () => resolve(false);
      document.body.appendChild(script);
    });
  };
  const formatTime = (seconds) => {
    const m = Math.floor(seconds / 60);
    const s = seconds % 60;
    return `${m.toString().padStart(2, "0")}:${s.toString().padStart(2, "0")}`;
  };
  const handlePayment = async () => {
    var _a2;
    if (!isAuthenticated) {
      alert(t("errors.loginRequired"));
      navigate("/login", { state: { from: location } });
      return;
    }
    const isScriptLoaded = await loadRazorpay();
    if (!isScriptLoaded) {
      alert(t("errors.razorpayFailed"));
      return;
    }
    setProcessingStep("booking");
    const bookingPayload = {
      pickupLocation: bookingData.pickupLocation || {
        address: bookingData.pickupAddress || "Bhopal, Madhya Pradesh",
        coordinates: [bookingData.picklng || 77.4126, bookingData.picklat || 23.2599]
      },
      dropLocation: bookingData.dropLocation || {
        address: bookingData.dropAddress || "Ujjain, Madhya Pradesh",
        coordinates: [bookingData.droplng || 75.7885, bookingData.droplat || 23.1765]
      },
      // NEW: Pass groupId and modelId for new booking system
      groupId: bookingData.groupId,
      modelId: bookingData.modelId,
      vehicleId: bookingData.vehicleId || id || void 0,
      // Optional for backward compatibility
      zoneId: bookingData.zoneId,
      tripType: bookingData.tripType || "oneWay",
      pickupDate: bookingData.pickupDate ? new Date(bookingData.pickupDate).toISOString().split("T")[0] : (/* @__PURE__ */ new Date()).toISOString().split("T")[0],
      pickupTime: bookingData.pickupTime || "10:00 AM",
      distance: bookingData.distance || 200,
      duration: bookingData.duration || 180,
      paymentMode: "online",
      fuelType: bookingData.fuelType || "petrol",
      isAc: bookingData.isAc !== void 0 ? bookingData.isAc : true
    };
    if (bookingData.stops && bookingData.stops.length > 0) {
      bookingPayload.stops = bookingData.stops.map((stop) => ({
        address: stop.address || stop.value,
        stopOrder: stop.stopOrder || 1,
        coordinates: stop.coordinates || []
      }));
    }
    if (bookingData.returnDate) {
      bookingPayload.returnDate = bookingData.returnDate;
    }
    if (bookingData.rentalPackage) {
      bookingPayload.rentalPackage = bookingData.rentalPackage;
    }
    try {
      const bookingAction = await dispatch(createBooking(bookingPayload)).unwrap();
      const bookingId = bookingAction.data._id;
      console.log("Booking created:", bookingId);
      setProcessingStep("order");
      const orderAction = await dispatch(createPaymentOrder({
        bookingId,
        amount: displayAmount,
        paymentType: bookingData.paymentType || (displayAmount < (((_a2 = bookingData.fare) == null ? void 0 : _a2.total) || Infinity) ? "partial" : "full")
      })).unwrap();
      const { data: orderData } = orderAction;
      console.log("Payment order created:", orderData);
      setProcessingStep("payment");
      const options = {
        key: orderData.keyId,
        amount: orderData.amount,
        currency: orderData.currency,
        name: "Cab Booking",
        description: `Booking for ${vehicleName}`,
        order_id: orderData.orderId,
        handler: async function(response) {
          setProcessingStep("verifying");
          try {
            await dispatch(verifyPayment({
              razorpay_order_id: response.razorpay_order_id,
              razorpay_payment_id: response.razorpay_payment_id,
              razorpay_signature: response.razorpay_signature
            })).unwrap();
            navigate("/my-trips", {
              state: {
                bookingConfirmed: true,
                orderId: bookingAction.data.orderId
              }
            });
          } catch (verifyError) {
            console.error("Verification failed:", verifyError);
            alert(t("errors.paymentVerifyFailed"));
            setProcessingStep("failed");
          }
        },
        prefill: {
          name: customerName,
          email: customerEmail,
          contact: customerPhone
        },
        theme: {
          color: "#ea580c"
        },
        modal: {
          ondismiss: function() {
            setProcessingStep("");
            alert(t("errors.paymentCancelled"));
          }
        }
      };
      const rzp1 = new window.Razorpay(options);
      rzp1.open();
    } catch (error) {
      console.error("Process failed:", error);
      setProcessingStep("failed");
    }
  };
  return /* @__PURE__ */ jsxs("div", { className: "flex flex-col min-h-screen text-black font-semibold bg-white", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "flex-grow max-w-6xl mx-auto p-6", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-6 mt-24", children: [
        /* @__PURE__ */ jsxs("h1", { className: "text-2xl font-semibold", children: [
          t("payment.payToConfirm").split(" ")[0],
          " ",
          /* @__PURE__ */ jsxs("span", { className: "text-orange-600 font-bold", children: [
            "₹ ",
            displayAmount
          ] }),
          " ",
          t("payment.payToConfirm").substring(t("payment.payToConfirm").indexOf(" "))
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex items-center text-orange-600 font-medium text-lg", children: [
          /* @__PURE__ */ jsx(Clock, { size: 18, className: "mr-1" }),
          t("payment.timeLeft"),
          ": ",
          /* @__PURE__ */ jsx("span", { className: "ml-1", children: formatTime(timeLeft) })
        ] })
      ] }),
      createError && /* @__PURE__ */ jsx("div", { className: "bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4", children: createError }),
      processingStep === "verifying" && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50", children: /* @__PURE__ */ jsxs("div", { className: "bg-white p-6 rounded-lg shadow-xl flex flex-col items-center", children: [
        /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-orange-500 mb-4" }),
        /* @__PURE__ */ jsx("p", { className: "text-lg font-semibold", children: t("payment.verifyingPayment") }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("payment.doNotClose") })
      ] }) }),
      /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-6", children: [
        /* @__PURE__ */ jsxs("div", { className: "md:col-span-2 space-y-6", children: [
          /* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl shadow p-4", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsxs("h2", { className: "text-lg font-medium", children: [
                pickupLocation,
                " ",
                bookingData.tripType === "rental" ? "" : `→ ${dropLocation}`,
                /* @__PURE__ */ jsxs("span", { className: "text-black font-normal ml-1", children: [
                  "(",
                  t(`tripTypes.${bookingData.tripType === "rental" ? "hourly" : bookingData.tripType === "round" ? "round" : "oneway"}`),
                  ")",
                  bookingData.tripType === "rental" ? ` - ${((_d = bookingData.rentalPackage) == null ? void 0 : _d.label) || ""}` : ` ${distance} Km`
                ] })
              ] }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-black font-normal", children: [
                t("booking.pickupLocation"),
                ": ",
                pickupDateDisplay,
                ", ",
                pickupTimeDisplay
              ] }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-black font-normal", children: [
                vehicleName,
                " (",
                t("cabSearch.ac"),
                ", 4 passengers allowed)"
              ] }),
              /* @__PURE__ */ jsxs("p", { className: "mt-2 text-sm", children: [
                /* @__PURE__ */ jsx("span", { className: "font-semibold", children: customerName }),
                " · ",
                customerEmail,
                " · ",
                customerPhone
              ] }),
              showDetails && /* @__PURE__ */ jsxs("div", { className: "mt-2 text-sm text-gray-600 space-y-1", children: [
                /* @__PURE__ */ jsxs("p", { children: [
                  "Vehicle ID: ",
                  bookingData.registrationNumber
                ] }),
                /* @__PURE__ */ jsxs("p", { children: [
                  "Trip Type: ",
                  bookingData.tripType || "oneWay"
                ] }),
                /* @__PURE__ */ jsxs("p", { children: [
                  "Pickup Address: ",
                  pickupLocation
                ] }),
                bookingData.tripType !== "rental" && /* @__PURE__ */ jsxs("p", { children: [
                  "Drop Address: ",
                  dropLocation
                ] }),
                bookingData.tripType === "rental" && /* @__PURE__ */ jsxs("p", { children: [
                  "Package: ",
                  (_e = bookingData.rentalPackage) == null ? void 0 : _e.label
                ] })
              ] })
            ] }),
            /* @__PURE__ */ jsxs(
              "button",
              {
                className: "flex items-center text-blue-600 font-medium",
                onClick: () => setShowDetails(!showDetails),
                children: [
                  showDetails ? t("common.hideDetails") : t("common.showDetails"),
                  " ",
                  /* @__PURE__ */ jsx(
                    ChevronDown,
                    {
                      size: 18,
                      className: `ml-1 transition-transform duration-200 ${showDetails ? "rotate-180" : ""}`
                    }
                  )
                ]
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl shadow p-4", children: [
            /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-4", children: t("payment.allPaymentOptions") }),
            /* @__PURE__ */ jsxs("ul", { className: "space-y-3", children: [
              /* @__PURE__ */ jsxs("li", { className: "border-b pb-2", children: [
                /* @__PURE__ */ jsx("p", { className: "font-medium", children: t("payment.upiOptions") }),
                /* @__PURE__ */ jsx("p", { className: "text-sm text-green-600", children: t("payment.getCashback") })
              ] }),
              /* @__PURE__ */ jsxs("li", { className: "border-b pb-2", children: [
                /* @__PURE__ */ jsx("p", { className: "font-medium", children: t("payment.creditDebit") }),
                /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("payment.cardProviders") })
              ] }),
              /* @__PURE__ */ jsxs("li", { className: "border-b pb-2", children: [
                /* @__PURE__ */ jsx("p", { className: "font-medium", children: t("payment.bookNowPayLater") }),
                /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: t("payment.bnplProviders") })
              ] }),
              /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("p", { className: "font-medium", children: t("payment.netBanking") }) })
            ] })
          ] }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: handlePayment,
              disabled: createLoading || paymentLoading || processingStep !== "",
              className: `w-full py-4 rounded-xl text-white font-bold text-lg ${createLoading || paymentLoading || processingStep !== "" ? "bg-gray-400 cursor-not-allowed" : "bg-orange-500 hover:bg-orange-600"}`,
              children: processingStep === "booking" ? t("payment.creatingBooking") : processingStep === "order" ? t("payment.initiatingPayment") : processingStep === "payment" ? t("payment.waitingPayment") : processingStep === "verifying" ? t("payment.verifying") : `${t("payment.payAndConfirm")} ₹${displayAmount}`
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl shadow p-4", children: [
            /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold", children: t("payment.grandTotal") }),
            /* @__PURE__ */ jsxs("p", { className: "text-2xl font-bold text-green-600 mt-2", children: [
              "₹",
              displayAmount
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 border border-orange-200 rounded-2xl p-4 text-sm text-gray-700", children: [
            t("payment.cabDriverDetails"),
            " ",
            /* @__PURE__ */ jsxs("b", { children: [
              pickupDateDisplay,
              " at 9:30 AM"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl shadow p-4", children: [
            /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-3", children: t("payment.includedBenefits") }),
            /* @__PURE__ */ jsxs("ul", { className: "space-y-2 text-sm", children: [
              /* @__PURE__ */ jsxs("li", { children: [
                "✅ ",
                t("payment.freeCancellation"),
                " ",
                pickupDateDisplay,
                ", 9:00 AM"
              ] }),
              /* @__PURE__ */ jsxs("li", { children: [
                "✅ ",
                t("payment.freeWaiting")
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl shadow p-4 text-center flex flex-col items-center", children: [
            /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold mb-2", children: t("payment.scanToPay") }),
            /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-3", children: t("payment.instantRefund") }),
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=DummyQR",
                alt: "QR Code",
                className: "w-40 h-40 object-contain"
              }
            )
          ] })
        ] })
      ] })
    ] })
  ] });
};
const CancelBookingModal = ({ booking: booking2, onClose, onSuccess }) => {
  const dispatch = useDispatch();
  const [reason, setReason] = useState("");
  const [showConfirmation, setShowConfirmation] = useState(false);
  const {
    cancellationPreview,
    previewCancellationLoading,
    previewCancellationError,
    cancelLoading,
    cancelError,
    cancelSuccess,
    cancellationResult
  } = useSelector((state) => state.booking);
  const bookingId = booking2 == null ? void 0 : booking2._id;
  useEffect(() => {
    console.log("CancelBookingModal mounted/updated");
    console.log("Booking:", booking2);
    console.log("Booking ID:", bookingId);
    if (bookingId) {
      console.log("Dispatching previewCancellation for:", bookingId);
      dispatch(previewCancellation(bookingId));
    }
    return () => {
      dispatch(resetCancellationPreview());
      dispatch(resetCancelBooking());
      setReason("");
      setShowConfirmation(false);
    };
  }, [bookingId, dispatch]);
  useEffect(() => {
    if (cancelSuccess && cancellationResult) {
      setTimeout(() => {
        if (onSuccess) {
          onSuccess(cancellationResult);
        }
        handleClose();
      }, 2e3);
    }
  }, [cancelSuccess, cancellationResult]);
  const handleClose = () => {
    setReason("");
    setShowConfirmation(false);
    dispatch(resetCancellationPreview());
    dispatch(resetCancelBooking());
    onClose();
  };
  const handlePreviewCancel = () => {
    if (!reason.trim()) {
      alert("Please provide a reason for cancellation");
      return;
    }
    setShowConfirmation(true);
  };
  const handleConfirmCancel = () => {
    dispatch(cancelBooking({ bookingId, reason }));
  };
  const handleBackToForm = () => {
    setShowConfirmation(false);
  };
  if (!booking2) return null;
  const formatCurrency = (amount) => {
    return new Intl.NumberFormat("en-IN", {
      style: "currency",
      currency: "INR",
      maximumFractionDigits: 0
    }).format(amount);
  };
  const formatTimeRemaining = (hours) => {
    if (hours < 0) return "Pickup time has passed";
    if (hours < 1) return `${Math.round(hours * 60)} minutes`;
    if (hours < 24) return `${Math.round(hours * 10) / 10} hours`;
    const days = Math.floor(hours / 24);
    const remainingHours = Math.round(hours % 24);
    return `${days} day${days > 1 ? "s" : ""} ${remainingHours > 0 ? `${remainingHours} hour${remainingHours > 1 ? "s" : ""}` : ""}`;
  };
  return /* @__PURE__ */ jsx("div", { className: "cancel-modal-overlay", onClick: handleClose, children: /* @__PURE__ */ jsxs("div", { className: "cancel-modal-content", onClick: (e) => e.stopPropagation(), children: [
    previewCancellationLoading && /* @__PURE__ */ jsxs("div", { className: "cancel-modal-loading", children: [
      /* @__PURE__ */ jsx("div", { className: "spinner" }),
      /* @__PURE__ */ jsx("p", { children: "Loading cancellation details..." })
    ] }),
    previewCancellationError && /* @__PURE__ */ jsxs("div", { className: "cancel-modal-error", children: [
      /* @__PURE__ */ jsx("h3", { children: "Error" }),
      /* @__PURE__ */ jsx("p", { children: previewCancellationError }),
      /* @__PURE__ */ jsx("button", { onClick: handleClose, className: "btn-close-error", children: "Close" })
    ] }),
    cancelSuccess && cancellationResult && /* @__PURE__ */ jsxs("div", { className: "cancel-modal-success", children: [
      /* @__PURE__ */ jsx("div", { className: "success-icon", children: "✓" }),
      /* @__PURE__ */ jsx("h3", { children: "Booking Cancelled Successfully" }),
      /* @__PURE__ */ jsxs("div", { className: "success-details", children: [
        /* @__PURE__ */ jsxs("p", { children: [
          /* @__PURE__ */ jsx("strong", { children: "Order ID:" }),
          " ",
          cancellationResult.orderId
        ] }),
        cancellationResult.cancellation.refundAmount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsxs("p", { className: "refund-amount", children: [
            /* @__PURE__ */ jsx("strong", { children: "Refund Amount:" }),
            " ",
            formatCurrency(cancellationResult.cancellation.refundAmount)
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "refund-status", children: [
            "Refund Status: ",
            /* @__PURE__ */ jsx("span", { className: "status-badge", children: cancellationResult.cancellation.refundStatus })
          ] }),
          /* @__PURE__ */ jsx("p", { className: "refund-note", children: "The refund will be processed within 5-7 business days" })
        ] }),
        cancellationResult.cancellation.cancellationCharges > 0 && /* @__PURE__ */ jsxs("p", { className: "cancellation-charges", children: [
          /* @__PURE__ */ jsx("strong", { children: "Cancellation Charges:" }),
          " ",
          formatCurrency(cancellationResult.cancellation.cancellationCharges)
        ] })
      ] })
    ] }),
    !previewCancellationLoading && !previewCancellationError && !cancelSuccess && cancellationPreview && /* @__PURE__ */ jsx(Fragment, { children: !showConfirmation ? (
      // Step 1: Show preview and collect reason
      /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsxs("div", { className: "cancel-modal-header", children: [
          /* @__PURE__ */ jsx("h2", { children: "Cancel Booking" }),
          /* @__PURE__ */ jsx("button", { onClick: handleClose, className: "btn-close", children: "×" })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "cancel-modal-body", children: [
          /* @__PURE__ */ jsxs("div", { className: "booking-info", children: [
            /* @__PURE__ */ jsx("h3", { children: "Booking Details" }),
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Order ID:" }),
              " ",
              cancellationPreview.orderId
            ] }),
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Status:" }),
              " ",
              /* @__PURE__ */ jsx("span", { className: "status-badge", children: cancellationPreview.currentStatus })
            ] }),
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Scheduled Pickup:" }),
              " ",
              new Date(cancellationPreview.scheduledPickup).toLocaleString("en-IN", {
                dateStyle: "medium",
                timeStyle: "short"
              })
            ] }),
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Time Until Pickup:" }),
              " ",
              formatTimeRemaining(cancellationPreview.hoursUntilPickup)
            ] })
          ] }),
          cancellationPreview.canCancel ? /* @__PURE__ */ jsxs("div", { className: "cancellation-policy", children: [
            /* @__PURE__ */ jsx("h3", { children: "Cancellation Policy" }),
            /* @__PURE__ */ jsx("div", { className: "policy-rule", children: /* @__PURE__ */ jsx("p", { className: "rule-text", children: cancellationPreview.refund.appliedRule }) }),
            cancellationPreview.hoursUntilPickup < 0 && /* @__PURE__ */ jsx("div", { className: "warning-message", style: {
              backgroundColor: "#FEF3C7",
              border: "1px solid #F59E0B",
              padding: "12px",
              borderRadius: "8px",
              marginBottom: "16px"
            }, children: /* @__PURE__ */ jsxs("p", { style: { color: "#92400E", fontSize: "14px", margin: 0 }, children: [
              "⚠️ ",
              /* @__PURE__ */ jsx("strong", { children: "Note:" }),
              " The scheduled pickup time for this booking has already passed. You can still cancel, but no refund will be processed as per the cancellation policy."
            ] }) }),
            /* @__PURE__ */ jsxs("div", { className: "refund-breakdown", children: [
              /* @__PURE__ */ jsxs("div", { className: "refund-row", children: [
                /* @__PURE__ */ jsx("span", { children: "Total Paid:" }),
                /* @__PURE__ */ jsx("span", { className: "amount", children: formatCurrency(cancellationPreview.payment.totalPaid) })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "refund-row highlight", children: [
                /* @__PURE__ */ jsxs("span", { children: [
                  "Refund Amount (",
                  cancellationPreview.refund.refundPercentage,
                  "%):"
                ] }),
                /* @__PURE__ */ jsx("span", { className: "amount refund", children: formatCurrency(cancellationPreview.refund.refundAmount) })
              ] }),
              cancellationPreview.refund.cancellationCharges > 0 && /* @__PURE__ */ jsxs("div", { className: "refund-row", children: [
                /* @__PURE__ */ jsx("span", { children: "Cancellation Charges:" }),
                /* @__PURE__ */ jsx("span", { className: "amount charges", children: formatCurrency(cancellationPreview.refund.cancellationCharges) })
              ] })
            ] })
          ] }) : /* @__PURE__ */ jsx("div", { className: "cannot-cancel", children: /* @__PURE__ */ jsx("p", { className: "warning-text", children: "This booking cannot be cancelled at this time." }) }),
          cancellationPreview.canCancel && /* @__PURE__ */ jsxs("div", { className: "reason-section", children: [
            /* @__PURE__ */ jsxs("label", { htmlFor: "cancel-reason", children: [
              /* @__PURE__ */ jsx("strong", { children: "Reason for Cancellation" }),
              " ",
              /* @__PURE__ */ jsx("span", { className: "required", children: "*" })
            ] }),
            /* @__PURE__ */ jsx(
              "textarea",
              {
                id: "cancel-reason",
                value: reason,
                onChange: (e) => setReason(e.target.value),
                placeholder: "Please provide a reason for cancelling this booking...",
                rows: "4",
                maxLength: "500",
                required: true
              }
            ),
            /* @__PURE__ */ jsxs("small", { children: [
              reason.length,
              "/500 characters"
            ] })
          ] }),
          cancelError && /* @__PURE__ */ jsx("div", { className: "error-message", children: cancelError })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "cancel-modal-footer", children: [
          /* @__PURE__ */ jsx("button", { onClick: handleClose, className: "btn-secondary", disabled: cancelLoading, children: "Keep Booking" }),
          cancellationPreview.canCancel && /* @__PURE__ */ jsx(
            "button",
            {
              onClick: handlePreviewCancel,
              className: "btn-danger",
              disabled: cancelLoading || !reason.trim(),
              children: cancelLoading ? "Processing..." : "Continue to Cancel"
            }
          )
        ] })
      ] })
    ) : (
      // Step 2: Confirmation
      /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsxs("div", { className: "cancel-modal-header", children: [
          /* @__PURE__ */ jsx("h2", { children: "Confirm Cancellation" }),
          /* @__PURE__ */ jsx("button", { onClick: handleClose, className: "btn-close", children: "×" })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "cancel-modal-body", children: [
          /* @__PURE__ */ jsxs("div", { className: "confirmation-warning", children: [
            /* @__PURE__ */ jsx("div", { className: "warning-icon", children: "⚠️" }),
            /* @__PURE__ */ jsx("h3", { children: "Are you sure you want to cancel this booking?" }),
            /* @__PURE__ */ jsx("p", { children: "This action cannot be undone." })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "confirmation-summary", children: [
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Order ID:" }),
              " ",
              cancellationPreview.orderId
            ] }),
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Refund Amount:" }),
              " ",
              formatCurrency(cancellationPreview.refund.refundAmount)
            ] }),
            cancellationPreview.refund.cancellationCharges > 0 && /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Cancellation Charges:" }),
              " ",
              formatCurrency(cancellationPreview.refund.cancellationCharges)
            ] }),
            /* @__PURE__ */ jsxs("p", { children: [
              /* @__PURE__ */ jsx("strong", { children: "Reason:" }),
              " ",
              reason
            ] })
          ] }),
          cancelError && /* @__PURE__ */ jsx("div", { className: "error-message", children: cancelError })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "cancel-modal-footer", children: [
          /* @__PURE__ */ jsx("button", { onClick: handleBackToForm, className: "btn-secondary", disabled: cancelLoading, children: "Go Back" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              onClick: handleConfirmCancel,
              className: "btn-danger",
              disabled: cancelLoading,
              children: cancelLoading ? "Cancelling..." : "Yes, Cancel Booking"
            }
          )
        ] })
      ] })
    ) })
  ] }) });
};
const MyTrips = () => {
  const [activeTab, setActiveTab] = useState("upcoming");
  const [showCancelModal, setShowCancelModal] = useState(false);
  const [selectedBooking, setSelectedBooking] = useState(null);
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const { t } = useTranslation();
  const { bookings, bookingsLoading, bookingsError, bookingsPagination } = useSelector(
    (state) => state.booking
  );
  const { isAuthenticated } = useSelector((state) => state.auth);
  const getStatusForTab = (tab) => {
    switch (tab) {
      case "upcoming":
        return "created,assigned,arrived";
      case "cancelled":
        return "cancelled";
      case "completed":
        return "completed";
      default:
        return "";
    }
  };
  useEffect(() => {
    if (isAuthenticated) {
      const status = getStatusForTab(activeTab);
      dispatch(getAllBookings({ status, page: 1, limit: 10 }));
    }
  }, [activeTab, isAuthenticated, dispatch]);
  const filteredBookings = bookings.filter((booking2) => {
    if (activeTab === "upcoming") {
      return ["created", "assigned", "arrived", "inProgress"].includes(booking2.status);
    } else if (activeTab === "cancelled") {
      return booking2.status === "cancelled";
    } else if (activeTab === "completed") {
      return booking2.status === "completed";
    }
    return true;
  });
  const formatDate = (dateString) => {
    if (!dateString) return "";
    const date = new Date(dateString);
    return date.toLocaleDateString("en-IN", {
      day: "numeric",
      month: "short",
      year: "2-digit"
    });
  };
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "bg-[#f0f6ff] min-h-screen pt-16", children: [
      /* @__PURE__ */ jsx("div", { className: "bg-[#fc6325] h-[120px] flex items-center p-4 text-xl font-bold", children: /* @__PURE__ */ jsx("h1", { className: "ml-[170px] font-semibold text-2xl text-white", children: t("trips.yourTrips") }) }),
      /* @__PURE__ */ jsxs("div", { className: "flex ml-[170px] gap-20 mt-6", children: [
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: () => setActiveTab("upcoming"),
            className: `flex items-center gap-2 pb-2 ${activeTab === "upcoming" ? "border-b-2 border-[#fc6325] font-semibold text-black" : "text-gray-500"}`,
            children: [
              /* @__PURE__ */ jsx(Briefcase, { size: 18 }),
              " ",
              t("trips.upcomingBookings")
            ]
          }
        ),
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: () => setActiveTab("cancelled"),
            className: `flex items-center gap-2 pb-2 ${activeTab === "cancelled" ? "border-b-2 border-[#fc6325] font-semibold text-black" : "text-gray-500"}`,
            children: [
              /* @__PURE__ */ jsx(XCircle, { size: 18 }),
              " ",
              t("trips.cancelledBookings")
            ]
          }
        ),
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: () => setActiveTab("completed"),
            className: `flex items-center gap-2 pb-2 ${activeTab === "completed" ? "border-b-2 border-[#fc6325] font-semibold text-black" : "text-gray-500"}`,
            children: [
              /* @__PURE__ */ jsx(Backpack, { size: 18 }),
              " ",
              t("trips.completedBookings")
            ]
          }
        )
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "ml-[170px] mt-10", children: [
        bookingsLoading && /* @__PURE__ */ jsx("div", { className: "bg-white shadow-md rounded-lg p-8 w-[700px] flex justify-center items-center", children: /* @__PURE__ */ jsx("p", { className: "text-gray-600", children: t("trips.loadingTrips") }) }),
        bookingsError && /* @__PURE__ */ jsx("div", { className: "bg-white shadow-md rounded-lg p-8 w-[700px]", children: /* @__PURE__ */ jsx("p", { className: "text-red-500", children: bookingsError }) }),
        !bookingsLoading && !bookingsError && filteredBookings.length === 0 && /* @__PURE__ */ jsxs("div", { className: "bg-white shadow-md rounded-lg p-8 w-[700px] flex gap-6 items-center", children: [
          /* @__PURE__ */ jsx(
            "img",
            {
              src: "https://cdn-icons-png.flaticon.com/512/201/201623.png",
              alt: "Trips",
              className: "w-36 h-36"
            }
          ),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("p", { className: "text-gray-700 font-medium", children: [
              t("trips.noTrips"),
              " ",
              activeTab,
              " ",
              t("trips.bookingsWithEasyride")
            ] }),
            /* @__PURE__ */ jsx("p", { className: "font-bold text-black mt-1", children: t("trips.tripsWillShowHere") }),
            /* @__PURE__ */ jsx(
              "button",
              {
                onClick: () => navigate("/"),
                className: "mt-5 px-6 py-2 bg-[#fc6325] text-white rounded-md shadow hover:bg-[#fc6325] transition",
                children: t("trips.startBookingNow")
              }
            )
          ] })
        ] }),
        !bookingsLoading && !bookingsError && filteredBookings.length > 0 && /* @__PURE__ */ jsx("div", { className: "space-y-4 w-[700px]", children: filteredBookings.map((booking2) => {
          var _a, _b, _c;
          const canCancel = ["created", "assigned", "arrived", "enRoute"].includes(booking2.status);
          return /* @__PURE__ */ jsx(
            "div",
            {
              className: "bg-white shadow-md rounded-lg p-6 hover:shadow-lg transition",
              children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
                /* @__PURE__ */ jsxs("div", { className: "flex-1", onClick: () => navigate(`/booking/${booking2._id}`), style: { cursor: "pointer" }, children: [
                  /* @__PURE__ */ jsxs("p", { className: "text-lg font-semibold text-gray-800", children: [
                    ((_a = booking2.pickupLocation) == null ? void 0 : _a.address) || "Pickup",
                    " → ",
                    ((_b = booking2.dropLocation) == null ? void 0 : _b.address) || "Drop"
                  ] }),
                  /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mt-1", children: [
                    t("trips.orderId"),
                    ": ",
                    booking2.orderId
                  ] }),
                  /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
                    formatDate(booking2.scheduledTime || booking2.createdAt),
                    " | ",
                    t(`tripTypes.${booking2.tripType}`) || booking2.tripType
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                  /* @__PURE__ */ jsxs("p", { className: "text-lg font-bold text-orange-600", children: [
                    "₹",
                    ((_c = booking2.fare) == null ? void 0 : _c.total) || 0
                  ] }),
                  /* @__PURE__ */ jsx(
                    "span",
                    {
                      className: `text-xs px-2 py-1 rounded ${booking2.status === "completed" ? "bg-green-100 text-green-700" : booking2.status === "cancelled" ? "bg-red-100 text-red-700" : "bg-blue-100 text-blue-700"}`,
                      children: t(`booking.status.${booking2.status}`) || booking2.status
                    }
                  ),
                  canCancel && /* @__PURE__ */ jsx(
                    "button",
                    {
                      onClick: (e) => {
                        e.stopPropagation();
                        console.log("Cancel button clicked for booking:", booking2._id);
                        console.log("Booking data:", booking2);
                        setSelectedBooking(booking2);
                        setShowCancelModal(true);
                      },
                      className: "mt-2 px-3 py-1 bg-red-500 text-white text-xs rounded hover:bg-red-600 transition",
                      children: "Cancel Booking"
                    }
                  ),
                  !canCancel && booking2.status !== "cancelled" && booking2.status !== "completed" && /* @__PURE__ */ jsx("p", { className: "mt-2 text-xs text-gray-500 italic", children: "Cannot cancel this booking" })
                ] })
              ] })
            },
            booking2._id
          );
        }) })
      ] })
    ] }),
    showCancelModal && selectedBooking && /* @__PURE__ */ jsx(
      CancelBookingModal,
      {
        booking: selectedBooking,
        onClose: () => {
          setShowCancelModal(false);
          setSelectedBooking(null);
        },
        onSuccess: () => {
          setShowCancelModal(false);
          setSelectedBooking(null);
          dispatch(getAllBookings({ status: getStatusForTab(activeTab), page: 1, limit: 10 }));
        }
      }
    )
  ] });
};
const InputField = ({ label, name, value, placeholder, type = "text", onChange, disabled = false }) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
  /* @__PURE__ */ jsx("label", { className: "block text-xs font-medium text-gray-700 mb-1 uppercase tracking-wide", children: label }),
  /* @__PURE__ */ jsx(
    "input",
    {
      name,
      type,
      value,
      placeholder,
      onChange,
      disabled,
      className: `w-full p-3 border border-gray-300 rounded focus:outline-none focus:border-orange-500 text-gray-900 ${disabled ? "bg-gray-100 cursor-not-allowed" : ""}`
    }
  )
] });
const SelectField = ({ label, name, value, options, placeholder, onChange }) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
  /* @__PURE__ */ jsx("label", { className: "block text-xs font-medium text-gray-700 mb-1 uppercase tracking-wide", children: label }),
  /* @__PURE__ */ jsxs("div", { className: "relative", children: [
    /* @__PURE__ */ jsxs(
      "select",
      {
        name,
        value,
        onChange,
        className: "w-full p-3 border border-gray-300 rounded bg-white text-gray-900 font-normal appearance-none focus:outline-none focus:border-orange-500",
        children: [
          /* @__PURE__ */ jsx("option", { value: "", children: placeholder || "Select" }),
          options && options.map((option, index) => /* @__PURE__ */ jsx("option", { value: option, children: option }, index))
        ]
      }
    ),
    /* @__PURE__ */ jsx(ChevronDown, { className: "absolute right-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-black pointer-events-none" })
  ] })
] });
const Profile = () => {
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const { t } = useTranslation();
  const { user, profileLoading, loading, error, message, isAuthenticated } = useSelector((state) => state.auth);
  const [formData, setFormData] = useState({
    fullName: "",
    email: "",
    phone: "",
    address: "",
    city: "",
    state: "",
    pincode: "",
    // Additional fields if supported
    gender: "",
    dob: "",
    nationality: "",
    maritalStatus: "",
    anniversaryDate: ""
  });
  const [passwordData, setPasswordData] = useState({
    currentPassword: "",
    newPassword: "",
    confirmPassword: ""
  });
  const [activeTab, setActiveTab] = useState("profile");
  const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
  useEffect(() => {
    if (!isAuthenticated) {
      navigate("/");
    } else {
      dispatch(getProfile());
    }
  }, [isAuthenticated, dispatch, navigate]);
  useEffect(() => {
    var _a, _b, _c, _d;
    if (user) {
      setFormData({
        fullName: user.fullName || "",
        email: user.email || "",
        phone: user.phone || "",
        // Handle nested address safely or if flattened
        address: ((_a = user.fullAddress) == null ? void 0 : _a.address) || "",
        city: ((_b = user.fullAddress) == null ? void 0 : _b.city) || "",
        state: ((_c = user.fullAddress) == null ? void 0 : _c.state) || "",
        pincode: ((_d = user.fullAddress) == null ? void 0 : _d.pincode) || "",
        gender: user.gender || "",
        dob: user.dob ? new Date(user.dob).toISOString().split("T")[0] : "",
        nationality: user.nationality || "",
        maritalStatus: user.maritalStatus || "",
        anniversaryDate: user.anniversaryDate ? new Date(user.anniversaryDate).toISOString().split("T")[0] : ""
      });
    }
  }, [user]);
  const handleInputChange = (e) => {
    setFormData({ ...formData, [e.target.name]: e.target.value });
  };
  const handlePasswordChange = (e) => {
    setPasswordData({ ...passwordData, [e.target.name]: e.target.value });
  };
  const onSaveProfile = () => {
    const updatePayload = {
      fullName: formData.fullName,
      email: formData.email,
      phone: formData.phone,
      fullAddress: {
        address: formData.address,
        city: formData.city,
        state: formData.state,
        pincode: formData.pincode
      },
      gender: formData.gender,
      dob: formData.dob,
      nationality: formData.nationality,
      maritalStatus: formData.maritalStatus,
      anniversaryDate: formData.anniversaryDate
    };
    dispatch(updateProfile(updatePayload)).then(() => {
      dispatch(getProfile());
    });
  };
  const onStartChangePassword = () => {
    if (passwordData.newPassword !== passwordData.confirmPassword) {
      toast$2.error(t("profile.passwordMismatch"));
      return;
    }
    dispatch(changePassword({
      currentPassword: passwordData.currentPassword,
      newPassword: passwordData.newPassword
    }));
    setPasswordData({ currentPassword: "", newPassword: "", confirmPassword: "" });
  };
  const onLogout = async () => {
    await dispatch(logoutUser());
    navigate("/");
  };
  const onDeleteAccount = async () => {
    if (window.confirm(t("profile.deleteConfirm"))) {
      await dispatch(deleteAccount());
      navigate("/");
    }
  };
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex flex-col", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsx("div", { className: "bg-orange-500 h-[200px] relative", children: /* @__PURE__ */ jsxs("div", { className: "absolute left-4 md:left-[150px] top-[50px] flex items-center space-x-6", children: [
      /* @__PURE__ */ jsx("div", { className: "relative mt-11", children: /* @__PURE__ */ jsx("div", { className: "w-20 h-20 rounded-full bg-gray-200 border-2 border-white overflow-hidden", children: (user == null ? void 0 : user.profileImageUrl) ? /* @__PURE__ */ jsx("img", { src: user.profileImageUrl, alt: "Profile", className: "w-full h-full object-cover" }) : /* @__PURE__ */ jsx("div", { className: "w-full h-full flex items-center justify-center text-gray-400", children: /* @__PURE__ */ jsx(Camera, { size: 24 }) }) }) }),
      /* @__PURE__ */ jsxs("div", { className: "text-white mt-11", children: [
        /* @__PURE__ */ jsx("h1", { className: "font-semibold text-xl", children: formData.fullName || "User" }),
        /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
          formData.phone,
          " · ",
          formData.email
        ] })
      ] })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row flex-1", children: [
      /* @__PURE__ */ jsx("div", { className: "w-full md:w-64 bg-white md:min-h-screen shadow-sm md:border-r", children: /* @__PURE__ */ jsxs("div", { className: "p-6 md:ml-10 mt-6", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-sm font-medium text-black mb-4", children: t("profile.myAccount") }),
        /* @__PURE__ */ jsxs("nav", { className: "space-y-2", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => setActiveTab("profile"),
              className: `flex w-full items-center text-sm py-2 ${activeTab === "profile" ? "text-orange-600 font-bold" : "text-gray-800 hover:text-orange-600"}`,
              children: [
                "👤 ",
                t("profile.title")
              ]
            }
          ),
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => setActiveTab("password"),
              className: `flex w-full items-center text-sm py-2 ${activeTab === "password" ? "text-orange-600 font-bold" : "text-gray-800 hover:text-orange-600"}`,
              children: [
                "🔒 ",
                t("profile.security")
              ]
            }
          ),
          /* @__PURE__ */ jsxs("div", { className: "border-t my-4 pt-4", children: [
            /* @__PURE__ */ jsxs("button", { onClick: onLogout, className: "flex w-full items-center text-sm text-gray-800 hover:text-red-600 py-2", children: [
              "🚪 ",
              t("nav.logout")
            ] }),
            /* @__PURE__ */ jsxs("button", { onClick: onDeleteAccount, className: "flex w-full items-center text-sm text-red-600 hover:text-red-800 py-2 mt-2 font-semibold", children: [
              "⚠️ ",
              t("profile.deleteAccount")
            ] })
          ] })
        ] })
      ] }) }),
      /* @__PURE__ */ jsx("div", { className: "flex-1 p-6 bg-gray-50", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto", children: [
        activeTab === "profile" && /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-6 mt-4", children: [
            /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-gray-800", children: t("profile.title") }),
            /* @__PURE__ */ jsx(
              "button",
              {
                onClick: onSaveProfile,
                disabled: profileLoading,
                className: "px-6 py-2 bg-orange-500 text-white rounded font-medium hover:bg-orange-600 transition disabled:bg-gray-400",
                children: profileLoading ? t("common.saving") : t("common.save")
              }
            )
          ] }),
          !formData.email || formData.email.startsWith("user_") || !formData.address ? /* @__PURE__ */ jsxs("div", { className: "bg-red-50 border border-red-200 rounded-xl p-5 mb-8 flex items-start space-x-4 shadow-sm animate-pulse", children: [
            /* @__PURE__ */ jsx("div", { className: "bg-red-500 text-white p-2 rounded-lg", children: /* @__PURE__ */ jsx(AlertCircle, { size: 20 }) }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("h3", { className: "text-red-800 font-bold text-sm uppercase tracking-wider", children: t("profile.actionRequired") }),
              /* @__PURE__ */ jsx("p", { className: "text-red-600 text-sm mt-1", children: t("profile.provideDetails") })
            ] })
          ] }) : /* @__PURE__ */ jsxs("div", { className: "bg-emerald-50 border border-emerald-200 rounded-xl p-5 mb-8 flex items-start space-x-4 shadow-sm", children: [
            /* @__PURE__ */ jsx("div", { className: "bg-emerald-500 text-white p-2 rounded-lg", children: /* @__PURE__ */ jsx(CheckCircle2, { size: 20 }) }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("h3", { className: "text-emerald-800 font-bold text-sm uppercase tracking-wider", children: t("profile.profileComplete") }),
              /* @__PURE__ */ jsx("p", { className: "text-emerald-600 text-sm mt-1", children: t("profile.profileVerified") })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm p-6 mb-6", children: [
            /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-800 mb-4", children: t("profile.generalInfo") }),
            /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
              /* @__PURE__ */ jsx(InputField, { label: t("profile.name"), name: "fullName", value: formData.fullName, onChange: handleInputChange }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.email"), name: "email", value: formData.email, onChange: handleInputChange, disabled: false }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.phone"), name: "phone", value: formData.phone, onChange: handleInputChange }),
              /* @__PURE__ */ jsx(SelectField, { label: t("profile.gender"), name: "gender", value: formData.gender, onChange: handleInputChange, options: ["FEMALE", "MALE", "OTHER"] }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.dob"), name: "dob", value: formData.dob, onChange: handleInputChange, type: "date" }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.nationality"), name: "nationality", value: formData.nationality, onChange: handleInputChange, placeholder: "Enter Nationality" }),
              /* @__PURE__ */ jsx(SelectField, { label: t("profile.maritalStatus"), name: "maritalStatus", value: formData.maritalStatus, onChange: handleInputChange, options: ["Single", "Married"] })
            ] }),
            /* @__PURE__ */ jsx("h2", { className: "text-lg font-semibold text-gray-800 mt-8 mb-4", children: t("profile.address") }),
            /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4", children: [
              /* @__PURE__ */ jsx("div", { className: "md:col-span-2", children: /* @__PURE__ */ jsx(InputField, { label: t("profile.streetAddress"), name: "address", value: formData.address, onChange: handleInputChange }) }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.city"), name: "city", value: formData.city, onChange: handleInputChange }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.state"), name: "state", value: formData.state, onChange: handleInputChange }),
              /* @__PURE__ */ jsx(InputField, { label: t("profile.pincode"), name: "pincode", value: formData.pincode, onChange: handleInputChange })
            ] })
          ] })
        ] }),
        activeTab === "password" && /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsx("div", { className: "flex justify-between items-center mb-6 mt-4", children: /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-gray-800", children: t("profile.changePassword") }) }),
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm p-6 mb-6 max-w-lg", children: [
            /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mb-6", children: [
              " ",
              t("profile.passwordSecure")
            ] }),
            /* @__PURE__ */ jsx(
              InputField,
              {
                label: t("profile.currentPassword"),
                name: "currentPassword",
                type: "password",
                value: passwordData.currentPassword,
                onChange: handlePasswordChange
              }
            ),
            /* @__PURE__ */ jsx(
              InputField,
              {
                label: t("profile.newPassword"),
                name: "newPassword",
                type: "password",
                value: passwordData.newPassword,
                onChange: handlePasswordChange
              }
            ),
            /* @__PURE__ */ jsx(
              InputField,
              {
                label: t("profile.confirmPassword"),
                name: "confirmPassword",
                type: "password",
                value: passwordData.confirmPassword,
                onChange: handlePasswordChange
              }
            ),
            /* @__PURE__ */ jsx(
              "button",
              {
                onClick: onStartChangePassword,
                disabled: loading,
                className: "w-full mt-4 px-6 py-3 bg-orange-500 text-white rounded font-medium hover:bg-orange-600 transition disabled:bg-gray-400",
                children: loading ? t("common.updating") : t("profile.changePassword").toUpperCase()
              }
            )
          ] })
        ] })
      ] }) })
    ] }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const Top = () => {
  var _a, _b;
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const { slug } = distExports.useParams();
  const { t } = useTranslation();
  const {
    currentIntercityRoute,
    currentIntercityLoading
  } = useSelector((state) => state.seo);
  const [showKnowMore, setShowKnowMore] = useState(false);
  const [tripType, setTripType] = useState("oneway");
  const [fromLocation, setFromLocation] = useState("");
  const [toLocation, setToLocation] = useState("");
  const [pickupDate, setPickupDate] = useState("");
  const [returnDate, setReturnDate] = useState("");
  const [pickupTime, setPickupTime] = useState("10:00 AM");
  const [stops, setStops] = useState([]);
  const [showTripTypeDropdown, setShowTripTypeDropdown] = useState(false);
  const [showLocationModal, setShowLocationModal] = useState(false);
  const [showStopsModal, setShowStopsModal] = useState(false);
  const [showDateModal, setShowDateModal] = useState(false);
  const [showTimeModal, setShowTimeModal] = useState(false);
  const [locationType, setLocationType] = useState("");
  const [dateType, setDateType] = useState("pickup");
  const [showReviewsModal, setShowReviewsModal] = useState(false);
  const [openFAQ, setOpenFAQ] = useState(null);
  const [currentUserLocation, setCurrentUserLocation] = useState(null);
  const [searchLoading, setSearchLoading] = useState(false);
  const routeFromState = (_a = location.state) == null ? void 0 : _a.route;
  const parseSlugToCities = (slug2) => {
    if (!slug2) return { origin: "", destination: "" };
    const match = slug2.match(/^(.+)-to-(.+)-cab$/i);
    if (match) {
      const capitalize = (str) => str.split("-").map(
        (word) => word.charAt(0).toUpperCase() + word.slice(1)
      ).join(" ");
      return {
        origin: capitalize(match[1]),
        destination: capitalize(match[2])
      };
    }
    return { origin: "", destination: "" };
  };
  const parsedCities = parseSlugToCities(slug);
  useEffect(() => {
    if (slug) {
      dispatch(getIntercityRouteBySlug(slug));
    }
  }, [dispatch, slug]);
  useEffect(() => {
    const route2 = currentIntercityRoute || routeFromState;
    if (route2) {
      setFromLocation(route2.originCity || "");
      setToLocation(route2.destinationCity || "");
    } else if (parsedCities.origin) {
      setFromLocation(parsedCities.origin);
      setToLocation(parsedCities.destination);
    }
    const tomorrow = /* @__PURE__ */ new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);
    setPickupDate(tomorrow.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }));
  }, [currentIntercityRoute, routeFromState, parsedCities.origin, parsedCities.destination]);
  const route = currentIntercityRoute || routeFromState;
  const vehicleOptions = (route == null ? void 0 : route.vehicleOptions) || [];
  const faqs = (route == null ? void 0 : route.faqs) || [];
  const nearbyRoutes = (route == null ? void 0 : route.nearbyRoutes) || [];
  const inwardRoutes = (route == null ? void 0 : route.inwardRoutes) || [];
  const routesToOrigin = (route == null ? void 0 : route.routesToOriginRaw) || [];
  const routesFromDestination = (route == null ? void 0 : route.routesFromDestinationRaw) || [];
  const displayOrigin = (route == null ? void 0 : route.originCity) || parsedCities.origin || fromLocation;
  const displayDestination = (route == null ? void 0 : route.destinationCity) || parsedCities.destination || toLocation;
  const routeNotFound = !currentIntercityLoading && !route && slug;
  const [currentDisplayDate, setCurrentDisplayDate] = useState(/* @__PURE__ */ new Date());
  const getDaysInMonth = (date) => {
    return new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
  };
  const getFirstDayOfMonth = (date) => {
    return new Date(date.getFullYear(), date.getMonth(), 1).getDay();
  };
  const generateCalendarDays = () => {
    const daysInMonth = getDaysInMonth(currentDisplayDate);
    const firstDay = getFirstDayOfMonth(currentDisplayDate);
    const days = [];
    const startOffset = firstDay === 0 ? 6 : firstDay - 1;
    for (let i = 0; i < startOffset; i++) {
      days.push({ day: "", otherMonth: true });
    }
    for (let i = 1; i <= daysInMonth; i++) {
      days.push({
        day: i.toString(),
        date: new Date(currentDisplayDate.getFullYear(), currentDisplayDate.getMonth(), i)
      });
    }
    return days;
  };
  const calendarDays = generateCalendarDays();
  const changeMonth = (offset) => {
    const newDate = new Date(currentDisplayDate);
    newDate.setMonth(newDate.getMonth() + offset);
    setCurrentDisplayDate(newDate);
  };
  const generateTimeSlots = () => {
    const times = [];
    for (let hour = 0; hour < 24; hour++) {
      for (let minute = 0; minute < 60; minute += 15) {
        const period = hour >= 12 ? "PM" : "AM";
        const displayHour = hour % 12 || 12;
        const timeString = `${displayHour}:${minute.toString().padStart(2, "0")} ${period}`;
        times.push(timeString);
      }
    }
    return times;
  };
  const timeSlots = generateTimeSlots();
  const tripTypeOptions = [
    { value: "oneway", label: t("tripTypes.oneway") },
    { value: "round", label: t("tripTypes.round") }
  ];
  const handleLocationSelect = (location2) => {
    if (locationType === "from") {
      setFromLocation(location2);
    } else if (locationType === "to") {
      setToLocation(location2);
    }
    setShowLocationModal(false);
  };
  const handleDateSelect = (dayObj) => {
    if (dayObj && !dayObj.otherMonth && dayObj.date) {
      const dateStr = dayObj.date.toLocaleDateString("en-GB", {
        day: "numeric",
        month: "short",
        year: "numeric"
      });
      if (dateType === "return") {
        setReturnDate(dateStr);
      } else {
        setPickupDate(dateStr);
      }
      setShowDateModal(false);
    }
  };
  const handleTimeSelect = (time) => {
    setPickupTime(time);
    setShowTimeModal(false);
  };
  const addStop = () => setStops([...stops, { id: Date.now(), value: "" }]);
  const removeStop = (id) => setStops(stops.filter((stop) => stop.id !== id));
  const handleStopChange = (id, value) => {
    setStops(stops.map((stop) => stop.id === id ? { ...stop, value } : stop));
  };
  const handleUpdateSearch = async () => {
    setSearchLoading(true);
    try {
      if (!fromLocation) {
        toast$2.error("Please enter a pickup location");
        setSearchLoading(false);
        return;
      }
      if (!toLocation) {
        toast$2.error("Please enter a drop location");
        setSearchLoading(false);
        return;
      }
      if (tripType === "round" && !returnDate) {
        toast$2.error("Please select a return date for round trip");
        setSearchLoading(false);
        return;
      }
      let sourceCoords;
      if (fromLocation === "Current Location" && currentUserLocation) {
        sourceCoords = currentUserLocation;
      } else {
        sourceCoords = await geocodeLocation(fromLocation);
      }
      if (!sourceCoords) {
        toast$2.error(`Could not find location: ${fromLocation}`);
        setSearchLoading(false);
        return;
      }
      let destCoords = await geocodeLocation(toLocation);
      if (!destCoords) {
        toast$2.error(`Could not find location: ${toLocation}`);
        setSearchLoading(false);
        return;
      }
      const validStops = [];
      if (stops.length > 0) {
        for (const stop of stops) {
          if (!stop.value || stop.value.trim() === "") continue;
          const stopCoords = await geocodeLocation(stop.value);
          if (stopCoords) {
            validStops.push({
              address: stop.value,
              coordinates: [stopCoords.lng, stopCoords.lat],
              stopOrder: validStops.length + 1
            });
          }
        }
      }
      const searchParams = {
        from: fromLocation,
        to: toLocation,
        sourceLat: sourceCoords.lat,
        sourceLong: sourceCoords.lng,
        destLat: destCoords.lat,
        destLong: destCoords.lng,
        tripType: tripType === "oneway" ? "oneWay" : "roundTrip",
        fuelType: "petrol",
        isAc: true,
        pickupDate,
        pickupTime,
        returnDate,
        startTime: (/* @__PURE__ */ new Date()).toISOString(),
        stops: validStops.length > 0 ? validStops : void 0
      };
      navigate("/results", { state: { searchParams } });
    } catch (error) {
      console.error("Search error:", error);
      toast$2.error("Something went wrong with the search");
    } finally {
      setSearchLoading(false);
    }
  };
  const handleSelectVehicle = (vehicle) => {
    const originCoords = (route == null ? void 0 : route.originCoords) || { lat: 0, lng: 0 };
    const destCoords = (route == null ? void 0 : route.destCoords) || { lat: 0, lng: 0 };
    const vehicleId = vehicle._id || vehicle.vehicleId || vehicle.groupId;
    navigate(`/details/${vehicleId}`, {
      state: {
        vehicleId,
        picklat: originCoords.lat,
        picklng: originCoords.lng,
        pickupAddress: fromLocation || (route == null ? void 0 : route.originCity),
        pickupCity: (route == null ? void 0 : route.originCity) || fromLocation,
        pickupState: "",
        droplat: destCoords.lat,
        droplng: destCoords.lng,
        dropAddress: toLocation || (route == null ? void 0 : route.destinationCity),
        dropCity: (route == null ? void 0 : route.destinationCity) || toLocation,
        dropState: "",
        distance: (route == null ? void 0 : route.distance) || 0,
        tripType: tripType === "round" ? "roundTrip" : "oneWay",
        fuelType: vehicle.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        vehicle,
        route,
        tripDetails: {
          from: fromLocation,
          to: toLocation,
          date: pickupDate,
          time: pickupTime,
          tripType,
          stops
        }
      }
    });
  };
  const LocationModal = () => {
    const [searchText, setSearchText] = useState("");
    const handleCurrentLocation = () => {
      if ("geolocation" in navigator) {
        navigator.geolocation.getCurrentPosition(
          (position) => {
            const coords = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };
            setCurrentUserLocation(coords);
            handleLocationSelect("Current Location");
          },
          (error) => {
            console.error("Error getting location:", error);
            toast$2.error(t("errors.locationError") || "Could not get location");
          }
        );
      } else {
        toast$2.error(t("errors.geolocationNotSupported") || "Geolocation not supported");
      }
    };
    return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
      /* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: locationType === "from" ? t("hero.from").toUpperCase() : t("hero.to").toUpperCase() }),
          /* @__PURE__ */ jsx("button", { onClick: () => setShowLocationModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
          LocationAutocomplete,
          {
            value: searchText,
            onChange: setSearchText,
            onLocationSelect: handleLocationSelect,
            placeholder: `${t("common.search")} ${locationType === "from" ? t("hero.from") : t("hero.to")}...`
          }
        ) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: handleCurrentLocation,
          className: "flex items-center gap-2 text-blue-600 text-sm font-medium mb-4 hover:bg-blue-50 p-2 rounded w-full transition-colors",
          children: [
            /* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
            " ",
            t("common.useCurrentLocation")
          ]
        }
      ) })
    ] }) });
  };
  const StopsModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: t("hero.addStops").replace("+ ", "") }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      stops.map((stop, index) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
        /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mb-2", children: [
          t("tripDetails.stop"),
          " ",
          index + 1
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsx(
            LocationAutocomplete,
            {
              value: stop.value,
              onChange: (val) => handleStopChange(stop.id, val),
              onLocationSelect: (val) => handleStopChange(stop.id, val),
              placeholder: t("tripDetails.stop"),
              className: "flex-1"
            }
          ),
          /* @__PURE__ */ jsx("button", { onClick: () => removeStop(stop.id), className: "text-gray-500 hover:text-red-500", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] })
      ] }, stop.id)),
      /* @__PURE__ */ jsxs("button", { onClick: addStop, className: "flex items-center gap-2 text-blue-600 text-sm font-medium mt-4", children: [
        /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
        " ",
        t("hero.addStops")
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-gray-200", children: /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "w-full bg-blue-600 text-white py-3 rounded-lg font-semibold", children: t("common.done").toUpperCase() }) })
  ] }) });
  const DateModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: dateType === "return" ? "RETURN DATE" : t("hero.pickupDate").toUpperCase() }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowDateModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4 text-gray-900", children: [
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(-1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 rotate-90" }) }),
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold uppercase", children: currentDisplayDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 -rotate-90" }) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-2", children: [t("weekDays.mon"), t("weekDays.tue"), t("weekDays.wed"), t("weekDays.thu"), t("weekDays.fri"), t("weekDays.sat"), t("weekDays.sun")].map((day) => /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-500 font-medium py-2", children: day }, day)) }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: calendarDays.map((dayObj, index) => {
        var _a2;
        const currentDateStr = (_a2 = dayObj.date) == null ? void 0 : _a2.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" });
        const isSelected = currentDateStr === (dateType === "return" ? returnDate : pickupDate);
        return /* @__PURE__ */ jsx(
          "div",
          {
            className: `h-10 flex items-center justify-center rounded-full text-sm font-medium cursor-pointer
                    ${!dayObj.day || dayObj.otherMonth ? "text-transparent pointer-events-none" : "text-gray-700 hover:bg-gray-100"}
                    ${isSelected ? "bg-orange-500 text-white hover:bg-orange-600" : ""}
                  `,
            onClick: () => handleDateSelect(dayObj),
            children: dayObj.day
          },
          index
        );
      }) })
    ] })
  ] }) });
  const TimeModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: t("hero.pickupTime").toUpperCase() }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowTimeModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto p-4", children: timeSlots.map((time, index) => /* @__PURE__ */ jsx(
      "div",
      {
        className: `py-3 border-b text-black border-gray-100 cursor-pointer hover:bg-gray-50 ${pickupTime === time ? "bg-blue-50" : ""}`,
        onClick: () => handleTimeSelect(time),
        children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: time })
      },
      index
    )) })
  ] }) });
  if (currentIntercityLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-white flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-orange-500 mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: "Loading route details..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-white", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    showLocationModal && /* @__PURE__ */ jsx(LocationModal, {}),
    showStopsModal && /* @__PURE__ */ jsx(StopsModal, {}),
    showDateModal && /* @__PURE__ */ jsx(DateModal, {}),
    showTimeModal && /* @__PURE__ */ jsx(TimeModal, {}),
    /* @__PURE__ */ jsx("div", { className: "w-full bg-orange-500 py-4 px-4 mt-16", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-8 ml-8", children: [
        /* @__PURE__ */ jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.tripType").toUpperCase() }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md flex items-center gap-1 text-black min-w-[180px]",
              onClick: () => setShowTripTypeDropdown(!showTripTypeDropdown),
              children: [
                (_b = tripTypeOptions.find((opt) => opt.value === tripType)) == null ? void 0 : _b.label,
                /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
              ]
            }
          ),
          showTripTypeDropdown && /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 mt-1 bg-white text-black border border-gray-200 rounded-md shadow-lg z-10 min-w-[180px]", children: tripTypeOptions.map((option) => /* @__PURE__ */ jsx(
            "div",
            {
              className: `px-4 py-2 cursor-pointer hover:bg-gray-100 ${tripType === option.value ? "bg-blue-50 text-blue-600" : ""}`,
              onClick: () => {
                setTripType(option.value);
                setShowTripTypeDropdown(false);
              },
              children: option.label
            },
            option.value
          )) })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.from").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("from");
                setShowLocationModal(true);
              },
              children: fromLocation || t("common.select")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "mt-5 relative inline-block", children: [
          /* @__PURE__ */ jsx("span", { className: "absolute -top-3 right-2 text-[11px] px-1.5 py-[1px] bg-white text-purple-600 border border-black rounded-md font-semibold shadow-sm", children: t("hero.new") }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3] shadow",
              onClick: () => setShowStopsModal(true),
              children: t("hero.addStops")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.to").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("to");
                setShowLocationModal(true);
              },
              children: toLocation || t("common.select")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.pickupDate").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setDateType("pickup");
                setShowDateModal(true);
              },
              children: pickupDate || t("common.selectDate")
            }
          )
        ] }),
        tripType === "round" && /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "RETURN DATE" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setDateType("return");
                setShowDateModal(true);
              },
              children: returnDate || "Select Date"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.pickupTime").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => setShowTimeModal(true),
              children: pickupTime
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
        "button",
        {
          className: "text-lg font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3]",
          onClick: handleUpdateSearch,
          disabled: searchLoading,
          children: searchLoading ? "SEARCHING..." : t("common.updateSearch").toUpperCase()
        }
      ) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "bg-[#f4f4f4] px-6 py-6", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto", children: [
      /* @__PURE__ */ jsxs("div", { className: "text-sm text-gray-500 mb-3", children: [
        t("nav.home"),
        " › ",
        t("nav.cabBooking"),
        " › ",
        displayOrigin,
        " ",
        t("hero.to"),
        " ",
        displayDestination,
        " ",
        t("nav.cabBooking")
      ] }),
      /* @__PURE__ */ jsxs("h1", { className: "text-2xl font-bold text-gray-900", children: [
        displayOrigin,
        " ",
        t("hero.to"),
        " ",
        displayDestination,
        " Cabs",
        " ",
        (route == null ? void 0 : route.startsFrom) && /* @__PURE__ */ jsxs("span", { className: "text-gray-500 text-lg font-normal ml-2", children: [
          "Starts @ ₹",
          route.startsFrom
        ] })
      ] }),
      /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm mt-1", children: 'Use "GOCAB" & get upto Rs 500 off' }),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 mt-2 text-sm text-gray-600", children: [
        /* @__PURE__ */ jsx("span", { className: "text-yellow-500", children: "★ 4.7" }),
        /* @__PURE__ */ jsxs("span", { children: [
          (route == null ? void 0 : route.distance) || 0,
          " ",
          t("common.km"),
          " • ",
          (route == null ? void 0 : route.durationText) || `${Math.round(((route == null ? void 0 : route.duration) || 0) / 60)} hrs`
        ] }),
        (route == null ? void 0 : route.startsFrom) && /* @__PURE__ */ jsx("span", { className: "text-green-600 font-semibold", children: t("hero.startsFrom", { price: route.startsFrom }) })
      ] }),
      routeNotFound && /* @__PURE__ */ jsx("p", { className: "mt-2 text-orange-600 text-sm", children: "This route is not yet configured. Please contact admin to add this route or search manually using the search bar above." })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "bg-[#f4f4f4] py-6", children: /* @__PURE__ */ jsx("div", { className: "max-w-6xl mx-auto space-y-5", children: currentIntercityLoading ? /* @__PURE__ */ jsxs("div", { className: "text-center py-10", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-10 w-10 border-b-2 border-orange-500 mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: t("cabSearch.searchingCabs") })
    ] }) : vehicleOptions.length > 0 ? (
      // Show vehicle options from route data (grouped by category)
      vehicleOptions.map((vehicle, idx) => {
        var _a2;
        return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl border border-gray-200 p-5 flex flex-col sm:flex-row items-center justify-between gap-6 hover:shadow-md transition-shadow", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-5", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
              /* @__PURE__ */ jsx(
                "img",
                {
                  src: vehicle.image || "https://go-assets.ibcdn.com/u/GI/images/1731502913771-sedan-2.png",
                  alt: vehicle.displayName || vehicle.groupName,
                  className: "w-36 h-20 object-contain rounded-lg bg-gray-50 shadow-xl border border-gray-300"
                }
              ),
              /* @__PURE__ */ jsx("span", { className: `mt-2 px-10 py-2 rounded-md text-sm font-medium ${vehicle.fuelType === "cng" ? "bg-blue-100 text-blue-700" : vehicle.fuelType === "electric" ? "bg-green-100 text-green-700" : "bg-orange-100 text-orange-700"}`, children: ((_a2 = vehicle.fuelType) == null ? void 0 : _a2.toUpperCase()) || "PETROL" })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
                /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: vehicle.displayName || vehicle.groupName }),
                /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: vehicle.tier || "Standard" })
              ] }),
              /* @__PURE__ */ jsx("div", { className: "flex items-center gap-3 mt-2", children: /* @__PURE__ */ jsxs("span", { className: "text-sm text-gray-600", children: [
                vehicle.category,
                " • ",
                vehicle.seats || "4",
                " ",
                t("cabSearch.seater"),
                " • AC"
              ] }) })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
            /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium text-gray-900", children: [
              vehicle.includedKm || (route == null ? void 0 : route.distance) || 0,
              " ",
              t("common.km"),
              " included"
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 mt-1", children: [
              "Extra fare ₹",
              vehicle.extraFarePerKm || 15,
              "/km"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
            /* @__PURE__ */ jsxs("p", { className: "text-2xl font-bold text-gray-900", children: [
              "₹",
              vehicle.price || 0
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
              "+ ₹",
              vehicle.estimatedTax || Math.round((vehicle.price || 0) * 0.05),
              " ",
              t("payment.taxes")
            ] }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "mt-3 px-10 py-2.5 bg-blue-600 text-white font-semibold rounded-lg hover:bg-blue-700",
                onClick: () => handleSelectVehicle(vehicle),
                children: t("common.select")
              }
            )
          ] })
        ] }, vehicle.groupId || idx);
      })
    ) : /* @__PURE__ */ jsx("div", { className: "text-center py-10", children: /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t("cabSearch.noCabs") }) }) }) }),
    nearbyRoutes.length > 0 && /* @__PURE__ */ jsx("div", { className: "bg-[rgb(244,244,244)] py-8 border-t border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4", children: [
      /* @__PURE__ */ jsxs("h2", { className: "text-xl font-bold text-gray-900 mb-2", children: [
        "Top Cab Routes from ",
        displayOrigin
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mb-6", children: [
        "Based on the most booked routes from ",
        displayOrigin
      ] }),
      /* @__PURE__ */ jsx("div", { className: "space-y-4", children: nearbyRoutes.map((route2, idx) => {
        var _a2;
        return /* @__PURE__ */ jsx("div", { className: "border border-gray-200 rounded-xl p-5 hover:shadow-md transition-shadow bg-white", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row justify-between items-center gap-4", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
            /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-gray-900", children: [
              route2.originCity,
              " to ",
              route2.destinationCity
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-sm mt-1", children: [
              route2.distance || "0",
              " Kms | ",
              route2.durationText || "N/A",
              " (approx.)"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex-1 text-center md:text-left", children: [
            /* @__PURE__ */ jsxs("p", { className: "font-bold text-gray-900", children: [
              route2.distance,
              " km included"
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-gray-500 text-sm mt-1", children: [
              "Extra fare ₹",
              route2.extraFarePerKm || "13.5",
              "/km after ",
              route2.distance,
              " kms"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-green-600 text-xs font-bold", children: "16% off" }),
              /* @__PURE__ */ jsxs("span", { className: "text-gray-400 text-xs line-through", children: [
                "₹",
                Math.round((route2.startsFrom || 2e3) * 1.19)
              ] }),
              /* @__PURE__ */ jsxs("span", { className: "text-xl font-bold text-gray-900", children: [
                "₹",
                ((_a2 = route2.startsFrom) == null ? void 0 : _a2.toLocaleString()) || "N/A"
              ] })
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-400 mb-2", children: [
              "+ ₹",
              route2.estimatedTax || Math.round((route2.startsFrom || 0) * 0.05),
              " Taxes & fees"
            ] }),
            /* @__PURE__ */ jsx(
              "a",
              {
                href: `/top/${route2.slug}`,
                className: "inline-block bg-blue-600 text-white px-6 py-2 rounded-lg font-semibold text-sm hover:bg-blue-700 transition",
                children: "View Cabs"
              }
            )
          ] })
        ] }) }, idx);
      }) })
    ] }) }),
    inwardRoutes.length > 0 && /* @__PURE__ */ jsx("div", { className: "bg-[rgb(244,244,244)] py-8 border-t border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4", children: [
      /* @__PURE__ */ jsxs("h2", { className: "text-xl font-bold text-gray-900 mb-2", children: [
        "Top Cab Routes to ",
        displayDestination
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mb-6", children: [
        "Popular routes ending at ",
        displayDestination
      ] }),
      /* @__PURE__ */ jsx("div", { className: "space-y-4", children: inwardRoutes.map((route2, idx) => {
        var _a2;
        return /* @__PURE__ */ jsx("div", { className: "border border-gray-200 rounded-xl p-5 hover:shadow-md transition-shadow bg-white", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col md:flex-row justify-between items-center gap-4", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
            /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-gray-900", children: [
              route2.originCity,
              " to ",
              route2.destinationCity
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-sm mt-1", children: [
              route2.distance || "0",
              " Kms | ",
              route2.durationText || "N/A",
              " (approx.)"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex-1 text-center md:text-left", children: [
            /* @__PURE__ */ jsxs("p", { className: "font-bold text-gray-900", children: [
              route2.distance,
              " km included"
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-gray-500 text-sm mt-1", children: [
              "Extra fare ₹",
              route2.extraFarePerKm || "13.5",
              "/km after ",
              route2.distance,
              " kms"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-end gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-green-600 text-xs font-bold", children: "16% off" }),
              /* @__PURE__ */ jsxs("span", { className: "text-gray-400 text-xs line-through", children: [
                "₹",
                Math.round((route2.startsFrom || 2e3) * 1.19)
              ] }),
              /* @__PURE__ */ jsxs("span", { className: "text-xl font-bold text-gray-900", children: [
                "₹",
                ((_a2 = route2.startsFrom) == null ? void 0 : _a2.toLocaleString()) || "N/A"
              ] })
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-400 mb-2", children: [
              "+ ₹",
              route2.estimatedTax || Math.round((route2.startsFrom || 0) * 0.05),
              " Taxes & fees"
            ] }),
            /* @__PURE__ */ jsx(
              "a",
              {
                href: `/top/${route2.slug}`,
                className: "inline-block bg-blue-600 text-white px-6 py-2 rounded-lg font-semibold text-sm hover:bg-blue-700 transition",
                children: "View Cabs"
              }
            )
          ] })
        ] }) }, idx);
      }) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "bg-[rgb(244,244,244)] py-10 border-t border-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4", children: [
      /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
        displayOrigin,
        " to ",
        displayDestination,
        " Cab Services Highlights"
      ] }),
      /* @__PURE__ */ jsx("div", { className: "overflow-x-auto rounded-lg border border-gray-200", children: /* @__PURE__ */ jsxs("table", { className: "w-full text-left bg-white", children: [
        /* @__PURE__ */ jsx("thead", { className: "bg-gray-50 border-b border-gray-200", children: /* @__PURE__ */ jsxs("tr", { children: [
          /* @__PURE__ */ jsx("th", { className: "py-4 px-6 font-semibold text-gray-700", children: "Route" }),
          /* @__PURE__ */ jsx("th", { className: "py-4 px-6 font-semibold text-gray-700", children: "Distance" }),
          /* @__PURE__ */ jsx("th", { className: "py-4 px-6 font-semibold text-gray-700", children: "Duration" }),
          /* @__PURE__ */ jsx("th", { className: "py-4 px-6 font-semibold text-gray-700", children: "Start Price" })
        ] }) }),
        /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsxs("tr", { children: [
          /* @__PURE__ */ jsxs("td", { className: "py-4 px-6 text-gray-600 border-b border-gray-100", children: [
            displayOrigin,
            " to ",
            displayDestination,
            " Cab"
          ] }),
          /* @__PURE__ */ jsxs("td", { className: "py-4 px-6 text-gray-600 border-b border-gray-100", children: [
            (route == null ? void 0 : route.distance) || "N/A",
            " km"
          ] }),
          /* @__PURE__ */ jsx("td", { className: "py-4 px-6 text-gray-600 border-b border-gray-100", children: (route == null ? void 0 : route.durationText) || "N/A" }),
          /* @__PURE__ */ jsxs("td", { className: "py-4 px-6 font-medium text-green-600 border-b border-gray-100", children: [
            "£",
            (route == null ? void 0 : route.startsFrom) || "N/A"
          ] })
        ] }) })
      ] }) })
    ] }) }),
    faqs.length > 0 && /* @__PURE__ */ jsx("div", { className: "bg-[#f4f4f4] py-10", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4", children: [
      /* @__PURE__ */ jsxs("h2", { className: "text-xl font-semibold text-gray-800 mb-6", children: [
        t("faq.title"),
        " ",
        displayOrigin,
        " ",
        t("hero.to"),
        " ",
        displayDestination,
        " Cabs"
      ] }),
      /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg shadow-sm p-6 space-y-4", children: faqs.map((faq2, index) => /* @__PURE__ */ jsxs("div", { className: "border-b border-gray-100 pb-4 last:border-0", children: [
        /* @__PURE__ */ jsxs(
          "button",
          {
            className: "w-full text-left flex justify-between items-center",
            onClick: () => setOpenFAQ(openFAQ === index ? null : index),
            children: [
              /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900", children: faq2.question }),
              /* @__PURE__ */ jsx(ChevronDown, { className: `w-5 h-5 text-gray-500 transition-transform ${openFAQ === index ? "rotate-180" : ""}` })
            ]
          }
        ),
        openFAQ === index && /* @__PURE__ */ jsx("p", { className: "mt-2 text-gray-600 text-sm", children: faq2.answer })
      ] }, index)) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "bg-[rgb(244,244,244)] py-10 border-t border-gray-200 mb-8", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-8", children: [
      nearbyRoutes.length > 0 && /* @__PURE__ */ jsxs("div", { className: "col-span-1 md:col-span-2 lg:col-span-4", children: [
        /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-gray-900 mb-4", children: [
          "Cabs from ",
          displayOrigin
        ] }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-3 gap-x-6", children: nearbyRoutes.map((r, idx) => /* @__PURE__ */ jsxs("a", { href: `/top/${r.slug}`, className: "text-blue-500 hover:underline text-sm truncate block", children: [
          r.originCity,
          " To ",
          r.destinationCity,
          " Cabs"
        ] }, idx)) })
      ] }),
      routesToOrigin.length > 0 && /* @__PURE__ */ jsxs("div", { className: "col-span-1 md:col-span-2 lg:col-span-4 mt-6", children: [
        /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-gray-900 mb-4", children: [
          "Cabs to ",
          displayOrigin
        ] }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-3 gap-x-6", children: routesToOrigin.map((r, idx) => /* @__PURE__ */ jsxs("a", { href: `/top/${r.slug}`, className: "text-blue-500 hover:underline text-sm truncate block", children: [
          r.originCity,
          " To ",
          r.destinationCity,
          " Cabs"
        ] }, idx)) })
      ] }),
      routesFromDestination.length > 0 && /* @__PURE__ */ jsxs("div", { className: "col-span-1 md:col-span-2 lg:col-span-4 mt-6", children: [
        /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-gray-900 mb-4", children: [
          "Cabs from ",
          displayDestination
        ] }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-3 gap-x-6", children: routesFromDestination.map((r, idx) => /* @__PURE__ */ jsxs("a", { href: `/top/${r.slug}`, className: "text-blue-500 hover:underline text-sm truncate block", children: [
          r.originCity,
          " To ",
          r.destinationCity,
          " Cabs"
        ] }, idx)) })
      ] }),
      inwardRoutes.length > 0 && /* @__PURE__ */ jsxs("div", { className: "col-span-1 md:col-span-2 lg:col-span-4 mt-6", children: [
        /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold text-gray-900 mb-4", children: [
          "Cabs to ",
          displayDestination
        ] }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-5 gap-y-3 gap-x-6", children: inwardRoutes.map((r, idx) => /* @__PURE__ */ jsxs("a", { href: `/top/${r.slug}`, className: "text-blue-500 hover:underline text-sm truncate block", children: [
          r.originCity,
          " To ",
          r.destinationCity,
          " Cabs"
        ] }, idx)) })
      ] })
    ] }) }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const TopMobile = () => {
  var _a, _b, _c, _d, _e;
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const { slug } = distExports.useParams();
  const {
    currentIntercityRoute,
    currentIntercityLoading
  } = useSelector((state) => state.seo);
  ((_a = location.state) == null ? void 0 : _a.routeName) || ((_b = location.state) == null ? void 0 : _b.route);
  const parseSlugToCities = (slug2) => {
    if (!slug2) return { origin: "Delhi", destination: "Jaipur" };
    const match = slug2.match(/^(.+)-to-(.+)-cab$/i);
    if (match) {
      const capitalize = (str) => str.split("-").map(
        (word) => word.charAt(0).toUpperCase() + word.slice(1)
      ).join(" ");
      return {
        origin: capitalize(match[1]),
        destination: capitalize(match[2])
      };
    }
    return { origin: "Delhi", destination: "Jaipur" };
  };
  const parsedCities = parseSlugToCities(slug);
  const [fromCity, setFromCity] = useState(parsedCities.origin);
  const [toCity, setToCity] = useState(parsedCities.destination);
  const [tripType, setTripType] = useState("oneway");
  const [pickupDate, setPickupDate] = useState("");
  useEffect(() => {
    const tomorrow = /* @__PURE__ */ new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);
    const formatted = tomorrow.toLocaleDateString("en-IN", { day: "2-digit", month: "short", year: "numeric" });
    setPickupDate(formatted);
  }, []);
  useEffect(() => {
    if (slug) {
      dispatch(getIntercityRouteBySlug(slug));
    }
  }, [dispatch, slug]);
  useEffect(() => {
    const route2 = currentIntercityRoute;
    if (route2) {
      setFromCity(route2.originCity || parsedCities.origin);
      setToCity(route2.destinationCity || parsedCities.destination);
    }
  }, [currentIntercityRoute, parsedCities.origin, parsedCities.destination]);
  const route = currentIntercityRoute;
  const vehicleOptions = (route == null ? void 0 : route.vehicleOptions) || [];
  const handleSwap = () => {
    setFromCity(toCity);
    setToCity(fromCity);
  };
  const handleUpdateSearch = () => {
    if (slug) {
      dispatch(getIntercityRouteBySlug(slug));
    }
  };
  const handleSelectCab = (cab) => {
    const originCoords = (route == null ? void 0 : route.originCoords) || { lat: 0, lng: 0 };
    const destCoords = (route == null ? void 0 : route.destCoords) || { lat: 0, lng: 0 };
    const vehicleId = cab._id || cab.vehicleId || cab.groupId;
    navigate(`/details/${vehicleId}`, {
      state: {
        vehicleId,
        picklat: originCoords.lat,
        picklng: originCoords.lng,
        pickupAddress: fromCity,
        pickupCity: fromCity,
        droplat: destCoords.lat,
        droplng: destCoords.lng,
        dropAddress: toCity,
        dropCity: toCity,
        distance: (route == null ? void 0 : route.distance) || 0,
        tripType: tripType === "round" ? "roundTrip" : "oneWay",
        fuelType: cab.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        vehicle: cab,
        route
      }
    });
  };
  if (currentIntercityLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-[#fff7f2] flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx(Loader, { className: "w-10 h-10 text-[#f97316] animate-spin mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: "Loading route details..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#fff7f2] text-gray-900 px-4 py-4", children: [
    /* @__PURE__ */ jsxs("div", { className: "bg-[#fff0e6] rounded-xl p-3 text-center mb-4 shadow-sm", children: [
      /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center gap-2 font-semibold text-[#f97316] text-sm", children: "Guaranteed On-time Cabs" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-1", children: "Clean cabs • Trusted drivers • 24x7 Support" })
    ] }),
    /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 mb-2", children: [
      "Home › Cab Booking › ",
      /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
        fromCity,
        " to ",
        toCity,
        " Cab"
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl p-4 shadow", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex mb-3 border-b border-gray-200", children: [
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => setTripType("oneway"),
            className: `flex-1 text-center py-2 font-semibold ${tripType === "oneway" ? "border-b-2 border-[#f97316] text-[#f97316]" : "text-gray-500"}`,
            children: "One Way"
          }
        ),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => setTripType("round"),
            className: `flex-1 text-center py-2 font-semibold ${tripType === "round" ? "border-b-2 border-[#f97316] text-[#f97316]" : "text-gray-500"}`,
            children: "Round Trip"
          }
        )
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("label", { className: "text-xs text-gray-500", children: "From (Area, Street or Landmark)" }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between bg-gray-100 rounded-lg p-2 mt-1", children: [
            /* @__PURE__ */ jsx("span", { className: "font-semibold", children: fromCity }),
            /* @__PURE__ */ jsx("button", { onClick: handleSwap, children: /* @__PURE__ */ jsx(ArrowUpDown, { size: 16, className: "text-gray-400" }) })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("label", { className: "text-xs text-gray-500", children: "To (Area, Street or Landmark)" }),
          /* @__PURE__ */ jsx("div", { className: "bg-gray-100 rounded-lg p-2 mt-1 font-semibold", children: toCity })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "text-xs text-[#f97316] font-semibold", children: [
          "+ Add Stops",
          " ",
          /* @__PURE__ */ jsx("span", { className: "text-[10px] bg-[#fee2e2] text-red-500 px-1 rounded", children: "new" })
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "mt-4 mb-4", children: [
        /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "TRIP START" }),
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mt-1 font-semibold", children: [
          /* @__PURE__ */ jsx(Calendar, { size: 16, className: "text-gray-500" }),
          /* @__PURE__ */ jsx("span", { children: pickupDate || "Select Date" }),
          /* @__PURE__ */ jsx("span", { className: "text-gray-400 text-sm", children: "10:00 AM" })
        ] })
      ] }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: handleUpdateSearch,
          className: "w-52 ml-12 absolute -mt-2 bg-[#f97316] text-white py-3 rounded-3xl font-semibold text-sm",
          children: "Update Search"
        }
      )
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "mt-8 bg-white rounded-xl p-4 shadow mb-4", children: [
      /* @__PURE__ */ jsxs("h2", { className: "font-semibold text-gray-800", children: [
        fromCity,
        " to ",
        toCity,
        " Cabs"
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 mt-1", children: [
        "Use ",
        /* @__PURE__ */ jsx("span", { className: "font-semibold", children: '"GOCAB"' }),
        " & get upto ₹500 off"
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-xs text-gray-600 mt-2", children: [
        /* @__PURE__ */ jsx("span", { children: "⭐ 4.4" }),
        /* @__PURE__ */ jsxs("span", { children: [
          "• ",
          (route == null ? void 0 : route.reviewCount) || 0,
          " reviews"
        ] }),
        /* @__PURE__ */ jsxs("span", { children: [
          "• ",
          (route == null ? void 0 : route.tripCount) || 0,
          " trips"
        ] })
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 mt-1", children: [
        (route == null ? void 0 : route.distance) || 0,
        " Km • ",
        (route == null ? void 0 : route.durationText) || `${Math.round(((route == null ? void 0 : route.duration) || 0) / 60)} hrs`
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "space-y-3", children: currentIntercityLoading ? /* @__PURE__ */ jsxs("div", { className: "text-center py-10", children: [
      /* @__PURE__ */ jsx(Loader, { className: "w-8 h-8 text-[#f97316] animate-spin mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600 text-sm", children: "Loading vehicles..." })
    ] }) : vehicleOptions.length > 0 ? (
      // Show vehicle options from route data
      vehicleOptions.map((vehicle, i) => /* @__PURE__ */ jsxs(
        "div",
        {
          onClick: () => handleSelectCab(vehicle),
          className: "flex items-center justify-between bg-white p-3 rounded-lg shadow-sm active:scale-[0.98] transition cursor-pointer",
          children: [
            /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
              /* @__PURE__ */ jsx(
                "img",
                {
                  src: vehicle.image || "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png",
                  alt: vehicle.displayName || vehicle.groupName,
                  className: "w-16 h-10 object-contain"
                }
              ),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm", children: vehicle.displayName || vehicle.groupName }),
                /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
                  vehicle.category,
                  " • ",
                  vehicle.seats || 4,
                  " seats • AC"
                ] }),
                /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 text-xs mt-1", children: /* @__PURE__ */ jsx(
                  "span",
                  {
                    className: `px-1.5 py-0.5 rounded text-[10px] ${vehicle.fuelType === "diesel" ? "bg-orange-100 text-orange-600" : vehicle.fuelType === "cng" ? "bg-blue-100 text-blue-600" : "bg-red-100 text-red-600"}`,
                    children: (vehicle.fuelType || "Petrol").toUpperCase()
                  }
                ) })
              ] })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
              /* @__PURE__ */ jsxs("p", { className: "font-semibold text-sm", children: [
                "₹",
                vehicle.price || 0
              ] }),
              /* @__PURE__ */ jsxs("p", { className: "text-[10px] text-gray-400", children: [
                "+ ₹",
                vehicle.estimatedTax || Math.round((vehicle.price || 0) * 0.05),
                " Taxes"
              ] })
            ] })
          ]
        },
        vehicle.groupId || i
      ))
    ) : /* @__PURE__ */ jsxs("div", { className: "text-center py-10 bg-white rounded-xl p-4", children: [
      /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "No vehicles available for this route." }),
      /* @__PURE__ */ jsx("p", { className: "text-gray-400 text-sm mt-1", children: "Please try again later." })
    ] }) }),
    (route == null ? void 0 : route.reviews) && route.reviews.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-5 bg-white rounded-xl p-4 shadow", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-2", children: [
        /* @__PURE__ */ jsxs("h3", { className: "font-semibold text-gray-800 text-sm", children: [
          route.reviews.length,
          " reviews on this route"
        ] }),
        /* @__PURE__ */ jsx("button", { className: "text-[#2563eb] text-xs font-semibold", children: "View all" })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "bg-gray-50 p-3 rounded-lg", children: [
        /* @__PURE__ */ jsx("div", { className: "flex text-yellow-500 mb-1", children: [...Array(5)].map((_, i) => /* @__PURE__ */ jsx(Star, { size: 14, fill: "currentColor" }, i)) }),
        /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-700", children: ((_c = route.reviews[0]) == null ? void 0 : _c.comment) || "Great service!" }),
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between text-xs text-gray-600 mt-2", children: [
          /* @__PURE__ */ jsx("span", { className: "font-semibold", children: ((_d = route.reviews[0]) == null ? void 0 : _d.userName) || "Customer" }),
          /* @__PURE__ */ jsx("span", { children: ((_e = route.reviews[0]) == null ? void 0 : _e.cabType) || "sedan" })
        ] })
      ] })
    ] }),
    (route == null ? void 0 : route.vehicleCategories) && route.vehicleCategories.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-5 bg-white rounded-xl p-4 shadow", children: [
      /* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-800 text-sm mb-3", children: "Available Cabs on the Route" }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: route.vehicleCategories.slice(0, 2).map((cat, i) => /* @__PURE__ */ jsxs("div", { className: "border rounded-xl p-3 text-center", children: [
        /* @__PURE__ */ jsx("img", { src: cat.image || "/hatchback.png", alt: cat.name, className: "w-20 mx-auto mb-2" }),
        /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm", children: cat.name }),
        /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 mb-2", children: [
          "Starting From ",
          /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
            "₹",
            cat.startsFrom || 2480
          ] })
        ] }),
        /* @__PURE__ */ jsx("button", { className: "border border-blue-500 text-blue-600 text-xs rounded-md px-3 py-1 font-semibold", children: "View Cabs" })
      ] }, i)) })
    ] }),
    (route == null ? void 0 : route.relatedRoutes) && route.relatedRoutes.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-5 bg-white rounded-xl p-4 shadow mb-8", children: [
      /* @__PURE__ */ jsxs("h3", { className: "font-semibold text-gray-800 text-sm mb-1", children: [
        "Top Cab Routes from ",
        fromCity
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500 mb-3", children: [
        "💡 Based on most booked routes from ",
        fromCity
      ] }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 gap-3", children: route.relatedRoutes.slice(0, 2).map((rel, i) => /* @__PURE__ */ jsxs("div", { className: "border rounded-xl p-3 text-center", children: [
        /* @__PURE__ */ jsxs("p", { className: "font-semibold text-sm", children: [
          rel.origin,
          " → ",
          rel.destination
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
          rel.distance,
          " kms | ",
          rel.duration
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "text-xs mt-1", children: [
          "Starting From ",
          /* @__PURE__ */ jsxs("span", { className: "font-semibold", children: [
            "₹",
            rel.startsFrom
          ] })
        ] }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate(`/top/${rel.slug}`),
            className: "mt-2 border border-blue-500 text-blue-600 text-xs rounded-md px-3 py-1 font-semibold",
            children: "View Cabs"
          }
        )
      ] }, i)) })
    ] }),
    (route == null ? void 0 : route.faqs) && route.faqs.length > 0 && /* @__PURE__ */ jsx("section", { className: "px-4 py-6 bg-white rounded-2xl shadow-sm mt-6 mb-8", children: /* @__PURE__ */ jsxs("details", { className: "border-t border-gray-200 pt-3", children: [
      /* @__PURE__ */ jsxs("summary", { className: "font-semibold text-gray-800 cursor-pointer", children: [
        "FAQs about ",
        fromCity,
        " to ",
        toCity
      ] }),
      /* @__PURE__ */ jsx("ul", { className: "mt-3 space-y-3 text-gray-700 text-sm", children: route.faqs.map((faq2, i) => /* @__PURE__ */ jsxs("li", { children: [
        /* @__PURE__ */ jsx("strong", { children: "Q." }),
        " ",
        faq2.question,
        faq2.answer && /* @__PURE__ */ jsx("p", { className: "mt-1 text-gray-600", children: faq2.answer })
      ] }, i)) })
    ] }) })
  ] });
};
const Airport = () => {
  var _a, _b;
  const { t } = useTranslation();
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const { slug } = distExports.useParams();
  const {
    currentAirportRoute,
    currentAirportLoading,
    searchResults,
    searchLoading: reduxSearchLoading
  } = useSelector((state) => state.seo);
  const [tripType, setTripType] = useState("oneway");
  const [airportTripType, setAirportTripType] = useState("pickup");
  const [fromLocation, setFromLocation] = useState("");
  const [toLocation, setToLocation] = useState("");
  const [pickupDate, setPickupDate] = useState("");
  const [returnDate, setReturnDate] = useState("");
  const [pickupTime, setPickupTime] = useState("10:00 AM");
  const [stops, setStops] = useState([]);
  const [sourceCoords, setSourceCoords] = useState({ lat: 0, lng: 0 });
  const [destCoords, setDestCoords] = useState({ lat: 0, lng: 0 });
  const [currentUserLocation, setCurrentUserLocation] = useState(null);
  const [showTripTypeDropdown, setShowTripTypeDropdown] = useState(false);
  const [showLocationModal, setShowLocationModal] = useState(false);
  const [showStopsModal, setShowStopsModal] = useState(false);
  const [showDateModal, setShowDateModal] = useState(false);
  const [showTimeModal, setShowTimeModal] = useState(false);
  const [locationType, setLocationType] = useState("");
  const [dateType, setDateType] = useState("pickup");
  const [localSearchLoading, setLocalSearchLoading] = useState(false);
  const [currentDisplayDate, setCurrentDisplayDate] = useState(/* @__PURE__ */ new Date());
  const routeFromState = (_a = location.state) == null ? void 0 : _a.route;
  useEffect(() => {
    if (slug) {
      dispatch(getAirportRouteBySlug(slug));
    }
  }, [dispatch, slug]);
  useEffect(() => {
    var _a2, _b2, _c, _d, _e, _f, _g, _h;
    const route2 = currentAirportRoute || routeFromState;
    if (route2) {
      let airportLat = ((_b2 = (_a2 = route2.coordinates) == null ? void 0 : _a2.coordinates) == null ? void 0 : _b2[1]) || 0;
      let airportLng = ((_d = (_c = route2.coordinates) == null ? void 0 : _c.coordinates) == null ? void 0 : _d[0]) || 0;
      let cityLat = ((_f = (_e = route2.cityCoordinates) == null ? void 0 : _e.coordinates) == null ? void 0 : _f[1]) || 0;
      let cityLng = ((_h = (_g = route2.cityCoordinates) == null ? void 0 : _g.coordinates) == null ? void 0 : _h[0]) || 0;
      const initializeCoords = async () => {
        if (airportLat === 0 && route2.airportName) {
          const aCoords = await geocodeLocation(route2.airportName);
          if (aCoords) {
            airportLat = aCoords.lat;
            airportLng = aCoords.lng;
          }
        }
        if (cityLat === 0 && route2.cityName) {
          const cCoords = await geocodeLocation(route2.cityName);
          if (cCoords) {
            cityLat = cCoords.lat;
            cityLng = cCoords.lng;
          }
        }
        if (route2.routeType === "from_airport") {
          setFromLocation(route2.airportName || "");
          setToLocation(route2.cityName || "");
          setAirportTripType("pickup");
          setSourceCoords({ lat: airportLat, lng: airportLng });
          setDestCoords({ lat: cityLat, lng: cityLng });
        } else {
          setFromLocation(route2.cityName || "");
          setToLocation(route2.airportName || "");
          setAirportTripType("drop");
          setSourceCoords({ lat: cityLat, lng: cityLng });
          setDestCoords({ lat: airportLat, lng: airportLng });
        }
      };
      initializeCoords();
      const tomorrow = /* @__PURE__ */ new Date();
      tomorrow.setDate(tomorrow.getDate() + 1);
      setPickupDate(tomorrow.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }));
    }
  }, [currentAirportRoute, routeFromState]);
  useEffect(() => {
    if (slug && currentAirportRoute) {
      dispatch(searchAirportCabs({
        slug,
        params: {
          startTime: (/* @__PURE__ */ new Date()).toISOString(),
          isAc: true
        }
      }));
    }
  }, [dispatch, slug, currentAirportRoute]);
  const route = currentAirportRoute || routeFromState;
  const vehicleOptions = (route == null ? void 0 : route.vehicleOptions) || [];
  const cabs = (searchResults == null ? void 0 : searchResults.cabs) || [];
  const faqs = (route == null ? void 0 : route.faqs) || [];
  const tripTypeOptions = [
    { value: "oneway", label: t("tripTypes.oneway") },
    { value: "round", label: t("tripTypes.round") }
  ];
  const handleTripTypeChange = (newType) => {
    if (newType === airportTripType) return;
    setAirportTripType(newType);
    const tempLoc = fromLocation;
    setFromLocation(toLocation);
    setToLocation(tempLoc);
    const tempCoords = sourceCoords;
    setSourceCoords(destCoords);
    setDestCoords(tempCoords);
  };
  const handleLocationSelect = (location2) => {
    if (locationType === "from") {
      setFromLocation(location2);
    } else if (locationType === "to") {
      setToLocation(location2);
    }
    setShowLocationModal(false);
  };
  const handleDateSelect = (dayObj) => {
    if (dayObj && !dayObj.otherMonth && dayObj.date) {
      const dateStr = dayObj.date.toLocaleDateString("en-GB", {
        day: "numeric",
        month: "short",
        year: "numeric"
      });
      if (dateType === "return") {
        setReturnDate(dateStr);
      } else {
        setPickupDate(dateStr);
      }
      setShowDateModal(false);
    }
  };
  const handleTimeSelect = (time) => {
    setPickupTime(time);
    setShowTimeModal(false);
  };
  const addStop = () => setStops([...stops, { id: Date.now(), value: "" }]);
  const removeStop = (id) => setStops(stops.filter((stop) => stop.id !== id));
  const handleStopChange = (id, value) => {
    setStops(stops.map((stop) => stop.id === id ? { ...stop, value } : stop));
  };
  const handleUpdateSearch = async () => {
    setLocalSearchLoading(true);
    try {
      if (!fromLocation || !toLocation) {
        toast$2.error("Please select both locations");
        setLocalSearchLoading(false);
        return;
      }
      if (tripType === "round" && !returnDate) {
        toast$2.error("Please select a return date");
        setLocalSearchLoading(false);
        return;
      }
      let sCoords = { ...sourceCoords };
      if (fromLocation === "Current Location" && currentUserLocation) {
        sCoords = currentUserLocation;
      } else if (!sCoords.lat || !sCoords.lng || fromLocation !== (airportTripType === "pickup" ? route == null ? void 0 : route.airportName : route == null ? void 0 : route.cityName)) {
        const c = await geocodeLocation(fromLocation);
        if (c) sCoords = c;
      }
      if (!sCoords.lat) {
        const c = await geocodeLocation(fromLocation);
        if (c) sCoords = c;
        else {
          toast$2.error(`Could not find location: ${fromLocation}`);
          setLocalSearchLoading(false);
          return;
        }
      }
      let dCoords = { ...destCoords };
      if (!dCoords.lat || !dCoords.lng || toLocation !== (airportTripType === "drop" ? route == null ? void 0 : route.airportName : route == null ? void 0 : route.cityName)) {
        const c = await geocodeLocation(toLocation);
        if (c) dCoords = c;
      }
      if (!dCoords.lat) {
        const c = await geocodeLocation(toLocation);
        if (c) dCoords = c;
        else {
          toast$2.error(`Could not find location: ${toLocation}`);
          setLocalSearchLoading(false);
          return;
        }
      }
      const validStops = [];
      if (stops.length > 0) {
        for (const stop of stops) {
          if (!stop.value || stop.value.trim() === "") continue;
          const stopCoords = await geocodeLocation(stop.value);
          if (stopCoords) {
            validStops.push({
              address: stop.value,
              coordinates: [stopCoords.lng, stopCoords.lat],
              stopOrder: validStops.length + 1
            });
          }
        }
      }
      const searchParams = {
        from: fromLocation,
        to: toLocation,
        sourceLat: sCoords.lat,
        sourceLong: sCoords.lng,
        destLat: dCoords.lat,
        destLong: dCoords.lng,
        tripType: tripType === "oneway" ? "oneWay" : "roundTrip",
        // Using "oneWay" format for backend
        fuelType: "petrol",
        isAc: true,
        pickupDate,
        pickupTime,
        returnDate,
        startTime: (/* @__PURE__ */ new Date()).toISOString(),
        stops: validStops.length > 0 ? validStops : void 0
      };
      navigate("/results", { state: { searchParams } });
    } catch (error) {
      console.error("Search error", error);
      toast$2.error("Search failed");
    } finally {
      setLocalSearchLoading(false);
    }
  };
  const handleSelectVehicle = (vehicle) => {
    var _a2;
    const vehicleId = vehicle.vehicleId || vehicle._id || vehicle.groupId;
    navigate(`/details/${vehicleId}`, {
      state: {
        vehicleId,
        picklat: sourceCoords.lat,
        picklng: sourceCoords.lng,
        pickupAddress: fromLocation,
        pickupCity: fromLocation,
        pickupState: "",
        droplat: destCoords.lat,
        droplng: destCoords.lng,
        dropAddress: toLocation,
        dropCity: toLocation,
        dropState: "",
        distance: ((_a2 = vehicle.tripDetails) == null ? void 0 : _a2.totalDistance) || (route == null ? void 0 : route.distance) || 40,
        tripType: "airport",
        fuelType: vehicle.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        vehicle,
        route,
        tripDetails: {
          from: fromLocation,
          to: toLocation,
          date: pickupDate,
          time: pickupTime,
          tripType: "airport",
          stops
        }
      }
    });
  };
  const getDaysInMonth = (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
  const getFirstDayOfMonth = (date) => new Date(date.getFullYear(), date.getMonth(), 1).getDay();
  const generateCalendarDays = () => {
    const daysInMonth = getDaysInMonth(currentDisplayDate);
    const firstDay = getFirstDayOfMonth(currentDisplayDate);
    const days = [];
    const startOffset = firstDay === 0 ? 6 : firstDay - 1;
    for (let i = 0; i < startOffset; i++) {
      days.push({ day: "", otherMonth: true });
    }
    for (let i = 1; i <= daysInMonth; i++) {
      days.push({
        day: i.toString(),
        date: new Date(currentDisplayDate.getFullYear(), currentDisplayDate.getMonth(), i)
      });
    }
    return days;
  };
  const calendarDays = generateCalendarDays();
  const changeMonth = (offset) => {
    const newDate = new Date(currentDisplayDate);
    newDate.setMonth(newDate.getMonth() + offset);
    setCurrentDisplayDate(newDate);
  };
  const generateTimeSlots = () => {
    const times = [];
    for (let hour = 0; hour < 24; hour++) {
      for (let minute = 0; minute < 60; minute += 15) {
        const period = hour >= 12 ? "PM" : "AM";
        const displayHour = hour % 12 || 12;
        const timeString = `${displayHour}:${minute.toString().padStart(2, "0")} ${period}`;
        times.push(timeString);
      }
    }
    return times;
  };
  const timeSlots = generateTimeSlots();
  const LocationModal = () => {
    const [searchText, setSearchText] = useState("");
    const handleCurrentLocation = () => {
      if ("geolocation" in navigator) {
        navigator.geolocation.getCurrentPosition(
          (position) => {
            const coords = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };
            setCurrentUserLocation(coords);
            handleLocationSelect("Current Location");
          },
          (error) => {
            console.error("Error getting location:", error);
            toast$2.error("Could not get location");
          }
        );
      } else {
        toast$2.error("Geolocation not supported");
      }
    };
    return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
      /* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: locationType === "from" ? t("hero.from").toUpperCase() : t("hero.to").toUpperCase() }),
          /* @__PURE__ */ jsx("button", { onClick: () => setShowLocationModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
          LocationAutocomplete,
          {
            value: searchText,
            onChange: setSearchText,
            onLocationSelect: handleLocationSelect,
            placeholder: `Search ${locationType === "from" ? "Pickup" : "Drop"}...`
          }
        ) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: handleCurrentLocation,
          className: "flex items-center gap-2 text-blue-600 text-sm font-medium mb-4 hover:bg-blue-50 p-2 rounded w-full transition-colors",
          children: [
            /* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
            " ",
            t("common.useCurrentLocation")
          ]
        }
      ) })
    ] }) });
  };
  const StopsModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: t("hero.addStops") }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      stops.map((stop, index) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
        /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mb-2", children: [
          t("tripDetails.stop"),
          " ",
          index + 1
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsx(
            LocationAutocomplete,
            {
              value: stop.value,
              onChange: (val) => handleStopChange(stop.id, val),
              onLocationSelect: (val) => handleStopChange(stop.id, val),
              placeholder: "Enter stop location",
              className: "flex-1"
            }
          ),
          /* @__PURE__ */ jsx("button", { onClick: () => removeStop(stop.id), className: "text-gray-500 hover:text-red-500", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] })
      ] }, stop.id)),
      /* @__PURE__ */ jsxs("button", { onClick: addStop, className: "flex items-center gap-2 text-blue-600 text-sm font-medium mt-4", children: [
        /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
        " ",
        t("hero.addStops")
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-gray-200", children: /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "w-full bg-blue-600 text-white py-3 rounded-lg font-semibold", children: t("common.done").toUpperCase() }) })
  ] }) });
  const DateModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: dateType === "return" ? "RETURN DATE" : t("hero.pickupDate").toUpperCase() }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowDateModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4 text-gray-900", children: [
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(-1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 rotate-90" }) }),
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold uppercase", children: currentDisplayDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 -rotate-90" }) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-2", children: [t("weekDays.mon"), t("weekDays.tue"), t("weekDays.wed"), t("weekDays.thu"), t("weekDays.fri"), t("weekDays.sat"), t("weekDays.sun")].map((day) => /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-500 font-medium py-2", children: day }, day)) }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: calendarDays.map((dayObj, index) => {
        var _a2;
        const currentDateStr = (_a2 = dayObj.date) == null ? void 0 : _a2.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" });
        const isSelected = currentDateStr === (dateType === "return" ? returnDate : pickupDate);
        return /* @__PURE__ */ jsx(
          "div",
          {
            className: `h-10 flex items-center justify-center rounded-full text-sm font-medium cursor-pointer
                    ${!dayObj.day || dayObj.otherMonth ? "text-transparent pointer-events-none" : "text-gray-700 hover:bg-gray-100"}
                    ${isSelected ? "bg-orange-500 text-white hover:bg-orange-600" : ""}
                  `,
            onClick: () => handleDateSelect(dayObj),
            children: dayObj.day
          },
          index
        );
      }) })
    ] })
  ] }) });
  const TimeModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: t("hero.pickupTime").toUpperCase() }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowTimeModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto p-4", children: timeSlots.map((time, index) => /* @__PURE__ */ jsx(
      "div",
      {
        className: `py-3 border-b text-black border-gray-100 cursor-pointer hover:bg-gray-50 ${pickupTime === time ? "bg-blue-50" : ""}`,
        onClick: () => handleTimeSelect(time),
        children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: time })
      },
      index
    )) })
  ] }) });
  if (currentAirportLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-white flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-orange-500 mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: "Loading airport route details..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen flex flex-col", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    showLocationModal && /* @__PURE__ */ jsx(LocationModal, {}),
    showStopsModal && /* @__PURE__ */ jsx(StopsModal, {}),
    showDateModal && /* @__PURE__ */ jsx(DateModal, {}),
    showTimeModal && /* @__PURE__ */ jsx(TimeModal, {}),
    /* @__PURE__ */ jsx("div", { className: "w-full bg-orange-500 py-4 px-4 mt-16", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-8 ml-8", children: [
        /* @__PURE__ */ jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.tripType").toUpperCase() }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md flex items-center gap-1 text-black min-w-[180px]",
              onClick: () => setShowTripTypeDropdown(!showTripTypeDropdown),
              children: [
                (_b = tripTypeOptions.find((opt) => opt.value === tripType)) == null ? void 0 : _b.label,
                /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
              ]
            }
          ),
          showTripTypeDropdown && /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 mt-1 bg-white text-black border border-gray-200 rounded-md shadow-lg z-10 min-w-[180px]", children: tripTypeOptions.map((option) => /* @__PURE__ */ jsx(
            "div",
            {
              className: `px-4 py-2 cursor-pointer hover:bg-gray-100 ${tripType === option.value ? "bg-blue-50 text-blue-600" : ""}`,
              onClick: () => {
                setTripType(option.value);
                setShowTripTypeDropdown(false);
              },
              children: option.label
            },
            option.value
          )) })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.from").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("from");
                setShowLocationModal(true);
              },
              children: fromLocation || t("common.select")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "mt-5 relative inline-block", children: [
          /* @__PURE__ */ jsx("span", { className: "absolute -top-3 right-2 text-[11px] px-1.5 py-[1px] bg-white text-purple-600 border border-black rounded-md font-semibold shadow-sm", children: t("hero.new") }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3] shadow",
              onClick: () => setShowStopsModal(true),
              children: t("hero.addStops")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.to").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("to");
                setShowLocationModal(true);
              },
              children: toLocation || t("common.select")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.pickupDate").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setDateType("pickup");
                setShowDateModal(true);
              },
              children: pickupDate || t("common.selectDate")
            }
          )
        ] }),
        tripType === "round" && /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "RETURN DATE" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setDateType("return");
                setShowDateModal(true);
              },
              children: returnDate || "Select Date"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: t("hero.pickupTime").toUpperCase() }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => setShowTimeModal(true),
              children: pickupTime
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
        "button",
        {
          className: "text-lg font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3]",
          onClick: handleUpdateSearch,
          disabled: localSearchLoading,
          children: localSearchLoading ? "SEARCHING..." : t("common.updateSearch").toUpperCase()
        }
      ) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "bg-gray-100 flex-1", children: /* @__PURE__ */ jsxs("div", { className: "max-w-6xl mx-auto px-4 py-8", children: [
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
        t("nav.home"),
        " > ",
        t("nav.cabBooking"),
        " >",
        " ",
        /* @__PURE__ */ jsxs("span", { className: "text-gray-900 font-medium", children: [
          route == null ? void 0 : route.airportName,
          " ",
          t("nav.cabBooking")
        ] })
      ] }),
      /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold text-gray-900 mt-3", children: t("hero.bookAirportTaxiDynamic", { airport: route == null ? void 0 : route.airportName }) }),
      /* @__PURE__ */ jsx("p", { className: "text-gray-700 mt-2 text-sm max-w-4xl", children: (route == null ? void 0 : route.metaDescription) || `Book sanitized ${route == null ? void 0 : route.airportName} taxi services for hassle-free experience. Book all type of cabs for Airport transfer.` }),
      (route == null ? void 0 : route.startsFrom) && /* @__PURE__ */ jsx("p", { className: "text-green-600 font-semibold mt-2", children: t("hero.startsFrom", { price: route.startsFrom }) }),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mt-6", children: [
        /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-700", children: [
          t("common.select"),
          " ",
          t("hero.tripType")
        ] }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: "To update price, included kms & extra fare" })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex gap-4 mt-4 flex-wrap", children: [
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: () => handleTripTypeChange("pickup"),
            className: `border px-6 py-3 rounded-lg flex items-center gap-2 shadow-sm font-medium ${airportTripType === "pickup" ? "border-blue-500 bg-blue-50 text-blue-600" : "border-gray-300 bg-white text-gray-900"}`,
            children: [
              /* @__PURE__ */ jsx("span", { className: `w-3 h-3 rounded-full border-2 flex items-center justify-center ${airportTripType === "pickup" ? "border-blue-500" : "border-gray-400"}`, children: airportTripType === "pickup" && /* @__PURE__ */ jsx("span", { className: "w-2 h-2 bg-blue-500 rounded-full" }) }),
              t("booking.airportPickup")
            ]
          }
        ),
        /* @__PURE__ */ jsxs(
          "button",
          {
            onClick: () => handleTripTypeChange("drop"),
            className: `border px-6 py-3 rounded-lg flex items-center gap-2 shadow-sm font-medium ${airportTripType === "drop" ? "border-blue-500 bg-blue-50 text-blue-600" : "border-gray-300 bg-white text-gray-900"}`,
            children: [
              /* @__PURE__ */ jsx("span", { className: `w-3 h-3 rounded-full border-2 flex items-center justify-center ${airportTripType === "drop" ? "border-blue-500" : "border-gray-400"}`, children: airportTripType === "drop" && /* @__PURE__ */ jsx("span", { className: "w-2 h-2 bg-blue-500 rounded-full" }) }),
              t("booking.airportDrop")
            ]
          }
        )
      ] }),
      (cabs.length > 0 || vehicleOptions.length > 0) && /* @__PURE__ */ jsxs("div", { className: "mt-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-lg font-semibold text-gray-900 mb-4", children: [
          t("cabSearch.availableCabsFor"),
          " ",
          route == null ? void 0 : route.airportName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "space-y-4", children: reduxSearchLoading ? /* @__PURE__ */ jsxs("div", { className: "text-center py-10", children: [
          /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-10 w-10 border-b-2 border-orange-500 mx-auto" }),
          /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: t("cabSearch.searchingCabs") })
        ] }) : cabs.length > 0 ? cabs.map((cab, idx) => {
          var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
          const vehicleName = cab.modelName || ((_a2 = cab.group) == null ? void 0 : _a2.groupName) || "Cab";
          const seats = cab.seats || ((_b2 = cab.group) == null ? void 0 : _b2.seats) || 4;
          const isAc = cab.isAc !== void 0 ? cab.isAc : ((_c = cab.group) == null ? void 0 : _c.isAc) || true;
          const fuelType = cab.fuelType || ((_d = cab.group) == null ? void 0 : _d.fuelType) || "Petrol";
          const image = cab.image || ((_f = (_e = cab.group) == null ? void 0 : _e.vehicleImages) == null ? void 0 : _f.frontView) || "https://go-assets.ibcdn.com/u/GI/images/1731502913771-sedan-2.png";
          const category = ((_g = cab.category) == null ? void 0 : _g.categoryName) || ((_i = (_h = cab.group) == null ? void 0 : _h.category) == null ? void 0 : _i.categoryName) || "Standard";
          return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-md p-4 flex flex-col sm:flex-row items-center justify-between gap-4 border border-gray-100 hover:shadow-lg transition-shadow", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 flex-1", children: [
              /* @__PURE__ */ jsx("div", { className: "w-24 h-16 flex-shrink-0", children: /* @__PURE__ */ jsx(
                "img",
                {
                  src: image,
                  alt: vehicleName,
                  className: "w-full h-full object-contain"
                }
              ) }),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("h3", { className: "font-bold text-lg text-gray-900", children: vehicleName }),
                /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 mt-1 text-sm text-gray-500", children: [
                  /* @__PURE__ */ jsx("span", { className: "bg-gray-100 px-2 py-0.5 rounded text-xs font-medium uppercase tracking-wide", children: category }),
                  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
                    "• ",
                    seats,
                    " ",
                    t("cabSearch.seater")
                  ] }),
                  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
                    "• ",
                    isAc ? t("cabSearch.ac") : t("cabSearch.nonAc")
                  ] }),
                  /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
                    "• ",
                    fuelType
                  ] }),
                  ((_j = cab.group) == null ? void 0 : _j.luggageCapacity) > 0 && /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1", children: [
                    "• ",
                    cab.group.luggageCapacity,
                    " Bags"
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "mt-2 text-xs text-green-600 font-medium flex items-center gap-1", children: [
                  /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M5 13l4 4L19 7" }) }),
                  t("payment.freeCancellation"),
                  /* @__PURE__ */ jsx("span", { className: "text-gray-400 mx-1", children: "|" }),
                  /* @__PURE__ */ jsx("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2", d: "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
                  t("cabSearch.instantConfirmation")
                ] })
              ] })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-right min-w-[120px]", children: [
              /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-end", children: [
                /* @__PURE__ */ jsxs("p", { className: "text-2xl font-bold text-gray-900", children: [
                  "₹",
                  Math.round(((_k = cab.fare) == null ? void 0 : _k.total) || cab.price)
                ] }),
                ((_l = cab.fare) == null ? void 0 : _l.baseFare) && /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-400 line-through", children: [
                  "₹",
                  Math.round((((_m = cab.fare) == null ? void 0 : _m.total) || cab.price) * 1.1)
                ] }),
                /* @__PURE__ */ jsx("p", { className: "text-[10px] text-gray-500 mt-1 uppercase font-semibold tracking-wider", children: t("cabSearch.fixedFare") })
              ] }),
              /* @__PURE__ */ jsx(
                "button",
                {
                  className: "mt-3 w-full bg-blue-600 hover:bg-blue-700 text-white px-6 py-2.5 rounded-full font-bold text-sm transition-colors shadow-sm",
                  onClick: () => handleSelectVehicle(cab),
                  children: t("common.select").toUpperCase()
                }
              )
            ] })
          ] }, cab._id || idx);
        }) : vehicleOptions.map((vehicle, idx) => /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-md p-4 flex items-center justify-between", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: vehicle.image || "https://go-assets.ibcdn.com/u/GI/images/1731502913771-sedan-2.png",
                alt: vehicle.groupName,
                className: "w-24 h-16 object-contain"
              }
            ),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900", children: vehicle.displayName || vehicle.groupName }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
                vehicle.category,
                " • ",
                vehicle.seats,
                " ",
                t("cabSearch.seater"),
                " • ",
                vehicle.fuelType
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
            /* @__PURE__ */ jsxs("p", { className: "text-xl font-bold text-gray-900", children: [
              "₹",
              vehicle.price
            ] }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "mt-2 bg-blue-600 text-white px-6 py-2 rounded-lg font-semibold",
                onClick: () => handleSelectVehicle(vehicle),
                children: t("common.select")
              }
            )
          ] })
        ] }, vehicle.groupId || idx)) })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "mt-10", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-lg font-semibold text-gray-900 mb-4", children: [
          t("faq.title"),
          " ",
          route == null ? void 0 : route.airportName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "bg-white shadow-md rounded-lg p-6 space-y-4", children: faqs.length > 0 ? faqs.map((faq2, index) => /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-900", children: [
            "Q: ",
            faq2.question
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "text-gray-700 mt-1", children: [
            "A: ",
            faq2.answer
          ] })
        ] }, index)) : /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-900", children: [
              "Q: ",
              t("faq.economicalCabQ", { airport: route == null ? void 0 : route.airportName })
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-gray-700 mt-1", children: [
              "A: ",
              t("faq.economicalCabA", { airport: route == null ? void 0 : route.airportName }),
              " ",
              /* @__PURE__ */ jsx("span", { className: "text-blue-600 cursor-pointer", children: t("hero.bookOnlineCab") })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-900", children: [
              "Q: ",
              t("faq.optionsQ", { airport: route == null ? void 0 : route.airportName })
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-gray-700 mt-1", children: [
              "A: ",
              t("faq.optionsA", { airport: route == null ? void 0 : route.airportName }),
              " ",
              /* @__PURE__ */ jsx("span", { className: "text-blue-600 cursor-pointer", children: t("hero.bookOnlineCab") }),
              ":- ",
              t("tripTypes.oneway"),
              ", ",
              t("hero.hourlyCarRental"),
              ", ",
              t("tripTypes.airport"),
              " ",
              t("booking.drop")
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "font-semibold text-gray-900", children: "Q: What are the advantages of online cab booking?" }),
            /* @__PURE__ */ jsx("p", { className: "text-gray-700 mt-1", children: "A: Online cab booking not only helps you with best prices but also helps you with the convenience of paying through multiple payment options (like Debit Card, Credit Card, eWallets etc.). You can easily compare prices and choose various categories of cabs like Hatchback cars, Sedan and SUV." })
          ] })
        ] }) })
      ] }),
      (route == null ? void 0 : route.routesFromAirport) && route.routesFromAirport.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-10", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-lg font-semibold text-gray-900 mb-4", children: [
          "Cabs from ",
          route.airportName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "bg-white shadow-md rounded-lg p-6", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: route.routesFromAirport.map((relatedRoute, index) => /* @__PURE__ */ jsxs(
          "a",
          {
            href: `/airport/${relatedRoute.slug}`,
            className: "text-blue-600 hover:text-blue-800 hover:underline text-sm",
            children: [
              relatedRoute.airportName,
              " To ",
              relatedRoute.cityName,
              " Cabs"
            ]
          },
          index
        )) }) })
      ] }),
      (route == null ? void 0 : route.routesToAirport) && route.routesToAirport.length > 0 && /* @__PURE__ */ jsxs("div", { className: "mt-10", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-lg font-semibold text-gray-900 mb-4", children: [
          "Cabs to ",
          route.airportName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "bg-white shadow-md rounded-lg p-6", children: /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: route.routesToAirport.map((relatedRoute, index) => /* @__PURE__ */ jsxs(
          "a",
          {
            href: `/airport/${relatedRoute.slug}`,
            className: "text-blue-600 hover:text-blue-800 hover:underline text-sm",
            children: [
              relatedRoute.cityName,
              " To ",
              relatedRoute.airportName,
              " Cabs"
            ]
          },
          index
        )) }) })
      ] })
    ] }) }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const Cities = () => {
  var _a, _b, _c, _d, _e, _f;
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const { slug } = distExports.useParams();
  const {
    currentCityService,
    currentCityLoading,
    searchResults
  } = useSelector((state) => state.seo);
  const [tripType, setTripType] = useState("oneway");
  const [fromLocation, setFromLocation] = useState("");
  const [toLocation, setToLocation] = useState("");
  const [pickupDate, setPickupDate] = useState("");
  const [returnDate, setReturnDate] = useState("");
  const [pickupTime, setPickupTime] = useState("10:00 AM");
  const [stops, setStops] = useState([]);
  const [showTripTypeDropdown, setShowTripTypeDropdown] = useState(false);
  const [showLocationModal, setShowLocationModal] = useState(false);
  const [showStopsModal, setShowStopsModal] = useState(false);
  const [showDateModal, setShowDateModal] = useState(false);
  const [showTimeModal, setShowTimeModal] = useState(false);
  const [locationType, setLocationType] = useState("");
  const [dateType, setDateType] = useState("pickup");
  const [currentUserLocation, setCurrentUserLocation] = useState(null);
  const [searchLoading, setSearchLoading] = useState(false);
  const [currentDisplayDate, setCurrentDisplayDate] = useState(/* @__PURE__ */ new Date());
  const serviceFromState = (_a = location.state) == null ? void 0 : _a.service;
  useEffect(() => {
    if (slug) {
      if ((currentCityService == null ? void 0 : currentCityService.slug) === slug) {
        return;
      }
      dispatch(getCityServiceBySlug(slug));
    }
  }, [dispatch, slug, currentCityService]);
  useEffect(() => {
    const service2 = currentCityService || serviceFromState;
    if (service2) {
      setFromLocation(service2.cityName || "");
      const tomorrow = /* @__PURE__ */ new Date();
      tomorrow.setDate(tomorrow.getDate() + 1);
      setPickupDate(tomorrow.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }));
    }
  }, [currentCityService, serviceFromState]);
  const service = currentCityService || serviceFromState;
  (service == null ? void 0 : service.popularRoutes) || [];
  const faqs = (service == null ? void 0 : service.faqs) || [];
  (service == null ? void 0 : service.vehicleOptions) || [];
  const tripTypeOptions = [
    { value: "oneway", label: "One Way" },
    { value: "round", label: "Round Trip" }
  ];
  const handleLocationSelect = (location2) => {
    if (locationType === "from") {
      setFromLocation(location2);
    } else if (locationType === "to") {
      setToLocation(location2);
    }
    setShowLocationModal(false);
  };
  const handleDateSelect = (dayObj) => {
    if (dayObj && !dayObj.otherMonth && dayObj.date) {
      const dateStr = dayObj.date.toLocaleDateString("en-GB", {
        day: "numeric",
        month: "short",
        year: "numeric"
      });
      if (dateType === "return") {
        setReturnDate(dateStr);
      } else {
        setPickupDate(dateStr);
      }
      setShowDateModal(false);
    }
  };
  const handleTimeSelect = (time) => {
    setPickupTime(time);
    setShowTimeModal(false);
  };
  const addStop = () => setStops([...stops, { id: Date.now(), value: "" }]);
  const removeStop = (id) => setStops(stops.filter((stop) => stop.id !== id));
  const handleStopChange = (id, value) => {
    setStops(stops.map((stop) => stop.id === id ? { ...stop, value } : stop));
  };
  const handleUpdateSearch = async () => {
    setSearchLoading(true);
    try {
      if (!fromLocation) {
        toast$2.error("Please enter a pickup location");
        setSearchLoading(false);
        return;
      }
      if (!toLocation) {
        toast$2.error("Please enter a drop location");
        setSearchLoading(false);
        return;
      }
      if (tripType === "round" && !returnDate) {
        toast$2.error("Please select a return date for round trip");
        setSearchLoading(false);
        return;
      }
      let sourceCoords;
      if (fromLocation === "Current Location" && currentUserLocation) {
        sourceCoords = currentUserLocation;
      } else {
        sourceCoords = await geocodeLocation(fromLocation);
      }
      if (!sourceCoords) {
        toast$2.error(`Could not find location: ${fromLocation}`);
        setSearchLoading(false);
        return;
      }
      let destCoords = await geocodeLocation(toLocation);
      if (!destCoords) {
        toast$2.error(`Could not find location: ${toLocation}`);
        setSearchLoading(false);
        return;
      }
      const validStops = [];
      if (stops.length > 0) {
        for (const stop of stops) {
          if (!stop.value || stop.value.trim() === "") continue;
          const stopCoords = await geocodeLocation(stop.value);
          if (stopCoords) {
            validStops.push({
              address: stop.value,
              coordinates: [stopCoords.lng, stopCoords.lat],
              stopOrder: validStops.length + 1
            });
          }
        }
      }
      const searchParams = {
        from: fromLocation,
        to: toLocation,
        sourceLat: sourceCoords.lat,
        sourceLong: sourceCoords.lng,
        destLat: destCoords.lat,
        destLong: destCoords.lng,
        tripType: tripType === "oneway" ? "oneWay" : "roundTrip",
        fuelType: "petrol",
        isAc: true,
        pickupDate,
        pickupTime,
        returnDate,
        startTime: (/* @__PURE__ */ new Date()).toISOString(),
        stops: validStops.length > 0 ? validStops : void 0
      };
      navigate("/results", { state: { searchParams } });
    } catch (error) {
      console.error("Search error:", error);
      toast$2.error("Something went wrong with the search");
    } finally {
      setSearchLoading(false);
    }
  };
  const handleRouteClick = (route) => {
    navigate(`/top/${route.slug}`, { state: { route } });
  };
  const handleSelectVehicle = (vehicle) => {
    const cityCoords = (service == null ? void 0 : service.coordinates) || { lat: 0, lng: 0 };
    navigate(`/details/${vehicle.vehicleId || vehicle._id || vehicle.groupId}`, {
      state: {
        // Required fields for booking review API
        vehicleId: vehicle.vehicleId || vehicle._id || vehicle.groupId,
        picklat: cityCoords.lat,
        picklng: cityCoords.lng,
        pickupAddress: fromLocation || (service == null ? void 0 : service.cityName),
        pickupCity: (service == null ? void 0 : service.cityName) || fromLocation,
        pickupState: "",
        droplat: cityCoords.lat,
        droplng: cityCoords.lng,
        dropAddress: toLocation || (service == null ? void 0 : service.cityName),
        dropCity: (service == null ? void 0 : service.cityName) || toLocation,
        dropState: "",
        distance: 10,
        // Default local distance
        tripType: tripType === "round" ? "roundTrip" : "oneWay",
        fuelType: vehicle.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        // Additional data for display
        vehicle,
        service,
        tripDetails: {
          from: fromLocation,
          to: toLocation,
          date: pickupDate,
          time: pickupTime,
          tripType,
          stops
        }
      }
    });
  };
  const getDaysInMonth = (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
  const getFirstDayOfMonth = (date) => new Date(date.getFullYear(), date.getMonth(), 1).getDay();
  const generateCalendarDays = () => {
    const daysInMonth = getDaysInMonth(currentDisplayDate);
    const firstDay = getFirstDayOfMonth(currentDisplayDate);
    const days = [];
    const startOffset = firstDay === 0 ? 6 : firstDay - 1;
    for (let i = 0; i < startOffset; i++) {
      days.push({ day: "", otherMonth: true });
    }
    for (let i = 1; i <= daysInMonth; i++) {
      days.push({
        day: i.toString(),
        date: new Date(currentDisplayDate.getFullYear(), currentDisplayDate.getMonth(), i)
      });
    }
    return days;
  };
  const calendarDays = generateCalendarDays();
  const changeMonth = (offset) => {
    const newDate = new Date(currentDisplayDate);
    newDate.setMonth(newDate.getMonth() + offset);
    setCurrentDisplayDate(newDate);
  };
  const generateTimeSlots = () => {
    const times = [];
    for (let hour = 0; hour < 24; hour++) {
      for (let minute = 0; minute < 60; minute += 15) {
        const period = hour >= 12 ? "PM" : "AM";
        const displayHour = hour % 12 || 12;
        const timeString = `${displayHour}:${minute.toString().padStart(2, "0")} ${period}`;
        times.push(timeString);
      }
    }
    return times;
  };
  const timeSlots = generateTimeSlots();
  const LocationModal = () => {
    const [searchText, setSearchText] = useState("");
    const handleCurrentLocation = () => {
      if ("geolocation" in navigator) {
        navigator.geolocation.getCurrentPosition(
          (position) => {
            const coords = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };
            setCurrentUserLocation(coords);
            handleLocationSelect("Current Location");
          },
          (error) => {
            console.error("Error getting location:", error);
            toast$2.error("Could not get location");
          }
        );
      } else {
        toast$2.error("Geolocation not supported");
      }
    };
    return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
      /* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: locationType === "from" ? "PICKUP" : "DROP" }),
          /* @__PURE__ */ jsx("button", { onClick: () => setShowLocationModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
          LocationAutocomplete,
          {
            value: searchText,
            onChange: setSearchText,
            onLocationSelect: handleLocationSelect,
            placeholder: `Search ${locationType === "from" ? "Pickup" : "Drop"}...`
          }
        ) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: handleCurrentLocation,
          className: "flex items-center gap-2 text-blue-600 text-sm font-medium mb-4 hover:bg-blue-50 p-2 rounded w-full transition-colors",
          children: [
            /* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
            " Use Current Location"
          ]
        }
      ) })
    ] }) });
  };
  const StopsModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Add Stops" }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      stops.map((stop, index) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
        /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mb-2", children: [
          "Stop ",
          index + 1
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsx(
            LocationAutocomplete,
            {
              value: stop.value,
              onChange: (val) => handleStopChange(stop.id, val),
              onLocationSelect: (val) => handleStopChange(stop.id, val),
              placeholder: "Enter stop location",
              className: "flex-1"
            }
          ),
          /* @__PURE__ */ jsx("button", { onClick: () => removeStop(stop.id), className: "text-gray-500 hover:text-red-500", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] })
      ] }, stop.id)),
      /* @__PURE__ */ jsxs("button", { onClick: addStop, className: "flex items-center gap-2 text-blue-600 text-sm font-medium mt-4", children: [
        /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
        " Add Stops"
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-gray-200", children: /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "w-full bg-blue-600 text-white py-3 rounded-lg font-semibold", children: "DONE" }) })
  ] }) });
  const DateModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: dateType === "return" ? "RETURN DATE" : "PICKUP DATE" }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowDateModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4 text-gray-900", children: [
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(-1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 rotate-90" }) }),
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold uppercase", children: currentDisplayDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 -rotate-90" }) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-2", children: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map((day) => /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-500 font-medium py-2", children: day }, day)) }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: calendarDays.map((dayObj, index) => {
        var _a2;
        const currentDateStr = (_a2 = dayObj.date) == null ? void 0 : _a2.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" });
        const isSelected = currentDateStr === (dateType === "return" ? returnDate : pickupDate);
        return /* @__PURE__ */ jsx(
          "div",
          {
            className: `h-10 flex items-center justify-center rounded-full text-sm font-medium cursor-pointer
                    ${!dayObj.day || dayObj.otherMonth ? "text-transparent pointer-events-none" : "text-gray-700 hover:bg-gray-100"}
                    ${isSelected ? "bg-orange-500 text-white hover:bg-orange-600" : ""}
                  `,
            onClick: () => handleDateSelect(dayObj),
            children: dayObj.day
          },
          index
        );
      }) })
    ] })
  ] }) });
  const TimeModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "PICKUP TIME" }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowTimeModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto p-4", children: timeSlots.map((time, index) => /* @__PURE__ */ jsx(
      "div",
      {
        className: `py-3 border-b text-black border-gray-100 cursor-pointer hover:bg-gray-50 ${pickupTime === time ? "bg-blue-50" : ""}`,
        onClick: () => handleTimeSelect(time),
        children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: time })
      },
      index
    )) })
  ] }) });
  if (currentCityLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-white flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-orange-500 mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: "Loading city service details..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    showLocationModal && /* @__PURE__ */ jsx(LocationModal, {}),
    showStopsModal && /* @__PURE__ */ jsx(StopsModal, {}),
    showDateModal && /* @__PURE__ */ jsx(DateModal, {}),
    showTimeModal && /* @__PURE__ */ jsx(TimeModal, {}),
    /* @__PURE__ */ jsx("div", { className: "w-full bg-orange-500 py-4 px-4 mt-16", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-8 ml-8", children: [
        /* @__PURE__ */ jsxs("div", { className: "relative", children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "TRIP TYPE" }),
          /* @__PURE__ */ jsxs(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md flex items-center gap-1 text-black min-w-[180px]",
              onClick: () => setShowTripTypeDropdown(!showTripTypeDropdown),
              children: [
                (_b = tripTypeOptions.find((opt) => opt.value === tripType)) == null ? void 0 : _b.label,
                /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
              ]
            }
          ),
          showTripTypeDropdown && /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 mt-1 bg-white text-black border border-gray-200 rounded-md shadow-lg z-10 min-w-[180px]", children: tripTypeOptions.map((option) => /* @__PURE__ */ jsx(
            "div",
            {
              className: `px-4 py-2 cursor-pointer hover:bg-gray-100 ${tripType === option.value ? "bg-blue-50 text-blue-600" : ""}`,
              onClick: () => {
                setTripType(option.value);
                setShowTripTypeDropdown(false);
              },
              children: option.label
            },
            option.value
          )) })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "FROM" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("from");
                setShowLocationModal(true);
              },
              children: fromLocation || "Select"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "mt-5 relative inline-block", children: [
          /* @__PURE__ */ jsx("span", { className: "absolute -top-3 right-2 text-[11px] px-1.5 py-[1px] bg-white text-purple-600 border border-black rounded-md font-semibold shadow-sm", children: "new" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3] shadow",
              onClick: () => setShowStopsModal(true),
              children: "+ Add Stops"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "TO" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setLocationType("to");
                setShowLocationModal(true);
              },
              children: toLocation || "Select"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PICKUP DATE" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setDateType("pickup");
                setShowDateModal(true);
              },
              children: pickupDate || "Select Date"
            }
          )
        ] }),
        tripType === "round" && /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "RETURN DATE" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => {
                setDateType("return");
                setShowDateModal(true);
              },
              children: returnDate || "Select Date"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PICKUP TIME" }),
          /* @__PURE__ */ jsx(
            "button",
            {
              className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
              onClick: () => setShowTimeModal(true),
              children: pickupTime
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
        "button",
        {
          className: "text-lg font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3]",
          onClick: handleUpdateSearch,
          disabled: searchLoading,
          children: searchLoading ? "SEARCHING..." : "UPDATE SEARCH"
        }
      ) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white min-h-screen text-gray-800", children: [
      /* @__PURE__ */ jsxs("div", { className: "px-16 py-4 text-sm text-blue-600 max-w-full mx-auto", children: [
        "Home > Cab Booking > ",
        (service == null ? void 0 : service.cityName) ? `${service.cityName} Cab Services` : "Cab Services"
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "px-16 max-w-full mx-auto", children: [
        /* @__PURE__ */ jsxs("h1", { className: "text-3xl font-bold mb-3 text-gray-900", children: [
          service == null ? void 0 : service.cityName,
          " Taxi Services"
        ] }),
        /* @__PURE__ */ jsx("p", { className: "text-gray-600 max-w-4xl mb-4 text-base", children: (service == null ? void 0 : service.metaDescription) || `Book taxi services in ${service == null ? void 0 : service.cityName} for comfort & safety. Book your taxi now.` }),
        (service == null ? void 0 : service.startsFrom) && /* @__PURE__ */ jsxs("p", { className: "text-green-600 font-bold text-lg", children: [
          "Starts from ₹",
          service.startsFrom
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row gap-8 px-16 mt-8 max-w-full mx-auto", children: [
        /* @__PURE__ */ jsx("div", { className: "lg:w-80 flex-shrink-0", children: /* @__PURE__ */ jsxs("div", { className: "bg-gray-50 p-6 rounded-lg border border-gray-200 h-fit sticky top-24", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-base font-bold text-gray-900 mb-4", children: "Why book one-way trip with us?" }),
          /* @__PURE__ */ jsxs("ul", { className: "space-y-3 text-sm text-gray-700", children: [
            /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-blue-600 font-bold mt-0.5 flex-shrink-0", children: "✓" }),
              /* @__PURE__ */ jsx("span", { className: "leading-snug", children: "Special one-way fares to just get dropped off to your destination" })
            ] }),
            /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-blue-600 font-bold mt-0.5 flex-shrink-0", children: "✓" }),
              /* @__PURE__ */ jsx("span", { className: "leading-snug", children: "Experienced and polite drivers with well-serviced, comfortable cabs" })
            ] }),
            /* @__PURE__ */ jsxs("li", { className: "flex items-start gap-2", children: [
              /* @__PURE__ */ jsx("span", { className: "text-blue-600 font-bold mt-0.5 flex-shrink-0", children: "✓" }),
              /* @__PURE__ */ jsx("span", { className: "leading-snug", children: "Prices inclusive of GST, state taxes and tolls on majority of the routes" })
            ] })
          ] }),
          /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx("button", { className: "text-blue-600 text-sm font-medium hover:underline", children: "know more" }) })
        ] }) }),
        /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
          /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
            "Top Cabs Routes from ",
            service == null ? void 0 : service.cityName
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden", children: [
            /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 bg-blue-100 p-4 font-bold text-gray-700 text-sm", children: [
              /* @__PURE__ */ jsxs("div", { className: "col-span-5", children: [
                "Cab from ",
                service == null ? void 0 : service.cityName
              ] }),
              /* @__PURE__ */ jsx("div", { className: "col-span-4", children: "Included kms & Extra fare" }),
              /* @__PURE__ */ jsx("div", { className: "col-span-3 text-right pr-8", children: "Cab Price" })
            ] }),
            /* @__PURE__ */ jsx("div", { className: "divide-y divide-gray-100", children: (service == null ? void 0 : service.routesFromCity) && service.routesFromCity.length > 0 || (service == null ? void 0 : service.popularRoutes) && service.popularRoutes.length > 0 ? (((_c = service.routesFromCity) == null ? void 0 : _c.length) > 0 ? service.routesFromCity : service.popularRoutes).map((route, i) => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 p-4 items-center hover:bg-gray-50 transition-colors", children: [
              /* @__PURE__ */ jsxs("div", { className: "col-span-5", children: [
                /* @__PURE__ */ jsxs("div", { className: "font-bold text-gray-900 text-base cursor-pointer hover:text-blue-600", onClick: () => handleRouteClick(route), children: [
                  service == null ? void 0 : service.cityName,
                  " to ",
                  route.destinationCity,
                  " cabs"
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-xs mt-1", children: [
                  route.distance,
                  " kms | ",
                  Math.round(route.duration / 60),
                  "h ",
                  route.duration % 60,
                  "m (appx.)"
                ] })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "col-span-4 text-sm", children: [
                /* @__PURE__ */ jsxs("div", { className: "text-green-600 font-medium mb-1", children: [
                  route.distance,
                  " kms included"
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-xs", children: [
                  "Extra fare ₹",
                  route.extraKmRate || 15,
                  "/km after ",
                  route.distance,
                  " kms"
                ] })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "col-span-3 flex items-center justify-end gap-6", children: [
                /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                  /* @__PURE__ */ jsxs("div", { className: "font-bold text-xl text-gray-900", children: [
                    "₹",
                    route.startsFrom
                  ] }),
                  /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: "onwards" })
                ] }),
                /* @__PURE__ */ jsx(
                  "button",
                  {
                    className: "bg-orange-500 hover:bg-orange-600 text-white font-bold py-2 px-6 rounded text-sm transition-colors",
                    onClick: () => handleRouteClick(route),
                    children: "VIEW CABS"
                  }
                )
              ] })
            ] }, i)) : /* @__PURE__ */ jsxs("div", { className: "p-8 text-center text-gray-500", children: [
              "No top routes available from ",
              service == null ? void 0 : service.cityName,
              " at the moment."
            ] }) })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "mt-12", children: [
            /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
              "Top Cabs Routes to ",
              service == null ? void 0 : service.cityName
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden", children: [
              /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 bg-blue-100 p-4 font-bold text-gray-700 text-sm", children: [
                /* @__PURE__ */ jsxs("div", { className: "col-span-5", children: [
                  "Cab to ",
                  service == null ? void 0 : service.cityName
                ] }),
                /* @__PURE__ */ jsx("div", { className: "col-span-4", children: "Included kms & Extra fare" }),
                /* @__PURE__ */ jsx("div", { className: "col-span-3 text-right pr-8", children: "Cab Price" })
              ] }),
              /* @__PURE__ */ jsx("div", { className: "divide-y divide-gray-100", children: (service == null ? void 0 : service.routesToCity) && service.routesToCity.length > 0 ? service.routesToCity.map((route, i) => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 p-4 items-center hover:bg-gray-50 transition-colors", children: [
                /* @__PURE__ */ jsxs("div", { className: "col-span-5", children: [
                  /* @__PURE__ */ jsxs("div", { className: "font-bold text-gray-900 text-base cursor-pointer hover:text-blue-600", onClick: () => handleRouteClick(route), children: [
                    route.originCity,
                    " to ",
                    service == null ? void 0 : service.cityName,
                    " cabs"
                  ] }),
                  /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-xs mt-1", children: [
                    route.distance,
                    " kms | ",
                    Math.round(route.duration / 60),
                    "h ",
                    route.duration % 60,
                    "m (appx.)"
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "col-span-4 text-sm", children: [
                  /* @__PURE__ */ jsxs("div", { className: "text-green-600 font-medium mb-1", children: [
                    route.distance,
                    " kms included"
                  ] }),
                  /* @__PURE__ */ jsxs("div", { className: "text-gray-500 text-xs", children: [
                    "Extra fare ₹",
                    route.extraKmRate || 15,
                    "/km after ",
                    route.distance,
                    " kms"
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "col-span-3 flex items-center justify-end gap-6", children: [
                  /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                    /* @__PURE__ */ jsxs("div", { className: "font-bold text-xl text-gray-900", children: [
                      "₹",
                      route.startsFrom
                    ] }),
                    /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: "onwards" })
                  ] }),
                  /* @__PURE__ */ jsx(
                    "button",
                    {
                      className: "bg-orange-500 hover:bg-orange-600 text-white font-bold py-2 px-6 rounded text-sm transition-colors",
                      onClick: () => handleRouteClick(route),
                      children: "VIEW CABS"
                    }
                  )
                ] })
              ] }, i)) : /* @__PURE__ */ jsxs("div", { className: "p-8 text-center text-gray-500", children: [
                "No top routes available to ",
                service == null ? void 0 : service.cityName,
                " at the moment."
              ] }) })
            ] })
          ] })
        ] })
      ] }),
      /* @__PURE__ */ jsx("section", { className: "py-12 bg-gray-50", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
          "Available Rental Cab in ",
          service == null ? void 0 : service.cityName
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden", children: [
          /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 bg-gray-100 p-4 font-bold text-gray-700 text-sm border-b", children: [
            /* @__PURE__ */ jsx("div", { className: "col-span-5", children: "Cab Model" }),
            /* @__PURE__ */ jsx("div", { className: "col-span-4", children: "Included kms & Extra fare" }),
            /* @__PURE__ */ jsx("div", { className: "col-span-3 text-right pr-4", children: "Cab Price" })
          ] }),
          /* @__PURE__ */ jsx("div", { className: "divide-y divide-gray-100", children: (service == null ? void 0 : service.vehicleOptions) && service.vehicleOptions.length > 0 ? service.vehicleOptions.map((pkg, i) => /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-12 gap-4 p-4 items-center hover:bg-gray-50", children: [
            /* @__PURE__ */ jsxs("div", { className: "col-span-5 flex items-center gap-3", children: [
              /* @__PURE__ */ jsx(Car, { className: "w-5 h-5 text-gray-400" }),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("div", { className: "font-bold text-gray-900", children: pkg.groupName }),
                /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: pkg.modelNames && pkg.modelNames.length > 0 ? pkg.modelNames.join(", ") : "Or Similar" })
              ] })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "col-span-4 text-sm", children: [
              /* @__PURE__ */ jsxs("div", { className: "text-gray-900 font-medium", children: [
                pkg.includedKm,
                " kms included"
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500", children: [
                "Extra fare ₹",
                pkg.extraFarePerKm,
                "/km"
              ] })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "col-span-3 flex items-center justify-end gap-4", children: [
              /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                /* @__PURE__ */ jsxs("div", { className: "font-bold text-xl text-gray-900", children: [
                  "₹",
                  pkg.price
                ] }),
                /* @__PURE__ */ jsx("div", { className: "text-xs text-gray-500", children: "flat rate" })
              ] }),
              /* @__PURE__ */ jsx(
                "button",
                {
                  className: "bg-white border border-blue-600 text-blue-600 font-bold py-1.5 px-4 rounded hover:bg-blue-50 transition-colors text-sm",
                  onClick: () => handleSelectVehicle(pkg),
                  children: "BOOK"
                }
              )
            ] })
          ] }, i)) : /* @__PURE__ */ jsxs("div", { className: "p-8 text-center text-gray-500", children: [
            "No rental packages available in ",
            service == null ? void 0 : service.cityName,
            " at the moment."
          ] }) })
        ] })
      ] }) }),
      faqs.length > 0 && /* @__PURE__ */ jsx("section", { className: "py-12 bg-gray-50", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
          "FAQs About ",
          service == null ? void 0 : service.cityName,
          " Cabs Services"
        ] }),
        /* @__PURE__ */ jsx("div", { className: "bg-white rounded-lg border border-gray-200 p-6 space-y-6", children: faqs.map((faq2, index) => /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("p", { className: "font-bold text-gray-900 text-base mb-2", children: [
            "Q: ",
            faq2.question
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "text-gray-700 text-sm leading-relaxed", children: [
            "A: ",
            faq2.answer
          ] })
        ] }, index)) })
      ] }) }),
      /* @__PURE__ */ jsx("section", { className: "py-8 bg-white border-t border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col lg:flex-row gap-8 px-16 max-w-full mx-auto", children: [
        /* @__PURE__ */ jsx("div", { className: "lg:w-40 flex-shrink-0 hidden lg:block" }),
        /* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-8", children: [
          ((_d = service == null ? void 0 : service.routesFromCitySlugsOnly) == null ? void 0 : _d.length) > 0 && /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("h3", { className: "text-sm font-bold text-gray-900 mb-3 uppercase tracking-wide", children: [
              "Cabs from ",
              service == null ? void 0 : service.cityName
            ] }),
            /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-x-2 gap-y-2 text-xs text-gray-500 leading-relaxed", children: service.routesFromCitySlugsOnly.map((route, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
              /* @__PURE__ */ jsxs(distExports.Link, { to: `/top/${route.slug}`, className: "hover:text-blue-600 hover:underline transition-colors", children: [
                route.originCity,
                " To ",
                route.destinationCity,
                " Cabs"
              ] }),
              i < service.routesFromCitySlugsOnly.length - 1 && /* @__PURE__ */ jsx("span", { className: "text-gray-300", children: "|" })
            ] }, i)) })
          ] }),
          ((_e = service == null ? void 0 : service.routesToCitySlugsOnly) == null ? void 0 : _e.length) > 0 && /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("h3", { className: "text-sm font-bold text-gray-900 mb-3 uppercase tracking-wide", children: [
              "Cabs to ",
              service == null ? void 0 : service.cityName
            ] }),
            /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-x-2 gap-y-2 text-xs text-gray-500 leading-relaxed", children: service.routesToCitySlugsOnly.map((route, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
              /* @__PURE__ */ jsxs(distExports.Link, { to: `/top/${route.slug}`, className: "hover:text-blue-600 hover:underline transition-colors", children: [
                route.originCity,
                " To ",
                route.destinationCity,
                " Cabs"
              ] }),
              i < service.routesToCitySlugsOnly.length - 1 && /* @__PURE__ */ jsx("span", { className: "text-gray-300", children: "|" })
            ] }, i)) })
          ] }),
          ((_f = service == null ? void 0 : service.airportRoutesFrom) == null ? void 0 : _f.length) > 0 && /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("h3", { className: "text-sm font-bold text-gray-900 mb-3 uppercase tracking-wide", children: "Airport Taxi" }),
            /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-x-2 gap-y-2 text-xs text-gray-500 leading-relaxed", children: service.airportRoutesFrom.map((route, i) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
              /* @__PURE__ */ jsxs(distExports.Link, { to: `/airport/${route.slug}`, className: "hover:text-blue-600 hover:underline transition-colors", children: [
                route.airportName,
                " Taxi Services"
              ] }),
              i < service.airportRoutesFrom.length - 1 && /* @__PURE__ */ jsx("span", { className: "text-gray-300", children: "|" })
            ] }, i)) })
          ] })
        ] })
      ] }) })
    ] }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const CityTaxiService = () => {
  var _a, _b, _c;
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  distExports.useLocation();
  const { slug } = distExports.useParams();
  const {
    currentCityService,
    currentCityLoading,
    currentCityError
  } = useSelector((state) => state.seo);
  const [tripType, setTripType] = useState("oneway");
  const [fromLocation, setFromLocation] = useState("");
  const [toLocation, setToLocation] = useState("");
  const [pickupDate, setPickupDate] = useState("");
  const [returnDate, setReturnDate] = useState("");
  const [pickupTime, setPickupTime] = useState("10:00 AM");
  const [stops, setStops] = useState([]);
  const [showTripTypeDropdown, setShowTripTypeDropdown] = useState(false);
  const [showLocationModal, setShowLocationModal] = useState(false);
  const [showStopsModal, setShowStopsModal] = useState(false);
  const [showDateModal, setShowDateModal] = useState(false);
  const [showTimeModal, setShowTimeModal] = useState(false);
  const [locationType, setLocationType] = useState("");
  const [dateType, setDateType] = useState("pickup");
  const [currentUserLocation, setCurrentUserLocation] = useState(null);
  const [searchLoading, setSearchLoading] = useState(false);
  const [activePackageTab, setActivePackageTab] = useState(0);
  const [expandedFaq, setExpandedFaq] = useState(null);
  const [currentDisplayDate, setCurrentDisplayDate] = useState(/* @__PURE__ */ new Date());
  useEffect(() => {
    if (slug) {
      dispatch(getCityServiceBySlug(slug));
    }
  }, [dispatch, slug]);
  useEffect(() => {
    if (currentCityService) {
      setFromLocation(currentCityService.cityName || "");
      const tomorrow = /* @__PURE__ */ new Date();
      tomorrow.setDate(tomorrow.getDate() + 1);
      setPickupDate(tomorrow.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" }));
    }
  }, [currentCityService]);
  const packageHours = [
    { label: "1 hr (10 km)", hours: 1 },
    { label: "2 hr (20 km)", hours: 2 },
    { label: "3 hr (30 km)", hours: 3 },
    { label: "4 hr (40 km)", hours: 4 },
    { label: "5 hr (50 km)", hours: 5 },
    { label: "6 hr (60 km)", hours: 6 }
  ];
  const tripTypeOptions = [
    { value: "oneway", label: "One Way" },
    { value: "round", label: "Round Trip" }
  ];
  const handleLocationSelect = (location2) => {
    if (locationType === "from") {
      setFromLocation(location2);
    } else if (locationType === "to") {
      setToLocation(location2);
    }
    setShowLocationModal(false);
  };
  const handleDateSelect = (dayObj) => {
    if (dayObj && !dayObj.otherMonth && dayObj.date) {
      const dateStr = dayObj.date.toLocaleDateString("en-GB", {
        day: "numeric",
        month: "short",
        year: "numeric"
      });
      if (dateType === "return") {
        setReturnDate(dateStr);
      } else {
        setPickupDate(dateStr);
      }
      setShowDateModal(false);
    }
  };
  const handleTimeSelect = (time) => {
    setPickupTime(time);
    setShowTimeModal(false);
  };
  const addStop = () => setStops([...stops, { id: Date.now(), value: "" }]);
  const removeStop = (id) => setStops(stops.filter((stop) => stop.id !== id));
  const handleStopChange = (id, value) => {
    setStops(stops.map((stop) => stop.id === id ? { ...stop, value } : stop));
  };
  const handleUpdateSearch = async () => {
    setSearchLoading(true);
    try {
      if (!fromLocation) {
        toast$2.error("Please enter a pickup location");
        setSearchLoading(false);
        return;
      }
      if (!toLocation) {
        toast$2.error("Please enter a drop location");
        setSearchLoading(false);
        return;
      }
      if (tripType === "round" && !returnDate) {
        toast$2.error("Please select a return date for round trip");
        setSearchLoading(false);
        return;
      }
      let sourceCoords;
      if (fromLocation === "Current Location" && currentUserLocation) {
        sourceCoords = currentUserLocation;
      } else {
        sourceCoords = await geocodeLocation(fromLocation);
      }
      if (!sourceCoords) {
        toast$2.error(`Could not find location: ${fromLocation}`);
        setSearchLoading(false);
        return;
      }
      let destCoords = await geocodeLocation(toLocation);
      if (!destCoords) {
        toast$2.error(`Could not find location: ${toLocation}`);
        setSearchLoading(false);
        return;
      }
      const validStops = [];
      if (stops.length > 0) {
        for (const stop of stops) {
          if (!stop.value || stop.value.trim() === "") continue;
          const stopCoords = await geocodeLocation(stop.value);
          if (stopCoords) {
            validStops.push({
              address: stop.value,
              coordinates: [stopCoords.lng, stopCoords.lat],
              stopOrder: validStops.length + 1
            });
          }
        }
      }
      const searchParams = {
        from: fromLocation,
        to: toLocation,
        sourceLat: sourceCoords.lat,
        sourceLong: sourceCoords.lng,
        destLat: destCoords.lat,
        destLong: destCoords.lng,
        tripType: tripType === "oneway" ? "oneWay" : "roundTrip",
        fuelType: "petrol",
        isAc: true,
        pickupDate,
        pickupTime,
        returnDate,
        startTime: (/* @__PURE__ */ new Date()).toISOString(),
        stops: validStops.length > 0 ? validStops : void 0
      };
      navigate("/results", { state: { searchParams } });
    } catch (error) {
      console.error("Search error:", error);
      toast$2.error("Something went wrong with the search");
    } finally {
      setSearchLoading(false);
    }
  };
  const getDaysInMonth = (date) => new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
  const getFirstDayOfMonth = (date) => new Date(date.getFullYear(), date.getMonth(), 1).getDay();
  const generateCalendarDays = () => {
    const daysInMonth = getDaysInMonth(currentDisplayDate);
    const firstDay = getFirstDayOfMonth(currentDisplayDate);
    const days = [];
    const startOffset = firstDay === 0 ? 6 : firstDay - 1;
    for (let i = 0; i < startOffset; i++) {
      days.push({ day: "", otherMonth: true });
    }
    for (let i = 1; i <= daysInMonth; i++) {
      days.push({
        day: i.toString(),
        date: new Date(currentDisplayDate.getFullYear(), currentDisplayDate.getMonth(), i)
      });
    }
    return days;
  };
  const calendarDays = generateCalendarDays();
  const changeMonth = (offset) => {
    const newDate = new Date(currentDisplayDate);
    newDate.setMonth(newDate.getMonth() + offset);
    setCurrentDisplayDate(newDate);
  };
  const generateTimeSlots = () => {
    const times = [];
    for (let hour = 0; hour < 24; hour++) {
      for (let minute = 0; minute < 60; minute += 15) {
        const period = hour >= 12 ? "PM" : "AM";
        const displayHour = hour % 12 || 12;
        const timeString = `${displayHour}:${minute.toString().padStart(2, "0")} ${period}`;
        times.push(timeString);
      }
    }
    return times;
  };
  const timeSlots = generateTimeSlots();
  const LocationModal = () => {
    const [searchText, setSearchText] = useState("");
    const handleCurrentLocation = () => {
      if ("geolocation" in navigator) {
        navigator.geolocation.getCurrentPosition(
          (position) => {
            const coords = {
              lat: position.coords.latitude,
              lng: position.coords.longitude
            };
            setCurrentUserLocation(coords);
            handleLocationSelect("Current Location");
          },
          (error) => {
            console.error("Error getting location:", error);
            toast$2.error("Could not get location");
          }
        );
      } else {
        toast$2.error("Geolocation not supported");
      }
    };
    return /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
      /* @__PURE__ */ jsxs("div", { className: "p-4 border-b border-gray-200", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: locationType === "from" ? "PICKUP" : "DROP" }),
          /* @__PURE__ */ jsx("button", { onClick: () => setShowLocationModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "mt-2", children: /* @__PURE__ */ jsx(
          LocationAutocomplete,
          {
            value: searchText,
            onChange: setSearchText,
            onLocationSelect: handleLocationSelect,
            placeholder: `Search ${locationType === "from" ? "Pickup" : "Drop"}...`
          }
        ) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "p-4", children: /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: handleCurrentLocation,
          className: "flex items-center gap-2 text-blue-600 text-sm font-medium mb-4 hover:bg-blue-50 p-2 rounded w-full transition-colors",
          children: [
            /* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
            " Use Current Location"
          ]
        }
      ) })
    ] }) });
  };
  const StopsModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Add Stops" }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      stops.map((stop, index) => /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
        /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mb-2", children: [
          "Stop ",
          index + 1
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
          /* @__PURE__ */ jsx(
            LocationAutocomplete,
            {
              value: stop.value,
              onChange: (val) => handleStopChange(stop.id, val),
              onLocationSelect: (val) => handleStopChange(stop.id, val),
              placeholder: "Enter stop location",
              className: "flex-1"
            }
          ),
          /* @__PURE__ */ jsx("button", { onClick: () => removeStop(stop.id), className: "text-gray-500 hover:text-red-500", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
        ] })
      ] }, stop.id)),
      /* @__PURE__ */ jsxs("button", { onClick: addStop, className: "flex items-center gap-2 text-blue-600 text-sm font-medium mt-4", children: [
        /* @__PURE__ */ jsx(Plus, { className: "w-4 h-4" }),
        " Add Stops"
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "p-4 border-t border-gray-200", children: /* @__PURE__ */ jsx("button", { onClick: () => setShowStopsModal(false), className: "w-full bg-blue-600 text-white py-3 rounded-lg font-semibold", children: "DONE" }) })
  ] }) });
  const DateModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: dateType === "return" ? "RETURN DATE" : "PICKUP DATE" }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowDateModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center mb-4 text-gray-900", children: [
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(-1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 rotate-90" }) }),
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-bold uppercase", children: currentDisplayDate.toLocaleDateString("en-US", { month: "long", year: "numeric" }) }),
        /* @__PURE__ */ jsx("button", { onClick: () => changeMonth(1), className: "p-2 hover:bg-gray-100 rounded-full", children: /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 -rotate-90" }) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1 mb-2", children: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"].map((day) => /* @__PURE__ */ jsx("div", { className: "text-center text-xs text-gray-500 font-medium py-2", children: day }, day)) }),
      /* @__PURE__ */ jsx("div", { className: "grid grid-cols-7 gap-1", children: calendarDays.map((dayObj, index) => {
        var _a2;
        const currentDateStr = (_a2 = dayObj.date) == null ? void 0 : _a2.toLocaleDateString("en-GB", { day: "numeric", month: "short", year: "numeric" });
        const isSelected = currentDateStr === (dateType === "return" ? returnDate : pickupDate);
        return /* @__PURE__ */ jsx(
          "div",
          {
            className: `h-10 flex items-center justify-center rounded-full text-sm font-medium cursor-pointer
                    ${!dayObj.day || dayObj.otherMonth ? "text-transparent pointer-events-none" : "text-gray-700 hover:bg-gray-100"}
                    ${isSelected ? "bg-orange-500 text-white hover:bg-orange-600" : ""}
                  `,
            onClick: () => handleDateSelect(dayObj),
            children: dayObj.day
          },
          index
        );
      }) })
    ] })
  ] }) });
  const TimeModal = () => /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-md", children: [
    /* @__PURE__ */ jsx("div", { className: "p-4 border-b border-gray-200", children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "PICKUP TIME" }),
      /* @__PURE__ */ jsx("button", { onClick: () => setShowTimeModal(false), className: "p-1 text-gray-500 hover:text-gray-700", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
    ] }) }),
    /* @__PURE__ */ jsx("div", { className: "max-h-96 overflow-y-auto p-4", children: timeSlots.map((time, index) => /* @__PURE__ */ jsx(
      "div",
      {
        className: `py-3 border-b text-black border-gray-100 cursor-pointer hover:bg-gray-50 ${pickupTime === time ? "bg-blue-50" : ""}`,
        onClick: () => handleTimeSelect(time),
        children: /* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: time })
      },
      index
    )) })
  ] }) });
  if (currentCityLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-white flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-orange-500 mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: "Loading city service details..." })
    ] }) });
  }
  if (currentCityError || !currentCityService) {
    return /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center min-h-screen", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-gray-800 mb-4", children: "City Service Not Found" }),
      /* @__PURE__ */ jsx("button", { onClick: () => navigate("/"), className: "px-6 py-2 bg-green-600 text-white rounded-lg", children: "Go to Home" })
    ] });
  }
  const data = currentCityService;
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-gray-50", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    showLocationModal && /* @__PURE__ */ jsx(LocationModal, {}),
    showStopsModal && /* @__PURE__ */ jsx(StopsModal, {}),
    showDateModal && /* @__PURE__ */ jsx(DateModal, {}),
    showTimeModal && /* @__PURE__ */ jsx(TimeModal, {}),
    /* @__PURE__ */ jsxs("div", { className: "pt-16", children: [
      /* @__PURE__ */ jsx("div", { className: "w-full bg-orange-500 py-4 px-4", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto flex flex-wrap items-center justify-between gap-4", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-8 ml-8", children: [
          /* @__PURE__ */ jsxs("div", { className: "relative", children: [
            /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "TRIP TYPE" }),
            /* @__PURE__ */ jsxs(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md flex items-center gap-1 text-black min-w-[180px]",
                onClick: () => setShowTripTypeDropdown(!showTripTypeDropdown),
                children: [
                  (_a = tripTypeOptions.find((opt) => opt.value === tripType)) == null ? void 0 : _a.label,
                  /* @__PURE__ */ jsx(ChevronDown, { className: "w-4 h-4" })
                ]
              }
            ),
            showTripTypeDropdown && /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 mt-1 bg-white text-black border border-gray-200 rounded-md shadow-lg z-10 min-w-[180px]", children: tripTypeOptions.map((option) => /* @__PURE__ */ jsx(
              "div",
              {
                className: `px-4 py-2 cursor-pointer hover:bg-gray-100 ${tripType === option.value ? "bg-blue-50 text-blue-600" : ""}`,
                onClick: () => {
                  setTripType(option.value);
                  setShowTripTypeDropdown(false);
                },
                children: option.label
              },
              option.value
            )) })
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "FROM" }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
                onClick: () => {
                  setLocationType("from");
                  setShowLocationModal(true);
                },
                children: fromLocation || "Select"
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "mt-5 relative inline-block", children: [
            /* @__PURE__ */ jsx("span", { className: "absolute -top-3 right-2 text-[11px] px-1.5 py-[1px] bg-white text-purple-600 border border-black rounded-md font-semibold shadow-sm", children: "new" }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3] shadow",
                onClick: () => setShowStopsModal(true),
                children: "+ Add Stops"
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "TO" }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
                onClick: () => {
                  setLocationType("to");
                  setShowLocationModal(true);
                },
                children: toLocation || "Select"
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PICKUP DATE" }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
                onClick: () => {
                  setDateType("pickup");
                  setShowDateModal(true);
                },
                children: pickupDate || "Select Date"
              }
            )
          ] }),
          tripType === "round" && /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "RETURN DATE" }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
                onClick: () => {
                  setDateType("return");
                  setShowDateModal(true);
                },
                children: returnDate || "Select Date"
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "text-white text-xs font-bold mb-1", children: "PICKUP TIME" }),
            /* @__PURE__ */ jsx(
              "button",
              {
                className: "text-sm font-semibold bg-white px-4 py-2 rounded-md text-black min-w-[120px]",
                onClick: () => setShowTimeModal(true),
                children: pickupTime
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "mt-4", children: /* @__PURE__ */ jsx(
          "button",
          {
            className: "text-lg font-semibold bg-white px-4 py-2 rounded-md text-[#2276e3]",
            onClick: handleUpdateSearch,
            disabled: searchLoading,
            children: searchLoading ? "SEARCHING..." : "UPDATE SEARCH"
          }
        ) })
      ] }) }),
      /* @__PURE__ */ jsx("div", { className: "bg-gradient-to-r from-blue-600 to-blue-700 text-white py-12", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h1", { className: "text-3xl md:text-4xl font-bold mb-2", children: [
          data.cityName,
          " Taxi Services"
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "text-lg opacity-90", children: [
          "Book reliable cabs starting from ",
          /* @__PURE__ */ jsxs("span", { className: "font-bold text-yellow-300", children: [
            "₹",
            data.startsFrom
          ] })
        ] })
      ] }) }),
      data.routesFromCity && data.routesFromCity.length > 0 && /* @__PURE__ */ jsx("section", { className: "py-12 bg-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
          "Top Cabs Routes from ",
          data.cityName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: data.routesFromCity.map((route, index) => /* @__PURE__ */ jsx(RouteCard, { route }, index)) })
      ] }) }),
      data.routesToCity && data.routesToCity.length > 0 && /* @__PURE__ */ jsx("section", { className: "py-12 bg-white", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
          "Top Cabs Routes to ",
          data.cityName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: data.routesToCity.map((route, index) => /* @__PURE__ */ jsx(RouteCard, { route }, index)) })
      ] }) }),
      data.rentalPackages && data.rentalPackages.length > 0 && /* @__PURE__ */ jsx("section", { className: "py-12 bg-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
          "Available Rental Cab in ",
          data.cityName
        ] }),
        /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mb-6", children: packageHours.map((pkg, index) => /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => setActivePackageTab(index),
            className: `px-4 py-2 rounded-lg font-medium transition-colors ${activePackageTab === index ? "bg-blue-600 text-white" : "bg-white text-gray-700 hover:bg-gray-50"}`,
            children: pkg.label
          },
          index
        )) }),
        /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6", children: data.rentalPackages.map((group, index) => {
          var _a2;
          const selectedPackage = (_a2 = group.packages) == null ? void 0 : _a2.find(
            (p) => p.hours === packageHours[activePackageTab].hours
          );
          if (!selectedPackage) return null;
          return /* @__PURE__ */ jsx(
            RentalPackageCard,
            {
              group,
              package: selectedPackage
            },
            index
          );
        }) })
      ] }) }),
      data.faqs && data.faqs.length > 0 && /* @__PURE__ */ jsx("section", { className: "py-12 bg-white", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: [
          "FAQs About ",
          data.cityName,
          " Cabs Services"
        ] }),
        /* @__PURE__ */ jsx("div", { className: "space-y-4", children: data.faqs.map((faq2, index) => /* @__PURE__ */ jsxs("div", { className: "bg-gray-50 rounded-lg overflow-hidden", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              onClick: () => setExpandedFaq(expandedFaq === index ? null : index),
              className: "w-full px-6 py-4 flex items-center justify-between text-left hover:bg-gray-100 transition-colors",
              children: [
                /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900", children: faq2.question }),
                /* @__PURE__ */ jsx(
                  ChevronDown,
                  {
                    className: `w-5 h-5 text-gray-500 transition-transform ${expandedFaq === index ? "transform rotate-180" : ""}`
                  }
                )
              ]
            }
          ),
          expandedFaq === index && /* @__PURE__ */ jsx("div", { className: "px-6 py-4 bg-white border-t", children: /* @__PURE__ */ jsx("p", { className: "text-gray-700", children: faq2.answer }) })
        ] }, index)) })
      ] }) }),
      data.routesFromCitySlugsOnly && data.routesFromCitySlugsOnly.length > 0 && /* @__PURE__ */ jsx(
        LinkListSection,
        {
          title: `Cabs from ${data.cityName}`,
          routes: data.routesFromCitySlugsOnly
        }
      ),
      data.routesToCitySlugsOnly && data.routesToCitySlugsOnly.length > 0 && /* @__PURE__ */ jsx(
        LinkListSection,
        {
          title: `Cabs to ${data.cityName}`,
          routes: data.routesToCitySlugsOnly
        }
      ),
      (data.airportRoutesFrom && data.airportRoutesFrom.length > 0 || data.airportRoutesTo && data.airportRoutesTo.length > 0) && /* @__PURE__ */ jsx("section", { className: "py-12 bg-white", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: "Airport Routes" }),
        /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: [
          (_b = data.airportRoutesFrom) == null ? void 0 : _b.map((route, index) => /* @__PURE__ */ jsxs(
            distExports.Link,
            {
              to: `/airport/${route.slug}`,
              className: "text-blue-600 hover:text-blue-800 hover:underline",
              children: [
                route.airportName,
                " to ",
                route.cityName
              ]
            },
            `from-${index}`
          )),
          (_c = data.airportRoutesTo) == null ? void 0 : _c.map((route, index) => /* @__PURE__ */ jsxs(
            distExports.Link,
            {
              to: `/airport/${route.slug}`,
              className: "text-blue-600 hover:text-blue-800 hover:underline",
              children: [
                route.cityName,
                " to ",
                route.airportName
              ]
            },
            `to-${index}`
          ))
        ] })
      ] }) })
    ] }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const RouteCard = ({ route }) => {
  const navigate = distExports.useNavigate();
  return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm hover:shadow-md transition-shadow p-6", children: [
    /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
        /* @__PURE__ */ jsxs("h3", { className: "font-semibold text-gray-900 text-lg mb-2", children: [
          route.originCity,
          " to ",
          route.destinationCity
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4 text-sm text-gray-600", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsx(MapPin, { className: "w-4 h-4" }),
            /* @__PURE__ */ jsxs("span", { children: [
              route.distance,
              " kms"
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
            /* @__PURE__ */ jsx(Clock, { className: "w-4 h-4" }),
            /* @__PURE__ */ jsx("span", { children: route.durationText })
          ] })
        ] })
      ] }),
      /* @__PURE__ */ jsx(Car, { className: "w-8 h-8 text-blue-600" })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "space-y-2 mb-4", children: [
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
        route.includedKm || route.distance,
        " kms included"
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
        "Extra fare ₹",
        route.extraFarePerKm,
        "/km after ",
        route.includedKm || route.distance,
        " kms"
      ] })
    ] }),
    /* @__PURE__ */ jsxs(
      "button",
      {
        onClick: () => navigate(`/top/${route.slug}`),
        className: "w-full bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg flex items-center justify-center gap-2 transition-colors",
        children: [
          /* @__PURE__ */ jsxs("span", { children: [
            "₹",
            route.startsFrom,
            " onwards"
          ] }),
          /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
        ]
      }
    )
  ] });
};
const RentalPackageCard = ({ group, package: pkg }) => {
  return /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-sm hover:shadow-md transition-shadow p-6", children: [
    /* @__PURE__ */ jsxs("div", { className: "mb-4", children: [
      /* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900 text-lg mb-1", children: group.groupName }),
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
        group.category,
        " • ",
        group.seats,
        " seats"
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "space-y-2 mb-4", children: [
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
        pkg.baseKm,
        " kms included"
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
        "Extra fare ₹",
        pkg.extraFarePerKm,
        "/km after ",
        pkg.baseKm,
        " kms"
      ] })
    ] }),
    /* @__PURE__ */ jsxs("button", { className: "w-full bg-green-600 hover:bg-green-700 text-white font-medium py-2 px-4 rounded-lg flex items-center justify-center gap-2 transition-colors", children: [
      /* @__PURE__ */ jsxs("span", { children: [
        "₹",
        pkg.price,
        " onwards"
      ] }),
      /* @__PURE__ */ jsx(ChevronRight, { className: "w-4 h-4" })
    ] })
  ] });
};
const LinkListSection = ({ title, routes: routes2 }) => {
  return /* @__PURE__ */ jsx("section", { className: "py-12 bg-gray-100", children: /* @__PURE__ */ jsxs("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: [
    /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold text-gray-900 mb-6", children: title }),
    /* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: routes2.map((route, index) => /* @__PURE__ */ jsxs(
      distExports.Link,
      {
        to: `/top/${route.slug}`,
        className: "text-blue-600 hover:text-blue-800 hover:underline",
        children: [
          route.originCity,
          " to ",
          route.destinationCity
        ]
      },
      index
    )) })
  ] }) });
};
const HeroSectionMobile = () => {
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const [tab, setTab] = useState("outstation");
  const [tripType, setTripType] = useState("oneway");
  const [pickup, setPickup] = useState("");
  const [drop, setDrop] = useState("");
  const [stops, setStops] = useState([]);
  const [pickupDate, setPickupDate] = useState("");
  const [pickupTime, setPickupTime] = useState("");
  const [dropDate, setDropDate] = useState("");
  const [dropTime, setDropTime] = useState("");
  const [hourlyPackage, setHourlyPackage] = useState(null);
  const [isSearching, setIsSearching] = useState(false);
  const addStop = () => setStops((s) => [...s, ""]);
  const updateStop = (idx, val) => {
    setStops((s) => s.map((st, i) => i === idx ? val : st));
  };
  const removeStop = (idx) => setStops((s) => s.filter((_, i) => i !== idx));
  const swapLocations = () => {
    setPickup((oldPickup) => {
      const oldDrop = drop;
      setDrop(oldPickup);
      setStops((oldStops) => {
        if (!oldStops || oldStops.length === 0) return oldStops;
        return [...oldStops].reverse();
      });
      return oldDrop;
    });
  };
  const handleSearch = async (e) => {
    e == null ? void 0 : e.preventDefault();
    if (!pickup || pickup.trim() === "") {
      toast$2.error("Please enter pickup location");
      return;
    }
    if (tab !== "hourly" && (!drop || drop.trim() === "")) {
      toast$2.error("Please enter drop location");
      return;
    }
    if (!pickupDate) {
      toast$2.error("Please select pickup date");
      return;
    }
    if (!pickupTime) {
      toast$2.error("Please select pickup time");
      return;
    }
    setIsSearching(true);
    toast$2.loading("Finding cabs...", { id: "search-loading" });
    try {
      const sourceCoords = await geocodeLocation(pickup);
      if (!sourceCoords) {
        toast$2.dismiss("search-loading");
        toast$2.error(`Could not find location: ${pickup}`);
        setIsSearching(false);
        return;
      }
      let destCoords = null;
      let distance = 0;
      if (tab !== "hourly") {
        destCoords = await geocodeLocation(drop);
        if (!destCoords) {
          toast$2.dismiss("search-loading");
          toast$2.error(`Could not find location: ${drop}`);
          setIsSearching(false);
          return;
        }
        distance = calculateDistance(
          sourceCoords.lat,
          sourceCoords.lng,
          destCoords.lat,
          destCoords.lng
        );
      }
      const validStops = [];
      if (stops.length > 0) {
        for (const stopValue of stops) {
          if (!stopValue || stopValue.trim() === "") continue;
          const stopCoords = await geocodeLocation(stopValue);
          if (stopCoords) {
            validStops.push({
              address: stopValue,
              coordinates: [stopCoords.lng, stopCoords.lat],
              stopOrder: validStops.length + 1
            });
          }
        }
      }
      const searchParams = {
        sourceLat: sourceCoords.lat,
        sourceLong: sourceCoords.lng,
        destLat: destCoords == null ? void 0 : destCoords.lat,
        destLong: destCoords == null ? void 0 : destCoords.lng,
        tripType: tripType === "oneway" ? "oneWay" : tripType === "roundtrip" ? "roundTrip" : tab,
        distance: distance || 50,
        fuelType: "petrol",
        isAc: true,
        startTime: (/* @__PURE__ */ new Date()).toISOString(),
        // Include additional params for navigation
        from: pickup,
        to: drop,
        pickupDate,
        pickupTime,
        returnDate: tripType === "roundtrip" ? dropDate : void 0,
        stops: validStops.length > 0 ? validStops : void 0,
        rentalPackage: tab === "hourly" ? hourlyPackage : void 0
      };
      dispatch(searchCabs(searchParams));
      toast$2.dismiss("search-loading");
      setIsSearching(false);
      navigate("/results", {
        state: {
          searchParams,
          searchData: {
            tab,
            tripType,
            pickup,
            drop,
            stops,
            pickupDate,
            pickupTime,
            dropDate: tripType === "roundtrip" ? dropDate : null,
            dropTime: tripType === "roundtrip" ? dropTime : null,
            hourlyPackage,
            sourceLat: sourceCoords.lat,
            sourceLong: sourceCoords.lng,
            destLat: destCoords == null ? void 0 : destCoords.lat,
            destLong: destCoords == null ? void 0 : destCoords.lng,
            distance
          }
        }
      });
    } catch (error) {
      toast$2.dismiss("search-loading");
      toast$2.error("Search failed. Please try again.");
      console.error("Search error:", error);
      setIsSearching(false);
    }
  };
  const hourlyOptions = [
    { id: 1, title: "1 hr", sub: "10 km" },
    { id: 2, title: "2 hr", sub: "20 km" },
    { id: 3, title: "3 hr", sub: "30 km" },
    { id: 4, title: "4 hr", sub: "40 km" }
  ];
  return /* @__PURE__ */ jsxs("div", { className: "w-full min-h-screen bg-gray-200 font-sans text-[#111827] pb-[1px]", children: [
    /* @__PURE__ */ jsxs("div", { className: "flex bg-white border-b border-gray-200 text-sm font-semibold", children: [
      /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: () => setTab("outstation"),
          className: `flex-1 py-3 text-center flex flex-col items-center gap-1 ${tab === "outstation" ? "text-[#1e67d1] border-b-4 border-[#1e67d1]" : "text-gray-500"}`,
          children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://cdn-icons-png.flaticon.com/128/89/89102.png",
                className: "w-5 h-5",
                alt: ""
              }
            ),
            "Outstation Cabs"
          ]
        }
      ),
      /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: () => setTab("airport"),
          className: `flex-1 py-3 text-center flex flex-col items-center gap-1 ${tab === "airport" ? "text-[#1e67d1] border-b-4 border-[#1e67d1]" : "text-gray-500"}`,
          children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://cdn-icons-png.flaticon.com/128/89/89102.png",
                className: "w-5 h-5",
                alt: ""
              }
            ),
            "Airport Cabs"
          ]
        }
      ),
      /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: () => setTab("hourly"),
          className: `flex-1 py-3 text-center flex flex-col items-center gap-1 ${tab === "hourly" ? "text-[#1e67d1] border-b-4 border-[#1e67d1]" : "text-gray-500"}`,
          children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://cdn-icons-png.flaticon.com/128/89/89102.png",
                className: "w-5 h-5",
                alt: ""
              }
            ),
            "Hourly Rentals"
          ]
        }
      )
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-[#e8f8ef] px-4 py-2 text-xs text-gray-700 flex items-start gap-2", children: [
      /* @__PURE__ */ jsx("span", { className: "inline-block bg-red-500 text-white text-[10px] px-2 py-0.5 rounded", children: "New" }),
      /* @__PURE__ */ jsxs("div", { children: [
        "Tap add stops and enter more locations to personalize your journey",
        " ",
        /* @__PURE__ */ jsx("span", { className: "text-[#1e67d1] font-semibold", children: "know more" })
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "mx-3 mt-3", children: [
      /* @__PURE__ */ jsxs("form", { onSubmit: handleSearch, className: "bg-white rounded-lg shadow-sm px-4 py-4 space-y-4", children: [
        tab === "outstation" && /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxs("div", { className: "flex bg-gray-100 rounded-full overflow-hidden text-sm font-semibold", children: [
            /* @__PURE__ */ jsx(
              "button",
              {
                type: "button",
                onClick: () => setTripType("oneway"),
                className: `px-5 py-1 rounded-full ${tripType === "oneway" ? "bg-[#dbe9ff] text-[#1e67d1]" : "text-gray-600"}`,
                children: "One Way"
              }
            ),
            /* @__PURE__ */ jsx(
              "button",
              {
                type: "button",
                onClick: () => setTripType("roundtrip"),
                className: `px-5 py-1 rounded-full ${tripType === "roundtrip" ? "bg-[#dbe9ff] text-[#1e67d1]" : "text-gray-600"}`,
                children: "Round Trip"
              }
            )
          ] }) }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
            /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-black rounded-full mt-3 shrink-0" }),
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsx("p", { className: "text-black text-xs", children: "From (Area, Street or Landmark)" }),
              /* @__PURE__ */ jsx(
                "input",
                {
                  value: pickup,
                  onChange: (e) => setPickup(e.target.value),
                  placeholder: "Enter pickup location",
                  className: "text-black w-full mt-1 text-base font-bold placeholder-black border-b border-transparent focus:border-b focus:border-gray-200 outline-none py-1 bg-transparent"
                }
              )
            ] }),
            /* @__PURE__ */ jsx(
              "button",
              {
                type: "button",
                onClick: swapLocations,
                className: "p-2 rounded-full hover:bg-gray-100 transition-colors",
                title: "Swap locations",
                children: /* @__PURE__ */ jsx(
                  "svg",
                  {
                    className: "mt-8",
                    xmlns: "https://www.w3.org/2000/svg",
                    viewBox: "0 0 28 28",
                    fill: "#647a97",
                    width: "3.2rem",
                    height: "2.2rem",
                    children: /* @__PURE__ */ jsx(
                      "path",
                      {
                        d: "M28 14c0-7.732-6.268-14-14-14S0 6.268 0 14s6.268 14 14 14c7.729-.008 13.992-6.271 14-14zm-14.11-3.589c-.192.41-.604.672-1.057.672h-1.458a.292.292 0 00-.292.292v4.375a1.167 1.167 0 11-2.333 0v-4.375a.292.292 0 00-.292-.292H7a1.166 1.166 0 01-.896-1.913l2.917-3.5a1.166 1.166 0 011.793 0l2.916 3.5c.29.348.352.832.16 1.241zm.11 7.672c0-.644.522-1.166 1.167-1.166h1.458c.161 0 .292-.13.292-.292V12.25a1.167 1.167 0 112.333 0v4.375c0 .161.13.292.292.292H21a1.166 1.166 0 01.897 1.913l-2.916 3.5a1.168 1.168 0 01-1.794 0l-2.916-3.5a1.172 1.172 0 01-.271-.747z",
                        fill: "#647A97",
                        fillRule: "nonzero"
                      }
                    )
                  }
                )
              }
            )
          ] }),
          stops.map((s, idx) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
            /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-black rounded-full mt-3 shrink-0" }),
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsxs("p", { className: "text-gray-600 text-xs", children: [
                "Stop ",
                idx + 1
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    value: s,
                    onChange: (e) => updateStop(idx, e.target.value),
                    placeholder: `Enter stop ${idx + 1}`,
                    className: "w-full mt-1 text-base placeholder-gray-400 border-b border-transparent focus:border-b focus:border-gray-200 outline-none py-1 bg-transparent font-medium"
                  }
                ),
                /* @__PURE__ */ jsx(
                  "button",
                  {
                    type: "button",
                    onClick: () => removeStop(idx),
                    className: "text-sm text-gray-500 px-2 py-1 rounded hover:bg-gray-100",
                    title: "Remove stop",
                    children: "✕"
                  }
                )
              ] })
            ] })
          ] }, idx)),
          /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
            /* @__PURE__ */ jsx("div", { className: "w-2 h-2 bg-black rounded-full mt-3 shrink-0" }),
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-xs", children: "To (Area, Street or Landmark)" }),
              /* @__PURE__ */ jsx(
                "input",
                {
                  value: drop,
                  onChange: (e) => setDrop(e.target.value),
                  placeholder: "Enter drop location",
                  className: "w-full mt-1 text-base font-bold placeholder-black border-b border-transparent focus:border-b focus:border-gray-200 outline-none py-1 bg-transparent"
                }
              )
            ] }),
            /* @__PURE__ */ jsx("div", { className: "w-8" })
          ] }),
          /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", { type: "button", onClick: addStop, className: "text-[#1e67d1] font-semibold text-sm", children: "+ Add stop" }) }),
          /* @__PURE__ */ jsxs("div", { className: "flex gap-4 border-t pt-4 text-sm", children: [
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsx("p", { className: "text-gray-600", children: "Pickup Date/Time" }),
              /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "date",
                    value: pickupDate,
                    onChange: (e) => setPickupDate(e.target.value),
                    className: "w-full px-2 py-1 border rounded-md text-sm"
                  }
                ),
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "time",
                    value: pickupTime,
                    onChange: (e) => setPickupTime(e.target.value),
                    className: "w-full mt-2 px-2 py-1 border rounded-md text-sm"
                  }
                )
              ] })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsx("p", { className: "text-gray-600", children: "Drop Date/Time" }),
              tripType === "roundtrip" ? /* @__PURE__ */ jsxs("div", { className: "mt-1 text-right", children: [
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "date",
                    value: dropDate,
                    onChange: (e) => setDropDate(e.target.value),
                    className: "w-full px-2 py-1 border rounded-md text-sm"
                  }
                ),
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "time",
                    value: dropTime,
                    onChange: (e) => setDropTime(e.target.value),
                    className: "w-full mt-2 px-2 py-1 border rounded-md text-sm"
                  }
                )
              ] }) : /* @__PURE__ */ jsx("div", { className: "mt-1 text-right", children: /* @__PURE__ */ jsx("p", { className: "text-[#1e67d1] font-semibold", children: "Book roundtrip for maximum savings!" }) })
            ] })
          ] })
        ] }),
        tab === "airport" && /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-sm", children: "From (Airport or Pickup address)" }),
          /* @__PURE__ */ jsx(
            "input",
            {
              value: pickup,
              onChange: (e) => setPickup(e.target.value),
              placeholder: "Enter pickup location",
              className: "w-full mt-1 text-base font-bold placeholder-black border-b border-transparent focus:border-b focus:border-gray-200 outline-none py-1 bg-transparent"
            }
          ),
          /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-sm", children: "To (Airport or Drop address)" }),
          /* @__PURE__ */ jsx(
            "input",
            {
              value: drop,
              onChange: (e) => setDrop(e.target.value),
              placeholder: "Enter drop location",
              className: "w-full mt-1 text-base font-bold placeholder-black border-b border-transparent focus:border-b focus:border-gray-200 outline-none py-1 bg-transparent"
            }
          ),
          /* @__PURE__ */ jsx("div", { className: "flex justify-end -mt-10 pr-2", children: /* @__PURE__ */ jsx("button", { onClick: swapLocations, type: "button", className: "p-2 rounded-full hover:bg-gray-100", children: /* @__PURE__ */ jsx(
            "svg",
            {
              xmlns: "https://www.w3.org/2000/svg",
              viewBox: "0 0 28 28",
              fill: "#647a97",
              width: "1.2rem",
              height: "1.2rem",
              children: /* @__PURE__ */ jsx(
                "path",
                {
                  d: "M28 14c0-7.732-6.268-14-14-14S0 6.268 0 14s6.268 14 14 14c7.729-.008 13.992-6.271 14-14zm-14.11-3.589c-.192.41-.604.672-1.057.672h-1.458a.292.292 0 00-.292.292v4.375a1.167 1.167 0 11-2.333 0v-4.375a.292.292 0 00-.292-.292H7a1.166 1.166 0 01-.896-1.913l2.917-3.5a1.166 1.166 0 011.793 0l2.916 3.5c.29.348.352.832.16 1.241zm.11 7.672c0-.644.522-1.166 1.167-1.166h1.458c.161 0 .292-.13.292-.292V12.25a1.167 1.167 0 112.333 0v4.375c0 .161.13.292.292.292H21a1.166 1.166 0 01.897 1.913l-2.916 3.5a1.168 1.168 0 01-1.794 0l-2.916-3.5a1.172 1.172 0 01-.271-.747z",
                  fill: "#647A97",
                  fillRule: "nonzero"
                }
              )
            }
          ) }) }),
          /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
            /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-sm", children: "Pickup Date/Time" }),
            /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-1", children: [
              /* @__PURE__ */ jsx(
                "input",
                {
                  type: "date",
                  value: pickupDate,
                  onChange: (e) => setPickupDate(e.target.value),
                  className: "flex-1 px-2 py-1 border rounded-md text-sm"
                }
              ),
              /* @__PURE__ */ jsx(
                "input",
                {
                  type: "time",
                  value: pickupTime,
                  onChange: (e) => setPickupTime(e.target.value),
                  className: "flex-1 px-2 py-1 border rounded-md text-sm"
                }
              )
            ] })
          ] })
        ] }),
        tab === "hourly" && /* @__PURE__ */ jsxs(Fragment, { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-sm", children: "From (Area, Street or Landmark)" }),
          /* @__PURE__ */ jsx(
            "input",
            {
              value: pickup,
              onChange: (e) => setPickup(e.target.value),
              placeholder: "Enter pickup location",
              className: "w-full mt-1 text-base font-bold placeholder-black border-b border-transparent focus:border-b focus:border-gray-200 outline-none py-1 bg-transparent"
            }
          ),
          /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
            /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-sm", children: "Pickup date and time" }),
            /* @__PURE__ */ jsxs("div", { className: "flex gap-2 mt-1 items-center", children: [
              /* @__PURE__ */ jsx(
                "input",
                {
                  type: "date",
                  value: pickupDate,
                  onChange: (e) => setPickupDate(e.target.value),
                  className: "px-2 py-1 border rounded-md text-sm flex-1"
                }
              ),
              /* @__PURE__ */ jsx(
                "input",
                {
                  type: "time",
                  value: pickupTime,
                  onChange: (e) => setPickupTime(e.target.value),
                  className: "px-2 py-1 border rounded-md text-sm w-36"
                }
              )
            ] })
          ] }),
          /* @__PURE__ */ jsx("p", { className: "mt-4 text-sm text-gray-600", children: "Package Preference" }),
          /* @__PURE__ */ jsx("div", { className: "flex gap-2 mt-2 overflow-x-auto pb-2", children: hourlyOptions.map((opt) => {
            const selected = hourlyPackage === opt.id;
            return /* @__PURE__ */ jsxs(
              "button",
              {
                type: "button",
                onClick: () => setHourlyPackage(opt.id),
                className: `min-w-[84px] px-3 py-2 rounded-lg text-center text-sm font-semibold whitespace-nowrap ${selected ? "bg-[#dbe9ff] text-[#1e67d1]" : "bg-[#f1f7ff] text-[#1e67d1]"}`,
                children: [
                  /* @__PURE__ */ jsx("div", { children: opt.title }),
                  /* @__PURE__ */ jsx("div", { className: "text-xs font-medium mt-1", children: opt.sub })
                ]
              },
              opt.id
            );
          }) })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "flex justify-center mt-2", children: /* @__PURE__ */ jsx(
          "button",
          {
            type: "submit",
            disabled: isSearching,
            className: `bg-[#ff6600] absolute text-white font-semibold px-16 -mt-2 py-3 rounded-full shadow-md transform active:scale-95 ${isSearching ? "opacity-70" : ""}`,
            children: isSearching ? "SEARCHING..." : "SEARCH"
          }
        ) })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "bg-blue-100 mx-3 rounded-lg p-3 flex items-center justify-between mb-3 mt-12", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("h2", { className: "font-semibold text-sm text-gray-800", children: "Our Top Rated Partner" }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "India's Leading Outstation Cab Rentals Since 2006" })
        ] }),
        /* @__PURE__ */ jsx(
          "img",
          {
            src: "https://go-assets.ibcdn.com/u/GI/images/1751872285411-savari-banner-dweb.png",
            alt: "Savaari Partner",
            className: "h-6 w-auto"
          }
        )
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "bg-white mt-12 p-4 rounded-md shadow-sm", children: [
        /* @__PURE__ */ jsx("h3", { className: "font-semibold text-lg", children: "#SafeTravel" }),
        /* @__PURE__ */ jsx("div", { className: "mt-3 grid grid-cols-1 gap-3", children: /* @__PURE__ */ jsxs("div", { className: "border rounded p-3", children: [
          /* @__PURE__ */ jsx("h4", { className: "font-semibold", children: "Cabs with goSafe promise" }),
          /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mt-1", children: "Sanitized cabs, hand sanitizer, driver with mask & healthy status on Aarogya, and more." })
        ] }) })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-3 text-sm text-gray-700" })
    ] })
  ] });
};
const ResultsPageMobile = () => {
  var _a, _b;
  const location = distExports.useLocation();
  const navigate = distExports.useNavigate();
  const { searchResults, searchLoading, searchError } = useSelector(
    (state) => state.booking
  );
  const searchData = ((_a = location.state) == null ? void 0 : _a.searchData) || ((_b = location.state) == null ? void 0 : _b.searchParams) || {
    pickup: "Delhi, India",
    drop: "Chandigarh, India",
    tripType: "oneway",
    pickupDate: "13 Nov",
    pickupTime: "10:00 AM"
  };
  const transformApiCabs = (apiCabs) => {
    if (!apiCabs || apiCabs.length === 0) return [];
    return apiCabs.map((cab, index) => {
      var _a2, _b2, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
      return {
        id: cab.vehicleId || cab._id || index + 1,
        vehicleId: cab.vehicleId || cab._id,
        name: cab.vehicleName || cab.modelName || ((_a2 = cab.group) == null ? void 0 : _a2.groupName) || "Vehicle",
        type: `${(cab.category || ((_b2 = cab.group) == null ? void 0 : _b2.tier) || "Sedan").toUpperCase()} | ${cab.isAc !== false ? "AC" : "Non-AC"}`,
        passengers: cab.seats || ((_c = cab.group) == null ? void 0 : _c.seats) || 4,
        rating: cab.rating || 4.5,
        originalPrice: cab.originalPrice || Math.round((cab.finalPrice || ((_d = cab.fare) == null ? void 0 : _d.total) || 0) * 1.15),
        price: cab.finalPrice !== void 0 ? cab.finalPrice : ((_e = cab.fare) == null ? void 0 : _e.total) || 0,
        tax: Math.round((cab.finalPrice || ((_f = cab.fare) == null ? void 0 : _f.total) || 0) * 0.05),
        offer: Math.round((cab.finalPrice || ((_g = cab.fare) == null ? void 0 : _g.total) || 0) * 0.1),
        roofCarrier: cab.hasRoofCarrier ? 157 : 0,
        image: ((_h = cab.images) == null ? void 0 : _h.frontView) || ((_i = cab.images) == null ? void 0 : _i.insideView) || ((_k = (_j = cab.vehicleDetails) == null ? void 0 : _j.images) == null ? void 0 : _k.frontView) || ((_m = (_l = cab.group) == null ? void 0 : _l.vehicleImages) == null ? void 0 : _m.frontView) || "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png",
        // Store original data for booking
        _original: cab
      };
    });
  };
  const cabs = useMemo(() => {
    const apiCabs = searchResults.cabs || [];
    if (apiCabs.length > 0) {
      return transformApiCabs(apiCabs);
    }
    return [];
  }, [searchResults.cabs]);
  const routeInfo = searchResults.route || {};
  const handleCabSelect = (cab) => {
    var _a2, _b2, _c, _d, _e, _f, _g, _h;
    navigate(`/details-mobile/${cab.id}`, {
      state: {
        cab,
        searchData,
        // Pass coordinates and route info for booking
        picklat: searchData.sourceLat || ((_b2 = (_a2 = location.state) == null ? void 0 : _a2.searchParams) == null ? void 0 : _b2.sourceLat),
        picklng: searchData.sourceLong || ((_d = (_c = location.state) == null ? void 0 : _c.searchParams) == null ? void 0 : _d.sourceLong),
        droplat: searchData.destLat || ((_f = (_e = location.state) == null ? void 0 : _e.searchParams) == null ? void 0 : _f.destLat),
        droplng: searchData.destLong || ((_h = (_g = location.state) == null ? void 0 : _g.searchParams) == null ? void 0 : _h.destLong),
        distance: routeInfo.totalDistance || searchData.distance,
        tripType: searchData.tripType,
        pickupDate: searchData.pickupDate,
        pickupTime: searchData.pickupTime
      }
    });
  };
  const pickupDisplay = searchData.pickup || searchData.from || "Pickup";
  const dropDisplay = searchData.drop || searchData.to || "Drop";
  const tripTypeDisplay = searchData.tripType === "roundtrip" || searchData.tripType === "roundTrip" ? "Round Trip" : "One way";
  return /* @__PURE__ */ jsxs("div", { className: "w-full min-h-screen bg-[#f6f7fb] font-sans text-[#111827]", children: [
    /* @__PURE__ */ jsxs("div", { className: "sticky top-0 bg-white shadow-sm p-3 flex items-center justify-between", children: [
      /* @__PURE__ */ jsx("button", { onClick: () => navigate(-1), className: "text-black", children: /* @__PURE__ */ jsx(ArrowLeft, { size: 22 }) }),
      /* @__PURE__ */ jsxs("h1", { className: "font-semibold text-sm truncate max-w-[60%] text-center mr-10", children: [
        pickupDisplay == null ? void 0 : pickupDisplay.split(",")[0],
        " - ",
        dropDisplay == null ? void 0 : dropDisplay.split(",")[0]
      ] }),
      /* @__PURE__ */ jsx("button", { className: "text-[#1e67d1] text-sm" })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "text-center text-gray-600 text-xs mt-1 mb-2", children: [
      tripTypeDisplay,
      " |",
      " ",
      searchData.pickupDate,
      ", ",
      searchData.pickupTime
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-[#e8f1fd] mx-3 rounded-lg p-3 flex items-center justify-between mb-3", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("h2", { className: "font-semibold text-sm text-gray-800", children: "Our Top Rated Partner" }),
        /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: "India's Leading Outstation Cab Rentals Since 2006" })
      ] }),
      /* @__PURE__ */ jsx(
        "img",
        {
          src: "https://go-assets.ibcdn.com/u/GI/images/1751872285411-savari-banner-dweb.png",
          alt: "Savaari Partner",
          className: "h-6 w-auto"
        }
      )
    ] }),
    searchLoading && /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center py-20", children: [
      /* @__PURE__ */ jsx(Loader, { className: "w-10 h-10 text-[#1e67d1] animate-spin" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600 text-sm", children: "Searching available cabs..." })
    ] }),
    searchError && !searchLoading && /* @__PURE__ */ jsxs("div", { className: "mx-3 p-4 bg-red-50 rounded-lg text-center", children: [
      /* @__PURE__ */ jsx("p", { className: "text-red-600 font-medium", children: "Unable to fetch cabs" }),
      /* @__PURE__ */ jsx("p", { className: "text-red-500 text-sm mt-1", children: searchError }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => navigate(-1),
          className: "mt-3 px-4 py-2 bg-red-100 text-red-600 rounded-lg text-sm font-medium",
          children: "Go Back & Retry"
        }
      )
    ] }),
    !searchLoading && !searchError && cabs.length === 0 && /* @__PURE__ */ jsxs("div", { className: "mx-3 p-6 bg-white rounded-lg text-center", children: [
      /* @__PURE__ */ jsx("p", { className: "text-gray-600 font-medium", children: "No cabs available" }),
      /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-sm mt-1", children: "Try searching for a different route or date" }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => navigate(-1),
          className: "mt-4 px-6 py-2 bg-[#1e67d1] text-white rounded-lg text-sm font-medium",
          children: "Modify Search"
        }
      )
    ] }),
    !searchLoading && cabs.length > 0 && /* @__PURE__ */ jsx("div", { className: "px-3 pb-20", children: cabs.map((cab) => /* @__PURE__ */ jsxs(
      "div",
      {
        onClick: () => handleCabSelect(cab),
        className: "bg-white rounded-lg shadow-sm mb-3 overflow-hidden active:scale-[0.98] transition",
        children: [
          /* @__PURE__ */ jsxs("div", { className: "flex p-3", children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: cab.image,
                alt: cab.name,
                className: "w-20 h-12 object-contain mr-3"
              }
            ),
            /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
              /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
                /* @__PURE__ */ jsxs("h3", { className: "font-semibold text-sm text-gray-900", children: [
                  cab.name,
                  " ",
                  /* @__PURE__ */ jsx("span", { className: "text-gray-600", children: "Or Similar" })
                ] }),
                /* @__PURE__ */ jsxs("span", { className: "bg-[#e6f4ea] text-[#137333] px-2 py-0.5 text-[10px] font-bold rounded", children: [
                  cab.rating,
                  "/5"
                ] })
              ] }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mt-0.5", children: cab.type }),
              /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
                cab.passengers,
                " passengers allowed"
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center px-3 pb-2", children: [
            /* @__PURE__ */ jsx("div", {}),
            /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
              cab.originalPrice > cab.price && /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-400 line-through", children: [
                "₹",
                cab.originalPrice
              ] }),
              /* @__PURE__ */ jsxs("p", { className: "text-lg font-bold text-gray-900", children: [
                "₹",
                cab.price
              ] }),
              /* @__PURE__ */ jsxs("p", { className: "text-[10px] text-gray-500", children: [
                "+ ₹",
                cab.tax,
                " taxes & fees"
              ] })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between border-t px-3 py-2 text-xs", children: [
            /* @__PURE__ */ jsx("button", { className: "border border-[#1e67d1] text-[#1e67d1] rounded-full px-2 py-[2px] text-[10px] font-semibold", children: "🎟️ GOCAB" }),
            /* @__PURE__ */ jsxs("span", { className: "text-[#1e67d1] font-medium", children: [
              "Use code and get ₹",
              cab.offer,
              " off"
            ] })
          ] }),
          cab.roofCarrier > 0 && /* @__PURE__ */ jsxs("div", { className: "bg-[#e6f9ff] px-3 py-2 text-[11px] text-[#0088aa] font-medium border-t border-[#ccf4ff]", children: [
            "✨ Roof Carrier available with this car starting @ INR",
            " ",
            cab.roofCarrier
          ] })
        ]
      },
      cab.id
    )) })
  ] });
};
const CitiesMobile = () => {
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const { slug } = distExports.useParams();
  const {
    currentCityService,
    currentCityLoading,
    searchResults,
    searchLoading,
    searchError
  } = useSelector((state) => state.seo);
  const [from, setFrom] = useState("Delhi");
  const [to, setTo] = useState("");
  const [date, setDate] = useState("");
  const [time, setTime] = useState("10:00");
  const [selectedPackage, setSelectedPackage] = useState(0);
  useEffect(() => {
    const tomorrow = /* @__PURE__ */ new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);
    setDate(tomorrow.toISOString().split("T")[0]);
  }, []);
  useEffect(() => {
    if (slug) {
      dispatch(getCityServiceBySlug(slug));
    }
  }, [dispatch, slug]);
  useEffect(() => {
    const city2 = currentCityService;
    if (city2) {
      setFrom(city2.cityName || from);
    }
  }, [currentCityService]);
  useEffect(() => {
    if (slug && currentCityService) {
      dispatch(searchCityCabs({
        slug,
        params: {
          startTime: (/* @__PURE__ */ new Date()).toISOString(),
          isAc: true
        }
      }));
    }
  }, [dispatch, slug, currentCityService]);
  const city = currentCityService;
  const cabs = (searchResults == null ? void 0 : searchResults.cabs) || [];
  const vehicleOptions = (city == null ? void 0 : city.vehicleOptions) || [];
  const routesFrom = (city == null ? void 0 : city.popularRoutesFrom) || [];
  const routesTo = (city == null ? void 0 : city.popularRoutesTo) || [];
  const rentalPackages = (city == null ? void 0 : city.rentalPackages) || [
    { hours: 1, km: 10, price: 250 },
    { hours: 2, km: 20, price: 400 },
    { hours: 3, km: 30, price: 550 }
  ];
  const cityName = (city == null ? void 0 : city.cityName) || "Delhi";
  const handleSearch = () => {
    if (slug) {
      dispatch(searchCityCabs({
        slug,
        params: {
          startTime: (/* @__PURE__ */ new Date()).toISOString(),
          isAc: true
        }
      }));
    }
  };
  const handleSelectCab = (cab) => {
    var _a;
    const cityCoords = (city == null ? void 0 : city.coordinates) || { lat: 0, lng: 0 };
    const vehicleId = cab._id || cab.vehicleId || cab.groupId;
    navigate(`/details/${vehicleId}`, {
      state: {
        vehicleId,
        picklat: cityCoords.lat,
        picklng: cityCoords.lng,
        pickupAddress: from,
        pickupCity: cityName,
        droplat: cityCoords.lat,
        droplng: cityCoords.lng,
        dropAddress: to || cityName,
        dropCity: cityName,
        distance: ((_a = rentalPackages[selectedPackage]) == null ? void 0 : _a.km) || 10,
        tripType: "rental",
        fuelType: cab.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        vehicle: cab,
        rentalPackage: rentalPackages[selectedPackage]
      }
    });
  };
  const handleRouteClick = (route) => {
    if (route.slug) {
      navigate(`/top/${route.slug}`);
    }
  };
  if (currentCityLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-[#0d6efd] flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx(Loader, { className: "w-10 h-10 text-white animate-spin mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-white", children: "Loading city details..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#0d6efd] flex flex-col items-center pb-24", children: [
    /* @__PURE__ */ jsxs("div", { className: "w-full bg-[#0d6efd] px-4 py-5 space-y-4 text-white", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("label", { className: "block text-xs font-semibold mb-1 uppercase opacity-80", children: "From" }),
        /* @__PURE__ */ jsx(
          "input",
          {
            type: "text",
            value: from,
            onChange: (e) => setFrom(e.target.value),
            className: "w-full bg-white text-gray-900 px-3 py-2 rounded-md font-semibold outline-none"
          }
        )
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("label", { className: "block text-xs font-semibold mb-1 uppercase opacity-80", children: "To" }),
        /* @__PURE__ */ jsx(
          "input",
          {
            type: "text",
            placeholder: "Choose Drop Location",
            value: to,
            onChange: (e) => setTo(e.target.value),
            className: "w-full bg-white text-gray-900 px-3 py-2 rounded-md font-semibold placeholder-gray-500 outline-none"
          }
        )
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
          /* @__PURE__ */ jsx("label", { className: "block text-xs font-semibold mb-1 uppercase opacity-80", children: "Pickup Date" }),
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "date",
              value: date,
              onChange: (e) => setDate(e.target.value),
              className: "w-full bg-white text-gray-900 px-3 py-2 rounded-md outline-none"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
          /* @__PURE__ */ jsx("label", { className: "block text-xs font-semibold mb-1 uppercase opacity-80", children: "Pickup Time" }),
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "time",
              value: time,
              onChange: (e) => setTime(e.target.value),
              className: "w-full bg-white text-gray-900 px-3 py-2 rounded-md outline-none"
            }
          )
        ] })
      ] }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: handleSearch,
          className: "w-full bg-white text-[#0d6efd] font-semibold py-2 rounded-md mt-2 hover:bg-gray-100 transition",
          children: "UPDATE SEARCH"
        }
      )
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "w-full bg-gray-100 text-gray-900 px-4 py-5", children: [
      /* @__PURE__ */ jsxs("p", { className: "text-xs text-blue-700 font-semibold", children: [
        "Home > Cab Booking > ",
        cityName,
        " Cab Services"
      ] }),
      /* @__PURE__ */ jsxs("h2", { className: "text-lg font-bold mt-2", children: [
        cityName,
        " Taxi Services"
      ] }),
      /* @__PURE__ */ jsx("p", { className: "text-sm mt-2 text-gray-700 leading-snug", children: (city == null ? void 0 : city.description) || `Book a taxi service in ${cityName} for comfort & safety or enjoy worry-free full-day taxi. Book your taxi now.` }),
      /* @__PURE__ */ jsx(
        "a",
        {
          href: "#",
          className: "text-blue-700 text-sm font-semibold mt-2 inline-block",
          children: "Read More"
        }
      )
    ] }),
    routesFrom.length > 0 && /* @__PURE__ */ jsxs("div", { className: "w-full bg-white text-gray-900 px-4 py-5", children: [
      /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold mb-3", children: [
        "Top Cabs Routes from ",
        cityName
      ] }),
      routesFrom.map((route, index) => /* @__PURE__ */ jsx(
        "div",
        {
          onClick: () => handleRouteClick(route),
          className: "border-b border-gray-200 py-3 last:border-none cursor-pointer active:bg-gray-50",
          children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "font-semibold text-base", children: route.title || `${route.origin} to ${route.destination}` }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-0.5", children: [
                route.distance,
                " kms | ",
                route.duration
              ] }),
              /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold mt-1", children: route.included || `${route.distance} kms included` }),
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: route.extra || `Extra fare ₹12/km after ${route.distance} kms` })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
              /* @__PURE__ */ jsxs("p", { className: "text-[#111] font-bold text-lg", children: [
                "₹",
                route.price || route.startsFrom
              ] }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 -mt-1", children: "Onwards" }),
              /* @__PURE__ */ jsx("button", { className: "mt-2 bg-orange-500 text-white px-4 py-1 rounded-md text-sm font-semibold", children: "View Cabs" })
            ] })
          ] })
        },
        index
      ))
    ] }),
    routesTo.length > 0 && /* @__PURE__ */ jsxs("div", { className: "w-full bg-white text-gray-900 px-4 py-5 mt-4", children: [
      /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold mb-3", children: [
        "Top Cabs Routes to ",
        cityName
      ] }),
      routesTo.map((route, index) => /* @__PURE__ */ jsx(
        "div",
        {
          onClick: () => handleRouteClick(route),
          className: "border-b border-gray-200 py-3 last:border-none cursor-pointer active:bg-gray-50",
          children: /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "font-semibold text-base", children: route.title || `${route.origin} to ${route.destination}` }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-0.5", children: [
                route.distance,
                " kms | ",
                route.duration
              ] }),
              /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold mt-1", children: route.included || `${route.distance} kms included` }),
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: route.extra || `Extra fare ₹12/km after ${route.distance} kms` })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
              /* @__PURE__ */ jsxs("p", { className: "text-[#111] font-bold text-lg", children: [
                "₹",
                route.price || route.startsFrom
              ] }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 -mt-1", children: "Onwards" }),
              /* @__PURE__ */ jsx("button", { className: "mt-2 bg-orange-500 text-white px-4 py-1 rounded-md text-sm font-semibold", children: "View Cabs" })
            ] })
          ] })
        },
        index
      ))
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "w-full bg-white text-gray-900 px-4 py-5 mt-4", children: [
      /* @__PURE__ */ jsxs("h3", { className: "text-lg font-bold mb-4", children: [
        "Available Rental Cab in ",
        cityName
      ] }),
      /* @__PURE__ */ jsx("div", { className: "flex justify-around mb-4", children: rentalPackages.slice(0, 3).map((pkg, index) => /* @__PURE__ */ jsxs(
        "div",
        {
          onClick: () => setSelectedPackage(index),
          className: `text-center px-4 py-2 rounded-md cursor-pointer ${selectedPackage === index ? "bg-blue-600 text-white" : "border border-gray-300"}`,
          children: [
            /* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold", children: [
              pkg.hours,
              " hr (",
              pkg.km,
              " km)"
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-sm font-medium", children: [
              "₹",
              pkg.price
            ] })
          ]
        },
        index
      )) }),
      searchLoading ? /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
        /* @__PURE__ */ jsx(Loader, { className: "w-8 h-8 text-blue-600 animate-spin mx-auto" }),
        /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600 text-sm", children: "Searching available cabs..." })
      ] }) : searchError ? /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
        /* @__PURE__ */ jsx("p", { className: "text-red-600 font-medium", children: "Unable to fetch cabs" }),
        /* @__PURE__ */ jsx("p", { className: "text-red-500 text-sm mt-1", children: searchError })
      ] }) : cabs.length > 0 ? cabs.map((cab, index) => {
        var _a, _b, _c, _d, _e, _f, _g, _h;
        return /* @__PURE__ */ jsxs(
          "div",
          {
            onClick: () => handleSelectCab(cab),
            className: "border-t border-gray-200 py-4 flex justify-between items-start cursor-pointer active:bg-gray-50",
            children: [
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsxs("p", { className: "font-semibold text-base", children: [
                  cab.modelName || ((_a = cab.group) == null ? void 0 : _a.groupName) || "Standard",
                  " Or Similar"
                ] }),
                /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
                  ((_b = cab.group) == null ? void 0 : _b.tier) || "Standard",
                  " | AC | ",
                  ((_c = cab.group) == null ? void 0 : _c.seats) || cab.seats || 4,
                  " passengers allowed"
                ] }),
                /* @__PURE__ */ jsxs("ul", { className: "mt-2 text-sm text-gray-700 space-y-1", children: [
                  /* @__PURE__ */ jsxs("li", { children: [
                    "✓ ",
                    ((_d = rentalPackages[selectedPackage]) == null ? void 0 : _d.km) || 10,
                    " Kms included"
                  ] }),
                  /* @__PURE__ */ jsxs("li", { children: [
                    "✓ Extra Kms charges: ₹",
                    ((_g = (_f = (_e = cab.group) == null ? void 0 : _e.fuelPricing) == null ? void 0 : _f[0]) == null ? void 0 : _g.ratePerKmAc) || 13,
                    "/Km"
                  ] }),
                  /* @__PURE__ */ jsxs("li", { children: [
                    "✓ ",
                    ((_h = rentalPackages[selectedPackage]) == null ? void 0 : _h.hours) || 1,
                    "h 00m (appx.)"
                  ] })
                ] })
              ] }),
              /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx("button", { className: "bg-orange-500 text-white px-4 py-1 rounded-md text-sm font-semibold mt-2", children: "Book" }) })
            ]
          },
          cab._id || index
        );
      }) : vehicleOptions.length > 0 ? vehicleOptions.map((vehicle, index) => {
        var _a, _b;
        return /* @__PURE__ */ jsxs(
          "div",
          {
            onClick: () => handleSelectCab(vehicle),
            className: "border-t border-gray-200 py-4 flex justify-between items-start cursor-pointer active:bg-gray-50",
            children: [
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsxs("p", { className: "font-semibold text-base", children: [
                  vehicle.displayName || vehicle.groupName,
                  " Or Similar"
                ] }),
                /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
                  vehicle.category,
                  " | AC | ",
                  vehicle.seats || 4,
                  " passengers allowed"
                ] }),
                /* @__PURE__ */ jsxs("ul", { className: "mt-2 text-sm text-gray-700 space-y-1", children: [
                  /* @__PURE__ */ jsxs("li", { children: [
                    "✓ ",
                    ((_a = rentalPackages[selectedPackage]) == null ? void 0 : _a.km) || 10,
                    " Kms included"
                  ] }),
                  /* @__PURE__ */ jsxs("li", { children: [
                    "✓ Extra Kms charges: ₹",
                    vehicle.extraKmRate || 13,
                    "/Km"
                  ] }),
                  /* @__PURE__ */ jsxs("li", { children: [
                    "✓ ",
                    ((_b = rentalPackages[selectedPackage]) == null ? void 0 : _b.hours) || 1,
                    "h 00m (appx.)"
                  ] })
                ] })
              ] }),
              /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx("button", { className: "bg-orange-500 text-white px-4 py-1 rounded-md text-sm font-semibold mt-2", children: "Book" }) })
            ]
          },
          vehicle.groupId || index
        );
      }) : /* @__PURE__ */ jsx("div", { className: "text-center py-8", children: /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "No vehicles available." }) })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "fixed bottom-4 right-4 flex flex-col gap-3 items-end", children: [
      /* @__PURE__ */ jsxs(
        "a",
        {
          href: "https://wa.me/",
          target: "_blank",
          rel: "noopener noreferrer",
          className: "bg-green-500 text-white flex items-center gap-2 px-4 py-2 rounded-full shadow-lg text-sm font-semibold",
          children: [
            /* @__PURE__ */ jsx(FaWhatsapp, { className: "text-lg" }),
            " Chat with us"
          ]
        }
      ),
      /* @__PURE__ */ jsxs(
        "a",
        {
          href: "tel:+911234567890",
          className: "bg-blue-600 text-white flex items-center gap-2 px-4 py-2 rounded-full shadow-lg text-sm font-semibold",
          children: [
            /* @__PURE__ */ jsx(FaPhoneAlt, { className: "text-lg" }),
            " Call us now"
          ]
        }
      )
    ] })
  ] });
};
const formatDateDisplay = (date) => {
  const d = new Date(date);
  const options = { weekday: "short", day: "2-digit", month: "short", year: "2-digit" };
  return d.toLocaleDateString("en-GB", options).replace(",", "");
};
const AirportMobile = () => {
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const { slug } = distExports.useParams();
  const {
    currentAirportRoute,
    currentAirportLoading,
    searchResults,
    searchLoading,
    searchError
  } = useSelector((state) => state.seo);
  const [from, setFrom] = useState("Kempegowda International Airport");
  const [to, setTo] = useState("Bangalore");
  const [date, setDate] = useState("");
  const [time, setTime] = useState("10:00");
  const [tripType, setTripType] = useState("drop");
  const [readMoreOpen, setReadMoreOpen] = useState(false);
  useEffect(() => {
    const tomorrow = /* @__PURE__ */ new Date();
    tomorrow.setDate(tomorrow.getDate() + 1);
    setDate(tomorrow.toISOString().split("T")[0]);
  }, []);
  useEffect(() => {
    if (slug) {
      dispatch(getAirportRouteBySlug(slug));
    }
  }, [dispatch, slug]);
  useEffect(() => {
    const route2 = currentAirportRoute;
    if (route2) {
      setFrom(route2.airportName || route2.originCity || from);
      setTo(route2.cityName || route2.destinationCity || to);
    }
  }, [currentAirportRoute]);
  useEffect(() => {
    if (slug && currentAirportRoute) {
      dispatch(searchAirportCabs({
        slug,
        params: {
          startTime: (/* @__PURE__ */ new Date()).toISOString(),
          isAc: true
        }
      }));
    }
  }, [dispatch, slug, currentAirportRoute]);
  const route = currentAirportRoute;
  const cabs = (searchResults == null ? void 0 : searchResults.cabs) || [];
  const vehicleOptions = (route == null ? void 0 : route.vehicleOptions) || [];
  const handleUpdate = () => {
    if (slug) {
      dispatch(searchAirportCabs({
        slug,
        params: {
          startTime: (/* @__PURE__ */ new Date()).toISOString(),
          isAc: true
        }
      }));
    }
  };
  const handleSelectCab = (cab) => {
    const originCoords = (route == null ? void 0 : route.originCoords) || { lat: 0, lng: 0 };
    const destCoords = (route == null ? void 0 : route.destCoords) || { lat: 0, lng: 0 };
    const vehicleId = cab._id || cab.vehicleId || cab.groupId;
    navigate(`/details/${vehicleId}`, {
      state: {
        vehicleId,
        picklat: originCoords.lat,
        picklng: originCoords.lng,
        pickupAddress: from,
        pickupCity: (route == null ? void 0 : route.cityName) || to,
        droplat: destCoords.lat,
        droplng: destCoords.lng,
        dropAddress: to,
        dropCity: (route == null ? void 0 : route.cityName) || to,
        distance: (route == null ? void 0 : route.distance) || 0,
        tripType: "airport",
        fuelType: cab.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString(),
        vehicle: cab,
        route
      }
    });
  };
  (route == null ? void 0 : route.cityName) || "Bangalore";
  const airportName = (route == null ? void 0 : route.airportName) || "Bangalore Airport";
  if (currentAirportLoading) {
    return /* @__PURE__ */ jsx("div", { className: "min-h-screen bg-gray-50 flex items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
      /* @__PURE__ */ jsx(Loader, { className: "w-10 h-10 text-blue-600 animate-spin mx-auto" }),
      /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600", children: "Loading airport details..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-gray-50 text-gray-900", children: [
    /* @__PURE__ */ jsx("div", { className: "bg-blue-600 px-4 pt-6 pb-8", children: /* @__PURE__ */ jsx("div", { className: "max-w-3xl mx-auto", children: /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "text-xs text-white font-semibold tracking-wide", children: "FROM" }),
        /* @__PURE__ */ jsx("div", { className: "mt-2 bg-blue-700 rounded-2xl px-4 py-4", children: /* @__PURE__ */ jsx(
          "input",
          {
            value: from,
            onChange: (e) => setFrom(e.target.value),
            className: "w-full bg-transparent text-white font-bold text-lg outline-none"
          }
        ) })
      ] }),
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("p", { className: "text-xs text-white font-semibold tracking-wide", children: "TO" }),
        /* @__PURE__ */ jsx("div", { className: "mt-2 bg-blue-700 rounded-2xl px-4 py-4", children: /* @__PURE__ */ jsx(
          "input",
          {
            value: to,
            onChange: (e) => setTo(e.target.value),
            className: "w-full bg-transparent text-white font-bold text-lg outline-none"
          }
        ) })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex gap-3", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
          /* @__PURE__ */ jsx("p", { className: "text-xs text-white font-semibold tracking-wide", children: "PICKUP DATE" }),
          /* @__PURE__ */ jsxs("div", { className: "mt-2 bg-blue-700 rounded-2xl px-4 py-3", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "date",
                value: date,
                onChange: (e) => setDate(e.target.value),
                className: "w-full bg-transparent text-white font-semibold outline-none"
              }
            ),
            /* @__PURE__ */ jsx("div", { className: "mt-1 text-white font-bold", children: date ? formatDateDisplay(date) : "" })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
          /* @__PURE__ */ jsx("p", { className: "text-xs text-white font-semibold tracking-wide", children: "PICKUP TIME" }),
          /* @__PURE__ */ jsxs("div", { className: "mt-2 bg-blue-700 rounded-2xl px-4 py-3", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "time",
                value: time,
                onChange: (e) => setTime(e.target.value),
                className: "w-full bg-transparent text-white font-semibold outline-none"
              }
            ),
            /* @__PURE__ */ jsx("div", { className: "mt-1 text-white font-bold", children: time })
          ] })
        ] })
      ] }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: handleUpdate,
          className: "w-full mt-3 bg-white text-black font-bold py-3 rounded-xl shadow-lg",
          children: "UPDATE SEARCH"
        }
      )
    ] }) }) }),
    /* @__PURE__ */ jsxs("div", { className: "max-w-3xl mx-auto px-4 mt-6", children: [
      /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-t-xl pt-4 pb-4 px-4 shadow", children: [
        /* @__PURE__ */ jsxs("p", { className: "text-xs text-blue-600", children: [
          "Home > Cab Booking >",
          " ",
          /* @__PURE__ */ jsxs("span", { className: "text-black font-semibold", children: [
            airportName,
            " Cab Booking"
          ] })
        ] }),
        /* @__PURE__ */ jsxs("h1", { className: "text-2xl font-bold text-gray-900 mt-3", children: [
          "Book ",
          airportName,
          " Taxi & use ",
          /* @__PURE__ */ jsx("span", { className: "text-blue-600", children: "GOCAB" }),
          " for 10% off"
        ] }),
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-700 mt-3 leading-relaxed", children: (route == null ? void 0 : route.description) || `Book sanitized ${airportName} taxi services for a hassle-free experience. Book all types of cabs and other taxi services like Airport transfer, Railway transfer with top car operators.` }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => setReadMoreOpen((s) => !s),
            className: "text-blue-600 text-sm font-semibold mt-3",
            children: readMoreOpen ? "Show Less" : "Read More"
          }
        ),
        readMoreOpen && /* @__PURE__ */ jsx("div", { className: "mt-3 text-sm text-gray-700", children: /* @__PURE__ */ jsx("p", { children: (route == null ? void 0 : route.longDescription) || "We partner with trusted operators to provide clean vehicles, trained drivers and transparent fares. Choose the car that fits your group and luggage." }) })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-b-xl px-4 py-4 shadow mb-6", children: [
        /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-3", children: "Select trip type to update price, included kms & extra fare" }),
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6", children: [
          /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-3 cursor-pointer", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "radio",
                name: "tripType",
                checked: tripType === "drop",
                onChange: () => setTripType("drop"),
                className: "accent-blue-600 w-4 h-4"
              }
            ),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: "Airport Drop" }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Drop passenger to airport" })
            ] })
          ] }),
          /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-3 cursor-pointer", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "radio",
                name: "tripType",
                checked: tripType === "pickup",
                onChange: () => setTripType("pickup"),
                className: "accent-blue-600 w-4 h-4"
              }
            ),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: "Airport Pickup" }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Pickup passenger from airport" })
            ] })
          ] })
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl px-4 py-4 shadow mb-6", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold text-gray-900 mb-4", children: "Available Cabs" }),
        searchLoading ? /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
          /* @__PURE__ */ jsx(Loader, { className: "w-8 h-8 text-blue-600 animate-spin mx-auto" }),
          /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-600 text-sm", children: "Searching available cabs..." })
        ] }) : searchError ? /* @__PURE__ */ jsxs("div", { className: "text-center py-8", children: [
          /* @__PURE__ */ jsx("p", { className: "text-red-600 font-medium", children: "Unable to fetch cabs" }),
          /* @__PURE__ */ jsx("p", { className: "text-red-500 text-sm mt-1", children: searchError })
        ] }) : cabs.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: cabs.map((cab, i) => {
          var _a, _b, _c, _d, _e, _f, _g;
          return /* @__PURE__ */ jsxs(
            "div",
            {
              onClick: () => handleSelectCab(cab),
              className: "flex items-center justify-between p-3 border rounded-lg active:scale-[0.98] transition cursor-pointer",
              children: [
                /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
                  /* @__PURE__ */ jsx(
                    "img",
                    {
                      src: ((_b = (_a = cab.group) == null ? void 0 : _a.vehicleImages) == null ? void 0 : _b.frontView) || cab.image || "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png",
                      alt: cab.modelName || ((_c = cab.group) == null ? void 0 : _c.groupName),
                      className: "w-16 h-10 object-contain"
                    }
                  ),
                  /* @__PURE__ */ jsxs("div", { children: [
                    /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm", children: cab.modelName || ((_d = cab.group) == null ? void 0 : _d.groupName) || "Standard" }),
                    /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
                      ((_e = cab.group) == null ? void 0 : _e.tier) || "Standard",
                      " • ",
                      ((_f = cab.group) == null ? void 0 : _f.seats) || cab.seats || 4,
                      " seats"
                    ] })
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                  /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
                    "₹",
                    ((_g = cab.fare) == null ? void 0 : _g.total) || cab.price || 0
                  ] }),
                  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: "+ taxes" })
                ] })
              ]
            },
            cab._id || i
          );
        }) }) : vehicleOptions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: vehicleOptions.map((vehicle, i) => /* @__PURE__ */ jsxs(
          "div",
          {
            onClick: () => handleSelectCab(vehicle),
            className: "flex items-center justify-between p-3 border rounded-lg active:scale-[0.98] transition cursor-pointer",
            children: [
              /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
                /* @__PURE__ */ jsx(
                  "img",
                  {
                    src: vehicle.image || "https://gos3.ibcdn.com/sedan_v_2_copy_2-1576142484.png",
                    alt: vehicle.groupName,
                    className: "w-16 h-10 object-contain"
                  }
                ),
                /* @__PURE__ */ jsxs("div", { children: [
                  /* @__PURE__ */ jsx("p", { className: "font-semibold text-sm", children: vehicle.displayName || vehicle.groupName }),
                  /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
                    vehicle.category,
                    " • ",
                    vehicle.seats || 4,
                    " seats"
                  ] })
                ] })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
                  "₹",
                  vehicle.price || 0
                ] }),
                /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400", children: "+ taxes" })
              ] })
            ]
          },
          vehicle.groupId || i
        )) }) : /* @__PURE__ */ jsx("div", { className: "text-center py-8", children: /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: "No vehicles available." }) })
      ] }),
      (route == null ? void 0 : route.faqs) && route.faqs.length > 0 && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl px-4 py-6 shadow mb-10", children: [
        /* @__PURE__ */ jsxs("h2", { className: "text-xl font-bold text-gray-900 mb-4", children: [
          "FAQs About ",
          airportName,
          " Cabs Services"
        ] }),
        route.faqs.map((faq2, i) => /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
          /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-900", children: [
            "Q. ",
            faq2.question
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "text-gray-700 mt-1", children: [
            "A. ",
            faq2.answer
          ] })
        ] }, i))
      ] }),
      (route == null ? void 0 : route.reviews) && route.reviews.length > 0 && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl px-4 py-4 shadow mb-8", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-xl font-bold text-gray-900 mb-4", children: "Customer reviews" }),
        route.reviews.slice(0, 2).map((review, i) => /* @__PURE__ */ jsxs("div", { className: "flex gap-3 mb-6", children: [
          /* @__PURE__ */ jsx("div", { className: "w-10 h-10 bg-gray-300 rounded-full" }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
              /* @__PURE__ */ jsx("p", { className: "font-semibold", children: review.userName || "Customer" }),
              /* @__PURE__ */ jsxs("span", { className: "bg-green-600 text-white px-2 py-1 rounded text-xs font-bold", children: [
                review.rating || 5,
                " / 5"
              ] })
            ] }),
            /* @__PURE__ */ jsx("p", { className: "text-gray-700 mt-1", children: review.comment || "Great service!" }),
            /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-1", children: [
              "Travelled in ",
              review.cabType || "sedan"
            ] })
          ] })
        ] }, i)),
        /* @__PURE__ */ jsx("button", { className: "text-blue-600 text-sm font-semibold", children: "View More" })
      ] })
    ] })
  ] });
};
const ResultDetailMobile = () => {
  var _a, _b, _c, _d, _e, _f;
  const navigate = distExports.useNavigate();
  const location = distExports.useLocation();
  const cab = (_a = location.state) == null ? void 0 : _a.cab;
  const searchData = ((_b = location.state) == null ? void 0 : _b.searchData) || {};
  const { isAuthenticated, user } = useSelector((state) => state.auth);
  if (!cab) {
    return /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsx("button", { onClick: () => navigate(-1), className: "mb-2", children: /* @__PURE__ */ jsx(ArrowLeft, {}) }),
      /* @__PURE__ */ jsx("p", { children: "No cab data found." })
    ] });
  }
  const originalCab = cab._original || cab;
  const cabName = cab.name || originalCab.vehicleName || originalCab.modelName || "Vehicle";
  const cabType = cab.type || `${originalCab.category || "Sedan"} | ${originalCab.isAc !== false ? "AC" : "Non-AC"}`;
  const passengers = cab.passengers || originalCab.seats || 4;
  const price = cab.price || ((_c = originalCab.fare) == null ? void 0 : _c.total) || originalCab.finalPrice || 0;
  const originalPrice = cab.originalPrice || Math.round(price * 1.15);
  const fuelType = originalCab.fuelType || "CNG/Diesel";
  const includedKm = originalCab.includedKm || searchData.distance || 300;
  const extraKmRate = originalCab.extraKmRate || ((_f = (_e = (_d = originalCab.group) == null ? void 0 : _d.fuelPricing) == null ? void 0 : _e[0]) == null ? void 0 : _f.ratePerKmAc) || 15;
  const tripType = searchData.tripType === "roundtrip" || searchData.tripType === "roundTrip" ? "Round trip" : "One-way trip";
  searchData.pickup || searchData.from || "Pickup Location";
  searchData.drop || searchData.to || "Drop Location";
  const pickupDate = searchData.pickupDate || "15 Nov";
  const pickupTime = searchData.pickupTime || "10:00 AM";
  const formatDate = (dateStr) => {
    if (dateStr.includes("-")) {
      const date = new Date(dateStr);
      return date.toLocaleDateString("en-IN", { day: "2-digit", month: "short", year: "numeric" });
    }
    return dateStr;
  };
  const cancellationTime = `${pickupDate} 9:00 am`;
  const carImages = useMemo(() => {
    var _a2, _b2;
    const images = [];
    const cabImages = originalCab.images || ((_a2 = originalCab.vehicleDetails) == null ? void 0 : _a2.images) || ((_b2 = originalCab.group) == null ? void 0 : _b2.vehicleImages) || {};
    if (cabImages.frontView) images.push(cabImages.frontView);
    if (cabImages.sideView) images.push(cabImages.sideView);
    if (cabImages.insideView) images.push(cabImages.insideView);
    if (cabImages.backView) images.push(cabImages.backView);
    if (cabImages.bootSpace) images.push(cabImages.bootSpace);
    if (images.length === 0) {
      return [
        cab.image || "https://go-assets.ibcdn.com/u/MMT/images/1732607472482-hatchback_Unknown_Unknown_EXTERIOR_Front_view_.jpeg",
        "https://go-assets.ibcdn.com/u/MMT/images/1732607474462-hatchback_Unknown_Unknown_EXTERIOR_Side_View.jpeg",
        "https://go-assets.ibcdn.com/u/MMT/images/1732607476045-hatchback_Unknown_Unknown_INTERIOR_Dashboard,_leg_space_in_front_seat.jpeg",
        "https://go-assets.ibcdn.com/u/MMT/images/1732607478924-hatchback_Unknown_Unknown_INTERIOR_Ample_leg_space_in_back_seat.jpeg",
        "https://go-assets.ibcdn.com/u/MMT/images/1732607480576-hatchback_Unknown_Unknown_BOOT_Sufficient_boot_space_for_2_bags.jpeg"
      ];
    }
    return images;
  }, [cab, originalCab]);
  const reserveAmount = Math.round(price * 0.2);
  const handleContinue = () => {
    var _a2, _b2, _c2, _d2, _e2;
    navigate("/search-details-mobile", {
      state: {
        cab,
        searchData,
        picklat: (_a2 = location.state) == null ? void 0 : _a2.picklat,
        picklng: (_b2 = location.state) == null ? void 0 : _b2.picklng,
        droplat: (_c2 = location.state) == null ? void 0 : _c2.droplat,
        droplng: (_d2 = location.state) == null ? void 0 : _d2.droplng,
        distance: (_e2 = location.state) == null ? void 0 : _e2.distance,
        tripType: searchData.tripType,
        pickupDate,
        pickupTime
      }
    });
  };
  return /* @__PURE__ */ jsxs("div", { className: "w-full min-h-screen bg-white pb-24", children: [
    /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 p-3 border-b text-black", children: [
      /* @__PURE__ */ jsx(ArrowLeft, { size: 22, onClick: () => navigate(-1), className: "cursor-pointer" }),
      /* @__PURE__ */ jsxs("div", { className: "leading-tight", children: [
        /* @__PURE__ */ jsxs("p", { className: "font-semibold text-[17px] text-black", children: [
          cabName,
          " - ",
          cabType
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
          tripType,
          " | ",
          formatDate(pickupDate),
          ", ",
          pickupTime
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 mt-3", children: [
      /* @__PURE__ */ jsxs("h2", { className: "text-xl font-semibold text-black", children: [
        cabName,
        " Or Similar"
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-gray-500 text-sm", children: [
        cabType,
        " | ",
        passengers,
        " passengers allowed"
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "flex overflow-x-auto gap-3 px-4 mt-3 snap-x snap-mandatory", children: carImages.map((img, index) => /* @__PURE__ */ jsx(
      "div",
      {
        className: "min-w-[200px] max-w-[200px] h-[140px] rounded-md overflow-hidden snap-center bg-gray-200",
        children: /* @__PURE__ */ jsx("img", { src: img, alt: `car-${index}`, className: "w-full h-full object-cover" })
      },
      index
    )) }),
    /* @__PURE__ */ jsx("div", { className: "bg-yellow-50 text-yellow-700 px-4 py-3 mt-3 text-sm", children: "Car images shown here are for representation purpose only." }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 mt-5", children: [
      /* @__PURE__ */ jsx("h3", { className: "text-gray-400 text-sm font-semibold", children: "Cancellation Policy" }),
      /* @__PURE__ */ jsx("div", { className: "mt-1 bg-white border rounded-lg p-3", children: /* @__PURE__ */ jsxs("p", { className: "text-[15px] font-semibold text-black", children: [
        "Full refund, till ",
        cancellationTime
      ] }) })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "px-4 mt-5", children: /* @__PURE__ */ jsxs("div", { className: "bg-[#f4f8ff] rounded-xl p-4 border", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-center", children: [
        /* @__PURE__ */ jsx(
          "img",
          {
            src: "https://cdn-icons-png.flaticon.com/512/2967/2967350.png",
            alt: "driver",
            className: "w-12 h-12"
          }
        ),
        /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("h3", { className: "text-[16px] font-semibold text-black", children: "Cab & Driver details" }) })
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "mt-3 text-[14px] leading-5 text-gray-700", children: [
        /* @__PURE__ */ jsx("span", { className: "font-semibold text-black", children: "Cab operator" }),
        " will be assigned as soon as booking is complete. Your ",
        /* @__PURE__ */ jsx("span", { className: "font-semibold text-black", children: "cab and driver" }),
        " details will be shared via",
        /* @__PURE__ */ jsx("span", { className: "font-semibold", children: " Whatsapp & SMS " }),
        "on your registered mobile number by"
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "mt-2 font-semibold text-black text-[15px]", children: [
        formatDate(pickupDate),
        " at 9:30 am"
      ] })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 mt-5", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsx("h3", { className: "text-[16px] font-semibold text-black", children: "Passenger and Luggage info" }),
        /* @__PURE__ */ jsx("button", { className: "text-[#1e67d1] font-semibold text-sm", children: "View details ➜" })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "mt-4 bg-white p-4 rounded-xl border", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex gap-3 items-center", children: [
          /* @__PURE__ */ jsx(
            "img",
            {
              src: "https://cdn-icons-png.flaticon.com/512/1077/1077012.png",
              className: "w-5 h-5",
              alt: "passengers"
            }
          ),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("p", { className: "font-semibold text-black text-sm", children: [
              "Up to ",
              passengers,
              " passengers"
            ] }),
            /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-xs", children: "Allowed as per govt guidelines" })
          ] })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "h-[1px] bg-gray-200 my-4" }),
        /* @__PURE__ */ jsxs("div", { className: "flex justify-around text-center", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://cdn-icons-png.flaticon.com/512/3103/3103461.png",
                className: "w-6 h-6 mx-auto",
                alt: "luggage"
              }
            ),
            /* @__PURE__ */ jsx("p", { className: "font-semibold text-black text-sm mt-1", children: "1 large bag" }),
            /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: '(30"x19"x11")' })
          ] }),
          /* @__PURE__ */ jsx("p", { className: "font-semibold text-gray-500 text-sm mt-5", children: "OR" }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx(
              "img",
              {
                src: "https://cdn-icons-png.flaticon.com/512/7756/7756464.png",
                className: "w-6 h-6 mx-auto",
                alt: "small bags"
              }
            ),
            /* @__PURE__ */ jsx("p", { className: "font-semibold text-black text-sm mt-1", children: "2 small bags" }),
            /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: '(19"x13"x7")' })
          ] })
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 mt-5", children: [
      /* @__PURE__ */ jsx("h3", { className: "font-semibold text-black text-[16px]", children: "Important Information" }),
      /* @__PURE__ */ jsxs("div", { className: "bg-green-100 text-green-700 px-4 py-2 mt-3 rounded-lg text-sm", children: [
        "Reserve this cab @₹",
        reserveAmount,
        " in next screen"
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 mt-4 text-sm space-y-2", children: [
      /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-black", children: [
        /* @__PURE__ */ jsx("span", { className: "text-green-600 text-lg", children: "✔" }),
        "Free waiting upto 45 minutes"
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 text-black", children: [
        /* @__PURE__ */ jsx("span", { className: "text-green-600 text-lg", children: "✔" }),
        "Free cancellation until 1 hour before pickup"
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 mt-5", children: [
      /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-800 text-lg", children: [
        "Fuel Type: ",
        /* @__PURE__ */ jsx("span", { className: "font-normal", children: fuelType })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex gap-4 mt-3", children: [
        /* @__PURE__ */ jsxs("div", { className: "w-1/2 border rounded-xl p-4", children: [
          /* @__PURE__ */ jsx("p", { className: "font-semibold text-gray-800 mb-2", children: "Petrol" }),
          /* @__PURE__ */ jsxs("ul", { className: "text-sm text-gray-600 space-y-1", children: [
            /* @__PURE__ */ jsx("li", { children: "✔ Better luggage capacity" }),
            /* @__PURE__ */ jsx("li", { children: "✔ Stronger AC" })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "w-1/2 border-2 border-green-600 rounded-xl p-4 bg-green-50", children: [
          /* @__PURE__ */ jsx("p", { className: "font-semibold text-gray-800 mb-2", children: fuelType }),
          /* @__PURE__ */ jsx("ul", { className: "text-sm text-gray-600 space-y-1", children: /* @__PURE__ */ jsx("li", { children: "✔ Based on availability" }) })
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "px-4 mt-5", children: /* @__PURE__ */ jsx("div", { className: "bg-gray-50 rounded-lg p-3 text-sm", children: /* @__PURE__ */ jsxs("p", { className: "text-gray-700", children: [
      /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Extra Kms Charges:" }),
      " ₹",
      extraKmRate,
      "/Km after ",
      includedKm,
      " Kms"
    ] }) }) }),
    /* @__PURE__ */ jsxs("div", { className: "bg-green-100 text-green-700 px-4 py-3 mt-5 text-center text-sm", children: [
      "Reserve this cab @₹",
      reserveAmount,
      " in next screen"
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "fixed bottom-0 left-0 w-full bg-white border-t px-4 py-3 flex justify-between items-center", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsxs("p", { className: "text-lg font-semibold", children: [
          originalPrice > price && /* @__PURE__ */ jsxs("span", { className: "line-through text-gray-400 mr-2 text-sm", children: [
            "₹",
            originalPrice
          ] }),
          "₹",
          price
        ] }),
        /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "+ taxes & fees" })
      ] }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: handleContinue,
          className: "bg-orange-600 text-white px-6 py-2 rounded-lg text-lg shadow",
          children: "Continue"
        }
      )
    ] })
  ] });
};
function SearchDetailMobile() {
  var _a, _b, _c, _d, _e, _f;
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const location = distExports.useLocation();
  const cab = (_a = location.state) == null ? void 0 : _a.cab;
  const searchData = ((_b = location.state) == null ? void 0 : _b.searchData) || {};
  const { user, isAuthenticated } = useSelector((state) => state.auth);
  const {
    bookingReview,
    reviewLoading,
    reviewError,
    createLoading,
    createSuccess,
    createError,
    currentBooking
  } = useSelector((state) => state.booking);
  const [selectedOffer, setSelectedOffer] = useState(null);
  const [roofCarrier, setRoofCarrier] = useState(false);
  const [gender, setGender] = useState("male");
  const [paymentType, setPaymentType] = useState("partial");
  const originalCab = (cab == null ? void 0 : cab._original) || cab || {};
  useEffect(() => {
    var _a2, _b2, _c2, _d2, _e2;
    if (originalCab.vehicleId || originalCab._id) {
      const vehicleId = originalCab.vehicleId || originalCab._id || (cab == null ? void 0 : cab.vehicleId) || (cab == null ? void 0 : cab.id);
      dispatch(getBookingReview({
        vehicleId,
        picklat: (_a2 = location.state) == null ? void 0 : _a2.picklat,
        picklng: (_b2 = location.state) == null ? void 0 : _b2.picklng,
        pickupAddress: searchData.pickup || searchData.from,
        droplat: (_c2 = location.state) == null ? void 0 : _c2.droplat,
        droplng: (_d2 = location.state) == null ? void 0 : _d2.droplng,
        dropAddress: searchData.drop || searchData.to,
        distance: ((_e2 = location.state) == null ? void 0 : _e2.distance) || searchData.distance || 100,
        tripType: searchData.tripType === "roundtrip" ? "roundTrip" : "oneWay",
        fuelType: originalCab.fuelType || "petrol",
        isAc: true,
        scheduledTime: (/* @__PURE__ */ new Date()).toISOString()
      }));
    }
  }, [dispatch, originalCab, location.state, searchData]);
  const loadRazorpay = () => {
    return new Promise((resolve) => {
      const script = document.createElement("script");
      script.src = "https://checkout.razorpay.com/v1/checkout.js";
      script.onload = () => resolve(true);
      script.onerror = () => resolve(false);
      document.body.appendChild(script);
    });
  };
  useEffect(() => {
    if (createError) {
      toast$2.error(createError);
    }
  }, [createError]);
  const review = bookingReview || {};
  const fareBreakdown = review.fareBreakdown || {};
  const cabName = (cab == null ? void 0 : cab.name) || originalCab.vehicleName || originalCab.modelName || review.vehicleName || "Vehicle";
  const cabType = (cab == null ? void 0 : cab.type) || `${originalCab.category || review.category || "SUV"} | AC | ${originalCab.seats || review.seats || 6} passengers allowed`;
  const fuelType = originalCab.fuelType || review.fuelType || "CNG";
  const includedKm = review.includedKm || originalCab.includedKm || searchData.distance || 300;
  const extraKmRate = review.extraKmRate || originalCab.extraKmRate || 26;
  const baseFare = fareBreakdown.baseFare || (cab == null ? void 0 : cab.price) || ((_c = originalCab.fare) == null ? void 0 : _c.total) || 5e3;
  const taxes = fareBreakdown.taxes || Math.round(baseFare * 0.05) || 0;
  const totalFare = fareBreakdown.total || review.totalFare || baseFare + taxes;
  const advancePayment = review.advancePayment || Math.round(totalFare * 0.25);
  const roofCarrierPrice = review.roofCarrierPrice || 315;
  const tripType = searchData.tripType === "roundtrip" || searchData.tripType === "roundTrip" ? "Round trip" : "One-way trip";
  const pickupLocation = searchData.pickup || searchData.from || "Pickup Location";
  const dropLocation = searchData.drop || searchData.to || "Drop Location";
  const pickupDate = searchData.pickupDate || ((_d = location.state) == null ? void 0 : _d.pickupDate) || "15 Nov";
  const pickupTime = searchData.pickupTime || ((_e = location.state) == null ? void 0 : _e.pickupTime) || "10:00 AM";
  const formatDate = (dateStr) => {
    if (dateStr.includes("-")) {
      const date = new Date(dateStr);
      return date.toLocaleDateString("en-IN", { day: "2-digit", month: "short", year: "numeric" });
    }
    return dateStr;
  };
  const getCancellationPolicyText = () => {
    if (!review.cancellationPolicy) {
      return `Full refund, till ${formatDate(pickupDate)} 9:00am`;
    }
    if (typeof review.cancellationPolicy === "object") {
      return review.cancellationPolicy.summary || review.cancellationPolicy.description || "Free cancellation available";
    }
    return review.cancellationPolicy;
  };
  const cancellationPolicy = getCancellationPolicyText();
  const defaultOffers = [
    {
      code: "GOCAB",
      description: "Use GOCAB and get Rs. 500 off on cab bookings."
    },
    {
      code: "GOCABNEW",
      description: "Get flat Rs. 300 off on your first cab booking!"
    },
    {
      code: "CABOFFER",
      description: "Get up-to Rs.200 Off on Outstation Cab transactions"
    }
  ];
  const rawOffers = review.availableOffers || defaultOffers;
  const offers = Array.isArray(rawOffers) ? rawOffers.map((offer) => {
    var _a2, _b2;
    return {
      code: typeof offer.code === "string" ? offer.code : String(offer.code || "OFFER"),
      description: typeof offer.description === "string" ? offer.description : typeof offer.description === "object" ? ((_a2 = offer.description) == null ? void 0 : _a2.summary) || ((_b2 = offer.description) == null ? void 0 : _b2.text) || "Get special discount!" : String(offer.description || "Get special discount!")
    };
  }) : defaultOffers;
  const handlePayAndConfirm = async () => {
    var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
    if (!isAuthenticated) {
      toast$2.error("Please login to continue with booking");
      return;
    }
    const vehicleId = originalCab.vehicleId || originalCab._id || (cab == null ? void 0 : cab.vehicleId) || (cab == null ? void 0 : cab.id);
    const groupId = ((_a2 = location.state) == null ? void 0 : _a2.groupId) || originalCab.groupId;
    const modelId = ((_b2 = location.state) == null ? void 0 : _b2.modelId) || originalCab.modelId;
    const zoneId = ((_c2 = location.state) == null ? void 0 : _c2.zoneId) || ((_d2 = originalCab.zone) == null ? void 0 : _d2.id);
    const bookingData = {
      pickupLocation: {
        address: pickupLocation,
        coordinates: [((_e2 = location.state) == null ? void 0 : _e2.picklng) || 0, ((_f2 = location.state) == null ? void 0 : _f2.picklat) || 0]
      },
      dropLocation: {
        address: dropLocation,
        coordinates: [((_g = location.state) == null ? void 0 : _g.droplng) || 0, ((_h = location.state) == null ? void 0 : _h.droplat) || 0]
      },
      // NEW: Pass groupId and modelId for new booking system
      groupId,
      modelId,
      vehicleId: vehicleId || void 0,
      // Optional for backward compatibility
      zoneId,
      tripType: searchData.tripType === "roundtrip" ? "roundTrip" : "oneWay",
      pickupDate: searchData.pickupDate || pickupDate,
      pickupTime: searchData.pickupTime || pickupTime,
      distance: ((_i = location.state) == null ? void 0 : _i.distance) || searchData.distance || 100,
      paymentMode: "online",
      fuelType: fuelType.toLowerCase(),
      isAc: true,
      // Calculate duration roughly (Assuming 60km/h average speed), send as Number (hours)
      duration: Math.round((((_j = location.state) == null ? void 0 : _j.distance) || searchData.distance || 100) / 60)
    };
    if (searchData.tripType === "roundtrip" && searchData.dropDate) {
      bookingData.returnDate = searchData.dropDate;
      bookingData.returnTime = searchData.dropTime;
    }
    if (selectedOffer) {
      bookingData.promoCode = selectedOffer;
    }
    try {
      const bookingAction = await dispatch(createBooking(bookingData)).unwrap();
      const bookingId = ((_k = bookingAction.data) == null ? void 0 : _k._id) || ((_l = bookingAction.data) == null ? void 0 : _l.id);
      if (!bookingId) {
        throw new Error("Booking creation failed - ID missing");
      }
      console.log("Booking created:", bookingId);
      toast$2.success("Booking created. Initiating payment...");
      const isScriptLoaded = await loadRazorpay();
      if (!isScriptLoaded) {
        toast$2.error("Razorpay SDK failed to load. Are you online?");
        return;
      }
      const finalTotalFare = totalFare + (roofCarrier ? roofCarrierPrice : 0);
      const payAmount = paymentType === "partial" ? advancePayment : finalTotalFare;
      const orderAction = await dispatch(createPaymentOrder({
        bookingId,
        amount: payAmount,
        paymentType
      })).unwrap();
      const { data: orderData } = orderAction;
      console.log("Payment order created:", orderData);
      const options = {
        key: orderData.keyId,
        amount: orderData.amount,
        currency: orderData.currency,
        name: "Cab Booking",
        description: `Booking for ${cabName}`,
        order_id: orderData.orderId,
        handler: async function(response) {
          try {
            toast$2.loading("Verifying payment...");
            await dispatch(verifyPayment({
              razorpay_order_id: response.razorpay_order_id,
              razorpay_payment_id: response.razorpay_payment_id,
              razorpay_signature: response.razorpay_signature
            })).unwrap();
            toast$2.dismiss();
            toast$2.success("Payment successful!");
            dispatch(resetCreateBooking());
            navigate(`/booking/${bookingId}`, { replace: true });
          } catch (verifyError) {
            console.error("Verification failed:", verifyError);
            toast$2.error("Payment verification failed. Please contact support.");
          }
        },
        prefill: {
          name: user == null ? void 0 : user.name,
          email: user == null ? void 0 : user.email,
          contact: user == null ? void 0 : user.phone
        },
        theme: {
          color: "#ea580c"
        },
        modal: {
          ondismiss: function() {
            toast$2.error("Payment cancelled");
          }
        }
      };
      const rzp1 = new window.Razorpay(options);
      rzp1.open();
    } catch (error) {
      console.error("Booking process failed:", error);
      toast$2.error(error.message || "Something went wrong");
    }
  };
  if (!cab) {
    return /* @__PURE__ */ jsxs("div", { className: "p-4", children: [
      /* @__PURE__ */ jsx("button", { onClick: () => navigate(-1), className: "mb-2", children: /* @__PURE__ */ jsx(ArrowLeft, {}) }),
      /* @__PURE__ */ jsx("p", { children: "No booking data found. Please go back and select a cab." })
    ] });
  }
  return /* @__PURE__ */ jsxs("div", { className: "w-full bg-gray-100 min-h-screen p-4 text-gray-900 pb-32", children: [
    /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-4", children: [
      /* @__PURE__ */ jsx(ArrowLeft, { size: 22, onClick: () => navigate(-1), className: "cursor-pointer" }),
      /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold", children: "Review booking" })
    ] }),
    reviewLoading && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center py-8", children: [
      /* @__PURE__ */ jsx(Loader, { className: "w-8 h-8 text-orange-500 animate-spin" }),
      /* @__PURE__ */ jsx("p", { className: "ml-3 text-gray-600", children: "Loading booking details..." })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: tripType }),
      /* @__PURE__ */ jsxs("p", { className: "font-semibold text-[17px] leading-5 mt-1", children: [
        pickupLocation,
        " → ",
        dropLocation
      ] }),
      /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600 mt-1", children: [
        formatDate(pickupDate),
        ", ",
        pickupTime
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-4", children: [
        /* @__PURE__ */ jsx(
          "img",
          {
            src: (cab == null ? void 0 : cab.image) || ((_f = originalCab.images) == null ? void 0 : _f.frontView) || "https://go-assets.ibcdn.com/u/MMT/images/1732607472482-hatchback_Unknown_Unknown_EXTERIOR_Front_view_.jpeg",
            className: "w-28 h-16 object-cover rounded",
            alt: "car"
          }
        ),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("p", { className: "font-semibold text-[16px]", children: [
            cabName,
            " Or Similar"
          ] }),
          /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: cabType })
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "mt-3 space-y-1 text-sm", children: [
        /* @__PURE__ */ jsxs("p", { children: [
          /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Fuel Type:" }),
          " ",
          fuelType
        ] }),
        /* @__PURE__ */ jsxs("p", { children: [
          /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Cancellation Policy:" }),
          " ",
          cancellationPolicy
        ] }),
        /* @__PURE__ */ jsxs("p", { children: [
          /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Extra Kms Charges:" }),
          " Rs ",
          extraKmRate,
          "/Km after ",
          includedKm,
          " Kms"
        ] }),
        /* @__PURE__ */ jsxs("p", { children: [
          /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Luggage:" }),
          " 1 large bag or 3 small bags"
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsx("p", { className: "font-semibold mb-3", children: "Special Request" }),
      /* @__PURE__ */ jsxs("label", { className: "flex items-center justify-between text-sm", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "checkbox",
              className: "w-4 h-4",
              checked: roofCarrier,
              onChange: (e) => setRoofCarrier(e.target.checked)
            }
          ),
          /* @__PURE__ */ jsx("span", { children: "Roof Carrier" })
        ] }),
        /* @__PURE__ */ jsxs("span", { children: [
          "₹ ",
          roofCarrierPrice
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-4", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
          /* @__PURE__ */ jsx("span", { className: "text-2xl", children: "💰" }),
          /* @__PURE__ */ jsx("p", { className: "font-semibold", children: "Wallet Cash" })
        ] }),
        /* @__PURE__ */ jsx("button", { className: "text-blue-600 font-semibold", children: "Apply ₹100" })
      ] }),
      /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600 mb-4", children: "Total Wallet Balance: ₹100" }),
      /* @__PURE__ */ jsx("p", { className: "font-semibold text-[17px] mb-3", children: "Offers" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-3", children: "Promo-code / offers / Bank offers" }),
      offers.map((offer) => /* @__PURE__ */ jsxs(
        "label",
        {
          className: "flex items-start justify-between py-3 border-b last:border-none",
          children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "font-semibold", children: offer.code }),
              /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: offer.description })
            ] }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "radio",
                name: "offer",
                className: "w-4 h-4 mt-1",
                checked: selectedOffer === offer.code,
                onChange: () => setSelectedOffer(offer.code)
              }
            )
          ]
        },
        offer.code
      ))
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsx("p", { className: "font-semibold text-[17px] mb-1", children: "Your Contact details" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-3", children: "Tickets will be shared to given contact" }),
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-6 mb-4 text-sm font-medium", children: [
        /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "radio",
              name: "gender",
              checked: gender === "male",
              onChange: () => setGender("male")
            }
          ),
          "Male"
        ] }),
        /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "radio",
              name: "gender",
              checked: gender === "female",
              onChange: () => setGender("female")
            }
          ),
          "Female"
        ] }),
        /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-1", children: [
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "radio",
              name: "gender",
              checked: gender === "other",
              onChange: () => setGender("other")
            }
          ),
          "Other"
        ] })
      ] }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Full Name" }),
      /* @__PURE__ */ jsx("p", { className: "font-medium mb-3", children: (user == null ? void 0 : user.name) || "Guest User" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Email" }),
      /* @__PURE__ */ jsx("p", { className: "font-medium mb-3", children: (user == null ? void 0 : user.email) || "Not provided" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Phone" }),
      /* @__PURE__ */ jsx("p", { className: "font-medium", children: (user == null ? void 0 : user.phone) || (user == null ? void 0 : user.phoneNumber) || "Not provided" })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsx("p", { className: "font-semibold text-[17px]", children: "Your Pickup location" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-2", children: "Our driver will reach at this location" }),
      /* @__PURE__ */ jsx("div", { className: "mt-2 p-3 bg-gray-100 rounded-xl text-sm", children: pickupLocation })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 mb-2", children: [
        /* @__PURE__ */ jsx("span", { className: "text-3xl", children: "🏆" }),
        /* @__PURE__ */ jsx("span", { className: "font-bold text-orange-500", children: "Loyalty Rewards" })
      ] }),
      /* @__PURE__ */ jsx("p", { className: "font-semibold text-[16px] mb-1", children: "Complete 3 more bookings* & unlock Premium Rewards" }),
      /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-3", children: "Use additional benefits on your next bookings." }),
      /* @__PURE__ */ jsxs("div", { className: "bg-orange-50 p-3 rounded-xl", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 mb-2", children: [
          /* @__PURE__ */ jsx("span", { className: "text-orange-500 text-lg", children: "✔" }),
          /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
            /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "Flat ₹50 cashback" }),
            " on airport & hourly rental cabs"
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
          /* @__PURE__ */ jsx("span", { className: "text-orange-500 text-lg", children: "✔" }),
          /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
            /* @__PURE__ */ jsx("span", { className: "font-semibold", children: "2% cashback*" }),
            " on outstation cabs"
          ] })
        ] })
      ] }),
      /* @__PURE__ */ jsx("button", { className: "text-blue-600 text-sm font-semibold mt-3", children: "View all benefits >" })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "bg-white p-4 rounded-2xl shadow mb-4", children: [
      /* @__PURE__ */ jsx("p", { className: "font-semibold text-[17px] mb-3", children: "Payment Options" }),
      /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
        /* @__PURE__ */ jsxs(
          "label",
          {
            onClick: () => setPaymentType("partial"),
            className: `flex items-start gap-3 p-3 rounded-lg border cursor-pointer ${paymentType === "partial" ? "bg-orange-50 border-orange-200" : "border-gray-100"}`,
            children: [
              /* @__PURE__ */ jsx("div", { className: `w-5 h-5 rounded-full border flex items-center justify-center mt-0.5 ${paymentType === "partial" ? "border-orange-500" : "border-gray-300"}`, children: paymentType === "partial" && /* @__PURE__ */ jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-orange-500" }) }),
              /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
                /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-900", children: [
                  "Pay ₹",
                  advancePayment,
                  " Now"
                ] }),
                /* @__PURE__ */ jsxs("p", { className: "text-xs text-gray-500", children: [
                  "Remaining ₹",
                  totalFare + (roofCarrier ? roofCarrierPrice : 0) - advancePayment,
                  " to driver"
                ] })
              ] })
            ]
          }
        ),
        /* @__PURE__ */ jsxs(
          "label",
          {
            onClick: () => setPaymentType("full"),
            className: `flex items-start gap-3 p-3 rounded-lg border cursor-pointer ${paymentType === "full" ? "bg-orange-50 border-orange-200" : "border-gray-100"}`,
            children: [
              /* @__PURE__ */ jsx("div", { className: `w-5 h-5 rounded-full border flex items-center justify-center mt-0.5 ${paymentType === "full" ? "border-orange-500" : "border-gray-300"}`, children: paymentType === "full" && /* @__PURE__ */ jsx("div", { className: "w-2.5 h-2.5 rounded-full bg-orange-500" }) }),
              /* @__PURE__ */ jsxs("div", { className: "flex-1", children: [
                /* @__PURE__ */ jsxs("p", { className: "font-semibold text-gray-900", children: [
                  "Pay ₹",
                  totalFare + (roofCarrier ? roofCarrierPrice : 0),
                  " Now"
                ] }),
                /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Full payment" })
              ] })
            ]
          }
        )
      ] })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "fixed bottom-0 left-0 w-full bg-white p-4 shadow-lg border-t", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-3", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("p", { className: "text-xl font-semibold", children: [
            "₹ ",
            totalFare + (roofCarrier ? roofCarrierPrice : 0)
          ] }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: "Includes tolls & taxes" })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "text-right", children: /* @__PURE__ */ jsx("p", { className: "text-blue-600 font-semibold cursor-pointer", onClick: () => {
          var _a2;
          return (_a2 = document.querySelector(".mb-24")) == null ? void 0 : _a2.scrollIntoView({ behavior: "smooth" });
        }, children: paymentType === "partial" ? "Partial Payment" : "Full Payment" }) })
      ] }),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: handlePayAndConfirm,
          disabled: createLoading,
          className: `w-full bg-orange-500 text-white py-3 rounded-xl text-center text-[17px] font-semibold ${createLoading ? "opacity-70" : ""}`,
          children: createLoading ? /* @__PURE__ */ jsxs("span", { className: "flex items-center justify-center gap-2", children: [
            /* @__PURE__ */ jsx(Loader, { className: "w-5 h-5 animate-spin" }),
            "Processing..."
          ] }) : `Pay ₹${paymentType === "partial" ? advancePayment : totalFare + (roofCarrier ? roofCarrierPrice : 0)} & confirm now`
        }
      )
    ] })
  ] });
}
const FareBreakdown = ({
  fare,
  payment: payment2 = null,
  showPaymentInfo = true,
  className = "",
  title = null
}) => {
  const { t } = useTranslation();
  if (!fare) {
    return /* @__PURE__ */ jsx("div", { className: `bg-gray-50 rounded-lg p-4 ${className}`, children: /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-center", children: t("payment.noFareInfo") }) });
  }
  const subtotal = (fare.base || 0) + (fare.distance || 0) + (fare.stops || 0) + (fare.nightCharge || 0) + (fare.zoneExtraCharge || 0) + (fare.taxes || 0);
  const discount = fare.discount || 0;
  const total = fare.total || subtotal - discount;
  return /* @__PURE__ */ jsxs("div", { className: `bg-white rounded-lg shadow p-6 ${className}`, children: [
    title && /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold mb-4", children: title }),
    /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-700 font-medium", children: t("payment.baseFare") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.minimumBookingCharge") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
          "₹",
          fare.base || 0
        ] })
      ] }),
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-700 font-medium", children: t("payment.distanceFare") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.perKilometerCharges") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
          "₹",
          fare.distance || 0
        ] })
      ] }),
      fare.stops > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-700 font-medium", children: t("payment.stopsCharge") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.additionalStops") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
          "₹",
          fare.stops
        ] })
      ] }),
      fare.nightCharge > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-700 font-medium", children: t("payment.nightCharge") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.lateNightSurcharge") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
          "₹",
          fare.nightCharge
        ] })
      ] }),
      fare.zoneExtraCharge > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-700 font-medium", children: t("payment.zoneExtraCharge") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.additionalZoneCharges") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
          "₹",
          fare.zoneExtraCharge
        ] })
      ] }),
      fare.taxes > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-700 font-medium", children: t("payment.gstTaxes") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500", children: t("payment.governmentTaxes") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
          "₹",
          fare.taxes
        ] })
      ] }),
      discount > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsx("hr", { className: "border-gray-200" }),
        /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
          /* @__PURE__ */ jsx("p", { className: "text-gray-600 font-medium", children: t("payment.subtotal") }),
          /* @__PURE__ */ jsxs("p", { className: "font-semibold", children: [
            "₹",
            subtotal
          ] })
        ] })
      ] }),
      discount > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-green-600 font-medium", children: t("payment.discountApplied") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-green-500", children: t("payment.promotionalDiscount") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "font-semibold text-green-600", children: [
          "-₹",
          discount
        ] })
      ] }),
      /* @__PURE__ */ jsx("hr", { className: "border-gray-300" }),
      /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center bg-gray-50 -mx-2 px-2 py-3 rounded", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("p", { className: "text-lg font-bold text-gray-900", children: t("payment.totalFare") }),
          /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-600", children: t("payment.finalAmountToPay") })
        ] }),
        /* @__PURE__ */ jsxs("p", { className: "text-xl font-bold text-orange-600", children: [
          "₹",
          total
        ] })
      ] }),
      showPaymentInfo && payment2 && /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsx("hr", { className: "border-gray-200 mt-4" }),
        payment2.onlinePaid > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-green-600 font-medium", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "font-semibold", children: t("payment.paidAmount") }),
            /* @__PURE__ */ jsx("p", { className: "text-xs text-green-500", children: t("payment.onlinePaymentReceived") })
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "font-bold", children: [
            "₹",
            payment2.onlinePaid
          ] })
        ] }),
        total - (payment2.onlinePaid || 0) > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-orange-600 font-bold bg-orange-50 -mx-2 px-2 py-2 rounded", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "font-bold", children: t("payment.pendingAmount") }),
            /* @__PURE__ */ jsx("p", { className: "text-xs text-orange-500", children: t("payment.toBePaidToDriver") })
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "text-lg font-bold", children: [
            "₹",
            total - (payment2.onlinePaid || 0)
          ] })
        ] }),
        total - (payment2.onlinePaid || 0) === 0 && payment2.onlinePaid > 0 && /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-center text-green-600 font-bold bg-green-50 -mx-2 px-2 py-2 rounded", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("p", { className: "font-bold", children: t("payment.paymentStatus") }),
            /* @__PURE__ */ jsx("p", { className: "text-xs text-green-500", children: t("payment.fullyPaidOnline") })
          ] }),
          /* @__PURE__ */ jsxs("p", { className: "font-bold", children: [
            "✓ ",
            t("payment.paid")
          ] })
        ] })
      ] })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "mt-4 p-3 bg-blue-50 rounded-lg", children: /* @__PURE__ */ jsxs("p", { className: "text-xs text-blue-700", children: [
      /* @__PURE__ */ jsxs("strong", { children: [
        t("common.note"),
        ":"
      ] }),
      " ",
      t("payment.fareCalculationNote")
    ] }) })
  ] });
};
const BookingDetails = () => {
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
  const { id } = distExports.useParams();
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const { t } = useTranslation();
  const [activeTab, setActiveTab] = useState("details");
  const {
    bookingDetails,
    detailsLoading,
    detailsError,
    timeline,
    timelineLoading,
    invoice,
    invoiceLoading
  } = useSelector((state) => state.booking);
  useEffect(() => {
    if (id) {
      dispatch(getBookingById(id));
      dispatch(getBookingTimeline(id));
    }
    return () => {
      dispatch(resetBookingDetails());
      dispatch(resetTimeline());
      dispatch(resetInvoice());
    };
  }, [dispatch, id]);
  useEffect(() => {
    if (activeTab === "invoice" && id && !invoice) {
      dispatch(getBookingInvoice(id));
    }
  }, [activeTab, id, invoice, dispatch]);
  const formatDate = (dateString) => {
    if (!dateString) return "";
    const date = new Date(dateString);
    return date.toLocaleDateString("en-IN", {
      day: "numeric",
      month: "short",
      year: "numeric",
      hour: "2-digit",
      minute: "2-digit"
    });
  };
  const getStatusColor = (status) => {
    switch (status) {
      case "completed":
        return "bg-green-100 text-green-700";
      case "cancelled":
        return "bg-red-100 text-red-700";
      case "inProgress":
        return "bg-blue-100 text-blue-700";
      case "assigned":
        return "bg-purple-100 text-purple-700";
      default:
        return "bg-yellow-100 text-yellow-700";
    }
  };
  if (detailsLoading) {
    return /* @__PURE__ */ jsxs("div", { className: "min-h-screen", children: [
      /* @__PURE__ */ jsx(Navbar, {}),
      /* @__PURE__ */ jsx("div", { className: "flex justify-center items-center h-96", children: /* @__PURE__ */ jsx("p", { className: "text-gray-600 text-lg", children: t("common.loading") }) })
    ] });
  }
  if (detailsError) {
    return /* @__PURE__ */ jsxs("div", { className: "min-h-screen", children: [
      /* @__PURE__ */ jsx(Navbar, {}),
      /* @__PURE__ */ jsxs("div", { className: "flex flex-col justify-center items-center h-96", children: [
        /* @__PURE__ */ jsx("p", { className: "text-red-500 text-lg mb-4", children: detailsError }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate("/my-trips"),
            className: "px-6 py-2 bg-orange-500 text-white rounded-md",
            children: t("booking.backToMyTrips")
          }
        )
      ] })
    ] });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-gray-50 text-gray-900", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "bg-[#fc6325] h-[120px] flex items-center justify-between px-4 md:px-[170px] mt-16", children: [
      /* @__PURE__ */ jsxs("div", { children: [
        /* @__PURE__ */ jsx("h1", { className: "text-2xl font-semibold text-white", children: t("booking.bookingDetails") }),
        /* @__PURE__ */ jsxs("p", { className: "text-white text-sm mt-1", children: [
          t("booking.orderId"),
          ": ",
          (bookingDetails == null ? void 0 : bookingDetails.orderId) || t("common.notAvailable")
        ] })
      ] }),
      /* @__PURE__ */ jsx("span", { className: `px-4 py-2 rounded-full font-semibold ${getStatusColor(bookingDetails == null ? void 0 : bookingDetails.status)}`, children: ((_a = bookingDetails == null ? void 0 : bookingDetails.status) == null ? void 0 : _a.toUpperCase()) || t("common.notAvailable") })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "flex gap-10 px-4 md:px-[170px] mt-6 border-b border-gray-200", children: [
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setActiveTab("details"),
          className: `pb-3 font-medium ${activeTab === "details" ? "border-b-2 border-[#fc6325] text-black" : "text-gray-500"}`,
          children: t("booking.tripDetails")
        }
      ),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setActiveTab("timeline"),
          className: `pb-3 font-medium ${activeTab === "timeline" ? "border-b-2 border-[#fc6325] text-black" : "text-gray-500"}`,
          children: t("booking.timeline")
        }
      ),
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => setActiveTab("invoice"),
          className: `pb-3 font-medium ${activeTab === "invoice" ? "border-b-2 border-[#fc6325] text-black" : "text-gray-500"}`,
          children: t("booking.invoice")
        }
      )
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "px-4 md:px-[170px] py-8", children: [
      activeTab === "details" && bookingDetails && /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold mb-4", children: t("booking.tripInformation") }),
          /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("booking.pickupLocation") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_b = bookingDetails.pickupLocation) == null ? void 0 : _b.address) || t("common.notAvailable") })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("booking.dropLocation") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_c = bookingDetails.dropLocation) == null ? void 0 : _c.address) || t("common.notAvailable") })
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "flex gap-8", children: [
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("booking.tripType") }),
                /* @__PURE__ */ jsx("p", { className: "font-medium capitalize", children: bookingDetails.tripType || t("common.notAvailable") })
              ] }),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("booking.distance") }),
                /* @__PURE__ */ jsxs("p", { className: "font-medium", children: [
                  bookingDetails.distance || 0,
                  " ",
                  t("common.km")
                ] })
              ] })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("booking.scheduledTime") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: formatDate(bookingDetails.scheduledTime) })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsx(
          FareBreakdown,
          {
            fare: bookingDetails.fare,
            payment: bookingDetails.payment,
            showPaymentInfo: true,
            title: t("payment.fareBreakdown")
          }
        ),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold mb-4", children: t("booking.customerDetails") }),
          /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("profile.name") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_d = bookingDetails.customer) == null ? void 0 : _d.fullName) || t("common.notAvailable") })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("profile.phone") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_e = bookingDetails.customer) == null ? void 0 : _e.phone) || t("common.notAvailable") })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("profile.email") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_f = bookingDetails.customer) == null ? void 0 : _f.email) || t("common.notAvailable") })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [
          /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold mb-4", children: t("payment.driverDetails") }),
          bookingDetails.driver ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("profile.name") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_g = bookingDetails.driver) == null ? void 0 : _g.fullName) || t("common.notAvailable") })
            ] }),
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: t("profile.phone") }),
              /* @__PURE__ */ jsx("p", { className: "font-medium", children: ((_h = bookingDetails.driver) == null ? void 0 : _h.phone) || t("common.notAvailable") })
            ] })
          ] }) : /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t("booking.driverNotAssigned") })
        ] })
      ] }),
      activeTab === "timeline" && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold mb-6", children: t("booking.bookingTimeline") }),
        timelineLoading ? /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t("common.loading") }) : timeline && timeline.length > 0 ? /* @__PURE__ */ jsx("div", { className: "space-y-6", children: timeline.map((event, index) => /* @__PURE__ */ jsxs("div", { className: "flex gap-4", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center", children: [
            /* @__PURE__ */ jsx("div", { className: "w-4 h-4 bg-orange-500 rounded-full" }),
            index < timeline.length - 1 && /* @__PURE__ */ jsx("div", { className: "w-0.5 h-16 bg-gray-300" })
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("h3", { className: "font-semibold", children: event.title }),
            /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: event.description }),
            /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 mt-1", children: formatDate(event.timestamp) })
          ] })
        ] }, index)) }) : /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t("booking.noTimelineEvents") })
      ] }),
      activeTab === "invoice" && /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow p-6", children: [
        /* @__PURE__ */ jsx("h2", { className: "text-lg font-bold mb-6", children: t("booking.invoice") }),
        invoiceLoading ? /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t("common.loading") }) : invoice ? /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
          /* @__PURE__ */ jsxs("div", { className: "flex justify-between items-start", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("h3", { className: "font-bold text-xl", children: invoice.invoiceNumber }),
              /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
                t("booking.date"),
                ": ",
                formatDate(invoice.createdAt)
              ] })
            ] }),
            /* @__PURE__ */ jsx("span", { className: `px-3 py-1 rounded text-sm font-medium ${invoice.status === "paid" ? "bg-green-100 text-green-700" : "bg-yellow-100 text-yellow-700"}`, children: (_i = invoice.status) == null ? void 0 : _i.toUpperCase() })
          ] }),
          /* @__PURE__ */ jsx("hr", {}),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("h4", { className: "font-semibold mb-2", children: t("booking.customer") }),
            /* @__PURE__ */ jsx("p", { children: ((_j = invoice.recipientDetails) == null ? void 0 : _j.name) || t("common.notAvailable") }),
            /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: ((_k = invoice.recipientDetails) == null ? void 0 : _k.email) || t("common.notAvailable") }),
            /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500", children: ((_l = invoice.recipientDetails) == null ? void 0 : _l.phone) || t("common.notAvailable") })
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("h4", { className: "font-semibold mb-2", children: t("booking.tripDetails") }),
            /* @__PURE__ */ jsxs("p", { children: [
              t("booking.pickup"),
              ": ",
              ((_m = invoice.tripDetails) == null ? void 0 : _m.pickupAddress) || t("common.notAvailable")
            ] }),
            /* @__PURE__ */ jsxs("p", { children: [
              t("booking.drop"),
              ": ",
              ((_n = invoice.tripDetails) == null ? void 0 : _n.dropAddress) || t("common.notAvailable")
            ] }),
            /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
              t("booking.distance"),
              ": ",
              ((_o = invoice.tripDetails) == null ? void 0 : _o.distance) || 0,
              " ",
              t("common.km"),
              " |",
              t("booking.duration"),
              ": ",
              ((_p = invoice.tripDetails) == null ? void 0 : _p.duration) || 0,
              " ",
              t("common.mins")
            ] })
          ] }),
          /* @__PURE__ */ jsx(
            FareBreakdown,
            {
              fare: bookingDetails.fare,
              payment: bookingDetails.payment,
              showPaymentInfo: false,
              title: t("payment.fareBreakdown"),
              className: "shadow-none border border-gray-200"
            }
          ),
          /* @__PURE__ */ jsx("button", { className: "w-full py-3 bg-orange-500 text-white rounded-lg font-semibold hover:bg-orange-600", children: t("booking.downloadInvoicePDF") })
        ] }) : /* @__PURE__ */ jsx("p", { className: "text-gray-500", children: t("booking.invoiceNotAvailable") })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsxs(
        "button",
        {
          onClick: () => navigate("/my-trips"),
          className: "px-6 py-3 bg-gray-200 text-gray-700 rounded-lg font-medium hover:bg-gray-300",
          children: [
            "← ",
            t("booking.backToMyTrips")
          ]
        }
      ) })
    ] }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const Register = () => {
  const dispatch = useDispatch();
  const navigate = distExports.useNavigate();
  const { t } = useTranslation();
  const { loading, error, registerSuccess, message } = useSelector(
    (state) => state.auth
  );
  const [formData, setFormData] = useState({
    fullName: "",
    email: "",
    password: "",
    phone: "",
    userName: "",
    address: "",
    city: "",
    state: "",
    pincode: ""
  });
  const [profileImage, setProfileImage] = useState(null);
  const handleChange = (e) => {
    setFormData({ ...formData, [e.target.name]: e.target.value });
  };
  const handleImageChange = (e) => {
    setProfileImage(e.target.files[0]);
  };
  const handleSubmit = (e) => {
    e.preventDefault();
    const data = new FormData();
    data.append("fullName", formData.fullName);
    data.append("email", formData.email);
    data.append("password", formData.password);
    data.append("phone", formData.phone);
    data.append("userName", formData.userName);
    data.append("fullAddress[address]", formData.address);
    data.append("fullAddress[city]", formData.city);
    data.append("fullAddress[state]", formData.state);
    data.append("fullAddress[pincode]", formData.pincode);
    if (profileImage) {
      data.append("profileImage", profileImage);
    }
    dispatch(registerUser(data));
  };
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-gray-50 flex flex-col", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsx("div", { className: "flex-grow flex items-center justify-center pt-24 pb-12 px-4", children: /* @__PURE__ */ jsxs("div", { className: "max-w-2xl w-full bg-white rounded-xl shadow-lg p-8", children: [
      /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold text-center text-gray-800 mb-8", children: t("auth.createAccount") }),
      error && /* @__PURE__ */ jsx("div", { className: "bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-6 text-sm", children: error }),
      /* @__PURE__ */ jsxs("form", { onSubmit: handleSubmit, className: "space-y-6", children: [
        /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("profile.name") }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "text",
                name: "fullName",
                value: formData.fullName,
                onChange: handleChange,
                required: true,
                className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                placeholder: t("auth.enterName")
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("auth.userName") || "Username" }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "text",
                name: "userName",
                value: formData.userName,
                onChange: handleChange,
                required: true,
                className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                placeholder: "johndoe123"
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-6", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("auth.email") }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "email",
                name: "email",
                value: formData.email,
                onChange: handleChange,
                required: true,
                className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                placeholder: t("auth.enterEmail")
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("auth.phone") }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "tel",
                name: "phone",
                value: formData.phone,
                onChange: handleChange,
                required: true,
                className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                placeholder: t("auth.enterPhone")
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("auth.password") }),
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "password",
              name: "password",
              value: formData.password,
              onChange: handleChange,
              required: true,
              className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
              placeholder: t("auth.enterPassword")
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "border-t pt-4", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-700 mb-4", children: t("profile.address") }),
          /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
            /* @__PURE__ */ jsxs("div", { children: [
              /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("profile.streetAddress") }),
              /* @__PURE__ */ jsx(
                "input",
                {
                  type: "text",
                  name: "address",
                  value: formData.address,
                  onChange: handleChange,
                  required: true,
                  className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                  placeholder: "123 Main St"
                }
              )
            ] }),
            /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: [
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("profile.city") }),
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "text",
                    name: "city",
                    value: formData.city,
                    onChange: handleChange,
                    required: true,
                    className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                    placeholder: "Bhopal"
                  }
                )
              ] }),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("profile.state") }),
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "text",
                    name: "state",
                    value: formData.state,
                    onChange: handleChange,
                    required: true,
                    className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                    placeholder: "MP"
                  }
                )
              ] }),
              /* @__PURE__ */ jsxs("div", { children: [
                /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: t("profile.pincode") }),
                /* @__PURE__ */ jsx(
                  "input",
                  {
                    type: "text",
                    name: "pincode",
                    value: formData.pincode,
                    onChange: handleChange,
                    required: true,
                    className: "w-full px-4 py-2 border rounded-lg focus:ring-2 focus:ring-orange-500 outline-none text-gray-900",
                    placeholder: "462001"
                  }
                )
              ] })
            ] })
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "border-t pt-4", children: [
          /* @__PURE__ */ jsx("label", { className: "block text-sm font-medium text-gray-700 mb-2", children: t("profile.profileImage") || "Profile Image" }),
          /* @__PURE__ */ jsx("div", { className: "flex items-center space-x-4", children: /* @__PURE__ */ jsx(
            "input",
            {
              type: "file",
              accept: "image/*",
              onChange: handleImageChange,
              className: "block w-full text-sm text-gray-500\r\n                    file:mr-4 file:py-2 file:px-4\r\n                    file:rounded-full file:border-0\r\n                    file:text-sm file:font-semibold\r\n                    file:bg-orange-50 file:text-orange-700\r\n                    hover:file:bg-orange-100"
            }
          ) })
        ] }),
        /* @__PURE__ */ jsx(
          "button",
          {
            type: "submit",
            disabled: loading,
            className: `w-full py-3 rounded-lg font-bold text-white transition-colors text-lg
                ${loading ? "bg-gray-400 cursor-not-allowed" : "bg-orange-600 hover:bg-orange-700"}`,
            children: loading ? t("common.creatingAccount") || "Creating Account..." : t("auth.register")
          }
        )
      ] }),
      /* @__PURE__ */ jsx("div", { className: "mt-6 text-center", children: /* @__PURE__ */ jsxs("p", { className: "text-gray-600", children: [
        t("auth.alreadyHaveAccount"),
        " ",
        /* @__PURE__ */ jsx("span", { className: "text-orange-600 font-semibold cursor-pointer", onClick: () => navigate("/"), children: t("auth.login") })
      ] }) })
    ] }) }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const Support = () => {
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const { isAuthenticated } = useSelector((state) => state.auth);
  const {
    categories,
    callbackReasons,
    timeSlots,
    orders,
    createLoading,
    createSuccess,
    createError,
    callbacksLoading,
    callbackSuccess,
    callbackError
  } = useSelector((state) => state.support);
  const [showTicketModal, setShowTicketModal] = useState(false);
  const [showCallbackModal, setShowCallbackModal] = useState(false);
  const [ticketForm, setTicketForm] = useState({
    category: "",
    orderId: "",
    subject: "",
    text: "",
    attachments: []
  });
  const [callbackForm, setCallbackForm] = useState({
    name: "",
    contact: "",
    orderId: "",
    reasonCategory: "",
    preferredSlot: {
      date: "",
      timeSlot: ""
    }
  });
  const [openFAQ, setOpenFAQ] = useState(null);
  const faqs = [
    {
      question: "How Do I Cancel My Booking?",
      answer: "You can cancel your booking from the 'My Trips' section. Go to your booking details and click on 'Cancel Booking'. Cancellation charges may apply based on the time of cancellation."
    },
    {
      question: "How Do I Get A Refund For A Cancelled Ride?",
      answer: "Refunds are processed automatically within 5-7 business days to your original payment method. For wallet payments, refunds are instant."
    },
    {
      question: "I Left Something In The Cab. How Do I Retrieve It?",
      answer: "Please raise a support ticket with your booking details. Our team will contact the driver and help you retrieve your belongings."
    },
    {
      question: "How Do I Report A Safety Concern?",
      answer: "Your safety is our priority. Please raise a ticket under 'Safety Issue' category or call our 24/7 helpline immediately for urgent concerns."
    },
    {
      question: "Why Was I Charged More Than The Estimated Fare?",
      answer: "Final fare may vary due to route changes, waiting time, toll charges, or extra kilometers. You can view the fare breakdown in your trip details."
    },
    {
      question: "How Do I Update My Profile Information?",
      answer: "Go to Profile section from the menu. You can update your name, email, phone number and other details from there."
    }
  ];
  useEffect(() => {
    if (isAuthenticated) {
      dispatch(getCategories());
      dispatch(getCallbackReasons());
      dispatch(getTimeSlots());
      dispatch(getMyOrders());
    }
  }, [dispatch, isAuthenticated]);
  useEffect(() => {
    if (createSuccess) {
      toast$2.success("Ticket created successfully!");
      setShowTicketModal(false);
      setTicketForm({ category: "", orderId: "", subject: "", text: "", attachments: [] });
      dispatch(resetCreateState());
    }
    if (createError) {
      toast$2.error(createError);
      dispatch(resetCreateState());
    }
  }, [createSuccess, createError, dispatch]);
  useEffect(() => {
    if (callbackSuccess) {
      toast$2.success("Callback request submitted successfully!");
      setShowCallbackModal(false);
      setCallbackForm({ name: "", contact: "", reasonCategory: "", preferredSlot: { date: "", timeSlot: "" } });
      dispatch(resetCallbackState());
    }
    if (callbackError) {
      toast$2.error(callbackError);
      dispatch(resetCallbackState());
    }
  }, [callbackSuccess, callbackError, dispatch]);
  const handleTicketSubmit = (e) => {
    e.preventDefault();
    if (!ticketForm.category || !ticketForm.subject || !ticketForm.text) {
      toast$2.error("Please fill all required fields");
      return;
    }
    dispatch(createTicket(ticketForm));
  };
  const handleCallbackSubmit = (e) => {
    e.preventDefault();
    if (!callbackForm.name || !callbackForm.contact || !callbackForm.reasonCategory || !callbackForm.preferredSlot.timeSlot || !callbackForm.orderId) {
      toast$2.error("Please fill all required fields");
      return;
    }
    const payload = { ...callbackForm };
    if (!payload.preferredSlot.date) {
      const { date, ...restSlot } = payload.preferredSlot;
      payload.preferredSlot = restSlot;
    }
    dispatch(requestCallback(payload));
  };
  const handleFileChange = (e) => {
    const files = Array.from(e.target.files);
    setTicketForm((prev) => ({ ...prev, attachments: [...prev.attachments, ...files] }));
  };
  const removeAttachment = (index) => {
    setTicketForm((prev) => ({
      ...prev,
      attachments: prev.attachments.filter((_, i) => i !== index)
    }));
  };
  const handleOpenTicketModal = () => {
    if (!isAuthenticated) {
      toast$2.error("Please login to raise a ticket");
      navigate("/register");
      return;
    }
    setShowTicketModal(true);
  };
  const handleOpenCallbackModal = () => {
    if (!isAuthenticated) {
      toast$2.error("Please login to request a callback");
      navigate("/register");
      return;
    }
    setShowCallbackModal(true);
  };
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#f0f5fa]", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "pt-20 pb-10", children: [
      /* @__PURE__ */ jsx("div", { className: "max-w-6xl mx-auto px-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between mb-6", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
          /* @__PURE__ */ jsx("button", { onClick: () => navigate(-1), className: "p-2 hover:bg-gray-200 rounded-full", children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" }) }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
            /* @__PURE__ */ jsx("div", { className: "w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center", children: /* @__PURE__ */ jsx(Headphones, { className: "w-4 h-4 text-blue-600" }) }),
            /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Help & Support" })
          ] })
        ] }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate("/my-tickets"),
            className: "px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700",
            children: "My Tickets"
          }
        )
      ] }) }),
      /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto px-4", children: [
        /* @__PURE__ */ jsx("div", { className: "bg-white rounded-2xl shadow-sm p-8 mb-8", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
          /* @__PURE__ */ jsxs("div", { className: "inline-flex items-center gap-2 px-4 py-2 bg-gray-100 rounded-full mb-6", children: [
            /* @__PURE__ */ jsx(Headphones, { className: "w-4 h-4 text-gray-600" }),
            /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-600", children: "24/7 Support Available" })
          ] }),
          /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold text-blue-600 mb-2", children: "How Can We Help You" }),
          /* @__PURE__ */ jsx("h2", { className: "text-3xl font-bold text-blue-600 mb-4", children: "Today ?" }),
          /* @__PURE__ */ jsx("p", { className: "text-gray-500 mb-8 max-w-lg mx-auto", children: "We're Here To Assist You With Any Questions Or Concerns About Your Rides. Choose How You'd Like To Reach Us." }),
          /* @__PURE__ */ jsxs("div", { className: "flex justify-center gap-4", children: [
            /* @__PURE__ */ jsxs(
              "button",
              {
                onClick: handleOpenTicketModal,
                className: "flex items-center gap-2 px-6 py-3 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700",
                children: [
                  /* @__PURE__ */ jsx(MessageSquare, { className: "w-5 h-5" }),
                  "Raise A Ticket"
                ]
              }
            ),
            /* @__PURE__ */ jsxs(
              "button",
              {
                onClick: handleOpenCallbackModal,
                className: "flex items-center gap-2 px-6 py-3 bg-gray-800 text-white rounded-lg font-medium hover:bg-gray-900",
                children: [
                  /* @__PURE__ */ jsx(Phone, { className: "w-5 h-5" }),
                  "Request A Callback"
                ]
              }
            )
          ] })
        ] }) }),
        /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-2xl shadow-sm p-8", children: [
          /* @__PURE__ */ jsx("h3", { className: "text-xl font-bold text-gray-900 text-center mb-2", children: "Frequently Asked Questions" }),
          /* @__PURE__ */ jsx("p", { className: "text-gray-500 text-center mb-6", children: "Quick Answers To Common Questions" }),
          /* @__PURE__ */ jsx("div", { className: "space-y-3", children: faqs.map((faq2, index) => /* @__PURE__ */ jsxs("div", { className: "border border-gray-200 rounded-lg", children: [
            /* @__PURE__ */ jsxs(
              "button",
              {
                onClick: () => setOpenFAQ(openFAQ === index ? null : index),
                className: "w-full flex items-center justify-between p-4 text-left",
                children: [
                  /* @__PURE__ */ jsx("span", { className: "font-medium text-gray-900", children: faq2.question }),
                  openFAQ === index ? /* @__PURE__ */ jsx(ChevronUp, { className: "w-5 h-5 text-gray-500" }) : /* @__PURE__ */ jsx(ChevronDown, { className: "w-5 h-5 text-gray-500" })
                ]
              }
            ),
            openFAQ === index && /* @__PURE__ */ jsx("div", { className: "px-4 pb-4 text-gray-600 text-sm", children: faq2.answer })
          ] }, index)) })
        ] })
      ] })
    ] }),
    showTicketModal && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-2xl max-h-[90vh] overflow-y-auto", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b", children: [
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Raise A Ticket" }),
        /* @__PURE__ */ jsx("button", { onClick: () => setShowTicketModal(false), className: "p-1 hover:bg-gray-100 rounded", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
      ] }),
      /* @__PURE__ */ jsxs("form", { onSubmit: handleTicketSubmit, className: "p-6 space-y-4", children: [
        /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
              "Select Category ",
              /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
            ] }),
            /* @__PURE__ */ jsxs(
              "select",
              {
                value: ticketForm.category,
                onChange: (e) => setTicketForm((prev) => ({ ...prev, category: e.target.value })),
                className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white",
                children: [
                  /* @__PURE__ */ jsx("option", { value: "", children: "Select" }),
                  categories.map((cat, idx) => {
                    const value = typeof cat === "object" ? cat.value || cat._id || cat.name : cat;
                    const label = typeof cat === "object" ? cat.label || cat.name || cat.value : cat;
                    return /* @__PURE__ */ jsx("option", { value, children: label }, idx);
                  })
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
              "Select Order ",
              /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
            ] }),
            /* @__PURE__ */ jsxs(
              "select",
              {
                value: ticketForm.orderId,
                onChange: (e) => setTicketForm((prev) => ({ ...prev, orderId: e.target.value })),
                className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white",
                children: [
                  /* @__PURE__ */ jsx("option", { value: "", children: "Select" }),
                  orders.map((order) => /* @__PURE__ */ jsx("option", { value: order.orderId || order._id, children: order.orderId || order._id }, order._id))
                ]
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
            "Subject ",
            /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
          ] }),
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "text",
              value: ticketForm.subject,
              onChange: (e) => setTicketForm((prev) => ({ ...prev, subject: e.target.value })),
              placeholder: "Brief Description About The Problem",
              className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
            "Describe Your Issue ",
            /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
          ] }),
          /* @__PURE__ */ jsx(
            "textarea",
            {
              value: ticketForm.text,
              onChange: (e) => setTicketForm((prev) => ({ ...prev, text: e.target.value })),
              placeholder: "Provide Detailed Information",
              rows: 4,
              className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 resize-none text-gray-900 bg-white"
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between pt-2", children: [
          /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 cursor-pointer text-gray-600 hover:text-gray-800", children: [
            /* @__PURE__ */ jsx(Paperclip, { className: "w-5 h-5" }),
            /* @__PURE__ */ jsx("span", { className: "text-sm", children: "+ Add Attachments (Optional)" }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "file",
                multiple: true,
                onChange: handleFileChange,
                className: "hidden",
                accept: "image/*,.pdf,.doc,.docx"
              }
            )
          ] }) }),
          /* @__PURE__ */ jsx(
            "button",
            {
              type: "submit",
              disabled: createLoading,
              className: "px-8 py-2.5 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 disabled:opacity-50",
              children: createLoading ? "Submitting..." : "Raise Ticket"
            }
          )
        ] }),
        ticketForm.attachments.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mt-2", children: ticketForm.attachments.map((file, idx) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-gray-100 px-2 py-1 rounded text-sm", children: [
          /* @__PURE__ */ jsx("span", { children: file.name }),
          /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeAttachment(idx), children: /* @__PURE__ */ jsx(X, { className: "w-4 h-4 text-gray-500" }) })
        ] }, idx)) })
      ] })
    ] }) }),
    showCallbackModal && /* @__PURE__ */ jsx("div", { className: "fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl w-full max-w-2xl", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between p-4 border-b", children: [
        /* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Request Callback" }),
        /* @__PURE__ */ jsx("button", { onClick: () => setShowCallbackModal(false), className: "p-1 hover:bg-gray-100 rounded", children: /* @__PURE__ */ jsx(X, { className: "w-5 h-5" }) })
      ] }),
      /* @__PURE__ */ jsxs("form", { onSubmit: handleCallbackSubmit, className: "p-6 space-y-4", children: [
        /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
              "Name ",
              /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
            ] }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "text",
                value: callbackForm.name,
                onChange: (e) => setCallbackForm((prev) => ({ ...prev, name: e.target.value })),
                placeholder: "Enter Name",
                className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white"
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
              "Phone Number ",
              /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
            ] }),
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "tel",
                value: callbackForm.contact,
                onChange: (e) => setCallbackForm((prev) => ({ ...prev, contact: e.target.value })),
                placeholder: "Enter Number",
                className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white"
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
            "Select Order ",
            /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
          ] }),
          /* @__PURE__ */ jsxs(
            "select",
            {
              value: callbackForm.orderId,
              onChange: (e) => setCallbackForm((prev) => ({ ...prev, orderId: e.target.value })),
              className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white",
              children: [
                /* @__PURE__ */ jsx("option", { value: "", children: "Select Order" }),
                orders.map((order) => /* @__PURE__ */ jsx("option", { value: order.orderId || order._id, children: order.orderId || order._id }, order._id))
              ]
            }
          )
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-4", children: [
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
              "Preferred Time ",
              /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
            ] }),
            /* @__PURE__ */ jsxs(
              "select",
              {
                value: callbackForm.preferredSlot.timeSlot,
                onChange: (e) => setCallbackForm((prev) => ({
                  ...prev,
                  preferredSlot: { ...prev.preferredSlot, timeSlot: e.target.value }
                })),
                className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white",
                children: [
                  /* @__PURE__ */ jsx("option", { value: "", children: "Select Time Slot" }),
                  timeSlots.map((slot, idx) => {
                    const value = typeof slot === "object" ? slot.value || slot._id || slot.name : slot;
                    const label = typeof slot === "object" ? slot.label || slot.name || slot.value : slot;
                    return /* @__PURE__ */ jsx("option", { value, children: label }, idx);
                  })
                ]
              }
            )
          ] }),
          /* @__PURE__ */ jsxs("div", { children: [
            /* @__PURE__ */ jsxs("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: [
              "Reason For Callback ",
              /* @__PURE__ */ jsx("span", { className: "text-red-500", children: "*" })
            ] }),
            /* @__PURE__ */ jsxs(
              "select",
              {
                value: callbackForm.reasonCategory,
                onChange: (e) => setCallbackForm((prev) => ({ ...prev, reasonCategory: e.target.value })),
                className: "w-full border border-gray-300 rounded-lg px-3 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white",
                children: [
                  /* @__PURE__ */ jsx("option", { value: "", children: "Select Reason" }),
                  callbackReasons.map((reason, idx) => {
                    const value = typeof reason === "object" ? reason.value || reason._id || reason.name : reason;
                    const label = typeof reason === "object" ? reason.label || reason.name || reason.value : reason;
                    return /* @__PURE__ */ jsx("option", { value, children: label }, idx);
                  })
                ]
              }
            )
          ] })
        ] }),
        /* @__PURE__ */ jsx("div", { className: "flex justify-center pt-4", children: /* @__PURE__ */ jsx(
          "button",
          {
            type: "submit",
            disabled: callbacksLoading,
            className: "px-8 py-2.5 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 disabled:opacity-50",
            children: callbacksLoading ? "Submitting..." : "Request Callback"
          }
        ) })
      ] })
    ] }) }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const MyTickets = () => {
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const { isAuthenticated } = useSelector((state) => state.auth);
  const { tickets, ticketsLoading, ticketsError } = useSelector((state) => state.support);
  useEffect(() => {
    if (isAuthenticated) {
      dispatch(getMyTickets());
    } else {
      navigate("/register");
    }
  }, [dispatch, isAuthenticated, navigate]);
  const getStatusColor = (status) => {
    switch (status == null ? void 0 : status.toLowerCase()) {
      case "open":
        return "bg-green-100 text-green-700 border-green-200";
      case "pending":
        return "bg-yellow-100 text-yellow-700 border-yellow-200";
      case "closed":
        return "bg-gray-100 text-gray-700 border-gray-200";
      default:
        return "bg-blue-100 text-blue-700 border-blue-200";
    }
  };
  const formatTimeAgo = (date) => {
    if (!date) return "";
    const now = /* @__PURE__ */ new Date();
    const past = new Date(date);
    const diffMs = now - past;
    const diffMins = Math.floor(diffMs / 6e4);
    const diffHours = Math.floor(diffMs / 36e5);
    const diffDays = Math.floor(diffMs / 864e5);
    if (diffMins < 60) return `${diffMins} mins ago`;
    if (diffHours < 24) return `${diffHours}hrs Ago`;
    return `${diffDays} days ago`;
  };
  const getLastMessage = (ticket) => {
    var _a, _b;
    if (ticket.messages && ticket.messages.length > 0) {
      const lastMsg = ticket.messages[ticket.messages.length - 1];
      return ((_a = lastMsg.text) == null ? void 0 : _a.substring(0, 80)) + (((_b = lastMsg.text) == null ? void 0 : _b.length) > 80 ? "..." : "");
    }
    return ticket.subject || "No messages yet";
  };
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#f0f5fa]", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsx("div", { className: "pt-20 pb-10", children: /* @__PURE__ */ jsxs("div", { className: "max-w-4xl mx-auto px-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 mb-6", children: [
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate("/support"),
            className: "p-2 hover:bg-white rounded-full border border-gray-200 bg-white",
            children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" })
          }
        ),
        /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "My Tickets" })
      ] }),
      ticketsLoading ? /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl p-8 text-center", children: [
        /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-10 w-10 border-b-2 border-blue-600 mx-auto" }),
        /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-500", children: "Loading tickets..." })
      ] }) : ticketsError ? /* @__PURE__ */ jsx("div", { className: "bg-white rounded-xl p-8 text-center", children: /* @__PURE__ */ jsx("p", { className: "text-red-500", children: ticketsError }) }) : tickets.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl p-8 text-center", children: [
        /* @__PURE__ */ jsx(MessageSquare, { className: "w-12 h-12 text-gray-300 mx-auto mb-4" }),
        /* @__PURE__ */ jsx("p", { className: "text-gray-500 mb-4", children: "No tickets found" }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate("/support"),
            className: "px-6 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700",
            children: "Raise A Ticket"
          }
        )
      ] }) : /* @__PURE__ */ jsx("div", { className: "space-y-4", children: tickets.map((ticket) => {
        var _a, _b, _c, _d;
        return /* @__PURE__ */ jsxs(
          "div",
          {
            onClick: () => navigate(`/ticket/${ticket._id}`),
            className: "bg-white rounded-xl p-5 cursor-pointer hover:shadow-md transition-shadow",
            children: [
              /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between mb-3", children: [
                /* @__PURE__ */ jsxs("div", { children: [
                  /* @__PURE__ */ jsx("h3", { className: "font-semibold text-gray-900", children: ticket.ticketId || `TCK-${(_a = ticket._id) == null ? void 0 : _a.slice(-4).toUpperCase()}` }),
                  /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500 mt-0.5", children: [
                    (_b = ticket.subject) == null ? void 0 : _b.substring(0, 30),
                    "..."
                  ] }),
                  ticket.orderId && /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
                    "Order: ",
                    ticket.orderId
                  ] })
                ] }),
                /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
                  /* @__PURE__ */ jsx("span", { className: `inline-block px-3 py-1 rounded-full text-xs font-medium border ${getStatusColor(ticket.status)}`, children: ((_c = ticket.status) == null ? void 0 : _c.charAt(0).toUpperCase()) + ((_d = ticket.status) == null ? void 0 : _d.slice(1)) || "Open" }),
                  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-2 text-gray-400 text-xs", children: [
                    /* @__PURE__ */ jsx(Clock, { className: "w-3 h-3" }),
                    /* @__PURE__ */ jsx("span", { children: formatTimeAgo(ticket.updatedAt || ticket.createdAt) })
                  ] })
                ] })
              ] }),
              /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2 pt-3 border-t border-gray-100", children: [
                /* @__PURE__ */ jsx("div", { className: "w-6 h-6 bg-gray-100 rounded flex items-center justify-center flex-shrink-0", children: /* @__PURE__ */ jsx(MessageSquare, { className: "w-3 h-3 text-gray-500" }) }),
                /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-600", children: getLastMessage(ticket) })
              ] })
            ]
          },
          ticket._id
        );
      }) })
    ] }) }),
    /* @__PURE__ */ jsx(Footer, {})
  ] });
};
const TicketDetails = () => {
  var _a, _b, _c, _d, _e, _f;
  const navigate = distExports.useNavigate();
  const dispatch = useDispatch();
  const { id } = distExports.useParams();
  const messagesEndRef = useRef(null);
  const { user, isAuthenticated } = useSelector((state) => state.auth);
  const { currentTicket, ticketLoading, ticketError, messageLoading } = useSelector((state) => state.support);
  const [newMessage, setNewMessage] = useState("");
  const [attachments, setAttachments] = useState([]);
  useEffect(() => {
    if (!isAuthenticated) {
      navigate("/register");
      return;
    }
    if (id) {
      dispatch(getTicketDetails(id));
    }
    return () => {
      dispatch(clearCurrentTicket());
    };
  }, [dispatch, id, isAuthenticated, navigate]);
  useEffect(() => {
    scrollToBottom();
  }, [currentTicket == null ? void 0 : currentTicket.messages]);
  const scrollToBottom = () => {
    var _a2;
    (_a2 = messagesEndRef.current) == null ? void 0 : _a2.scrollIntoView({ behavior: "smooth" });
  };
  const handleSendMessage = async (e) => {
    e.preventDefault();
    if (!newMessage.trim() && attachments.length === 0) {
      toast$2.error("Please enter a message");
      return;
    }
    const result = await dispatch(addMessage({
      ticketId: id,
      text: newMessage,
      attachments
    }));
    if (!result.error) {
      setNewMessage("");
      setAttachments([]);
    }
  };
  const handleFileChange = (e) => {
    const files = Array.from(e.target.files);
    setAttachments((prev) => [...prev, ...files]);
  };
  const removeAttachment = (index) => {
    setAttachments((prev) => prev.filter((_, i) => i !== index));
  };
  const formatDateTime = (date) => {
    if (!date) return "";
    const d = new Date(date);
    return d.toLocaleDateString("en-IN", {
      day: "2-digit",
      month: "short",
      hour: "2-digit",
      minute: "2-digit",
      hour12: true
    });
  };
  const getStatusColor = (status) => {
    switch (status == null ? void 0 : status.toLowerCase()) {
      case "open":
        return "bg-green-100 text-green-700 border-green-200";
      case "pending":
        return "bg-yellow-100 text-yellow-700 border-yellow-200";
      case "closed":
        return "bg-gray-100 text-gray-700 border-gray-200";
      default:
        return "bg-blue-100 text-blue-700 border-blue-200";
    }
  };
  const isOwnMessage = (message) => {
    var _a2;
    return ((_a2 = message.sender) == null ? void 0 : _a2._id) === (user == null ? void 0 : user._id) || message.senderType === "user";
  };
  const getInitials = (name) => {
    return name.split(" ").map((n) => n[0]).join("").toUpperCase().slice(0, 2);
  };
  if (ticketLoading) {
    return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#f0f5fa]", children: [
      /* @__PURE__ */ jsx(Navbar, {}),
      /* @__PURE__ */ jsx("div", { className: "pt-20 flex items-center justify-center h-[80vh]", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
        /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-10 w-10 border-b-2 border-blue-600 mx-auto" }),
        /* @__PURE__ */ jsx("p", { className: "mt-4 text-gray-500", children: "Loading ticket..." })
      ] }) })
    ] });
  }
  if (ticketError) {
    return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#f0f5fa]", children: [
      /* @__PURE__ */ jsx(Navbar, {}),
      /* @__PURE__ */ jsx("div", { className: "pt-20 flex items-center justify-center h-[80vh]", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
        /* @__PURE__ */ jsx("p", { className: "text-red-500 mb-4", children: ticketError }),
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate("/my-tickets"),
            className: "px-6 py-2 bg-blue-600 text-white rounded-lg",
            children: "Back to Tickets"
          }
        )
      ] }) })
    ] });
  }
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-[#f0f5fa] flex flex-col", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "pt-20 flex-1 flex flex-col max-w-4xl mx-auto w-full px-4", children: [
      /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 py-4", children: [
        /* @__PURE__ */ jsx(
          "button",
          {
            onClick: () => navigate("/my-tickets"),
            className: "p-2 hover:bg-white rounded-full",
            children: /* @__PURE__ */ jsx(ArrowLeft, { className: "w-5 h-5 text-gray-700" })
          }
        ),
        /* @__PURE__ */ jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Back To My Tickets" })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "bg-white rounded-xl p-5 mb-4", children: /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between", children: [
        /* @__PURE__ */ jsxs("div", { children: [
          /* @__PURE__ */ jsx("h2", { className: "font-semibold text-gray-900 text-lg", children: (currentTicket == null ? void 0 : currentTicket.ticketId) || `TCK-${(_a = currentTicket == null ? void 0 : currentTicket._id) == null ? void 0 : _a.slice(-4).toUpperCase()}` }),
          /* @__PURE__ */ jsx("p", { className: "text-sm text-gray-500 mt-1", children: currentTicket == null ? void 0 : currentTicket.subject }),
          (((_b = currentTicket == null ? void 0 : currentTicket.booking) == null ? void 0 : _b.orderId) || (currentTicket == null ? void 0 : currentTicket.orderId)) && /* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-500", children: [
            "Order: ",
            ((_c = currentTicket.booking) == null ? void 0 : _c.orderId) || currentTicket.orderId
          ] })
        ] }),
        /* @__PURE__ */ jsxs("div", { className: "text-right", children: [
          /* @__PURE__ */ jsx("span", { className: `inline-block px-3 py-1 rounded-full text-xs font-medium border ${getStatusColor(currentTicket == null ? void 0 : currentTicket.status)}`, children: ((_d = currentTicket == null ? void 0 : currentTicket.status) == null ? void 0 : _d.charAt(0).toUpperCase()) + ((_e = currentTicket == null ? void 0 : currentTicket.status) == null ? void 0 : _e.slice(1)) || "Open" }),
          /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 mt-2 text-gray-400 text-xs justify-end", children: [
            /* @__PURE__ */ jsx(Clock, { className: "w-3 h-3" }),
            /* @__PURE__ */ jsxs("span", { children: [
              "Created: ",
              formatDateTime(currentTicket == null ? void 0 : currentTicket.createdAt)
            ] })
          ] })
        ] })
      ] }) }),
      /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-xl flex-1 flex flex-col min-h-[400px] max-h-[500px]", children: [
        /* @__PURE__ */ jsxs("div", { className: "flex-1 overflow-y-auto p-5 space-y-6", children: [
          (_f = currentTicket == null ? void 0 : currentTicket.messages) == null ? void 0 : _f.map((message, index) => /* @__PURE__ */ jsx(
            "div",
            {
              className: `flex ${isOwnMessage(message) ? "justify-end" : "justify-start"}`,
              children: /* @__PURE__ */ jsxs("div", { className: `flex gap-3 max-w-[70%] ${isOwnMessage(message) ? "flex-row-reverse" : ""}`, children: [
                /* @__PURE__ */ jsx("div", { className: `w-10 h-10 rounded-full flex items-center justify-center flex-shrink-0 text-sm font-medium ${isOwnMessage(message) ? "bg-blue-100 text-blue-600" : "bg-gray-100 text-gray-600"}`, children: isOwnMessage(message) ? getInitials((user == null ? void 0 : user.fullName) || "You") : "GC" }),
                /* @__PURE__ */ jsxs("div", { className: isOwnMessage(message) ? "text-right" : "", children: [
                  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-500 mb-1", children: isOwnMessage(message) ? "You" : "GoCabs Support" }),
                  /* @__PURE__ */ jsx("div", { className: `rounded-lg px-4 py-3 ${isOwnMessage(message) ? "bg-blue-500 text-white" : "bg-gray-100 text-gray-800"}`, children: /* @__PURE__ */ jsx("p", { className: "text-sm", children: message.text }) }),
                  /* @__PURE__ */ jsx("p", { className: "text-xs text-gray-400 mt-1", children: formatDateTime(message.createdAt) }),
                  message.attachments && message.attachments.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mt-2", children: message.attachments.map((att, idx) => /* @__PURE__ */ jsxs(
                    "a",
                    {
                      href: att.url || att,
                      target: "_blank",
                      rel: "noopener noreferrer",
                      className: "text-xs text-blue-500 underline",
                      children: [
                        "Attachment ",
                        idx + 1
                      ]
                    },
                    idx
                  )) })
                ] })
              ] })
            },
            message._id || index
          )),
          /* @__PURE__ */ jsx("div", { ref: messagesEndRef })
        ] }),
        (currentTicket == null ? void 0 : currentTicket.status) !== "closed" && /* @__PURE__ */ jsxs("div", { className: "border-t p-4", children: [
          attachments.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2 mb-2", children: attachments.map((file, idx) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 bg-gray-100 px-2 py-1 rounded text-sm", children: [
            /* @__PURE__ */ jsx("span", { className: "text-xs", children: file.name }),
            /* @__PURE__ */ jsx("button", { type: "button", onClick: () => removeAttachment(idx), children: /* @__PURE__ */ jsx(X, { className: "w-3 h-3 text-gray-500" }) })
          ] }, idx)) }),
          /* @__PURE__ */ jsxs("form", { onSubmit: handleSendMessage, className: "flex items-center gap-3", children: [
            /* @__PURE__ */ jsx(
              "input",
              {
                type: "text",
                value: newMessage,
                onChange: (e) => setNewMessage(e.target.value),
                placeholder: "Type Your Message..",
                className: "flex-1 border border-gray-200 rounded-lg px-4 py-2.5 text-sm focus:ring-2 focus:ring-blue-500 focus:border-blue-500 text-gray-900 bg-white"
              }
            ),
            /* @__PURE__ */ jsxs("label", { className: "p-2.5 border border-gray-200 rounded-lg cursor-pointer hover:bg-gray-50", children: [
              /* @__PURE__ */ jsx(Paperclip, { className: "w-5 h-5 text-gray-500" }),
              /* @__PURE__ */ jsx(
                "input",
                {
                  type: "file",
                  multiple: true,
                  onChange: handleFileChange,
                  className: "hidden",
                  accept: "image/*,.pdf,.doc,.docx"
                }
              )
            ] }),
            /* @__PURE__ */ jsxs(
              "button",
              {
                type: "submit",
                disabled: messageLoading,
                className: "flex items-center gap-2 px-6 py-2.5 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 disabled:opacity-50",
                children: [
                  messageLoading ? "Sending..." : "Send",
                  /* @__PURE__ */ jsx(Send, { className: "w-4 h-4" })
                ]
              }
            )
          ] })
        ] }),
        (currentTicket == null ? void 0 : currentTicket.status) === "closed" && /* @__PURE__ */ jsx("div", { className: "border-t p-4 text-center text-gray-500 text-sm", children: "This ticket has been closed. Please create a new ticket if you need further assistance." })
      ] })
    ] })
  ] });
};
const FAQPage = () => {
  const dispatch = useDispatch();
  const [searchQuery, setSearchQuery] = useState("");
  const [selectedCategory, setSelectedCategory] = useState("all");
  const [expandedFAQs, setExpandedFAQs] = useState(/* @__PURE__ */ new Set());
  const [feedbackGiven, setFeedbackGiven] = useState(/* @__PURE__ */ new Set());
  const {
    groupedFAQs,
    groupedLoading,
    categories,
    searchResults,
    searchLoading,
    feedbackLoading
  } = useSelector((state) => state.faq);
  useEffect(() => {
    dispatch(getFAQsByCategory());
    dispatch(getFAQCategories());
  }, [dispatch]);
  const handleSearch = (e) => {
    e.preventDefault();
    if (searchQuery.trim()) {
      dispatch(searchFAQs({ query: searchQuery, limit: 20 }));
    }
  };
  const handleClearSearch = () => {
    setSearchQuery("");
    dispatch(resetSearchResults());
  };
  const toggleFAQ = (faqId) => {
    const newExpanded = new Set(expandedFAQs);
    if (newExpanded.has(faqId)) {
      newExpanded.delete(faqId);
    } else {
      newExpanded.add(faqId);
    }
    setExpandedFAQs(newExpanded);
  };
  const handleFeedback = (faqId, helpful) => {
    if (!feedbackGiven.has(faqId)) {
      dispatch(markFAQHelpful({ id: faqId, helpful }));
      setFeedbackGiven(new Set(feedbackGiven).add(faqId));
    }
  };
  const categoryLabels = {
    booking: "Booking",
    payment: "Payment",
    cancellation: "Cancellation",
    pricing: "Pricing",
    vehicles: "Vehicles",
    general: "General",
    support: "Support"
  };
  const categoryIcons = {
    booking: "📅",
    payment: "💳",
    cancellation: "🔄",
    pricing: "💰",
    vehicles: "🚗",
    general: "❓",
    support: "🎧"
  };
  const getFilteredFAQs = () => {
    if (searchResults.length > 0) {
      return { search: searchResults };
    }
    if (selectedCategory === "all") {
      return groupedFAQs;
    }
    return { [selectedCategory]: groupedFAQs[selectedCategory] || [] };
  };
  const filteredFAQs = getFilteredFAQs();
  return /* @__PURE__ */ jsxs("div", { className: "faq-page", children: [
    /* @__PURE__ */ jsx("div", { className: "faq-hero", children: /* @__PURE__ */ jsxs("div", { className: "faq-hero-content", children: [
      /* @__PURE__ */ jsx("h1", { children: "Frequently Asked Questions" }),
      /* @__PURE__ */ jsx("p", { children: "Find answers to common questions about GoCabs" }),
      /* @__PURE__ */ jsxs("form", { onSubmit: handleSearch, className: "faq-search-form", children: [
        /* @__PURE__ */ jsxs("div", { className: "search-input-wrapper", children: [
          /* @__PURE__ */ jsx("span", { className: "search-icon", children: "🔍" }),
          /* @__PURE__ */ jsx(
            "input",
            {
              type: "text",
              placeholder: "Search for answers...",
              value: searchQuery,
              onChange: (e) => setSearchQuery(e.target.value),
              className: "search-input"
            }
          ),
          searchQuery && /* @__PURE__ */ jsx(
            "button",
            {
              type: "button",
              onClick: handleClearSearch,
              className: "clear-search-btn",
              children: "×"
            }
          )
        ] }),
        /* @__PURE__ */ jsx("button", { type: "submit", className: "search-btn", disabled: searchLoading, children: searchLoading ? "Searching..." : "Search" })
      ] })
    ] }) }),
    /* @__PURE__ */ jsxs("div", { className: "faq-container", children: [
      /* @__PURE__ */ jsxs("div", { className: "faq-sidebar", children: [
        /* @__PURE__ */ jsx("h3", { children: "Categories" }),
        /* @__PURE__ */ jsxs("div", { className: "category-list", children: [
          /* @__PURE__ */ jsxs(
            "button",
            {
              className: `category-btn ${selectedCategory === "all" ? "active" : ""}`,
              onClick: () => {
                setSelectedCategory("all");
                handleClearSearch();
              },
              children: [
                /* @__PURE__ */ jsx("span", { className: "category-icon", children: "📋" }),
                /* @__PURE__ */ jsx("span", { className: "category-label", children: "All FAQs" }),
                /* @__PURE__ */ jsx("span", { className: "category-count", children: Object.values(groupedFAQs).reduce((sum, faqs) => sum + faqs.length, 0) })
              ]
            }
          ),
          categories.map((cat) => /* @__PURE__ */ jsxs(
            "button",
            {
              className: `category-btn ${selectedCategory === cat.category ? "active" : ""}`,
              onClick: () => {
                setSelectedCategory(cat.category);
                handleClearSearch();
              },
              children: [
                /* @__PURE__ */ jsx("span", { className: "category-icon", children: categoryIcons[cat.category] }),
                /* @__PURE__ */ jsx("span", { className: "category-label", children: categoryLabels[cat.category] }),
                /* @__PURE__ */ jsx("span", { className: "category-count", children: cat.count })
              ]
            },
            cat.category
          ))
        ] })
      ] }),
      /* @__PURE__ */ jsx("div", { className: "faq-content", children: groupedLoading ? /* @__PURE__ */ jsxs("div", { className: "faq-loading", children: [
        /* @__PURE__ */ jsx("div", { className: "spinner" }),
        /* @__PURE__ */ jsx("p", { children: "Loading FAQs..." })
      ] }) : Object.keys(filteredFAQs).length === 0 ? /* @__PURE__ */ jsx("div", { className: "faq-empty", children: /* @__PURE__ */ jsx("p", { children: "No FAQs found" }) }) : Object.entries(filteredFAQs).map(([category, faqs]) => /* @__PURE__ */ jsxs("div", { className: "faq-category-section", children: [
        searchResults.length === 0 && /* @__PURE__ */ jsxs("h2", { className: "category-title", children: [
          /* @__PURE__ */ jsx("span", { className: "category-icon-large", children: categoryIcons[category] || "📋" }),
          categoryLabels[category] || category
        ] }),
        /* @__PURE__ */ jsx("div", { className: "faq-list", children: faqs.map((faq2) => /* @__PURE__ */ jsxs(
          "div",
          {
            className: `faq-item ${expandedFAQs.has(faq2._id) ? "expanded" : ""}`,
            children: [
              /* @__PURE__ */ jsxs(
                "button",
                {
                  className: "faq-question",
                  onClick: () => toggleFAQ(faq2._id),
                  children: [
                    /* @__PURE__ */ jsx("span", { className: "question-text", children: faq2.question }),
                    /* @__PURE__ */ jsx("span", { className: "expand-icon", children: expandedFAQs.has(faq2._id) ? "−" : "+" })
                  ]
                }
              ),
              expandedFAQs.has(faq2._id) && /* @__PURE__ */ jsxs("div", { className: "faq-answer", children: [
                /* @__PURE__ */ jsx("p", { children: faq2.answer }),
                /* @__PURE__ */ jsxs("div", { className: "faq-feedback", children: [
                  /* @__PURE__ */ jsx("span", { className: "feedback-label", children: "Was this helpful?" }),
                  /* @__PURE__ */ jsxs("div", { className: "feedback-buttons", children: [
                    /* @__PURE__ */ jsx(
                      "button",
                      {
                        onClick: () => handleFeedback(faq2._id, true),
                        disabled: feedbackGiven.has(faq2._id) || feedbackLoading,
                        className: "feedback-btn helpful",
                        children: "👍 Yes"
                      }
                    ),
                    /* @__PURE__ */ jsx(
                      "button",
                      {
                        onClick: () => handleFeedback(faq2._id, false),
                        disabled: feedbackGiven.has(faq2._id) || feedbackLoading,
                        className: "feedback-btn not-helpful",
                        children: "👎 No"
                      }
                    )
                  ] }),
                  feedbackGiven.has(faq2._id) && /* @__PURE__ */ jsx("span", { className: "feedback-thanks", children: "Thank you for your feedback!" })
                ] })
              ] })
            ]
          },
          faq2._id
        )) })
      ] }, category)) })
    ] }),
    /* @__PURE__ */ jsxs("div", { className: "faq-support-section", children: [
      /* @__PURE__ */ jsx("h2", { children: "Still have questions?" }),
      /* @__PURE__ */ jsx("p", { children: "Can't find the answer you're looking for? Our support team is here to help." }),
      /* @__PURE__ */ jsx("button", { className: "contact-support-btn", children: "Contact Support" })
    ] })
  ] });
};
const Home = () => {
  const navigate = distExports.useNavigate();
  return /* @__PURE__ */ jsxs("div", { className: "min-h-screen bg-gray-50", children: [
    /* @__PURE__ */ jsx(Navbar, {}),
    /* @__PURE__ */ jsxs("div", { className: "pt-16", children: [
      /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(HeroSection, { onSearch: (searchParams) => navigate("/results", { state: { searchParams } }) }) }),
      /* @__PURE__ */ jsx("div", { className: "block md:hidden", children: /* @__PURE__ */ jsx(HeroSectionMobile, {}) })
    ] }),
    /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(CabFaq, {}) }),
    /* @__PURE__ */ jsx("div", { className: "block md:hidden", children: /* @__PURE__ */ jsx(FAQMobile, {}) }),
    /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(CabRoutes, {}) }),
    /* @__PURE__ */ jsx("div", { className: "block md:hidden", children: /* @__PURE__ */ jsx(RoutesMobile, {}) }),
    /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(Footer, {}) })
  ] });
};
const isSSR = typeof window === "undefined";
const ProfileCompletionChecker = () => {
  const { user, isAuthenticated } = useSelector((state) => state.auth);
  const location = distExports.useLocation();
  const navigate = distExports.useNavigate();
  useEffect(() => {
    var _a, _b;
    if (isSSR) return;
    if (isAuthenticated && user) {
      const isEmailPlaceholder = (_a = user.email) == null ? void 0 : _a.startsWith("user_");
      const isAddressMissing = !((_b = user.fullAddress) == null ? void 0 : _b.address);
      const restrictedPaths = ["/profile", "/logout", "/support"];
      if ((isEmailPlaceholder || isAddressMissing) && !restrictedPaths.includes(location.pathname)) {
        toast$2("Please complete your profile details", { icon: "👤", id: "profile-prompt" });
        navigate("/profile");
      }
    }
  }, [isAuthenticated, user, location.pathname, navigate]);
  return null;
};
const AppRoutes = () => {
  var _a;
  const dispatch = useDispatch();
  const { settings } = useSelector((state) => state.setting || {});
  const { socialConfig } = useSelector((state) => state.auth);
  const { isFetched } = useSelector((state) => state.language);
  const { footer: footer2, loading: cmsLoading } = useSelector((state) => state.cms || {});
  useEffect(() => {
    if (isSSR) return;
    if (!settings || Object.keys(settings).length === 0) {
      dispatch(fetchSettings());
    }
    if (!socialConfig || Object.keys(socialConfig).length === 0) {
      dispatch(getSocialConfig());
    }
    if (!isFetched) {
      dispatch(fetchGlobalLanguage());
    }
    if (!footer2 || footer2.length === 0) {
      dispatch(getFooter());
    }
  }, [dispatch]);
  useEffect(() => {
    var _a2, _b;
    if (isSSR) return;
    if (settings) {
      if ((_a2 = settings.general) == null ? void 0 : _a2.storeName) {
        document.title = settings.general.storeName;
      }
      if ((_b = settings.design) == null ? void 0 : _b.favicon) {
        let link = document.querySelector("link[rel~='icon']");
        if (!link) {
          link = document.createElement("link");
          link.rel = "icon";
          document.getElementsByTagName("head")[0].appendChild(link);
        }
        link.href = settings.design.favicon;
      }
    }
  }, [settings]);
  const googleClientId = ((_a = socialConfig == null ? void 0 : socialConfig.google) == null ? void 0 : _a.clientId) || "";
  const [showLoader, setShowLoader] = React__default.useState(false);
  useEffect(() => {
    if (!isFetched) {
      setShowLoader(true);
    } else {
      setShowLoader(false);
    }
  }, [isFetched]);
  if (!isSSR && showLoader) {
    return /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center min-h-screen bg-gray-50", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-4", children: [
      /* @__PURE__ */ jsx("div", { className: "animate-spin rounded-full h-12 w-12 border-b-2 border-green-600" }),
      /* @__PURE__ */ jsx("p", { className: "text-gray-500 font-medium", children: "Loading..." })
    ] }) });
  }
  return /* @__PURE__ */ jsxs(GoogleOAuthProvider, { clientId: googleClientId, children: [
    /* @__PURE__ */ jsx(ProfileCompletionChecker, {}),
    /* @__PURE__ */ jsx(
      Toaster,
      {
        position: "top-center",
        reverseOrder: false,
        gutter: 8,
        containerClassName: "",
        containerStyle: {},
        toastOptions: {
          duration: 4e3,
          style: { background: "#363636", color: "#fff" },
          success: { duration: 3e3, style: { background: "#10B981", color: "#fff" } },
          error: { duration: 5e3, style: { background: "#EF4444", color: "#fff" } },
          loading: { style: { background: "#3B82F6", color: "#fff" } }
        }
      }
    ),
    /* @__PURE__ */ jsxs(distExports.Routes, { children: [
      /* @__PURE__ */ jsx(distExports.Route, { path: "/", element: /* @__PURE__ */ jsx(Home, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/airport", element: /* @__PURE__ */ jsx(Airport, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/airport/:slug", element: /* @__PURE__ */ jsx(Airport, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/top", element: /* @__PURE__ */ jsx(Top, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/top/:slug", element: /* @__PURE__ */ jsx(Top, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/cities", element: /* @__PURE__ */ jsx(Cities, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/cities/:slug", element: /* @__PURE__ */ jsx(Cities, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/city-taxi/:slug", element: /* @__PURE__ */ jsx(CityTaxiService, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/top-mobile", element: /* @__PURE__ */ jsx(TopMobile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/cities-mobile", element: /* @__PURE__ */ jsx(CitiesMobile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/airport-mobile", element: /* @__PURE__ */ jsx(AirportMobile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/details-mobile/:id", element: /* @__PURE__ */ jsx(ResultDetailMobile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/search-details-mobile", element: /* @__PURE__ */ jsx(SearchDetailMobile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/results", element: /* @__PURE__ */ jsxs(Fragment, { children: [
        /* @__PURE__ */ jsx("div", { className: "hidden md:block", children: /* @__PURE__ */ jsx(CabResults, {}) }),
        /* @__PURE__ */ jsx("div", { className: "block md:hidden", children: /* @__PURE__ */ jsx(ResultsPageMobile, {}) })
      ] }) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/details/:id", element: /* @__PURE__ */ jsx(DetailPage, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/payment/:id", element: /* @__PURE__ */ jsx(PaymentPage, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/my-trips", element: /* @__PURE__ */ jsx(MyTrips, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/booking/:id", element: /* @__PURE__ */ jsx(BookingDetails, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/profile", element: /* @__PURE__ */ jsx(Profile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/register", element: /* @__PURE__ */ jsx(Register, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/results-mobile", element: /* @__PURE__ */ jsx(ResultsPageMobile, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/support", element: /* @__PURE__ */ jsx(Support, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/my-tickets", element: /* @__PURE__ */ jsx(MyTickets, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/ticket/:id", element: /* @__PURE__ */ jsx(TicketDetails, {}) }),
      /* @__PURE__ */ jsx(distExports.Route, { path: "/faqs", element: /* @__PURE__ */ jsx(FAQPage, {}) })
    ] })
  ] });
};
const App = () => {
  return /* @__PURE__ */ jsx(AppRoutes, {});
};
function render(url, initialData) {
  const store = makeStore(initialData);
  const html = ReactDOMServer.renderToString(
    /* @__PURE__ */ jsx(Provider_default, { store, children: /* @__PURE__ */ jsx(distExports.StaticRouter, { location: url, children: /* @__PURE__ */ jsx(App, {}) }) })
  );
  return { html, state: store.getState() };
}
export {
  render
};
