import{j as e}from"./radix-ui-CVZWoPyd.js";import{r as s}from"./react-vendor-BmlOtb7g.js";import{a as t,u as a,L as r}from"./react-router-DzDVDRUd.js";import{u as i,a as n,D as l,G as o,B as c,L as d,d as m}from"./index-BCSgDlp8.js";import{u as x}from"./use-mobile-onbIdywO.js";import{C as h}from"./CheckoutButton-BXcL0vXQ.js";import{M as g,W as p,I as u,C as b,a as j}from"./wrench-n19foI4n.js";import{X as f}from"./x-DIEzjPMA.js";import{L as y,a as v}from"./log-out-DrMwdybL.js";import{B as N}from"./briefcase-Cj6O7NU7.js";import{C as w}from"./circle-plus-C5zM2HoU.js";import{S as k}from"./sparkles-D1jOictl.js";import{T as C}from"./trending-up-DMpQ-MB3.js";import{B as S}from"./building-2-xmYyS5DZ.js";import{B}from"./book-open-D7nUFbtH.js";import{S as P}from"./settings-BQk8nNSr.js";import{C as G}from"./chevron-right-D_Z5YBDv.js";import{C as M}from"./chevron-left-D5q9zZf8.js";import{C as L}from"./credit-card-CUy9-vWB.js";const T=[{name:"Marketing Plan Templates",href:"/marketing-plan-templates",icon:C,badge:void 0},{name:"Business Plan Templates",href:"/business-plan-templates",icon:S,badge:void 0},{name:"Financial Plan Templates",href:"/financial-plan-templates",icon:l,badge:"New"},{name:"Funding Guide Templates",href:"/funding-guide-templates",icon:o,badge:"New"},{name:"Marketing Tools",href:"/marketing-tools",icon:p,badge:void 0},{name:"Hero Section Examples",href:"/landing-page-examples",icon:u,badge:"New"},{name:"Calculators",href:"/marketing-calculators",icon:b,badge:void 0},{name:"Blog",href:"/blog",icon:B,badge:void 0}],F=[{name:"Support",href:"/support",icon:j,badge:void 0},{name:"Settings",href:"/app/settings",icon:P,badge:void 0}];function z({children:s,href:t,icon:i,badge:n,collapsed:l,special:o,onClick:c}){const{pathname:d}=a(),h=d===t,g="Soon"===n,p=x(),u=m("group flex items-center gap-x-2 rounded-lg px-2.5 py-2 text-[13px] font-medium relative",o?"bg-blue-600 hover:bg-blue-700 text-white shadow-lg hover:shadow-xl transform hover:scale-105 transition-all duration-200":p?"text-gray-800":"text-gray-300",g?"opacity-50 cursor-not-allowed":!o&&h?p?"bg-blue-50 text-blue-700":"bg-blue-900/30 text-white":!o&&(p?"hover:bg-gray-50 hover:text-blue-600":"hover:bg-blue-900/20 hover:text-white"));return g?e.jsxs("div",{className:u,children:[e.jsx(i,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"flex-1 truncate",children:s}),n&&e.jsx("span",{className:"absolute right-1.5 top-1/2 -translate-y-1/2 inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium bg-gray-600/30 text-gray-200 ring-1 ring-inset ring-gray-400/50",children:n})]}):e.jsxs(r,{to:t,className:u,onClick:c,children:[e.jsx(i,{className:m("h-4 w-4 shrink-0",o?"text-white":h?p?"text-blue-600":"text-white":p?"text-gray-600":"text-gray-200 group-hover:text-white")}),e.jsx("span",{className:m("flex-1 truncate transition-opacity duration-200",l&&"opacity-0 w-0"),children:s}),n&&e.jsx("span",{className:m("absolute right-1.5 top-1/2 -translate-y-1/2 inline-flex items-center rounded-md px-1.5 py-0.5 text-xs font-medium",o?"bg-yellow-400 text-yellow-900 ring-1 ring-inset ring-yellow-500/50":p?"bg-blue-50 text-blue-600 ring-1 ring-inset ring-blue-200":"bg-blue-900/30 text-blue-200 ring-1 ring-inset ring-blue-500/30",l&&"hidden"),children:n})]})}function E(){const r=t(),{user:l,signOut:o}=i(),{creditBalance:p,loadingCredits:u}=n(),[b,j]=s.useState(!1),[C,S]=s.useState(!1),[B,P]=s.useState(!1),[E,O]=s.useState(!1),q=x();s.useEffect(()=>{if(!q){const e=()=>{O(document.body.classList.contains("hide-sidebar"))};e();const s=new MutationObserver(e);return s.observe(document.body,{attributes:!0,attributeFilter:["class"]}),()=>{s.disconnect()}}},[q]);const A=()=>{return e=this,s=null,t=function*(){j(!0);try{yield o(),r("/")}catch(e){console.error("Error signing out:",e)}j(!1)},new Promise((a,r)=>{var i=e=>{try{l(t.next(e))}catch(s){r(s)}},n=e=>{try{l(t.throw(e))}catch(s){r(s)}},l=e=>e.done?a(e.value):Promise.resolve(e.value).then(i,n);l((t=t.apply(e,s)).next())});var e,s,t},I=a();s.useEffect(()=>{q&&S(!1)},[I,q]);const R=(e=>[{name:"Dashboard",href:"/app",icon:y,badge:void 0,special:!1},...e?[{name:"Projects",href:"/app/documents",icon:N,badge:void 0,special:!1}]:[],{name:e?"New Project":"Create Marketing Plan",href:"/questionnaire",icon:e?w:k,badge:e?void 0:"Start",special:!e}])(l);return q?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>S(!0),className:"fixed top-4 right-4 z-30 p-2 text-gray-600 hover:text-gray-900 transition-colors","aria-label":"Toggle mobile menu",children:e.jsx(g,{size:24})}),C&&e.jsx("div",{className:"fixed inset-0 bg-white z-[51] overflow-y-auto",children:e.jsxs("div",{className:"p-4",children:[e.jsx("button",{onClick:()=>S(!1),className:"absolute top-4 right-4 p-2 rounded-lg text-gray-600 hover:bg-gray-50",children:e.jsx(f,{className:"h-6 w-6"})}),e.jsx("div",{className:"flex items-center justify-center mb-8 pt-2",children:e.jsx("img",{src:"/logo.png",alt:"Logo",className:"h-8"})}),e.jsxs("nav",{className:"space-y-6",children:[e.jsx("div",{className:"space-y-1",children:R.map(s=>e.jsx(z,{href:s.href,icon:s.icon,badge:s.badge,special:s.special,onClick:()=>S(!1),children:s.name},s.name))}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"px-2.5 text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:"Resources"}),T.map(s=>e.jsx(z,{href:s.href,icon:s.icon,badge:s.badge,onClick:()=>S(!1),children:s.name},s.name))]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{className:"px-2.5 text-[11px] font-semibold text-gray-400 uppercase tracking-wider",children:"Support"}),F.map(s=>e.jsx(z,{href:s.href,icon:s.icon,badge:s.badge,onClick:()=>S(!1),children:s.name},s.name))]}),l&&e.jsx("div",{className:"pt-4 border-t border-gray-200",children:e.jsxs(c,{variant:"ghost",className:"w-full justify-start text-gray-600 hover:text-gray-900 hover:bg-gray-50",onClick:A,disabled:b,children:[b?e.jsx(d,{className:"h-5 w-5 animate-spin"}):e.jsx(v,{className:"h-5 w-5"}),e.jsx("span",{className:"ml-3",children:"Sign out"})]})})]})]})})]}):e.jsxs("div",{className:m("flex h-screen flex-col justify-between border-r border-gray-800 bg-gray-900 transition-all duration-300",B?"w-16":E?"w-0 opacity-0":"w-64"),children:[e.jsxs("div",{className:"flex h-16 shrink-0 items-center gap-x-3 border-b border-gray-800 px-4 relative",children:[e.jsx("div",{className:"cursor-pointer flex items-center",onClick:()=>r("/"),children:B?e.jsx("div",{className:"h-8 w-8 flex items-center justify-center",children:e.jsx("img",{src:"/logo.png",alt:"MarketingGuide.ai Logo",className:"h-8 w-auto object-contain"})}):e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:"/logo.png",alt:"MarketingGuide.ai Logo",className:"h-8 w-auto object-contain"}),e.jsxs("span",{className:m("text-lg font-bold text-white transition-opacity duration-200",B?"opacity-0":"opacity-100"),children:[e.jsx("span",{className:"text-blue-400",children:"Marketing"}),"Guide.ai"]})]})}),e.jsx("button",{onClick:()=>P(!B),className:"absolute right-2 top-1/2 -translate-y-1/2 p-2 rounded-lg hover:bg-gray-800 text-gray-400 hover:text-white transition-colors",children:B?e.jsx(G,{className:"h-5 w-5"}):e.jsx(M,{className:"h-5 w-5"})})]}),e.jsxs("nav",{className:"flex-1 overflow-y-auto px-3 py-6 pb-24",children:[e.jsx("div",{className:"space-y-1",children:R.map(s=>e.jsx(z,{href:s.href,icon:s.icon,badge:s.badge,special:s.special,collapsed:B,children:s.name},s.name))}),e.jsxs("div",{className:"mt-10",children:[e.jsx("p",{className:m("px-2.5 text-[11px] font-semibold uppercase tracking-wider text-gray-100 transition-all duration-200",B?"opacity-0":"opacity-100"),children:"Guides & Resources"}),e.jsx("div",{className:"mt-2 space-y-1",children:T.map(s=>e.jsx(z,{href:s.href,icon:s.icon,badge:s.badge,collapsed:B,children:s.name},s.name))})]}),e.jsxs("div",{className:"mt-10",children:[e.jsx("p",{className:m("px-2.5 text-[11px] font-semibold uppercase tracking-wider text-gray-100 transition-all duration-200",B?"opacity-0":"opacity-100"),children:"Support"}),e.jsx("div",{className:"mt-2 space-y-1",children:F.map(s=>e.jsx(z,{href:s.href,icon:s.icon,badge:s.badge,collapsed:B,children:s.name},s.name))})]})]}),e.jsx("div",{className:m("px-4 py-4 border-t border-gray-800",B?"flex justify-center":""),children:l?e.jsx("div",{className:m("rounded-lg bg-blue-900/30 p-3",B?"w-12 h-12 flex items-center justify-center":"w-full"),children:B?e.jsxs("div",{className:"relative",children:[e.jsx(L,{className:"h-5 w-5 text-blue-400"}),p>0&&e.jsx("div",{className:"absolute -top-2 -right-2 w-4 h-4 rounded-full bg-green-500 text-white text-xs flex items-center justify-center",children:p>9?"9+":p})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(L,{className:"h-4 w-4 text-blue-400 mr-2"}),e.jsx("span",{className:"text-sm font-medium text-blue-200",children:"Available Credits"})]}),e.jsx("span",{className:"text-lg font-bold text-blue-100 flex items-center",children:u?e.jsx(d,{className:"h-4 w-4 animate-spin text-blue-300"}):p})]}),e.jsx(h,{productId:"agency_pack",className:"w-full bg-blue-600 hover:bg-blue-700 text-white text-sm py-1.5 rounded mt-2",size:"sm",showArrow:!1,children:"Buy Project Credits"})]})}):e.jsx("div",{className:m("rounded-lg bg-gradient-to-br from-blue-600/20 to-indigo-600/20 border border-blue-500/30 p-3 w-full backdrop-blur-sm",B?"w-12 h-12 flex items-center justify-center":""),children:B?e.jsxs("div",{className:"relative",children:[e.jsx(k,{className:"h-5 w-5 text-blue-400"}),e.jsx("div",{className:"absolute -top-1 -right-1 w-2 h-2 rounded-full bg-yellow-400"})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center mb-2",children:[e.jsxs("div",{className:"flex items-center justify-center mb-2",children:[e.jsx(k,{className:"h-4 w-4 text-blue-400 mr-2"}),e.jsx("span",{className:"text-sm font-medium text-blue-200",children:"Ready to start?"})]}),e.jsx("p",{className:"text-xs text-gray-300 mb-3 leading-relaxed",children:"Get your complete marketing strategy"}),e.jsx("p",{className:"text-xs text-blue-300 mb-3 font-medium",children:"15 professional documents"})]}),e.jsxs("div",{className:"text-center mb-3",children:[e.jsx("div",{className:"text-lg font-bold text-white",children:"$29.99"}),e.jsx("div",{className:"text-xs text-gray-400",children:"One-time payment"})]}),e.jsx("button",{onClick:()=>r("/questionnaire"),className:"w-full bg-gradient-to-r from-blue-600 to-indigo-600 hover:from-blue-700 hover:to-indigo-700 text-white text-xs py-2 px-3 rounded font-medium transition-all duration-200 shadow-md hover:shadow-lg transform hover:scale-105",children:"Get Started Now"})]})})}),e.jsx("div",{className:"p-4 border-t border-gray-800",children:l?e.jsxs("button",{onClick:A,disabled:b,className:m("w-full group flex items-center gap-x-3 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-200","text-gray-100 hover:bg-gray-800 hover:text-white"),children:[b?e.jsx(d,{className:"h-5 w-5 shrink-0 animate-spin text-gray-200"}):e.jsx(v,{className:"h-5 w-5 shrink-0 text-gray-200 group-hover:text-white"}),e.jsx("span",{className:m("transition-all duration-200",B?"opacity-0 w-0":"opacity-100"),children:"Sign Out"})]}):e.jsxs("button",{onClick:()=>r("/auth"),className:m("w-full group flex items-center gap-x-3 rounded-lg px-3 py-2 text-sm font-medium transition-all duration-200","text-gray-100 hover:bg-gray-800 hover:text-white"),children:[e.jsx(v,{className:"h-5 w-5 shrink-0 text-gray-200 group-hover:text-white"}),e.jsx("span",{className:m("transition-all duration-200",B?"opacity-0 w-0":"opacity-100"),children:"Sign In"})]})})]})}export{E as A};