PageSourceSearch

https://yogicurious.lovable.app/assets/Meditation-CjjOgkW1.js

js yogicurious.lovable.app collected 2026-10-03 03:48:12 UTC 33,261 bytes, 68 lines download raw bytes

1var ce=Object.defineProperty;var de=(i,t,c)=>t in i?ce(i,t,{enumerable:!0,configurable:!0,writable:!0,value:c}):i[t]=c;var v=(i,t,c)=>de(i,typeof t!="symbol"?t+"":t,c);import{j as e}from"./vendor-query-DoHIXVj8.js";import{r as l}from"./vendor-react-B1CyA2bu.js";import{c as b,s as K,u as ue,C,a as G,b as D,e as V,B as h,T as he,X as J}from"./index-Cn6nJhWG.js";import{B as L}from"./badge-BQ5YkzSG.js";import{P as me}from"./progress-CoOI6RJN.js";import{M as pe}from"./monitor-8lOsBT6T.js";import{S as O}from"./smartphone-CaApHHC_.js";import{L as xe}from"./loader-circle-Lrf5ROOc.js";import{Z as _}from"./zap-ClKvao4_.js";import{C as H}from"./circle-check-big-DmcUwc3l.js";import{E as fe}from"./eye--shIzgCe.js";import{C as ye}from"./circle-x-6LkAfR4g.js";import{H as $}from"./heart-CEw_tAcA.js";import{S as W}from"./sparkles-BK2JkoPv.js";import{R as ge}from"./rotate-ccw-DbSTeCvc.js";import"./vendor-supabase-Bxjw3GPQ.js";import"./vendor-ui-Dv9JeOyV.js";typeof globalThis.require!="function"&&(globalThis.require=function(){return null},window.require=globalThis.require);/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const X=b("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const be=b("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const je=b("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/**
17 * @license lucide-react v0.462.0 - ISC
18 *
19 * This source code is licensed under the ISC license.
20 * See the LICENSE file in the root directory of this source tree.
21 */const ve=b("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
22 * @license lucide-react v0.462.0 - ISC
23 *
24 * This source code is licensed under the ISC license.
25 * See the LICENSE file in the root directory of this source tree.
26 */const we=b("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
27 * @license lucide-react v0.462.0 - ISC
28 *
29 * This source code is licensed under the ISC license.
30 * See the LICENSE file in the root directory of this source tree.
31 */const Ne=b("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/**
32 * @license lucide-react v0.462.0 - ISC
33 *
34 * This source code is licensed under the ISC license.
35 * See the LICENSE file in the root directory of this source tree.
36 */const Ce=b("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/**
37 * @license lucide-react v0.462.0 - ISC
38 *
39 * This source code is licensed under the ISC license.
40 * See the LICENSE file in the root directory of this source tree.
41 */const ke=b("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/**
42 * @license lucide-react v0.462.0 - ISC
43 *
44 * This source code is licensed under the ISC license.
45 * See the LICENSE file in the root directory of this source tree.
46 */const Ae=b("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
47 * @license lucide-react v0.462.0 - ISC
48 *
49 * This source code is licensed under the ISC license.
50 * See the LICENSE file in the root directory of this source tree.
51 */const Se=b("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
52 * @license lucide-react v0.462.0 - ISC
53 *
54 * This source code is licensed under the ISC license.
55 * See the LICENSE file in the root directory of this source tree.
56 */const Pe=b("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);class Ie{constructor(){v(this,"audioContext",null);v(this,"masterGainNode",null);v(this,"ambientOscillators",[]);v(this,"ambientGainNodes",[]);v(this,"currentVoiceAudio",null);v(this,"voiceCache",new Map);v(this,"isAmbientPlaying",!1);v(this,"userVoiceId",null);v(this,"volume",.075)}async initializeAudio(){this.audioContext||(this.audioContext=new(window.AudioContext||window.webkitAudioContext),this.masterGainNode=this.audioContext.createGain(),this.masterGainNode.connect(this.audioContext.destination)),this.audioContext.state==="suspended"&&await this.audioContext.resume()}async getUserVoiceId(){var t;if(this.userVoiceId)return this.userVoiceId;try{const{data:{user:c}}=await K.auth.getUser();
56if(!c)return"EXAVITQu4vr4xnSDxMaL";const{data:n}=await K.from("profiles").select("gender, relationship_intentions").eq("user_id",c.id).single();if(!n)return"EXAVITQu4vr4xnSDxMaL";const f=(t=n.gender)==null?void 0:t.toLowerCase(),g=(n.relationship_intentions||[]).some(u=>u.toLowerCase().includes("same")||u.toLowerCase().includes("gay")||u.toLowerCase().includes("lesbian")||u.toLowerCase().includes("lgbtq"));return f==="male"&&g?this.userVoiceId="onwK4e9ZLuTAKqWW03F9":f==="female"&&g?this.userVoiceId="EXAVITQu4vr4xnSDxMaL":f==="male"?this.userVoiceId="EXAVITQu4vr4xnSDxMaL":f==="female"?this.userVoiceId="onwK4e9ZLuTAKqWW03F9":this.userVoiceId="EXAVITQu4vr4xnSDxMaL",this.userVoiceId}catch(c){return console.log("Error getting user voice preference:",c),"EXAVITQu4vr4xnSDxMaL"}}async startAmbientMusic(){if(!this.isAmbientPlaying)try{if(await this.initializeAudio(),!this.audioContext||!this.masterGainNode)return;this.stopAmbientMusic();const t=this.audioContext.createOscillator(),c=this.audioContext.createGain();t.frequency.setValueAtTime(432,this.audioContext.currentTime),t.type="sine",c.gain.setValueAtTime(this.volume,this.audioContext.currentTime),t.connect(c),c.connect(this.masterGainNode),this.ambientOscillators.push(t),this.ambientGainNodes.push(c);const n=[432*2,432*1.5,432/2],f=[.3,.2,.4];n.forEach((r,g)=>{const u=this.audioContext.createOscillator(),y=this.audioContext.createGain();u.frequency.setValueAtTime(r,this.audioContext.currentTime),u.type="sine",y.gain.setValueAtTime(this.volume*f[g],this.audioContext.currentTime),u.connect(y),y.connect(this.masterGainNode),this.ambientOscillators.push(u),this.ambientGainNodes.push(y)}),this.ambientOscillators.forEach(r=>r.start()),this.isAmbientPlaying=!0,console.log("Started ambient music")}catch(t){console.error("Error starting ambient music:",t)}}stopAmbientMusic(){try{this.ambientOscillators.forEach(t=>{t.context.state!=="closed"&&(t.stop(),t.disconnect())}),this.ambientGainNodes.forEach(t=>{t.context.state!=="closed"&&t.disconnect()}),this.ambientOscillators=[],this.ambientGainNodes=[],this.isAmbientPlaying=!1,console.log("Stopped ambient music")}catch(t){console.error("Error stopping ambient music:",t)}}async playVoiceInstruction(t){console.log("Voice instruction (text only):",t)}stopVoiceInstruction(){this.currentVoiceAudio&&(this.currentVoiceAudio.pause(),this.currentVoiceAudio.currentTime=0,URL.revokeObjectURL(this.currentVoiceAudio.src),this.currentVoiceAudio=null)}isVoicePlaying(){return this.currentVoiceAudio?!this.currentVoiceAudio.paused:!1}isAmbientMusicPlaying(){return this.isAmbientPlaying}setVolume(t){this.volume=Math.max(0,Math.min(1,t)),this.masterGainNode&&this.audioContext&&this.masterGainNode.gain.setValueAtTime(this.volume,this.audioContext.currentTime)}cleanup(){this.stopAmbientMusic(),this.stopVoiceInstruction(),this.audioContext&&this.audioContext.state!=="closed"&&this.audioContext.close().catch(()=>{}),this.audioContext=null,this.masterGainNode=null,this.voiceCache.clear(),console.log("Audio manager cleaned up")}}const x=new Ie,Me=()=>{const{toast:i}=ue(),[t,c]=l.useState(!1),[n,f]=l.useState(null),[r,g]=l.useState(!1),u=a=>{switch(a){case"High":return"bg-red-500";case"Medium":return"bg-yellow-500";case"Low":return"bg-blue-500";default:return"bg-gray-500"}},y=a=>{switch(a){case"High":return e.jsx(ye,{className:"w-4 h-4"});case"Medium":return e.jsx(he,{className:"w-4 h-4"});case"Low":return e.jsx(H,{className:"w-4 h-4"});default:return e.jsx(H,{className:"w-4 h-4"})}},E=a=>{switch(a.toLowerCase()){case"responsive design":return e.jsx(Ne,{className:"w-4 h-4"});case"touch interactions":return e.jsx(O,{className:"w-4 h-4"});case"performance":return e.jsx(_,{className:"w-4 h-4"});case"accessibility":return e.jsx(fe,{className:"w-4 h-4"});case"mobile-specific":return e.jsx(O,{className:"w-4 h-4"});default:return e.jsx(ve,{className:"w-4 h-4"})}},k=async()=>{c(!0),f(null);try{i({title:"Analyzing Audio Synchronization",description:"AI is analyzing meditation page audio synchronization issues..."}),await new Promise(w=>setTimeout(w,2e3));const a={summary:"Found critical audio synchronization issues in the meditation page. The breathing pattern visual cues ('Inhale', 'Hold', 'Exhale') are not properly synchronized with the audio instructions due to multiple timing conflicts and state management problems.",score:4.2,issues:[{category:"Critical Audio Timing",description:"Breathing pattern calculation relies on 
56stepTimeLeft which decreases, causing phase calculations to be inverted or delayed",priority:"High",solution:"Use elapsed time from step start instead of remaining time for breathing calculations",codeExample:`// Fix: Use elapsed time instead of remaining
57const elapsed = (currentStep.duration - stepTimeLeft); // Current (WRONG)
58const elapsed = totalTimeElapsed - stepStartTime; // Better approach`},{category:"State Race Conditions",description:"instructionPlayed flag dependency causes breathing pattern to wait for voice audio completion, creating async delays",priority:"High",solution:"Decouple breathing pattern timing from voice instruction completion",codeExample:`// Remove dependency on instructionPlayed
59if (!isPlaying || !currentStep.breathPattern) { return; }
60// Don't wait for: !instructionPlayed`},{category:"Timer Accuracy",description:"500ms update frequency for breathing pattern is too slow for smooth 'Inhale/Exhale' transitions",priority:"High",solution:"Increase update frequency to 100ms or use requestAnimationFrame for smoother updates",codeExample:`// Change from 500ms to 100ms
61setInterval(() => { ... }, 100); // Instead of 500`},{category:"Audio Async Issues",description:"Voice instruction playback promise resolution doesn't guarantee audio has actually finished playing",priority:"Medium",solution:"Use audio 'ended' event listener instead of promise-based completion",codeExample:`// Better audio completion detection
62audio.addEventListener('ended', () => setInstructionPlayed(true));`},{category:"Step Transition Timing",description:"Step changes reset breathing phase but don't account for voice instruction duration overlap",priority:"Medium",solution:"Add proper transition delays and breathing pattern reset timing",codeExample:`// Add transition delay
63setTimeout(() => { setBreathPhase('inhale'); }
63, voiceInstructionDuration);`}],recommendations:["🔧 IMMEDIATE FIX: Remove instructionPlayed dependency from breathing pattern useEffect","⏱️ Use performance.now() or Date.now() for precise timing instead of stepTimeLeft countdown","🎵 Implement separate timing system for breathing patterns independent of voice audio","📱 Add user gesture requirement before starting any audio (mobile browser compliance)","🔄 Use requestAnimationFrame for smooth 60fps breathing animations","🎯 Add audio preloading to reduce instruction delays","⚡ Implement breathing pattern preview before voice instructions start","🐞 Add debugging console logs to track timing mismatches"]};f(a),i({title:"Critical Issues Found!",description:`Audio sync problems identified. Score: ${a.score}/10`,variant:"destructive"})}catch(a){console.error("Analysis error:",a),i({title:"Analysis Failed",description:"Could not complete audio synchronization analysis.",variant:"destructive"})}finally{c(!1)}};return e.jsx("div",{className:"space-y-6",children:e.jsxs(C,{children:[e.jsxs(G,{children:[e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(pe,{className:"w-5 h-5"}),e.jsx(O,{className:"w-5 h-5"})]}),"AI Compatibility Checker"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Let OpenAI analyze your app for desktop and mobile compatibility issues"})]}),e.jsxs(V,{className:"space-y-4",children:[e.jsx(h,{onClick:k,disabled:t,className:"w-full",children:t?e.jsxs(e.Fragment,{children:[e.jsx(xe,{className:"w-4 h-4 mr-2 animate-spin"}),"Analyzing Compatibility..."]}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"w-4 h-4 mr-2"}),"Run Compatibility Check"]})}),n&&e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"text-center p-4 bg-muted rounded-lg",children:[e.jsxs("div",{className:"text-2xl font-bold text-primary",children:[n.score,"/10"]}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Compatibility Score"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:"Summary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:n.summary})]}),n.issues&&n.issues.length>0&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"font-semibold",children:"Issues Found"}),e.jsx(h,{variant:"outline",size:"sm",onClick:()=>g(!r),children:r?"Hide Details":"Show Details"})]}),e.jsx("div",{className:"space-y-2",children:n.issues.map((a,w)=>e.jsx(C,{className:"p-3",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[E(a.category),y(a.priority)]}),e.jsxs("div",{className:"flex-1 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(L,{variant:"outline",className:"text-xs",children:a.category}),e.jsx(L,{className:`text-xs text-white ${u(a.priority)}`,children:a.priority})]}),e.jsx("p",{className:"text-sm",children:a.description}),r&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-green-600",children:"Solution:"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.solution}),a.codeExample&&e.jsx("div",{className:"bg-muted p-2 rounded text-xs font-mono overflow-x-auto",children:a.codeExample})]})]})]})},w))})]}),n.recommendations&&n.recommendations.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("h3",{className:"font-semibold",children:"Recommendations"}),e.jsx("div",{className:"space-y-2",children:n.recommendations.map((a,w)=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(H,{className:"w-4 h-4 text-green-500 mt-0.5 flex-shrink-0"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]},w))})]})]})]})]})})},B=[{id:"pre-date-calm",title:"Pre-Date Calm",description:"Release nervous energy and center yourself before meeting someone new",duration:8,category:"pre-date",icon:$,color:"bg-rose-500",steps:[{instruction:"Find a comfortable seated position. Close your eyes and take three natural breaths to settle in.",duration:30},{instruction:"Let's begin with calming breathwork. Breathe in slowly through your nose for 4 counts.",duration:90,breathPattern:{inh
63ale:4,hold:2,exhale:6}},{instruction:"Continue this rhythm: inhale for 4, pause briefly, then exhale for 6. Let each exhale release any tension.",duration:120,breathPattern:{inhale:4,hold:2,exhale:6}},{instruction:"Now visualize your upcoming meeting. See yourself feeling calm, authentic, and genuinely curious about this person.",duration:90},{instruction:"Remind yourself: 'I am worthy of love and connection. I trust myself to be genuine and present.'",duration:90},{instruction:"Take three final deep breaths, wiggle your fingers and toes, and when you're ready, open your eyes.",duration:60,breathPattern:{inhale:4,hold:2,exhale:6}}]},{id:"confidence-boost",title:"Confidence Breathwork",description:"Energizing breathing techniques to boost self-assurance and inner strength",duration:6,category:"confidence",icon:W,color:"bg-amber-500",steps:[{instruction:"Stand tall or sit with your spine straight. Place one hand on your chest, one on your belly.",duration:30},{instruction:"We'll practice power breathing. Take a strong inhale through your nose for 3 counts, filling your belly first.",duration:60,breathPattern:{inhale:3,exhale:3}},{instruction:"Exhale forcefully through your mouth for 3 counts. Feel your core engage. This is your power breath.",duration:90,breathPattern:{inhale:3,exhale:3}},{instruction:"Continue power breathing. With each inhale, draw in confidence. With each exhale, release self-doubt.",duration:120,breathPattern:{inhale:3,exhale:3}},{instruction:"Now slow your breathing. Think: 'I am confident, I am worthy, I bring unique value to any connection.'",duration:60},{instruction:"Take three normal breaths, roll your shoulders back, and step into your power.",duration:30,breathPattern:{inhale:4,exhale:4}}]},{id:"post-date-reflection",title:"Post-Date Reflection",description:"Process your experience mindfully, whether it went well or not so well",duration:10,category:"post-date",icon:X,color:"bg-purple-500",steps:[{instruction:"Settle into a comfortable position. Take a moment to simply breathe and arrive here with yourself.",duration:45},{instruction:"Begin with gentle breathing: inhale for 4, hold for 4, exhale for 4. Let this create space for reflection.",duration:90,breathPattern:{inhale:4,hold:4,exhale:4}},{instruction:"Bring your recent experience to mind without judgment. Simply observe what happened like watching a movie.",duration:75},{instruction:"Notice what emotions arise. Breathe with them. All feelings are valid and temporary.",duration:90,breathPattern:{inhale:4,hold:4,exhale:4}},{instruction:"Ask yourself: What did I learn about myself today? What am I grateful for in this experience?",duration:120},{instruction:"Whether this connection continues or not, honor yourself for being brave enough to try.",duration:90},{instruction:"Take three deep breaths of appreciation for your journey of growth and connection.",duration:90,breathPattern:{inhale:5,hold:2,exhale:7}}]},{id:"loving-kindness",title:"Heart Opening Practice",description:"Cultivate compassion for yourself and openness to love in all its forms",duration:12,category:"general",icon:$,color:"bg-green-500",steps:[{instruction:"Sit comfortably and place both hands on your heart. Feel its steady rhythm.",duration:60},{instruction:"Begin heart-centered breathing: breathe into your heart space for 5 counts.",duration:90,breathPattern:{inhale:5,exhale:5}},{instruction:"Continue breathing into your heart. With each breath, imagine your heart space expanding with warmth.",duration:120,breathPattern:{inhale:5,exhale:5}},{instruction:"Silently repeat: 'May I be happy. May I be peaceful. May I be loved. May I love freely.'",duration:90},{instruction:"Now extend this loving kindness: 'May all beings seeking love find what they need. May all hearts be open and free.'",duration:120},{instruction:"Return to your own heart. Feel gratitude for your capacity to love and be loved.",duration:90},{instruction:"Take three final heart breaths, feeling connected to the love that surrounds you always.",duration:90,breathPattern:{inhale:5,exhale:5}}]}],Te=({session:i,onComplete:t,onClose:c})=>{var Z;const[n,f]=l.useState(!1),[r,g]=l.useState(0),[u,y]=l.useState(((Z=i.steps[0])==null?void 0:Z.duration)||0),[E,k]=l.useState(0),[a,w]=l.useState(!0),[o,A]=l.useState(!0),[m,S]=l.useState("inhale"),[U,z]=l.useState(0),[Q,q]=l.useState(!1),[Y,P]=l.useState(!1),[Ve,Ee]=l.useState(!1),p=i.steps[r],ee=i.steps.reduce((s,d)=>s+d.duration,0),te=E/ee*100;l.useEffect(()=>{o&&n?x.isAmbientMusicPlaying()||x.startAmbientMusic():x.isAmbientMusicPlaying()&&x.stopAmbientMusic()},[o,n]),l.useEffect(()=>{let s;return n&&(s=setInterval(()=>{y(d=>d<=1?r<i.steps.length-1?(g(N=>N+1),q(!1),P(!1),i.steps[r+1].duration):(f(!1),t(),0):d-1),k(d=>d+1)},1e3)),()=>clearInterval(s)},[n,r,i.steps,t]),l.useEffect(()=>{n&&!Q&&(console.log("🎯 Starting new step:",r,p.instruction),q(!0),S("inhale"),z(0),a?(console.log("🔊 Playing voice instruction..."),x.playVoiceInstru
63ction(p.instruction).then(()=>{console.log("✅ Voice instruction completed"),P(!0)}).catch(s=>{console.log("❌ Voice instruction failed:",s),P(!0)})):(console.log("🔇 Voice disabled, marking instruction as played"),P(!0)))},[n,Q,a,p.instruction]),l.useEffect(()=>{if(!n||!p.breathPattern){console.log("🔄 Breathing stopped - not playing or no pattern"),S("inhale"),z(0);return}const s=p.breathPattern,d=s.inhale+(s.hold||0)+s.exhale+(s.pause||0);console.log("🫁 Starting breathing pattern:",s,"cycle time:",d);const N=setInterval(()=>{const I=p.duration-u,j=I%d;console.log("⏱️ Step elapsed:",I,"Cycle position:",j);let M,T=0;j<s.inhale?(M="inhale",T=j/s.inhale*100):s.hold&&j<s.inhale+s.hold?(M="hold",T=100):j<s.inhale+(s.hold||0)+s.exhale?(M="exhale",T=(1-(j-s.inhale-(s.hold||0))/s.exhale)*100):(M="pause",T=0),console.log("🫁 Breath phase:",M,"progress:",T),S(M),z(T)},100);return()=>clearInterval(N)},[n,p.breathPattern,u,p.duration]);const se=()=>{f(!n),n&&x.stopVoiceInstruction()},ie=()=>{f(!1),g(0),y(i.steps[0].duration),k(0),q(!1),P(!1),S("inhale"),z(0),x.stopVoiceInstruction(),x.stopAmbientMusic()},F=()=>{f(!1),x.stopVoiceInstruction(),x.stopAmbientMusic(),c()},ae=()=>{w(!a),a&&x.stopVoiceInstruction()},ne=()=>{A(!o),o&&x.isAmbientMusicPlaying()&&x.stopAmbientMusic()},R=s=>{if(s<0||s>=i.steps.length)return;g(s),y(i.steps[s].duration),q(!1),P(!1),S("inhale"),z(0);const d=i.steps.slice(0,s).reduce((N,I)=>N+I.duration,0);k(d),x.stopVoiceInstruction()},re=()=>{r>0&&R(r-1)},oe=()=>{r<i.steps.length-1&&R(r+1)};l.useEffect(()=>()=>{x.cleanup()},[]);const le=s=>{const d=Math.floor(s/60),N=s%60;return`${d}:${N.toString().padStart(2,"0")}`};return e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50 p-4",onClick:s=>s.target===s.currentTarget&&F(),children:e.jsx("div",{className:"w-full max-w-md mx-auto",children:e.jsxs(C,{className:"bg-gradient-to-b from-background to-muted/30 relative max-w-md mx-auto",children:[e.jsx(h,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 h-8 w-8 z-10",onClick:F,children:e.jsx(J,{className:"h-4 w-4"})}),e.jsxs(G,{className:"text-center",children:[e.jsx("div",{className:`w-16 h-16 mx-auto rounded-full ${i.color} flex items-center justify-center mb-4`,children:e.jsx(i.icon,{className:"h-8 w-8 text-white"})}),e.jsx(D,{className:"text-xl",children:i.title}),e.jsx("p",{className:"text-sm text-muted-foreground",children:i.description})]}),e.jsxs(V,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex justify-between text-sm",children:[e.jsxs("span",{children:["Step ",r+1," of ",i.steps.length]}),e.jsxs("span",{children:[le(u)," remaining"]})]}),e.jsx(me,{value:te,className:"h-2"})]}),p.breathPattern&&Y&&e.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[e.jsxs("div",{className:"relative w-32 h-32",children:[e.jsx("div",{className:`w-full h-full rounded-full border-4 transition-all duration-1000 ${m==="inhale"?"border-blue-400 scale-110":m==="hold"?"border-purple-400 scale-110":m==="exhale"?"border-green-400 scale-90":"border-gray-400 scale-90"}`,style:{background:`conic-gradient(from 0deg, 
64                      ${m==="inhale"?"rgba(59, 130, 246, 0.3)":m==="hold"?"rgba(147, 51, 234, 0.3)":m==="exhale"?"rgba(34, 197, 94, 0.3)":"rgba(156, 163, 175, 0.3)"} ${U}%, 
65                      transparent ${U}%)`}}),e.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:e.jsx("span",{className:"text-lg font-semibold capitalize",children:m==="pause"?"pause":m})})]}),e.jsx("div",{className:"text-center",children:e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Breathe ",m==="inhale"?"in":m==="exhale"?"out":m,e.jsxs("span",{className:"block text-xs",children:["In ",p.breathPattern.inhale,"s •",p.breathPattern.hold&&` Hold ${p.breathPattern.hold}s • `,"Out ",p.breathPattern.exhale,"s",p.breathPattern.pause&&` • Pause ${p.breathPattern.pause}s`]})]})})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-center text-xs text-muted-foreground",children:"Steps Timeline"}),e.jsx("div",{className:"flex items-center space-x-2 overflow-x-auto pb-2",children:i.steps.map((s,d)=>{const N=d<r,I=d===r,j=d<=r||!n;return e.jsx("button",{onClick:()=>j&&R(d),disabled:!j,className:`
66                      flex-shrink-0 w-8 h-8 rounded-full border-2 flex items-center justify-center text-xs font-medium transition-all
67                      ${I?"border-primary bg-primary text-primary-foreground":N?"border-green-500 bg-green-500/20 text-green-600 hover:bg-green-500/30":j?"border-muted-foreground
67/30 bg-background hover:border-muted-foreground/50 hover:bg-muted/50":"border-muted-foreground/20 bg-muted/20 text-muted-foreground/50 cursor-not-allowed"}
68                    `,children:d+1},d)})})]}),e.jsx(C,{className:"bg-muted/50",children:e.jsx(V,{className:"p-4",children:e.jsx("p",{className:"text-center text-sm leading-relaxed",children:p.instruction})})}),e.jsxs("div",{className:"flex justify-center items-center space-x-2",children:[e.jsx(h,{variant:"ghost",size:"icon",onClick:re,disabled:r===0,className:"h-10 w-10 rounded-full",children:e.jsx(Ce,{className:"h-4 w-4"})}),e.jsx(h,{variant:"ghost",size:"icon",onClick:se,className:"h-16 w-16 rounded-full bg-primary/10 hover:bg-primary/20",children:n?e.jsx(be,{className:"h-8 w-8"}):e.jsx(je,{className:"h-8 w-8"})}),e.jsx(h,{variant:"ghost",size:"icon",onClick:oe,disabled:r===i.steps.length-1,className:"h-10 w-10 rounded-full",children:e.jsx(ke,{className:"h-4 w-4"})})]}),e.jsx("div",{className:"flex justify-center space-x-4",children:e.jsx(h,{variant:"ghost",size:"icon",onClick:ie,className:"h-12 w-12 rounded-full",children:e.jsx(ge,{className:"h-5 w-5"})})}),e.jsxs("div",{className:"flex justify-center space-x-2",children:[e.jsxs(h,{variant:a?"default":"outline",size:"sm",onClick:ae,className:"text-xs",children:[a?e.jsx(Se,{className:"h-4 w-4 mr-1"}):e.jsx(Pe,{className:"h-4 w-4 mr-1"}),"Voice Guide"]}),e.jsxs(h,{variant:o?"default":"outline",size:"sm",onClick:ne,className:"text-xs",children:[e.jsx(we,{className:"h-4 w-4 mr-1"}),"Nature + 432Hz"]})]}),e.jsx("div",{className:"text-center",children:e.jsx(h,{variant:"outline",size:"sm",onClick:F,children:"Close Session"})})]})]})})})},Ye=()=>{const[i,t]=l.useState(null),[c,n]=l.useState(new Set),[f,r]=l.useState(!1),[g,u]=l.useState(!1);l.useEffect(()=>()=>{x.cleanup()},[]);const[y,E]=l.useState("all"),k=[{id:"all",label:"All Practices",icon:X},{id:"pre-date",label:"Pre-Date",icon:$},{id:"confidence",label:"Confidence",icon:W},{id:"post-date",label:"Reflection",icon:X},{id:"general",label:"General",icon:Ae}],a=y==="all"?B:B.filter(o=>o.category===y),w=()=>{i&&(n(o=>new Set([...o,i.id])),t(null))};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center space-y-2",children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Mindful Dating"}),e.jsx("p",{className:"text-muted-foreground max-w-2xl mx-auto",children:"Breathwork and meditation practices designed specifically for dating confidence, anxiety relief, and meaningful connections."})]}),e.jsx("div",{className:"mb-8",children:e.jsx(C,{className:"p-6 bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:e.jsxs("div",{className:"text-center space-y-4",children:[e.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"🤖 AI-Powered Interactive Sessions"}),e.jsx("p",{className:"text-muted-foreground",children:"Experience personalized meditation with real-time AI guidance that adapts to your needs"}),e.jsxs("div",{className:"flex flex-wrap justify-center gap-3",children:[e.jsx(h,{onClick:()=>r(!0),className:"bg-primary hover:bg-primary/90 text-white",children:"Mindfulness AI Guide"}),e.jsx(h,{onClick:()=>r(!0),variant:"outline",className:"border-primary text-primary hover:bg-primary/10",children:"Breathing Coach"}),e.jsx(h,{onClick:()=>r(!0),variant:"outline",className:"border-primary text-primary hover:bg-primary/10",children:"Stress Relief"}),e.jsx(h,{onClick:()=>r(!0),variant:"outline",className:"border-primary text-primary hover:bg-primary/10",children:"Confidence Building"})]})]})})}),e.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:k.map(o=>{const A=o.icon;return e.jsxs(h,{variant:y===o.id?"default":"outline",size:"sm",onClick:()=>E(o.id),className:"flex items-center gap-2",children:[e.jsx(A,{className:"h-4 w-4"}),o.label]},o.id)})}),e.jsx("div",{className:"text-center",children:e.jsxs(h,{onClick:()=>u(!0),variant:"outline",className:"text-left justify-start",children:[e.jsx(W,{className:"mr-2 h-4 w-4"}),"Check Mobile/Desktop Compatibility"]})}),e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:a.map(o=>{const A=o.icon,m=c.has(o.id);return e.jsxs(C,{className:"cursor-pointer hover:shadow-lg transition-shadow group",onClick:()=>t(o),children:[e.jsxs(G,{children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx("div",{className:`w-12 h-12 rounded-full ${o.color} flex items-center justify-center`,children:e.jsx(A,{className:"h-6 w-6 text-white"})}),e.jsxs("div",{className:"flex flex-col items-end gap-2",children:[e.jsxs(L,{variant:"outline",className:"text-xs",children:[o.duration," min"]}),m&&e.jsx(L,{variant:"secondary",className:"text-xs bg-green-100 text-green-800",children:"✓ Completed"})]})]}),e.jsx(D,{className:"text-lg group-hover:text-primary transition-colors",children:o.title})]}),e.jsxs(V,{children:[e.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:o.description}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(L,{variant:"outline",className:"capitalize",children:o.category.replace("-"," ")}),e.jsx(h,{size:"sm",className:"opacity-0 group-hover:opacity-100 transition-opacity",children:"Start Practice"})]})]})]},o.id)})}),e.jsx(C,{className:"bg-gradient-to-r from-primary/5 to-secondary/5",children:e.jsx(V,{className:"p-6",children:e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 text-center",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-primary",children:c.size}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Sessions Completed"})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-2xl font-bold text-secondary",children:Array.from(c).reduce((o,A)=>
68{const m=B.find(S=>S.id===A);return o+((m==null?void 0:m.duration)||0)},0)}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Minutes Practiced"})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"text-2xl font-bold text-accent",children:[Math.round(c.size/B.length*100),"%"]}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Programs Completed"})]})]})})}),i&&e.jsx(Te,{session:i,onComplete:w,onClose:()=>t(null)}),g&&e.jsx("div",{className:"fixed inset-0 bg-background/80 backdrop-blur-sm z-50 flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-4xl max-h-[90vh] overflow-y-auto",children:e.jsxs(C,{children:[e.jsx(G,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(D,{children:"AI Compatibility Analysis"}),e.jsx(h,{variant:"ghost",size:"icon",onClick:()=>u(!1),children:e.jsx(J,{className:"h-4 w-4"})})]})}),e.jsx(V,{children:e.jsx(Me,{})})]})})})]})};export{Ye as default};

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.