!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).RangePickerFooter=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=t(e);function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function o(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(e){return e&&e.name?e.name.split("_")[1]:""}return function(e,t){void 0===t&&(t={});var r=t.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],a=document.createElement("style");a.type="text/css","top"===r&&n.firstChild?n.insertBefore(a,n.firstChild):n.appendChild(a),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(document.createTextNode(e))}}(".rmdp-range-picker-footer{padding:10px;text-align:left}.rtl.rmdp-range-picker-footer{direction:rtl;text-align:right}.rmdp-range-picker-footer h6{font-size:16px;margin:0;white-space:nowrap}.left.rmdp-range-picker-footer h6,.right.rmdp-range-picker-footer h6{flex-direction:row;padding-top:5px;width:100%}.rmdp-cancel{background-color:#bdbcbc;border-radius:50%;color:#fff;cursor:pointer;display:inline-block;font-family:Arial!important;font-size:16px;height:17px;line-height:19px;margin:auto 7px auto 0;text-align:center;transform:rotate(45deg);width:17px}.rtl .rmdp-cancel{margin-left:7px;margin-right:unset}.rmdp-range-picker-footer span{font-size:16px;margin-top:auto}"),function(e){var t,n=e.state,o=e.handleChange,i=e.position,c=e.direction,d=void 0===c?["fa","ar"].includes(l(n.date.locale))?"rtl":"ltr":c,u=e.format,f=void 0===u?"rtl"===d?"DD MMMM":"MMMM DD":u,s=e.names,p=e.DatePicker,m=n.selectedDate,g=n.date.locale,y=n.multiple,b=n.range,h=["bottom","top"].includes(i),v={en:{selectedDates:"Selected Dates"+(h?":":""),from:"From:",to:"To:",selectDate:"Select Date",close:"Close",separator:"-"},fa:{selectedDates:"تاریخ انتخابی شما"+(h?":":""),from:"از:",to:"تا:",selectDate:"انتخاب کنید",close:"بستن",separator:"-"}},x=s||v[l(g)]||v.en;return r.default.createElement("div",{className:"rmdp-range-picker-footer ".concat(d," ").concat(i),style:{display:h?"block":"grid",gridTemplateRows:"auto 1fr"}},r.default.createElement("h6",{className:"rmdp-week-day"},x.selectedDates),r.default.createElement("div",{style:{position:"relative",display:"grid"}},y&&b?m.map((function(e,t){return r.default.createElement("div",{key:t},k(e))})):k(m),p&&(null===(t=m)||void 0===t?void 0:t.length)>0&&r.default.createElement("button",{className:"rmdp-button",style:{maxHeight:"30px",position:h?"absolute":"block",right:"0",top:"50%",transform:"translateY(-50%)"},onClick:function(){return p.closeCalendar()}},x.close)));function k(e){var t,n,a,o,l=null===(t=e[0])||void 0===t||null===(n=t.format)||void 0===n?void 0:n.call(t,f),i=null===(a=e[1])||void 0===a||null===(o=a.format)||void 0===o?void 0:o.call(a,f);return r.default.createElement("div",{className:"rmdp-header-values",style:{flex:"1",display:h?"":"grid",margin:"0"}},r.default.createElement("div",{style:{display:"inline-block"}},r.default.createElement("i",{className:"rmdp-cancel",onClick:function(){return D(e[0])}},"+"),r.default.createElement("span",null,x.from," ",null!=l?l:x.selectDate)),h&&r.default.createElement("span",{style:{padding:"0px 10px"}},x.separator),r.default.createElement("div",{style:{display:"inline-block"}},r.default.createElement("i",{className:"rmdp-cancel",onClick:function(){return D(e[1])}},"+"),r.default.createElement("span",null,x.to," ",null!=i?i:x.selectDate)))}function D(e){Array.isArray(m)&&(m=y&&b?m.map((function(t){return t.filter((function(t){return t!==e}))})).filter((function(e){return e.length>0})):m.filter((function(t){return t!==e})),o(m,a(a({},n),{},{selectedDate:m})))}}}));
