import{a as x}from"./chunk-IEEEMRE5.mjs";import{useState as O}from"react";import{SwipeableDrawer as U}from"@baseapp-frontend/design-system/components/web/drawers";import{DATE_FORMAT as S,formatDate as K}from"@baseapp-frontend/utils";import{KeyboardArrowDown as Q}from"@mui/icons-material";import{Box as j,Chip as W,Divider as $,Menu as q,Typography as z,useMediaQuery as G}from"@mui/material";import{DateTime as J}from"luxon";import{jsx as o,Fragment as M,jsxs as v}from"react/jsx-runtime";function T(e,t){return H(e)||B(e,t)||P(e,t)||L()}function L(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function P(e,t){if(e){if(typeof e=="string")return _(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_(e,t):void 0}}function _(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,l=Array(t);r<t;r++)l[r]=e[r];return l}function B(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var l,p,u,f,i=[],c=!0,s=!1;try{if(u=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;c=!1}else for(;!(c=(l=u.call(r)).done)&&(i.push(l.value),i.length!==t);c=!0);}catch(h){s=!0,p=h}finally{try{if(!c&&r.return!=null&&(f=r.return(),Object(f)!==f))return}finally{if(s)throw p}}return i}}function H(e){if(Array.isArray(e))return e}var N=function(t){var r=t.fetchParameters,l=t.executeRefetch,p=O(!1),u=T(p,2),f=u[0],i=u[1],c=O(null),s=T(c,2),h=s[0],y=s[1],b=G(function(a){return a.breakpoints.down("sm")}),R=function(){return i(!0)},D=function(){return i(!1)},C=function(){return y(null)},m=r.createdFrom,d=r.createdTo,I=m||d,g=function(n){return n?J.fromFormat(n,S.api):null},A=function(n){return n?K(n,{toFormat:S[3]}):null},k=function(){var n=A(m),w=A(d);return m&&d?"".concat(n," - ").concat(w):m?"From ".concat(n):d?"Until ".concat(w):"Period"},E=function(n){b?R():y(n.currentTarget)},F=function(n){return v(M,{children:[o(z,{variant:"subtitle1",m:4,align:"center",children:"Period"}),o($,{sx:{marginBottom:2}}),o(x,{createdFrom:g(m),createdTo:g(d),executeRefetch:l,onApply:n,onClearFilter:n})]})};return v(M,{children:[o(W,{label:v(j,{sx:{display:"flex",alignItems:"center",gap:1},children:[o("span",{children:k()}),o(Q,{color:"action"})]}),onClick:E,variant:I?"filled":"soft",color:"default"}),b?o(U,{globalHeight:"auto",open:f,onClose:D,children:F(D)}):o(q,{anchorEl:h,open:!!h,onClose:C,children:o(j,{padding:2,children:F(C)})})]})},ae=N;export{ae as a};
//# sourceMappingURL=chunk-IBNPAVWK.mjs.map