import{I as C}from"./IdnodeGrid-U6EqXqja.js";import{A as E}from"./ActionMenu-B3aKIJFu.js";import{j as i,d as S,u as x,a as D,e as A,f as s,g as f,h as o,I as P,F as T,k as I,o as z,i as L,t as M,s as V,_ as B}from"./index-D92x6h1h.js";import{u as a}from"./useBulkAction-UV8yZtrd.js";import{u as U,d as G}from"./dvrEntryColumns-BRmCkPKX.js";import{P as N}from"./PlayCell-Bqj044wg.js";import{f as $}from"./predicates-CyAX7uX3.js";import{a as H}from"./dvrFieldDefs-BDfuZvpU.js";import"./DataGrid-CbtTsx8d.js";import"./index-BG9mM10J.js";import"./index-7HNOjfAo.js";import"./localDay-CoEbUe3O.js";import"./SearchInput-DBHWpJgW.js";import"./useGridLayout-DCIiMD42.js";import"./CollapsibleSection.vue_vue_type_style_index_0_lang-Cq2AVc9p.js";import"./sliders-horizontal-Am8f4Xsv.js";import"./useStaleDataRecovery-BuNK-94T.js";import"./useEditorMode-DvyB-mon.js";import"./play-DDT_Ndp2.js";import"./BooleanCell-BFiLlZVv.js";/* empty css                                                                      */import"./EnumNameCell-BjJ4chu_.js";function j(e){const t=!$(e.selection);return[{id:"edit",label:i("Edit"),tooltip:i("Edit the selected entry"),disabled:e.selection.length===0,onClick:()=>e.onEdit(e.selection)},{id:"remove",label:e.removing?i("Removing…"):i("Remove"),tooltip:i("Remove the selected recording from storage"),disabled:e.selection.length===0||e.removing||t,onClick:()=>e.onRemove(e.selection,e.clearSelection)},{id:"download",label:i("Download"),tooltip:i("Download the selected recording"),disabled:e.selection.length!==1||t,onClick:()=>e.onDownload(e.selection)},{id:"rerecord",label:e.rerecording?i("Toggling…"):i("Re-record"),tooltip:i("Toggle re-record functionality"),disabled:e.selection.length===0||e.rerecording||t,onClick:()=>e.onRerecord(e.selection,e.clearSelection)},{id:"move",label:e.moving?i("Moving…"):i("Move to failed"),tooltip:i("Mark the selected recording as failed"),disabled:e.selection.length===0||e.moving||t,onClick:()=>e.onMoveToFailed(e.selection,e.clearSelection)}]}const O={class:"finished__empty"},q=S({__name:"FinishedView",setup(e){const{t}=x(),g=D(),d=I(()=>g.data?.admin?"disp_title,disp_extratext,episode_disp,playcount,retention,removal,owner,comment":"retention,removal,comment"),{kodiFmt:v,editingUuid:h,editingUuids:_,gridRef:y,editorLevel:b,openEditor:c,closeEditor:k}=U({editList:d,urlSync:!0}),w=[{field:"_play",label:t("Play"),hideHeaderLabel:!0,width:40,sortable:!1,cellComponent:N,playPath:"dvrfile",playTitle:r=>{const n=String(r.disp_title??""),l=String(r.episode_disp??"");return l?`${n} / ${l}`:n},playEnabled:r=>typeof r.filesize=="number"&&r.filesize>0},...G(v,{filesize:!0,playcount:!0,filename:!0,phoneFields:["filesize","duration"]})],m=a({endpoint:"dvr/entry/remove",confirmText:t("Do you really want to remove the selected recordings from storage?"),confirmSeverity:"danger",failPrefix:t("Failed to remove")}),p=a({endpoint:"dvr/entry/rerecord/toggle",failPrefix:t("Failed to toggle re-record")}),u=a({endpoint:"dvr/entry/move/failed",failPrefix:t("Failed to move to failed")});function F(r){if(r.length===0)return;const n=r[0].uuid;typeof n!="string"||!n||globalThis.open(V(`dvrfile/${n}`),"_blank")}return(r,n)=>(z(),A(T,null,[s(C,{ref_key:"gridRef",ref:y,endpoint:"dvr/entry/grid_finished","help-page":"class/dvrentry",columns:w,"store-key":"dvr-finished","default-sort":{key:"start_real",dir:"ASC"},"virtual-scroller-options":{itemSize:36,lazy:!1},"count-label":"recordings","groupable-fields":o(H),class:"finished__grid",onRowDblclick:n[0]||(n[0]=l=>o(c)([l]))},{empty:f(()=>[L("p",O,M(o(t)("No finished recordings.")),1)]),toolbarActions:f(({selection:l,clearSelection:R})=>[s(E,{actions:o(j)({selection:l,clearSelection:R,removing:o(m).inflight.value,rerecording:o(p).inflight.value,moving:o(u).inflight.value,onEdit:o(c),onRemove:o(m).run,onDownload:F,onRerecord:o(p).run,onMoveToFailed:o(u).run})},null,8,["actions"])]),_:1},8,["groupable-fields"]),s(P,{uuid:o(h),uuids:o(_),level:o(b),list:d.value,title:o(t)("Edit Recording"),onClose:o(k)},null,8,["uuid","uuids","level","list","title","onClose"])],64))}}),ge=B(q,[["__scopeId","data-v-de999b6b"]]);export{ge as default};
