1import{r as s,u as Q,j as r,B as X}from"./index-DN4Mwqf7.js";import{by as Z,aJ as $,ag as ee,f as te}from"./Parameter-DD2b9kxf.js";import{u as ne}from"./index-CeTPcGzX.js";function ae(c){const h=(e,n)=>({startDate:e,endDate:n}),i=new Date,v=new Date(i.getTime()-6048e5),{open:m=!1,content:se="Open Date Picker",icon:P="calendar alternate",onChange:b=h,onOpen:T=()=>{},styles:x,style:V,future:B=!0,originDate:k,warningMessage:w,highAlert:J=!1,hasNoData:U=!1}=c;let o={startDate:c.begin||v,endDate:c.end||i,key:"selection"};o.endDate>i&&(o.endDate=i);const[u,N]=s.useState([o]),[re,z]=s.useState(),[d,p]=s.useState(!1),[y,R]=s.useState(0),[O,C]=s.useState(!1),A=s.useRef(null),l=s.useRef(null);s.useRef(null);const{username:D}=Q(),{userActivity:E,setUserActivity:Y}=Z(),{width:q}=ne();s.useEffect(()=>{T(d)},[d]),s.useEffect(()=>{e();function e(){if(E){const{username:n,np_SelectedDate:t}=E;if(n===D&&t&&t.startDate){const a={startDate:new Date(t.startDate),endDate:new Date(t.endDate)};S(a==null?void 0:a.startDate,a==null?void 0:a.endDate)}else S(o==null?void 0:o.startDate,o==null?void 0:o.endDate)}}},[D]);const H=e=>{e.target===A.current&&(N([{startDate:o.startDate,endDate:o.endDate,key:"selection"}]),b([o.startDate,o.endDate]),p(!1))},S=(e,n)=>{const t="".concat(e.getMonth()+1,"/").concat(e.getDate(),"/").concat(e.getFullYear()),a="".concat(n.getMonth()+1,"/").concat(n.getDate(),"/").concat(n.getFullYear());z({startDate:t,endDate:a})};function _(e){return e?te(e,"MM/dd/yyyy"):"--/--/----"}function F(e){return typeof e=="object"&&Object.keys(e).length}const K=e=>{if(F(e))for(let n in e){let t=e[n];if(F(t)&&"startDate"in t&&"endDate"in t){S(t.startDate,t.endDate),R(y+1),N([t]),D&&Y({...E,username:D,np_SelectedDate:t});break}}};s.useEffect(()=>{},[u]),s.useEffect(()=>{(y>=2||O===!0)&&(p(!1),b([u[0].startDate,u[0].endDate]),R(0),C(!1))},[y,O]);const W=e=>{(e.className==="rdrStaticRangeLabel"||e.className==="rdrStaticRange")&&C(!0)};return s.useEffect(()=>{var e;(e=l==null?void 0:l.current)==null||e.addEventListener("click",n=>{W(n.target)})},[l==null?void 0:l.current]),s.useEffect(()=>{if(!d||!(l!=null&&l.current))return;const e=l.current.querySelectorAll(".rdrInputRangeInput"),n=[];return e.forEach(t=>{let a=null;const f=g=>{a=g.target.value,g.stopImmediatePropagation()},L=g=>{var j;if(a!==null){const I=g.target,M=(j=Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value"))==null?void 0:j.set;M==null||M.call(I,a);const G=new Event("input",{bubbles:!0});I.dispatchEvent(G),a=null}};t.addEventListener("input",f,{capture:!0}),t.addEventListener("blur",L),n.push({input:t,handleInput:f,handleBlur:L})}),()=>{n.forEach(({input:t,handleInput:a,handleBlur:f})=>{t.removeEventListener("input",a,{capture:!0}),t.removeEventListener("blur",f)})}},[d]),r.jsxs("div",{className:"DateRangeSelector",ref:l,children:[r.jsx(X,{icon:P,content:"".concat(_(o.startDate)," - ").concat(_(o.endDate)),onClick:()=>p(!d),style:x?{background:"none",color:x.textColor}:{background:"none",...V}}),(()=>{var e;if(U){const n=w||"NOTE: No information found for this date range. Please adjust your timeframe or contact your client services manager to research";return r.jsx("div",{className:"date-warning high-alert",children:r.jsx("h5",{children:n})})}try{const n=((e=u==null?void 0:u[0])==null?void 0:e.endDate)||o.endDate;if(k&&n&&n<k){const t=w||"NOTE: The date selected preceeds your origin date",a=J?"date-warning high-alert":"date-warning";return r.jsx("div",{className:a,children:r.jsx("h5",{children:t})})}}catch{}return null})(),m||d?r.jsx("div",{className:"DateRangeSelector-background",ref:A,onClick:H,children:r.jsx("div",{className:"DateRangeSelector-content",children:r.jsx($.DateRangePicker,{onChange:K,moveRangeOnFirstSelection:!1,months:q<800?1:2,ranges:u,direction:"horizontal",maxDate:B?void 0:ee(new Date,1)})})}):null]})}function ie(){const[c,h]=s.useState({startDate:"",endDate:""}),i=(v,m)=>{h({startDate:v,endDate:m})};return r.jsxs("div",{children:[r.jsx("br",{}),r.jsxs("div",{children:["Start Date: ",JSON.stringify(c==null?void 0:c.startDate),r.jsx("br",{}),"End Date: ",JSON.stringify(c==null?void 0:c.endDate)]}),r.jsx("br",{}
1),r.jsx(ae,{onChange:i,initialValue:{startDate:c.startDate,endDate:c.endDate}})]})}export{ie as default};
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.