1import{j as e,r as c,B as n,L as V,e as h}from"./index-uPuoBMhx.js";import{e as m}from"./tooltip-B-l-dOqs.js";import{c as q}from"./index-A7ElDbZk.js";import{C as u,b as j,c as g,a as f}from"./card-1lN1_Se8.js";import{B as N}from"./badge-CrRB5M6z.js";import{T as G,a as Y,b as L,c as E}from"./tabs-CJ62Nd3v.js";import{D as J,a as Q,b as K,c as X}from"./dialog-DXhopuNX.js";import{I as Z}from"./input-BmSpt0Eh.js";import{L as P}from"./label-BejpMhEw.js";import{T as ee,a8 as te}from"./pages.config-hgExbgEC.js";import{P as se}from"./PageSkeleton-C4cCZsu0.js";import{R as ae}from"./quill.snow-CfUTnqzn.js";import{P as re}from"./PageHeader-BaSP7za5.js";import{E as v}from"./EmptyState-skwXRmFI.js";import{L as ie}from"./loader-circle-CClJTEjr.js";import{S as le,C as y}from"./dropdown-menu-iCIlU9cC.js";import{V as b}from"./video-CYNXJfA8.js";import{F as U,D as oe}from"./trending-up-DI8OWV5v.js";import{a as ne}from"./clock-D9btEWFO.js";import{L as ce}from"./link-q-TY0bPt.js";import{S as de}from"./square-pen-CBgOWTmU.js";import{T as me}from"./trash-2-CNhP3AqE.js";import{h as R}from"./format-WoXbaKoi.js";import"./index-BaASz1SR.js";import"./index-CPcWs2mZ.js";import"./index-Wvdu2dI_.js";import"./index-BLbwat6W.js";import"./index-ovzA6VBT.js";import"./index-BIK2eHIR.js";import"./index-DoY6TkfM.js";import"./index-Cu1sS3TT.js";import"./index-BmCJDWmK.js";import"./x-ChRmB3ff.js";import"./skeleton-DOGFCoEw.js";import"./select-D07I9jAC.js";import"./index-BdQq_4o_.js";import"./chevron-down-BNqv1YJ1.js";import"./plus-nao29ywL.js";import"./textarea-lM6uA-MR.js";import"./switch-BehuccBp.js";import"./circle-alert-C0QDXt7F.js";import"./sparkles-BMLEjkPv.js";import"./users-U-Rdm9PF.js";import"./crown-Dka_-Nxk.js";import"./waypoints-DB6uEXAV.js";import"./graduation-cap-DFwKZhhE.js";import"./arrow-right-VpgmkQjv.js";import"./SupervisedGuidesRoster-DrArdAB4.js";import"./avatar-Bhxn90qL.js";import"./ChurchTag-FinbzF8x.js";import"./building-2-CH0TgYOF.js";import"./circle-check-BO0sHK-q.js";import"./clipboard-list-3xEa1kOf.js";import"./journeyApi-CQ6eKrk4.js";import"./search-CqNdnPxG.js";import"./external-link-DCG1godj.js";import"./proxy-kYcqYoy3.js";import"./JourneyCard-6WViabqj.js";import"./info-D7uJ7LVm.js";import"./shield-check-Ds0sNnHc.js";import"./globe-CcruHzdM.js";import"./badge-check-D0W_elOA.js";import"./megaphone-CGb0rIfX.js";import"./user-plus-DYMIVDGV.js";import"./sheet-CRixps9Y.js";import"./circle-check-big-DOAasZi7.js";import"./useQuery-BHFaz3Mh.js";import"./Loader-yhtKwwRu.js";import"./lock-BWkWm970.js";import"./index-Ck7DnIc4.js";import"./user-CtT-IPS_.js";import"./mail-Dn9HRcgA.js";function pe(){const[p,F]=c.useState([]),[w,x]=c.useState([]),[M,C]=c.useState(!0),[$,z]=c.useState("workshops"),[r,d]=c.useState(null),[_,T]=c.useState(null);if(c.useEffect(()=>{(async()=>{try{C(!0);const s=await m.Workshop.filter({published:!0,deleted_at:null},"scheduled_date");F(s);try{const a=await m.User.me(),o=(await m.UserNote.filter({created_by:a.email})).filter(i=>{var W;return(W=i.module_id)==null?void 0:W.startsWith("workshop_")});x(o)}catch{}}catch(s){console.error("Failed to fetch workshops:",s)}finally{C(!1)}})()},[]),M)return e.jsx(se,{cards:8,columns:4});const k=p.filter(t=>new Date(t.scheduled_date)>=new Date&&t.status==="scheduled"),D=p.filter(t=>new Date(t.scheduled_date)<new Date||t.status==="completed"),I=(t,s)=>{var i;s.preventDefault(),s.stopPropagation();const a=new Date(t.scheduled_date),l=new Date(a.getTime()+(t.duration_minutes||60)*6e4),o=`https://calendar.google.com/calendar/render?action=TEMPLATE&text=${encodeURIComponent(t.title)}&dates=${a.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,"")}/${l.toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,"")}&details=${encodeURIComponent(t.short_description||((i=t.description)==null?void 0:i.replace(/<[^>]*>/g,"").substring(0,200))||"")}`;window.open(o,"_blank")},O=t=>{const s=t==null?void 0:t.replace("workshop_",""),a=p.find(l=>l.id===s);return(a==null?void 0:a.title)||"Workshop"},A=async t=>{if(window.confirm("Are you sure you want to delete this note?"))try{await m.UserNote.delete(t),x(s=>s.filter(a=>a.id!==t)),h.success("Note deleted")}catch(s){console.error("Failed to delete note:",s),h.error("Failed to delete note")}},B=t=>{const s=document.createElement("div");s.innerHTML=t.content||"";const a=s.textContent||s.innerText||"",l=new Blob([`${t.title} 2${"=".repeat(40)} 3 4${a}`],{type:"text/plain"}),o=URL.createObjectURL(l),i=document.createElement("a");i.href=o,i.download=`${(t.title||"note").replace(/[^a-z0-9]/gi,"_")}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},H=async()=>
4{if(r)try{T(r.id),await m.UserNote.update(r.id,{title:r.title,content:r.content}),x(t=>t.map(s=>s.id===r.id?{...s,title:r.title,content:r.content}:s)),d(null),h.success("Note saved!")}catch(t){console.error("Failed to save note:",t),h.error("Failed to save note")}finally{T(null)}},S=(t,s)=>{d(a=>({...a,[t]:s}))};return e.jsxs(e.Fragment,{children:[e.jsx(J,{open:!!r,onOpenChange:()=>d(null),children:e.jsxs(Q,{className:"max-w-3xl max-h-[90vh] flex flex-col",children:[e.jsx(K,{children:e.jsx(X,{children:"Edit Note"})}),r&&e.jsxs("div",{className:"flex-1 space-y-4 overflow-y-auto pr-2",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{htmlFor:"edit-note-title",children:"Note Title"}),e.jsx(Z,{id:"edit-note-title",value:r.title||"",onChange:t=>S("title",t.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(P,{children:"Content"}),e.jsx(ae,{theme:"snow",value:r.content||"",onChange:t=>S("content",t),className:"bg-white"})]})]}),e.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[e.jsx(n,{variant:"ghost",onClick:()=>d(null),children:"Cancel"}),e.jsx(n,{onClick:H,disabled:_===(r==null?void 0:r.id),children:_===(r==null?void 0:r.id)?e.jsxs(e.Fragment,{children:[e.jsx(ie,{className:"w-4 h-4 mr-2 animate-spin"}),"Saving..."]}):e.jsxs(e.Fragment,{children:[e.jsx(le,{className:"w-4 h-4 mr-2"}),"Save Changes"]})})]})]})}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(re,{icon:y,title:"Workshops",description:"Join live workshops or catch up with past replays."}),e.jsxs(G,{value:$,onValueChange:z,children:[e.jsxs(Y,{children:[e.jsxs(L,{value:"workshops",children:[e.jsx(b,{className:"w-4 h-4 mr-2"}),"Workshops"]}),e.jsxs(L,{value:"notes",children:[e.jsx(U,{className:"w-4 h-4 mr-2"}),"My Notes"]})]}),e.jsxs(E,{value:"workshops",className:"space-y-8 mt-6",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Upcoming Live Workshops"}),k.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:k.map(t=>e.jsxs(u,{className:"flex flex-col overflow-hidden",children:[t.thumbnail_url&&e.jsx("div",{className:"w-full h-40 overflow-hidden",children:e.jsx("img",{src:t.thumbnail_url,alt:t.title,className:"w-full h-full object-cover"})}),e.jsxs(j,{className:t.thumbnail_url?"pt-4":"",children:[e.jsx(N,{variant:"outline",className:"w-fit mb-2 capitalize",children:t.category}),e.jsx(g,{className:"text-lg leading-tight",children:t.title}),e.jsxs("p",{className:"text-sm text-gray-500",children:["with ",t.presenter]})]}),e.jsxs(f,{className:"flex-grow space-y-2 text-sm",children:[t.short_description&&e.jsx("p",{className:"text-gray-600 line-clamp-2",children:t.short_description}),e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(y,{className:"w-4 h-4 flex-shrink-0"}),e.jsxs("span",{children:[R(new Date(t.scheduled_date+"T00:00:00"),"MMMM d, yyyy"),t.start_time&&` at ${t.start_time}`]})]}),t.duration_minutes&&e.jsxs("div",{className:"flex items-center gap-2 text-gray-600",children:[e.jsx(ne,{className:"w-4 h-4 flex-shrink-0"}),e.jsxs("span",{children:[t.duration_minutes," minutes"]})]})]}),e.jsxs("div",{className:"p-6 pt-0 space-y-2",children:[t.zoom_link&&e.jsx(n,{asChild:!0,className:"w-full bg-brand-accent hover:bg-brand-accent-hover",children:e.jsxs("a",{href:t.zoom_link,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(ce,{className:"w-4 h-4 mr-2"}),"Get Workshop Link"]})}),e.jsxs(n,{variant:"outline",className:"w-full",onClick:s=>I(t,s),children:[e.jsx(te,{className:"w-4 h-4 mr-2"}),"Add to Calendar"]})]})]},t.id))}):e.jsx(v,{icon:y,title:"No Upcoming Workshops",description:"No workshops are scheduled right now. Check back soon!"})]}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-semibold mb-4",children:"Past Workshop Replays"}),D.length>0?e.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:D.map(t=>e.jsxs(u,{className:"flex flex-col overflow-hidden",children:[t.thumbnail_url&&e.jsx("div",{className:"w-full h-40 overflow-hidden",children:e.jsx("img",{src:t.thumbnail_url,alt:t.title,className:"w-full h-full object-cover"})}),e.jsxs(j,{className:t.thumbnail_url?"pt-4":"",children:[e.jsx(N,{variant:"outline",className:"w-fit mb-2 capitalize",children:t.category}),e.jsx(g,{className:"text-lg leading-tight",children:t.title}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Presented by ",t.presenter]})]}),e.jsx(f,{className:"flex-grow",children:t.short_description&&e.jsx("p",{className:"text-gray-600 text-sm line-clamp-2",children:t.short_description})}),e.jsx("div",{className:"p-6 pt-0",children:e.jsx(n,{asChild:!0,variant:"secondary",className:"w-full",children:e.jsxs(V,{to:q("Workshop")+`?id=${t.id}`,children:[e.jsx(b,{className:"w-4 h-4 mr-2"}),"Watch Replay"]})})})]},t.id))}):e.jsx(v,{icon:b,title:"No Replays Yet",description:"Past workshop replays will appear here."})]})]}),e.jsx(E,{value:"notes",className:"mt-6",children:w.length>0?e.jsx("div",{className:"space-y-4",children:w.map(t=>{var l;const s=(l=t.module_id)==null?void 0:l.replace("workshop_",""),a=p.find(o=>o.id===s);return e.jsxs(u,{className:"hover:shadow-md transition-shadow",children:[e.jsx(j,{className:"pb-2",children:e.jsxs("div",{className:"flex justify-between items-start gap-2",children:[e.jsxs("div",{children:[e.jsx(g,{className:"text-lg",children:t.title||O(t.module_id)}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-gray-500 mt-1",children:[(a==null?void 0:a.category)&&e.jsx(N,{variant:"outline",className:"capitalize",children:a.category}),e.jsx("span",{children:R(new Date(t.updated_date||t.created_date),"MMM d, yyyy")})]})]}),e.jsxs("div",{className:"flex items-center gap-1 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"icon",onClick:()=>d({...t}),children:e.jsx(de,{className:"w-4 h-4"})}),e.jsx(n,{variant:"ghost",size:"icon",onClick:()=>B(t),children:e.jsx(oe,{className:"w-4 h-4"})}),e.jsx(n,{variant:"ghost",size:"icon",className:"text-red-500 hover:bg-red-50",onClick:()=>A(t.id),children:e.jsx(me,{className:"w-4 h-4"})})]})]})}),e.jsx(f,{className:"pt-2",children:e.jsx("div",{className:"text-sm text-gray-600 prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.content}})})]},t.id)})}):e.jsx(v,{icon:U,title:"No Notes Yet",description:"Watch a workshop and take notes to see them here."})})]})]})]})}function Lt(){return e.jsx(ee,{requiredTier:"basic",featureName:"Workshops",children:e.jsx(pe,{})})}
4export{Lt 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.