1import{c as o,aD as Q,j as t,a4 as U,bl as $,aj as J}from"./vendor-1kUQ7zn2.js";import{aA as Z,w as z,au as ee,aB as te,aC as I,B as D}from"./index--kdl1ae9.js";import{d as re}from"./vendor-supabase-Dh2gyaRa.js";import{m as L,A as oe}from"./vendor-motion-BX-jsy7E.js";import"./vendor-date-en1IyhsK.js";const V={title:"Welcome to Eisenhower Matrix",description:"A quick spotlight tour of how to work the matrix.",highlightSelector:null},ie={title:"Daily Review",description:"A two-minute morning plan: clear what carried over, pick up to three tasks for today.",highlightSelector:"#daily-review-btn",requiresTarget:!0},ne={title:"Statistics",description:"Completion rates, focus time and streaks. Your momentum at a glance.",highlightSelector:"#stats-button",requiresTarget:!0},se=(a,l)=>a==="mobile"?[V,{title:"The priority canvas",description:"One quadrant at a time, by urgency and importance. Tap a task for its options.",highlightSelector:"#mx-panel",requiresTarget:!0},{title:"Categorize new tasks",description:"Imported tasks without a quadrant land here. Tap to place them on the matrix.",highlightSelector:"#categorize-btn",requiresTarget:!0},{title:"Quick actions",description:"Switch between quadrants here and add a task with +. Single Task Focus and filters sit at the top.",highlightSelector:"#mx-tabbar",requiresTarget:!0},{title:"Daily Review and Statistics",description:"Your two-minute morning plan opens by itself each day; replay it, or see your streaks and focus time, from here.",highlightSelector:"#mx-account-btn",requiresTarget:!0}]:[V,{title:"The priority canvas",description:l?"Four quadrants by urgency à importance. Move tasks between quadrants to reprioritize.":"Four quadrants by urgency à importance. Hold Ctrl (â on Mac) + click to pick tasks, then move them between quadrants to reprioritize.",highlightSelector:a==="clean"?".cm-root":".matrix-grid",requiresTarget:!0},{title:"Clean or Classic",description:l?"Two ways to see the same matrix. Switch views here anytime.":"Two ways to see the same matrix. Switch views here anytime, or press V.",highlightSelector:".cm-switch",requiresTarget:!0},{title:"Filters",description:"Narrow by label, project, date or priority. Save the views you use most as presets.",highlightSelector:".matrix-filters",requiresTarget:!0},{title:"Single Task Focus",description:"Work one task at a time. The matrix dims and a focus timer takes over, built for deep work.",highlightSelector:"#single-task-focus",requiresTarget:!0},{title:"Add and manage tasks",description:l?"Add with +. Tap a task to complete, comment or open in Todoist.":"Add with +. Click a task to complete, comment or open in Todoist. Ctrl (â on Mac) + click to recategorize.",highlightSelector:"#add-task-btn",fallbackSelector:".task-card",requiresTarget:!0},{title:"Categorize new tasks",description:`Imported tasks without a quadrant land here. ${l?"Tap":"Click"} to place them on the matrix.`,highlightSelector:"#categorize-btn",fallbackSelector:"#recategorize-btn",requiresTarget:!0},{title:"Recategorize in bulk",description:"Move many tasks at once. Perfect for weekly planning.",highlightSelector:"#recategorize-btn",requiresTarget:!0},ie,ne,{title:"Share your ideas",description:"Found a bug or have an idea? Choose Send feedback in your account menu. We read every message.",highlightSelector:"#account-menu-btn",requiresTarget:!0}],ae=()=>document.querySelector(".mx-header")?"mobile":document.querySelector(".cm-root")?"clean":"classic",ce='button:not([disabled]), [href], input:not([disabled]), select, textarea, [tabindex]:not([tabindex="-1"])',v=10,k=16,M=a=>{const l=a.highlightSelector?I(a.highlightSelector):null;return l||(a.fallbackSelector?I(a.fallbackSelector):null)},ge=({onClose:a})=>{const{session:l}=re.useSessionContext(),[f]=o.useState(()=>se(ae(),Z()).filter(e=>!e.requiresTarget||M(e))),[d,F]=o.useState(0),[c,W]=o.useState(null),[h,_]=o.useState({w:380,h:240}),[S,K]=o.useState({w:typeof window<"u"?window.innerWidth:1280,h:typeof window<"u"?window.innerHeight:800}),T=o.useRef(null),u=f[d],x=d===f.length-1,H=!!(u.highlightSelector||u.fallbackSelector);o.useEffect(()=>{z("tour_started",{kind:"replay",layout:ee()})},[]);const C=o.useRef(0);C.current=d;const g=o.useCallback(()=>{C.current<f.length-1?z("tour_skipped",{kind:"replay",step:C.current}):z("tour_completed",{kind:"replay"}),localStorage.setItem("onboardingComplete","true"),a()},[a,f.length]),E=o.useCallback(()=>{x?g():F(e=>e+1)},[x,g]),q=o.useCallback(()=>{F(e=>Math.max(0,e-1))},[]),j=l?.user?.id;o.useEffect(()=>{j&&u.highlightSelector===".cm-switch"&&te(j)},[u,j]),o.useEffect(()=>{let e=!1,r=0;const i=()=>{const p=M(u);e||W(p?p.getBoundingClientRect():null)},s=M(u);s&&s.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),i();const b=window.setTimeout(i,380),m=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(i)};return window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{e=!0,window.clearTimeout(b),cancelAnimationFrame(r),window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[d,u]),o.useEffect(()=>{const e=()=>K({w:window.innerWidth,h:window.innerHeight});return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),o.useLayoutEffect(()=>{if(T.current){const e=T.current.getBoundingClientRect();_({w:e.width,h:e.height})}},[d,c,S.w,S.h]);const y=o.useRef(null);o.useEffect(()=>{const e=r=>{if(r.key==="Escape")g();else if(r.key==="ArrowRight")E();else if(r.key==="ArrowLeft")q();else if(r.key==="Tab"){const i=y.current;if(!i)return;const s=Array.from(i.querySelectorAll(ce)).filter(X=>X.getClientRects().length>0);if(!s.length)return;const b=s[0],m=s[s.length-1],p=document.activeElement;
1(!(p&&i.contains(p))||r.shiftKey&&p===b||!r.shiftKey&&p===m)&&(r.preventDefault(),(r.shiftKey?m:b).focus())}};return window.addEventListener("keydown",e,!0),()=>window.removeEventListener("keydown",e,!0)},[g,E,q]);const Y=o.useCallback(e=>{e?.focus({preventScroll:!0})},[]);o.useEffect(()=>{const e=i=>{const s=y.current;if(!s||s.contains(i.target))return;s.querySelector("[data-tour-primary]")?.focus({preventScroll:!0})};document.addEventListener("focusin",e);const r=window.setTimeout(()=>{const i=y.current;i&&!i.contains(document.activeElement)&&i.querySelector("[data-tour-primary]")?.focus({preventScroll:!0})},120);return()=>{document.removeEventListener("focusin",e),window.clearTimeout(r)}},[]);const[G]=o.useState(()=>typeof document<"u"?document.activeElement:null);o.useEffect(()=>{const e=G;return()=>{(e&&e!==document.body&&e.isConnected&&e.getClientRects().length>0?e:I("#mx-account-btn, #account-menu-btn"))?.focus({preventScroll:!0})}},[]);const{w:B,h:O}=S,P=H&&!!c,n=c?{left:c.left-v,top:c.top-v,w:c.width+v*2,h:c.height+v*2}:null;let w="center",N=(B-h.w)/2,A=(O-h.h)/2,R=null;if(P&&n&&c){const e=O-(n.top+n.h),r=n.top;if(e>=h.h+k+16?(w="bottom",A=n.top+n.h+k):r>=h.h+k+16?(w="top",A=n.top-k-h.h):w="center",w!=="center"){const i=c.left+c.width/2;N=Math.min(Math.max(12,i-h.w/2),B-h.w-12),R=Math.min(Math.max(20,i-N),h.w-20)}}return Q.createPortal(t.jsxs("div",{ref:y,className:"fixed inset-0 z-[120]",role:"dialog","aria-modal":"true","aria-label":"Product tour",children:[P&&n?t.jsx(L.div,{"aria-hidden":!0,className:"absolute rounded-2xl pointer-events-none",initial:!1,animate:{left:n.left,top:n.top,width:n.w,height:n.h},transition:{type:"spring",stiffness:320,damping:34},style:{boxShadow:"0 0 0 9999px rgba(2, 6, 23, 0.66)",outline:"2px solid hsl(var(--primary) / 0.55)",outlineOffset:"3px"},children:t.jsx(L.span,{"aria-hidden":!0,className:"absolute -inset-1 rounded-2xl",animate:{opacity:[.5,0,.5]},transition:{duration:2.4,repeat:1/0,ease:"easeInOut"},style:{boxShadow:"0 0 0 4px hsl(var(--primary) / 0.35)"}})}):t.jsx("div",{className:"absolute inset-0 bg-[rgba(2,6,23,0.66)]","aria-hidden":!0}),t.jsx("div",{className:"absolute inset-0"}),t.jsx(oe,{mode:"wait",children:t.jsxs(L.div,{ref:T,initial:{opacity:0,y:10,scale:.97},animate:{opacity:1,y:0,scale:1},exit:{opacity:0,y:-8,scale:.97},transition:{duration:.22,ease:[.22,1,.36,1]},className:"absolute w-[380px] max-w-[calc(100vw-24px)] rounded-2xl border border-border/70 bg-card text-card-foreground shadow-2xl",style:{left:N,top:A},children:[R!==null&&t.jsx("span",{"aria-hidden":!0,className:"absolute h-3 w-3 rotate-45 bg-card",style:{left:R-6,...w==="bottom"?{top:-6,borderTop:"1px solid hsl(var(--border))",borderLeft:"1px solid hsl(var(--border))"}:{bottom:-6,borderBottom:"1px solid hsl(var(--border))",borderRight:"1px solid hsl(var(--border))"}}}),t.jsxs("div",{className:"p-5",children:[t.jsxs("div",{className:"flex items-center justify-between mb-3",children:[t.jsx("div",{className:"flex items-center gap-1.5",children:f.map((e,r)=>t.jsx("span",{className:"h-1.5 rounded-full transition-all duration-300 "+(r===d?"w-5 bg-primary":r<d?"w-1.5 bg-primary/50":"w-1.5 bg-muted-foreground/25")},r))}),t.jsx("button",{onClick:g,"aria-label":"Close tour",className:"text-muted-foreground hover:text-foreground transition-colors -mr-1 -mt-1 p-1 rounded-md",children:t.jsx(U,{className:"h-4 w-4"})})]}),t.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:u.title}),t.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-muted-foreground",children:u.description}),t.jsxs("div",{className:"mt-5 flex items-center justify-between gap-2",children:[t.jsx("button",{onClick:g,className:"text-xs font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Skip tour"}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsxs(D,{variant:"ghost",size:"sm",onClick:q,disabled:d===0,className:"gap-1 h-8",children:[t.jsx($,{className:"h-4 w-4"}),"Back"]}),t.jsxs(D,{ref:Y,"data-tour-primary":!0,size:"sm",onClick:E,className:"gap-1.5 h-8",children:[x?"Get started":"Next",!x&&t.jsx(J,{className:"h-4 w-4"})]})]})]})]})]},d)})]}),document.body)};export{ge as OnboardingTour};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.