import{o as e}from"./rolldown-runtime-iuO8RvI4.js";import{Dr as s,cu as t}from"./shared-0-C4kdVF7Y.js";import{Mi as n,ki as a}from"./vendor-frame-CwiylG4Y.js";import{Hg as i,Rh as l,bp as r,zg as d}from"./shared-1-3-6x7RKF.js";import{nn as o,rn as x}from"./vendor-all-2-BJdkbLSj.js";import{_i as c,di as u,li as m,si as p,ui as j}from"./shared-3-D-Ux4aGn.js";import{ur as h}from"./index-C9LAU4f-.js";var f=e(n()),g=a();function N({isScheduledDuringPeakHours:e,peakHoursWindowPst:s,variant:n}){return x(),t(),null}function b(e){return!e.enabled&&!!e.fireAt&&!!e.lastRunAt}new Intl.DateTimeFormat("en-US",{timeZone:"America/Los_Angeles",hour:"numeric",hourCycle:"h23"});var v="group relative flex h-28 flex-col justify-between p-3 rounded-lg bg-bg-100 ring-1 ring-inset ring-border-300 hover:bg-bg-200 outline-none focus-visible:shadow-focus transition-colors text-left text-sm no-underline cursor-pointer",w="inline-flex items-center gap-1 h-[18px] max-w-[8rem] px-1.5 rounded bg-bg-300 text-xs text-text-300 shrink-0 truncate";(0,f.memo)(({scheduledTask:e,detailRoutePrefix:t,displayName:n,contextLabel:a,scheduleTextFallback:k,triggerCount:A=0,sourceBadge:M,statusOverride:H,onClick:R})=>{const S=x(),P="string"==typeof a?[a]:a,y=(0,f.useMemo)(()=>u(e.cronExpression,Math.round((e.jitterSeconds??0)/60),S,e.fireAt),[e.cronExpression,e.jitterSeconds,e.fireAt,S]),C=e.enabled?e.fireAt&&!e.lastRunAt?j(new Date(e.fireAt),S,"future"):m(p(e.cronExpression),e.nextRunAt,Math.round((e.jitterSeconds??0)/60),S):null,D=!C&&e.enabled&&e.lastRunAt?j(new Date(e.lastRunAt),S,"past"):null,F=H??(e.enabled?null:b(e)?"completed":"paused"),z=(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,g.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,g.jsx)("span",{className:"font-medium text-text-100 truncate",children:n??c(e.id)}),(0,g.jsx)(N,{variant:"icon",isScheduledDuringPeakHours:e.isScheduledDuringPeakHours,peakHoursWindowPst:e.peakHoursWindowPst}),P&&P.length>0&&(0,g.jsx)("span",{className:`${w} ml-auto`,title:P.join("\n"),children:P.length>1?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)("span",{className:"truncate",children:P[0].split("/").pop()}),(0,g.jsx)("span",{className:"shrink-0 text-text-500",children:(0,g.jsx)(o,{defaultMessage:"+{n}",id:"gxFSojQzTJ",values:{n:P.length-1}})})]}):P[0].split("/").pop()}),"local"===M&&(0,g.jsxs)("span",{className:w,children:[(0,g.jsx)(d,{size:12}),(0,g.jsx)(o,{defaultMessage:"Local",id:"W4SaxYXWRk"})]}),"remote"===M&&(0,g.jsxs)("span",{className:w,children:[(0,g.jsx)(i,{size:12}),(0,g.jsx)(o,{defaultMessage:"Cloud",id:"fiPvwYljok"})]})]}),(0,g.jsxs)("div",{className:"text-text-400 font-small",children:[y||k||"\xa0",A>1&&(0,g.jsx)("span",{className:"ml-1.5 text-text-500",children:(0,g.jsx)(o,{defaultMessage:"+{n} more",id:"Fo49VHwJiZ",values:{n:A-1}})})]})]}),(0,g.jsxs)("div",{className:"flex items-center justify-between text-text-400 font-small",children:[(0,g.jsx)("span",{children:C?e.fireAt?(0,g.jsx)(o,{defaultMessage:"Runs at: {when}",id:"Ncpy/sig/G",values:{when:(0,g.jsx)("span",{className:"text-text-200",children:C})}}):(0,g.jsx)(o,{defaultMessage:"Next run: {when}",id:"tXnyVYHFxs",values:{when:(0,g.jsx)("span",{className:"text-text-200",children:C})}}):D?(0,g.jsx)(o,{defaultMessage:"Last run: {when}",id:"4AXNTH5eDF",values:{when:(0,g.jsx)("span",{className:"text-text-200",children:D})}}):"\xa0"}),"paused"===F&&(0,g.jsxs)("span",{className:"inline-flex items-center gap-1 text-text-300",children:[(0,g.jsx)(h,{size:12}),(0,g.jsx)(o,{defaultMessage:"Paused",id:"C2iTEHtK//"})]}),"completed"===F&&(0,g.jsxs)("span",{className:"inline-flex items-center gap-1 text-text-300",children:[(0,g.jsx)(s,{size:12}),(0,g.jsx)(o,{defaultMessage:"Ran",id:"+CuLVSpi4n"})]}),"auto-disabled"===F&&(0,g.jsxs)("span",{className:"inline-flex items-center gap-1 text-danger-000",children:[(0,g.jsx)(l,{size:12}),(0,g.jsx)(o,{defaultMessage:"Auto-disabled",id:"oKQHGunEG3"})]})]})]});return R?(0,g.jsx)("button",{type:"button",onClick:R,className:v,children:z}):(0,g.jsx)(r,{href:t?`${t}/${encodeURIComponent(e.id)}`:"#",className:v,children:z})});export{N as n,b as t};