PageSourceSearch

https://platform.cequens.com/assets/VoiceRecordsPage-CDkC2u9q.js

js cequens.com collected 2026-10-02 05:34:58 UTC 4,945 bytes, 1 lines download raw bytes

1import{y as g,l as R,r as l,j as o}from"./vendor-react-BXs1OprT.js";import{u as j,f as h,b,a as y}from"./index-BH8T5dXT.js";import{dt as v,T as w,W as N,B as E,ao as C}from"./index-CuGE_ghf.js";import{P as D}from"./page-heading-e7cQaNMg.js";import{E as k,a as M,b as L,c as T,d as F}from"./empty-p3Xem3rE.js";import{D as S,b as H,c as V,d as P,e as x,f as p}from"./data-table-jYX60-rP.js";import{b as U}from"./vendor-lib-D0CMuov3.js";import{bW as z,a4 as $,bw as A,bg as B,t as O}from"./vendor-ui-BRcYFyVA.js";import"./checkbox-BAyn9gxM.js";import"./table-Dy5io_wv.js";import"./filter-select-DIfa6Z29.js";function W(e){const a=e.startsWith("/")?e.substring(1):e,r=v();return r?`${r.replace(/\/$/,"")}/${a}`:a}function G(){const e={},a=w.getIdToken();return a&&(e["x-user-auth"]=`Bearer ${a}`),e}async function I(e){const a=W("audio-files"),r=await U.get(a,{headers:G(),signal:e});return r.data?.data??r.data}function K(){return g({queryKey:[N.VOICE_RECORDS],queryFn:({signal:e})=>I(e)})}function _(e){if(!Number.isFinite(e)||e<0)return"—";const a=Math.floor(e/60),r=Math.round(e%60);return`${a}:${String(r).padStart(2,"0")}`}function q({url:e}){const[a,r]=l.useState(null),c=l.useRef(null);return l.useEffect(()=>{const t=new Audio;t.preload="metadata",c.current=t;const n=()=>r(t.duration),d=()=>r(Number.NaN);return t.addEventListener("loadedmetadata",n),t.addEventListener("error",d),t.src=e,()=>{t.removeEventListener("loadedmetadata",n),t.removeEventListener("error",d),t.src="",c.current=null}},[e]),a===null?o.jsx("span",{className:"text-xs text-muted-foreground",children:"…"}):o.jsxs("span",{className:"inline-flex items-center gap-1 text-xs tabular-nums text-muted-foreground",children:[o.jsx(B,{className:"size-3"}),_(a)]})}async function Q(e,a){try{const r=await fetch(e.url);if(!r.ok)throw new Error("Download failed");const c=await r.blob(),t=URL.createObjectURL(c),n=document.createElement("a");n.href=t,n.download=e.key,document.body.appendChild(n),n.click(),n.remove(),URL.revokeObjectURL(t)}catch{O.error(a)}}function ie(){const{t:e}=R(),{data:a,isLoading:r}=K(),[c,t]=l.useState(""),n=l.useMemo(()=>a??[],[a]),d=l.useMemo(()=>[{id:"filename",accessorKey:"key",header:e("voiceRecords.filename"),meta:{displayName:e("voiceRecords.filename")},cell:({row:s})=>o.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[o.jsx("div",{className:"bg-primary/10 flex size-8 flex-shrink-0 items-center justify-center rounded-md",children:o.jsx(z,{className:"size-4 text-primary"})}),o.jsx("span",{className:"truncate text-sm font-medium",children:s.original.key})]})},{id:"player",header:e("voiceRecords.player"),meta:{displayName:e("voiceRecords.player")},cell:({row:s})=>o.jsx("audio",{controls:!0,preload:"none",className:"h-10 w-full max-w-[320px]",children:o.jsx("source",{src:s.original.url})})},{id:"duration",header:e("voiceRecords.duration","Duration"),meta:{displayName:e("voiceRecords.duration","Duration")},cell:({row:s})=>o.jsx(q,{url:s.original.url})},{id:"download",header:()=>o.jsx("div",{className:"text-end",children:e("voiceRecords.download")}),meta:{displayName:e("voiceRecords.download")},cell:({row:s})=>o.jsx("div",{className:"flex justify-end",children:o.jsxs(E,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>Q(s.original,e("voiceRecords.downloadError")),children:[o.jsx($,{className:"size-4"}),e("voiceRecords.download")]})})}],[e]),u=j({data:n,columns:d,state:{globalFilter:c},onGlobalFilterChange:t,getCoreRowModel:y(),getFilteredRowModel:b(),globalFilterFn:(s,i,f)=>{const m=f.trim().toLowerCase();return m?(s.original.key??"").toLowerCase().includes(m):!0}});return o.jsx(C,{children:o.jsxs("div",{className:"space-y-6",children:[o.jsx(D,{title:e("voiceRecords.title"),description:e("voiceRecords.description"),isLoading:r}),!r&&n.length===0?o.jsx(k,{children:o.jsxs(M,{children:[o.jsx(L,{variant:"icon",children:o.jsx(A,{className:"size-5"})}),o.jsx(T,{children:e("voiceRecords.noRecords")}),o.jsx(F,{children:e("voiceRecords.noRecordsHint")})]})}):o.jsxs(S,{isLoading:r,showControls:!1,searchConfig:{placeholder:e("voiceRecords.searchPlaceholder","Search recordings..."),searchColumns:[],table:u},footerLabel:e("voiceRecords.showingCount",{count:u.getRowModel().rows.length,defaultValue:"Showing {{count}} recordings"}),children:[o.jsx(H,{children:u.getHeaderGroups().map(s=>s.headers.map(i=>o.jsx(V,{children:i.isPlaceholder?null:h(i.column.columnDef.header,i.getContext())},i.id)))}),o.jsx(P,{children:u.getRowModel().rows.length===0?o.jsx(x,{children:o.jsx(p,{colSpan:d.length,children:o.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:e("voiceRecords.emptySearch","No recordings match your search.")})})}):u.getRowModel().rows.map(s=>o.jsx(x,{className:"hover:bg-muted/30 group",children:s.getVisibleCells().map(i=>o.jsx(p,{columnId:i.column.id,children:h(i.column.columnDef.cell,i.getContext())},i.id))},s.id))})]})]})})}export{ie 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.