"use strict";
/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
(self["webpackChunktimetics"] = self["webpackChunktimetics"] || []).push([["assets_src_admin_pages_bookings_FormField_js"],{

/***/ "./assets/src/admin/pages/bookings/FormField.js":
/*!******************************************************!*\
  !*** ./assets/src/admin/pages/bookings/FormField.js ***!
  \******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _common_TextInput__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../common/TextInput */ \"./assets/src/common/TextInput.js\");\n/* harmony import */ var _common_SelectInput__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../../common/SelectInput */ \"./assets/src/common/SelectInput.js\");\n/* harmony import */ var _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../admin/actionCreators/actions */ \"./assets/src/admin/actionCreators/actions.js\");\n/* harmony import */ var _frontend_utils_helper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../frontend/utils/helper */ \"./assets/src/frontend/utils/helper.js\");\n/* harmony import */ var _admin_context_provider__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../admin/context/provider */ \"./assets/src/admin/context/provider.js\");\n/* harmony import */ var _services_meetings__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../services/meetings */ \"./assets/src/admin/services/meetings.js\");\n/* harmony import */ var _hooks_useBooking__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./hooks/useBooking */ \"./assets/src/admin/pages/bookings/hooks/useBooking.js\");\n/* harmony import */ var _common_icons_Icons__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../../common/icons/Icons */ \"./assets/src/common/icons/Icons.js\");\n/* harmony import */ var _helper_helpers__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../../helper/helpers */ \"./assets/src/helper/helpers.js\");\n/* harmony import */ var react_router_dom__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react-router-dom */ \"./node_modules/react-router-dom/dist/index.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it[\"return\"] != null) it[\"return\"](); } finally { if (didErr) throw err; } } }; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = \"function\" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || \"@@iterator\", asyncIteratorSymbol = $Symbol.asyncIterator || \"@@asyncIterator\", toStringTagSymbol = $Symbol.toStringTag || \"@@toStringTag\"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, \"\"); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, \"_invoke\", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: \"normal\", arg: fn.call(obj, arg) }; } catch (err) { return { type: \"throw\", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { [\"next\", \"throw\", \"return\"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if (\"throw\" !== record.type) { var result = record.arg, value = result.value; return value && \"object\" == _typeof(value) && hasOwn.call(value, \"__await\") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke(\"next\", value, resolve, reject); }, function (err) { invoke(\"throw\", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke(\"throw\", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, \"_invoke\", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = \"suspendedStart\"; return function (method, arg) { if (\"executing\" === state) throw new Error(\"Generator is already running\"); if (\"completed\" === state) { if (\"throw\" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if (\"next\" === context.method) context.sent = context._sent = context.arg;else if (\"throw\" === context.method) { if (\"suspendedStart\" === state) throw state = \"completed\", context.arg; context.dispatchException(context.arg); } else \"return\" === context.method && context.abrupt(\"return\", context.arg); state = \"executing\"; var record = tryCatch(innerFn, self, context); if (\"normal\" === record.type) { if (state = context.done ? \"completed\" : \"suspendedYield\", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } \"throw\" === record.type && (state = \"completed\", context.method = \"throw\", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, \"throw\" === context.method) { if (delegate.iterator[\"return\"] && (context.method = \"return\", context.arg = undefined, maybeInvokeDelegate(delegate, context), \"throw\" === context.method)) return ContinueSentinel; context.method = \"throw\", context.arg = new TypeError(\"The iterator does not provide a 'throw' method\"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if (\"throw\" === record.type) return context.method = \"throw\", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, \"return\" !== context.method && (context.method = \"next\", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = \"throw\", context.arg = new TypeError(\"iterator result is not an object\"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = \"normal\", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: \"root\" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if (\"function\" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, \"GeneratorFunction\"), exports.isGeneratorFunction = function (genFun) { var ctor = \"function\" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || \"GeneratorFunction\" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, \"GeneratorFunction\")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, \"Generator\"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, \"toString\", function () { return \"[object Generator]\"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { \"t\" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if (\"throw\" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = \"throw\", record.arg = exception, context.next = loc, caught && (context.method = \"next\", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if (\"root\" === entry.tryLoc) return handle(\"end\"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, \"catchLoc\"), hasFinally = hasOwn.call(entry, \"finallyLoc\"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error(\"try statement without catch or finally\"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, \"finallyLoc\") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && (\"break\" === type || \"continue\" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = \"next\", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if (\"throw\" === record.type) throw record.arg; return \"break\" === record.type || \"continue\" === record.type ? this.next = record.arg : \"return\" === record.type ? (this.rval = this.arg = record.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, \"catch\": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if (\"throw\" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, \"next\" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\nvar __ = wp.i18n.__;\nvar _React = React,\n  useState = _React.useState,\n  useEffect = _React.useEffect,\n  useRef = _React.useRef;\n\n\n\n\n\n\n\n\n\nvar _antd = antd,\n  Row = _antd.Row,\n  Col = _antd.Col,\n  Select = _antd.Select,\n  Form = _antd.Form,\n  Space = _antd.Space,\n  Input = _antd.Input;\nvar _wp$hooks = wp.hooks,\n  adAction = _wp$hooks.adAction,\n  doAction = _wp$hooks.doAction;\nvar customParseFormat = __webpack_require__(/*! dayjs/plugin/customParseFormat */ \"./node_modules/dayjs/plugin/customParseFormat.js\");\ndayjs__WEBPACK_IMPORTED_MODULE_0___default().extend(customParseFormat);\nfunction FormField(_ref) {\n  var _filterData$, _window2, _window2$timetics, _meetingToBook$locati2, _wp, _wp$hooks2, _selectedDaysSlots$fi, _selectedDaysSlots$fi2;\n  var meetingData = _ref.meetingData,\n    form = _ref.form;\n  var _useSearchParams = (0,react_router_dom__WEBPACK_IMPORTED_MODULE_10__.useSearchParams)(),\n    _useSearchParams2 = _slicedToArray(_useSearchParams, 1),\n    searchParams = _useSearchParams2[0];\n  var id = searchParams.get(\"id\");\n  var fp = useRef(null);\n  var time = Form.useWatch(\"start_time\", form);\n  var _useState = useState([]),\n    _useState2 = _slicedToArray(_useState, 2),\n    seats = _useState2[0],\n    setSeats = _useState2[1];\n  var _useStateValue = (0,_admin_context_provider__WEBPACK_IMPORTED_MODULE_5__.useStateValue)(),\n    _useStateValue2 = _slicedToArray(_useStateValue, 2),\n    _useStateValue2$ = _useStateValue2[0],\n    meetingReducer = _useStateValue2$.meeting,\n    bookingReducer = _useStateValue2$.booking,\n    settingsReducer = _useStateValue2$.settings,\n    dispatch = _useStateValue2[1];\n  var _useBooking = (0,_hooks_useBooking__WEBPACK_IMPORTED_MODULE_7__[\"default\"])(),\n    getSlotsForSelectedDay = _useBooking.getSlotsForSelectedDay;\n  var meetings = meetingReducer.meetings;\n  var settings = settingsReducer.settings;\n  var selectedStaffIdToBook = bookingReducer.selectedStaffIdToBook,\n    meetingToBook = bookingReducer.meetingToBook,\n    selectedDate = bookingReducer.selectedDate,\n    _bookingReducer$unava = bookingReducer.unavailableDayNumber,\n    unavailableDayNumber = _bookingReducer$unava === void 0 ? [] : _bookingReducer$unava,\n    selectedDaysSlots = bookingReducer.selectedDaysSlots,\n    slots = bookingReducer.slots,\n    renderFlatPicker = bookingReducer.renderFlatPicker,\n    startDateForSlots = bookingReducer.startDateForSlots,\n    meetingStaffs = bookingReducer.meetingStaffs,\n    booking = bookingReducer.booking,\n    selectedMeetingId = bookingReducer.selectedMeetingId;\n\n  // if(meetin)\n\n  useEffect(function () {\n    if (typeof window !== \"undefined\" && window.flatpickr && fp.current) {\n      var _meetingToBook$availa, _meetingToBook$availa2, _meetingToBook$availa3, _window, _window$timetics;\n      var inputEl = fp.current;\n      if (settings !== null && settings !== void 0 && settings.calendar_locale) window.flatpickr.localize(window.flatpickr.l10ns[settings === null || settings === void 0 ? void 0 : settings.calendar_locale]);\n      var flatpickrInstance = window.flatpickr(inputEl, {\n        //TODO need to add default date if selected date is available\n        altFormat: \"F j, Y\",\n        dateFormat: \"Y-m-d\",\n        defaultDate: selectedDate ? selectedDate : null,\n        minDate: meetingToBook !== null && meetingToBook !== void 0 && meetingToBook.availability ? new Date(meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$availa = meetingToBook.availability) === null || _meetingToBook$availa === void 0 ? void 0 : _meetingToBook$availa.start) < new Date() ? new Date() : meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$availa2 = meetingToBook.availability) === null || _meetingToBook$availa2 === void 0 ? void 0 : _meetingToBook$availa2.start : new Date().fp_incr(30),\n        monthSelectorType: \"static\",\n        maxDate: meetingToBook !== null && meetingToBook !== void 0 && meetingToBook.availability ? meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$availa3 = meetingToBook.availability) === null || _meetingToBook$availa3 === void 0 ? void 0 : _meetingToBook$availa3.end : new Date().fp_incr(30),\n        disable: [function (date) {\n          return _toConsumableArray(unavailableDayNumber).includes(date.getDay());\n        }],\n        locale: {\n          firstDayOfWeek: Number((_window = window) === null || _window === void 0 ? void 0 : (_window$timetics = _window.timetics) === null || _window$timetics === void 0 ? void 0 : _window$timetics.start_of_week) // start week on Monday\n        },\n\n        onChange: function onChange(selectedDates, dateStr, instance) {\n          var day = (0,_frontend_utils_helper__WEBPACK_IMPORTED_MODULE_4__.getWeekDay)(new Date(dateStr));\n          dispatch({\n            type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_SELECTED_DATE,\n            payload: {\n              selectedDate: dateStr,\n              selectedDay: day\n            }\n          });\n        },\n        onMonthChange: function onMonthChange(selectedDates, dateStr, instance) {\n          var newDateStr = dayjs__WEBPACK_IMPORTED_MODULE_0___default()().month(instance.currentMonth).startOf(\"month\").toDate();\n          dispatch({\n            type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_BOOKING_STATE,\n            payload: {\n              startDateForSlots: dayjs__WEBPACK_IMPORTED_MODULE_0___default()(newDateStr).format(\"YYYY-MM-DD\")\n            }\n          });\n        }\n      });\n      return function () {\n        flatpickrInstance.destroy();\n      };\n    }\n  }, [renderFlatPicker]);\n  useEffect(function () {\n    var loadData = /*#__PURE__*/function () {\n      var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n        var _yield$getSlots, data;\n        return _regeneratorRuntime().wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                if (!(selectedStaffIdToBook && meetingToBook !== null && meetingToBook !== void 0 && meetingToBook.id)) {\n                  _context.next = 6;\n                  break;\n                }\n                _context.next = 3;\n                return (0,_services_meetings__WEBPACK_IMPORTED_MODULE_6__.getSlots)({\n                  method: \"GET\"\n                }, _objectSpread({\n                  staffId: selectedStaffIdToBook,\n                  meetingId: meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.id,\n                  timeZone: (settings === null || settings === void 0 ? void 0 : settings.locale_timezone) || Intl.DateTimeFormat().resolvedOptions().timeZone\n                }, (0,_frontend_utils_helper__WEBPACK_IMPORTED_MODULE_4__.getDateRangeOfStartDateAndEndOfTheMonth)(startDateForSlots || dayjs__WEBPACK_IMPORTED_MODULE_0___default()().format(\"YYYY-MM-DD\"))));\n              case 3:\n                _yield$getSlots = _context.sent;\n                data = _yield$getSlots.data;\n                dispatch({\n                  type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_MEETING_SLOTS,\n                  payload: {\n                    slots: data === null || data === void 0 ? void 0 : data.data\n                  }\n                });\n              case 6:\n              case \"end\":\n                return _context.stop();\n            }\n          }\n        }, _callee);\n      }));\n      return function loadData() {\n        return _ref2.apply(this, arguments);\n      };\n    }();\n    loadData();\n  }, [selectedStaffIdToBook, startDateForSlots]);\n\n  /**\n   *Called On change of selected date\n   */\n  useEffect(function () {\n    var todayDate = dayjs__WEBPACK_IMPORTED_MODULE_0___default()().format(\"YYYY-MM-DD\");\n    if (todayDate === selectedDate) {\n      var _selectedDaysSlots = getSlotsForSelectedDay({\n        selectedDate: dayjs__WEBPACK_IMPORTED_MODULE_0___default()(selectedDate).format(\"YYYY-MM-DD\")\n      });\n      var selectedDaysSlotsFiltered = _selectedDaysSlots === null || _selectedDaysSlots === void 0 ? void 0 : _selectedDaysSlots.filter(function (slot) {\n        return dayjs__WEBPACK_IMPORTED_MODULE_0___default()(slot === null || slot === void 0 ? void 0 : slot.start_time, \"hh:mma\").isAfter(dayjs__WEBPACK_IMPORTED_MODULE_0___default()());\n      });\n      dispatch({\n        type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_SELECTED_DATE,\n        payload: {\n          selectedDaysSlots: selectedDaysSlotsFiltered\n        }\n      });\n    } else {\n      var _selectedDaysSlots2 = getSlotsForSelectedDay({\n        selectedDate: dayjs__WEBPACK_IMPORTED_MODULE_0___default()(selectedDate).format(\"YYYY-MM-DD\"),\n        slots: slots\n      });\n      if (booking !== null && booking !== void 0 && booking.seats && (meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.type) === \"seat\") {\n        var filterByAvailableSeats = _selectedDaysSlots2 === null || _selectedDaysSlots2 === void 0 ? void 0 : _selectedDaysSlots2.filter(function (slot) {\n          return slot.start_time === (booking === null || booking === void 0 ? void 0 : booking.start_time) || !booking.seats.some(function (seat) {\n            return slot === null || slot === void 0 ? void 0 : slot.seats.includes(seat);\n          });\n        });\n        dispatch({\n          type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_SELECTED_DATE,\n          payload: {\n            selectedDaysSlots: filterByAvailableSeats\n          }\n        });\n        return;\n      }\n      dispatch({\n        type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_SELECTED_DATE,\n        payload: {\n          selectedDaysSlots: _selectedDaysSlots2\n        }\n      });\n    }\n  }, [selectedDate, slots]);\n  useEffect(function () {\n    form === null || form === void 0 ? void 0 : form.setFieldValue(\"seats\", seats);\n  }, [seats]);\n  var onSelectHandler = function onSelectHandler(data) {\n    if (Array.isArray(data)) {\n      setSeats(function (s) {\n        return s.concat(data === null || data === void 0 ? void 0 : data.map(function (el) {\n          return el.id;\n        }));\n      });\n    } else {\n      setSeats(function (s) {\n        return s.concat(data === null || data === void 0 ? void 0 : data.id);\n      });\n    }\n  };\n  var onUnselectHandler = function onUnselectHandler(data) {\n    if (Array.isArray(data)) {\n      var idArr = data === null || data === void 0 ? void 0 : data.map(function (el) {\n        return el.id;\n      });\n      setSeats(function (s) {\n        return s.filter(function (seat) {\n          return !idArr.includes(seat);\n        });\n      });\n    } else {\n      setSeats(function (s) {\n        return s.filter(function (seat) {\n          return seat !== (data === null || data === void 0 ? void 0 : data.id);\n        });\n      });\n    }\n  };\n\n  /**\n   * Meeting title on change get value\n   * @param {number} value selected value\n   */\n  var meetingOnChange = function meetingOnChange(value) {\n    var _meetingToBook$;\n    if (!value) {\n      dispatch({\n        type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_MEETING_TO_BOOK,\n        payload: {\n          meetingToBook: undefined,\n          staffsOfMeetingToBook: undefined,\n          selectedStaffIdToBook: undefined,\n          selectedDate: null,\n          selectedMeetingId: null\n        }\n      });\n      return;\n    }\n    dispatch({\n      type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_BOOKING_STATE,\n      payload: {\n        selectedMeetingId: value\n      }\n    });\n    var meetingToBook = meetings === null || meetings === void 0 ? void 0 : meetings.filter(function (item) {\n      return (item === null || item === void 0 ? void 0 : item.id) == value;\n    });\n    var staffsOfMeetingToBook = meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$ = meetingToBook[0]) === null || _meetingToBook$ === void 0 ? void 0 : _meetingToBook$.staff;\n    dispatch({\n      type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_MEETING_TO_BOOK,\n      payload: {\n        meetingToBook: meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook[0],\n        staffsOfMeetingToBook: staffsOfMeetingToBook,\n        meetingStaffs: staffsOfMeetingToBook\n      }\n    });\n  };\n  var onSelectStaff = function onSelectStaff(value) {\n    var selectedScheduleBasedOnStaff = meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.schedule[value];\n    var offDays = (0,_frontend_utils_helper__WEBPACK_IMPORTED_MODULE_4__.getDayNumbers)(selectedScheduleBasedOnStaff);\n    dispatch({\n      type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_SELECTED_STAFF_ID_TO_BOOK,\n      payload: {\n        selectedStaffIdToBook: value,\n        unavailableDayNumber: offDays,\n        renderFlatPicker: new Date().getTime()\n      }\n    });\n  };\n\n  /**\n   * get selected meeting data\n   */\n  var filterData = meetings === null || meetings === void 0 ? void 0 : meetings.filter(function (item) {\n    return (item === null || item === void 0 ? void 0 : item.id) == selectedMeetingId;\n  });\n  var meetingDate = filterData === null || filterData === void 0 ? void 0 : (_filterData$ = filterData[0]) === null || _filterData$ === void 0 ? void 0 : _filterData$.availability;\n  // const meetingStaff = filterData?.[0]?.staff;\n\n  /**\n   * disable date\n    @param {} current\n   * @returns true or false\n   */\n\n  function disabledDate(current) {\n    var startDate = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(meetingDate === null || meetingDate === void 0 ? void 0 : meetingDate.start);\n    var endDate = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(meetingDate === null || meetingDate === void 0 ? void 0 : meetingDate.end).add(1, \"day\");\n    return current < startDate || current > endDate;\n  }\n\n  /**\n   * booking status\n   */\n  var status = [{\n    id: 1,\n    name: __(\"Pending\", \"timetics\"),\n    value: \"pending\"\n  }, {\n    id: 2,\n    name: __(\"Approved\", \"timetics\"),\n    value: \"approved\"\n  }, {\n    id: 2,\n    name: __(\"Cancel\", \"timetics\"),\n    value: \"cancel\"\n  }];\n  var showField = !!(filterData !== null && filterData !== void 0 && filterData.length) || !!selectedMeetingId ? true : false;\n  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_common_TextInput__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n    label: __(\"Customer's name\", \"timetics\"),\n    name: \"first_name\",\n    type: \"text\",\n    size: \"small\",\n    rules: [{\n      required: true,\n      message: __(\"Customer name is required!\", \"timetics\")\n    }],\n    placeholder: __(\"Jhon Deo\", \"timetics\")\n  }), /*#__PURE__*/React.createElement(_common_TextInput__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n    label: __(\"Customer's Email\", \"timetics\"),\n    name: \"email\",\n    type: \"email\",\n    size: \"small\",\n    rules: [{\n      required: true,\n      message: \"Customer email is required!\"\n    }],\n    placeholder: __(\"name@yourdomain.com\", \"timetics\")\n  }), /*#__PURE__*/React.createElement(_common_SelectInput__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n    initialValue: (settings === null || settings === void 0 ? void 0 : settings.locale_timezone) || Intl.DateTimeFormat().resolvedOptions().timeZone,\n    style: {\n      width: \"100%\"\n    },\n    key: \"meeting-timezone\",\n    data: function () {\n      if (!Intl.supportedValuesOf) {\n        return [{\n          label: \"Your browser does not support Intl.supportedValuesOf()\",\n          value: null\n        }];\n      } else {\n        var options = [];\n        var _iterator = _createForOfIteratorHelper(Intl.supportedValuesOf(\"timeZone\")),\n          _step;\n        try {\n          for (_iterator.s(); !(_step = _iterator.n()).done;) {\n            var timeZone = _step.value;\n            options.push({\n              label: timeZone,\n              value: timeZone\n            });\n          }\n        } catch (err) {\n          _iterator.e(err);\n        } finally {\n          _iterator.f();\n        }\n        return options;\n      }\n    }(),\n    label: __(\"Client time zone\", \"timetics\"),\n    labelCol: 24,\n    wrapperCol: 24,\n    name: \"timezone\",\n    showSearch: true,\n    rules: [{\n      required: true,\n      message: __(\"Please select your timezone\", \"timetics\")\n    }]\n  }), /*#__PURE__*/React.createElement(_common_SelectInput__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n    label: __(\"Select Meeting\", \"timetics\"),\n    key: \"appointment\",\n    options: (_window2 = window) !== null && _window2 !== void 0 && (_window2$timetics = _window2.timetics) !== null && _window2$timetics !== void 0 && _window2$timetics.timeticsPro ? meetingData : meetingData === null || meetingData === void 0 ? void 0 : meetingData.filter(function (el) {\n      return el.type === \"One-to-One\";\n    }),\n    fieldNames: {\n      label: \"name\",\n      value: \"id\"\n    },\n    onChange: meetingOnChange,\n    name: \"appointment\",\n    showSearch: true,\n    allowClear: true,\n    placeholder: __(\"Please Select Your Meeting\", \"timetics\"),\n    filterOption: function filterOption(input, option) {\n      var _option$name;\n      return ((_option$name = option === null || option === void 0 ? void 0 : option.name) !== null && _option$name !== void 0 ? _option$name : \"\").includes(input);\n    },\n    rules: [{\n      required: true,\n      message: __(\"Meeting title is required\", \"timetics\")\n    }]\n  }), showField && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_common_SelectInput__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n    label: __(\"Select Host\", \"timetics\"),\n    key: \"host\",\n    style: {\n      width: \"100%\"\n    },\n    options: meetingStaffs,\n    fieldNames: {\n      label: \"full_name\",\n      value: \"id\"\n    }\n    // default/initial value remain set for the name.\n    ,\n    name: \"staff\",\n    placeholder: __(\"Select Host\", \"timetics\"),\n    onChange: onSelectStaff\n    // defaultValue={selectedStaffIdToBook}\n    ,\n    rules: [{\n      required: true,\n      message: __(\"Host is required\", \"timetics\")\n    }]\n  }), (meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.type) == \"seat\" ? /*#__PURE__*/React.createElement(_common_TextInput__WEBPACK_IMPORTED_MODULE_1__[\"default\"], {\n    label: __(\"Number of invitee\", \"timetics\"),\n    name: \"invitee\",\n    type: \"number\",\n    size: \"small\",\n    placeholder: __(\"Enter Number of invitee\", \"timetics\")\n  }) : null, /*#__PURE__*/React.createElement(Form.Item, {\n    label: __(\"Select Location\", \"timetics\"),\n    className: \"timetics-input\",\n    key: \"location_type\",\n    style: {\n      width: \"100%\"\n    }\n    // options={meetingToBook?.locations}\n    // fieldNames={{\n    //     label: \"location_type\",\n    //     value: \"location_type\",\n    // }}\n    // default/initial value remain set for the name.\n    ,\n    name: \"location_type\",\n    placeholder: __(\"Select Location\", \"timetics\")\n  }, /*#__PURE__*/React.createElement(Select, {\n    size: \"large\",\n    className: \"tt-location-item\"\n    // name={\"location_type\"}\n    ,\n    key: \"location_type\",\n    onChange: function onChange(value) {\n      var _meetingToBook$locati;\n      dispatch({\n        type: _admin_actionCreators_actions__WEBPACK_IMPORTED_MODULE_3__.actions.SET_BOOKING_STATE,\n        payload: _objectSpread({}, meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$locati = meetingToBook.locations) === null || _meetingToBook$locati === void 0 ? void 0 : _meetingToBook$locati.filter(function (item) {\n          return item.location_type == value;\n        })[0])\n      });\n    }\n  }, meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$locati2 = meetingToBook.locations) === null || _meetingToBook$locati2 === void 0 ? void 0 : _meetingToBook$locati2.map(function (option, i) {\n    return /*#__PURE__*/React.createElement(Select.Option, {\n      key: \"\".concat(i, \"-meeting-location\"),\n      value: option.location_type\n    }, /*#__PURE__*/React.createElement(Space, {\n      className: \"tt-location-option\"\n    }, locationIcons[option.location_type], option.location_type));\n  }))), selectedStaffIdToBook && /*#__PURE__*/React.createElement(Row, {\n    gutter: [20, 20]\n  }, /*#__PURE__*/React.createElement(Col, {\n    span: 12\n  }, /*#__PURE__*/React.createElement(Form.Item, {\n    className: \"timetics-input\",\n    label: \"Select date\"\n  }, /*#__PURE__*/React.createElement(\"input\", {\n    placeholder: \"Select booking date\",\n    ref: fp,\n    type: \"text\",\n    className: \"tt-flat-picker-input ant-input ant-input-lg\",\n    id: \"booking-date\",\n    name: \"booking-date\"\n  }))), /*#__PURE__*/React.createElement(Col, {\n    span: 12\n  }, /*#__PURE__*/React.createElement(_common_SelectInput__WEBPACK_IMPORTED_MODULE_2__[\"default\"], {\n    label: __(\"Select time\", \"timetics\"),\n    key: \"time\",\n    style: {\n      width: \"100%\"\n    },\n    options: selectedDaysSlots,\n    fieldNames: {\n      label: \"start_time\",\n      value: \"start_time\"\n    },\n    name: \"start_time\",\n    placeholder: __(\"Select Meeting\", \"timetics\"),\n    rules: [{\n      required: true,\n      message: __(\"Time is required\", \"timetics\")\n    }]\n  })), (meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.type) === \"seat\" && time && !id && selectedDate ? /*#__PURE__*/React.createElement(Col, {\n    span: 24\n  }, /*#__PURE__*/React.createElement(\"div\", {\n    style: {\n      border: \"1px solid var(--tt-secondary-color-12)\",\n      borderRadius: \"6px\",\n      marginBottom: \"1rem\"\n    }\n  }, (_wp = wp) === null || _wp === void 0 ? void 0 : (_wp$hooks2 = _wp.hooks) === null || _wp$hooks2 === void 0 ? void 0 : _wp$hooks2.applyFilters(\"seatMap\", meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.seat_plan, // an array of individual seat data\n  meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.seat_plan_settings,\n  // object regarding the canvas settings\n  (selectedDaysSlots === null || selectedDaysSlots === void 0 ? void 0 : (_selectedDaysSlots$fi = selectedDaysSlots.filter(function (slot) {\n    return slot.start_time === time;\n  })) === null || _selectedDaysSlots$fi === void 0 ? void 0 : (_selectedDaysSlots$fi2 = _selectedDaysSlots$fi[0]) === null || _selectedDaysSlots$fi2 === void 0 ? void 0 : _selectedDaysSlots$fi2.seats) || [],\n  // an array of number id\n  onSelectHandler, onUnselectHandler)), /*#__PURE__*/React.createElement(Form.Item, {\n    hidden: true,\n    name: \"seats\"\n  }, /*#__PURE__*/React.createElement(Input, {\n    type: \"hidden\"\n  }))) : null)), /*#__PURE__*/React.createElement(_common_SelectInput__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n  // defaultValue={__(\"Approved\", \"timetics\")}\n  , {\n    className: \"tt-booking-status-field\",\n    popupClassName: \"tt-booking-status-options\",\n    style: {\n      width: \"100%\"\n    },\n    key: \"status\",\n    data: status,\n    fieldNames: {\n      label: \"name\",\n      value: \"value\"\n    },\n    label: __(\"Status\", \"timetics\"),\n    name: \"status\",\n    placeholder: __(\"Select Booking status\", \"timetics\")\n  }));\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FormField);\nvar locationIcons = {\n  \"google-meet\": /*#__PURE__*/React.createElement(_common_icons_Icons__WEBPACK_IMPORTED_MODULE_8__.GoogleMeet, null),\n  \"phone-call\": /*#__PURE__*/React.createElement(_common_icons_Icons__WEBPACK_IMPORTED_MODULE_8__.Phone, null),\n  \"in-person-meeting\": /*#__PURE__*/React.createElement(_common_icons_Icons__WEBPACK_IMPORTED_MODULE_8__.Location, null)\n};\n\n//# sourceURL=webpack://timetics/./assets/src/admin/pages/bookings/FormField.js?");

/***/ }),

