@pisell/private-materials 6.11.125 → 6.11.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,685 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function _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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
3
+ function 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); } }
4
+ function _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); }); }; }
5
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
6
+ function _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."); }
7
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
8
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
13
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
14
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
15
+ function _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."); }
16
+ function _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); }
17
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
18
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
19
+ function _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; }
20
+ import React, { useEffect, useMemo, useRef, useState } from 'react';
21
+ import ReactDOM from 'react-dom';
22
+ import "./index.less";
23
+ var CLOSE_ANIMATION_MS = 180;
24
+ var activeInstance = null;
25
+
26
+ /** Format float hours like 9.5 into 09:30. */
27
+ function defaultFormatHourLabel(hour) {
28
+ var normalizedMinutes = Math.round(hour * 60);
29
+ var wholeHours = Math.floor(normalizedMinutes / 60);
30
+ var minutes = normalizedMinutes % 60;
31
+ return "".concat(String(wholeHours).padStart(2, '0'), ":").concat(String(minutes).padStart(2, '0'));
32
+ }
33
+ function getHourStep(hourSlots) {
34
+ if (hourSlots.length < 2) {
35
+ return 1;
36
+ }
37
+ var sorted = _toConsumableArray(hourSlots).sort(function (a, b) {
38
+ return a - b;
39
+ });
40
+ var minStep = Number.POSITIVE_INFINITY;
41
+ for (var index = 1; index < sorted.length; index += 1) {
42
+ var step = sorted[index] - sorted[index - 1];
43
+ if (step > 0 && step < minStep) {
44
+ minStep = step;
45
+ }
46
+ }
47
+ return Number.isFinite(minStep) ? minStep : 1;
48
+ }
49
+ function getFallbackHourSlots() {
50
+ return Array.from({
51
+ length: 24
52
+ }, function (_, index) {
53
+ return index;
54
+ });
55
+ }
56
+ function getCourtName(courts, courtId) {
57
+ var _courts$find;
58
+ if (!courtId) {
59
+ return 'Court';
60
+ }
61
+ return ((_courts$find = courts.find(function (court) {
62
+ return court.id === courtId;
63
+ })) === null || _courts$find === void 0 ? void 0 : _courts$find.name) || 'Court';
64
+ }
65
+ function pickFirstDefined() {
66
+ for (var _len = arguments.length, values = new Array(_len), _key = 0; _key < _len; _key++) {
67
+ values[_key] = arguments[_key];
68
+ }
69
+ return values.find(function (value) {
70
+ return value !== undefined && value !== null && value !== '';
71
+ });
72
+ }
73
+ function asNumber(value) {
74
+ var fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
75
+ var next = Number(value);
76
+ return Number.isFinite(next) ? next : fallback;
77
+ }
78
+ function formatDateKey(date) {
79
+ var year = date.getFullYear();
80
+ var month = "".concat(date.getMonth() + 1).padStart(2, '0');
81
+ var day = "".concat(date.getDate()).padStart(2, '0');
82
+ return "".concat(year, "-").concat(month, "-").concat(day);
83
+ }
84
+ function getNormalizedDateTime(dateKey, hour) {
85
+ var date = new Date("".concat(dateKey, "T00:00:00"));
86
+ if (Number.isNaN(date.getTime())) {
87
+ return {
88
+ date: dateKey,
89
+ time: defaultFormatHourLabel(hour)
90
+ };
91
+ }
92
+ var minutes = Math.round(hour * 60);
93
+ date.setMinutes(date.getMinutes() + minutes);
94
+ return {
95
+ date: formatDateKey(date),
96
+ time: "".concat(String(date.getHours()).padStart(2, '0'), ":").concat(String(date.getMinutes()).padStart(2, '0'))
97
+ };
98
+ }
99
+ function buildSubmitPayload(args) {
100
+ var _itemRaw$metadata, _pickFirstDefined, _itemRaw$metadata2, _itemRaw$metadata3;
101
+ var item = args.item,
102
+ draft = args.draft,
103
+ duration = args.duration,
104
+ nextEndHour = args.nextEndHour,
105
+ targetCourt = args.targetCourt;
106
+ var itemRaw = item.raw || {};
107
+ var itemMetadata = item.metadata || {};
108
+ var targetCourtMetadata = (targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.metadata) || {};
109
+ var firstResource = Array.isArray(item.resources) && item.resources[0] || {};
110
+ var firstResourceMetadata = firstResource.metadata || {};
111
+ var start = getNormalizedDateTime(draft.targetDate, draft.targetHour);
112
+ var end = getNormalizedDateTime(draft.targetDate, nextEndHour);
113
+ var resourceRelationId = pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.relation_id, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.relationId, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.resource_id, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.resourceId, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.id, firstResource.relation_id, item.courtId) || item.courtId;
114
+ return {
115
+ id: pickFirstDefined(item.id, itemRaw.id) || '',
116
+ relation_id: pickFirstDefined(item.relation_id, itemRaw.relation_id, 0) || 0,
117
+ like_status: pickFirstDefined(item.like_status, itemRaw.like_status, 'common') || 'common',
118
+ relation_type: pickFirstDefined(item.relation_type, itemRaw.relation_type, '') || '',
119
+ is_all: asNumber(pickFirstDefined(item.is_all, itemRaw.is_all, 0), 0),
120
+ schedule_id: pickFirstDefined(item.schedule_id, itemRaw.schedule_id, 0) || 0,
121
+ sub_type: pickFirstDefined(item.sub_type, itemRaw.sub_type, 'minutes') || 'minutes',
122
+ select_date: draft.targetDate,
123
+ number: Math.max(1, asNumber(pickFirstDefined(item.number, itemRaw.number, 1), 1)),
124
+ metadata: _objectSpread(_objectSpread(_objectSpread({}, itemRaw.metadata), itemMetadata), {}, {
125
+ slot_count: Math.max(1, asNumber(pickFirstDefined(itemMetadata.slot_count, (_itemRaw$metadata = itemRaw.metadata) === null || _itemRaw$metadata === void 0 ? void 0 : _itemRaw$metadata.slot_count, Math.ceil(Math.max(0, duration * 60) / 30)), 1)),
126
+ resource_id: pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.resource_id, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.resourceId, resourceRelationId, item.courtId),
127
+ venue_booking: (_pickFirstDefined = pickFirstDefined(itemMetadata.venue_booking, (_itemRaw$metadata2 = itemRaw.metadata) === null || _itemRaw$metadata2 === void 0 ? void 0 : _itemRaw$metadata2.venue_booking, true)) !== null && _pickFirstDefined !== void 0 ? _pickFirstDefined : true,
128
+ unique_identification_number: pickFirstDefined(itemMetadata.unique_identification_number, (_itemRaw$metadata3 = itemRaw.metadata) === null || _itemRaw$metadata3 === void 0 ? void 0 : _itemRaw$metadata3.unique_identification_number)
129
+ }),
130
+ resources: [{
131
+ form_id: pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.form_id, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.formId, firstResource.form_id, 0) || 0,
132
+ relation_type: pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.relation_type, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.relationType, firstResource.relation_type, 'form') || 'form',
133
+ relation_id: resourceRelationId,
134
+ capacity: asNumber(pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.capacity, firstResource.capacity, 0), 0),
135
+ like_status: pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.like_status, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.likeStatus, firstResource.like_status, 'common') || 'common',
136
+ metadata: _objectSpread(_objectSpread(_objectSpread({}, firstResourceMetadata), targetCourtMetadata), {}, {
137
+ form_name: pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.form_name, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.formName, targetCourtMetadata.form_name, firstResourceMetadata.form_name) || '',
138
+ resource_name: pickFirstDefined(targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.resource_name, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.resourceName, targetCourtMetadata.resource_name, firstResourceMetadata.resource_name, targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.name) || (targetCourt === null || targetCourt === void 0 ? void 0 : targetCourt.name) || ''
139
+ })
140
+ }],
141
+ start_date: start.date,
142
+ start_time: start.time,
143
+ end_date: end.date,
144
+ end_time: end.time,
145
+ duration: Math.max(0, Math.round(duration * 60))
146
+ };
147
+ }
148
+ function resolveDetail(options, courts) {
149
+ try {
150
+ var _options$getBookingDe;
151
+ return ((_options$getBookingDe = options.getBookingDetailData) === null || _options$getBookingDe === void 0 ? void 0 : _options$getBookingDe.call(options, options.item, courts)) || {};
152
+ } catch (error) {
153
+ return {};
154
+ }
155
+ }
156
+ function buildCustomer(options, detail, selectedCustomer) {
157
+ var _detail$customer, _detail$headerSummary, _detail$customer2, _detail$customer3;
158
+ if (selectedCustomer) {
159
+ return selectedCustomer;
160
+ }
161
+ return {
162
+ name: ((_detail$customer = detail.customer) === null || _detail$customer === void 0 ? void 0 : _detail$customer.name) || ((_detail$headerSummary = detail.headerSummary) === null || _detail$headerSummary === void 0 ? void 0 : _detail$headerSummary.customerName) || options.item.name || 'Customer',
163
+ phone: ((_detail$customer2 = detail.customer) === null || _detail$customer2 === void 0 ? void 0 : _detail$customer2.phone) || options.item.phone || '',
164
+ email: ((_detail$customer3 = detail.customer) === null || _detail$customer3 === void 0 ? void 0 : _detail$customer3.email) || ''
165
+ };
166
+ }
167
+ function destroyActiveInstance() {
168
+ if (!activeInstance) {
169
+ return;
170
+ }
171
+ var _activeInstance = activeInstance,
172
+ container = _activeInstance.container;
173
+ activeInstance = null;
174
+ ReactDOM.unmountComponentAtNode(container);
175
+ if (document.body.contains(container)) {
176
+ document.body.removeChild(container);
177
+ }
178
+ }
179
+ function closeActiveInstance(reason) {
180
+ if (!activeInstance) {
181
+ return;
182
+ }
183
+ var _activeInstance2 = activeInstance,
184
+ reject = _activeInstance2.reject;
185
+ destroyActiveInstance();
186
+ reject(reason);
187
+ }
188
+ var BookingChangeModalRenderer = function BookingChangeModalRenderer(_ref) {
189
+ var _ref2, _options$firstTimelin, _options$endTimelineE, _detail$headerSummary2, _detail$headerSummary3;
190
+ var options = _ref.options,
191
+ onResolve = _ref.onResolve,
192
+ onReject = _ref.onReject;
193
+ var item = options.item,
194
+ _options$courts = options.courts,
195
+ courts = _options$courts === void 0 ? [] : _options$courts,
196
+ visibleCourts = options.visibleCourts,
197
+ _options$bookings = options.bookings,
198
+ bookings = _options$bookings === void 0 ? [] : _options$bookings,
199
+ _options$selectedCust = options.selectedCustomer,
200
+ initialCustomer = _options$selectedCust === void 0 ? null : _options$selectedCust,
201
+ _options$title = options.title,
202
+ title = _options$title === void 0 ? 'Booking information' : _options$title,
203
+ _options$description = options.description,
204
+ description = _options$description === void 0 ? 'Update customer, court, date and time for this booking.' : _options$description,
205
+ _options$confirmText = options.confirmText,
206
+ confirmText = _options$confirmText === void 0 ? 'Confirm' : _options$confirmText,
207
+ _options$cancelText = options.cancelText,
208
+ cancelText = _options$cancelText === void 0 ? 'Cancel' : _options$cancelText,
209
+ _options$closeOnBackd = options.closeOnBackdrop,
210
+ closeOnBackdrop = _options$closeOnBackd === void 0 ? true : _options$closeOnBackd,
211
+ _options$zIndex = options.zIndex,
212
+ zIndex = _options$zIndex === void 0 ? 1072 : _options$zIndex,
213
+ _options$theme = options.theme,
214
+ theme = _options$theme === void 0 ? 'dark' : _options$theme;
215
+ var panelRef = useRef(null);
216
+ var closedRef = useRef(false);
217
+ var timerRef = useRef(null);
218
+ var _useState = useState(false),
219
+ _useState2 = _slicedToArray(_useState, 2),
220
+ visible = _useState2[0],
221
+ setVisible = _useState2[1];
222
+ var _useState3 = useState(false),
223
+ _useState4 = _slicedToArray(_useState3, 2),
224
+ customerLoading = _useState4[0],
225
+ setCustomerLoading = _useState4[1];
226
+ var _useState5 = useState(false),
227
+ _useState6 = _slicedToArray(_useState5, 2),
228
+ submitLoading = _useState6[0],
229
+ setSubmitLoading = _useState6[1];
230
+ var _useState7 = useState(''),
231
+ _useState8 = _slicedToArray(_useState7, 2),
232
+ submitError = _useState8[0],
233
+ setSubmitError = _useState8[1];
234
+ var _useState9 = useState(initialCustomer),
235
+ _useState10 = _slicedToArray(_useState9, 2),
236
+ selectedCustomer = _useState10[0],
237
+ setSelectedCustomer = _useState10[1];
238
+ var _useState11 = useState({
239
+ targetCourtId: options.targetCourtId,
240
+ targetDate: options.targetDate,
241
+ targetHour: options.targetHour
242
+ }),
243
+ _useState12 = _slicedToArray(_useState11, 2),
244
+ draft = _useState12[0],
245
+ setDraft = _useState12[1];
246
+ var mergedCourts = useMemo(function () {
247
+ var source = (visibleCourts && visibleCourts.length > 0 ? visibleCourts : courts) || [];
248
+ if (source.length > 0) {
249
+ return source;
250
+ }
251
+ var fallbackIds = [item.courtId, draft.targetCourtId].filter(Boolean);
252
+ var uniqueIds = Array.from(new Set(fallbackIds));
253
+ return uniqueIds.map(function (courtId) {
254
+ return {
255
+ id: courtId,
256
+ name: courtId
257
+ };
258
+ });
259
+ }, [courts, draft.targetCourtId, item.courtId, visibleCourts]);
260
+ var allCourts = useMemo(function () {
261
+ if (courts.length > 0) {
262
+ return courts;
263
+ }
264
+ return mergedCourts;
265
+ }, [courts, mergedCourts]);
266
+ var targetCourt = useMemo(function () {
267
+ return allCourts.find(function (court) {
268
+ return court.id === draft.targetCourtId;
269
+ });
270
+ }, [allCourts, draft.targetCourtId]);
271
+ var detail = useMemo(function () {
272
+ return resolveDetail(options, allCourts);
273
+ }, [allCourts, options]);
274
+ var currentCustomer = useMemo(function () {
275
+ return buildCustomer(options, detail, selectedCustomer);
276
+ }, [detail, options, selectedCustomer]);
277
+ var hourSlots = useMemo(function () {
278
+ return options.hourSlots && options.hourSlots.length > 0 ? options.hourSlots : getFallbackHourSlots();
279
+ }, [options.hourSlots]);
280
+ var formatHourLabel = options.formatHourLabel || defaultFormatHourLabel;
281
+ var isBusinessHour = options.isBusinessHour || function () {
282
+ return true;
283
+ };
284
+ var availableHours = useMemo(function () {
285
+ var filtered = hourSlots.filter(function (hour) {
286
+ return isBusinessHour(hour);
287
+ });
288
+ return filtered.length > 0 ? filtered : hourSlots;
289
+ }, [hourSlots, isBusinessHour]);
290
+ var hourStep = useMemo(function () {
291
+ return getHourStep(hourSlots);
292
+ }, [hourSlots]);
293
+ var firstTimelineHour = (_ref2 = (_options$firstTimelin = options.firstTimelineHour) !== null && _options$firstTimelin !== void 0 ? _options$firstTimelin : Math.min.apply(Math, _toConsumableArray(hourSlots))) !== null && _ref2 !== void 0 ? _ref2 : 0;
294
+ var endTimelineExclusive = (_options$endTimelineE = options.endTimelineExclusive) !== null && _options$endTimelineE !== void 0 ? _options$endTimelineE : Math.max.apply(Math, _toConsumableArray(hourSlots)) + hourStep;
295
+ var duration = item.endHour - item.startHour;
296
+ var nextStartHour = draft.targetHour;
297
+ var nextEndHour = nextStartHour + duration;
298
+ var originalDate = item.date;
299
+ var originalStart = formatHourLabel(item.startHour);
300
+ var originalEnd = formatHourLabel(item.endHour);
301
+ var originalCourtName = getCourtName(allCourts, item.courtId) || ((_detail$headerSummary2 = detail.headerSummary) === null || _detail$headerSummary2 === void 0 ? void 0 : _detail$headerSummary2.resourceLabel) || 'Court';
302
+ var nextCourtName = getCourtName(allCourts, draft.targetCourtId) || ((_detail$headerSummary3 = detail.headerSummary) === null || _detail$headerSummary3 === void 0 ? void 0 : _detail$headerSummary3.resourceLabel) || 'Court';
303
+ var changed = originalDate !== draft.targetDate || item.courtId !== draft.targetCourtId || item.startHour !== nextStartHour;
304
+ var isDragScenario = item.date !== options.targetDate || item.startHour !== options.targetHour || item.courtId !== options.targetCourtId;
305
+ var hasConflict = options.hasConflict || function () {
306
+ return false;
307
+ };
308
+ var conflict = hasConflict(bookings, draft.targetCourtId, draft.targetDate, nextStartHour, nextEndHour, item.id);
309
+ var isLight = theme === 'light';
310
+ var finishClose = function finishClose(type, payload) {
311
+ if (closedRef.current) {
312
+ return;
313
+ }
314
+ closedRef.current = true;
315
+ setVisible(false);
316
+ timerRef.current = window.setTimeout(function () {
317
+ if (type === 'resolve') {
318
+ onResolve(payload);
319
+ } else {
320
+ onReject(payload);
321
+ }
322
+ }, CLOSE_ANIMATION_MS);
323
+ };
324
+ var handleCancel = function handleCancel(reasonType) {
325
+ if (submitLoading) {
326
+ return;
327
+ }
328
+ finishClose('reject', {
329
+ type: reasonType
330
+ });
331
+ };
332
+ useEffect(function () {
333
+ var rafId = window.requestAnimationFrame(function () {
334
+ setVisible(true);
335
+ });
336
+ var previousOverflow = document.body.style.overflow;
337
+ document.body.style.overflow = 'hidden';
338
+ var onKeyDown = function onKeyDown(event) {
339
+ if (event.key === 'Escape') {
340
+ handleCancel('escape');
341
+ }
342
+ };
343
+ window.addEventListener('keydown', onKeyDown);
344
+ return function () {
345
+ window.cancelAnimationFrame(rafId);
346
+ window.removeEventListener('keydown', onKeyDown);
347
+ document.body.style.overflow = previousOverflow;
348
+ if (timerRef.current) {
349
+ window.clearTimeout(timerRef.current);
350
+ }
351
+ };
352
+ }, []);
353
+
354
+ /** Keep customer picking delegated to the caller. */
355
+ var handleCustomerChange = /*#__PURE__*/function () {
356
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
357
+ var _result;
358
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
359
+ while (1) switch (_context.prev = _context.next) {
360
+ case 0:
361
+ if (!(!options.onCustomerChange || customerLoading)) {
362
+ _context.next = 2;
363
+ break;
364
+ }
365
+ return _context.abrupt("return");
366
+ case 2:
367
+ setCustomerLoading(true);
368
+ _context.prev = 3;
369
+ _context.next = 6;
370
+ return options.onCustomerChange({
371
+ item: item,
372
+ customer: currentCustomer,
373
+ draft: draft,
374
+ options: options
375
+ });
376
+ case 6:
377
+ _result = _context.sent;
378
+ if (_result) {
379
+ setSelectedCustomer(_result);
380
+ }
381
+ case 8:
382
+ _context.prev = 8;
383
+ setCustomerLoading(false);
384
+ return _context.finish(8);
385
+ case 11:
386
+ case "end":
387
+ return _context.stop();
388
+ }
389
+ }, _callee, null, [[3,, 8, 11]]);
390
+ }));
391
+ return function handleCustomerChange() {
392
+ return _ref3.apply(this, arguments);
393
+ };
394
+ }();
395
+ var handleConfirm = /*#__PURE__*/function () {
396
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
397
+ var resultBase, submitResult, message;
398
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
399
+ while (1) switch (_context2.prev = _context2.next) {
400
+ case 0:
401
+ if (!(conflict || submitLoading)) {
402
+ _context2.next = 2;
403
+ break;
404
+ }
405
+ return _context2.abrupt("return");
406
+ case 2:
407
+ setSubmitError('');
408
+ resultBase = {
409
+ item: item,
410
+ original: {
411
+ targetCourtId: options.targetCourtId,
412
+ targetDate: options.targetDate,
413
+ targetHour: options.targetHour
414
+ },
415
+ draft: draft,
416
+ customer: currentCustomer,
417
+ duration: duration,
418
+ nextEndHour: nextEndHour,
419
+ changed: changed,
420
+ submitPayload: buildSubmitPayload({
421
+ item: item,
422
+ draft: draft,
423
+ duration: duration,
424
+ nextEndHour: nextEndHour,
425
+ targetCourt: targetCourt
426
+ })
427
+ };
428
+ if (options.onSubmit) {
429
+ _context2.next = 7;
430
+ break;
431
+ }
432
+ finishClose('resolve', resultBase);
433
+ return _context2.abrupt("return");
434
+ case 7:
435
+ setSubmitLoading(true);
436
+ _context2.prev = 8;
437
+ _context2.next = 11;
438
+ return options.onSubmit(_objectSpread(_objectSpread({}, resultBase), {}, {
439
+ options: options
440
+ }));
441
+ case 11:
442
+ submitResult = _context2.sent;
443
+ finishClose('resolve', _objectSpread(_objectSpread({}, resultBase), {}, {
444
+ submitResult: submitResult
445
+ }));
446
+ _context2.next = 19;
447
+ break;
448
+ case 15:
449
+ _context2.prev = 15;
450
+ _context2.t0 = _context2["catch"](8);
451
+ message = (_context2.t0 === null || _context2.t0 === void 0 ? void 0 : _context2.t0.message) || options.submitErrorMessage || 'Submit failed. Please try again.';
452
+ setSubmitError(message);
453
+ case 19:
454
+ _context2.prev = 19;
455
+ setSubmitLoading(false);
456
+ return _context2.finish(19);
457
+ case 22:
458
+ case "end":
459
+ return _context2.stop();
460
+ }
461
+ }, _callee2, null, [[8, 15, 19, 22]]);
462
+ }));
463
+ return function handleConfirm() {
464
+ return _ref4.apply(this, arguments);
465
+ };
466
+ }();
467
+ return /*#__PURE__*/React.createElement("div", {
468
+ className: ['pisell-booking-change-modal', visible ? 'is-visible' : '', isLight ? 'is-light' : 'is-dark'].filter(Boolean).join(' '),
469
+ style: {
470
+ zIndex: zIndex
471
+ },
472
+ onMouseDown: function onMouseDown(event) {
473
+ if (event.target === event.currentTarget && closeOnBackdrop) {
474
+ handleCancel('backdrop');
475
+ }
476
+ }
477
+ }, /*#__PURE__*/React.createElement("div", {
478
+ ref: panelRef,
479
+ className: "pisell-booking-change-modal__panel",
480
+ onMouseDown: function onMouseDown(event) {
481
+ return event.stopPropagation();
482
+ }
483
+ }, /*#__PURE__*/React.createElement("div", {
484
+ className: "pisell-booking-change-modal__title"
485
+ }, title), /*#__PURE__*/React.createElement("div", {
486
+ className: "pisell-booking-change-modal__description"
487
+ }, description), /*#__PURE__*/React.createElement("div", {
488
+ className: "pisell-booking-change-modal__body"
489
+ }, /*#__PURE__*/React.createElement("div", {
490
+ className: "pisell-booking-change-modal__card"
491
+ }, /*#__PURE__*/React.createElement("div", {
492
+ className: "pisell-booking-change-modal__customer"
493
+ }, /*#__PURE__*/React.createElement("div", {
494
+ className: "pisell-booking-change-modal__customer-info"
495
+ }, /*#__PURE__*/React.createElement("div", {
496
+ className: "pisell-booking-change-modal__section-label"
497
+ }, "Customer"), /*#__PURE__*/React.createElement("div", {
498
+ className: "pisell-booking-change-modal__customer-name"
499
+ }, currentCustomer.name), /*#__PURE__*/React.createElement("div", {
500
+ className: "pisell-booking-change-modal__customer-meta"
501
+ }, currentCustomer.phone || 'No phone'), /*#__PURE__*/React.createElement("div", {
502
+ className: "pisell-booking-change-modal__customer-meta"
503
+ }, currentCustomer.email || 'No email')), /*#__PURE__*/React.createElement("button", {
504
+ type: "button",
505
+ onClick: handleCustomerChange,
506
+ disabled: !options.onCustomerChange || customerLoading,
507
+ className: "pisell-booking-change-modal__ghost-button"
508
+ }, customerLoading ? 'Loading...' : 'Change'))), /*#__PURE__*/React.createElement("div", {
509
+ className: "pisell-booking-change-modal__grid"
510
+ }, /*#__PURE__*/React.createElement("div", {
511
+ className: "pisell-booking-change-modal__field"
512
+ }, /*#__PURE__*/React.createElement("label", {
513
+ className: "pisell-booking-change-modal__field-label"
514
+ }, "Court"), /*#__PURE__*/React.createElement("select", {
515
+ value: draft.targetCourtId,
516
+ onChange: function onChange(event) {
517
+ return setDraft(function (prev) {
518
+ return _objectSpread(_objectSpread({}, prev), {}, {
519
+ targetCourtId: event.target.value
520
+ });
521
+ });
522
+ },
523
+ className: "pisell-booking-change-modal__control"
524
+ }, mergedCourts.map(function (court) {
525
+ return /*#__PURE__*/React.createElement("option", {
526
+ key: court.id,
527
+ value: court.id
528
+ }, court.name);
529
+ }))), /*#__PURE__*/React.createElement("div", {
530
+ className: "pisell-booking-change-modal__field"
531
+ }, /*#__PURE__*/React.createElement("label", {
532
+ className: "pisell-booking-change-modal__field-label"
533
+ }, "New date"), /*#__PURE__*/React.createElement("input", {
534
+ type: "date",
535
+ value: draft.targetDate,
536
+ onChange: function onChange(event) {
537
+ return setDraft(function (prev) {
538
+ return _objectSpread(_objectSpread({}, prev), {}, {
539
+ targetDate: event.target.value
540
+ });
541
+ });
542
+ },
543
+ className: "pisell-booking-change-modal__control"
544
+ }))), /*#__PURE__*/React.createElement("div", {
545
+ className: "pisell-booking-change-modal__grid"
546
+ }, /*#__PURE__*/React.createElement("div", {
547
+ className: "pisell-booking-change-modal__field"
548
+ }, /*#__PURE__*/React.createElement("label", {
549
+ className: "pisell-booking-change-modal__field-label"
550
+ }, "New start time"), /*#__PURE__*/React.createElement("select", {
551
+ value: nextStartHour,
552
+ onChange: function onChange(event) {
553
+ return setDraft(function (prev) {
554
+ return _objectSpread(_objectSpread({}, prev), {}, {
555
+ targetHour: Number(event.target.value)
556
+ });
557
+ });
558
+ },
559
+ className: "pisell-booking-change-modal__control"
560
+ }, availableHours.map(function (hour) {
561
+ var disabled = hour + duration > endTimelineExclusive || hasConflict(bookings, draft.targetCourtId, draft.targetDate, hour, hour + duration, item.id);
562
+ return /*#__PURE__*/React.createElement("option", {
563
+ key: hour,
564
+ value: hour,
565
+ disabled: disabled
566
+ }, disabled ? "Unavailable ".concat(formatHourLabel(hour)) : formatHourLabel(hour));
567
+ }))), /*#__PURE__*/React.createElement("div", {
568
+ className: "pisell-booking-change-modal__field"
569
+ }, /*#__PURE__*/React.createElement("label", {
570
+ className: "pisell-booking-change-modal__field-label"
571
+ }, "New end time"), /*#__PURE__*/React.createElement("select", {
572
+ value: nextEndHour,
573
+ onChange: function onChange(event) {
574
+ var targetEndHour = Number(event.target.value);
575
+ setDraft(function (prev) {
576
+ return _objectSpread(_objectSpread({}, prev), {}, {
577
+ targetHour: targetEndHour - duration
578
+ });
579
+ });
580
+ },
581
+ className: "pisell-booking-change-modal__control"
582
+ }, availableHours.map(function (hour) {
583
+ var startHour = hour - duration;
584
+ var disabled = startHour < firstTimelineHour || hasConflict(bookings, draft.targetCourtId, draft.targetDate, startHour, hour, item.id);
585
+ return /*#__PURE__*/React.createElement("option", {
586
+ key: "end-".concat(hour),
587
+ value: hour,
588
+ disabled: disabled
589
+ }, disabled ? "Unavailable ".concat(formatHourLabel(hour)) : formatHourLabel(hour));
590
+ })))), changed && /*#__PURE__*/React.createElement("div", {
591
+ className: "pisell-booking-change-modal__card"
592
+ }, /*#__PURE__*/React.createElement("div", {
593
+ className: "pisell-booking-change-modal__section-label"
594
+ }, "Previous booking info"), /*#__PURE__*/React.createElement("div", {
595
+ className: "pisell-booking-change-modal__compare-grid"
596
+ }, /*#__PURE__*/React.createElement("div", {
597
+ className: "pisell-booking-change-modal__compare-card"
598
+ }, /*#__PURE__*/React.createElement("div", {
599
+ className: "pisell-booking-change-modal__compare-title"
600
+ }, "Original"), /*#__PURE__*/React.createElement("div", {
601
+ className: "pisell-booking-change-modal__compare-value"
602
+ }, originalCourtName), /*#__PURE__*/React.createElement("div", {
603
+ className: "pisell-booking-change-modal__compare-value"
604
+ }, originalDate), /*#__PURE__*/React.createElement("div", {
605
+ className: "pisell-booking-change-modal__compare-value"
606
+ }, originalStart, " - ", originalEnd)), /*#__PURE__*/React.createElement("div", {
607
+ className: "pisell-booking-change-modal__compare-card is-highlighted"
608
+ }, /*#__PURE__*/React.createElement("div", {
609
+ className: "pisell-booking-change-modal__compare-title"
610
+ }, isDragScenario ? 'Drop target' : 'Updated'), /*#__PURE__*/React.createElement("div", {
611
+ className: "pisell-booking-change-modal__compare-value"
612
+ }, nextCourtName), /*#__PURE__*/React.createElement("div", {
613
+ className: "pisell-booking-change-modal__compare-value"
614
+ }, draft.targetDate), /*#__PURE__*/React.createElement("div", {
615
+ className: "pisell-booking-change-modal__compare-value"
616
+ }, formatHourLabel(nextStartHour), " - ", formatHourLabel(nextEndHour)))))), conflict && /*#__PURE__*/React.createElement("div", {
617
+ className: "pisell-booking-change-modal__error"
618
+ }, "The selected date, court, or time range is unavailable. Please choose an available option."), !conflict && submitError && /*#__PURE__*/React.createElement("div", {
619
+ className: "pisell-booking-change-modal__error"
620
+ }, submitError), /*#__PURE__*/React.createElement("div", {
621
+ className: "pisell-booking-change-modal__footer"
622
+ }, /*#__PURE__*/React.createElement("button", {
623
+ type: "button",
624
+ onClick: function onClick() {
625
+ return handleCancel('cancel');
626
+ },
627
+ disabled: submitLoading,
628
+ className: "pisell-booking-change-modal__ghost-button"
629
+ }, cancelText), /*#__PURE__*/React.createElement("button", {
630
+ type: "button",
631
+ disabled: conflict || submitLoading,
632
+ onClick: handleConfirm,
633
+ className: "pisell-booking-change-modal__primary-button"
634
+ }, submitLoading ? 'Submitting...' : confirmText))));
635
+ };
636
+
637
+ /**
638
+ * Open the booking change modal as a Promise-based singleton.
639
+ */
640
+ function open(options) {
641
+ if (typeof window === 'undefined' || typeof document === 'undefined') {
642
+ return Promise.reject({
643
+ type: 'programmatic-close',
644
+ message: 'bookingChangeModal can only open in a browser environment.'
645
+ });
646
+ }
647
+ if (activeInstance) {
648
+ closeActiveInstance({
649
+ type: 'replaced',
650
+ message: 'A new booking change modal replaced the current one.'
651
+ });
652
+ }
653
+ var container = document.createElement('div');
654
+ document.body.appendChild(container);
655
+ return new Promise(function (resolve, reject) {
656
+ activeInstance = {
657
+ container: container,
658
+ reject: reject
659
+ };
660
+ var handleResolve = function handleResolve(result) {
661
+ destroyActiveInstance();
662
+ resolve(result);
663
+ };
664
+ var handleReject = function handleReject(reason) {
665
+ destroyActiveInstance();
666
+ reject(reason);
667
+ };
668
+ ReactDOM.render( /*#__PURE__*/React.createElement(BookingChangeModalRenderer, {
669
+ options: options,
670
+ onResolve: handleResolve,
671
+ onReject: handleReject
672
+ }), container);
673
+ });
674
+ }
675
+ function close(reason) {
676
+ closeActiveInstance(reason || {
677
+ type: 'programmatic-close'
678
+ });
679
+ }
680
+ var bookingChangeModal = {
681
+ open: open,
682
+ close: close
683
+ };
684
+ export { open as openBookingChangeModal, close as closeBookingChangeModal };
685
+ export default bookingChangeModal;