PageSourceSearch

https://felixthoennessen.de/assets/MindsetCoach-C4xW1qir.js

js felixthoennessen.de collected 2026-09-24 18:56:37 UTC 15,194 bytes, 19 lines download raw bytes

1import{j as e}from"./ui-vendor-CealJQWJ.js";import{r as n}from"./react-vendor-BkH0-HFx.js";import{e as _,B as M,X as ne,z as oe,j as S}from"./index-BKQfK9e1.js";import{T as ie}from"./textarea-D9Zn1_Y_.js";import{supabase as L}from"./client-D7ttkOWR.js";import{c as le}from"./coach-mindset-CHeFsV42.js";import{u as ce,b as K,C as de,a as me,c as ue,M as he}from"./CoachProgress-BLzkPx96.js";import{H as q}from"./house-ewSKpfIc.js";import{A as pe}from"./index-BvwLCwyq.js";import{H as $}from"./heart-CalacmmH.js";import{I as fe}from"./image-plus-Cktiw_42.js";import{S as xe}from"./send-djag2WS2.js";import{C as ge}from"./compass-Cwm_O5NX.js";import{L as be}from"./lightbulb-CN25p8CA.js";import{F as je}from"./flame-Co0uerXj.js";import{S as we}from"./star-C1ARtSKw.js";import"./query-vendor-i3MONKX8.js";import"./plus-DqmBkR-_.js";import"./message-square-D-uBphLB.js";import"./trash-2-B2PFkUhJ.js";import"./proxy-jnRaCSkQ.js";import"./trending-up-D5-ZbhRQ.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const ye=_("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/**
7 * @license lucide-react v0.462.0 - ISC
8 *
9 * This source code is licensed under the ISC license.
10 * See the LICENSE file in the root directory of this source tree.
11 */const Ne=_("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/**
12 * @license lucide-react v0.462.0 - ISC
13 *
14 * This source code is licensed under the ISC license.
15 * See the LICENSE file in the root directory of this source tree.
16 */const ve=_("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);function ke(o){return typeof o.content=="string"?o.content:o.content.filter(i=>i.type==="text").map(i=>i.text).join("")}function Ie(o){return typeof o.content=="string"?[]:o.content.filter(i=>i.type==="image_url").map(i=>i.image_url.url)}const Ce="https://sdsgixwujcobxwwhuikj.supabase.co/functions/v1/mindset-coach",Me=4*1024*1024,Y=[{icon:e.jsx(ge,{className:"h-4 w-4 text-purple-500"}),label:"Meine Werte herausfinden",prompt:"Ich möchte herausfinden, was mir im Leben wirklich wichtig ist. Führe mich sanft durch eine Werte-Übung.",category:"reflexion"},{icon:e.jsx(be,{className:"h-4 w-4 text-purple-500"}),label:"Meine inneren Blockaden verstehen",prompt:"Ich habe das Gefühl, dass mich etwas innerlich blockiert. Hilf mir, dem auf den Grund zu gehen.",category:"reflexion"},{icon:e.jsx(oe,{className:"h-4 w-4 text-purple-500"}),label:"Morgenroutine für mehr Klarheit",prompt:"Ich möchte eine Morgenroutine aufbauen, die mir Energie und Klarheit gibt. Was empfiehlst du?",category:"uebung"},{icon:e.jsx(Ne,{className:"h-4 w-4 text-purple-500"}),label:"Achtsamkeits-Übung für jetzt",prompt:"Ich fühle mich gerade gestresst. Führe mich durch eine kurze Achtsamkeitsübung.",category:"uebung"},{icon:e.jsx($,{className:"h-4 w-4 text-purple-500"}),label:"Ich zweifle an mir selbst",prompt:"Ich zweifle gerade sehr an mir und meinen Fähigkeiten. Ich brauche Unterstützung.",category:"frage"},{icon:e.jsx(je,{className:"h-4 w-4 text-purple-500"}),label:"Ich fühle mich ausgebrannt",prompt:"Ich fühle mich total ausgebrannt und erschöpft. Mir fehlt die Energie. Ich brauche jemanden, der das versteht.",category:"frage"},{icon:e.jsx(ve,{className:"h-4 w-4 text-purple-500"}),label:"Ich habe Angst vor Veränderung",prompt:"Ich stehe vor einer Veränderung und habe Angst davor. Ich weiß nicht, ob ich den Schritt wagen soll.",category:"frage"},{icon:e.jsx(we,{className:"h-4 w-4 text-purple-500"}),label:"Ich will meine Stärken erkennen",prompt:"Hilf mir, meine Stärken und das Gute in meinem Leben zu sehen. Ich möchte den Fokus auf das Positive richten.",category:"frage"},{icon:e.jsx(ye,{className:"h-4 w-4 text-purple-500"}),label:"Dankbarkeits-Journaling",prompt:"Lass uns zusammen eine Dankbarkeitsübung machen. Führe mich durch.",category:"uebung"}];async function Se(o){return new Promise((i,j)=>{const r=new FileReader;r.onload=()=>
16i(r.result),r.onerror=j,r.readAsDataURL(o)})}async function ze({messages:o,userProfile:i,previousContext:j,currentMood:r,onDelta:w,onDone:z,onError:D}){var v,g,k,m,b,T;const x=await fetch(Ce,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InNkc2dpeHd1amNvYnh3d2h1aWtqIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzQ0NTcyODYsImV4cCI6MjA5MDAzMzI4Nn0.iEqXZVaWXEBe4-kxU-TCVJT3wRmsoflhcNrbV6y7FxE"},body:JSON.stringify({messages:o,userProfile:i,previousContext:j,currentMood:r})});if(!x.ok){const h=await x.json().catch(()=>({}));D(h.error||"Fehler beim Verbinden mit dem Coach");return}if(!x.body){D("Keine Antwort erhalten");return}const O=x.body.getReader(),P=new TextDecoder;let d="";for(;;){const{done:h,value:l}=await O.read();if(h)break;d+=P.decode(l,{stream:!0});let p;for(;(p=d.indexOf(`
17`))!==-1;){let c=d.slice(0,p);if(d=d.slice(p+1),c.endsWith("\r")&&(c=c.slice(0,-1)),!c.startsWith("data: "))continue;const F=c.slice(6).trim();if(F==="[DONE]"){z();return}try{const y=(k=(g=(v=JSON.parse(F).choices)==null?void 0:v[0])==null?void 0:g.delta)==null?void 0:k.content;y&&w(y)}catch{d=c+`
18`+d;break}}}for(const h of d.split(`
19`)){if(!h.startsWith("data: "))continue;const l=h.slice(6).trim();if(l!=="[DONE]")try{const c=(T=(b=(m=JSON.parse(l).choices)==null?void 0:m[0])==null?void 0:b.delta)==null?void 0:T.content;c&&w(c)}catch{}}z()}const $e=({onBack:o})=>{var U,X;const{conversations:i,activeConvoId:j,messages:r,setMessages:w,loading:z,saveMessages:D,startNewConversation:x,loadConversation:O,deleteConversation:P,getPreviousContext:d,sessionCount:v}=ce("mindset"),[g,k]=n.useState(""),[m,b]=n.useState(!1),[T,h]=n.useState(null),[l,p]=n.useState(null),[c,F]=n.useState(!1),[H,y]=n.useState(!0),[E,J]=n.useState(null),R=n.useRef(null),Q=n.useRef(null),A=n.useRef(null);n.useEffect(()=>{(async()=>{const{data:{user:s}}=await L.auth.getUser();if(!s)return;const a=new Date;a.setHours(0,0,0,0);const{data:u}=await L.from("mood_checkins").select("mood").eq("user_id",s.id).gte("created_at",a.toISOString()).limit(1);u&&u.length>0&&(J(u[0].mood),y(!1))})()},[]),n.useEffect(()=>{(async()=>{const{data:{user:s}}=await L.auth.getUser();if(!s)return;const{data:a}=await L.from("profiles").select("full_name, business_description, city, job_title, membership_tier, interests, website").eq("id",s.id).single();a&&h(a)})()},[]);const V=n.useCallback(()=>{setTimeout(()=>{R.current&&(R.current.scrollTop=R.current.scrollHeight)},50)},[]);n.useEffect(V,[r,V]);const ee=async t=>{var a;const s=(a=t.target.files)==null?void 0:a[0];if(s){if(!s.type.startsWith("image/")){S.error("Nur Bilder sind erlaubt");return}if(s.size>Me){S.error("Bild ist zu groß (max. 4 MB)");return}try{p(await Se(s))}catch{S.error("Fehler beim Laden des Bildes")}A.current&&(A.current.value="")}},B=async t=>{var Z;const s=t.trim();if(!s&&!l||m)return;const a=[];l&&a.push({type:"image_url",image_url:{url:l}}),s?a.push({type:"text",text:s}):l&&a.push({type:"text",text:"Was siehst du in diesem Bild?"});const u={role:"user",content:a},I=[...r,u];w(I),k(""),p(null),b(!0);let N="";const se=f=>{N+=f,w(C=>{const W=C[C.length-1];return(W==null?void 0:W.role)==="assistant"?C.map((G,ae)=>ae===C.length-1?{...G,content:N}:G):[...C,{role:"assistant",content:N}]})},re=E?(Z=K.find(f=>f.value===E))==null?void 0:Z.label:void 0;try{await ze({messages:I,userProfile:T||void 0,previousContext:d(),currentMood:re,onDelta:se,onDone:()=>{b(!1);const f=[...I,{role:"assistant",content:N}];w(f),D(j,f)},onError:f=>{S.error(f),b(!1)}})}catch{S.error("Verbindung fehlgeschlagen"),b(!1)}},te=t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),B(g))};return z?e.jsx("div",{className:"max-w-3xl mx-auto flex items-center justify-center py-20",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-purple-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})}):e.jsxs("div",{className:"max-w-3xl mx-auto",children:[e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[o&&e.jsx(M,{variant:"ghost",size:"icon",onClick:o,className:"h-9 w-9 text-muted-foreground hover:text-purple-500 mr-1",children:e.jsx(q,{className:"h-4 w-4"})}),e.jsx("div",{className:"w-10 h-10 rounded-full bg-gradient-to-br from-purple-400 to-purple-600 flex items-center justify-center overflow-hidden",children:e.jsx("img",{src:le,alt:"Mindset Coach",className:"w-9 h-9 object-contain"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h2",{className:"text-xl font-heading uppercase text-foreground",children:"Mindset Coach"}),e.jsxs("p",{className:"text-xs text-muted-foreground font-body",children:["Dein einfühlsamer Begleiter – ein sicherer Raum für dich ","🌱",E&&e.jsx("span",{className:"ml-1.5",children:(U=K.find(t=>t.value===E))==null?void 0:U.emoji})]})]}),v>0&&e.jsx(M,{variant:"ghost",size:"sm",onClick:()=>F(!c),className:"text-[10px] text-muted-foreground",children:c?"Ausblenden":"Fortschritt"})]})}),c&&e.jsx(de,{coachType:"mindset",sessionCount:v}),e.jsx(me,{conversations:i,activeId:j,onSelect:O,onNew:x,onDelete:P,accentColor:"purple"}),e.jsxs("div",{className:"border border-border rounded-xl bg-card overflow-hidden flex flex-col",style:{height:"min(65vh, 500px)"},children:[e.jsxs("div",{ref:R,className:"flex-1 overflow-y-auto p-4 space-y-4",children:[e.jsx(pe,{mode:"wait",children:H&&r.length===0?e.jsx(ue,{onComplete:t=>{J(t),y(!1)},onSkip:()=>y(!1)},"mood"):r.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center px-4",children:[e.jsx($,{className:"h-10 w-10 text-purple-400 mb-3"}),e.jsx("p",{className:"text-sm font-heading text-foreground mb-1",children:"Ein sicherer Raum für dich."}),e.jsx("p",{className:"text-xs text-muted-foreground font-body mb-5",children:"Wähl ein Thema oder schreib einfach, was dich bewegt."}),e.jsxs("div",{className:"w-full max-w-lg space-y-3",children:[e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-heading text-left",children:[e.jsx("span",{className:"not-uppercase font-sans",children:"🍃"})," Reflexion & Übungen"]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:Y.filter(t=>t.category!=="frage").map(t=>e.jsxs("button",{onClick:()=>B(t.prompt),className:"flex items-center gap-2.5 text-left text-xs font-body p-3 rounded-lg border border-border hover:border-purple-400 hover:bg-purple-50 dark:hover:bg-purple-950/20 transition-colors",children:[t.icon,e.jsx("span",{children:t.label})]},t.label))}),e.jsxs("p",{className:"text-[10px] uppercase tracking-wider text-muted-foreground font-heading text-left pt-1",children:[e.jsx("span",{className:"not-uppercase font-sans",children:"💛"})," Was dich bewegt"]}),e.jsx("div",{className:"grid grid-cols-1 gap-2",children:Y.filter(t=>t.category==="frage").map(t=>e.jsxs("button",{onClick:()=>B(t.prompt),className:"flex items-center gap-2 text-left text-xs font-body p-2.5 rounded-lg border border-border hover:border-purple-400 hover:bg-purple-50 dark:hover:bg-purple-950/20 transition-colors",children:[t.icon,e.jsx("span",{children:t.label})]},t.label))})]})]}):r.map((t,s)=>{const a=Ie(t),u=ke(t);return e.jsx("div",{className:`flex ${t.role==="user"?"justify-end":"justify-start"}`,children:e.jsxs("div",{className:`max-w-[85%] rounded-2xl px-4 py-2.5 text-sm font-body ${t.role==="user"?"bg-purple-500 text-white rounded-br-md":"bg-muted text-foreground rounded-bl-md"}`,children:[a.length>0&&e.jsx("div",{className:"mb-2",children:a.map((I,N)=>e.jsx("img",{src:I,alt:"Hochgeladenes Bild",className:"rounded-lg max-h-48 max-w-full object-contain"},N))}),t.role==="assistant"?e.jsx("div",{className:"prose prose-sm dark:prose-invert max-w-none prose-p:my-1 prose-li:my-0.5 prose-headings:my-2 prose-strong:text-foreground",children:e.jsx(he,{children:u})}):u&&e.jsx("span",{className:"whitespace-pre-wrap",children:u}),t.role==="assistant"&&m&&s===r.length-1&&e.jsx("span",{className:"inline-block w-1.5 h-4 bg-foreground
19/40 animate-pulse ml-0.5 align-text-bottom"})]})},s)})}),m&&((X=r[r.length-1])==null?void 0:X.role)==="user"&&e.jsx("div",{className:"flex justify-start",children:e.jsx("div",{className:"bg-muted rounded-2xl rounded-bl-md px-4 py-3",children:e.jsxs("div",{className:"flex gap-1",children:[e.jsx("span",{className:"w-2 h-2 bg-foreground/30 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-foreground/30 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-foreground/30 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]})})})]}),l&&e.jsx("div",{className:"border-t border-border px-3 py-2 bg-muted/50",children:e.jsxs("div",{className:"relative inline-block",children:[e.jsx("img",{src:l,alt:"Vorschau",className:"h-16 rounded-lg object-contain"}),e.jsx("button",{onClick:()=>p(null),className:"absolute -top-1.5 -right-1.5 bg-destructive text-destructive-foreground rounded-full p-0.5",children:e.jsx(ne,{className:"h-3 w-3"})})]})}),e.jsxs("div",{className:"border-t border-border p-3 flex gap-2 items-end",children:[r.length>0&&e.jsx(M,{variant:"ghost",size:"icon",onClick:x,className:"flex-shrink-0 text-muted-foreground hover:text-purple-500 h-9 w-9",title:"Neues Gespräch",children:e.jsx(q,{className:"h-4 w-4"})}),e.jsx("input",{ref:A,type:"file",accept:"image/*",className:"hidden",onChange:ee}),e.jsx(M,{variant:"ghost",size:"icon",onClick:()=>{var t;return(t=A.current)==null?void 0:t.click()},className:"flex-shrink-0 text-muted-foreground hover:text-purple-500 h-9 w-9",title:"Bild hochladen",disabled:m,children:e.jsx(fe,{className:"h-4 w-4"})}),e.jsx(ie,{ref:Q,value:g,onChange:t=>k(t.target.value),onKeyDown:te,placeholder:l?"Was möchtest du zu dem Bild wissen?":"Was bewegt dich gerade?",className:"min-h-[36px] max-h-[120px] resize-none text-sm font-body",rows:1,disabled:m}),e.jsx(M,{onClick:()=>B(g),disabled:!g.trim()&&!l||m,size:"icon",className:"flex-shrink-0 bg-purple-500 hover:bg-purple-600 text-white h-9 w-9",children:e.jsx(xe,{className:"h-4 w-4"})})]})]})]})};export{$e as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.