/***/ "./assets/src/admin/pages/bookings/hooks/useBooking.js":
/*!*************************************************************!*\
  !*** ./assets/src/admin/pages/bookings/hooks/useBooking.js ***!
  \*************************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _context_provider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../context/provider */ \"./assets/src/admin/context/provider.js\");\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\nfunction _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== \"undefined\" && arr[Symbol.iterator] || arr[\"@@iterator\"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\n\nfunction useBooking() {\n  var _useStateValue = (0,_context_provider__WEBPACK_IMPORTED_MODULE_1__.useStateValue)(),\n    _useStateValue2 = _slicedToArray(_useStateValue, 1),\n    _useStateValue2$ = _useStateValue2[0],\n    bookingReducer = _useStateValue2$.booking,\n    meetingReducer = _useStateValue2$.meeting;\n  var slots = bookingReducer.slots,\n    meetingToBook = bookingReducer.meetingToBook;\n  var getSlotsForSelectedDay = function getSlotsForSelectedDay(_ref) {\n    var _slots$days, _data$, _data$$slots, _meetingToBook$price, _data$2, _data$2$slots;\n    var selectedDate = _ref.selectedDate,\n      _slots = _ref.slots;\n    var __slots = _slots || slots;\n    var _singleDaySlots;\n    var data = __slots === null || __slots === void 0 ? void 0 : (_slots$days = __slots.days) === null || _slots$days === void 0 ? void 0 : _slots$days.filter(function (item) {\n      return dayjs__WEBPACK_IMPORTED_MODULE_0___default()(item === null || item === void 0 ? void 0 : item.date).format(\"YYYY-MM-DD\") == dayjs__WEBPACK_IMPORTED_MODULE_0___default()(selectedDate).format(\"YYYY-MM-DD\");\n    });\n    switch (meetingToBook === null || meetingToBook === void 0 ? void 0 : meetingToBook.type) {\n      case \"One-to-One\":\n        _singleDaySlots = data === null || data === void 0 ? void 0 : (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : (_data$$slots = _data$.slots) === null || _data$$slots === void 0 ? void 0 : _data$$slots.filter(function (item) {\n          return item.status == \"available\";\n        });\n        break;\n      case \"One-to-Many\":\n      case \"seat\":\n        var totalTicketsPerSlot = meetingToBook === null || meetingToBook === void 0 ? void 0 : (_meetingToBook$price = meetingToBook.price) === null || _meetingToBook$price === void 0 ? void 0 : _meetingToBook$price.reduce(function (acc, cur) {\n          return Number(cur.ticket_quantity) + acc;\n        }, 0);\n        _singleDaySlots = data === null || data === void 0 ? void 0 : (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : (_data$2$slots = _data$2.slots) === null || _data$2$slots === void 0 ? void 0 : _data$2$slots.filter(function (item) {\n          return Number(item.booked) < totalTicketsPerSlot;\n        });\n        break;\n    }\n    return _singleDaySlots;\n  };\n  return {\n    getSlotsForSelectedDay: getSlotsForSelectedDay\n  };\n}\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (useBooking);\n\n//# sourceURL=webpack://timetics/./assets/src/admin/pages/bookings/hooks/useBooking.js?");

