1import{j as e,r,J as Q,N as K,Q as U,U as H,V,c as _,aA as M,aX as re,a as X,fB as ae,a5 as ne,aY as ie,a9 as oe,aH as le,fD as ce,B as D,L as A,al as de,fE as me,ah as ue,W as xe,dq as fe,d7 as he,bC as pe,dx as $,dz as ge,ay as be}from"./index-BuKyStDl.js";import{C as je,a as ve}from"./card-Del7XBUu.js";import{a as _e}from"./format-date-g02VbQr_.js";import{M as G}from"./mic-BuvBjnUW.js";import{Z as ye}from"./zap-DJ4y05Ve.js";import{a as we,b as Ne,c as ke,d as O,e as Ce,f as Re,g as Se,h as Pe,i as De,j as Ae,k as Ee,l as Me,m as Te,n as Ie,o as Le,p as ze,q as Fe,r as Be,s as qe,t as We,u as $e,v as Oe,w as Qe,x as Ke,y as Ue,z as He,A as Ve,B as Xe}from"./recordings_main_my_submissions-DYyxKlu-.js";import{A as Ge}from"./ash-upgrade-dialog-CGZvlAdL.js";import{B as Je}from"./briefcase-CERU5xNw.js";import{A as Ze}from"./arrow-right-BaghLRy4.js";import{a as Ye,b as es,i as ss}from"./recording-status-CHiBlqJ0.js";import{C as ts}from"./clock-Di4Fe-gs.js";import{T as rs}from"./trash-2-CsYgQ4BC.js";import{S as as,u as ns,R as is}from"./use-recordings-pagination-DYfYUflb.js";import{C as os}from"./circle-check-DcBae7Na.js";import{T as I}from"./triangle-alert-pdW9voI8.js";import{P as ls}from"./pause-DcE2XySt.js";import{P as cs}from"./play-DKac4cLv.js";import{c as ds}from"./common_loading-BxQ7CHwp.js";import{i as ms,e as us}from"./recordings_status_unavailable-BTcuxaQ-.js";import{c as xs}from"./common_cancel-Ctr2P1hT.js";import{c as fs}from"./common_delete-CqhxqfTN.js";import{c as hs,s as ps}from"./sidebar_close_aria-i1IAr7VG.js";import{c as J}from"./common_generic_error-vLvJcNTA.js";import{u as gs}from"./use-sidebar-BrFejAi0.js";import"./penguin-feedback-BhJLoOXN.js";import"./ai_interview_upgrade_title-H-sO5YD9.js";import"./ai_interview_upgrade_compare-BcDaGNDz.js";import"./panel-left-close-qcxweWyQ.js";import"./infiniteQueryOptions-Kf6x0a2l.js";import"./useInfiniteQuery-Cz_Slncd.js";function bs({open:t,onOpenChange:o,workshopTitle:l,liveTitle:x,onPickAsh:p,onPickQuickfire:m}){const c=[{key:"ash",icon:e.jsx(G,{className:"h-5 w-5"}),title:x,subtitle:we(),onSelect:p},{key:"quickfire",icon:e.jsx(ye,{className:"h-5 w-5"}),title:ke(),subtitle:Ne(),onSelect:m}],[a,f]=r.useState(0),d=r.useRef([]);r.useEffect(()=>{t&&f(0)},[t]);const s=n=>{const u=(n+c.length)%c.length;f(u),d.current[u]?.focus()},h=n=>{switch(n.key){case"ArrowDown":n.preventDefault(),s(a+1);break;case"ArrowUp":n.preventDefault(),s(a-1);break;case"Home":n.preventDefault(),s(0);break;case"End":n.preventDefault(),s(c.length-1);break}};return e.jsx(Q,{open:t,onOpenChange:o,children:e.jsxs(K,{className:"sm:max-w-md sm:rounded-2xl",onOpenAutoFocus:n=>{n.preventDefault(),d.current[0]?.focus()},children:[e.jsxs(U,{children:[e.jsx(H,{children:O({workshop:l})}),e.jsx(V,{children:Ce()})]}),e.jsx("div",{role:"menu","aria-orientation":"vertical","aria-label":O({workshop:l}),className:"flex flex-col gap-3",onKeyDown:h,children:c.map((n,u)=>{const b=u===a;return e.jsxs("button",{ref:g=>{d.current[u]=g},type:"button",role:"menuitem",tabIndex:b?0:-1,onClick:n.onSelect,onFocus:()=>
1f(u),className:_("group flex items-center gap-4 rounded-2xl border p-4 text-start outline-none transition-colors",b?"border-primary bg-primary/10 ring-2 ring-primary":"border-border bg-card hover:bg-accent"),children:[e.jsx("span",{className:_("flex size-11 shrink-0 items-center justify-center rounded-full transition-colors",b?"bg-primary text-primary-foreground":"bg-muted text-foreground"),children:n.icon}),e.jsxs("span",{className:"min-w-0 flex-1",children:[e.jsx("span",{className:"block font-semibold",children:n.title}),e.jsx("span",{className:"block text-sm text-muted-foreground",children:n.subtitle})]}),e.jsx(M,{className:_("h-5 w-5 shrink-0 transition-transform rtl:rotate-180",b?"translate-x-0.5 text-primary":"text-muted-foreground")})]},n.key)})})]})})}function js(){const{user:t}=re(),o=X(),l=ae(t),[x,p]=r.useState(null),[m,c]=r.useState(!1),a=[{type:Se(),description:Re(),slug:"job-interview",img:ne,bgClass:"bg-amber-50 dark:bg-amber-950/30",borderColor:"border-amber-200 dark:border-amber-800/40",icon:Je,iconColor:"text-amber-600 dark:text-amber-400"},{type:De(),description:Pe(),slug:"ielts",img:oe,bgClass:"bg-green-50 dark:bg-green-950/30",borderColor:"border-green-200 dark:border-green-800/40",icon:ie,iconColor:"text-green-600 dark:text-green-400"},{type:Ee(),description:Ae(),slug:"conversation",img:ce,bgClass:"bg-blue-50 dark:bg-blue-950/30",borderColor:"border-blue-200 dark:border-blue-800/40",icon:le,iconColor:"text-blue-600 dark:text-blue-400"}],f=()=>{const s=x?.slug;p(null),s&&o({to:"/ash/$workshop",params:{workshop:s}})},d=()=>{const s=x?.slug;if(p(null),!!s){if(!l){c(!0);return}o({to:"/quickfire/$workshop",params:{workshop:s}})}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold",children:Me()}),e.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:Te()})]}),e.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:a.map(s=>{const h=s.icon;return e.jsxs("button",{type:"button",onClick:()=>p({slug:s.slug,title:s.type}),className:`group relative flex flex-col overflow-hidden rounded-2xl border bg-card shadow-sm transition-shadow duration-200 hover:shadow-md ${s.borderColor}`,children:[e.jsx("div",{className:`relative flex items-end justify-center overflow-hidden px-6 pt-5 ${s.bgClass}`,children:e.jsx("img",{src:s.img,alt:s.type,width:304,height:303,decoding:"async",className:"relative z-[1] h-[75px] w-auto object-contain sm:h-[90px]"})}),e.jsxs("div",{className:"flex flex-1 flex-col items-start gap-1 px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{className:`h-3.5 w-3.5 ${s.iconColor}`}),e.jsx("span",{className:"text-sm font-semibold",children:s.type})]}),e.jsx("p",{className:"text-left text-xs text-muted-foreground",children:s.description})]}),e.jsxs("div",{className:"flex items-center justify-between border-t border-border/50 px-4 py-2",children:[e.jsx("span",{className:"text-xs font-medium text-primary",children:Ie()}),e.jsx(Ze,{className:"h-3.5 w-3.5 text-primary transition-transform duration-200 group-hover:translate-x-0.5 rtl:rotate-180"})]})]},s.slug)})}),e.jsx(bs,{open:!!x,onOpenChange:s=>{s||p(null)},workshopTitle:x?.title??"",liveTitle:x?.slug==="conversation"?Le():x?.slug==="ielts"?ze():Fe(),onPickAsh:f,onPickQuickfire:d}),e.jsx(Ge,{open:m,onOpenChange:c})]})}function vs(t,o){return t.map(l=>l.filter(x=>x.id!==o))}function _s(t,o,l){return l?o:t===o?null:t}function T(t){const o=Math.floor(t/60),l=Math.floor(t%60);return`${o}:${l.toString().padStart(2,"0")}`}const ys=[["a",40],["b",65],["c",35],["d",80],["e",50],["f",70],["g",45],["h",90],["i",55],["j",75],["k",40],["l",60],["m",35],["n",85],["o",50]];function ws({audioUrl:t,onPlayStateChange:o,shouldStop:l,rtl:x}){const p=fe(),m=x??p==="rtl",c=r.useRef(null),a=r.useRef(null),f=r.useRef(()=>{}),d=r.useRef(o),s=r.useRef(!1),h=r.useRef(!1),n=r.useRef(0),[u,b]=r.useState(!1),[g,E]=r.useState(0),[k,L]=r.useState(0),[y,R]=r.useState("idle"),[z,N]=r.useState(!1);r.useEffect(()=>{d.current=o},[o]),r.useEffect(()=>{const j=++n.current;let v=!1,i=null,C=null;h.current=!1,s.current=!1,a.current=null,R("idle"),N(!1),b(!1),E(0),L(0);const w=()=>!v&&n.current===j,S=()=>{w()&&(s.current=!1,N(!1),b(!1),d.current?.(!1))},B=()=>{w()&&(h.current=!1,i&&(i.destroy(),i=null),a.current=null,C=null,R("error"),S())},q=P=>{P.play().catch(S)},se=P=>
1{if(w()){if(P&&(s.current=!0),i){P&&h.current&&q(i);return}C||(R("loading"),C=he(()=>import("./wavesurfer.esm-BgXv1P4T.js"),[]).then(async({default:te})=>{const W=c.current;!w()||!W||(i=te.create({container:W,waveColor:"#D1D5DB",progressColor:"#000000",cursorWidth:0,barWidth:3,barGap:2,barRadius:3,height:40,normalize:!0,interact:!m}),a.current=i,i.on("ready",()=>{!w()||!i||(h.current=!0,R("ready"),L(i.getDuration()),s.current&&(s.current=!1,q(i)))}),i.on("audioprocess",()=>{w()&&i&&E(i.getCurrentTime())}),i.on("play",()=>{w()&&(N(!1),b(!0),d.current?.(!0))}),i.on("pause",S),i.on("finish",S),i.on("error",B),await i.load(t))}).catch(B))}};return f.current=se,()=>{v=!0,n.current+=1,f.current=()=>{},a.current=null,i?.destroy()}},[t,m]),r.useEffect(()=>{l&&(s.current=!1,N(!1),a.current&&u&&a.current.pause())},[l,u]);const F=r.useCallback(()=>{y==="idle"&&f.current(!1)},[y]),Z=r.useCallback(j=>{j.stopPropagation();const v=a.current;if(N(!0),v&&h.current){u||d.current?.(!0),v.playPause().catch(()=>{N(!1),d.current?.(!1)});return}d.current?.(!0),f.current(!0)},[u]),Y=r.useCallback(j=>{if(!m||!a.current||!c.current)return;j.stopPropagation();const v=c.current.getBoundingClientRect(),C=1-(j.clientX-v.left)/v.width;a.current.seekTo(Math.max(0,Math.min(1,C)))},[m]),ee=r.useCallback(j=>{if(j.key!=="ArrowLeft"&&j.key!=="ArrowRight")return;const v=a.current;if(!v||k<=0)return;j.preventDefault();const i=Math.max(0,Math.min(k,g+(j.key==="ArrowRight"?5:-5)));v.seekTo(i/k),E(i)},[g,k]);return e.jsxs("div",{className:"flex items-center gap-2 md:gap-3",onPointerEnter:F,onFocusCapture:F,children:[e.jsx("button",{type:"button",onClick:Z,disabled:z,className:_("w-8 h-8 md:w-10 md:h-10 rounded-full flex items-center justify-center transition-colors flex-shrink-0","bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),children:z?e.jsx(A,{className:"w-4 h-4 md:w-5 md:h-5 animate-spin"}):u?e.jsx(ls,{className:"w-4 h-4 md:w-5 md:h-5"}):y==="error"?e.jsx(I,{className:"w-4 h-4 md:w-5 md:h-5"}):e.jsx(cs,{className:"w-4 h-4 md:w-5 md:h-5 ml-0.5"})}),e.jsx("span",{className:"text-xs md:text-sm font-mono text-muted-foreground flex-shrink-0",children:T(g)}),e.jsxs("div",{className:"relative h-10 min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{ref:c,role:y==="ready"?"slider":void 0,tabIndex:y==="ready"?0:-1,"aria-label":hs({time:T(g)}),"aria-valuemin":0,"aria-valuemax":k,"aria-valuenow":g,className:_("h-10 transition-opacity duration-150",y==="ready"?"opacity-100":"opacity-0",m&&"cursor-pointer"),style:m?{transform:"scaleX(-1)"}:void 0,onClick:m?Y:void 0,onKeyDown:ee}),y!=="ready"?e.jsx("div",{"aria-hidden":"true",className:_("absolute inset-0 flex items-center gap-1 overflow-hidden transition-opacity",y==="loading"&&"animate-pulse"),children:ys.map(([j,v])=>e.jsx("span",{className:"min-w-0 flex-1 rounded-full bg-muted-foreground/20",style:{height:`${v}%`}},j))}):null]})]})}function Ns({recording:t,onViewFeedback:o,playingRecordingId:l,onPlayStateChange:x}){const p=l!==null&&l!==t.id,[m,c]=r.useState(!1),a=r.useRef(!1),f=de(),{mutate:d,isPending:s}=me({mutation:{onSuccess:(u,b)=>{f.setQueryData([...$(),"infinite"],g=>g&&{...g,pages:vs(g.pages,b.id)}),a.current=!1,c(!1),f.invalidateQueries({queryKey:$()}).catch(()=>{})},onError:()=>{a.current=!1,pe.error(J())}}}),h=r.useCallback(u=>{x(t.id,u)},[t.id,x]),n=()=>{a.current||(a.current=!0,d({id:t.id}))};return e.jsxs(e.Fragment,{children:[e.jsx(je,{className:"border hover:border-primary/30 transition-colors",children:e.jsxs(ve,{className:"p-3 md:p-4 space-y-3 md:space-y-4",children:[e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-1 md:gap-0",children:[e.jsxs("div",{className:"flex items-center justify-between md:justify-start gap-2 md:gap-3",children:[e.jsx("h3",{className:"font-semibold text-base md:text-lg",children:ue(t.language)}),e.jsx("span",{className:"text-xs md:text-sm text-muted-foreground",children:_e(t.created_at)})]}),e.jsxs("div",{className:"flex items-center justify-between md:justify-end gap-2 md:gap-3",children:[e.jsxs("span",{className:"inline-flex items-center text-xs md:text-sm text-muted-foreground",children:[e.jsx(ts,{className:"w-3 h-3 md:w-4 md:h-4 me-1"}),T(t.duration)]}),e.jsx("button",{type:"button",onClick:()=>c(!0),className:"p-1 md:p-1.5 rounded-md text-destructive hover:bg-destructive/10 transition-colors",title:Oe(),children:e.jsx(rs,{className:"w-4 h-4 md:w-5 md:h-5"})})]})]}),e.jsx(ws,{audioUrl:t.audio_url,onPlayStateChange:h,shouldStop:p}),e.jsx("div",{className:"flex items-center justify-between pt-2 border-t border-border",children:Ye(t)?e.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-1.5 md:gap-2 text-amber-600 dar
1k:text-amber-400 hover:text-amber-500 font-medium transition-colors group text-sm md:text-base",title:ms(),children:[e.jsx(as,{className:"w-4 h-4 md:w-5 md:h-5"}),e.jsx("span",{children:Qe()}),e.jsx(M,{className:"w-3 h-3 md:w-4 md:h-4 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 rtl:rotate-180 transition-transform"})]}):es(t)?e.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-1.5 md:gap-2 text-green-600 dark:text-green-400 hover:text-green-500 font-medium transition-colors group text-sm md:text-base",children:[e.jsx(os,{className:"w-4 h-4 md:w-5 md:h-5"}),e.jsx("span",{children:Ke()}),e.jsx(M,{className:"w-3 h-3 md:w-4 md:h-4 group-hover:translate-x-0.5 rtl:group-hover:-translate-x-0.5 rtl:rotate-180 transition-transform"})]}):ss(t)?e.jsxs("div",{className:"inline-flex items-center gap-1.5 md:gap-2 text-muted-foreground text-sm md:text-base",children:[e.jsx(A,{className:"w-4 h-4 md:w-5 md:h-5 animate-spin"}),e.jsx("span",{className:"font-medium",children:Ue()})]}):e.jsxs("div",{className:"inline-flex items-center gap-1.5 text-sm text-destructive",children:[e.jsx(I,{className:"h-4 w-4","aria-hidden":!0}),e.jsx("span",{className:"font-medium",children:us()})]})})]})}),e.jsx(Q,{open:m,onOpenChange:u=>!s&&c(u),children:e.jsxs(K,{children:[e.jsxs(U,{children:[e.jsx(H,{children:He()}),e.jsx(V,{children:Ve()})]}),e.jsxs(xe,{children:[e.jsx(D,{variant:"outline",onClick:()=>c(!1),disabled:s,children:xs()}),e.jsx(D,{variant:"destructive",onClick:n,disabled:s,children:s?e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"w-4 h-4 me-2 animate-spin"}),Xe()]}):fs()})]})]})})]})}function ks(){return e.jsx("div",{className:"flex flex-col gap-3 md:gap-4",children:[1,2,3].map(t=>e.jsx("div",{className:"h-24 md:h-28 bg-muted rounded-lg animate-pulse"},t))})}function Cs(){return e.jsxs("div",{className:"text-center py-8 md:py-12",children:[e.jsx(G,{className:"w-12 h-12 md:w-16 md:h-16 mx-auto text-muted-foreground/50 mb-3 md:mb-4"}),e.jsx("h3",{className:"text-base md:text-lg font-medium mb-1 md:mb-2",children:We()}),e.jsx("p",{className:"text-xs md:text-sm text-muted-foreground",children:$e()})]})}function Rs({recordings:t,isLoading:o,onSelectRecording:l,hasMore:x=!1,isLoadingMore:p=!1,onLoadMore:m}){const[c,a]=r.useState(null),f=r.useCallback((d,s)=>{a(h=>_s(h,d,s))},[]);return e.jsxs("div",{className:"p-3 md:p-6 space-y-6 md:space-y-8",children:[e.jsx(js,{}),e.jsx("div",{className:"h-px bg-border"}),e.jsx("h2",{className:"text-lg md:text-xl font-semibold",children:Be()}),o?e.jsx(ks,{}):t.length===0?e.jsx(Cs,{}):e.jsxs("div",{className:"flex flex-col gap-3 md:gap-4",children:[t.map(d=>e.jsx(Ns,{recording:d,onViewFeedback:()=>l(d.id),playingRecordingId:c,onPlayStateChange:f},d.id)),x&&m&&e.jsx("div",{className:"flex justify-center pt-3 md:pt-4",children:e.jsx(D,{variant:"outline",onClick:m,disabled:p,className:"min-w-[160px] md:min-w-[200px] text-xs md:text-sm",children:p?e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"w-3 h-3 md:w-4 md:h-4 me-2 animate-spin"}),ds()]}):qe()})})]})]})}function at(){const t=X(),o=ge(),{sidebarCollapsed:l,toggleSidebar:x,closeSidebar:p}=gs(),{recordings:m,isLoading:c,isError:a,isFetching:f,refetch:d,hasMore:s,isLoadingMore:h,loadMore:n}=ns(),u=g=>{t({to:"/dashboard/feedback",search:{recordingId:g}})},b=o===!0;return a&&m.length===0?e.jsxs("div",{className:"flex min-h-[50vh] flex-col items-center justify-center p-6 text-center",children:[e.jsx(I,{className:"h-8 w-8 text-destructive","aria-hidden":!0}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",role:"alert",children:J()}),e.jsx(D,{className:"mt-3",variant:"outline",disabled:f,onClick:()=>{d()},children:be()})]}):e.jsxs("div",{className:_("h-[calc(100vh-64px)] flex relative","p-0 md:p-6","md:gap-6","gap-0"),children:[b&&e.jsx("button",{type:"button",className:_("fixed top-[64px] inset-x-0 bottom-0 bg-black/50 z-30 transition-opacity duration-300",l?"opacity-0 pointer-events-none":"opacity-100"),onClick:p,"aria-label":ps()}),e.jsx("div",{className:_("flex-shrink-0 bg-card z-40 transition-[width] duration-300 ease-in-out","w-14 border-r border-border","md:w-80 md:rounded-lg md:border md:shadow-sm md:border-r-0",b&&!l&&"!w-72 shadow-xl"),children:e.jsx(is,{recordings:m,selectedRecordingId:null,onSelectRecording:u,isLoading:c,hasMore:s,isLoadingMore:h,onLoadMore:n,isMobile:o,isCollapsed:l,onToggle:x})}),e.jsx("main",{className:_("flex-1 bg-card min-w-0 overflow-y-auto","md:rounded-lg md:border md:border-border md:shadow-sm"),children:e.jsx(Rs,{recordings:m,isLoading:c,onSelectRecording:u,hasMore:s,isLoadingMore:h,onLoadMore:n})})]})}export{at as component};
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.