PageSourceSearch

https://imaginalapp.space/assets/index-9erSEm9O.js

js imaginalapp.space collected 2026-09-29 22:06:37 UTC 99,721 bytes, 10 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/thread-BOuzZpm3.js","assets/lessons-DIOe4Q76.js","assets/quotes-B0rzRAYr.js","assets/vendor-ebxS2RN4.js","assets/Quiz-Dsk8Fvss.js","assets/Journal-Co3iGy5j.js","assets/NextCard-Dwo7KJl-.js","assets/Support-1JU1SxhB.js","assets/Learn-D2wVvaGF.js","assets/Practice-lb4CeO6u.js","assets/Me-B5nuGAPk.js"])))=>i.map(i=>d[i]);
2var dn=Object.defineProperty;var un=(e,n,a)=>n in e?dn(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a;var Ct=(e,n,a)=>un(e,typeof n!="symbol"?n+"":n,a);import{j as t,r as s,a as hn,c as mn,R as gn}from"./vendor-ebxS2RN4.js";(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const r of o)if(r.type==="childList")for(const l of r.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&i(l)}).observe(document,{childList:!0,subtree:!0});function a(o){const r={};return o.integrity&&(r.integrity=o.integrity),o.referrerPolicy&&(r.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?r.credentials="include":o.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(o){if(o.ep)return;o.ep=!0;const r=a(o);fetch(o.href,r)}})();const pn="modulepreload",fn=function(e){return"/"+e},Tt={},F=function(n,a,i){let o=Promise.resolve();if(a&&a.length>0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),d=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));o=Promise.allSettled(a.map(h=>{if(h=fn(h),h in Tt)return;Tt[h]=!0;const m=h.endsWith(".css"),y=m?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${y}`))return;const u=document.createElement("link");if(u.rel=m?"stylesheet":pn,m||(u.as="script"),u.crossOrigin="",u.href=h,d&&u.setAttribute("nonce",d),document.head.appendChild(u),m)return new Promise((p,b)=>{u.addEventListener("load",p),u.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${h}`)))})}))}function r(l){const d=new Event("vite:preloadError",{cancelable:!0});if(d.payload=l,window.dispatchEvent(d),!d.defaultPrevented)throw l}return o.then(l=>{for(const d of l||[])d.status==="rejected"&&r(d.reason);return n().catch(r)})},yn=[{key:"today",label:"Today"},{key:"journal",label:"Journal"},{key:"learn",label:"Learn"},{key:"practice",label:"Practice"},{key:"me",label:"Me"}];function Ce({name:e}){const n={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"};switch(e){case"today":return t.jsxs("svg",{...n,children:[t.jsx("circle",{cx:"12",cy:"12",r:"3.6"}),t.jsx("path",{d:"M12 3.4v2.1M12 18.5v2.1M3.4 12h2.1M18.5 12h2.1M6 6l1.5 1.5M16.5 16.5 18 18M18 6l-1.5 1.5M7.5 16.5 6 18"})]});case"journal":return t.jsxs("svg",{...n,children:[t.jsx("path",{d:"M12 7C10 5.8 7 5.5 4.8 6v11c2.2-.5 5.2-.2 7.2 1 2-1.2 5-1.5 7.2-1V6C17 5.5 14 5.8 12 7Z"}),t.jsx("path",{d:"M12 7v11"})]});case"learn":return t.jsx("svg",{...n,children:t.jsx("path",{d:"M12 3.4l1.75 6.85L20.6 12l-6.85 1.75L12 20.6l-1.75-6.85L3.4 12l6.85-1.75z"})});case"practice":return t.jsxs("svg",{...n,children:[t.jsx("circle",{cx:"12",cy:"12",r:"8.2"}),t.jsx("circle",{cx:"12",cy:"12",r:"4"}),t.jsx("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor",stroke:"none"})]});case"me":return t.jsx("svg",{...n,children:t.jsx("path",{d:"M16.7 3.7A8.4 8.4 0 1 0 16.7 20.3 6.6 6.6 0 0 1 16.7 3.7Z"})})}}
2function wn({active:e,onChange:n}){return t.jsx("nav",{className:"tabbar","aria-label":"Main",children:yn.map(a=>t.jsxs("button",{type:"button",className:a.key===e?"tab active":"tab","aria-current":a.key===e?"page":void 0,onClick:()=>n(a.key),children:[t.jsx("span",{className:"tab-ico","aria-hidden":"true",children:t.jsx(Ce,{name:a.key})}),t.jsx("span",{className:"tab-label",children:a.label})]},a.key))})}const mt="imaginal-auth-token";function Ke(){try{return localStorage.getItem(mt)}catch{return null}}function Be(e){try{e?localStorage.setItem(mt,e):localStorage.removeItem(mt)}catch{}}function Te(){const e=Ke();return e?{Authorization:`Bearer ${e}`}:{}}const vn="".replace(/\/$/,""),Ee=e=>vn+e;async function w(e,n,a){const i=await fetch(Ee(n),{method:e,headers:{...a!==void 0?{"Content-Type":"application/json"}:{},...Te()},body:a!==void 0?JSON.stringify(a):void 0});if(!i.ok){let o="";try{const l=await i.json();o=l.detail??JSON.stringify(l)}catch{o=await i.text().catch(()=>"")}const r=new Error(o||`Request to ${n} failed (${i.status})`);throw r.status=i.status,r}if(i.status!==204)return i.json()}const bn=(e,n,a)=>w("POST","/api/auth/signup",{email:e,password:n,name:a}),jn=(e,n)=>w("POST","/api/auth/login",{email:e,password:n}),xn=()=>w("POST","/api/auth/logout"),dt=()=>w("GET","/api/auth/me"),kn=e=>w("POST","/api/auth/request-reset",{email:e}),Nn=(e,n)=>w("POST","/api/auth/reset",{token:e,password:n}),Sn=e=>w("POST","/api/auth/verify",{token:e}),Cn=e=>w("POST","/api/auth/resend-verification",{email:e}),ji=()=>w("POST","/api/auth/deactivate"),xi=e=>w("POST","/api/auth/delete",{password:e}),Rt=()=>w("GET","/api/profile"),Jt=e=>w("PUT","/api/profile",{data:e}),Tn=()=>w("GET","/api/journal"),ft=e=>w("PUT",`/api/journal/${e.id}`,{type:e.type,title:e.title,body:e.body,data:e.data}),En=e=>w("DELETE",`/api/journal/${e}`),Pn=e=>w("GET",`/api/daily/${e}`),qt=e=>w("PUT","/api/daily",e),An=e=>w("GET",`/api/streak?today=${e}`),$t=e=>w("POST","/api/practice",e),In=()=>w("GET","/api/practice"),Mn=()=>w("GET","/api/reflect/status"),ki=()=>w("GET","/api/reflect/usage");async function Ni(e,n){const a=await fetch("/api/reflect/chat",{method:"POST",headers:{"Content-Type":"application/json",...Te()},body:JSON.stringify(e)});if(!a.ok||!a.body){let d="";try{d=(await a.json()).detail??""}catch{d=await a.text().catch(()=>"")}const h=new Error(d||`Request failed (${a.status})`);throw h.status=a.status,h}const i=a.body.getReader(),o=new TextDecoder;let r="";const l={model:"",chat_remaining:0};for(;;){const{value:d,done:h}=await i.read();if(h)break;r+=o.decode(d,{stream:!0});const m=r.split(`
3
4`);r=m.pop()??"";for(const y of m){const u=y.split(`
5`).find(b=>b.startsWith("data:"));if(!u)continue;const p=JSON.parse(u.slice(5).trim());if(p.t)n(p.t);else{if(p.error)throw new Error(p.error);p.done&&(l.model=p.model,l.chat_remaining=p.chat_remaining??0)}}}return l}function D(e){try{fetch(Ee("/api/event"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:e})}).catch(()=>{})}catch{}}function Si(e,n,a,i,o){return w("POST","/api/quiz/email",{email:e,profile:n,answers:a,source:i,newsletter_opt_in:o})}async function _n(e,n){return w("POST","/api/practice/subscribe",{email:e,source:n})}async function Ft(e,n,a){if(!(await fetch(Ee(`/api/journal/${e}/audio?duration=${a}`),{method:"PUT",headers:{"Content-Type":n.type||"audio/webm",...Te()},body:n})).ok)throw new Error("Could not save the voice note.")}async function Gn(e){const n=await fetch(Ee(`/api/journal/${e}/audio`),{headers:Te()});if(n.status===404)return null;if(!n.ok)throw new Error("Could not load the voice note.");return n.blob()}const On=e=>w("DELETE",`/api/journal/${e}/audio`);async function Ci(e,n){const a=await fetch(Ee("/api/reflect/stream"),{method:"POST",headers:{"Content-Type":"application/json",...Te()},body:JSON.stringify(e)});if(!a.ok||!a.body){let d="";try{d=(await a.json()).detail??""}catch{d=await a.text().catch(()=>"")}const h=new Error(d||`Request failed (${a.status})`);throw h.status=a.status,h}const i=a.body.getReader(),o=new TextDecoder;let r="";const l={model:""};for(;;){const{value:d,done:h}=await i.read();if(h)break;r+=o.decode(d,{stream:!0});const m=r.split(`
6
7`);r=m.pop()??"";for(const y of m){const u=y.split(`
8`).find(b=>b.startsWith("data:"));if(!u)continue;const p=JSON.parse(u.slice(5).trim());if(p.t)n(p.t);else{if(p.error)throw new Error(p.error);p.done&&(l.model=p.model)}}}return l}const Wn=()=>w("GET","/api/billing/status");async function Ti(e){const{url:n}=await w("POST","/api/billing/checkout",{plan:e});window.location.href=n}async function Ei(){const{url:e}=await w("POST","/api/billing/portal");window.location.href=e}const Pi=()=>w("GET","/api/push/status"),Ai=e=>w("PUT","/api/push",e),Ii=e=>w("POST","/api/push/unsubscribe",{endpoint:e}),Dn=e=>w("GET",`/api/partner?today=${e}`),Ln=()=>w("POST","/api/partner/invite"),Rn=e=>w("GET",`/api/partner/invite/${encodeURIComponent(e)}`),Jn=e=>w("POST","/api/partner/join",{token:e}),qn=e=>w("POST","/api/partner/nudge",{day:e}),$n=()=>w("POST","/api/partner/end");function Fn(){var n,a;if(typeof window>"u")return null;const e=window;return((a=(n=e==null?void 0:e.Capacitor)==null?void 0:n.Plugins)==null?void 0:a.Haptics)??null}function ae(e="light"){var n,a;try{const i=Fn();if(i){e==="success"?(n=i.notification)==null||n.call(i,{type:"SUCCESS"}):(a=i.impact)==null||a.call(i,{style:e==="heavy"?"HEAVY":e==="medium"?"MEDIUM":"LIGHT"});return}if(typeof navigator<"u"&&typeof navigator.vibrate=="function"){const o=e==="success"?[8,36,8]:e==="heavy"?18:e==="medium"?12:7;navigator.vibrate(o)}}catch{}}const Bn=/^[A-Za-z0-9_-]{8,128}$/;function zn(e,n){const a=e.match(/^\/join\/([^/?#]+)\/?$/),i=a?decodeURIComponent(a[1]):new URLSearchParams(n).get("join");return i&&Bn.test(i)?i:null}function Bt(e,n){return`${e.replace(/\/$/,"")}/join/${n}`}function Un(e){const n=e.practised_today?`${e.name} practised today ✓`:`${e.name} hasn’t practised yet today`,a=e.streak>0?` · ${e.streak}-day streak`:"";return n+a}function Hn(e,n){const a=(e||"").trim().split(/\s+/)[0];return`${a?`${a} invited you`:"You’re invited"} to practise together on Imaginal — a few minutes of inner work a day, easier in pairs. ${n}`}function zt({user:e,token:n,onToken:a,onError:i,className:o,label:r="Invite a friend"}){const[l,d]=s.useState("idle");async function h(){d("busy");try{const m=n||(await Ln()).token;a==null||a(m);const y=Bt(window.location.origin,m),u=Hn(e.name,y),p=navigator;if(p.share)try{await p.share({title:"Practise together on Imaginal",text:u,url:y}),d("shared"),ae("success");return}catch{}await navigator.clipboard.writeText(y),d("copied"),ae("light")}catch(m){d("idle"),i==null||i(m.message||"Couldn’t create the invite link.");return}setTimeout(()=>d("idle"),2500)}return t.jsx("button",{type:"button",className:o??"btn btn-primary btn-sm",disabled:l==="busy",onClick:h,children:l==="copied"?"Link copied ✓":l==="shared"?"Sent ✓":l==="busy"?"One moment…":r})}function Yn({partner:e,day:n,onFlash:a,onChanged:i}){const[o,r]=s.useState(!1),[l,d]=s.useState(!1),h=e.presence;if(!e.partnership||!h)return null;const m=l||!!e.nudged_today;async function y(){r(!0);try{const u=await qn(n);u.sent?(d(!0),ae("success"),a(`✦ A nudge is on its way to ${u.partner_name}.`),i()):a(`${u.partner_name}
8 hasn’t turned on notifications yet — a message from you might land better.`)}catch(u){const p=u.status;a(p===429?"One nudge a day between you — today’s has already gone.":u.message||"Couldn’t send the nudge."),p===429&&d(!0)}finally{r(!1)}}return t.jsxs("div",{className:`partner-line${h.practised_today?" did":""}`,role:"status",children:[t.jsx("span",{className:"partner-dot","aria-hidden":"true",children:h.practised_today?"✓":"·"}),t.jsx("span",{className:"partner-text",children:Un(h)}),!h.practised_today&&t.jsx("button",{type:"button",className:"partner-nudge-btn",disabled:o||m,onClick:y,"aria-label":m?"Nudge sent today":`Nudge ${h.name}`,children:m?"Nudged ✓":"Nudge"})]})}function Vn({user:e,onInvited:n,onDismiss:a}){const[i,o]=s.useState(null);return t.jsxs("div",{className:"rem-nudge partner-invite-nudge",children:[t.jsxs("p",{className:"rem-nudge-text",children:[t.jsx("b",{children:"Practice is easier in pairs."})," Invite a friend — you’ll each see whether the other practised today, nothing more."]}),t.jsxs("div",{className:"rem-nudge-actions",children:[t.jsx(zt,{user:e,onToken:n,onError:o}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:a,children:"Not now"})]}),i&&t.jsx("p",{className:"auth-error",style:{marginTop:8},children:i})]})}function Mi({user:e,partner:n,onChanged:a}){var m;const[i,o]=s.useState(!1),[r,l]=s.useState(null),d=n!=null&&n.invite?Bt(window.location.origin,n.invite.token):null;async function h(y){if(confirm(y)){o(!0),l(null);try{await $n(),a()}catch(u){l(u.message)}finally{o(!1)}}}if(n!=null&&n.partnership){const y=n.presence;return t.jsxs(t.Fragment,{children:[t.jsxs("p",{className:"muted",style:{margin:"0 0 6px"},children:["You’re practising with ",t.jsx("b",{children:n.partnership.partner.name}),".",y&&t.jsxs(t.Fragment,{children:[" ",y.practised_today?"They’ve practised today ✓":"They haven’t practised yet today",y.streak>0?` · ${y.streak}-day streak`:"","."]})]}),t.jsx("p",{className:"dim",style:{margin:"0 0 12px",fontSize:".8rem"},children:"You each see only whether the other practised today and their streak — never journal entries or what you wrote."}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",disabled:i,onClick:()=>{var u;return h(`End your practice partnership with ${(u=n.partnership)==null?void 0:u.partner.name}? Either of you can start a new one afterwards.`)},children:"End partnership"}),r&&t.jsx("p",{className:"auth-error",style:{marginTop:8},children:r})]})}return t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"muted",style:{margin:"0 0 10px"},children:"Daily practice is easier in pairs. Share a link with one friend; you’ll each see whether the other practised today, and can send a gentle nudge."}),d&&t.jsx("div",{className:"partner-link-row",children:t.jsx("input",{className:"input",readOnly:!0,value:d,onFocus:y=>y.currentTarget.select(),"aria-label":"Your invite link"})}),t.jsxs("div",{className:"row wrap",children:[t.jsx(zt,{user:e,token:(m=n==null?void 0:n.invite)==null?void 0:m.token,onToken:a,onError:l,label:d?"Share the link again":"Create an invite link"}),d&&t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",disabled:i,onClick:()=>h("Cancel this invite link? It will stop working."),children:"Cancel invite"})]}),d&&t.jsx("p",{className:"dim",style:{fontSize:".78rem",margin:"10px 0 0"},children:"Waiting for your friend to join — the link works until they do."}),r&&t.jsx("p",{className:"auth-error",style:{marginTop:8},children:r})]})}function Kn({token:e,user:n,onOpenAuth:a,onJoined:i,onDismiss:o}){const[r,l]=s.useState(null),[d,h]=s.useState(null),[m,y]=s.useState(!1),u=s.useRef(!1);s.useEffect(()=>{let k=!0;return Rn(e).then(S=>{k&&l(S)}).catch(S=>{k&&h(S.message||"This invite link is invalid or no longer active.")}),()=>{k=!1}},[e]);async function p(){y(!0),h(null);try{const k=await Jn(e);ae("success"),i(k)}catch(k){h(k.message||"Couldn’t join right now.")}finally{y(!1)}}s.useEffect(()=>{n&&u.current&&(u.current=!1,p())},[n]);const b=r==null?void 0:r.inviter_name,N=(r==null?void 0:r.status)==="pending";return t.jsx("div",{className:"join-landing",role:"dialog","aria-modal":"true","aria-label":"Practice partner invitation",children:t.jsxs("div",{className:"join-card",children:[t.jsxs("span",{className:"brand",style:{justifyContent:"center"},children:[t.jsx("span",{className:"brand-glyph",children:"✦"})," Imaginal"]}),!r&&!d&&t.jsx("p",{className:"status",children:"Opening your invitation…"}),r&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"lookback-eyebrow",children:"Practice partner"}),t.jsx("h1",{className:"join-title serif",children:N?t.jsxs(t.Fragment,{children:[b," invited you to practice together"]}):t.jsx(t.Fragment,{children:"This invite has already been used"})}),t.jsx("p",{className:"join-lead",children:"Imaginal is a few minutes of inner work a day — a morning intention, an evening revision, one line of gratitude — drawn from Neville Goddard, Jung, and the contemplative traditions."}),N&&t.jsx("p",{className:"join-lead",children:"As partners you’ll each see only whether the other practised today and their streak — never what you wrote."})]}),d&&t.jsx("p",{className:"auth-error center",children:d}),r&&N&&!n&&t.jsxs("div",{className:"join-actions",children:[t.jsxs("button",{type:"button",className:"btn btn-primary btn-block",onClick:()=>{u.current=!0,a("signup")},children:["Create a free account & join ",b]}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-block",onClick:()=>{u.current=!0,a("login")},children:"I have an account — sign in"})]}),r&&N&&n&&t.jsx("div",{className:"join-actions",children:t.jsx("button",{type:"button",className:"btn btn-primary btn-block",disabled:m,onClick:p,children:m?"Joining…":`Join ${b}`})}),t.jsx("button",{type:"button",className:"beat-back",onClick:o,children:N?"Not now":"Open Imaginal"})]})})}const Et={neville:"Neville Goddard",jung:"Jung & von Franz"},Pt={neville:"✦",jung:"☾"},ut=[{id:"nev-assume",tradition:"neville",source:"Neville Goddard",teaching:"Assume the feeling of the wish fulfilled, and let that assumption harden into fact.",micro:"For sixty seconds, feel one wish as already, quietly, true.",prompt:"Write one sentence as if your desire is already yours."},{id:"jun-unconscious",tradition:"jung",source:"C. G. Jung",teaching:"Until you make the unconscious conscious it will direct your life — and you will call it fate.",micro:"Name one mood today you can’t quite explain.",prompt:"What might that unexplained mood be carrying?"},{id:"nev-imagination",tradition:"neville",source:"Neville Goddard",teaching:"Imagination is the gateway of reality — the world is your imagining pushed out.",micro:"Picture a short scene that would only exist if your wish were real.",prompt:"Describe the scene that implies the wish is fulfilled."},{id:"jun-shadow",tradition:"jung",source:"C. G. Jung",teaching:"What irritates us in others can lead to an understanding of ourselves.",micro:"Recall one irritation today and look for its mirror in you.",prompt:"What disowned trait might that irritation point to?"},{id:"nev-feeling",tradition:"neville",source:"Neville Goddard",teaching:"Feeling is the secret. The feeling, not the words, is the prayer that is answered.",micro:"Recall a past joy until its warmth returns to your body.",prompt:"What feeling does your fulfilled wish carry in the body?"},{id:"jun-active",tradition:"jung",source:"Active imagination",teaching:"Let the inner figures speak. Imagination is a real organ of perception.",micro:"Let one inner image appear, and ask it a single question.",prompt:"Who appeared — and what did they say back?"},{id:"nev-revision",tradition:"neville",source:"Neville Goddard",teaching:"Revise the day. Re-live any scene the way you wished it had gone.",micro:"Replay one moment from today exactly as you would have liked it.",prompt:"Rewrite one scene from today as it should have been."},{id:"jun-dream",tradition:"jung",source:"M.-L. von Franz",teaching:"The dream is a little hidden door into the innermost recesses of the soul.",micro:"Recall one image from a recent dream and stay with it.",prompt:"Hold one dream image — what feeling surrounds it?"},{id:"nev-sats",tradition:"neville",source:"Neville Goddard",teaching:"Sleep in the assumption that it is done (the state akin to sleep, SATS).",micro:"Choose a single short scene of fulfillment to drift asleep inside tonight.",prompt:"What one scene will you sleep in tonight?"},{id:"jun-self",tradition:"jung",source:"Individuation",teaching:"Individuation is becoming the one you already, secretly, are.",micro:"Ask quietly: “What in me is asking to become whole?”",prompt:"What part of you is asking for more room?"},{id:"nev-means",tradition:"neville",source:"Neville Goddard",teaching:"Dwell on the end; leave the means to your imagination.",micro:'For a minute, refuse to plan the "how". Rest only in the "done".',prompt:'Where are you gripping the "how"? Loosen it here.'},{id:"jun-synchronicity",tradition:"jung",source:"Synchronicity",teaching:"A meaningful coincidence can be the psyche and the world rhyming.",micro:"Notice one coincidence today and let it mean something.",prompt:"What “coincidence” felt like it was addressed to you?"},{id:"nev-state",tradition:"neville",source:"Neville Goddard",teaching:"You are already that which you seek; assume the state and walk in it.",micro:"Step into the “I am it” feeling and hold it for a few breaths.",prompt:"Who are you when the wish is already true? Describe that person."},{id:"jun-persona",tradition:"jung",source:"C. G. Jung",teaching:"The persona is a mask for the world — useful, but not who you are.",micro:"Notice one mask you wore today; thank it, then set it down.",prompt:"Where does your persona differ from your truer face?"},{id:"nev-iam",tradition:"neville",source:"Neville Goddard",teaching:"Whatever you attach to “I am”, you summon into being.",micro:"Catch one “I am tired / anxious” and gently reword the “I am”.",prompt:"What have you been quietly affirming after “I am”?"},{id:"jun-opposites",tradition:"jung",source:"C. G. Jung",teaching:"Hold the tension of opposites and a third, reconciling thing can be born.",micro:"Name tw
8o opposing pulls in you; hold both without choosing.",prompt:"What pair of opposites are you living between right now?"},{id:"nev-attention",tradition:"neville",source:"Neville Goddard",teaching:"Attention is the creative power; where it rests, life gathers.",micro:"For one minute, rest attention on what you want, not what you fear.",prompt:"Where has your attention been living lately?"},{id:"jun-projection",tradition:"jung",source:"C. G. Jung",teaching:"What we cannot see in ourselves we meet, magnified, in others.",micro:"Catch one strong reaction and ask what it mirrors in you.",prompt:"Whom are you judging — and what might it reveal about you?"},{id:"nev-bridge",tradition:"neville",source:"Neville Goddard",teaching:"Hold the end; a bridge of incidents will carry you to it.",micro:"Assume the wish fulfilled and let go of plotting the route.",prompt:"What “how” can you release to imagination today?"},{id:"jun-fairytale",tradition:"jung",source:"M.-L. von Franz",teaching:"Fairy tales are maps of the psyche; their figures live in you.",micro:"Recall a tale that gripped you young; feel which figure you are.",prompt:"Which fairy-tale figure is active in your life now?"},{id:"nev-faith",tradition:"neville",source:"Neville Goddard",teaching:"Faith is feeling the reality of the unseen until it is seen.",micro:"Give the unseen wish the trust you give the sunrise.",prompt:"What would you do today if you fully trusted it was done?"},{id:"jun-alchemy",tradition:"jung",source:"Jung on alchemy",teaching:"The work turns lead into gold — and the base material is your own life.",micro:"Find the “lead” of today and imagine it as raw gold.",prompt:"What heavy experience might be slowly transforming in you?"},{id:"nev-conversation",tradition:"neville",source:"Neville Goddard",teaching:"Change the inner conversation and you change the outer life.",micro:"Notice your inner talk; turn one complaint into thanks.",prompt:"What inner conversation are you ready to revise?"},{id:"jun-wholeness",tradition:"jung",source:"C. G. Jung",teaching:"The goal is not perfection but wholeness — including the dark.",micro:"Welcome one rejected part of yourself, briefly, as a guest.",prompt:"What part of you wants to be included, not fixed?"},{id:"nev-wish",tradition:"neville",source:"Neville Goddard",teaching:"Desire is the spark of creation — the wish is heaven whispering what’s possible for you.",micro:"Name one true desire without apology; feel it as worthy.",prompt:"What does your deepest wish reveal about who you’re becoming?"},{id:"jun-anima",tradition:"jung",source:"C. G. Jung",teaching:"The contrasexual within — anima or animus — carries the soul’s images; court it.",micro:"Notice who fascinates or provokes you; ask what they carry for you.",prompt:"What does a figure you’re drawn to reveal about your soul?"},{id:"nev-mood",tradition:"neville",source:"Neville Goddard",teaching:"Your prevailing mood is the prophet of your future; tend it like a garden.",micro:"Choose the mood of the fulfilled wish and wear it for a minute.",prompt:"What mood have you been broadcasting lately?"},{id:"jun-complex",tradition:"jung",source:"C. G. Jung",teaching:"A complex has a will of its own; name it and its grip loosens.",micro:"Notice a button that got pushed today; name the pattern behind it.",prompt:"What old, charged theme keeps getting triggered in you?"},{id:"nev-everyone",tradition:"neville",source:"Neville Goddard",teaching:"Everyone you meet is yourself pushed out — so meet them as you wish to be met.",micro:"Silently assume the best of one person today.",prompt:"Who in your life might be mirroring your own assumptions?"},{id:"jun-numinous",tradition:"jung",source:"C. G. Jung",teaching:"Stay open to the numinous — the awe that quietly rearranges a life.",micro:"Let one beautiful or vast thing stop you for a breath.",prompt:"When did you last feel genuine awe — and what stirred it?"},{id:"nev-test",tradition:"neville",source:"Neville Goddard",teaching:"Put the law to the test on one small thing, and let the proof teach you.",micro:"Pick a tiny outcome and assume it quietly today.",prompt:"What small thing will you test your imagining on?"},{id:"jun-symbol",tradition:"jung",source:"C. G. Jung",teaching:"A symbol is not a sign; it points past anything words can fully hold.",micro:"Hold one image from a dream or the day without explaining it.",prompt:"What image keeps tugging at you, beyond words?"},{id:"nev-thanks",tradition:"neville",source:"Neville Goddard",teaching:"Give thanks now; gratitude is how you receive a gift before you see it.",micro:"Thank life for the wish as though it has already arrived.",prompt:"What can you thank in advance, as good as done?"},{id:"jun-midlife",tradition:"jung",source:"C. G. Jung",teaching:"At the turn of life the psyche asks for what the morning of life set aside.",micro:"Name one part of you that got shelved long ago.",prompt:"What set-aside longing is asking for room now?"},{id:"nev-rest",tradition:"neville",source:"Neville Goddard",teaching:"Having assumed it, rest — straining only says you don’t yet believe.",micro:"Notice one place you’re forcing; let your shoulders drop.",prompt:"Where can you trade effort for quiet certainty?"},{id:"jun-wiseold",tradition:"jung",source:"C. G. Jung",teaching:"The wise old one appears when the conscious mind has reached its limit.",micro:"Imagine a wise elder; ask them the question you’re stuck on.",prompt:"What would your inner sage say about your dilemma?"},{id:"nev-cause",tradition:"neville",source:"Neville Goddard",teaching:"Consciousness is the one and only reality — tend it first.",micro:"Trace one outer worry back to the inner state feeding it.",prompt:"What state of consciousness are you living from today?"},{id:"jun-value",tradition:"jung",source:"C. G. Jung",teaching:"Feeling is a function of value — honor what genuinely moves you.",micro:"Notice what stirred real feeling today, and why.",prompt:"What moved you today — and what does it value?"},{id:"nev-now",tradition:"neville",source:"Neville Goddard",teaching:"There is no tomorrow in imagination; assume the wish now.",micro:"Drop “someday”; feel the wish as a present fact for a minute.",prompt:"How would now feel if it were already done?"},{id:"jun-child",tradition:"jung",source:"The inner child",teaching:"Tend the child you once were; they still live within you.",micro:"Offer a kind word to your younger self.",prompt:"What did young-you need that you can give now?"},{id:"nev-doubt",tradition:"neville",source:"Neville Goddard",teaching:"Doubt is faith in the unwanted — turn it toward the wish.",micro:"Catch one doubt and restate it as the outcome you prefer.",prompt:"What fear have you been faithfully rehearsing?"},{id:"jun-record",tradition:"jung",source:"M.-L. von Franz",teaching:"Write the dream down before it dissolves; the psyche speaks in images.",micro:"Jot one fragment from a recent dream right now.",prompt:"What dream image is still faintly with you?"},{id:"nev-felt",tradition:"neville",source:"Neville Goddard",teaching:"What you would be, you must first feel yourself to be.",micro:"Feel the quality you want as already yours, for a few breaths.",prompt:"Who do you feel yourself to be, most of the time?"},{id:"jun-wounddoor",tradition:"jung",source:"C. G. Jung",teaching:"Make meaning of the wound, and it can become a doorway.",micro:"Ask what one old hurt has taught or opened in you.",prompt:"Where has a wound slowly become a doorway?"},{id:"nev-screen",tradition:"neville",source:"Neville Goddard",teaching:"The outer world is a screen on which your inner state is shown.",micro:"Read one situation today as a mirror of an inner assumption.",prompt:"What might today’s events be reflecting back to you?"},{id:"jun-darkness",tradition:"jung",source:"C. G. Jung",teaching:"We become whole not by imagining light, but by meeting our darkness.",micro:"Turn toward one thing in yourself you’d rather not see.",prompt:"What part of you have you been keeping in the dark?"},{id:"nev-end3",tradition:"neville",source:"Neville Goddard",teaching:"Think from the end, not merely toward it.",micro:"Stand inside the finished wish and look back, not forward.",prompt:"From the end, what has already fallen into place?"},{id:"jun-task",tradition:"jung",source:"C. G. Jung",teaching:"Where your fear is, your task — and your growth — are waiting.",micro:"Name one fear; ask what it’s inviting you to face.",prompt:"What is your fear quietly pointing you toward?"},{id:"nev-give",tradition:"neville",source:"Neville Goddard",teaching:"To receive, first give yourself the feeling of already having.",micro:"Generate the satisfaction of “it’s here” before it appears.",prompt:"What would “already having it” feel like, right now?"},{id:"jun-vocation",tradition:"jung",source:"C. G. Jung",teaching:"Follow what holds a charge of awe; it marks your path.",micro:"Notice what gives you energy today, and lean toward it.",prompt:"What lights you up — and what does it ask of you?"},{id:"nev-worthy",tradition:"neville",source:"Neville Goddard",teaching:"You are worthy of your desire; the wish is life seeking to express through you.",micro:"Drop the “do I deserve it?” and simply assume it.",prompt:"Where does unworthiness quietly block your wish?"},{id:"jun-accept",tradition:"jung",source:"C. G. Jung",teaching:"What you can accept in yourself, you can begin to transform.",micro:"Offer acceptance to one trait you usually fight.",prompt:"What might change if you stopped fighting yourself here?"},{id:"nev-replace",tradition:"neville",source:"Neville Goddard",teaching:"When an unwanted scene plays, gently replace it with its lovely opposite.",micro:"Catch one worry-scene and re-cast it as already resolved.",prompt:"What scene keeps replaying that you could revise?"},{id:"jun-meaning",tradition:"jung",source:"C. G. Jung",teaching:"Meaning can make almost anything bearable.",micro:"Ask what one hard thing might be trying to teach you.",prompt:"Where are you hungry for meaning, not just relief?"},{id:"nev-walk",tradition:"neville",source:"Neville Goddard",teaching:"Walk through the day as though your prayer is already answered.",micro:"Carry the posture of the fulfilled wish for one hour.",prompt:"How would you move through today if it were already done?"},{id:"jun-dream2",tradition:"jung",source:"M.-L. von Franz",teaching:"Dreams are letters from the deeper self; read them kindly.",micro:"Greet last night’s dream as a message, not a puzzle.",prompt:"If your last dream were a letter, what was its tone?"},{id:"nev-speech",tradition:"neville",source:"Neville Goddard",teaching:"Align your inner speech with the wish; words within shape the world without.",micro:"Reword one inner sentence to match what you want.",prompt:"What is your inner speech repeating lately?"},{id:"jun-relation",tradition:"jung",source:"C. G. Jung",teaching:"A true meeting changes both people, like two elements reacting.",micro:"Enter one conversation today willing to be changed.",prompt:"Who has transformed y
8ou simply by meeting you?"},{id:"nev-mirror",tradition:"neville",source:"Neville Goddard",teaching:"The world is a mirror, forever reflecting back what you are within.",micro:"Read one outer reaction today as a reflection of your inner state.",prompt:"What has the world been mirroring back to you lately?"},{id:"jun-outgrow",tradition:"jung",source:"C. G. Jung",teaching:"The great problems of life are never solved — only outgrown.",micro:"Notice one problem you’ve outgrown rather than solved.",prompt:"Which struggle are you ready to outgrow rather than fix?"},{id:"nev-firstperson",tradition:"neville",source:"Neville Goddard",teaching:"Imagine from within the scene — through your own eyes, not as a spectator.",micro:"Re-enter a wished-for scene from the inside for a minute.",prompt:"Are you watching your wish, or living inside it?"},{id:"jun-meaningless",tradition:"jung",source:"C. G. Jung",teaching:"The mind cannot bear a meaningless life; meaning heals more than comfort.",micro:"Ask what one hard thing is asking of you, not just taking from you.",prompt:"Where are you seeking meaning, not only relief?"},{id:"nev-natural",tradition:"neville",source:"Neville Goddard",teaching:"A true assumption feels natural and obvious — never forced or merely hoped-for.",micro:"Hold your wish until it feels ordinary, like an old fact.",prompt:"Does your wish feel natural yet, or still effortful?"},{id:"jun-afternoon",tradition:"jung",source:"C. G. Jung",teaching:"You cannot live the afternoon of life by the morning’s program.",micro:"Notice one old rule that no longer fits this season of life.",prompt:"What worked once that you have quietly outgrown?"},{id:"nev-evidence",tradition:"neville",source:"Neville Goddard",teaching:"Refuse to take the evidence of the senses as the final word.",micro:"Notice one “fact” you’re treating as fixed; hold it lightly.",prompt:"What current “reality” are you ready to stop confirming?"},{id:"jun-acceptself",tradition:"jung",source:"C. G. Jung",teaching:"The most daunting task is to accept oneself, completely.",micro:"Offer acceptance to one part of yourself you usually refuse.",prompt:"What in you is still waiting to be accepted?"},{id:"nev-endfeeling",tradition:"neville",source:"Neville Goddard",teaching:"Capture the feeling that would be yours if the wish were already fulfilled.",micro:"Name the single feeling the fulfilled wish would bring; rest in it.",prompt:"What feeling is the real prize behind your wish?"},{id:"jun-calling",tradition:"jung",source:"C. G. Jung",teaching:"A vocation is a summons — something in you calls, and you answer.",micro:"Listen for what quietly, persistently calls you.",prompt:"What has been calling you that you keep postponing?"},{id:"nev-desire",tradition:"neville",source:"Neville Goddard",teaching:"Your deepest desire is a kind of word in you, pointing to who you’re meant to become.",micro:"Name one true desire and treat it as guidance, not greed.",prompt:"What is your strongest desire trying to tell you?"},{id:"jun-goldshadow",tradition:"jung",source:"C. G. Jung",teaching:"The shadow holds gold as well as dross — disowned gifts, not only faults.",micro:"Ask what strength you’ve hidden because it felt “too much”.",prompt:"What disowned gift might be waiting in your shadow?"},{id:"nev-night",tradition:"neville",source:"Neville Goddard",teaching:"What you fall asleep in, you tend to wake into; choose your last thought with care.",micro:"Tonight, let your final waking thought be the wish fulfilled.",prompt:"What will you carry into sleep tonight?"},{id:"jun-solitude",tradition:"jung",source:"C. G. Jung",teaching:"In solitude the inner voice, drowned out by noise, grows audible again.",micro:"Take three minutes of true quiet and simply listen inward.",prompt:"What does your inner voice say when the noise stops?"},{id:"nev-forgive",tradition:"neville",source:"Neville Goddard",teaching:"To forgive is to exchange the old image of someone for a better one — including yourself.",micro:"Hold one person (or yourself) in a kinder, truer image for a minute.",prompt:"Whose old image are you ready to revise?"},{id:"jun-symboliclife",tradition:"jung",source:"C. G. Jung",teaching:"A life without symbol and image goes flat; tend what carries meaning for you.",micro:"Notice one object, image, or ritual that holds meaning; honor it.",prompt:"What symbols quietly hold your life together?"},{id:"nev-prune",tradition:"neville",source:"Neville Goddard",teaching:"Revision is the pruning shears: cut away the scenes you don’t want to grow.",micro:"Replay one unwanted moment from today and re-cut it.",prompt:"What scene from today would you prune and re-grow?"},{id:"jun-woundhealer",tradition:"jung",source:"C. G. Jung",teaching:"The wounded one becomes the healer; your hurt can ripen into your gift.",micro:"Ask how one old wound has made you more able to help others.",prompt:"How has a wound of yours become a source of compassion?"},{id:"nev-believe",tradition:"neville",source:"Neville Goddard",teaching:"To believe is to live as if — to be so alive to the wish that you act from it.",micro:"Do one small thing today as the person whose wish is fulfilled.",prompt:"What would you do today if you fully believed?"},{id:"jun-instinct",tradition:"jung",source:"C. G. Jung",teaching:"Beneath the noise, the psyche has its own older wisdom; trust the deeper instinct.",micro:"Feel for the gut sense beneath today’s decision.",prompt:"Where is your deeper instinct pointing that your head resists?"},{id:"nev-imaginalact",tradition:"neville",source:"Neville Goddard",teaching:"A vividly felt imaginal act is itself a creative deed, as real as any outer one.",micro:"Perform one short scene in imagination, with full feeling.",prompt:"What imaginal act could you perform right now?"},{id:"jun-godimage",tradition:"jung",source:"C. G. Jung",teaching:"What older language called God, the psyche meets within as the Self.",micro:"Sense, quietly, the center in you that is larger than the ego.",prompt:"When have you felt a center in you greater than “I”?"},{id:"nev-loved",tradition:"neville",source:"Neville Goddard",teaching:"Assume you are deeply loved and supported, and life arranges itself to confirm it.",micro:"For a minute, rest in the felt sense of being wholly supported.",prompt:"How would today change if you assumed you were fully supported?"},{id:"jun-paradox",tradition:"jung",source:"C. G. Jung",teaching:"The psyche speaks in paradox; hold the both/and rather than forcing either/or.",micro:"Take one “contradiction” in you and let both sides be true for now.",prompt:"What two opposite things are both true of you today?"},{id:"nev-power",tradition:"neville",source:"Neville Goddard",teaching:"All power is within; nothing outside can give or withhold what you truly assume.",micro:"Notice one thing you’re waiting for “out there”, and claim it within.",prompt:"Where are you handing your power to circumstances?"},{id:"jun-inferior",tradition:"jung",source:"C. G. Jung",teaching:"Your weakest, least-developed side is often the very doorway to growth.",micro:"Name the part of life you handle worst; greet it kindly.",prompt:"What clumsy, undeveloped side of you is asking for attention?"},{id:"nev-quiet",tradition:"neville",source:"Neville Goddard",teaching:"Quiet confidence, not loud affirmation, is the mark of a settled assumption.",micro:"Drop the effort to convince yourself; simply rest in the wish as done.",prompt:"Does your assumption feel calm, or are you still arguing for it?"},{id:"jun-nightsea",tradition:"jung",source:"C. G. Jung",teaching:"The “night sea journey”: we descend into darkness in order to be renewed.",micro:"If you’re in a hard passage, ask what it might be growing in you.",prompt:"What darkness are you passing through — and toward what?"},{id:"nev-wanting",tradition:"neville",source:"Neville Goddard",teaching:"Wanting keeps the wish at a distance; live instead in the state of already having.",micro:"Catch one “I w
8ant…” and rephrase it as “I have…”, and feel it.",prompt:"Where are you wanting from lack rather than living from having?"},{id:"jun-imageheals",tradition:"jung",source:"C. G. Jung",teaching:"An image, truly met, can heal what argument and willpower cannot.",micro:"Stay with one healing image for a minute, without explaining it.",prompt:"What image comforts or steadies you when words fail?"},{id:"nev-endday",tradition:"neville",source:"Neville Goddard",teaching:"End each day in the feeling of having received what you desire.",micro:"Tonight, replay the day as if your wish had already been granted.",prompt:"What would you give thanks for tonight, as already received?"},{id:"jun-body",tradition:"jung",source:"C. G. Jung",teaching:"The body carries what the mind won’t say; read its signals as messages.",micro:"Scan the body once; ask what one tension might be trying to tell you.",prompt:"What is your body saying that you’ve been talking over?"},{id:"nev-stillness",tradition:"neville",source:"Neville Goddard",teaching:"In stillness, assume — the calm mind impresses the wish most deeply.",micro:"Settle into a quiet minute, then gently assume the wish fulfilled.",prompt:"What grows clearer about your wish when the mind is still?"},{id:"jun-meaningsearch",tradition:"jung",source:"C. G. Jung",teaching:"Much of our unrest is, at its root, a search for meaning.",micro:"Ask whether a current restlessness is really a hunger for meaning.",prompt:"Where might your restlessness be pointing you toward meaning?"},{id:"nev-inner-talk",tradition:"neville",source:"Neville Goddard",teaching:"Your inner conversations are the seeds of circumstance — tend the ones you would harvest.",micro:"Catch one running inner conversation and gently rewrite it toward the end you want.",prompt:"What have you been rehearsing inwardly — and what would you rather say?"},{id:"nev-the-state",tradition:"neville",source:"Neville Goddard",teaching:"You attract not the thing you want, but the state you are willing to occupy.",micro:"Name the state your wish lives in — at ease, loved, secure — and step into it for a minute.",prompt:"Which inner state does your wish belong to — and can you enter it now?"},{id:"nev-persist",tradition:"neville",source:"Neville Goddard",teaching:"An assumption hardens into fact only when it is lived in with quiet persistence.",micro:"Return to the wish fulfilled once more today — calmly, as if for the tenth time.",prompt:"Where can you trade urgency for steady persistence?"},{id:"nev-first-cause",tradition:"neville",source:"Neville Goddard",teaching:"Imagination is the first cause; the outer event is only its echo returning.",micro:"Before acting, imagine the outcome already complete, then let the action follow from it.",prompt:"What could you cause in imagination first, before you touch it outwardly?"},{id:"jun-persona",tradition:"jung",source:"C. G. Jung",teaching:"The mask you show the world is useful, but it is not you — know the difference.",micro:"Notice one place today you played a role; sense who stood behind the mask.",prompt:"Where does your public face differ from your private self?"},{id:"jun-projection",tradition:"jung",source:"C. G. Jung",teaching:"What we cannot see in ourselves we meet, disguised, in the people around us.",micro:"Recall a strong reaction to someone; ask what it might reveal about you.",prompt:"What might you be seeing in another that actually lives in you?"},{id:"jun-opposites",tradition:"jung",source:"C. G. Jung",teaching:"Growth often means holding two opposite truths without collapsing either one.",micro:"Name a tension you want to fix; try simply holding both sides for a minute.",prompt:"Which opposites are you being asked to hold, rather than resolve?"},{id:"jun-synchronicity",tradition:"jung",source:"C. G. Jung",teaching:"Now and then an outer event rhymes with an inner one — a meaningful coincidence.",micro:"Recall a coincidence that felt meaningful; ask what it seemed to answer.",prompt:"What synchronicity have you noticed — and what was stirring in you at the time?"}],Zn=864e5;function Ut(e,n){const a=Math.floor(new Date(e+"T00:00:00").getTime()/Zn),i=n?ut.filter(r=>r.tradition===n):ut,o=i.length?i:ut;return o[(a%o.length+o.length)%o.length]}const At={sun:t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"32",cy:"32",r:"11"}),t.jsx("path",{d:"M32 4v8M32 52v8M4 32h8M52 32h8M12 12l6 6M46 46l6 6M52 12l-6 6M18 46l-6 6"})]}),moon:t.jsx("path",{d:"M42 10A24 24 0 1 0 42 54A18 18 0 1 1 42 10Z"}),ouroboros:t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"32",cy:"32",r:"16"}),t.jsx("path",{d:"M32 16l-7-4 0 8Z",fill:"currentColor",stroke:"none"})]}),spiral:t.jsx("path",{d:"M32 32C32 28 37 28 37 33C37 40 27 40 27 31C27 21 43 21 43 34C43 47 21 47 21 30"}),tree:t.jsx("path",{d:"M32 56V27M32 40q-10-4-14-12M32 40q10-4 14-12M32 28q-6-6-8-15M32 28q6-6 8-15M32 56q-5-1-9 3M32 56q5-1 9 3"}),water:t.jsx("path",{d:"M10 24q6-7 12 0t12 0 12 0M10 34q6-7 12 0t12 0 12 0M10 44q6-7 12 0t12 0 12 0"}),mountain:t.jsx("path",{d:"M6 50L22 24L32 38L42 20L58 50Z"}),eye:t.jsxs(t.Fragment,{children:[t.jsx("path",{d:"M6 32q26-20 52 0q-26 20-52 0Z"}),t.jsx("circle",{cx:"32",cy:"32",r:"7"}),t.jsx("circle",{cx:"32",cy:"32",r:"1.6",fill:"currentColor",stroke:"none"})]}),key:t.jsxs(t.Fragment,{children:[t.jsx("circle",{cx:"21",cy:"32",r:"9"}),t.jsx("path",{d:"M30 32h26M50 32v7M56 32v9"})]}),flame:t.jsx("path",{d:"M32 55c-9-3-13-11-9-20 2 5 5 5 6 2 1-6-2-9-1-14 6 3 13 10 13 20 0 7-4 12-9 12Z"}),star:t.jsx("path",{d:"M32 5L38.7 22.6L57.5 24.1L43.1 36.3L47.6 54.6L32 44.7L16.4 54.6L20.9 36.3L6.5 24.1L25.3 22.6Z"}),threshold:t.jsx("path",{d:"M12 56V28a20 20 0 0 1 40 0v28M6 56h52"})};function Qn({id:e,size:n=44}){return t.jsx("svg",{viewBox:"0 0 64 64",width:n,height:n,fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:At[e]??At.spiral})}const gt="imaginal-course-asked";function Xn({onDone:e}){const[n,a]=s.useState(""),[i,o]=s.useState("idle"),[r,l]=s.useState("");s.useEffect(()=>{D("course_nudge_shown")},[]);async function d(m){m.preventDefault();const y=n.trim();if(!(!y||i==="sending")){o("sending");try{const u=await _n(y,"ritual_complete");if(u.already)l(`${y} is already walking the course — the next morning arrives tomorrow.`);else if(u.sent)l(`Check ${y} — tap the button in that email and the first morning arrives${u.mornings?` (${u.mornings} in all)`:""}.`);else{l("We couldn't send the confirmation just now. Try again a little later — nothing has started."),o("error");return}o("done"),D("course_nudge_submitted");try{localStorage.setItem(gt,"1")}
8catch{}}catch(u){const p=u.status;l(p===503?"The course isn't available right now — try again another day.":u.message||"Couldn't start that — check the address and try again."),o("error")}}}function h(){try{localStorage.setItem(gt,"1")}catch{}e()}return i==="done"?t.jsx("div",{className:"rem-nudge course-nudge",children:t.jsxs("p",{className:"rem-nudge-text",children:["✦ ",r]})}):t.jsxs("form",{className:"rem-nudge course-nudge",onSubmit:d,children:[t.jsxs("p",{className:"rem-nudge-text",children:[t.jsx("b",{children:"Seven mornings of practice"}),t.jsx("br",{}),"One short lesson a day — the law of assumption, the practice, one question to sit with. Free, no account."]}),t.jsxs("div",{className:"course-nudge-row",children:[t.jsx("input",{type:"email",inputMode:"email",autoComplete:"email",className:"course-nudge-input",placeholder:"[email protected]","aria-label":"Your email address",value:n,onChange:m=>a(m.target.value),required:!0,maxLength:254,disabled:i==="sending"}),t.jsx("button",{type:"submit",className:"btn btn-primary btn-sm",disabled:i==="sending"||!n.trim(),children:i==="sending"?"…":"Start"})]}),i==="error"&&t.jsx("p",{className:"course-nudge-err",role:"alert",children:r}),t.jsx("div",{className:"rem-nudge-actions",children:t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:h,children:"Not now"})}),t.jsx("p",{className:"course-nudge-fine",children:"We send one confirmation email first — nothing starts until you tap it."})]})}function ea(){try{return localStorage.getItem(gt)==="1"}catch{return!0}}const Q={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"},Ne={fill:"currentColor",stroke:"none"};function ta({kind:e}){switch(e){case"meditation":return t.jsxs("svg",{...Q,children:[t.jsx("circle",{cx:"12",cy:"5.6",r:"2.2"}),t.jsx("path",{d:"M12 8.4c-2 0-3.6 1.4-4 3.3M12 8.4c2 0 3.6 1.4 4 3.3"}),t.jsx("path",{d:"M4.8 17.3c1.7-2.7 4.3-4.2 7.2-4.2s5.5 1.5 7.2 4.2c-4.7 2-9.7 2-14.4 0Z"})]});case"sats":return t.jsxs("svg",{...Q,children:[t.jsx("path",{d:"M3.6 12S6.9 6.9 12 6.9 20.4 12 20.4 12 17.1 17.1 12 17.1 3.6 12 3.6 12Z"}),t.jsx("circle",{cx:"12",cy:"12",r:"2.4"}),t.jsx("circle",{cx:"12",cy:"12",r:"0.6",...Ne})]});case"imagination":return t.jsxs("svg",{...Q,children:[t.jsx("path",{d:"M12 4.6a7.4 7.4 0 1 1-6.5 3.8"}),t.jsx("path",{d:"M12 8a4 4 0 1 0 3.4 1.9"}),t.jsx("circle",{cx:"12",cy:"12",r:"0.9",...Ne})]});case"japa":return t.jsxs("svg",{...Q,children:[t.jsx("circle",{cx:"12",cy:"10.4",r:"6",strokeDasharray:"0.4 3.35"}),t.jsx("circle",{cx:"12",cy:"16.4",r:"1.35",...Ne}),t.jsx("path",{d:"M12 17.9v2.8"})]});case"tonglen":return t.jsxs("svg",{...Q,children:[t.jsx("path",{d:"M5.5 12a6.5 6.5 0 0 1 11-4.7"}),t.jsx("path",{d:"M16.5 7.3 13.4 6.9M16.5 7.3 16.9 4.2"}),t.jsx("path",{d:"M18.5 12a6.5 6.5 0 0 1-11 4.7"}),t.jsx("path",{d:"M7.5 16.7 10.6 17.1M7.5 16.7 7.1 19.8"}),t.jsx("circle",{cx:"12",cy:"12",r:"1",...Ne})]});case"metta":return t.jsx("svg",{...Q,children:t.jsx("path",{d:"M12 20.1s-6.8-4.1-6.8-9A3.8 3.8 0 0 1 12 8.7a3.8 3.8 0 0 1 6.8 2.4c0 4.9-6.8 9-6.8 9Z"})});case"immerse":return t.jsxs("svg",{...Q,children:[t.jsx("circle",{cx:"12",cy:"12",r:"3.1"}),t.jsx("circle",{cx:"12",cy:"12",r:"0.8",...Ne}),t.jsx("path",{d:"M7.2 8.6a7 7 0 0 0 0 6.8M8.8 10a3.6 3.6 0 0 0 0 4"}),t.jsx("path",{d:"M16.8 8.6a7 7 0 0 1 0 6.8M15.2 10a3.6 3.6 0 0 1 0 4"})]});default:return t.jsx("svg",{...Q,children:t.jsx("path",{d:"M12 3.8l1.6 6.6 6.6 1.6-6.6 1.6L12 20.2l-1.6-6.6L3.8 12l6.6-1.6z"})})}}const H={viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.6,strokeLinecap:"round",strokeLinejoin:"round"};function Ht({name:e}){switch(e){case"bell":return t.jsxs("svg",{...H,children:[t.jsx("path",{d:"M12 3.4v1.4"}),t.jsx("path",{d:"M6.8 10.2a5.2 5.2 0 0 1 10.4 0c0 3.6 1.3 5.1 2 5.8.4.4.1 1.1-.5 1.1H5.3c-.6 0-.9-.7-.5-1.1.7-.7 2-2.2 2-5.8Z"}),t.jsx("path",{d:"M10.1 19.2a2 2 0 0 0 3.8 0"})]});case"sound-on":return t.jsxs("svg",{...H,children:[t.jsx("path",{d:"M4.5 9.6v4.8h2.9l4 3.1V6.5l-4 3.1Z"}),t.jsx("path",{d:"M14.6 9.4a3.8 3.8 0 0 1 0 5.2"}),t.jsx("path",{d:"M16.9 7.2a7 7 0 0 1 0 9.6"})]});case"sound-off":return t.jsxs("svg",{...H,children:[t.jsx("path",{d:"M4.5 9.6v4.8h2.9l4 3.1V6.5l-4 3.1Z"}),t.jsx("path",{d:"M15.2 10l4.3 4M19.5 10l-4.3 4"})]});case"pen":return t.jsxs("svg",{...H,children:[t.jsx("path",{d:"M16.4 3.7a2 2 0 0 1 2.9 2.9L7.4 18.5l-3.9 1 1-3.9z"}),t.jsx("path",{d:"M14.9 5.2l2.9 2.9"})]});case"mail":return t.jsxs("svg",{...H,children:[t.jsx("rect",{x:"3.4",y:"5.6",width:"17.2",height:"12.8",rx:"2.2"}),t.jsx("path",{d:"M4.2 7.4 12 13l7.8-5.6"})]});case"mic":return t.jsxs("svg",{...H,children:[t.jsx("rect",{x:"9.2",y:"3",width:"5.6",height:"9",rx:"2.8"}),t.jsx("path",{d:"M6.5 10.6a5.5 5.5 0 0 0 11 0"}),t.jsx("path",{d:"M12 16.1v3.9"}),t.jsx("path",{d:"M9 20.2h6"})]});case"install":return t.jsxs("svg",{...H,children:[t.jsx("rect",{x:"6.6",y:"3.4",width:"10.8",height:"17.2",rx:"2.3"}),t.jsx("path",{d:"M12 7.6v5M12 12.6l-2.1-2.1M12 12.6l2.1-2.1"}),t.jsx("path",{d:"M10.4 17.7h3.2"})]});case"bloom":return t.jsxs("svg",{...H,children:[t.jsx("path",{d:"M12 15V6.2c1.4 1.3 2.1 2.9 2.1 4.6 0 1.6-.7 3-2.1 4.2-1.4-1.2-2.1-2.6-2.1-4.2 0-1.7.7-3.3 2.1-4.6Z"}),t.jsx("path",{d:"M12 15c-2.4-1.1-3.9-3-4.3-5.6C10 9.6 11.4 11.4 12 13.6"}),t.jsx("path",{d:"M12 15c2.4-1.1 3.9-3 4.3-5.6C14 9.6 12.6 11.4 12 13.6"}),t.jsx("path",{d:"M5.5 13.4c1.4 2.3 3.8 3.6 6.5 3.6s5.1-1.3 6.5-3.6"})]});default:return t.jsx("svg",{...H,children:t.jsx("circle",{cx:"12",cy:"12",r:"8"})})}}const Yt="imaginal-reminder";let ze=null;function Xe(){return typeof window<"u"&&"Notification"in window}function Vt(){return Xe()?Notification.permission:"denied"}async function na(){return Xe()?Notification.requestPermission():"denied"}function Kt(){try{return JSON.parse(localStorage.getItem(Yt)||"null")}catch{return null}}function aa(e){try{localStorage.setItem(Yt,JSON.stringify(e))}catch{}yt()}async function ia(e,n){var a;try{const i=await((a=navigator.serviceWorker)==null?void 0:a.getRegistration());if(i!=null&&i.showNotification){i.showNotification(e,{body:n,icon:"/icon.svg",badge:"/icon.svg",tag:"imaginal-daily"});return}}catch{}Xe()&&Notification.permission==="granted"&&new Notification(e,{body:n,icon:"/icon.svg"})}function yt(){ze&&(clearTimeout(ze),ze=null);const e=Kt();if(!(e!=null&&e.enabled)||!e.time||e.viaPush||Vt()!=="granted")return;const[n,a]=e.time.split(":").map(Number),i=new Date;i.setHours(n,a,0,0),i.getTime()<=Date.now()&&i.setDate(i.getDate()+1);const o=Math.min(i.getTime()-Date.now(),2**31-1);ze=setTimeout(()=>{ia("Imaginal","A moment for your practice. ✦"),yt()},o)}const It=[{id:"sun",name:"The Sun",invitation:"What in you is ready to stand in full light?"},{id:"moon",name:"The Moon",invitation:"What do you know only in the dark?"},{id:"ouroboros",name:"The Ouroboros",invitation:"What is ending in you so something new can begin?"},{id:"spiral",name:"The Spiral",invitation:"Where are you circling back — but on a higher turn?"},{id:"tree",name:"The Tree",invitation:"What in you is rooted, and what is reaching toward light?"}
8,{id:"water",name:"The Waters",invitation:"What feeling moves beneath your surface today?"},{id:"mountain",name:"The Mountain",invitation:"What must you climb — or grow still before?"},{id:"eye",name:"The Eye",invitation:"What is watching in you, and what longs to be seen?"},{id:"key",name:"The Key",invitation:"Which door in you is waiting to be opened?"},{id:"flame",name:"The Flame",invitation:"What in you is ready to be transformed?"},{id:"star",name:"The Star",invitation:"What quiet hope still guides you?"},{id:"threshold",name:"The Threshold",invitation:"What are you standing at the edge of?"}];function oa(e){let n=0;for(let a=0;a<e.length;a++)n=n*31+e.charCodeAt(a)>>>0;return It[n%It.length]}function ra(){const e=new Date().getHours();return e<5?"Still awake":e<12?"Good morning":e<17?"Good afternoon":e<21?"Good evening":"Good night"}function sa(){const e=new Date().getHours();return e<5?"night":e<11?"dawn":e<17?"day":e<21?"dusk":"night"}function Mt(e,n=8){const a=e.trim().split(/\s+/);return a.length<=n?e:a.slice(0,n).join(" ")+"…"}function ca(){try{return JSON.parse(localStorage.getItem("imaginal-last-intention")||"null")}catch{return null}}function _t(e){if(!e)return"";const n=new Date(e),a=o=>new Date(o.getFullYear(),o.getMonth(),o.getDate()).getTime(),i=Math.round((a(new Date)-a(n))/864e5);return i===1?"yesterday":i>1&&i<7?`${i} days ago`:i>=7&&i<14?"last week":n.toLocaleDateString(void 0,{month:"long",day:"numeric"})}const de={intention:{icon:t.jsx(Ce,{name:"today"}),title:"Live in the end",hint:"Set an intention in the present tense — as if it’s already so.",placeholder:"Today I am…"},revision:{icon:"✎",title:"Revise the day",hint:"Re-live one moment from today the way you wished it had gone.",placeholder:"If today had gone perfectly…"},gratitude:{icon:"✿",title:"Offer gratitude",hint:"Name one grace from today.",placeholder:"I’m grateful for…"}};function la({daily:e,streak:n,card:a,cardBias:i,dateLabel:o,entries:r,onSave:l,onWrite:d,onOpenEntry:h,onOpenLesson:m,onOpenPractice:y,user:u,partner:p,onPartnerChanged:b,onFlash:N,firstVisit:k=!1}){var $e;const[S,L]=s.useState(e.morning_intention),[O,R]=s.useState(e.evening_revision),[I,B]=s.useState(e.gratitude),Y=f=>!!f.trim(),A=[S,O,I].filter(Y).length,T={intention:S,revision:O,gratitude:I},v={intention:L,revision:R,gratitude:B},C={intention:e.morning_intention,revision:e.evening_revision,gratitude:e.gratitude},Ie={intention:"morning_intention",revision:"evening_revision",gratitude:"gratitude"},ie=new Date().getHours()>=15,V=ie?["revision","gratitude","intention"]:["intention","revision","gratitude"],J=["teaching",...V,"done"],[j,P]=s.useState(()=>A===0?"teaching":V.find(f=>!Y(T[f]))??"done"),[Me,me]=s.useState(!1),[_e,Ge]=s.useState(()=>{var f;try{return localStorage.getItem("imaginal-reminder-asked")==="1"||!!((f=Kt())!=null&&f.enabled)}catch{return!1}}),X=Xe()&&Vt()!=="denied"&&!_e,Oe=async()=>{await na()==="granted"&&(aa({enabled:!0,time:"08:00"}),D("reminder_enable"));try{localStorage.setItem("imaginal-reminder-asked","1")}catch{}Ge(!0)},ge=()=>{try{localStorage.setItem("imaginal-reminder-asked","1")}catch{}Ge(!0)},[tt,We]=s.useState(()=>{try{return localStorage.getItem("imaginal-rate-asked")==="1"}catch{return!0}}),pe=(()=>{try{return Number(localStorage.getItem("imaginal-days-completed")||"0")}catch{return 0}})();s.useEffect(()=>{if(A===3)try{localStorage.getItem("imaginal-days-completed-last")!==e.day&&(localStorage.setItem("imaginal-days-completed-last",e.day),localStorage.setItem("imaginal-days-completed",String(Number(localStorage.getItem("imaginal-days-completed")||"0")+1)),ae("success"))}catch{}},[A,e.day]);const fe=/Android/i.test(navigator.userAgent)&&window.matchMedia("(display-mode: standalone)").matches&&!tt&&pe>=3&&!X,ye=()=>{try{localStorage.setItem("imaginal-rate-asked","1")}catch{}We(!0)},[nt,at]=s.useState(()=>{try{return localStorage.getItem("imaginal-partner-asked")==="1"}catch{return!0}}),we=()=>{try{localStorage.setItem("imaginal-partner-asked","1")}catch{}at(!0)},oe=!!u&&!!p&&!p.partnership&&!p.invite&&A===3&&!nt&&!X&&!fe,[it,De]=s.useState(ea),ot=!u&&A===3&&!it&&!X&&!fe&&!oe,[Le,Re]=s.useState(!1),z=ca(),ee=!Le&&!S.trim()&&(($e=z==null?void 0:z.text)!=null&&$e.trim())&&z&&z.day<e.day?z:null;s.useEffect(()=>{ee&&D("welcome_back_shown")},[!!ee]);const re=f=>{if(T[f]!==C[f]&&l({[Ie[f]]:T[f]}),f==="intention"&&T.intention.trim())try{localStorage.setItem("imaginal-last-intention",JSON.stringify({day:e.day,text:T.intention.trim()}))}catch{}},q=f=>{me(!1),P(f)},$=()=>q(J[Math.min(J.indexOf(j)+1,J.length-1)]),ve=()=>
8q(J[Math.max(J.indexOf(j)-1,0)]),rt=f=>{ae("light"),re(f),$()},st=new Set(n.days),Je=(()=>{const f=new Date(e.day+"T00:00:00"),Z=[];for(let ce=6;ce>=0;ce--){const le=new Date(f);le.setDate(f.getDate()-ce);const je=`${le.getFullYear()}-${String(le.getMonth()+1).padStart(2,"0")}-${String(le.getDate()).padStart(2,"0")}`;Z.push({iso:je,active:st.has(je),today:ce===0})}return Z})(),[K,ct]=s.useState(null);s.useEffect(()=>{let f=!0;return F(()=>import("./thread-BOuzZpm3.js"),__vite__mapDeps([0,1,2,3])).then(Z=>{f&&ct(Z.threadForDate(e.day))}).catch(()=>{}),()=>{f=!1}},[e.day]);const U=r.find(f=>f.createdAt&&new Date(f.createdAt).getTime()<Date.now()-2*864e5)??null,te=oa(e.day),se=Ut(new Date(new Date(e.day+"T00:00:00").getTime()+864e5).toISOString().slice(0,10),i),be=J.indexOf(j),qe=be===J.length-2;return t.jsxs("div",{className:"screen today-guided",children:[t.jsxs("div",{className:"today-hero slim","data-tod":sa(),children:[t.jsx("span",{className:"hero-glow","aria-hidden":"true"}),t.jsxs("h1",{className:"greeting",children:[ra(),"."]}),t.jsxs("p",{className:"date",children:[o,n.current>0&&t.jsxs("span",{className:"streak-pill",children:["✦ ",n.current," day",n.current===1?"":"s"]}),n.mended&&n.current>0&&t.jsx("span",{className:"mend-note",children:"↺ a missed day, gently held"})]})]}),(p==null?void 0:p.partnership)&&t.jsx(Yn,{partner:p,day:e.day,onFlash:N,onChanged:b}),ee&&t.jsxs("div",{className:"welcome-back",role:"note",children:[t.jsx("span",{className:"lookback-eyebrow",children:"↺ Welcome back"}),t.jsxs("p",{className:"wb-lead",children:[_t(ee.day+"T00:00:00")==="yesterday"?"Yesterday":"Last time"," you set an intention:"]}),t.jsxs("p",{className:"wb-intention serif",children:["“",ee.text,"”"]}),t.jsx("p",{className:"wb-ask",children:"How did it unfold? Carry it forward, or set a new one for today."}),t.jsxs("div",{className:"rem-nudge-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:()=>{Re(!0),q("intention")},children:"Set today’s intention ›"}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:()=>Re(!0),children:"Not now"})]})]}),t.jsx("div",{className:"day-arc","aria-label":"Today’s arc",children:J.map(f=>{const Z=f==="teaching"?be>0:f==="done"?A===3:Y(T[f]);return t.jsx("button",{type:"button",className:`arc-dot${j===f?" current":""}${Z?" done":""}${f==="done"?" arc-end":""}`,"aria-current":j===f?"step":void 0,"aria-label":f==="teaching"?"Teaching":f==="done"?"Complete":de[f].title,onClick:()=>q(f)},f)})}),t.jsxs("div",{className:"focus-card",children:[j==="teaching"&&t.jsxs("div",{className:"beat beat-teaching",children:[k?t.jsx("div",{className:"beat-eyebrow",children:"A daily practice for the inner world — start with today’s teaching."}):t.jsxs("div",{className:"dc-trad",children:[t.jsx("span",{"aria-hidden":"true",children:Pt[a.tradition]})," ",Et[a.tradition]]}),t.jsxs("p",{className:"teaching-quote serif",children:["“",a.teaching,"”"]}),t.jsxs("p",{className:"teaching-by",children:["— ",a.source]}),Me&&t.jsx("p",{className:"beat-micro",children:a.micro}),t.jsxs("div",{className:"beat-actions",children:[t.jsxs("button",{type:"button",className:"btn btn-primary btn-block",onClick:()=>d(a.prompt),children:["Reflect on this ",t.jsx("span",{className:"ico-inline",children:t.jsx(Ht,{name:"pen"})})]}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-block",onClick:$,children:"Begin today’s practice ›"})]}),t.jsx("button",{type:"button",className:"beat-reveal",onClick:()=>me(f=>!f),children:Me?"Hide the 1-minute practice":"Try a 1-minute practice"})]}),j!=="teaching"&&j!=="done"&&t.jsxs("div",{className:"beat beat-step",children:[t.jsxs("div",{className:"beat-eyebrow",children:[ie?"Evening":"Morning"," · ",V.indexOf(j)+1," of 3"]}),t.jsx("span",{className:"beat-ico","aria-hidden":"true",children:de[j].icon}),t.jsx("h2",{className:"beat-title serif",children:de[j].title}),t.jsx("p",{className:"beat-hint",children:de[j].hint}),j==="gratitude"?t.jsx("input",{className:"input beat-input",value:T[j],placeholder:de[j].placeholder,onChange:f=>v[j](f.target.value),onBlur:()=>re(j)}):t.jsx("textarea",{className:"textarea beat-input",rows:3,value:T[j],placeholder:de[j].placeholder,onChange:f=>v[j](f.target.value),onBlur:()=>re(j)}),t.jsxs("div",{className:"beat-actions",children:[t.jsxs("button",{type:"button",className:"btn btn-primary btn-block",onClick:()=>rt(j),children:[qe?"Save & finish":"Save & continue"," ›"]}
8),t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:$,children:"Skip for now"})]}),t.jsx("button",{type:"button",className:"beat-back",onClick:ve,children:"‹ Back"})]}),j==="done"&&t.jsxs("div",{className:"beat beat-done",children:[t.jsx("span",{className:"beat-ico end","aria-hidden":"true",children:"✦"}),t.jsx("h2",{className:"beat-title serif",children:A===3?"Practice complete":"Where you are today"}),n.current>0&&t.jsxs("p",{className:"done-streak",children:["✦ ",n.current,"-day streak",n.current>=3?" — kept alight":""]}),t.jsx("p",{className:"beat-hint",children:A===3?"Beautifully done — carry it gently into the day.":`${A} of 3 held so far. Return whenever you like.`}),t.jsx("div",{className:"week-mini","aria-hidden":"true",children:Je.map(f=>t.jsx("i",{className:`${f.active?"on":""}${f.today?" today":""}`},f.iso))}),t.jsxs("div",{className:"tomorrow-teaser",children:[t.jsxs("span",{className:"tomorrow-eyebrow",children:["Tomorrow · ",Et[se.tradition]]}),t.jsxs("p",{className:"tomorrow-text",children:[t.jsx("span",{className:"tomorrow-glyph","aria-hidden":"true",children:Pt[se.tradition]}),"“",Mt(se.teaching),"”"]})]}),U&&t.jsxs("button",{type:"button",className:"lookback-card",onClick:()=>U.id&&h(U.id),children:[t.jsxs("span",{className:"lookback-eyebrow",children:["↺ On this day · ",_t(U.createdAt)]}),t.jsxs("span",{className:"lookback-quote",children:["“",Mt(U.body||U.title||"an entry from before",14),"”"]})]}),fe&&t.jsxs("div",{className:"beat-nudge",children:[t.jsx("p",{children:"Is Imaginal helping? A rating on Google Play helps others find it."}),t.jsxs("div",{className:"beat-actions",children:[t.jsx("a",{className:"btn btn-soft",href:"https://play.google.com/store/apps/details?id=space.imaginalapp.twa",target:"_blank",rel:"noreferrer",onClick:ye,children:"Rate Imaginal"}),t.jsx("button",{type:"button",className:"btn-plain",onClick:ye,children:"Not now"})]})]}),oe&&u&&t.jsx(Vn,{user:u,onInvited:()=>{we(),b()},onDismiss:we}),X&&t.jsxs("div",{className:"rem-nudge",children:[t.jsx("p",{className:"rem-nudge-text",children:"Want a soft reminder to return tomorrow?"}),t.jsxs("div",{className:"rem-nudge-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:Oe,children:"Enable a daily nudge"}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:ge,children:"Not now"})]})]}),ot&&t.jsx(Xn,{onDone:()=>De(!0)}),t.jsxs("button",{type:"button",className:"explore-hero",onClick:()=>y("immerse"),children:[t.jsx("span",{className:"explore-hero-orb","aria-hidden":"true"}),t.jsxs("span",{className:"explore-hero-text",children:[t.jsx("b",{children:"Breathe under the stars"}),t.jsx("span",{children:"A few minutes in the immersive space"})]}),t.jsx("span",{className:"tr-chev","aria-hidden":"true",children:"›"})]}),t.jsx("div",{className:"explore-label",children:"Go deeper"}),t.jsxs("div",{className:"explore-rows",children:[t.jsxs("button",{type:"button",className:"thread-row",onClick:()=>d(`${te.name} — ${te.invitation}`),children:[t.jsx("span",{className:"tr-ico tr-sym","aria-hidden":"true",children:t.jsx(Qn,{id:te.id,size:22})}),t.jsxs("span",{className:"tr-text",children:[t.jsx("b",{children:"Symbol"})," · ",te.name]}),t.jsx("span",{className:"tr-chev","aria-hidden":"true",children:"›"})]}),K&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{type:"button",className:"thread-row",onClick:()=>m(K.lesson.id),children:[t.jsx("span",{className:"tr-ico","aria-hidden":"true",children:t.jsx(Ce,{name:"learn"})}),t.jsxs("span",{className:"tr-text",children:[t.jsx("b",{children:"Learn"})," · ",K.lesson.title]}),t.jsx("span",{className:"tr-chev","aria-hidden":"true",children:"›"})]}),t.jsxs("button",{type:"button",className:"thread-row",onClick:()=>y(K.tool),children:[t.jsx("span",{className:"tr-ico","aria-hidden":"true",children:t.jsx(ta,{kind:K.tool})}),t.jsxs("span",{className:"tr-text",children:[t.jsx("b",{children:"Practice"})," · ",K.toolLabel]}),t.jsx("span",{className:"tr-chev","aria-hidden":"true",children:"›"})]})]})]})]})]})]})}function Ze(e,n){var a;try{(a=window.gtag)==null||a.call(window,"event",e,n)}catch{}}function da({user:e,onAuth:n,onManageAccount:a,open:i,onOpenChange:o,initialMode:r}){const[l,d]=s.useState(!1),h=i??l,m=o??d;if(e){const y=(e.name||e.email||"?").trim().charAt(0).toUpperCase()||"?";return t.jsx("button",{type:"button",className:"account-chip",onClick:a,title:e.email,"aria-label":"Account",children:y})}return t.jsxs("div",{className:"auth-controls",children:[t.jsx("span",{className:"auth-guest",children:"Guest"}),t.jsx("button",{type:"button",className:"auth-btn",onClick:()=>m(!0),children:"Sign in / Sign up"}),h&&t.jsx(ha,{initialMode:r,onClose:()=>m(!1),onAuth:y=>{n(y),m(!1)}})]})}const ua={login:"Welcome back",signup:"Create your account","reset-request":"Reset your password","reset-confirm":"Choose a new password"};function ha({onClose:e,onAuth:n,initialMode:a}){const[i,o]=s.useState(a??"login"),[r,l]=s.useState(""),[d,h]=s.useState(""),[m,y]=s.useState(""),[u,p]=s.useState(!1),[b,N]=s.useState(""),[k,S]=s.useState(null),[L,O]=s.useState(!1),[R,I]=s.useState(null);s.useEffect(()=>{const v=C=>{C.key==="Escape"&&e()};return window.addEventListener("keydown",v),document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",v),document.body.style.overflow=""}},[e]);function B(v){o(v),I(null),S(null)}async function Y(v){v.preventDefault(),O(!0),I(null);try{const C=i==="login"?await jn(d,m):await bn(d,m,r);i==="signup"&&Ze("sign_up"),n(C)}catch(C){I(C.message||"Something went wrong.")}finally{O(!1)}}async function A(v){v.preventDefault(),O(!0),I(null);try{const C=await kn(d);C.dev_token?(N(C.dev_token),S("Dev mode: your reset code has been filled in below.")):S("If an account exists for that email, a reset code is on its way. Paste it below."),o("reset-confirm")}catch(C){I(C.message||"Something went wrong.")}finally{O(!1)}}async function T(v){v.preventDefault(),O(!0),I(null);try{await Nn(b,m),y(""),B("login"),S("Password updated — please sign in with your new password.")}catch(C){I(C.message||"Something went wrong.")}finally{O(!1)}}return hn.createPortal(t.jsx("div",{className:"explore-overlay",onClick:e,children:t.jsxs("div",{className:"explore-modal auth-modal",role:"dialog","aria-modal":"true","aria-label":"Account",onClick:v=>v.stopPropagation(),children:[t.jsxs("header",{className:"explore-modal-head",children:[t.jsx("h3",{children:ua[i]}),t.jsx("button",{type:"button",className:"explore-close",onClick:e,"aria-label":"Close",children:"✕"})]}),t.jsxs("div",{className:"explore-modal-body",children:[k&&t.jsx("p",{className:"auth-notice",children:k}),(i==="login"||i==="signup")&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"auth-intro",children:i==="login"?"Welcome back — sign in to sync your journal and practice across devices.":"Create a free account to keep your journal & practice safe and synced."}),t.jsxs("form",{className:"auth-form",onSubmit:Y,children:[i==="signup"&&t.jsxs("label",{children:["Name",t.jsx("input",{type:"text",value:r,autoComplete:"name",onChange:v=>l(v.target.value),placeholder:"What should we call you?"})]}),t.jsxs("label",{children:["Email",t.jsx("input",{type:"email",value:d,autoComplete:"email",required:!0,onChange:v=>h(v.target.value),placeholder:"[email protected]"})]}),t.jsxs("label",{children:["Password",t.jsxs("div",{className:"pw-field",children:[t.jsx("input",{type:u?"text":"password",value:m,required:!0,minLength:8,autoComplete:i==="login"?"current-password":"new-password",onChange:v=>y(v.target.value),placeholder:i==="signup"?"At least 8 characters":"••••••••"}),t.jsx("button",{type:"button",className:"pw-toggle",onClick:()=>p(v=>!v),"aria-label":u?"Hide password":"Show password",children:u?"Hide":"Show"})]})]}),R&&t.jsx("p",{className:"auth-error",children:R}),t.jsx("button",{type:"submit",className:"auth-submit",disabled:L,children:L?"Please wait…":i==="login"?"Sign in":"Create account"})]}),i==="login"&&t.jsx("p",{className:"auth-forgot",children:t.jsx("button",{type:"button",className:"auth-link",onClick:()=>B("reset-request"),children:"Forgot password?"})}),t.jsxs("p",{className:"auth-switch",children:[i==="login"?"New here?":"Already have an account?"," ",t.jsx("button",{type:"button",className:"auth-link",onClick:()=>B(i==="login"?"signup":"login"),children:i==="login"?"Create an account":"Sign in"})]})]}),i==="reset-request"&&t.jsxs(t.Fragment,{children:[t.jsx("p",{className:"auth-intro",children:"Enter your email and we’ll send a code to reset your password."}),t.jsxs("form",{className:"auth-form",onSubmit:A,children:[t.jsxs("label",{children:["Email",t.jsx("input",{type:"email",value:d,autoComplete:"email",required:!0,onChange:v=>h(v.target.value),placeholder:"[email protected]"})]}),R&&t.jsx("p",{className:"auth-error",children:R}),t.jsx("button",{type:"submit",className:"auth-submit",disabled:L,children:L?"Please wait…":"Send reset code"})]}),t.jsx("p",{className:"auth-switch",children:t.jsx("button",{type:"button",className:"auth-link",onClick:()=>B("login"),children:"Back to sign in"})})]}),i==="reset-confirm"&&t.jsxs(t.Fragment,{children:[t.jsxs("form",{className:"auth-form",onSubmit:T,children:[t.jsxs("label",{children:["Reset code",t.jsx("input",{type:"text",value:b,required:!0,onChange:v=>N(v.target.value),placeholder:"Paste the code from your email"})]}),t.jsxs("label",{children:["New password",t.jsxs("div",{className:"pw-field",children:[t.jsx("input",{type:u?"text":"password",value:m,required:!0,minLength:8,autoComplete:"new-password",onChange:v=>y(v.target.value),placeholder:"At least 8 characters"}),t.jsx("button",{type:"button",className:"pw-toggle",onClick:()=>p(v=>!v),"aria-label":u?"Hide password":"Show password",children:u?"Hide":"Show"})]})]}),R&&t.jsx("p",{className:"auth-error",children:R}),t.jsx("button",{type:"submit",className:"auth-submit",disabled:L,children:L?"Please wait…":"Reset password"})]}),t.jsx("p",{className:"auth-switch",children:t.jsx("button",{type:"button",className:"auth-link",onClick:()=>B("login"),children:"Back to sign in"})})]})]})]})}),document.body)}function ma({user:e}){const[n,a]=s.useState(!1),[i,o]=s.useState(!1),[r,l]=s.useState(null);if(e.verified)return null;async function d(){o(!0),l(null);try{await Cn(e.email),a(!0)}catch(h){l(h.message||"Could not send right now — please try again.")}finally{o(!1)}}return t.jsxs("div",{className:"verify-banner",role:"note",children:[t.jsx("span",{className:"ico-inline","aria-hidden":"true",children:t.jsx(Ht,{name:"mail"})}),n?t.jsx("span",{children:"Verification email sent — check your inbox."}):t.jsxs("span",{children:["Verify your email to secure your account."," ",t.jsx("button",{type:"button",onClick:d,disabled:i,children:i?"Sending…":"Resend"})]}),r&&t.jsx("span",{className:"verify-error",children:r})]})}const ht=[{glyph:"✦",image:"/hero.webp",title:"Welcome to Imaginal",body:"A daily practice for the inner world — a few quiet minutes to imagine, reflect, and become more whole."},{glyph:"◍",title:"Two paths, one inner world",body:"Imaginal weaves two traditions that agree on one thing: the inner world shapes your experience — and can be trained.",paths:!0},{glyph:t.jsx(Ce,{name:"today"}),title:"A gentle daily loop",body:"Each day, set an intention, draw a teaching card, revise the evening, and offer gratitude. A streak grows as you return."},{glyph:t.jsx(Ce,{name:"journal"}),title:"Journal, learn & practice",body:"Capture dreams and scripting in the Journal, read short lessons in Learn, and sit, visualize, or reflect in Practice."}],ga=[{glyph:"✦",name:"Neville Goddard",note:"Imagination & assumption"},{glyph:"☾",name:"Jung & von Franz",note:"The unconscious & wholeness"}];function pa({onDone:e}){const[n,a]=s.useState(0),i=ht[n],o=n===ht.length-1,r=l=>{D(`onboarding_${l}`),e()};return t.jsx("div",{className:"onboard",role:"dialog","aria-modal":"true","aria-label":"Welcome",children:t.jsxs("div",{className:"onboard-card",children:[t.jsx("button",{type:"button",className:"onboard-skip",onClick:()=>r("skip"),children:"Skip"}),t.jsxs("div",{className:"onboard-step",children:[i.paths?t.jsx("div",{className:"onboard-paths",children:ga.map(l=>t.jsxs("div",{className:"onboard-path",children:[t.jsx("span",{className:"op-glyph","aria-hidden":"true",children:l.glyph}),t.jsx("div",{className:"op-name",children:l.name}),t.jsx("div",{className:"op-note",children:l.note})]},l.name))}):i.image?t.jsx("img",{className:"onboard-hero",src:i.image,alt:"",width:"1200",height:"800",decoding:"async"}):t.jsx("div",{className:"onboard-glyph","aria-hidden":"true",children:i.glyph}),t.jsx("h2",{className:"onboard-title serif",children:i.title}),t.jsx("p",{className:"onboard-body",children:i.body})]},n),t.jsx("div",{className:"onboard-dots","aria-hidden":"true",children:ht.map((l,d)=>t.jsx("span",{className:`odot${d===n?" on":""}`},d))}),t.jsxs("div",{className:"onboard-actions",children:[n>0?t.jsx("button",{type:"button",className:"btn btn-ghost",onClick:()=>a(n-1),children:"Back"}):t.jsx("span",{}),o?t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>r("complete"),children:"Begin ✦"}):t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>a(n+1),children:"Next"})]})]})})}function fa({fireKey:e}){const[n,a]=s.useState(!1);if(s.useEffect(()=>{var r;if(!e||(r=window.matchMedia)!=null&&r.call(window,"(prefers-reduced-motion: reduce)").matches)return;a(!0);const o=setTimeout(()=>a(!1),1700);return()=>clearTimeout(o)},[e]),!n)return null;const i=18;return t.jsxs("div",{className:"celebrate","aria-hidden":"true",children:[t.jsx("span",{className:"celebrate-flash"}),Array.from({length:i}).map((o,r)=>
8{const l=r/i*2*Math.PI+e%6*.35,d=86+r%4*28,h={"--dx":`${Math.cos(l)*d}px`,"--dy":`${Math.sin(l)*d}px`,animationDelay:`${r%5*28}ms`};return t.jsx("span",{className:"celebrate-spark",style:h},r)})]})}const E={daily:"imaginal-daily",journal:"imaginal-journal",practice:"imaginal-practice"};function G(e,n){try{const a=localStorage.getItem(e);return a?JSON.parse(a):n}catch{return n}}function Pe(e,n){try{localStorage.setItem(e,JSON.stringify(n))}catch{}}function wt(e){return{day:e,morning_intention:"",evening_revision:"",gratitude:"",card_id:"",flags:{}}}function ya(e){return G(E.daily,{})[e]??wt(e)}function wa(e,n){const a=G(E.daily,{}),i=a[e]??wt(e),o={...i,..."morning_intention"in n?{morning_intention:n.morning_intention}:{},..."evening_revision"in n?{evening_revision:n.evening_revision}:{},..."gratitude"in n?{gratitude:n.gratitude}:{},..."card_id"in n?{card_id:n.card_id}:{},flags:{...i.flags,...n.flags??{}},day:e};return a[e]=o,Pe(E.daily,a),o}function va(e){return!!(e.morning_intention||e.evening_revision||e.gratitude||Object.values(e.flags||{}).some(Boolean))}function ba(e){const n=G(E.daily,{}),a=new Set(Object.values(n).filter(va).map(u=>u.day)),i=u=>new Date(u+"T00:00:00"),o=u=>u.toISOString().slice(0,10),r=(u,p)=>{const b=new Date(u);return b.setDate(b.getDate()-p),b};let l=0,d=!1,h=null,m=a.has(e)?i(e):r(i(e),1);for(;;)if(a.has(o(m)))l++,m=r(m,1);else if(a.has(o(r(m,1)))&&(!h||(h.getTime()-m.getTime())/864e5>=7))h=m,d=!0,m=r(m,1);else break;let y=0;for(const u of a){const p=i(u);if(a.has(o(r(p,1))))continue;let b=0,N=p;for(;a.has(o(N));)b++,N=r(N,-1);y=Math.max(y,b)}return{current:l,longest:Math.max(y,l),days:[...a].sort().slice(-60),mended:d}}function vt(){return G(E.journal,[]).sort((e,n)=>(n.createdAt??"").localeCompare(e.createdAt??""))}function ja(e){const n=G(E.journal,[]),a=new Date().toISOString(),i=n.findIndex(o=>o.id===e.id);i>=0?n[i]={...e,createdAt:n[i].createdAt??a,updatedAt:a}:n.push({...e,createdAt:a,updatedAt:a}),Pe(E.journal,n)}function xa(e){Pe(E.journal,G(E.journal,[]).filter(n=>n.id!==e)),Zt(e)}const et=e=>`imaginal-audio-${e}`;function ka(e){return new Promise((n,a)=>{const i=new FileReader;i.onload=()=>n(i.result),i.onerror=a,i.readAsDataURL(e)})}async function Na(e,n,a){const i=await ka(n);Pe(et(e),{data:i,mime:n.type||"audio/webm",duration:a})}function Sa(e){var n;return((n=G(et(e),null))==null?void 0:n.data)??null}function Ca(e){const n=G(et(e),null);if(!(n!=null&&n.data))return null;try{const a=n.data.split(",")[1]??"",i=atob(a),o=new Uint8Array(i.length);for(let r=0;r<i.length;r++)o[r]=i.charCodeAt(r);return new Blob([o],{type:n.mime||"audio/webm"})}catch{return null}}function Zt(e){try{localStorage.removeItem(et(e))}catch{}}function Ta(e){const n=G(E.practice,[]);n.unshift({...e,id:Math.random().toString(36).slice(2),createdAt:new Date().toISOString()}),Pe(E.practice,n.slice(0,200))}function bt(){return G(E.practice,[])}function Ea(){return vt().length>0||Object.keys(G(E.daily,{})).length>0||bt().length>0}function Pa(){return{daily:G(E.daily,{}),journal:vt(),practice:bt()}}function Aa(){for(const e of Object.values(E))try{localStorage.removeItem(e)}catch{}try{Object.keys(localStorage).filter(e=>e.startsWith("imaginal-audio-")).forEach(e=>localStorage.removeItem(e))}catch{}}const Qt="imaginal-journal-pending";function Ae(){try{return JSON.parse(localStorage.getItem(Qt)||"[]")}catch{return[]}}function Xt(e){try{localStorage.setItem(Qt,JSON.stringify(e))}catch{}}function Ia(e){Xt([...Ae().filter(n=>n.id!==e.id),e])}function jt(e){const n=Ae(),a=n.filter(i=>i.id!==e);a.length!==n.length&&Xt(a)}function _i(){return new Set(Ae().map(e=>e.id))}function xt(e){return(e==null?void 0:e.status)===void 0}async function Ma(e,n){return e?Pn(n):ya(n)}async function Ue(e,n,a){return e?qt({...a,day:n}):wa(n,a)}async function He(e,n){return e?An(n):ba(n)}async function Ye(e){if(!e)return vt();const n=Ae();let a;try{a=(await Tn()).entries}catch(o){if(xt(o)&&n.length)return n;throw o}if(!n.length)return a;const i=new Set(a.map(o=>o.id));return[...a,...n.filter(o=>!i.has(o.id))]}async function _a(e,n){if(!e){ja(n);return}try{await ft(n),jt(n.id)}catch(a){if(xt(a)){Ia(n);return}throw a}}async function Ga(e,n){if(!e){xa(n);return}jt(n);try{await En(n)}catch(a){if(!xt(a))throw a}}async function Oa(e){if(!e)return!1;const n=Ae();if(!n.length)return!1;let a=!1;for(const i of n)try{await ft(i),jt(i.id),a=!0}catch{}return a}
8async function Gi(e,n,a,i){if(e){await Ft(n,a,i);return}await Na(n,a,i)}async function Oi(e,n){if(e){const a=await Gn(n);return a?URL.createObjectURL(a):null}return Sa(n)}async function Wi(e,n){if(e){await On(n);return}Zt(n)}async function Wa(e,n){if(e){await $t(n);return}Ta(n)}async function Di(e){if(e)try{return(await In()).logs}catch{return[]}return bt()}async function Da(){var i;if(!Ea())return;const{daily:e,journal:n,practice:a}=Pa();try{for(const o of n)if(await ft(o),(i=o.data)!=null&&i.audio){const r=Ca(o.id);r&&await Ft(o.id,r,o.data.audio.duration).catch(()=>{})}for(const o of Object.keys(e)){const r=e[o];await qt({day:o,morning_intention:r.morning_intention,evening_revision:r.evening_revision,gratitude:r.gratitude,card_id:r.card_id,flags:r.flags})}for(const o of a)await $t({kind:o.kind,duration_s:o.duration_s,count:o.count,data:o.data});Aa()}catch{}}const en="imaginal-quiz-result",La="imaginal-quiz-done";function tn(){try{return JSON.parse(localStorage.getItem(en)||"null")}catch{return null}}function kt(e){try{localStorage.setItem(en,JSON.stringify(e)),localStorage.setItem(La,"1")}catch{}}async function Ra(e,n){if(kt(n),e)try{await Jt(n)}catch{}}async function Ja(e){if(!e)return tn();try{const n=await Rt();if(n!=null&&n.data&&Object.keys(n.data).length)return kt(n.data),n.data}catch{}return null}async function qa(e){try{const a=await Rt();if(a!=null&&a.data&&Object.keys(a.data).length){kt(a.data);return}}catch{}const n=tn();if(n)try{await Jt(n)}catch{}}function Gt(){const e=new Date,n=String(e.getMonth()+1).padStart(2,"0"),a=String(e.getDate()).padStart(2,"0");return`${e.getFullYear()}-${n}-${a}`}let ue=null;function Li(){var n;const e=window.Capacitor;return(n=e==null?void 0:e.isNativePlatform)!=null&&n.call(e)||window.location.protocol==="capacitor:"?!0:window.matchMedia("(display-mode: standalone)").matches||navigator.standalone===!0}function $a(){return/iPad|iPhone|iPod/.test(navigator.userAgent)?!0:navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}function Ri(){if(!$a())return!1;const e=navigator.userAgent;return/Safari/.test(e)&&!/(CriOS|FxiOS|EdgiOS|OPiOS|OPT\/|mercury|GSA|DuckDuckGo|Brave)/.test(e)}function Fa(e){window.addEventListener("beforeinstallprompt",n=>{n.preventDefault(),ue=n,e(!0)}),window.addEventListener("appinstalled",()=>{ue=null,e(!1)})}async function Ba(){if(!ue)return!1;ue.prompt();const{outcome:e}=await ue.userChoice;return ue=null,e==="accepted"}const nn="imaginal-sound";let W=null,he=za(),ne=null,Se=null,Ve=null;function za(){try{return localStorage.getItem(nn)!=="off"}catch{return!0}}function Ua(){return he}function Ha(e){he=e;try{localStorage.setItem(nn,e?"on":"off")}catch{}e&&an()}const _=[261.63,293.66,329.63,392,440,523.25,587.33,659.25],Ya=[{ratio:1,gain:1},{ratio:2,gain:.34},{ratio:3.01,gain:.13},{ratio:4.16,gain:.05}];function Va(e){const n=Math.floor(e.sampleRate*1.9),a=e.createBuffer(2,n,e.sampleRate);for(let i=0;i<2;i++){const o=a.getChannelData(i);for(let r=0;r<n;r++)o[r]=(Math.random()*2-1)*Math.pow(1-r/n,2.7)}return a}function Nt(){try{const e=window.AudioContext||window.webkitAudioContext;if(W||(W=new e),W.state==="suspended"&&W.resume(),!ne){const n=W.createDynamicsCompressor();n.threshold.value=-10,n.ratio.value=12,n.attack.value=.003,n.release.value=.25,n.connect(W.destination),ne=W.createGain(),ne.gain.value=.9,ne.connect(n),Se=W.createConvolver(),Se.buffer=Va(W),Ve=W.createGain(),Ve.gain.value=.55,Se.connect(Ve),Ve.connect(ne)}return W}catch{return null}}function Qe(e,n,a,i,o,r=2300){if(!ne||!Se)return;const l=e.currentTime+a,d=e.createGain();d.gain.setValueAtTime(1e-4,l),d.gain.linearRampToValueAtTime(o,l+.014),d.gain.setTargetAtTime(1e-4,l+.02,i*.34);const h=e.createBiquadFilter();h.type="lowpass",h.Q.value=.5,h.frequency.setValueAtTime(r,l),h.frequency.setTargetAtTime(r*.45,l+.03,i*.4),d.connect(h),h.connect(ne);const m=e.createGain();m.gain.value=.5,h.connect(m),m.connect(Se);const y=l+i+.1;Ya.forEach((u,p)=>{const b=e.createOscillator();b.type="sine",b.frequency.value=n*u.ratio;const N=e.createGain();if(N.gain.value=u.gain,b.connect(N),N.connect(d),b.start(l),b.stop(y),p===0){const k=e.createOscillator();k.type="sine",k.frequency.value=n*u.ratio,k.detune.value=7;const S=e.createGain();S.gain.value=u.gain*.5,k.connect(S),S.connect(d),k.start(l),k.stop(y)}})}function an(){if(!he)return;const e=Nt();if(!e)return;const n=_[2+Math.floor(Math.random()*4)];Qe(e,n,0,1.1,.12,2200)}
8function Ka(){if(!he)return;const e=Nt();e&&[_[0],_[3],_[5],_[7]].forEach((n,a)=>Qe(e,n,a*.18,2.6,.11,2600))}function Za(e=!1){if(!he)return;const n=Nt();n&&([_[2],_[3],_[4],_[5]].forEach((a,i)=>Qe(n,a,i*.1,1.5,.12,2800)),e&&[_[5],_[7],_[7]*1.5].forEach((a,i)=>Qe(n,a,.42+i*.12,2.6,.1,3400)))}const Qa='button, a, [role="button"]';let Ot=!1;function Xa(){Ot||(Ot=!0,window.addEventListener("pointerdown",e=>{if(!he)return;const n=e.target;n&&n.closest(Qa)&&an()},{passive:!0,capture:!0}))}const pt="imaginal-theme",ei={dark:"#0a0913",light:"#f3eff9"},ti={dark:"black-translucent",light:"default"},ni={dark:"DARK",light:"LIGHT"};function ai(){var e,n;return((n=(e=window==null?void 0:window.Capacitor)==null?void 0:e.Plugins)==null?void 0:n.StatusBar)??null}function on(e=rn()){var n,a;try{(a=(n=ai())==null?void 0:n.setStyle)==null||a.call(n,{style:ni[e]})}catch{}}function ii(){return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function oi(){try{const e=localStorage.getItem(pt);return e==="light"||e==="dark"?e:"system"}catch{return"system"}}function Wt(e){return e==="system"?ii():e}function Dt(e){document.documentElement.dataset.theme=e;const n=document.querySelector('meta[name="theme-color"]');n&&n.setAttribute("content",ei[e]);const a=document.querySelector('meta[name="apple-mobile-web-app-status-bar-style"]');a&&a.setAttribute("content",ti[e]),on(e)}function rn(){return document.documentElement.dataset.theme==="dark"?"dark":"light"}function Ji(){const[e,n]=s.useState(oi),a=s.useCallback(i=>{try{i==="system"?localStorage.removeItem(pt):localStorage.setItem(pt,i)}catch{}Dt(Wt(i)),n(i)},[]);return s.useEffect(()=>{if(e!=="system"||!window.matchMedia)return;const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>Dt(Wt("system"));return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[e]),{pref:e,setPref:a,resolved:rn()}}const ri=.85,si=1.35,ci=16;function sn(){var e,n;return((n=(e=window==null?void 0:window.Capacitor)==null?void 0:e.Plugins)==null?void 0:n.TextZoom)??null}function li(e){return Math.min(si,Math.max(ri,e))}async function Lt(){const e=sn();if(e!=null&&e.getPreferred)try{const{value:n}=await e.getPreferred();if(typeof n!="number"||!isFinite(n))return;document.documentElement.style.fontSize=`${(ci*li(n)).toFixed(2)}px`}catch{}}function di(){var n,a,i;if(!sn())return;Lt();const e=(a=(n=window==null?void 0:window.Capacitor)==null?void 0:n.Plugins)==null?void 0:a.App;(i=e==null?void 0:e.addListener)==null||i.call(e,"resume",()=>{Lt()})}const ui=s.lazy(()=>F(()=>import("./Quiz-Dsk8Fvss.js"),__vite__mapDeps([4,3,1]))),hi=s.lazy(()=>F(()=>import("./Journal-Co3iGy5j.js"),__vite__mapDeps([5,3,6,7]))),mi=s.lazy(()=>F(()=>import("./Learn-D2wVvaGF.js"),__vite__mapDeps([8,3,2,6,1]))),gi=s.lazy(()=>F(()=>import("./Practice-lb4CeO6u.js"),__vite__mapDeps([9,3,6]))),pi=s.lazy(()=>F(()=>import("./Me-B5nuGAPk.js"),__vite__mapDeps([10,3,7])));function fi(){var e;try{const n=JSON.parse(localStorage.getItem("imaginal-quiz-result")||"null"),a=(e=n==null?void 0:n.type)==null?void 0:e.track;return a==="neville"?"neville":a==="jung"?"jung":null}catch{return null}}function yi(){const e=Gt(),n=fi(),a=Ut(e,n),[i,o]=s.useState(null),[r,l]=s.useState("today"),[d,h]=s.useState(wt(e)),[m,y]=s.useState({current:0,longest:0,days:[]}),[u,p]=s.useState([]),[b,N]=s.useState(!1),[k,S]=s.useState(!1),[L,O]=s.useState(null),[R,I]=s.useState(void 0),[B,Y]=s.useState(null),[A,T]=s.useState(!1),[v,C]=s.useState("login"),[Ie,ie]=s.useState(null),[V,J]=s.useState(()=>{try{return zn(window.location.pathname,window.location.search)}catch{return null}}),[j,P]=s.useState(null),[Me,me]=s.useState(!1),[_e,Ge]=s.useState(!1),[X,Oe]=s.useState(!1),[ge,tt]=s.useState(()=>{try{return localStorage.getItem("imaginal-onboarded")!=="1"}catch{return!1}}),[We,pe]=s.useState(!1),[St,fe]=s.useState(!1),[ye,nt]=s.useState(Ua()),[at,we]=s.useState(0),oe=s.useRef(null),[it,De]=s.useState(null),[ot,Le]=s.useState(null),[Re,z]=s.useState(null),[ee,re]=s.useState(null),q=s.useCallback(async c=>{if(!c){ie(null);return}try{ie(await Dn(e))}catch{}},[e]),$=s.useCallback(async c=>{const[g,x,M]=await Promise.all([Ma(c,e),He(c,e),Ye(c)]);h(g),y(x),oe.current=x.current,p(M),await q(c);let xe=!1;c&&(xe=!!await Ja(c).catch(()=>null));const Fe=M.length>0||x.days.length>0||!!(g.morning_intention||g.evening_revision||g.gratitude);try{pe(localStorage.getItem("imaginal-onboarded")==="1"&&localStorage.getItem("imaginal-quiz-done")!=="1"&&!xe&&Fe)}catch{}},[e,q]);function ve(c){const g=oe.current;if(g!==null&&c.current>g){const x=[3,7,14,21,30,50,75,100,150,200,365].includes(c.current);
8Za(x),x&&(we(M=>M+1),P(`✦ ${c.current}-day streak! Beautiful.`))}oe.current=c.current,y(c)}s.useEffect(()=>{if(ge){try{localStorage.setItem("imaginal-onboarded","1")}catch{}Ze("first_open")}},[ge]),s.useEffect(()=>{Mn().then(c=>N(c.enabled)).catch(()=>{}),Wn().then(c=>{S(c.enabled),O(c.plans??null),I(c.amounts)}).catch(()=>{})},[]),s.useEffect(()=>{Fa(fe),yt(),Xa(),on(),di()},[]),s.useEffect(()=>{D("app_open");try{const c=Gt(),g=localStorage.getItem("imaginal-last-open");if(g&&g!==c&&D("return_visit"),localStorage.setItem("imaginal-last-open",c),!localStorage.getItem("imaginal-acq")){const x=(new URLSearchParams(window.location.search).get("utm_source")||"").toLowerCase(),M=x==="youtube"?"youtube":x==="tiktok"?"tiktok":x?"other":"direct";localStorage.setItem("imaginal-acq",M),D(`acq_${M}`)}}catch{}},[]),s.useEffect(()=>{if(!i)return;let c=!0;const g=async()=>{await Oa(i).catch(()=>!1)&&c&&p(await Ye(i).catch(()=>[]))};return g(),window.addEventListener("online",g),()=>{c=!1,window.removeEventListener("online",g)}},[i]),s.useEffect(()=>{const c=()=>{F(()=>import("./Journal-Co3iGy5j.js"),__vite__mapDeps([5,3,6,7])),F(()=>import("./Learn-D2wVvaGF.js"),__vite__mapDeps([8,3,2,6,1])),F(()=>import("./Practice-lb4CeO6u.js"),__vite__mapDeps([9,3,6])),F(()=>import("./Me-B5nuGAPk.js"),__vite__mapDeps([10,3,7]))},g=window;g.requestIdleCallback?g.requestIdleCallback(c):setTimeout(c,1500)},[]),s.useEffect(()=>{const c=new URLSearchParams(window.location.search),g=c.get("verify_token");g&&(c.delete("verify_token"),window.history.replaceState({},"",window.location.pathname+(c.toString()?`?${c}`:"")),Sn(g).then(()=>{P("✓ Your email is verified."),Ke()&&dt().then(o).catch(()=>{})}).catch(()=>P("That verification link is invalid or has expired.")))},[]),s.useEffect(()=>{const c=new URLSearchParams(window.location.search),g=c.get("checkout");if(!g)return;const x=c.get("amount"),M=(c.get("currency")||"USD").toUpperCase();for(const ke of["checkout","plan","amount","currency"])c.delete(ke);if(window.history.replaceState({},"",window.location.pathname+(c.toString()?`?${c}`:"")),g==="cancel"){P("Checkout cancelled — no charge was made.");return}if(g!=="success"||!Ke())return;P("✦ Thank you — activating your Premium…");let xe=0;const Fe=async()=>{xe+=1;try{const ke=await dt();if(o(ke),ke.is_premium){const lt=x?Number(x)/100:NaN;
8Ze("purchase",Number.isFinite(lt)&&lt>0?{currency:M,value:lt}:{currency:M}),D("checkout_success"),P("✦ Premium is active. Enjoy your reflections.");return}}catch{}xe<5?setTimeout(Fe,2e3):P("✦ Payment received — Premium will appear here shortly.")};Fe()},[]),s.useEffect(()=>{let c=!1;async function g(){if(Ke())try{const x=await dt();if(c)return;o(x),await $(x);return}catch{Be(null)}c||await $(null)}return g().finally(()=>{c||Ge(!0)}),()=>{c=!0}},[$]),s.useEffect(()=>{if(!j)return;const c=setTimeout(()=>P(null),6e3);return()=>clearTimeout(c)},[j]);async function rt(c){var x;const g=await Ue(i,e,c);h(g),He(i,e).then(ve).catch(()=>{}),g.morning_intention&&g.evening_revision&&g.gratitude&&!((x=g.flags)!=null&&x.celebrated)&&(Ka(),we(M=>M+1),Ze("practice_completed"),P("✦ Today’s practice is complete. Beautifully done."),Ue(i,e,{flags:{...g.flags,celebrated:!0}}).then(h).catch(()=>{}))}async function st(c){await _a(i,c),await Ue(i,e,{flags:{...d.flags,journaled:!0}}).then(h).catch(()=>{});const[g,x]=await Promise.all([Ye(i),He(i,e)]);if(p(g),ve(x),!i)try{localStorage.getItem("imaginal-sync-asked")!=="1"&&(me(!0),D("account_prompt_show"))}catch{}}const Je=()=>{try{localStorage.setItem("imaginal-sync-asked","1")}catch{}me(!1)};async function K(c){await Ga(i,c),p(await Ye(i))}async function ct(c){await Wa(i,c),await Ue(i,e,{flags:{...d.flags,practiced:!0}}).then(h).catch(()=>{}),He(i,e).then(ve).catch(()=>{})}function U(c="login"){C(c),T(!0)}function te(c){J(null);try{window.history.replaceState({},"","/")}catch{}c&&P(c)}function se(c){Y({type:"free",prompt:c}),l("journal")}function be(c){De(c),l("learn")}function qe(c){Le(c),l("practice")}function $e(c){z(c),l("journal")}function f(c,g){Ra(i,c),pe(!1),g!=null&&g.lesson?be(g.lesson):g!=null&&g.practice?qe(g.practice):g!=null&&g.tab&&l(g.tab)}function Z(){pe(!0)}function ce(){const c=!ye;nt(c),Ha(c)}async function le(c){Be(c.token),o(c.user),await Da().catch(()=>{}),await qa(c.user).catch(()=>{}),await $(c.user)}async function je(){try{await xn()}catch{}Be(null),o(null),l("today"),await $(null)}function cn(){Be(null),o(null),l("today"),$(null)}const ln=new Date(e+"T00:00:00").toLocaleDateString(void 0,{weekday:"long",month:"long",day:"numeric"});return t.jsxs("div",{className:"app",children:[t.jsx("a",{href:"#main",className:"skip-link",children:"Skip to content"}),t.jsxs("header",{className:"topbar",children:[t.jsxs("span",{className:"brand",children:[t.jsx("span",{className:"brand-glyph",children:"✦"})," Imaginal"]}),t.jsx("div",{className:"topbar-right",children:t.jsx(da,{user:i,onAuth:le,onSignOut:je,onManageAccount:()=>l("me"),open:A,onOpenChange:c=>{T(c),c||C("login")},initialMode:v})})]}),i&&t.jsx(ma,{user:i}),j&&t.jsxs("div",{className:"app-flash",role:"status",children:[t.jsx("span",{children:j}),t.jsx("button",{type:"button",onClick:()=>P(null),"aria-label":"Dismiss",children:"✕"})]}),Me&&!i&&!We&&t.jsxs("div",{className:"sync-prompt",role:"note",children:[t.jsxs("div",{className:"sync-prompt-body",children:[t.jsx("b",{children:"Keep this safe"}),t.jsx("span",{children:"Create a free account to sync your journal and streak across devices."})]}),t.jsxs("div",{className:"sync-prompt-actions",children:[t.jsx("button",{type:"button",className:"btn btn-primary btn-sm",onClick:()=>{D("account_prompt_accept"),Je(),U("signup")},children:"Create account"}),t.jsx("button",{type:"button",className:"btn btn-ghost btn-sm",onClick:Je,children:"Not now"})]})]}),t.jsx("main",{className:"app-main",id:"main",children:_e?t.jsx(s.Suspense,{fallback:t.jsx("p",{className:"status",children:"Opening…"}),children:t.jsxs("div",{className:"tab-view",children:[r==="today"&&t.jsx(la,{daily:d,streak:m,card:a,cardBias:n,dateLabel:ln,entries:u,onSave:rt,onWrite:se,onOpenEntry:$e,onOpenLesson:be,onOpenPractice:qe,user:i,partner:Ie,onPartnerChanged:()=>q(i),onFlash:P,firstVisit:ge},((i==null?void 0:i.id)??"guest")+e),r==="journal"&&t.jsx(hi,{user:i,entries:u,reflectEnabled:b,draft:B,onClearDraft:()=>Y(null),initialEntryId:Re,onConsumedEntry:()=>z(null),onSave:st,onDelete:K,onOpenAuth:()=>T(!0),onGo:c=>l(c),onGoPremium:()=>{re("premium"),l("me")}}),r==="learn"&&t.jsx(mi,{onWrite:se,initialLessonId:it,onConsumed:()=>De(null),onGo:c=>l(c)}),r==="practice"&&t.jsx(gi,{user:i,onLog:ct,initialTool:ot,onConsumed:()=>Le(null),onGo:c=>l(c)}),r==="me"&&t.jsx(pi,{user:i,entries:u,streak:m,billingEnabled:k,billingPlans:L,billingAmounts:R,installAvailable:St,onInstall:Ba,onSignOut:je,onOpenAuth:()=>T(!0),onSignedOut:cn,onRetakeQuiz:Z,soundOn:ye,onToggleSound:ce,onReplayIntro:()=>{tt(!1),Oe(!0)},partner:Ie,onPartnerChanged:()=>q(i),initialSetting:ee,onConsumedSetting:()=>re(null)})]},r)}):t.jsx("p",{className:"status",children:"Opening the inner world…"})}),t.jsx(wn,{active:r,onChange:c=>{ae("light"),l(c)}}),V&&_e&&t.jsx(Kn,{token:V,user:i,onOpenAuth:U,onJoined:c=>{var g;ie(c),q(i),te(`✦ You’re now practising with ${((g=c.partnership)==null?void 0:g.partner.name)??"your friend"}.`)},onDismiss:()=>te("")}),X&&!V&&t.jsx(pa,{onDone:()=>{try{localStorage.setItem("imaginal-onboarded","1")}catch{}Oe(!1)}}),!X&&!V&&We&&t.jsx(s.Suspense,{fallback:null,children:t.jsx(ui,{onFinish:f,signedOut:!i})}),t.jsx(fa,{fireKey:at})]})}class wi extends s.Component{constructor(){super(...arguments);Ct(this,"state",{failed:!1})}static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(a,i){console.error("Imaginal crashed:",a,i==null?void 0:i.componentStack)}render(){return this.state.failed?t.jsx("div",{className:"crash",children:t.jsxs("div",{className:"crash-card",children:[t.jsx("div",{className:"crash-glyph","aria-hidden":"true",children:"✦"}),t.jsx("h1",{className:"crash-title serif",children:"Something slipped"}),t.jsx("p",{className:"crash-body",children:"The app hit an unexpected snag. Your journal and streak are saved — reloading usually sets things right."}),t.jsx("button",{type:"button",className:"btn btn-primary",onClick:()=>window.location.reload(),children:"Reload Imaginal"})]})}):this.props.children}}try{const e=new URLSearchParams(window.location.search);if(e.has("title")||e.has("text")||e.has("url")){const n=[e.get("text")||"",e.get("url")||""].filter(
8Boolean).join(`
9
10`);(n||e.get("title"))&&localStorage.setItem("imaginal-journal-draft",JSON.stringify({type:"free",title:e.get("title")||"",body:n,mood:"",tagStr:"",at:Date.now()})),window.history.replaceState(null,"","/")}}catch{}mn.createRoot(document.getElementById("root")).render(t.jsx(gn.StrictMode,{children:t.jsx(wi,{children:t.jsx(yi,{})})}));export{_a as A,na as B,Ei as C,Ti as D,ji as E,xi as F,Ht as G,aa as H,Ut as I,ta as P,Ce as T,Gi as a,Ci as b,Pt as c,Wi as d,Si as e,ki as f,Oi as g,Et as h,Ka as i,Ai as j,Pi as k,Di as l,Ze as m,Kt as n,Vt as o,_i as p,Mi as q,Ii as r,Ni as s,D as t,Ji as u,Xe as v,ia as w,Li as x,Ri as y,$a as z};

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.