1import{bd as F,aU as i,a as j,aI as e,I as r,g as I}from"./index-Cgggh05U.js";function S({token:t,user:n}){const m=F(),[a,d]=i.useState(null),[o,y]=i.useState(!0),[v,p]=i.useState(!1),[h,f]=i.useState("faq"),[g,w]=i.useState([]),[N,_]=i.useState([]),[q,A]=i.useState(null);if(i.useEffect(()=>{fetch(`${j}/api/follows/user/avatars`,{headers:{Authorization:`Bearer ${t}`}}).then(s=>s.json()).then(s=>{const c=(s.avatars||[]).find(C=>C.avatar_type==="assistant");d(c||null)}).catch(console.error).finally(()=>y(!1))},[t]),i.useEffect(()=>{a&&(fetch(`${j}/api/chat/assistant-knowledge/${a.avatar_id}`,{headers:{Authorization:`Bearer ${t}`}}).then(s=>s.json()).then(s=>w(s.knowledge||[])).catch(()=>{}),fetch(`${j}/api/videos/avatar/${a.avatar_id}`,{headers:{Authorization:`Bearer ${t}`}}).then(s=>s.json()).then(s=>_(s.videos||[])).catch(()=>{}))},[a,t]),o)return e.jsx("div",{className:"assistant-page",children:e.jsx("div",{className:"container",children:e.jsx("div",{className:"loading-state",children:"Loading assistant..."})})});if(!a)return e.jsx("div",{className:"assistant-page",children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"empty-state card",children:[e.jsx("h3",{children:"Assistant Not Available"}),e.jsx("p",{className:"text-muted",children:"The platform assistant is not set up yet."}),e.jsx("button",{className:"btn btn-primary",onClick:()=>m("/"),children:"Go Home"})]})})});const u=g.filter(s=>s.category==="faq"),x=g.filter(s=>s.category==="custom");return e.jsxs("div",{className:"assistant-page",children:[e.jsx("div",{className:"assistant-hero",children:e.jsx("div",{className:"container",children:e.jsxs("div",{className:"assistant-profile",children:[e.jsx("div",{className:"assistant-avatar-large",children:a.profile_image_url?e.jsx("img",{src:a.profile_image_url,alt:a.name}):e.jsx("div",{className:"assistant-avatar-placeholder",children:e.jsx(r,{name:"comment",size:64})})}),e.jsxs("div",{className:"assistant-info",children:[e.jsx("h1",{children:a.name}),e.jsx("p",{className:"assistant-role",children:"Platform Assistant"}),e.jsx("p",{className:"assistant-desc",children:"Your personal guide to HypeTunes. Get help with features, marketing strategies, artist management, and more."}),e.jsxs("button",{className:"btn btn-primary assistant-chat-btn",onClick:()=>p(!0),children:[e.jsx(r,{name:"comment",size:16})," Chat Now"]})]})]})})}),e.jsxs("div",{className:"container",children:[e.jsxs("div",{className:"category-tabs",children:[e.jsxs("button",{className:`tab ${h==="faq"?"active":""}`,onClick:()=>f("faq"),children:[e.jsx(r,{name:"circle-question",size:16})," FAQ"]}),e.jsxs("button",{className:`tab ${h==="videos"?"active":""}`,onClick:()=>f("videos"),children:[e.jsx(r,{name:"clapperboard",size:16})," Videos"]})]}),h==="faq"&&e.jsxs("div",{className:"faq-section",children:[u.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"section-title",children:"Frequently Asked Questions"}),e.jsx("div",{className:"faq-list",children:u.map((s,l)=>e.jsx(b,{content:s.content},l))})]}),x.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"section-title",children:"Platform Features"}),e.jsx("div",{className:"faq-list",children:x.map((s,l)=>e.jsx(b,{content:s.content},l))})]}),u.length===0&&x.length===0&&e.jsxs("div",{className:"empty-state card",children:[e.jsx(r,{name:"circle-question",size:48}),e.jsx("h3",{children:"No FAQs Yet"}),e.jsx("p",{className:"text-muted",children:"Chat with the assistant to get help with anything."})]})]}),h==="videos"&&e.jsx("section",{className:"tab-content",children:N.length===0?e.jsxs("div",{className:"empty-state card",children:[e.jsx("div",{className:"empty-icon",children:e.jsx(r,{name:"clapperboard",size:48})}),e.jsx("h3",{children:"No Videos Yet"}),e.jsx("p",{className:"text-muted",children:"Tutorial videos will appear here."})]}):e.jsx("div",{className:"videos-grid",children:N.map(s=>{const l=s.video_type==="generated"||s.gcs_url,c=l?null:$(s.youtube_url);return e.jsx("div",{className:"video-card card",children:l?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"video-thumbnail",children:e.jsx("video",{src:s.gcs_url,poster:s.poster_url,controls:!0,preload:"metadata",style:{width:"100%",aspectRatio:"16/9",objectFit:"contain",backgroundColor:"#000"}})}),e.jsx("div",{className:"video-info",children:e.jsx("h3",{children:s.title||"Generated Video"})})]}):c&&q===c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"video-thumbnail",children:e.jsx("iframe",{width:"100%",style:{aspectRatio:"16/9"},src:`https://www.youtube.com/embed/${c}?autoplay=1`,title:s.title,frameBorder:"0",allow:"autoplay; encrypted-media",allowFullScreen:!0})}),e.jsx("div",{className:"video-info",children:e.jsx("h3",{children:s.title||"Untitled Video"})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"video-thumbnail",onClick:()=>A(c),style:{cursor:"pointer"},children:[e.jsx("img",{src:`https://img.youtube.com/vi/${c}/hqdefault.jpg`,alt:s.title}),e.jsx("div",{className:"video-play-overlay",children:"â¶"})]}),e.jsx("div",{className:"video-info",children:e.jsx("h3",{children:s.title||"Untitled Video"})})]})},s.video_id)})})})]}),v&&e.jsx(I,{isOpen:v,onClose:()=>p(!1),avatarId:a.avatar_id,avatarName:a.name,avatarImage:a.profile_image_url,token:t,user:n,isFollowing:!0})]})}function $(t){const n=t?.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/);
1return n?n[1]:null}function b({content:t}){const[n,m]=i.useState(!1),a=t.indexOf(":");let d,o;return a>0&&a<60?(d=t.substring(0,a),o=t.substring(a+1).trim()):(d=t.length>80?t.substring(0,80)+"...":t,o=t),e.jsxs("div",{className:`faq-card card ${n?"expanded":""}`,onClick:()=>m(!n),children:[e.jsxs("div",{className:"faq-card-header",children:[e.jsx("h3",{children:d}),e.jsx(r,{name:n?"chevron-up":"chevron-down",size:14})]}),n&&e.jsx("p",{className:"faq-card-body",children:o})]})}export{S 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.