import{r as m,j as e,i as Pe}from"./index-gX9iSPDQ.js";import{a as Re,B as De,C as te,g as Te}from"./audio-recordings.query-TNjEEFpx.js";import{B as Me,d as Ee,a as ae,b as Ae,e as Ve,c as Le,S as f}from"./skeleton-DGPXlcFF.js";import{c as _,u as Be,b as Ie,l as ze,e as A,P as z,f as I,k as He,a as ce,B as R}from"./createLucideIcon-W0Ra_zwb.js";import{f as de,e as Ke,u as me,C as $,b as F,c as U,a as O}from"./index-BIG1Xq_V.js";import{u as $e}from"./index-DmVJm5MZ.js";import{T as Fe,a as Ue,b as ne,c as re}from"./tabs-CKzWU6B3.js";import{L as Y}from"./link-YPZRNdtx.js";import{F as Oe,a as ie}from"./file-text-BnwEIBwa.js";import"./apiConstants-BiX1T2IA.js";import"./chevron-right-BHY7sgyv.js";import"./index-DVAmEPTK.js";/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qe=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Xe=_("ArrowLeft",qe);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ye=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],q=_("Download",Ye);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qe=[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]],Ge=_("Pause",Qe);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const We=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],Je=_("Play",We);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ze=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],es=_("RefreshCw",Ze);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ss=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],X=_("Tag",ss);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ts=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],as=_("User",ts);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ns=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]],rs=_("Volume2",ns);/**
 * @license lucide-react v0.476.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const is=[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]],os=_("VolumeX",is);var ue=["PageUp","PageDown"],xe=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],he={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},V="Slider",[Q,ls,cs]=ze(V),[fe,Ks]=Ie(V,[cs]),[ds,H]=fe(V),pe=m.forwardRef((s,t)=>{const{name:a,min:n=0,max:i=100,step:o=1,orientation:r="horizontal",disabled:d=!1,minStepsBetweenThumbs:x=0,defaultValue:j=[n],value:y,onValueChange:l=()=>{},onValueCommit:h=()=>{},inverted:b=!1,form:w,...N}=s,v=m.useRef(new Set),p=m.useRef(0),u=r==="horizontal"?ms:us,[g=[],k]=Be({prop:y,defaultProp:j,onChange:S=>{var M;(M=[...v.current][p.current])==null||M.focus(),l(S)}}),D=m.useRef(g);function T(S){const C=gs(g,S);L(S,C)}function _e(S){L(S,p.current)}function Ce(){const S=D.current[p.current];g[p.current]!==S&&h(g)}function L(S,C,{commit:M}={commit:!1}){const ee=Ns(o),K=bs(Math.round((S-n)/o)*o+n,ee),B=de(K,[n,i]);k((E=[])=>{const P=fs(E,B,C);if(ys(P,x*o)){p.current=P.indexOf(B);const se=String(P)!==String(E);return se&&M&&h(P),se?P:E}else return E})}return e.jsx(ds,{scope:s.__scopeSlider,name:a,disabled:d,min:n,max:i,valueIndexToChangeRef:p,thumbs:v.current,values:g,orientation:r,form:w,children:e.jsx(Q.Provider,{scope:s.__scopeSlider,children:e.jsx(Q.Slot,{scope:s.__scopeSlider,children:e.jsx(u,{"aria-disabled":d,"data-disabled":d?"":void 0,...N,ref:t,onPointerDown:A(N.onPointerDown,()=>{d||(D.current=g)}),min:n,max:i,inverted:b,onSlideStart:d?void 0:T,onSlideMove:d?void 0:_e,onSlideEnd:d?void 0:Ce,onHomeKeyDown:()=>!d&&L(n,0,{commit:!0}),onEndKeyDown:()=>!d&&L(i,g.length-1,{commit:!0}),onStepKeyDown:({event:S,direction:C})=>{if(!d){const K=ue.includes(S.key)||S.shiftKey&&xe.includes(S.key)?10:1,B=p.current,E=g[B],P=o*K*C;L(E+P,B,{commit:!0})}}})})})})});pe.displayName=V;var[ge,je]=fe(V,{startEdge:"left",endEdge:"right",size:"width",direction:1}),ms=m.forwardRef((s,t)=>{const{min:a,max:n,dir:i,inverted:o,onSlideStart:r,onSlideMove:d,onSlideEnd:x,onStepKeyDown:j,...y}=s,[l,h]=m.useState(null),b=I(t,u=>h(u)),w=m.useRef(void 0),N=He(i),v=N==="ltr",p=v&&!o||!v&&o;function c(u){const g=w.current||l.getBoundingClientRect(),k=[0,g.width],T=Z(k,p?[a,n]:[n,a]);return w.current=g,T(u-g.left)}return e.jsx(ge,{scope:s.__scopeSlider,startEdge:p?"left":"right",endEdge:p?"right":"left",direction:p?1:-1,size:"width",children:e.jsx(ve,{dir:N,"data-orientation":"horizontal",...y,ref:b,style:{...y.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:u=>{const g=c(u.clientX);r==null||r(g)},onSlideMove:u=>{const g=c(u.clientX);d==null||d(g)},onSlideEnd:()=>{w.current=void 0,x==null||x()},onStepKeyDown:u=>{const k=he[p?"from-left":"from-right"].includes(u.key);j==null||j({event:u,direction:k?-1:1})}})})}),us=m.forwardRef((s,t)=>{const{min:a,max:n,inverted:i,onSlideStart:o,onSlideMove:r,onSlideEnd:d,onStepKeyDown:x,...j}=s,y=m.useRef(null),l=I(t,y),h=m.useRef(void 0),b=!i;function w(N){const v=h.current||y.current.getBoundingClientRect(),p=[0,v.height],u=Z(p,b?[n,a]:[a,n]);return h.current=v,u(N-v.top)}return e.jsx(ge,{scope:s.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:e.jsx(ve,{"data-orientation":"vertical",...j,ref:l,style:{...j.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const v=w(N.clientY);o==null||o(v)},onSlideMove:N=>{const v=w(N.clientY);r==null||r(v)},onSlideEnd:()=>{h.current=void 0,d==null||d()},onStepKeyDown:N=>{const p=he[b?"from-bottom":"from-top"].includes(N.key);x==null||x({event:N,direction:p?-1:1})}})})}),ve=m.forwardRef((s,t)=>{const{__scopeSlider:a,onSlideStart:n,onSlideMove:i,onSlideEnd:o,onHomeKeyDown:r,onEndKeyDown:d,onStepKeyDown:x,...j}=s,y=H(V,a);return e.jsx(z.span,{...j,ref:t,onKeyDown:A(s.onKeyDown,l=>{l.key==="Home"?(r(l),l.preventDefault()):l.key==="End"?(d(l),l.preventDefault()):ue.concat(xe).includes(l.key)&&(x(l),l.preventDefault())}),onPointerDown:A(s.onPointerDown,l=>{const h=l.target;h.setPointerCapture(l.pointerId),l.preventDefault(),y.thumbs.has(h)?h.focus():n(l)}),onPointerMove:A(s.onPointerMove,l=>{l.target.hasPointerCapture(l.pointerId)&&i(l)}),onPointerUp:A(s.onPointerUp,l=>{const h=l.target;h.hasPointerCapture(l.pointerId)&&(h.releasePointerCapture(l.pointerId),o(l))})})}),ye="SliderTrack",Ne=m.forwardRef((s,t)=>{const{__scopeSlider:a,...n}=s,i=H(ye,a);return e.jsx(z.span,{"data-disabled":i.disabled?"":void 0,"data-orientation":i.orientation,...n,ref:t})});Ne.displayName=ye;var G="SliderRange",be=m.forwardRef((s,t)=>{const{__scopeSlider:a,...n}=s,i=H(G,a),o=je(G,a),r=m.useRef(null),d=I(t,r),x=i.values.length,j=i.values.map(h=>Se(h,i.min,i.max)),y=x>1?Math.min(...j):0,l=100-Math.max(...j);return e.jsx(z.span,{"data-orientation":i.orientation,"data-disabled":i.disabled?"":void 0,...n,ref:d,style:{...s.style,[o.startEdge]:y+"%",[o.endEdge]:l+"%"}})});be.displayName=G;var W="SliderThumb",we=m.forwardRef((s,t)=>{const a=ls(s.__scopeSlider),[n,i]=m.useState(null),o=I(t,d=>i(d)),r=m.useMemo(()=>n?a().findIndex(d=>d.ref.current===n):-1,[a,n]);return e.jsx(xs,{...s,ref:o,index:r})}),xs=m.forwardRef((s,t)=>{const{__scopeSlider:a,index:n,name:i,...o}=s,r=H(W,a),d=je(W,a),[x,j]=m.useState(null),y=I(t,c=>j(c)),l=x?r.form||!!x.closest("form"):!0,h=$e(x),b=r.values[n],w=b===void 0?0:Se(b,r.min,r.max),N=ps(n,r.values.length),v=h==null?void 0:h[d.size],p=v?js(v,w,d.direction):0;return m.useEffect(()=>{if(x)return r.thumbs.add(x),()=>{r.thumbs.delete(x)}},[x,r.thumbs]),e.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[d.startEdge]:`calc(${w}% + ${p}px)`},children:[e.jsx(Q.ItemSlot,{scope:s.__scopeSlider,children:e.jsx(z.span,{role:"slider","aria-label":s["aria-label"]||N,"aria-valuemin":r.min,"aria-valuenow":b,"aria-valuemax":r.max,"aria-orientation":r.orientation,"data-orientation":r.orientation,"data-disabled":r.disabled?"":void 0,tabIndex:r.disabled?void 0:0,...o,ref:y,style:b===void 0?{display:"none"}:s.style,onFocus:A(s.onFocus,()=>{r.valueIndexToChangeRef.current=n})})}),l&&e.jsx(hs,{name:i??(r.name?r.name+(r.values.length>1?"[]":""):void 0),form:r.form,value:b},n)]})});we.displayName=W;var hs=s=>{const{value:t,...a}=s,n=m.useRef(null),i=Ke(t);return m.useEffect(()=>{const o=n.current,r=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(r,"value").set;if(i!==t&&x){const j=new Event("input",{bubbles:!0});x.call(o,t),o.dispatchEvent(j)}},[i,t]),e.jsx("input",{style:{display:"none"},...a,ref:n,defaultValue:t})};function fs(s=[],t,a){const n=[...s];return n[a]=t,n.sort((i,o)=>i-o)}function Se(s,t,a){const o=100/(a-t)*(s-t);return de(o,[0,100])}function ps(s,t){return t>2?`Value ${s+1} of ${t}`:t===2?["Minimum","Maximum"][s]:void 0}function gs(s,t){if(s.length===1)return 0;const a=s.map(i=>Math.abs(i-t)),n=Math.min(...a);return a.indexOf(n)}function js(s,t,a){const n=s/2,o=Z([0,50],[0,n]);return(n-o(t)*a)*a}function vs(s){return s.slice(0,-1).map((t,a)=>s[a+1]-t)}function ys(s,t){if(t>0){const a=vs(s);return Math.min(...a)>=t}return!0}function Z(s,t){return a=>{if(s[0]===s[1]||t[0]===t[1])return t[0];const n=(t[1]-t[0])/(s[1]-s[0]);return t[0]+n*(a-s[0])}}function Ns(s){return(String(s).split(".")[1]||"").length}function bs(s,t){const a=Math.pow(10,t);return Math.round(s*a)/a}var ke=pe,ws=Ne,Ss=be,ks=we;const J=m.forwardRef(({className:s,...t},a)=>e.jsxs(ke,{ref:a,className:ce("relative flex w-full touch-none items-center select-none",s),...t,children:[e.jsx(ws,{className:"bg-secondary relative h-2 w-full grow overflow-hidden rounded-full",children:e.jsx(Ss,{className:"bg-primary absolute h-full"})}),e.jsx(ks,{className:"border-primary bg-background ring-offset-background focus-visible:ring-ring block h-5 w-5 rounded-full border-2 transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"})]}));J.displayName=ke.displayName;const oe=s=>{const t=Math.floor(s/60),a=Math.floor(s%60);return`${t}:${a.toString().padStart(2,"0")}`};function _s(s){const t=m.useRef(null),[a,n]=m.useState(!1),[i,o]=m.useState(!1),[r,d]=m.useState(0),[x,j]=m.useState(0),[y,l]=m.useState(75);m.useEffect(()=>{const c=t.current;if(!c)return;const u=()=>d(c.currentTime),g=()=>j(c.duration),k=()=>n(!1),D=()=>{const T=Math.round(c.volume*100);Math.abs(T-y)>1&&l(T),o(c.muted)};return c.volume=y/100,c.muted=i,c.addEventListener("timeupdate",u),c.addEventListener("loadedmetadata",g),c.addEventListener("ended",k),c.addEventListener("volumechange",D),c.readyState>=1&&g(),()=>{c.removeEventListener("timeupdate",u),c.removeEventListener("loadedmetadata",g),c.removeEventListener("ended",k),c.removeEventListener("volumechange",D)}},[s,y,i]),m.useEffect(()=>{const c=t.current;c&&(a?c.play().catch(u=>{console.error("Error playing audio:",u),n(!1)}):c.pause())},[a]);const h=m.useCallback(()=>{n(c=>!c)},[]),b=m.useCallback(()=>{const c=t.current;if(!c)return;const u=!i;c.muted=u,o(u)},[i]),w=m.useCallback(c=>{const u=c[0];d(u),t.current&&(t.current.currentTime=u)},[]),N=m.useCallback(c=>{const u=c[0];l(u),t.current&&(t.current.volume=u/100,u>0&&t.current.muted&&(t.current.muted=!1,o(!1)))},[]),v=oe(r),p=oe(x||0);return{audioRef:t,isPlaying:a,isMuted:i,currentTime:r,duration:x,displayVolume:y,togglePlayPause:h,toggleMute:b,handleTimeSliderChange:w,handleVolumeSliderChange:N,formattedCurrentTime:v,formattedDuration:p}}const le={completed:"bg-green-500 text-white border border-green-700 shadow-md px-4 py-1 rounded-full",processing:"bg-yellow-500 text-black border border-yellow-600 shadow-md px-4 py-1 rounded-full",uploaded:"bg-blue-500 text-white border border-blue-700 shadow-md px-4 py-1 rounded-full",failed:"bg-red-500 text-white border border-red-700 shadow-md px-4 py-1 rounded-full",error:"bg-red-500 text-white border border-red-700 shadow-md px-4 py-1 rounded-full",default:"bg-gray-500 text-white border border-gray-600 shadow-md px-4 py-1 rounded-full"};function Cs({recording:s}){const{data:t,refetch:a}=me(Re(s.id)),{audioRef:n,isPlaying:i,isMuted:o,currentTime:r,duration:d,displayVolume:x,togglePlayPause:j,toggleMute:y,handleTimeSliderChange:l,handleVolumeSliderChange:h,formattedCurrentTime:b,formattedDuration:w}=_s(s.file_path);return e.jsxs("div",{className:"relative container mx-auto px-4 py-6",children:[e.jsx("div",{className:"mb-6 flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Y,{to:"/audio-recordings",children:e.jsx(R,{variant:"outline",size:"icon",className:"hover:cursor-pointer",children:e.jsx(Xe,{className:"h-5 w-5"})})}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-bold",children:"Audio Recording Details"}),e.jsx(Me,{className:"text-muted-foreground text-sm",children:e.jsxs(Ee,{children:[e.jsx(ae,{children:e.jsx(Ae,{asChild:!0,children:e.jsx(Y,{to:"/audio-recordings",children:"Recordings"})})}),e.jsx(Ve,{}),e.jsx(ae,{children:e.jsx(Le,{children:s.id})})]})})]})]})}),e.jsx("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:e.jsxs("div",{className:"space-y-6 lg:col-span-3",children:[e.jsxs($,{children:[e.jsx(F,{className:"pb-3",children:e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-primary/10 rounded-full p-2",children:e.jsx(Oe,{className:"text-primary h-5 w-5"})}),"Recording"]})}),e.jsxs(O,{children:[e.jsx("audio",{ref:n,src:s.file_path,preload:"metadata",className:"hidden"}),e.jsxs("div",{className:"bg-secondary/30 mb-4 rounded-lg p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-4",children:[e.jsx(R,{size:"icon",className:"bg-primary text-primary-foreground hover:bg-primary/80 h-10 w-10 rounded-full",onClick:j,children:i?e.jsx(Ge,{className:"size-5"}):e.jsx(Je,{className:"size-5"})}),e.jsxs("div",{className:"flex flex-1 items-center gap-3",children:[e.jsx("span",{className:"text-sm",children:b}),e.jsx(J,{value:[r],max:d||100,step:1,className:"flex-1 cursor-pointer",onValueChange:l}),e.jsx("span",{className:"text-sm",children:w})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{variant:"ghost",size:"icon",onClick:y,children:o?e.jsx(os,{className:"size-5"}):e.jsx(rs,{className:"size-5"})}),e.jsx(J,{value:[x],max:100,step:1,className:"w-20 cursor-pointer",onValueChange:h})]})]}),e.jsx("div",{className:"flex justify-center",children:e.jsxs(R,{className:"w-full sm:w-auto",onClick:()=>window.open(s.file_path,"_blank"),children:[e.jsx(q,{className:"mr-2 h-4 w-4"}),"Download Audio"]})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(X,{className:"text-muted-foreground h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"flex-shrink-0 text-sm font-medium",children:"Job ID:"}),e.jsx("code",{className:"bg-secondary/50 rounded px-1.5 py-0.5 text-sm",children:s.id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(as,{className:"text-muted-foreground h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"flex-shrink-0 text-sm font-medium",children:"User ID:"}),e.jsx("code",{className:"bg-secondary/50 rounded px-1.5 py-0.5 text-sm",children:s.user_id})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(es,{className:"text-muted-foreground h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"flex-shrink-0 text-sm font-medium",children:"Status:"}),e.jsx(De,{className:ce("flex min-w-[100px] items-center justify-center rounded-md px-4 py-1 text-xs",le[s.status]||le.default),children:s.status.charAt(0).toUpperCase()+s.status.slice(1)})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"text-muted-foreground h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"flex-shrink-0 text-sm font-medium",children:"Created:"}),e.jsx("span",{className:"text-sm",children:new Date(s.created_at).toLocaleString()})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(te,{className:"text-muted-foreground h-4 w-4 flex-shrink-0"}),e.jsx("span",{className:"flex-shrink-0 text-sm font-medium",children:"Updated:"}),e.jsx("span",{className:"text-sm",children:new Date(s.updated_at).toLocaleString()})]})]})]}),e.jsxs("div",{className:"mt-4 space-y-3",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"text-muted-foreground mt-1 h-4 w-4 flex-shrink-0"}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-1 flex-shrink-0 text-sm font-medium",children:"Category:"}),e.jsx("code",{className:"bg-secondary/50 rounded px-2 py-1 text-sm break-all",children:s.prompt_category_id||"N/A"})]})})]}),e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(X,{className:"text-muted-foreground mt-1 h-4 w-4 flex-shrink-0"}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"mr-1 flex-shrink-0 text-sm font-medium",children:"Subcategory:"}),e.jsx("code",{className:"bg-secondary/50 rounded px-2 py-1 text-sm break-all",children:s.prompt_subcategory_id||"N/A"})]})})]})]})]})]}),e.jsxs(Fe,{defaultValue:"transcription",className:"w-full",children:[e.jsxs(Ue,{className:"mb-4 grid grid-cols-2",children:[e.jsx(ne,{value:"transcription",children:"Transcription"}),e.jsx(ne,{value:"analysis",children:"Analysis"})]}),e.jsx(re,{value:"transcription",className:"mt-0",children:e.jsxs($,{className:"border-0 bg-transparent shadow-none",children:[e.jsx(F,{className:"pb-3",children:e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-primary/10 rounded-full p-2",children:e.jsx(ie,{className:"text-primary h-5 w-5"})}),"Transcription"]})}),e.jsxs(O,{children:[t?e.jsx("div",{className:"mb-4 rounded-lg bg-gray-100 p-4 shadow-md dark:bg-gray-800",children:e.jsx("pre",{className:"text-sm whitespace-pre-wrap",children:t})}):e.jsx("div",{className:"mb-4",children:e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg bg-gray-100 p-4 py-8 shadow-md dark:bg-gray-800",children:[e.jsx("p",{className:"text-muted-foreground mb-6 text-center",children:"Transcription data is not loaded. Click the button below to load the transcription."}),e.jsx(R,{onClick:()=>a(),className:"px-8",children:"Load Transcription"})]})}),s.transcription_file_path&&e.jsx("div",{className:"flex justify-center",children:e.jsxs(R,{onClick:()=>s.transcription_file_path&&window.open(s.transcription_file_path,"_blank"),variant:"outline",className:"w-full max-w-md rounded-lg font-semibold shadow-md",disabled:!s.transcription_file_path,children:[e.jsx(q,{className:"me-2 h-4 w-4"}),"Download Transcription TXT"]})})]})]})}),e.jsx(re,{value:"analysis",className:"mt-0",children:e.jsxs($,{children:[e.jsx(F,{className:"pb-3",children:e.jsxs(U,{className:"flex items-center gap-2",children:[e.jsx("span",{className:"bg-primary/10 rounded-full p-2",children:e.jsx(ie,{className:"text-primary h-5 w-5"})}),"Analysis Summary"]})}),e.jsx(O,{children:s.analysis_text?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4 rounded-lg bg-gray-100 p-4 shadow-md dark:bg-gray-800",children:s.analysis_text.split(`

`).map((N,v)=>{const p=N.split(`
`),c=p[0],u=p.slice(1);return e.jsxs("div",{className:"mt-4",children:[e.jsx("h4",{className:"text-md font-semibold",children:c}),e.jsx("ul",{className:"mt-2 list-inside list-disc text-sm text-gray-700 dark:text-gray-300",children:u.map((g,k)=>e.jsx("li",{children:g},k))})]},v)})}),e.jsxs(R,{onClick:()=>s.analysis_file_path&&window.open(s.analysis_file_path,"_blank"),variant:"outline",className:"mt-2 w-full rounded-lg font-semibold shadow-md",disabled:!s.analysis_file_path,children:[e.jsx(q,{className:"me-2 h-4 w-4"}),"Download Analysis PDF"]})]}):e.jsx("p",{className:"text-muted-foreground",children:"No analysis available for this recording."})})]})})]})]})})]})}function Ps(){return e.jsxs("div",{className:"relative container mx-auto px-4 py-6",children:[e.jsx("div",{className:"mb-6 flex items-center justify-between",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-9 w-9"}),e.jsxs("div",{children:[e.jsx(f,{className:"h-9 w-48"}),e.jsx(f,{className:"mt-1 h-4 w-32"})]})]})}),e.jsx("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-3",children:e.jsxs("div",{className:"space-y-6 lg:col-span-3",children:[e.jsxs("div",{className:"bg-card rounded-lg border p-6",children:[e.jsx("div",{className:"pb-3",children:e.jsx(f,{className:"h-8 w-32"})}),e.jsxs("div",{className:"bg-secondary/30 mb-4 rounded-lg p-4",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-4",children:[e.jsx(f,{className:"h-10 w-10 rounded-full"}),e.jsxs("div",{className:"flex flex-1 items-center gap-3",children:[e.jsx(f,{className:"h-4 w-12"}),e.jsx(f,{className:"h-2 flex-1"}),e.jsx(f,{className:"h-4 w-12"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-9 w-9"}),e.jsx(f,{className:"h-2 w-20"})]})]}),e.jsx("div",{className:"flex justify-center",children:e.jsx(f,{className:"h-9 w-40"})})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[e.jsx("div",{className:"space-y-3",children:[1,2,3].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsx(f,{className:"h-4 w-24"}),e.jsx(f,{className:"h-4 w-32"})]},s))}),e.jsx("div",{className:"space-y-3",children:[1,2].map(s=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsx(f,{className:"h-4 w-24"}),e.jsx(f,{className:"h-4 w-32"})]},s))})]}),e.jsx("div",{className:"mt-4 space-y-3",children:[1,2].map(s=>e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(f,{className:"h-4 w-4"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx(f,{className:"h-4 w-24"}),e.jsx(f,{className:"ml-1 h-6 w-32"})]})]},s))})]}),e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 flex gap-1",children:[e.jsx(f,{className:"h-10 w-32"}),e.jsx(f,{className:"h-10 w-32"})]}),e.jsxs("div",{className:"bg-card rounded-lg border p-6",children:[e.jsx("div",{className:"pb-3",children:e.jsx(f,{className:"h-8 w-32"})}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(f,{className:"h-32 w-full"}),e.jsx(f,{className:"mx-auto h-9 w-48"})]})]})]})]})})]})}const $s=function(){const{id:t}=Pe.useParams(),{data:a,isLoading:n,isError:i}=me(Te()),o=a==null?void 0:a.find(r=>r.id===t);return n?e.jsx(Ps,{}):!o||i?e.jsx("div",{className:"container mx-auto px-4 py-6",children:e.jsx("div",{className:"rounded border border-red-400 bg-red-100 px-4 py-3 text-red-700",children:e.jsx("p",{className:"mt-2",children:e.jsx(Y,{to:"/audio-recordings",className:"text-blue-500 underline",children:"Return to recordings list"})})})}):e.jsx(Cs,{recording:o})};export{$s as component};