/***/ }),

/***/ "./assets/src/common/constant.js":
/*!***************************************!*\
  !*** ./assets/src/common/constant.js ***!
  \***************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"FRONTEND_STEPS\": () => (/* binding */ FRONTEND_STEPS),\n/* harmony export */   \"MEETING_TYPE\": () => (/* binding */ MEETING_TYPE),\n/* harmony export */   \"USER_STEPS\": () => (/* binding */ USER_STEPS)\n/* harmony export */ });\nvar FRONTEND_STEPS = {\n  bookingSchedule: 1,\n  seatMap: 2,\n  contactInfo: 3,\n  paymentForm: 4\n};\nvar USER_STEPS = {\n  userBookingsList: 1,\n  userProfile: 2,\n  userChangePassword: 3\n};\nvar MEETING_TYPE = {\n  oneToOne: \"One-to-One\",\n  oneToMany: \"One-to-Many\",\n  seat: \"seat\"\n};\n\n//# sourceURL=webpack://timetics/./assets/src/common/constant.js?");

/***/ }),

/***/ "./assets/src/frontend/utils/helper.js":
/*!*********************************************!*\
  !*** ./assets/src/frontend/utils/helper.js ***!
  \*********************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"convertMilisecondsToCurrentDateAsMiliseconds\": () => (/* binding */ convertMilisecondsToCurrentDateAsMiliseconds),\n/* harmony export */   \"genrateSeats\": () => (/* binding */ genrateSeats),\n/* harmony export */   \"getDateListFromDayStrings\": () => (/* binding */ getDateListFromDayStrings),\n/* harmony export */   \"getDateRangeOfStartDateAndEndOfTheMonth\": () => (/* binding */ getDateRangeOfStartDateAndEndOfTheMonth),\n/* harmony export */   \"getDayCountOfMonth\": () => (/* binding */ getDayCountOfMonth),\n/* harmony export */   \"getDayNumber\": () => (/* binding */ getDayNumber),\n/* harmony export */   \"getDayNumbers\": () => (/* binding */ getDayNumbers),\n/* harmony export */   \"getDaysThatNotAvailable\": () => (/* binding */ getDaysThatNotAvailable),\n/* harmony export */   \"getPaymentMethods\": () => (/* binding */ getPaymentMethods),\n/* harmony export */   \"getStepNo\": () => (/* binding */ getStepNo),\n/* harmony export */   \"getTimeSlot\": () => (/* binding */ getTimeSlot),\n/* harmony export */   \"getWeekDay\": () => (/* binding */ getWeekDay),\n/* harmony export */   \"isFreeMeeting\": () => (/* binding */ isFreeMeeting),\n/* harmony export */   \"isLocalPayment\": () => (/* binding */ isLocalPayment),\n/* harmony export */   \"isNoPayment\": () => (/* binding */ isNoPayment),\n/* harmony export */   \"isWCPayment\": () => (/* binding */ isWCPayment)\n/* harmony export */ });\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! dayjs */ \"./node_modules/dayjs/dayjs.min.js\");\n/* harmony import */ var dayjs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(dayjs__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _common_constant__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../common/constant */ \"./assets/src/common/constant.js\");\n\n\n\n/**\n *Handler for getting the day of the week from a date.\n * @param {Object} date Js Date object\n * @returns {String} Day of the week\n */\nfunction getWeekDay(date) {\n  var days = [\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"];\n  return days[date.getDay()];\n}\n\n/**\n *Handler for getting the day count of a month.\n * @param {Object} date Js Date object\n * @returns {Number} Day count of the month\n */\nvar getDayCountOfMonth = function getDayCountOfMonth() {\n  var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();\n  date.setDate(1); // Set date to the first of the month\n  date.setMonth(date.getMonth() + 1); // Set date to the first of the next month\n  date.setDate(date.getDate() - 1); // Set date to the last day of the current month\n  var dayCount = date.getDate();\n  return dayCount;\n};\nvar getDaysThatNotAvailable = function getDaysThatNotAvailable(schedules) {\n  if (!schedules) return [];\n  var days = schedules.filter(function (day) {\n    return !day.status;\n  });\n  return days.map(function (day) {\n    return day.name.toLocaleLowerCase();\n  });\n};\nvar getDateListFromDayStrings = function getDateListFromDayStrings(_ref) {\n  var _ref$days = _ref.days,\n    days = _ref$days === void 0 ? [] : _ref$days,\n    _ref$currentMonth = _ref.currentMonth,\n    currentMonth = _ref$currentMonth === void 0 ? new Date().getMonth() : _ref$currentMonth;\n  var unavailableDates = [];\n  var date = new Date();\n  var dateForCurrentMonth = new Date(date.setMonth(currentMonth));\n  // get currentMonth day count\n  var dayCount = getDayCountOfMonth(new Date(dateForCurrentMonth));\n  for (var i = 1; i <= dayCount; i++) {\n    var _date = new Date(dateForCurrentMonth);\n    _date.setDate(i);\n    var day = _date.toLocaleDateString(\"en\", {\n      weekday: \"long\"\n    }).toLocaleLowerCase();\n    if (days.includes(day)) {\n      unavailableDates.push(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(_date).format(\"YYYY-MM-DD\"));\n    }\n  }\n  return unavailableDates;\n};\nvar getTimeSlot = function getTimeSlot(_ref2) {\n  var schedule = _ref2.schedule,\n    selectedDate = _ref2.selectedDate,\n    selectedDay = _ref2.selectedDay,\n    duration = _ref2.duration;\n  //get number from du\n  var num = parseInt(duration);\n  //get unit from du\n  var splittedDuration = duration.split(\" \");\n  //convert unit to seconds\n  var multiplier = splittedDuration[1] == \"min\" ? 60 * 1000 : 60 * 60 * 1000;\n  var durationInMilliseconds = multiplier * splittedDuration[0];\n  var day = schedule.find(function (day) {\n    return day.name === selectedDay;\n  });\n\n  // divide the time slots into 30 minutes intervals and return the time slots\n\n  var timeSlots = [];\n  var startTime = convertMilisecondsToCurrentDateAsMiliseconds(day.schedules[0].start.value, selectedDate);\n  var endTime = convertMilisecondsToCurrentDateAsMiliseconds(day.schedules[0].end.value, selectedDate);\n  for (var i = startTime; endTime - i >= durationInMilliseconds; i += durationInMilliseconds) {\n    var date = new Date(selectedDate);\n    date.setHours(0, 0, 0, 0);\n    date.setHours(new Date(i).getHours(), new Date(i).getMinutes(), new Date(i).getSeconds(), new Date(i).getMilliseconds());\n    timeSlots.push(date.getTime());\n  }\n  return timeSlots;\n};\nvar convertMilisecondsToCurrentDateAsMiliseconds = function convertMilisecondsToCurrentDateAsMiliseconds(miliseconds, selectedDate) {\n  var date = new Date(miliseconds);\n  // date.setHours(0, 0, 0, 0);\n  date.setDate(new Date(selectedDate).getDate());\n  date.setHours(new Date(date).getHours(), new Date(date).getMinutes(), new Date(date).getSeconds(), new Date(date).getMilliseconds());\n  return date.getTime();\n};\nvar getDayNumber = function getDayNumber(_ref3) {\n  var days = _ref3.days;\n  var _days = {\n    sunday: 0,\n    monday: 1,\n    tuesday: 2,\n    wednesday: 3,\n    thursday: 4,\n    friday: 5,\n    saturday: 6\n  };\n\n  //convert days to numbers based on _days object\n  var dayNumbers = days.map(function (day) {\n    return _days[day];\n  });\n  return dayNumbers;\n};\nvar getDateRangeOfStartDateAndEndOfTheMonth = function getDateRangeOfStartDateAndEndOfTheMonth(date) {\n  //get date range of the month based on start date\n  var startDate = dayjs__WEBPACK_IMPORTED_MODULE_0___default()(date).toDate();\n  var endDate = new Date(date);\n  endDate.setDate(getDayCountOfMonth(startDate));\n  return {\n    startDate: dayjs__WEBPACK_IMPORTED_MODULE_0___default()(dayjs__WEBPACK_IMPORTED_MODULE_0___default()(date).toDate()).format(\"YYYY-MM-DD\"),\n    endDate: dayjs__WEBPACK_IMPORTED_MODULE_0___default()(endDate).format(\"YYYY-MM-DD\")\n  };\n};\nvar getDayNumbers = function getDayNumbers(schedule) {\n  var _days = {\n    sun: 0,\n    mon: 1,\n    tue: 2,\n    wed: 3,\n    thu: 4,\n    fri: 5,\n    sat: 6\n  };\n\n  //convert days to numbers based on _days object\n  var dayNumbers = Object.keys(schedule).map(function (day) {\n    if (schedule[day].length < 1) {\n      return _days[\"\".concat(String(day).toLocaleLowerCase())];\n    }\n  });\n  //remove undefined values\n  var _dayNumbers = dayNumbers.filter(function (day) {\n    return day !== undefined;\n  });\n  return _dayNumbers;\n};\nvar isNoPayment = function isNoPayment(paymentMethods) {\n  var noPayment = paymentMethods === null || paymentMethods === void 0 ? void 0 : paymentMethods.every(function (method) {\n    return !method.status;\n  });\n  return noPayment;\n};\nvar isLocalPayment = function isLocalPayment(paymentMethods) {\n  var localPayment = paymentMethods.some(function (method) {\n    return method.name == \"Local Pay\" && method.status;\n  });\n  return localPayment;\n};\nvar isWCPayment = function isWCPayment(paymentMethods) {\n  var wcPayment = paymentMethods.some(function (method) {\n    return method.name == \"Woocommerce\" && method.status;\n  });\n  return wcPayment;\n};\nvar isFreeMeeting = function isFreeMeeting(total) {\n  var freeMeeting = total === 0;\n  return freeMeeting;\n};\nvar getPaymentMethods = function getPaymentMethods(paymentMethods) {\n  var methods = paymentMethods.filter(function (method) {\n    return method.status;\n  });\n  return methods;\n};\nvar getStepNo = function getStepNo(_ref4) {\n  var isFree = _ref4.isFree,\n    noPayment = _ref4.noPayment,\n    isLocalPaymentActive = _ref4.isLocalPaymentActive,\n    selectedPaymentMethod = _ref4.selectedPaymentMethod,\n    meetingType = _ref4.meetingType,\n    wcPayment = _ref4.wcPayment;\n  var status = 3;\n  if (isFree) {\n    status = _common_constant__WEBPACK_IMPORTED_MODULE_1__.FRONTEND_STEPS.bookingSchedule;\n    return status;\n  }\n  if (noPayment) {\n    status = _common_constant__WEBPACK_IMPORTED_MODULE_1__.FRONTEND_STEPS.bookingSchedule;\n    return status;\n  }\n  if (isLocalPaymentActive && selectedPaymentMethod == \"Local Pay\") {\n    status = _common_constant__WEBPACK_IMPORTED_MODULE_1__.FRONTEND_STEPS.bookingSchedule;\n    return status;\n  }\n  if (wcPayment) {\n    status = _common_constant__WEBPACK_IMPORTED_MODULE_1__.FRONTEND_STEPS.contactInfo;\n    return status;\n  }\n  if (selectedPaymentMethod == \"Paypal\" || selectedPaymentMethod == \"Stripe\") {\n    status = _common_constant__WEBPACK_IMPORTED_MODULE_1__.FRONTEND_STEPS.paymentForm;\n  }\n  return status;\n};\n\n// demo/test for seat generation\nvar genrateSeats = function genrateSeats(_ref5) {\n  var _ref5$row = _ref5.row,\n    row = _ref5$row === void 0 ? 4 : _ref5$row,\n    _ref5$column = _ref5.column,\n    column = _ref5$column === void 0 ? 12 : _ref5$column,\n    _ref5$label = _ref5.label,\n    label = _ref5$label === void 0 ? \"a,Z|0,100\" : _ref5$label,\n    _ref5$ticketType = _ref5.ticketType,\n    ticketType = _ref5$ticketType === void 0 ? \"vip\" : _ref5$ticketType;\n  var seats = [];\n  var labels = label.split(\"|\");\n  var rowLabels = labels[0].split(\",\");\n  var columnLabels = labels[1].split(\",\");\n  var rowLabelStart = rowLabels[0];\n  var rowLabelEnd = rowLabels[1];\n  var columnLabelStart = columnLabels[0];\n  var columnLabelEnd = columnLabels[1];\n  for (var i = 0; i < row; i++) {\n    var _row = [];\n    for (var j = 0; j < column; j++) {\n      var seat = {\n        row: String.fromCharCode(rowLabelStart.charCodeAt(0) + i),\n        column: +(columnLabelStart + j),\n        status: \"available\",\n        type: ticketType\n      };\n      _row.push(seat);\n    }\n    seats.push(_row);\n  }\n};\ngenrateSeats({\n  row: 4,\n  column: 12,\n  label: \"a,Z|0,100\",\n  ticketType: \"vip\"\n});\n\n//# sourceURL=webpack://timetics/./assets/src/frontend/utils/helper.js?");

/***/ })

}]);