1import{j as e,u as h}from"./vendor-react-ff_kKGjF.js";import{c as N}from"./app--xwA6v7e.js";import{f as b}from"./brinka-CgXfR3Ka.js";import{u as v}from"./useListingActions-BZPuJ9IJ.js";import{ImagePlaceholderIcon as g,StatusBadge as m,ActionButton as l,StatsDisplay as _}from"./DashboardUI-DKXgM1-1.js";import{ListingLinks as D}from"./ListingLinks-C-qQLfaq.js";/* empty css */const A={default:{card:"border border-gray-200",stats:"bg-gray-50"},expiring:{card:"border-2 border-red-200 bg-red-50",stats:"bg-white"},topPerforming:{card:"border border-gray-200",stats:"bg-gray-50"},favourite:{card:"border border-gray-200",stats:"bg-gray-50"}};function E({item:s,variant:d="default",onAction:r,isTogglingAutoRenew:i=!1}){const{translations:a}=h().props,t=v(s),{isDraft:n,isExpired:f,isPublished:x,hasPendingRevision:p}=t,u=!!s.current_listing_package_id,o=u&&x,j=A[d];return e.jsxs("div",{className:N(j.card,"rounded-lg overflow-hidden hover:shadow-md transition flex flex-col"),children:[e.jsx("div",{className:"bg-gray-100 h-48 overflow-hidden flex items-center justify-center relative",children:s.image?e.jsx("img",{src:s.image,alt:s.title,className:"w-full h-full object-cover"}):e.jsx(g,{className:"w-12 h-12 text-gray-400"})}),e.jsxs("div",{className:"p-4 flex flex-col flex-1",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-1 text-sm sm:text-base",children:s.title}),s.location&&e.jsx("p",{className:"text-xs sm:text-sm text-gray-500 mb-1",children:s.location}),!n&&e.jsx(D,{listing:s,className:"flex items-center gap-2 mb-3",linkClassName:"text-xs text-blue-500 hover:underline"}),e.jsxs("div",{className:"mb-4 flex flex-col gap-2",children:[e.jsxs("div",{className:"flex gap-2 items-center flex-wrap",children:[p&&x?e.jsx("span",{className:"px-2 py-0.5 inline-flex text-xs font-medium rounded bg-blue-100 text-blue-700",children:a.DASHBOARD_STATUS_PUBLISHED_EDITS_IN_REVIEW}):e.jsx(m,{status:s.status}),s.package_names&&s.package_names.length>0&&s.package_names.map((c,y)=>e.jsxs("span",{title:c.expiring_soon?a.DASHBOARD_EXPIRING_SOON_BADGE:void 0,className:"px-2 py-0.5 inline-flex items-center gap-1 text-xs font-medium rounded-full bg-gray-100 text-gray-700",children:[c.expiring_soon&&e.jsx("svg",{className:"w-3 h-3 text-amber-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),c.name]},y)),s.brinka_interval&&e.jsxs("span",{className:"text-xs text-gray-500",children:["(",b(s.brinka_interval),")"]}),s.expiring_soon&&s.days_until_expiry!=null&&s.days_until_expiry>0&&e.jsx("span",{className:"px-2 py-1 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800",children:a.DASHBOARD_DAYS_LEFT.replace(":days",String(s.days_until_expiry))}),s.renewal_payment_failed&&e.jsxs("span",{className:"px-2 py-1 inline-flex items-center gap-1 text-xs leading-5 font-semibold rounded-full bg-red-100 text-red-800",children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})}),a.DASHBOARD_RENEWAL_PAYMENT_FAILED]})]}),!n&&e.jsxs("div",{className:"flex justify-between items-center text-xs",children:[e.jsx("span",{className:"text-gray-500",children:s.expires_at?a.DASHBOARD_EXPIRES.replace(":date",s.expires_at):a.DASHBOARD_EXPIRES_NA}),!f&&u&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{type:"button",onClick:()=>r("toggleAutoRenew",s),disabled:!o||i,className:`relative inline-flex h-4 w-7 items-center rounded-full transition-colors ${s.auto_renew?"bg-primary":"bg-gray-200"} ${!o||i?"opacity-50 cursor-not-allowed":"cursor-pointer"}`,title:o?s.auto_renew?a.DASHBOARD_DISABLE_AUTO_RENEW:a.DASHBOARD_ENABLE_AUTO_RENEW:void 0,children:e.jsx("span",{className:`inline-block h-2.5 w-2.5 transform rounded-full bg-white transition-transform ${s.auto_renew?"translate-x-3.5":"translate-x-1"}`})}),e.jsx("span",{className:"text-gray-500",children:a.AUTO_RENEW})]})]})]}),!n&&e.jsx(_,{clicks:s.clicks,views:s.views,formSubmissions:s.form_submissions,layout:"grid",className:"mb-4"}),e.jsx("div",{className:"flex gap-2 mt-auto flex-wrap items-stretch",children:t.showDelete?n?e.jsxs(e.Fragment,{children:[e.jsx(l,{variant:"primary",href:t.editUrl,fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_EDIT}),e.jsx(l,{variant:"danger",onClick:()=>r("deleteDraft",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_DELET
1E})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"flex-1 py-2 rounded-lg text-center text-xs font-medium bg-amber-100 text-amber-700 inline-flex items-center justify-center",children:a.PENDING}),e.jsx(l,{variant:"danger",onClick:()=>r("delete",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_DELETE})]}):e.jsxs(e.Fragment,{children:[t.showRenew&&e.jsx(l,{variant:"success",onClick:()=>r("renew",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_RENEW}),t.showRetryPayment&&e.jsx(l,{variant:"danger",onClick:()=>r("retryPayment",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_RETRY_PAYMENT}),t.showReactivate&&!t.showRetryPayment&&e.jsx(l,{variant:"success",onClick:()=>r("reactivate",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_REACTIVATE}),t.showBoost&&e.jsx(l,{variant:"boost",onClick:()=>r("boost",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_BOOST}),t.showEdit&&(t.editDisabled?e.jsx("span",{className:"flex-1 py-2 rounded-lg text-center text-xs font-medium bg-gray-100 text-gray-400 inline-flex items-center justify-center cursor-not-allowed",children:a.DASHBOARD_CANNOT_EDIT_IN_REVIEW}):e.jsx(l,{variant:"primary",href:t.editUrl,fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_EDIT})),t.showDeactivate&&e.jsx(l,{variant:"danger",onClick:()=>r("deactivate",s),fullWidth:!0,className:"py-2 rounded-lg",children:a.DASHBOARD_DEACTIVATE})]})})]})]})}function w({item:s,onAction:d}){const{translations:r}=h().props,i=s.status==="Published";return e.jsxs("div",{className:"border border-gray-200 rounded-lg overflow-hidden hover:shadow-md transition flex flex-col",children:[e.jsxs("div",{className:"bg-gray-100 h-48 overflow-hidden flex items-center justify-center relative",children:[s.image?e.jsx("img",{src:s.image,alt:s.title,className:"w-full h-full object-cover"}):e.jsx(g,{className:"w-12 h-12 text-gray-400"}),e.jsx("div",{className:"absolute top-2 right-2",children:e.jsx(m,{status:i?"Available":"Expired"})})]}),e.jsxs("div",{className:"p-4 flex flex-col flex-1",children:[e.jsx("h3",{className:"font-bold text-gray-900 mb-1 text-sm sm:text-base",children:s.title}),s.location&&e.jsx("p",{className:"text-xs sm:text-sm text-gray-500 mb-2",children:s.location}),s.seller&&e.jsxs("p",{className:"text-xs text-gray-600 mb-3",children:[e.jsxs("span",{className:"font-medium",children:[r.SELLER,":"]})," ",s.seller]}),s.price&&e.jsx("p",{className:"text-lg font-bold text-gray-900 mb-4",children:s.price}),e.jsxs("div",{className:"flex gap-2 mt-auto",children:[i?e.jsx(l,{variant:"primary",href:s.url,fullWidth:!0,className:"py-2 rounded-lg",children:r.DASHBOARD_VIEW_LISTING}):e.jsx("span",{className:"flex-1 text-center px-3 py-2 bg-gray-300 text-gray-600 rounded-lg text-sm font-medium cursor-not-allowed",children:r.DASHBOARD_NO_LONGER_AVAILABLE}),e.jsx(l,{variant:"danger",onClick:()=>d("remove",s),fullWidth:!0,className:"py-2 rounded-lg",children:r.DASHBOARD_REMOVE})]})]})]})}function R(s){return s.variant==="favourite"||s.item.type==="favourite"?e.jsx(w,{...s}):e.jsx(E,{...s})}function T({items:s,variant:d="default",onAction:r,togglingAutoRenewId:i,emptyMessage:a,emptyIcon:t="list"}){return s.length===0?e.jsxs("div",{className:"col-span-full text-center py-12",children:[t==="heart"?e.jsx("svg",{className:"w-16 h-16 mx-auto mb-3 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})}):e.jsx("svg",{className:"w-16 h-16 mx-auto mb-3 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"})}),e.jsx("p",{className:"text-gray-500",children:a||"No items found."})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 p-4 sm:p-6",children:s.map(n=>e.jsx(R,{item:n,variant:d,onAction:r,isTogglingAutoRenew:i===n.id},`${n.type}-${n.id}`))})}
1export{R as DashboardCard,T as DashboardCardGrid};
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.