"use client"
import{c as p}from"./chunk-IGMFMKPE.mjs";import{b as P}from"./chunk-KGQWA5H2.mjs";import{i as g}from"./chunk-QSMIB34W.mjs";import{Command as n}from"cmdk";import{Lock as x}from"lucide-react";import{jsx as s,jsxs as R}from"react/jsx-runtime";var w=({presets:o,onSelect:l,currentValue:i})=>{let y=e=>"dateRange"in e,h=e=>"date"in e,r=(e,t)=>e.getDate()===t.getDate()&&e.getMonth()===t.getMonth()&&e.getFullYear()===t.getFullYear(),D=(e,t)=>{let a=e.from,m=t.from,u=!1;a&&m&&r(a,m)&&(u=!0);let c=e.to,d=t.to,f=!1;return c&&d&&r(c,d)&&(f=!0),u&&f},b=e=>{if(y(e)){let t=i;return t&&D(t,e.dateRange)}else if(h(e)){let t=i;return t&&r(t,e.date)}return!1};return console.log(o),o.some(e=>e.shortcut)&&(console.log(o.filter(e=>e.shortcut).map(e=>e.shortcut)),p(o.filter(e=>e.shortcut).map(e=>e.shortcut),e=>{console.log("shortcut",e.key);let t=o.find(a=>a.shortcut===e.key);t&&l(t)},{enabled:!0})),s(n,{className:"w-full rounded ring-gray-200 ring-offset-2 focus:outline-none",tabIndex:0,autoFocus:!0,loop:!0,children:s(n.List,{className:"[&>*]:flex [&>*]:w-full [&>*]:items-start [&>*]:gap-x-2 [&>*]:gap-y-0.5 [&>*]:sm:flex-col",children:o.map((e,t)=>R(n.Item,{disabled:e.requiresUpgrade,onSelect:()=>l(e),title:e.label,value:e.id,className:g("relative flex cursor-pointer items-center justify-between overflow-hidden text-ellipsis whitespace-nowrap rounded border border-gray-200","px-2.5 py-1.5 text-left text-sm text-gray-700 shadow-sm outline-none sm:w-full sm:border-none sm:py-2 sm:shadow-none","disabled:pointer-events-none disabled:opacity-50","sm:data-[selected=true]:bg-gray-100",b(e)&&"font-semibold text-gray-800"),children:[s("span",{children:e.label}),e.requiresUpgrade&&s(x,{className:"h-3.5 w-3.5","aria-hidden":"true"}),e.requiresUpgrade&&e.tooltipContent&&s(P,{side:"bottom",content:e.tooltipContent,children:s("div",{className:"absolute inset-0 cursor-not-allowed"})})]},t))})})};w.displayName="DatePicker.Presets";export{w as a};
