import { jsx, jsxs, Fragment } from "react/jsx-runtime";
import { createRootRoute, Link, Outlet, HeadContent, Scripts, createFileRoute, lazyRouteComponent, createRouter, useRouter } from "@tanstack/react-router";
import { useState, useRef, useEffect } from "react";
import { Toaster as Toaster$1 } from "sonner";
const appCss = "/assets/styles-BIIFPO_2.css";
const Toaster = ({ ...props }) => {
  return /* @__PURE__ */ jsx(
    Toaster$1,
    {
      className: "toaster group",
      toastOptions: {
        classNames: {
          toast: "group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",
          description: "group-[.toast]:text-muted-foreground",
          actionButton: "group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",
          cancelButton: "group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"
        }
      },
      ...props
    }
  );
};
const splashVideo = "/assets/iqraa-splash-jJrjwHpa.mp4";
function SplashScreen() {
  const [mounted, setMounted] = useState(true);
  const [visible, setVisible] = useState(true);
  const videoRef = useRef(null);
  useEffect(() => {
    if (typeof window === "undefined") return;
    const v = videoRef.current;
    let playVideo;
    if (v) {
      v.muted = true;
      v.currentTime = 0;
      playVideo = () => {
        const p = v.play();
        if (p && typeof p.catch === "function") p.catch(() => {
        });
      };
      playVideo();
      v.addEventListener("canplay", playVideo, { once: true });
    }
    const fadeTimer = window.setTimeout(() => {
      setVisible(false);
      window.dispatchEvent(new CustomEvent("splash:done"));
    }, 3400);
    const unmountTimer = window.setTimeout(() => setMounted(false), 4400);
    return () => {
      if (v && playVideo) v.removeEventListener("canplay", playVideo);
      window.clearTimeout(fadeTimer);
      window.clearTimeout(unmountTimer);
    };
  }, []);
  if (!mounted) return null;
  return /* @__PURE__ */ jsx(
    "div",
    {
      "aria-hidden": true,
      className: `fixed inset-0 z-[200] flex items-center justify-center ${visible ? "opacity-100" : "opacity-0 pointer-events-none"}`,
      style: {
        backgroundColor: "#ffffff",
        transition: "opacity 900ms ease-out"
      },
      children: /* @__PURE__ */ jsx(
        "video",
        {
          ref: videoRef,
          src: splashVideo,
          autoPlay: true,
          muted: true,
          playsInline: true,
          preload: "auto",
          className: "w-[70vmin] h-[70vmin] max-w-[520px] max-h-[520px] object-contain"
        }
      )
    }
  );
}
function NotFoundComponent() {
  return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center bg-background px-4", children: /* @__PURE__ */ jsxs("div", { className: "max-w-md text-center", children: [
    /* @__PURE__ */ jsx("h1", { className: "text-7xl font-bold text-foreground", children: "404" }),
    /* @__PURE__ */ jsx("h2", { className: "mt-4 text-xl font-semibold text-foreground", children: "Page not found" }),
    /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "The page you're looking for doesn't exist or has been moved." }),
    /* @__PURE__ */ jsx("div", { className: "mt-6", children: /* @__PURE__ */ jsx(
      Link,
      {
        to: "/",
        className: "inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",
        children: "Go home"
      }
    ) })
  ] }) });
}
const Route$3 = createRootRoute({
  head: () => ({
    meta: [
      { charSet: "utf-8" },
      { name: "viewport", content: "width=device-width, initial-scale=1" },
      { title: "Iqraa - Your Quranic Companion" },
      { name: "description", content: "Live Quran sessions in audio and video with a certified teacher" },
      { name: "author", content: "Lovable" },
      { property: "og:title", content: "Iqraa - Your Quranic Companion" },
      { property: "og:description", content: "Live Quran sessions in audio and video with a certified teacher" },
      { property: "og:type", content: "website" },
      { name: "twitter:card", content: "summary" },
      { name: "twitter:site", content: "@Lovable" },
      { name: "twitter:title", content: "Iqraa - Your Quranic Companion" },
      { name: "twitter:description", content: "Live Quran sessions in audio and video with a certified teacher" },
      { property: "og:image", content: "https://storage.googleapis.com/gpt-engineer-file-uploads/pAwg3Zu1ayRpUpqELOn7j4HCygD3/social-images/social-1776898758575-Logo_with_Text_PNG.webp" },
      { name: "twitter:image", content: "https://storage.googleapis.com/gpt-engineer-file-uploads/pAwg3Zu1ayRpUpqELOn7j4HCygD3/social-images/social-1776898758575-Logo_with_Text_PNG.webp" }
    ],
    links: [
      {
        rel: "stylesheet",
        href: appCss
      },
      { rel: "preconnect", href: "https://fonts.googleapis.com" },
      { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" },
      {
        rel: "preload",
        href: "https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Inter:wght@400;500;600;700&display=swap",
        as: "style"
      },
      {
        rel: "stylesheet",
        href: "https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Inter:wght@400;500;600;700&display=swap",
        media: "print",
        onLoad: "this.media='all'"
      }
    ]
  }),
  shellComponent: RootShell,
  component: RootComponent,
  notFoundComponent: NotFoundComponent
});
function RootShell({ children }) {
  return /* @__PURE__ */ jsxs("html", { lang: "ar", dir: "rtl", children: [
    /* @__PURE__ */ jsx("head", { children: /* @__PURE__ */ jsx(HeadContent, {}) }),
    /* @__PURE__ */ jsxs("body", { children: [
      children,
      /* @__PURE__ */ jsx(Scripts, {})
    ] })
  ] });
}
function RootComponent() {
  const [hydrated, setHydrated] = useState(false);
  useEffect(() => {
    setHydrated(true);
  }, []);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    hydrated && /* @__PURE__ */ jsx(SplashScreen, {}),
    /* @__PURE__ */ jsx("div", { style: { visibility: hydrated ? "visible" : "hidden" }, children: hydrated ? /* @__PURE__ */ jsx(Outlet, {}) : null }),
    /* @__PURE__ */ jsx(Toaster, {})
  ] });
}
const $$splitComponentImporter$2 = () => import("./terms-C5129FUb.js");
const Route$2 = createFileRoute("/terms")({
  head: () => ({
    meta: [{
      title: "الشروط والأحكام — إقراء"
    }, {
      name: "description",
      content: "الشروط والأحكام الخاصة باستخدام خدمات إقراء لتقنية المعلومات."
    }, {
      property: "og:title",
      content: "الشروط والأحكام — إقراء"
    }, {
      property: "og:description",
      content: "الشروط والأحكام الخاصة باستخدام خدمات إقراء لتقنية المعلومات."
    }]
  }),
  component: lazyRouteComponent($$splitComponentImporter$2, "component")
});
const $$splitComponentImporter$1 = () => import("./privacy-DWm7Vc15.js");
const Route$1 = createFileRoute("/privacy")({
  head: () => ({
    meta: [{
      title: "سياسة الخصوصية — إقراء"
    }, {
      name: "description",
      content: "سياسة الخصوصية الخاصة بتطبيق إقراء وكيفية حماية بيانات المستخدمين."
    }, {
      property: "og:title",
      content: "سياسة الخصوصية — إقراء"
    }, {
      property: "og:description",
      content: "سياسة الخصوصية الخاصة بتطبيق إقراء وكيفية حماية بيانات المستخدمين."
    }]
  }),
  component: lazyRouteComponent($$splitComponentImporter$1, "component")
});
const $$splitComponentImporter = () => import("./index-7ittRxSa.js");
const Route = createFileRoute("/")({
  head: () => ({
    meta: [{
      title: "Iqraa — Read, Reflect, Grow"
    }, {
      name: "description",
      content: "Iqraa is a beautifully crafted mobile app to deepen your daily reading and reflection journey."
    }, {
      property: "og:title",
      content: "Iqraa — Read, Reflect, Grow"
    }, {
      property: "og:description",
      content: "A beautifully crafted mobile app for daily reading and reflection."
    }]
  }),
  component: lazyRouteComponent($$splitComponentImporter, "component")
});
const TermsRoute = Route$2.update({
  id: "/terms",
  path: "/terms",
  getParentRoute: () => Route$3
});
const PrivacyRoute = Route$1.update({
  id: "/privacy",
  path: "/privacy",
  getParentRoute: () => Route$3
});
const IndexRoute = Route.update({
  id: "/",
  path: "/",
  getParentRoute: () => Route$3
});
const rootRouteChildren = {
  IndexRoute,
  PrivacyRoute,
  TermsRoute
};
const routeTree = Route$3._addFileChildren(rootRouteChildren)._addFileTypes();
function DefaultErrorComponent({ error, reset }) {
  const router = useRouter();
  return /* @__PURE__ */ jsx("div", { className: "flex min-h-screen items-center justify-center bg-background px-4", children: /* @__PURE__ */ jsxs("div", { className: "max-w-md text-center", children: [
    /* @__PURE__ */ jsx("div", { className: "mx-auto mb-6 flex h-16 w-16 items-center justify-center rounded-full bg-destructive/10", children: /* @__PURE__ */ jsx(
      "svg",
      {
        xmlns: "http://www.w3.org/2000/svg",
        className: "h-8 w-8 text-destructive",
        fill: "none",
        viewBox: "0 0 24 24",
        stroke: "currentColor",
        strokeWidth: 2,
        children: /* @__PURE__ */ jsx(
          "path",
          {
            strokeLinecap: "round",
            strokeLinejoin: "round",
            d: "M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"
          }
        )
      }
    ) }),
    /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold tracking-tight text-foreground", children: "Something went wrong" }),
    /* @__PURE__ */ jsx("p", { className: "mt-2 text-sm text-muted-foreground", children: "An unexpected error occurred. Please try again." }),
    false,
    /* @__PURE__ */ jsxs("div", { className: "mt-6 flex items-center justify-center gap-3", children: [
      /* @__PURE__ */ jsx(
        "button",
        {
          onClick: () => {
            router.invalidate();
            reset();
          },
          className: "inline-flex items-center justify-center rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90",
          children: "Try again"
        }
      ),
      /* @__PURE__ */ jsx(
        "a",
        {
          href: "/",
          className: "inline-flex items-center justify-center rounded-md border border-input bg-background px-4 py-2 text-sm font-medium text-foreground transition-colors hover:bg-accent",
          children: "Go home"
        }
      )
    ] })
  ] }) });
}
const getRouter = () => {
  const router = createRouter({
    routeTree,
    context: {},
    scrollRestoration: true,
    defaultPreloadStaleTime: 0,
    defaultErrorComponent: DefaultErrorComponent
  });
  return router;
};
export {
  getRouter
};
