1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="b103cc16-c8d7-9cb3-29d6-05866152c5d5")}catch(e){}}(); 2(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([typeof document === "object" ? document.currentScript : undefined, 3620825, ((__turbopack_context__) => { 4"use strict"; 5 6function formatMoney(value) { 7 const { format } = new Intl.NumberFormat("nl-NL", { 8 currency: "EUR", 9 style: "currency", 10 maximumFractionDigits: 2, 11 minimumFractionDigits: 2 12 }); 13 const formattedValue = format(value); 14 const formattedWithoutCurrency = formattedValue.replace("â¬", "").trim(); 15 if (Number.isInteger(value)) { 16 return formattedWithoutCurrency.replace(",00", ",-"); 17 } 18 // Check if the value is effectively a whole number by rounding to two decimal places 19 // E.g. 12.002 = true, 12.006 = false 20 if (Number.isInteger(Math.round(value * 100) / 100)) { 21 return formattedWithoutCurrency.replace(",00", ",-"); 22 } 23 return formattedWithoutCurrency; 24} 25function splitFormattedMoney(formatted) { 26 const commaIndex = formatted.indexOf(","); 27 if (commaIndex === -1) return { 28 integer: formatted, 29 decimal: ",-" 30 }; 31 return { 32 integer: formatted.slice(0, commaIndex), 33 decimal: formatted.slice(commaIndex) 34 }; 35} 36__turbopack_context__.s([ 37 "default", 38 0, 39 formatMoney, 40 "splitFormattedMoney", 41 0, 42 splitFormattedMoney 43]); 44}), 45794909, ((__turbopack_context__, module, exports) => { 46"use strict"; 47 48var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 49"use strict"; 50Object.defineProperty(exports, "__esModule", { 51 value: true 52}); 530 && (module.exports = { 54 default: null, 55 getImageProps: null 56}); 57function _export(target, all) { 58 for(var name in all)Object.defineProperty(target, name, { 59 enumerable: true, 60 get: all[name] 61 }); 62} 63_export(exports, { 64 default: function() { 65 return _default; 66 }, 67 getImageProps: function() { 68 return getImageProps; 69 } 70}); 71const _interop_require_default = __turbopack_context__.r(563141); 72const _getimgprops = __turbopack_context__.r(908927); 73const _imagecomponent = __turbopack_context__.r(605500); 74const _imageloader = /*#__PURE__*/ _interop_require_default._(__turbopack_context__.r(1948)); 75function getImageProps(imgProps) { 76 const { props } = (0, _getimgprops.getImgProps)(imgProps, { 77 defaultLoader: _imageloader.default, 78 // This is replaced by webpack define plugin 79 imgConf: ("TURBOPACK compile-time value", { 80 "deviceSizes": ("TURBOPACK compile-time value", [ 81 ("TURBOPACK compile-time value", 640), 82 ("TURBOPACK compile-time value", 750), 83 ("TURBOPACK compile-time value", 828), 84 ("TURBOPACK compile-time value", 1080), 85 ("TURBOPACK compile-time value", 1200), 86 ("TURBOPACK compile-time value", 1920), 87 ("TURBOPACK compile-time value", 2048), 88 ("TURBOPACK compile-time value", 3840) 89 ]), 90 "imageSizes": ("TURBOPACK compile-time value", [ 91 ("TURBOPACK compile-time value", 32), 92 ("TURBOPACK compile-time value", 48), 93 ("TURBOPACK compile-time value", 64), 94 ("TURBOPACK compile-time value", 96), 95 ("TURBOPACK compile-time value", 128), 96 ("TURBOPACK compile-time value", 256), 97 ("TURBOPACK compile-time value", 384) 98 ]), 99 "qualities": ("TURBOPACK compile-time value", [ 100 ("TURBOPACK compile-time value", 75) 101 ]), 102 "path": ("TURBOPACK compile-time value", "/_next/image"), 103 "loader": ("TURBOPACK compile-time value", "default"), 104 "dangerouslyAllowSVG": ("TURBOPACK compile-time value", false), 105 "unoptimized": ("TURBOPACK compile-time value", false) 106 }) 107 }); 108 // Normally we don't care about undefined props because we pass to JSX, 109 // but this exported function could be used by the end user for anything 110 // so we delete undefined props to clean it up a little. 111 for (const [key, value] of Object.entries(props)){ 112 if (value === undefined) { 113 delete props[key]; 114 } 115 } 116 return { 117 props 118 }; 119} 120const _default = _imagecomponent.Image; 121}),
122657688, ((__turbopack_context__, module, exports) => { 123 124module.exports = __turbopack_context__.r(794909); 125}), 126580317, ((__turbopack_context__) => { 127"use strict"; 128 129var __TURBOPACK__imported__module__843476__ = __turbopack_context__.i(843476); 130var __TURBOPACK__imported__module__657688__ = __turbopack_context__.i(657688); 131"use client"; 132; 133; 134const loader = (param)=>{ 135 let { src, width, quality } = param; 136 return "".concat(src, "?w=").concat(width, "&q=").concat(quality !== null && quality !== void 0 ? quality : 75); 137}; 138function BackendImage(props) { 139 return /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])(__TURBOPACK__imported__module__657688__["default"], { 140 ...props, 141 loader: loader 142 }); 143} 144__turbopack_context__.s([ 145 "BackendImage", 146 0, 147 BackendImage, 148 "loader", 149 0, 150 loader 151]); 152}), 153209019, ((__turbopack_context__) => { 154"use strict"; 155 156var __TURBOPACK__imported__module__845110__ = __turbopack_context__.i(845110); 157var __TURBOPACK__imported__module__381515__ = __turbopack_context__.i(381515); 158; 159; 160function differenceInDays(laterDate, earlierDate, options) { 161 const [laterDate_, earlierDate_] = (0, __TURBOPACK__imported__module__845110__["normalizeDates"])(options === null || options === void 0 ? void 0 : options.in, laterDate, earlierDate); 162 const sign = compareLocalAsc(laterDate_, earlierDate_); 163 const difference = Math.abs((0, __TURBOPACK__imported__module__381515__["differenceInCalendarDays"])(laterDate_, earlierDate_)); 164 laterDate_.setDate(laterDate_.getDate() - sign * difference); 165 // Math.abs(diff in full days - diff in calendar days) === 1 if last calendar day is not full 166 // If so, result must be decreased by 1 in absolute value 167 const isLastDayNotFull = Number(compareLocalAsc(laterDate_, earlierDate_) === -sign); 168 const result = sign * (difference - isLastDayNotFull); 169 // Prevent negative zero 170 return result === 0 ? 0 : result; 171} 172// Like `compareAsc` but uses local time not UTC, which is needed 173// for accurate equality comparisons of UTC timestamps that end up 174// having the same representation in local time, e.g. one hour before 175// DST ends vs. the instant that DST ends. 176function compareLocalAsc(laterDate, earlierDate) { 177 const diff = laterDate.getFullYear() - earlierDate.getFullYear() || laterDate.getMonth() - earlierDate.getMonth() || laterDate.getDate() - earlierDate.getDate() || laterDate.getHours() - earlierDate.getHours() || laterDate.getMinutes() - earlierDate.getMinutes() || laterDate.getSeconds() - earlierDate.getSeconds() || laterDate.getMilliseconds() - earlierDate.getMilliseconds(); 178 if (diff < 0) return -1; 179 if (diff > 0) return 1; 180 // Return 0 if diff is 0; return NaN if diff is NaN 181 return diff; 182} 183const __TURBOPACK__default__export__ = differenceInDays; 184__turbopack_context__.s([ 185 "differenceInDays", 186 0, 187 differenceInDays 188]); 189}), 19083064, ((__turbopack_context__) => { 191"use strict"; 192 193var __TURBOPACK__imported__module__843476__ = __turbopack_context__.i(843476); 194; 195function Spinner(props) { 196 return /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])("svg", { 197 "aria-hidden": "true",
198 viewBox: "0 0 38 38", 199 xmlns: "http://www.w3.org/2000/svg", 200 stroke: "currentColor", 201 ...props, 202 children: /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])("g", { 203 fill: "none", 204 fillRule: "evenodd", 205 children: /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsxs"])("g", { 206 transform: "translate(1 1)", 207 strokeWidth: "2", 208 children: [ 209 /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])("circle", { 210 strokeOpacity: ".5", 211 cx: "18", 212 cy: "18", 213 r: "18" 214 }), 215 /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])("path", { 216 d: "M36 18c0-9.94-8.06-18-18-18", 217 children: /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])("animateTransform", { 218 attributeName: "transform", 219 type: "rotate", 220 from: "0 18 18", 221 to: "360 18 18", 222 dur: "1s", 223 repeatCount: "indefinite" 224 }) 225 }) 226 ] 227 }) 228 }) 229 }); 230} 231__turbopack_context__.s([ 232 "default", 233 0, 234 Spinner 235]); 236}), 237671857, ((__turbopack_context__) => { 238"use strict"; 239 240var __TURBOPACK__imported__module__281092__ = __turbopack_context__.i(281092); 241; 242function isAfter(date, dateToCompare) { 243 return +(0, __TURBOPACK__imported__module__281092__["toDate"])(date) > +(0, __TURBOPACK__imported__module__281092__["toDate"])(dateToCompare); 244} 245const __TURBOPACK__default__export__ = isAfter; 246__turbopack_context__.s([ 247 "isAfter", 248 0, 249 isAfter 250]); 251}), 252433331, ((__turbopack_context__) => { 253"use strict"; 254 255var __TURBOPACK__imported__module__595727__ = __turbopack_context__.i(595727); 256; 257function addWeeks(date, amount, options) { 258 return (0, __TURBOPACK__imported__module__595727__["addDays"])(date, amount * 7, options); 259} 260const __TURBOPACK__default__export__ = addWeeks; 261__turbopack_context__.s([ 262 "addWeeks", 263 0, 264 addWeeks 265]); 266}), 267952027, 551068, 268((__turbopack_context__) => { 269"use strict"; 270 271// MERGED MODULE: [project]/node_modules/date-fns/addHours.js [app-client] (ecmascript) 272; 273// MERGED MODULE: [project]/node_modules/date-fns/addMilliseconds.js [app-client] (ecmascript) 274; 275var __TURBOPACK__imported__module__677241__ = __turbopack_context__.i(677241); 276var __TURBOPACK__imported__module__281092__ = __turbopack_context__.i(281092); 277; 278; 279function addMilliseconds(date, amount, options) { 280 return (0, __TURBOPACK__imported__module__677241__["constructFrom"])((options === null || options === void 0 ? void 0 : options.in) || date, +(0, __TURBOPACK__imported__module__281092__["toDate"])(date) + amount); 281} 282const __TURBOPACK__default__export__ = addMilliseconds; 283__turbopack_context__.s([ 284 "addMilliseconds", 285 0, 286 addMilliseconds 287], 551068); 288var __TURBOPACK__imported__module__234662__ = __turbopack_context__.i(234662); 289; 290; 291function addHours(date, amount, options) { 292 return addMilliseconds(date, amount * __TURBOPACK__imported__module__234662__["millisecondsInHour"], options); 293} 294const __TURBOPACK__default__export__1 = addHours; 295__turbopack_context__.s([ 296 "addHours", 297 0, 298 addHours 299], 952027); 300}), 301755838, ((__turbopack_context__, module, exports) => { 302"use strict"; 303 304/** 305 * @license React 306 * use-sync-external-store-shim.production.js 307 * 308 * Copyright (c) Meta Platforms, Inc. and affiliates. 309 * 310 * This source code is licensed under the MIT license found in the 311 * LICENSE file in the root directory of this source tree. 312 */ var React = __turbopack_context__.r(271645); 313function is(x, y) { 314 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 315} 316var objectIs = "function" === typeof Object.is ? Object.is : is, useState = React.useState, useEffect = React.useEffect, useLayoutEffect = React.useLayoutEffect, useDebugValue = React.useDebugValue; 317function useSyncExternalStore$2(subscribe, getSnapshot) { 318 var value = getSnapshot(), _useState = useState({ 319 inst: { 320 value: value, 321 getSnapshot: getSnapshot 322 } 323 }), inst = _useState[0].inst, forceUpdate = _useState[1]; 324 useLayoutEffect(function() { 325 inst.value = value; 326 inst.getSnapshot = getSnapshot;
327 checkIfSnapshotChanged(inst) && forceUpdate({ 328 inst: inst 329 }); 330 }, [ 331 subscribe, 332 value, 333 getSnapshot 334 ]); 335 useEffect(function() { 336 checkIfSnapshotChanged(inst) && forceUpdate({ 337 inst: inst 338 }); 339 return subscribe(function() { 340 checkIfSnapshotChanged(inst) && forceUpdate({ 341 inst: inst 342 }); 343 }); 344 }, [ 345 subscribe 346 ]); 347 useDebugValue(value); 348 return value; 349} 350function checkIfSnapshotChanged(inst) { 351 var latestGetSnapshot = inst.getSnapshot; 352 inst = inst.value; 353 try { 354 var nextValue = latestGetSnapshot(); 355 return !objectIs(inst, nextValue); 356 } catch (error) { 357 return !0; 358 } 359} 360function useSyncExternalStore$1(subscribe, getSnapshot) { 361 return getSnapshot(); 362} 363var shim = "undefined" === typeof window || "undefined" === typeof window.document || "undefined" === typeof window.document.createElement ? useSyncExternalStore$1 : useSyncExternalStore$2; 364exports.useSyncExternalStore = void 0 !== React.useSyncExternalStore ? React.useSyncExternalStore : shim; 365}), 366802239, ((__turbopack_context__, module, exports) => { 367"use strict"; 368 369var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 370'use strict'; 371if ("TURBOPACK compile-time truthy", 1) { 372 module.exports = __turbopack_context__.r(755838); 373} else //TURBOPACK unreachable 374; 375}), 376752822, ((__turbopack_context__, module, exports) => { 377"use strict"; 378 379/** 380 * @license React 381 * use-sync-external-store-shim/with-selector.production.js 382 * 383 * Copyright (c) Meta Platforms, Inc. and affiliates. 384 * 385 * This source code is licensed under the MIT license found in the 386 * LICENSE file in the root directory of this source tree. 387 */ var React = __turbopack_context__.r(271645), shim = __turbopack_context__.r(802239); 388function is(x, y) { 389 return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y; 390} 391var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = shim.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo = React.useMemo, useDebugValue = React.useDebugValue; 392exports.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 393 var instRef = useRef(null); 394 if (null === instRef.current) { 395 var inst = { 396 hasValue: !1, 397 value: null 398 }; 399 instRef.current = inst; 400 } else inst = instRef.current; 401 instRef = useMemo(function() { 402 function memoizedSelector(nextSnapshot) { 403 if (!hasMemo) { 404 hasMemo = !0; 405 memoizedSnapshot = nextSnapshot; 406 nextSnapshot = selector(nextSnapshot); 407 if (void 0 !== isEqual && inst.hasValue) { 408 var currentSelection = inst.value; 409 if (isEqual(currentSelection, nextSnapshot)) return memoizedSelection = currentSelection; 410 } 411 return memoizedSelection = nextSnapshot; 412 } 413 currentSelection = memoizedSelection; 414 if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection; 415 var nextSelection = selector(nextSnapshot); 416 if (void 0 !== isEqual && isEqual(currentSelection, nextSelection)) return memoizedSnapshot = nextSnapshot, currentSelection; 417 memoizedSnapshot = nextSnapshot; 418 return memoizedSelection = nextSelection; 419 } 420 var hasMemo = !1, memoizedSnapshot, memoizedSelection, maybeGetServerSnapshot = void 0 === getServerSnapshot ? null : getServerSnapshot; 421 return [ 422 function() { 423 return memoizedSelector(getSnapshot()); 424 }, 425 null === maybeGetServerSnapshot ? void 0 : function() { 426 return memoizedSelector(maybeGetServerSnapshot()); 427 } 428 ]; 429 }, [ 430 getSnapshot, 431 getServerSnapshot, 432 selector, 433 isEqual 434 ]); 435 var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]); 436 useEffect(function() { 437 inst.hasValue = !0; 438 inst.value = value; 439 }, [ 440 value 441 ]); 442 useDebugValue(value); 443 return value; 444}; 445}),
446430224, ((__turbopack_context__, module, exports) => { 447"use strict"; 448 449var __TURBOPACK__imported__module__247167__ = /*#__PURE__*/ __turbopack_context__.i(247167); 450'use strict'; 451if ("TURBOPACK compile-time truthy", 1) { 452 module.exports = __turbopack_context__.r(752822); 453} else //TURBOPACK unreachable 454; 455}), 456733803, ((__turbopack_context__, module, exports) => { 457 458var Symbol = __turbopack_context__.r(630353), isArguments = __turbopack_context__.r(473250), isArray = __turbopack_context__.r(45350); 459/** Built-in value references. */ var spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; 460/** 461 * Checks if `value` is a flattenable `arguments` object or array. 462 * 463 * @private 464 * @param {*} value The value to check. 465 * @returns {boolean} Returns `true` if `value` is flattenable, else `false`. 466 */ function isFlattenable(value) { 467 return isArray(value) || isArguments(value) || !!(spreadableSymbol && value && value[spreadableSymbol]); 468} 469module.exports = isFlattenable; 470}), 471541891, ((__turbopack_context__, module, exports) => { 472 473var arrayPush = __turbopack_context__.r(169102), isFlattenable = __turbopack_context__.r(733803); 474/** 475 * The base implementation of `_.flatten` with support for restricting flattening. 476 * 477 * @private 478 * @param {Array} array The array to flatten. 479 * @param {number} depth The maximum recursion depth. 480 * @param {boolean} [predicate=isFlattenable] The function invoked per iteration. 481 * @param {boolean} [isStrict] Restrict to values that pass `predicate` checks. 482 * @param {Array} [result=[]] The initial result value. 483 * @returns {Array} Returns the new flattened array. 484 */ function baseFlatten(array, depth, predicate, isStrict, result) { 485 var index = -1, length = array.length; 486 predicate || (predicate = isFlattenable); 487 result || (result = []); 488 while(++index < length){ 489 var value = array[index]; 490 if (depth > 0 && predicate(value)) { 491 if (depth > 1) { 492 // Recursively flatten arrays (susceptible to call stack limits). 493 baseFlatten(value, depth - 1, predicate, isStrict, result); 494 } else { 495 arrayPush(result, value); 496 } 497 } else if (!isStrict) { 498 result[result.length] = value; 499 } 500 } 501 return result; 502} 503module.exports = baseFlatten; 504}), 505418196, ((__turbopack_context__) => { 506"use strict"; 507 508function getRoundingMethod(method) { 509 return (number)=>{ 510 const round = method ? Math[method] : Math.trunc; 511 const result = round(number); 512 // Prevent negative zero 513 return result === 0 ? 0 : result; 514 }; 515} 516__turbopack_context__.s([ 517 "getRoundingMethod", 518 0, 519 getRoundingMethod 520]); 521}), 522562407, ((__turbopack_context__, module, exports) => { 523 524var isArray = __turbopack_context__.r(45350); 525/** 526 * Casts `value` as an array if it's not one. 527 * 528 * @static 529 * @memberOf _ 530 * @since 4.4.0 531 * @category Lang 532 * @param {*} value The value to inspect. 533 * @returns {Array} Returns the cast array. 534 * @example 535 * 536 * _.castArray(1); 537 * // => [1] 538 * 539 * _.castArray({ 'a': 1 }); 540 * // => [{ 'a': 1 }] 541 * 542 * _.castArray('abc'); 543 * // => ['abc'] 544 * 545 * _.castArray(null); 546 * // => [null] 547 * 548 * _.castArray(undefined); 549 * // => [undefined] 550 * 551 * _.castArray(); 552 * // => [] 553 * 554 * var array = [1, 2, 3]; 555 * console.log(_.castArray(array) === array); 556 * // => true 557 */ function castArray() { 558 if (!arguments.length) { 559 return []; 560 } 561 var value = arguments[0]; 562 return isArray(value) ? value : [ 563 value 564 ]; 565} 566module.exports = castArray; 567}), 568776736, ((__turbopack_context__, module, exports) => { 569 570/** 571 * Copies the values of `source` to `array`. 572 * 573 * @private 574 * @param {Array} source The array to copy values from. 575 * @param {Array} [array=[]] The array to copy values to. 576 * @returns {Array} Returns `array`. 577 */ function copyArray(source, array) { 578 var index = -1, length = source.length; 579 array || (array = Array(length)); 580 while(++index < length){ 581 array[index] = source[index]; 582 } 583 return array; 584} 585module.exports = copyArray; 586}),
587195047, ((__turbopack_context__, module, exports) => { 588 589var arrayPush = __turbopack_context__.r(169102), baseFlatten = __turbopack_context__.r(541891), copyArray = __turbopack_context__.r(776736), isArray = __turbopack_context__.r(45350); 590/** 591 * Creates a new array concatenating `array` with any additional arrays 592 * and/or values. 593 * 594 * @static 595 * @memberOf _ 596 * @since 4.0.0 597 * @category Array 598 * @param {Array} array The array to concatenate. 599 * @param {...*} [values] The values to concatenate. 600 * @returns {Array} Returns the new concatenated array. 601 * @example 602 * 603 * var array = [1]; 604 * var other = _.concat(array, 2, [3], [[4]]); 605 * 606 * console.log(other); 607 * // => [1, 2, 3, [4]] 608 * 609 * console.log(array); 610 * // => [1] 611 */ function concat() { 612 var length = arguments.length; 613 if (!length) { 614 return []; 615 } 616 var args = Array(length - 1), array = arguments[0], index = length; 617 while(index--){ 618 args[index - 1] = arguments[index]; 619 } 620 return arrayPush(isArray(array) ? copyArray(array) : [ 621 array 622 ], baseFlatten(args, 1)); 623} 624module.exports = concat; 625}), 626864516, 861643, 627108956, 628((__turbopack_context__) => { 629"use strict"; 630 631// MERGED MODULE: [project]/src/components/form/DateTimeInput/getTimeSlotsForRange.ts [app-client] (ecmascript) 632; 633var __TURBOPACK__imported__module__562407__ = __turbopack_context__.i(562407); 634var __TURBOPACK__imported__module__195047__ = __turbopack_context__.i(195047); 635// MERGED MODULE: [project]/src/components/form/DateTimeInput/getTimeSlots.ts [app-client] (ecmascript) 636; 637var __TURBOPACK__imported__module__662537__ = __turbopack_context__.i(662537); 638var __TURBOPACK__imported__module__250630__ = __turbopack_context__.i(250630); 639// MERGED MODULE: [project]/node_modules/date-fns/differenceInMinutes.js [app-client] (ecmascript) 640; 641var __TURBOPACK__imported__module__418196__ = __turbopack_context__.i(418196); 642var __TURBOPACK__imported__module__234662__ = __turbopack_context__.i(234662); 643// MERGED MODULE: [project]/node_modules/date-fns/differenceInMilliseconds.js [app-client] (ecmascript) 644; 645var __TURBOPACK__imported__module__281092__ = __turbopack_context__.i(281092); 646; 647function differenceInMilliseconds(laterDate, earlierDate) { 648 return +(0, __TURBOPACK__imported__module__281092__["toDate"])(laterDate) - +(0, __TURBOPACK__imported__module__281092__["toDate"])(earlierDate); 649} 650const __TURBOPACK__default__export__ = differenceInMilliseconds; 651__turbopack_context__.s([ 652 "differenceInMilliseconds", 653 0, 654 differenceInMilliseconds 655], 861643); 656; 657; 658; 659function differenceInMinutes(dateLeft, dateRight, options) { 660 const diff = differenceInMilliseconds(dateLeft, dateRight) / __TURBOPACK__imported__module__234662__["millisecondsInMinute"]; 661 return (0, __TURBOPACK__imported__module__418196__["getRoundingMethod"])(options === null || options === void 0 ? void 0 : options.roundingMethod)(diff); 662} 663const __TURBOPACK__default__export__1 = differenceInMinutes; 664var __TURBOPACK__imported__module__690740__ = __turbopack_context__.i(690740); 665; 666; 667; 668function isWithRange(props) { 669 return "start" in props && "end" in props; 670} 671function getTimeSlots(props) { 672 var _props_slot; 673 const date = isWithRange(props) ? props.start : props.date; 674 const start = isWithRange(props) ? props.start : (0, __TURBOPACK__imported__module__690740__["parseTimeString"])("00:00", date); 675 const end = isWithRange(props) ? props.end : (0, __TURBOPACK__imported__module__690740__["parseTimeString"])("23:45", date); 676 const slot = (_props_slot = props.slot) !== null && _props_slot !== void 0 ? _props_slot : 15; 677 try { 678 const difference = differenceInMinutes(start, end); 679 if (difference > 0) { 680 const startFormatted = (0, __TURBOPACK__imported__module__690740__["asTimeString"])(start); 681 const endFormatted = (0, __TURBOPACK__imported__module__690740__["asTimeString"])(end); 682 throw Error("Start time (".concat(startFormatted, ") can not be later than end time (").concat(endFormatted, ").")); 683 } 684 const slots = Math.round(difference / -slot); 685 if (isNaN(slots)) { 686 throw Error("Could not calculate amount of slots."); 687 } 688 return [ 689 ...Array(slots + 1) 690 ].map((_, index)=>{ 691 return (0, __TURBOPACK__imported__module__250630__["addMinutes"])(start, index * slot); 692 }); 693 } catch (error) { 694 __TURBOPACK__imported__module__662537__["captureException"](error, { 695 extra: { 696 start, 697 end, 698 slot, 699 date 700 } 701 }); 702 return []; 703 } 704} 705__turbopack_context__.s([ 706 "getTimeSlots", 707 0, 708 getTimeSlots 709], 108956); 710; 711; 712; 713function getTimeSlotsForRange(param) { 714 let { range, slot } = param; 715 if (!range) { 716 return []; 717 } 718 const slots = (0, __TURBOPACK__imported__module__195047__["default"])([], ...(0, __TURBOPACK__imported__module__562407__["default"])(range).map((param)=>{ 719 let { from, to } = param; 720 return getTimeSlots({ 721 start: from, 722 end: to, 723 slot 724 }); 725 })); 726 // It's possible for multiple ranges to be given, e.g. 08:00 - 12:00, 13:00 - 17:00 727 // Since we can't always be certain they are in order, we sort them. 728 return slots.sort(// Sort by UNIX timestamp 729 (a, b)=>a.getTime() - b.getTime()); 730} 731__turbopack_context__.s([ 732 "getTimeSlotsForRange", 733 0, 734 getTimeSlotsForRange 735], 864516); 736}), 737702305, 478569, 738((__turbopack_context__) => { 739"use strict"; 740 741// MERGED MODULE: [project]/src/car-rental/utils.ts [app-client] (ecmascript) 742; 743var __TURBOPACK__imported__module__929387__ = __turbopack_context__.i(929387); 744var __TURBOPACK__imported__module__109881__ = __turbopack_context__.i(109881); 745var __TURBOPACK__imported__module__433331__ = __turbopack_context__.i(433331); 746var __TURBOPACK__imported__module__671857__ = __turbopack_context__.i(671857); 747var __TURBOPACK__imported__module__550516__ = __turbopack_context__.i(550516); 748var __TURBOPACK__imported__module__838122__ = __turbopack_context__.i(838122); 749var __TURBOPACK__imported__module__826514__ = __turbopack_context__.i(826514); 750var __TURBOPACK__imported__module__585890__ = __turbopack_context__.i(585890); 751var __TURBOPACK__imported__module__685149__ = __turbopack_context__.i(685149); 752// MERGED MODULE: [project]/src/components/form/DateTimeInput/getRangeForLocation.ts [app-client] (ecmascript) 753; 754var __TURBOPACK__imported__module__929387__1 = __TURBOPACK__imported__module__929387__; 755var __TURBOPACK__imported__module__109881__1 = __TURBOPACK__imported__module__109881__; 756var __TURBOPACK__imported__module__988052__ = __turbopack_context__.i(988052); 757var __TURBOPACK__imported__module__952027__ = __turbopack_context__.i(952027); 758var __TURBOPACK__imported__module__250630__ = __turbopack_context__.i(250630); 759var __TURBOPACK__imported__module__550516__1 = __TURBOPACK__imported__module__550516__;
760var __TURBOPACK__imported__module__368977__ = __turbopack_context__.i(368977); 761var __TURBOPACK__imported__module__690740__ = __turbopack_context__.i(690740); 762var __TURBOPACK__imported__module__685149__1 = __TURBOPACK__imported__module__685149__; 763var __TURBOPACK__imported__module__341184__ = __turbopack_context__.i(341184); 764var __TURBOPACK__imported__module__864516__ = __turbopack_context__.i(864516); 765; 766; 767; 768; 769; 770; 771function getRangeForLocation(param) { 772 let { date, now, location, slot = 15, bookingOffsetMinutes = 0 } = param; 773 // Ensure we always compare by the minute 774 const nowRounded = new __TURBOPACK__imported__module__988052__["TZDate"](now.getTime(), __TURBOPACK__imported__module__685149__1["TIMEZONE"]); 775 nowRounded.setSeconds(0); 776 nowRounded.setMilliseconds(0); 777 const applyPickupCutoff = (0, __TURBOPACK__imported__module__690740__["applyTimeOffset"])([ 778 { 779 from: (0, __TURBOPACK__imported__module__690740__["parseTimeString"])("08:00", date), 780 to: (0, __TURBOPACK__imported__module__690740__["parseTimeString"])("23:45", date) 781 } 782 ], bookingOffsetMinutes)[0]; 783 if (!date || !(0, __TURBOPACK__imported__module__368977__["isValid"])(date)) { 784 return applyPickupCutoff !== null && applyPickupCutoff !== void 0 ? applyPickupCutoff : null; 785 } 786 const openingRange = location ? (0, __TURBOPACK__imported__module__341184__["getOpeningHoursForDate"])({ 787 date, 788 location 789 }) : undefined; 790 if ((openingRange === null || openingRange === void 0 ? void 0 : openingRange.length) === 0) { 791 return null; 792 } 793 let range = undefined; 794 if (openingRange) { 795 range = openingRange.map((singleRange)=>({ 796 from: (0, __TURBOPACK__imported__module__690740__["parseTimeString"])(singleRange.from, date), 797 to: (0, __TURBOPACK__imported__module__690740__["parseTimeString"])(singleRange.to, date) 798 })); 799 } 800 if (range && range.length > 0) { 801 range = (0, __TURBOPACK__imported__module__690740__["applyTimeOffset"])(range, bookingOffsetMinutes); 802 if (range.length === 0) { 803 return null; 804 } 805 } 806 if ((0, __TURBOPACK__imported__module__550516__1["isSameDay"])(nowRounded, date, { 807 in: (0, __TURBOPACK__imported__module__109881__1["tz"])(__TURBOPACK__imported__module__685149__1["TIMEZONE"]) 808 })) { 809 const oneHourInTheFuture = (0, __TURBOPACK__imported__module__952027__["addHours"])(nowRounded, 1); 810 const minutes = oneHourInTheFuture.getMinutes(); 811 const roundedMinutes = Math.ceil(minutes / 15) * 15; 812 oneHourInTheFuture.setMinutes(roundedMinutes); 813 const from = new __TURBOPACK__imported__module__988052__["TZDate"](oneHourInTheFuture, __TURBOPACK__imported__module__685149__1["TIMEZONE"]); 814 // If a range was found, calculate the latest possible slot. 815 // Preserve gaps between opening ranges so same-day bookings cannot span closed periods. 816 if (range) { 817 const todayRange = range.map((singleRange)=>({ 818 from: singleRange.from.getTime() > from.getTime() ? singleRange.from : from, 819 to: singleRange.to 820 })).filter((singleRange)=>singleRange.to.getTime() > singleRange.from.getTime()); 821 const selectableTodayRange = todayRange.map((singleRange)=>{ 822 const selectableSlots = (0, __TURBOPACK__imported__module__864516__["getTimeSlotsForRange"])({ 823 range: singleRange, 824 slot 825 }).filter((timeSlot)=>timeSlot.getTime() <= singleRange.to.getTime()); 826 const firstSelectableSlot = selectableSlots[0]; 827 const latestSelectableSlot = selectableSlots[selectableSlots.length - 1]; 828 if (!firstSelectableSlot || !latestSelectableSlot) { 829 return null; 830 } 831 return { 832 from: firstSelectableSlot, 833 to: latestSelectableSlot 834 }; 835 }).filter((singleRange)=>!!singleRange); 836 if (selectableTodayRange.length === 0) { 837 return null; 838 } 839 return selectableTodayRange.length === 1 ? selectableTodayRange[0] : selectableTodayRange; 840 } 841 const to = (0, __TURBOPACK__imported__module__250630__["addMinutes"])((0, __TURBOPACK__imported__module__690740__["parseTimeString"])("23:45", nowRounded), -bookingOffsetMinutes); 842 if (to.getTime() === from.getTime()) { 843 return null; 844 } 845 if (from.getTime() > to.getTime()) { 846 return null; 847 } 848 return { 849 from, 850 to 851 }; 852 } 853 return range !== null && range !== void 0 ? range : applyPickupCutoff; 854} 855__turbopack_context__.s([ 856 "getRangeForLocation", 857 0, 858 getRangeForLocation 859], 478569); 860var __TURBOPACK__imported__module__864516__1 = __TURBOPACK__imported__module__864516__; 861var __TURBOPACK__imported__module__341184__1 = __TURBOPACK__imported__module__341184__; 862; 863; 864; 865; 866; 867; 868function getDisabledPickupDatesForLocation(param) { 869 let { now, location, bookingOffsetMinutes = 0 } = param; 870 const today = (0, __TURBOPACK__imported__module__585890__["startOfDay"])(now, { 871 in: (0, __TURBOPACK__imported__module__109881__["tz"])(__TURBOPACK__imported__module__685149__["TIMEZONE"]) 872 }); 873 const excludedDates = []; 874 const addExcludedDate = (date)=>{ 875 if (!excludedDates.some((excludedDate)=>(0, __TURBOPACK__imported__module__550516__["isSameDay"])(excludedDate, date, { 876 in: (0, __TURBOPACK__imported__module__109881__["tz"])(__TURBOPACK__imported__module__685149__["TIMEZONE"]) 877 }))) { 878 excludedDates.push(date); 879 } 880 }; 881 const shouldExcludeDate = (date)=>{ 882 return (0, __TURBOPACK__imported__module__341184__1["getOpeningHoursForDate"])({ 883 date, 884 location 885 }).length === 0; 886 }; 887 location.divergentOpeningHours.filter((it)=>
887it.isClosedForTheWholeDay).forEach((it)=>{ 888 const parsedDate = (0, __TURBOPACK__imported__module__826514__["parseISO"])(it.date, { 889 in: (0, __TURBOPACK__imported__module__109881__["tz"])(__TURBOPACK__imported__module__685149__["TIMEZONE"]) 890 }); 891 if ((0, __TURBOPACK__imported__module__671857__["isAfter"])(parsedDate, today) || (0, __TURBOPACK__imported__module__550516__["isSameDay"])(parsedDate, today)) { 892 addExcludedDate(parsedDate); 893 } 894 }); 895 Object.entries(location.openingHours).forEach((param)=>{ 896 let [key, value] = param; 897 const index = __TURBOPACK__imported__module__685149__["DAY_OF_THE_WEEK_TO_INDEX"][key]; 898 // No opening hours specified for day of the week 899 if (value.length === 0) { 900 if (today.getDay() === index && shouldExcludeDate(today)) { 901 addExcludedDate(today); 902 } 903 for(let i = 0; i <= 52; i++){ 904 const candidateDate = (0, __TURBOPACK__imported__module__838122__["nextDay"])((0, __TURBOPACK__imported__module__433331__["addWeeks"])(today, i), index); 905 if (shouldExcludeDate(candidateDate)) { 906 addExcludedDate(candidateDate); 907 } 908 } 909 } 910 }); 911 const currentRange = getRangeForLocation({ 912 now, 913 date: now, 914 location, 915 bookingOffsetMinutes 916 }); 917 if (currentRange === null) { 918 addExcludedDate(today); 919 } 920 return excludedDates; 921} 922function getMinPickupTimeForLocation(param) { 923 let { location, date, now, bookingOffsetMinutes = 0 } = param; 924 const slots = (0, __TURBOPACK__imported__module__864516__1["getTimeSlotsForRange"])({ 925 range: getRangeForLocation({ 926 now, 927 date, 928 location, 929 bookingOffsetMinutes 930 }) 931 }); 932 if (!!slots[0]) { 933 return slots[0]; 934 } 935 return null; 936} 937function getMinPickupTime(param) { 938 let { locations, date, now, bookingOffsetMinutes = 0 } = param; 939 const slots = locations.map((location)=>{ 940 return getMinPickupTimeForLocation({ 941 date, 942 now, 943 location, 944 bookingOffsetMinutes 945 }); 946 }).filter((it)=>!!it).sort(// Sort by UNIX timestamp 947 (a, b)=>a.getTime() - b.getTime()); 948 return slots[0] || null; 949} 950function getMaxPickupTime(param) { 951 let { locations, date, now, bookingOffsetMinutes } = param; 952 const slots = locations.map((location)=>{ 953 const slots = (0, __TURBOPACK__imported__module__864516__1["getTimeSlotsForRange"])({ 954 range: getRangeForLocation({ 955 now, 956 date, 957 location, 958 bookingOffsetMinutes 959 }) 960 }); 961 if (slots[0]) { 962 return slots[slots.length - 1]; 963 } 964 return undefined; 965 }).filter((it)=>!!it).sort(// Sort by UNIX timestamp 966 (a, b)=>a.getTime() - b.getTime()); 967 return slots[slots.length - 1] || null; 968} 969const formatPickupOrDeliveryLine = (line, t)=>{ 970 return line.replace("Ophalen locatie", t("order.summary.pickupLocation")).replace("Afleveren locatie", t("order.summary.deliveryLocation")); 971}; 972const isPickupOrDeliveryLine = (line)=>{ 973 return line.includes("Ophalen locatie") || line.includes("Afleveren locatie"); 974}; 975const isCityFeeLine = (line)=>{ 976 return line.toLowerCase().includes("cityfee"); 977}; 978__turbopack_context__.s([ 979 "formatPickupOrDeliveryLine", 980 0, 981 formatPickupOrDeliveryLine, 982 "getDisabledPickupDatesForLocation", 983 0, 984 getDisabledPickupDatesForLocation, 985 "getMaxPickupTime", 986 0, 987 getMaxPickupTime, 988 "getMinPickupTime", 989 0, 990 getMinPickupTime, 991 "getMinPickupTimeForLocation", 992 0, 993 getMinPickupTimeForLocation, 994 "isCityFeeLine", 995 0, 996 isCityFeeLine, 997 "isPickupOrDeliveryLine", 998 0, 999 isPickupOrDeliveryLine 1000], 702305); 1001}), 1002406102, ((__turbopack_context__) => { 1003"use strict"; 1004 1005// MERGED MODULE: [project]/src/generated/businessRule/reactQueries.tsx [app-client] (ecmascript) 1006; 1007var __TURBOPACK__imported__module__954616__ = __turbopack_context__.i(954616); 1008var __TURBOPACK__imported__module__266027__ = __turbopack_context__.i(266027); 1009var __TURBOPACK__imported__module__912598__ = __turbopack_context__.i(912598); 1010var __TURBOPACK__imported__module__197643__ = __turbopack_context__.i(197643); 1011// MERGED MODULE: [project]/src/generated/businessRule/apiClient.ts [app-client] (ecmascript) 1012; 1013async function apiBusinessRuleCreate(axiosInstance, body, requestConfig) { 1014 const response = await axiosInstance.request({ 1015 url: "business-rule/", 1016 method: "POST", 1017 data: body, 1018 ...requestConfig 1019 }); 1020 return response.data; 1021} 1022async function apiBusinessRuleGetBookingOffsetPublic(axiosInstance, requestConfig) { 1023 const response = await axiosInstance.request({ 1024 url: "business-rule/booking-offset", 1025 method: "GET", 1026 ...requestConfig 1027 }); 1028 return response.data; 1029} 1030async function apiBusinessRuleList(axiosInstance, requestConfig) { 1031 const response = await axiosInstance.request({ 1032 url: "business-rule/", 1033 method: "GET", 1034 ...requestConfig 1035 }); 1036 return response.data; 1037} 1038async function apiBusinessRuleRemove(axiosInstance, params, requestConfig) { 1039 const response = await axiosInstance.request({ 1040 url: "business-rule/".concat(params.id), 1041 method: "DELETE", 1042 ...requestConfig 1043 }); 1044 return response.data; 1045} 1046async function apiBusinessRuleUpdate(axiosInstance, params, body, requestConfig) { 1047 const response = await axiosInstance.request({ 1048 url: "business-rule/".concat(params.id), 1049 method: "PUT", 1050 data: body, 1051 ...requestConfig 1052 }); 1053 return response.data; 1054} 1055; 1056; 1057; 1058function useBusinessRuleCreate() { 1059 let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, hookOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 1060 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 1061 const queryClient = (0, __TURBOPACK__imported__module__912598__["useQueryClient"])(); 1062 if (hookOptions.invalidateQueries) { 1063 const originalOnSuccess = options.onSuccess; 1064 options.onSuccess = async function(data, variables) { 1065 for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){ 1066 args[_key - 2] = arguments[_key]; 1067 }
1068 queryClient.invalidateQueries({ 1069 queryKey: [ 1070 "businessRule" 1071 ] 1072 }); 1073 if (typeof originalOnSuccess === "function") { 1074 return await originalOnSuccess(data, variables, ...args); 1075 } 1076 }; 1077 } 1078 return (0, __TURBOPACK__imported__module__954616__["useMutation"])({ 1079 mutationFn: (variables)=>apiBusinessRuleCreate(axiosInstance, { 1080 config: variables["config"] 1081 }, variables === null || variables === void 0 ? void 0 : variables.requestConfig), 1082 ...options 1083 }); 1084} 1085function useBusinessRuleGetBookingOffsetPublic() { 1086 let opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 1087 var _ref; 1088 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 1089 const options = (_ref = opts === null || opts === void 0 ? void 0 : opts.queryOptions) !== null && _ref !== void 0 ? _ref : {}; 1090 return (0, __TURBOPACK__imported__module__266027__["useQuery"])({ 1091 queryKey: useBusinessRuleGetBookingOffsetPublic.queryKey(), 1092 queryFn: (param)=>{ 1093 let { signal } = param; 1094 var _opts, _requestConfig; 1095 (_requestConfig = (_opts = opts).requestConfig) !== null && _requestConfig !== void 0 ? _requestConfig : _opts.requestConfig = {}; 1096 opts.requestConfig.signal = signal; 1097 return apiBusinessRuleGetBookingOffsetPublic(axiosInstance, opts === null || opts === void 0 ? void 0 : opts.requestConfig); 1098 }, 1099 ...options 1100 }); 1101} 1102/** 1103 * Base key used by useBusinessRuleGetBookingOffsetPublic.queryKey() 1104 */ useBusinessRuleGetBookingOffsetPublic.baseKey = ()=>[ 1105 "businessRule", 1106 "getBookingOffsetPublic" 1107 ]; 1108/** 1109 * Query key used by useBusinessRuleGetBookingOffsetPublic 1110 */ useBusinessRuleGetBookingOffsetPublic.queryKey = ()=>[ 1111 ...useBusinessRuleGetBookingOffsetPublic.baseKey() 1112 ]; 1113/** 1114 * Fetch useBusinessRuleGetBookingOffsetPublic via the queryClient and return the result 1115 */ useBusinessRuleGetBookingOffsetPublic.fetch = (queryClient, axiosInstance, opts)=>{ 1116 return queryClient.fetchQuery({ 1117 queryKey: useBusinessRuleGetBookingOffsetPublic.queryKey(), 1118 queryFn: ()=>{ 1119 return apiBusinessRuleGetBookingOffsetPublic(axiosInstance, opts === null || opts === void 0 ? void 0 : opts.requestConfig); 1120 } 1121 }); 1122}; 1123/** 1124 * Prefetch useBusinessRuleGetBookingOffsetPublic via the queryClient 1125 */ useBusinessRuleGetBookingOffsetPublic.prefetch = (queryClient, axiosInstance, opts)=>{ 1126 return queryClient.prefetchQuery({ 1127 queryKey: useBusinessRuleGetBookingOffsetPublic.queryKey(), 1128 queryFn: ()=>{ 1129 return apiBusinessRuleGetBookingOffsetPublic(axiosInstance, opts === null || opts === void 0 ? void 0 : opts.requestConfig); 1130 } 1131 }); 1132}; 1133/** 1134 * Invalidate useBusinessRuleGetBookingOffsetPublic via the queryClient 1135 */ useBusinessRuleGetBookingOffsetPublic.invalidate = (queryClient)=>queryClient.invalidateQueries({ 1136 queryKey: useBusinessRuleGetBookingOffsetPublic.queryKey() 1137 }); 1138/** 1139 * Set query data for useBusinessRuleGetBookingOffsetPublic via the queryClient 1140 */ useBusinessRuleGetBookingOffsetPublic.setQueryData = (queryClient, data)=>{ 1141 return queryClient.setQueryData(useBusinessRuleGetBookingOffsetPublic.queryKey(), data); 1142}; 1143function useBusinessRuleList() { 1144 let opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 1145 var _ref; 1146 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 1147 const options = (_ref = opts === null || opts === void 0 ? void 0 : opts.queryOptions) !== null && _ref !== void 0 ? _ref : {}; 1148 return (0, __TURBOPACK__imported__module__266027__["useQuery"])({ 1149 queryKey: useBusinessRuleList.queryKey(), 1150 queryFn: (param)=>{ 1151 let { signal } = param; 1152 var _opts, _requestConfig; 1153 (_requestConfig = (_opts = opts).requestConfig) !== null && _requestConfig !== void 0 ? _requestConfig : _opts.requestConfig = {}; 1154 opts.requestConfig.signal = signal; 1155 return apiBusinessRuleList(axiosInstance, opts === null || opts === void 0 ? void 0 : opts.requestConfig); 1156 }, 1157 ...options 1158 }); 1159} 1160/** 1161 * Base key used by useBusinessRuleList.queryKey() 1162 */ useBusinessRuleList.baseKey = ()=>[ 1163 "businessRule", 1164 "list" 1165 ]; 1166/** 1167 * Query key used by useBusinessRuleList 1168 */ useBusinessRuleList.queryKey = ()=>[ 1169 ...useBusinessRuleList.baseKey() 1170 ]; 1171/** 1172 * Fetch useBusinessRuleList via the queryClient and return the result 1173 */ useBusinessRuleList.fetch = (queryClient, axiosInstance, opts)=>{ 1174 return queryClient.fetchQuery({ 1175 queryKey: useBusinessRuleList.queryKey(), 1176 queryFn: ()=>{ 1177 return apiBusinessRuleList(axiosInstance, opts === null || opts === void 0 ? void 0 : opts.requestConfig); 1178 } 1179 }); 1180}; 1181/** 1182 * Prefetch useBusinessRuleList via the queryClient 1183 */ useBusinessRuleList.prefetch = (queryClient, axiosInstance, opts)=>{ 1184 return queryClient.prefetchQuery({ 1185 queryKey: useBusinessRuleList.queryKey(), 1186 queryFn: ()=>{ 1187 return apiBusinessRuleList(axiosInstance, opts === null || opts === void 0 ? void 0 : opts.requestConfig); 1188 } 1189 }); 1190}; 1191/** 1192 * Invalidate useBusinessRuleList via the queryClient
1193 */ useBusinessRuleList.invalidate = (queryClient)=>queryClient.invalidateQueries({ 1194 queryKey: useBusinessRuleList.queryKey() 1195 }); 1196/** 1197 * Set query data for useBusinessRuleList via the queryClient 1198 */ useBusinessRuleList.setQueryData = (queryClient, data)=>{ 1199 return queryClient.setQueryData(useBusinessRuleList.queryKey(), data); 1200}; 1201function useBusinessRuleRemove() { 1202 let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}; 1203 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 1204 const queryClient = (0, __TURBOPACK__imported__module__912598__["useQueryClient"])(); 1205 return (0, __TURBOPACK__imported__module__954616__["useMutation"])({ 1206 mutationFn: (variables)=>apiBusinessRuleRemove(axiosInstance, { 1207 id: variables["id"] 1208 }, variables === null || variables === void 0 ? void 0 : variables.requestConfig), 1209 ...options 1210 }); 1211} 1212function useBusinessRuleUpdate() { 1213 let options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, hookOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 1214 const axiosInstance = (0, __TURBOPACK__imported__module__197643__["useApi"])(); 1215 const queryClient = (0, __TURBOPACK__imported__module__912598__["useQueryClient"])(); 1216 if (hookOptions.invalidateQueries) { 1217 const originalOnSuccess = options.onSuccess; 1218 options.onSuccess = async function(data, variables) { 1219 for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){ 1220 args[_key - 2] = arguments[_key]; 1221 } 1222 queryClient.invalidateQueries({ 1223 queryKey: [ 1224 "businessRule" 1225 ] 1226 }); 1227 if (typeof originalOnSuccess === "function") { 1228 return await originalOnSuccess(data, variables, ...args); 1229 } 1230 }; 1231 } 1232 return (0, __TURBOPACK__imported__module__954616__["useMutation"])({ 1233 mutationFn: (variables)=>apiBusinessRuleUpdate(axiosInstance, { 1234 id: variables["id"] 1235 }, { 1236 config: variables["config"] 1237 }, variables === null || variables === void 0 ? void 0 : variables.requestConfig), 1238 ...options 1239 }); 1240} 1241__turbopack_context__.s([ 1242 "useBusinessRuleCreate", 1243 0, 1244 useBusinessRuleCreate, 1245 "useBusinessRuleGetBookingOffsetPublic", 1246 0, 1247 useBusinessRuleGetBookingOffsetPublic, 1248 "useBusinessRuleList", 1249 0, 1250 useBusinessRuleList, 1251 "useBusinessRuleRemove", 1252 0, 1253 useBusinessRuleRemove, 1254 "useBusinessRuleUpdate", 1255 0, 1256 useBusinessRuleUpdate 1257], 406102); 1258}), 1259414083, 579473, 1260((__turbopack_context__) => { 1261"use strict"; 1262 1263// MERGED MODULE: [project]/node_modules/zustand/esm/traditional.mjs [app-client] (ecmascript) 1264; 1265var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 1266var __TURBOPACK__imported__module__430224__ = __turbopack_context__.i(430224); 1267var __TURBOPACK__imported__module__408155__ = __turbopack_context__.i(408155); 1268; 1269; 1270; 1271const { useSyncExternalStoreWithSelector } = __TURBOPACK__imported__module__430224__["default"]; 1272const identity = (arg)=>arg; 1273function useStoreWithEqualityFn(api) { 1274 let selector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : identity, equalityFn = arguments.length > 2 ? arguments[2] : void 0; 1275 const slice = useSyncExternalStoreWithSelector(api.subscribe, api.getState, api.getInitialState, selector, equalityFn); 1276 __TURBOPACK__imported__module__271645__["default"].useDebugValue(slice); 1277 return slice; 1278} 1279const createWithEqualityFnImpl = (createState, defaultEqualityFn)=>{ 1280 const api = (0, __TURBOPACK__imported__module__408155__["createStore"])(createState); 1281 const useBoundStoreWithEqualityFn = function(selector) { 1282 let equalityFn = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : defaultEqualityFn; 1283 return useStoreWithEqualityFn(api, selector, equalityFn); 1284 }; 1285 Object.assign(useBoundStoreWithEqualityFn, api); 1286 return useBoundStoreWithEqualityFn; 1287}; 1288const createWithEqualityFn = (createState, defaultEqualityFn)=>createState ? createWithEqualityFnImpl(createState, defaultEqualityFn) : createWithEqualityFnImpl; 1289; 1290__turbopack_context__.s([ 1291 "useStoreWithEqualityFn", 1292 0, 1293 useStoreWithEqualityFn 1294], 414083); 1295// MERGED MODULE: [project]/node_modules/zustand/esm/middleware.mjs [app-client] (ecmascript) 1296; 1297const __TURBOPACK__import$2e$meta__ = { 1298 get url () { 1299 return `file://${__turbopack_context__.P("node_modules/zustand/esm/middleware.mjs")}`; 1300 } 1301}; 1302const reduxImpl = (reducer, initial)=>(set, _get, api)=>{ 1303 api.dispatch = (action)=>{ 1304 set((state)=>reducer(state, action), false, action); 1305 return action; 1306 }; 1307 api.dispatchFromDevtools = true; 1308 return { 1309 dispatch: function() { 1310 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1311 args[_key] = arguments[_key]; 1312 } 1313 return api.dispatch(...args); 1314 }, 1315 ...initial 1316 }; 1317 }; 1318const redux = reduxImpl; 1319const shouldDispatchFromDevtools = (api)=>!!api.dispatchFromDevtools && typeof api.dispatch === "function"; 1320const trackedConnections = /* @__PURE__ */ new Map(); 1321const getTrackedConnectionState = (name)=>{ 1322 const api = trackedConnections.get(name); 1323 if (!api) return {}; 1324 return Object.fromEntries(Object.entries(api.stores).map((param)=>{ 1325 let [key, api2] = param; 1326 return [ 1327 key, 1328 api2.getState() 1329 ]; 1330 })); 1331}; 1332const extractConnectionInformation = (store, extensionConnector, options)=>{ 1333 if (store === void 0) { 1334 return { 1335 type: "untracked", 1336 connection: extensionConnector.connect(options) 1337 }; 1338 } 1339 const existingConnection = trackedConnections.get(options.name); 1340 if (existingConnection) { 1341 return { 1342 type: "tracked", 1343 store, 1344 ...existingConnection 1345 }; 1346 } 1347 const newConnection = { 1348 connection: extensionConnector.connect(options), 1349 stores: {} 1350 }; 1351 trackedConnections.set(options.name, newConnection); 1352 return { 1353 type: "tracked", 1354 store, 1355 ...newConnection 1356 }; 1357}; 1358const removeStoreFromTrackedConnections = (name, store)=>{ 1359 if (store === void 0) return; 1360 const connectionInfo = trackedConnections.get(name); 1361 if (!connectionInfo) return; 1362 delete connectionInfo.stores[store]; 1363 if (Object.keys(connectionInfo.stores).length === 0) { 1364 trackedConnections.delete(name); 1365 } 1366}; 1367const v8StackLineRe = /^at (?:new |async )?(.+?) \(/; 1368const geckoStackLineRe = /^([^@]+)@/; 1369function findCallerName(stack) { 1370 var _a, _b, _c; 1371 if (!stack) return void 0; 1372 const traceLines = stack.split("\n"); 1373 const apiSetStateLineIndex = traceLines.findIndex((traceLine)=>traceLine.includes("api.setState")); 1374 if (apiSetStateLineIndex < 0) return void 0; 1375 const callerLine = ((_a = traceLines[apiSetStateLineIndex + 1]) == null ? void 0 : _a.trim()) || ""; 1376 return ((_b = v8StackLineRe.exec(callerLine)) == null ? void 0 : _b[1]) || ((_c = geckoStackLineRe.exec(callerLine)) == null ? void 0 : _c[1]); 1377} 1378const devtoolsImpl = function(fn) { 1379 let devtoolsOptions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}; 1380 return (set, get, api)=>{ 1381 const { enabled, anonymousActionType, store, ...options } = devtoolsOptions; 1382 let extensionConnector; 1383 try { 1384 extensionConnector = (enabled != null ? enabled : (__TURBOPACK__import$2e$meta__.env ? __TURBOPACK__import$2e$meta__.env.MODE : void 0) !== "production") && window.__REDUX_DEVTOOLS_EXTENSION__; 1385 } catch (e) {} 1386 if (!extensionConnector) { 1387 return fn(set, get, api); 1388 } 1389 const { connection, ...connectionInformation } = extractConnectionInformation(store, extensionConnector, options); 1390 let isRecording = true; 1391 api.setState = (state, replace, nameOrAction)=>{ 1392 const r = set(state, replace); 1393 if (!isRecording) return r; 1394 const action = nameOrAction === void 0 ? { 1395 type: anonymousActionType || findCallerName(new Error().stack) || "anonymous" 1396 } : typeof nameOrAction === "string" ? { 1397 type: nameOrAction 1398 } : nameOrAction; 1399 if (store === void 0) { 1400 connection == null ? void 0 : connection.send(action, get()); 1401 return r; 1402 } 1403 connection == null ? void 0 : connection.send({ 1404 ...action, 1405 type: "".concat(store, "/").concat(action.type) 1406 }, { 1407 ...getTrackedConnectionState(options.name), 1408 [store]: api.getState() 1409 }); 1410 return r; 1411 }; 1412 api.devtools = { 1413 cleanup: ()=>{ 1414 if (connection && typeof connection.unsubscribe === "function") { 1415 connection.unsubscribe(); 1416 } 1417 removeStoreFromTrackedConnections(options.name, store); 1418 } 1419 }; 1420 const setStateFromDevtools = function() { 1421 for(var _len = arguments.length, a = new Array(_len), _key = 0; _key < _len; _key++){ 1422 a[_key] = arguments[_key]; 1423 } 1424 const originalIsRecording = isRecording; 1425 isRecording = false;
1426 set(...a); 1427 isRecording = originalIsRecording; 1428 }; 1429 const initialState = fn(api.setState, get, api); 1430 if (connectionInformation.type === "untracked") { 1431 connection == null ? void 0 : connection.init(initialState); 1432 } else { 1433 connectionInformation.stores[connectionInformation.store] = api; 1434 connection == null ? void 0 : connection.init(Object.fromEntries(Object.entries(connectionInformation.stores).map((param)=>{ 1435 let [key, store2] = param; 1436 return [ 1437 key, 1438 key === connectionInformation.store ? initialState : store2.getState() 1439 ]; 1440 }))); 1441 } 1442 if (shouldDispatchFromDevtools(api)) { 1443 let didWarnAboutReservedActionType = false; 1444 const originalDispatch = api.dispatch; 1445 api.dispatch = function() { 1446 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1447 args[_key] = arguments[_key]; 1448 } 1449 if ((__TURBOPACK__import$2e$meta__.env ? __TURBOPACK__import$2e$meta__.env.MODE : void 0) !== "production" && args[0].type === "__setState" && !didWarnAboutReservedActionType) { 1450 console.warn('[zustand devtools middleware] "__setState" action type is reserved to set state from the devtools. Avoid using it.'); 1451 didWarnAboutReservedActionType = true; 1452 } 1453 originalDispatch(...args); 1454 }; 1455 } 1456 connection.subscribe((message)=>{ 1457 var _a; 1458 switch(message.type){ 1459 case "ACTION": 1460 if (typeof message.payload !== "string") { 1461 console.error("[zustand devtools middleware] Unsupported action format"); 1462 return; 1463 } 1464 return parseJsonThen(message.payload, (action)=>{ 1465 if (action.type === "__setState") { 1466 if (store === void 0) { 1467 setStateFromDevtools(action.state); 1468 return; 1469 } 1470 if (Object.keys(action.state).length !== 1) { 1471 console.error('\n [zustand devtools middleware] Unsupported __setState action format.\n When using \'store\' option in devtools(), the \'state\' should have only one key, which is a value of \'store\' that was passed in devtools(),\n and value of this only key should be a state object. Example: { "type": "__setState", "state": { "abc123Store": { "foo": "bar" } } }\n '); 1472 } 1473 const stateFromDevtools = action.state[store]; 1474 if (stateFromDevtools === void 0 || stateFromDevtools === null) { 1475 return; 1476 } 1477 if (JSON.stringify(api.getState()) !== JSON.stringify(stateFromDevtools)) { 1478 setStateFromDevtools(stateFromDevtools); 1479 } 1480 return; 1481 } 1482 if (shouldDispatchFromDevtools(api)) { 1483 api.dispatch(action); 1484 } 1485 }); 1486 case "DISPATCH": 1487 switch(message.payload.type){ 1488 case "RESET": 1489 setStateFromDevtools(initialState); 1490 if (store === void 0) { 1491 return connection == null ? void 0 : connection.init(api.getState()); 1492 } 1493 return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name)); 1494 case "COMMIT": 1495 if (store === void 0) { 1496 connection == null ? void 0 : connection.init(api.getState()); 1497 return; 1498 } 1499 return connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name)); 1500 case "ROLLBACK": 1501 return parseJsonThen(message.state, (state)=>{ 1502 if (store === void 0) { 1503 setStateFromDevtools(state); 1504 connection == null ? void 0 : connection.init(api.getState()); 1505 return; 1506 } 1507 setStateFromDevtools(state[store]); 1508 connection == null ? void 0 : connection.init(getTrackedConnectionState(options.name)); 1509 }); 1510 case "JUMP_TO_STATE": 1511 case "JUMP_TO_ACTION": 1512 return parseJsonThen(message.state, (state)=>{ 1513 if (store === void 0) { 1514 setStateFromDevtools(state); 1515 return; 1516 } 1517 if (JSON.stringify(api.getState()) !== JSON.stringify(state[store])) { 1518 setStateFromDevtools(state[store]); 1519 } 1520 }); 1521 case "IMPORT_STATE": 1522 { 1523 const { nextLiftedState } = message.payload; 1524 const lastComputedState = (_a = nextLiftedState.computedStates.slice(-1)[0]) == null ? void 0 : _a.state; 1525 if (!lastComputedState) return; 1526 if (store === void 0) { 1527 setStateFromDevtools(lastComputedState); 1528 } else { 1529 setStateFromDevtools(lastComputedState[store]); 1530 } 1531 connection == null ? void 0 : connection.send(null, // FIXME no-any 1532 nextLiftedState); 1533 return; 1534 } 1535 case "PAUSE_RECORDING": 1536 return isRecording = !isRecording; 1537 } 1538 return; 1539 } 1540 }); 1541 return initialState; 1542 }; 1543}; 1544const devtools = devtoolsImpl; 1545const parseJsonThen = (stringified, fn)=>{ 1546 let parsed; 1547 try { 1548 parsed = JSON.parse(stringified); 1549 } catch (e) { 1550 console.error("[zustand devtools middleware] Could not parse the received json", e); 1551 } 1552 if (parsed !== void 0) fn(parsed); 1553}; 1554const subscribeWithSelectorImpl = (fn)=>(set, get, api)=>{ 1555 const origSubscribe = api.subscribe; 1556 api.subscribe = (selector, optListener, options)=>{ 1557 let listener = selector; 1558 if (optListener) { 1559 const equalityFn = (options == null ? void 0 : options.equalityFn) || Object.is; 1560 let currentSlice = selector(api.getState()); 1561 listener = (state)=>{ 1562 const nextSlice = selector(state); 1563 if (!equalityFn(currentSlice, nextSlice)) { 1564 const previousSlice = currentSlice; 1565 optListener(currentSlice = nextSlice, previousSlice); 1566 } 1567 }; 1568 if (options == null ? void 0 : options.fireImmediately) { 1569 optListener(currentSlice, currentSlice); 1570 } 1571 } 1572 return origSubscribe(listener); 1573 }; 1574 const initialState = fn(set, get, api); 1575 return initialState; 1576 }; 1577const subscribeWithSelector = subscribeWithSelectorImpl; 1578function combine(initialState, create) { 1579 return function() { 1580 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1581 args[_key] = arguments[_key]; 1582 } 1583 return Object.assign({}, initialState, create(...args)); 1584 }; 1585} 1586function createJSONStorage(getStorage, options) { 1587 let storage; 1588 try { 1589 storage = getStorage(); 1590 } catch (e) { 1591 return; 1592 } 1593 const persistStorage = { 1594 getItem: (name)=>{ 1595 var _a; 1596 const parse = (str2)=>{ 1597 if (str2 === null) { 1598 return null; 1599 } 1600 return JSON.parse(str2, options == null ? void 0 : options.reviver); 1601 }; 1602 const str = (_a = storage.getItem(name)) != null ? _a : null; 1603 if (str instanceof Promise) { 1604 return str.then(parse); 1605 } 1606 return parse(str); 1607 }, 1608 setItem: (name, newValue)=>storage.setItem(name, JSON.stringify(newValue, options == null ? void 0 : options.replacer)), 1609 removeItem: (name)=>storage.removeItem(name) 1610 }; 1611 return persistStorage; 1612} 1613const toThenable = (fn)=>(input)=>{ 1614 try { 1615 const result = fn(input); 1616 if (result instanceof Promise) { 1617 return result; 1618 } 1619 return { 1620 then (onFulfilled) { 1621 return toThenable(onFulfilled)(result); 1622 }, 1623 catch (_onRejected) { 1624 return this; 1625 } 1626 }; 1627 } catch (e) { 1628 return { 1629 then (_onFulfilled) { 1630 return this; 1631 }, 1632 catch (onRejected) { 1633 return toThenable(onRejected)(e); 1634 } 1635 }; 1636 } 1637 }; 1638const persistImpl = (config, baseOptions)=>(set, get, api)=>{ 1639 let options = { 1640 storage: createJSONStorage(()=>window.localStorage), 1641 partialize: (state)=>state, 1642 version: 0, 1643 merge: (persistedState, currentState)=>({ 1644 ...currentState, 1645 ...persistedState 1646 }), 1647 ...baseOptions 1648 }; 1649 let hasHydrated = false;
1650 let hydrationVersion = 0; 1651 const hydrationListeners = /* @__PURE__ */ new Set(); 1652 const finishHydrationListeners = /* @__PURE__ */ new Set(); 1653 let storage = options.storage; 1654 if (!storage) { 1655 return config(function() { 1656 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1657 args[_key] = arguments[_key]; 1658 } 1659 console.warn("[zustand persist middleware] Unable to update item '".concat(options.name, "', the given storage is currently unavailable.")); 1660 set(...args); 1661 }, get, api); 1662 } 1663 const setItem = ()=>{ 1664 const state = options.partialize({ 1665 ...get() 1666 }); 1667 return storage.setItem(options.name, { 1668 state, 1669 version: options.version 1670 }); 1671 }; 1672 const savedSetState = api.setState; 1673 api.setState = (state, replace)=>{ 1674 savedSetState(state, replace); 1675 return setItem(); 1676 }; 1677 const configResult = config(function() { 1678 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){ 1679 args[_key] = arguments[_key]; 1680 } 1681 set(...args); 1682 return setItem(); 1683 }, get, api); 1684 api.getInitialState = ()=>configResult; 1685 let stateFromStorage; 1686 const hydrate = ()=>{ 1687 var _a, _b; 1688 if (!storage) return; 1689 const currentVersion = ++hydrationVersion; 1690 hasHydrated = false; 1691 hydrationListeners.forEach((cb)=>{ 1692 var _a2; 1693 return cb((_a2 = get()) != null ? _a2 : configResult); 1694 }); 1695 const postRehydrationCallback = ((_b = options.onRehydrateStorage) == null ? void 0 : _b.call(options, (_a = get()) != null ? _a : configResult)) || void 0; 1696 return toThenable(storage.getItem.bind(storage))(options.name).then((deserializedStorageValue)=>{ 1697 if (deserializedStorageValue) { 1698 if (typeof deserializedStorageValue.version === "number" && deserializedStorageValue.version !== options.version) { 1699 if (options.migrate) { 1700 const migration = options.migrate(deserializedStorageValue.state, deserializedStorageValue.version); 1701 if (migration instanceof Promise) { 1702 return migration.then((result)=>[ 1703 true, 1704 result 1705 ]); 1706 } 1707 return [ 1708 true, 1709 migration 1710 ]; 1711 } 1712 console.error("State loaded from storage couldn't be migrated since no migrate function was provided"); 1713 } else { 1714 return [ 1715 false, 1716 deserializedStorageValue.state 1717 ]; 1718 } 1719 } 1720 return [ 1721 false, 1722 void 0 1723 ]; 1724 }).then((migrationResult)=>{ 1725 var _a2; 1726 if (currentVersion !== hydrationVersion) { 1727 return; 1728 } 1729 const [migrated, migratedState] = migrationResult; 1730 stateFromStorage = options.merge(migratedState, (_a2 = get()) != null ? _a2 : configResult); 1731 set(stateFromStorage, true); 1732 if (migrated) { 1733 return setItem(); 1734 } 1735 }).then(()=>{ 1736 if (currentVersion !== hydrationVersion) { 1737 return; 1738 } 1739 postRehydrationCallback == null ? void 0 : postRehydrationCallback(get(), void 0); 1740 stateFromStorage = get(); 1741 hasHydrated = true;
1742 finishHydrationListeners.forEach((cb)=>cb(stateFromStorage)); 1743 }).catch((e)=>{ 1744 if (currentVersion !== hydrationVersion) { 1745 return; 1746 } 1747 postRehydrationCallback == null ? void 0 : postRehydrationCallback(void 0, e); 1748 }); 1749 }; 1750 api.persist = { 1751 setOptions: (newOptions)=>{ 1752 options = { 1753 ...options, 1754 ...newOptions 1755 }; 1756 if (newOptions.storage) { 1757 storage = newOptions.storage; 1758 } 1759 }, 1760 clearStorage: ()=>{ 1761 ++hydrationVersion; 1762 storage == null ? void 0 : storage.removeItem(options.name); 1763 }, 1764 getOptions: ()=>options, 1765 rehydrate: ()=>hydrate(), 1766 hasHydrated: ()=>hasHydrated, 1767 onHydrate: (cb)=>{ 1768 hydrationListeners.add(cb); 1769 return ()=>{ 1770 hydrationListeners.delete(cb); 1771 }; 1772 }, 1773 onFinishHydration: (cb)=>{ 1774 finishHydrationListeners.add(cb); 1775 return ()=>{ 1776 finishHydrationListeners.delete(cb); 1777 }; 1778 } 1779 }; 1780 if (!options.skipHydration) { 1781 hydrate(); 1782 } 1783 return stateFromStorage || configResult; 1784 }; 1785const persist = persistImpl; 1786function ssrSafe(config) { 1787 let isSSR = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : typeof window === "undefined"; 1788 return (set, get, api)=>{ 1789 if (!isSSR) { 1790 return config(set, get, api); 1791 } 1792 const ssrSet = ()=>{ 1793 throw new Error("Cannot set state of Zustand store in SSR"); 1794 }; 1795 api.setState = ssrSet; 1796 return config(ssrSet, get, api); 1797 }; 1798} 1799; 1800__turbopack_context__.s([ 1801 "devtools", 1802 0, 1803 devtools, 1804 "subscribeWithSelector", 1805 0, 1806 subscribeWithSelector 1807], 579473); 1808}), 1809218330, 814802, 1810732402, 1811105047, 1812((__turbopack_context__) => { 1813"use strict"; 1814 1815// MERGED MODULE: [project]/src/car-rental/context.tsx [app-client] (ecmascript) 1816; 1817var __TURBOPACK__imported__module__843476__ = __turbopack_context__.i(843476); 1818var __TURBOPACK__imported__module__271645__ = __turbopack_context__.i(271645); 1819var __TURBOPACK__imported__module__898892__ = __turbopack_context__.i(898892); 1820var __TURBOPACK__imported__module__414083__ = __turbopack_context__.i(414083); 1821var __TURBOPACK__imported__module__330079__ = __turbopack_context__.i(330079); 1822// MERGED MODULE: [project]/src/hooks/useBookingOffsetMinutes.ts [app-client] (ecmascript) 1823; 1824var __TURBOPACK__imported__module__406102__ = __turbopack_context__.i(406102); 1825; 1826function useBookingOffsetMinutes() { 1827 var _ref; 1828 const { data } = (0, __TURBOPACK__imported__module__406102__["useBusinessRuleGetBookingOffsetPublic"])(); 1829 return (_ref = data === null || data === void 0 ? void 0 : data.offsetInMinutes) !== null && _ref !== void 0 ? _ref : 0; 1830} 1831__turbopack_context__.s([ 1832 "useBookingOffsetMinutes", 1833 0, 1834 useBookingOffsetMinutes 1835], 814802); 1836var __TURBOPACK__imported__module__773447__ = __turbopack_context__.i(773447); 1837// MERGED MODULE: [project]/src/car-rental/store.ts [app-client] (ecmascript) 1838; 1839var __TURBOPACK__imported__module__929387__ = __turbopack_context__.i(929387); 1840var __TURBOPACK__imported__module__988052__ = __turbopack_context__.i(988052); 1841var __TURBOPACK__imported__module__109881__ = __turbopack_context__.i(109881); 1842var __TURBOPACK__imported__module__952027__ = __turbopack_context__.i(952027); 1843var __TURBOPACK__imported__module__974875__ = __turbopack_context__.i(974875); 1844var __TURBOPACK__imported__module__550516__ = __turbopack_context__.i(550516); 1845var __TURBOPACK__imported__module__408155__ = __turbopack_context__.i(408155); 1846var __TURBOPACK__imported__module__579473__ = __turbopack_context__.i(579473); 1847var __TURBOPACK__imported__module__718580__ = __turbopack_context__.i(718580); 1848var __TURBOPACK__imported__module__685149__ = __turbopack_context__.i(685149); 1849var __TURBOPACK__imported__module__126476__ = __turbopack_context__.i(126476); 1850// MERGED MODULE: [project]/src/car-rental/validators.ts [app-client] (ecmascript) 1851; 1852var __TURBOPACK__imported__module__929387__1 = __TURBOPACK__imported__module__929387__; 1853var __TURBOPACK__imported__module__109881__1 = __TURBOPACK__imported__module__109881__; 1854var __TURBOPACK__imported__module__299378__ = __turbopack_context__.i(299378); 1855var __TURBOPACK__imported__module__861643__ = __turbopack_context__.i(861643); 1856var __TURBOPACK__imported__module__671857__ = __turbopack_context__.i(671857); 1857var __TURBOPACK__imported__module__550516__1 = __TURBOPACK__imported__module__550516__; 1858var __TURBOPACK__imported__module__385479__ = __turbopack_context__.i(385479); 1859var __TURBOPACK__imported__module__702305__ = __turbopack_context__.i(702305); 1860var __TURBOPACK__imported__module__685149__1 = __TURBOPACK__imported__module__685149__; 1861var __TURBOPACK__imported__module__341184__ = __turbopack_context__.i(341184); 1862; 1863; 1864; 1865; 1866; 1867const MS_IN_HOUR = 3_600_000; 1868const MS_IN_MINUTE = 60_000; 1869const isReturnDateAfterPickupDate = (param)=>{ 1870 let { config } = param; 1871 const datePickup = config.datePickup; 1872 const dateReturn = config.dateReturn; 1873 if (!!datePickup && !!dateReturn && dateReturn.getTime() <= datePickup.getTime()) { 1874 return [ 1875 { 1876 type: "date_return_min_one_hour_after_date_pickup", 1877 field: "dateReturn", 1878 message: "Het inlevermoment moet minimaal één uur na het ophaalmoment zijn." 1879 } 1880 ]; 1881 } 1882 return []; 1883}; 1884const isPickupDateAtLeastOneHourInFuture = (param)=>{ 1885 let { config, now } = param; 1886 const datePickup = config.datePickup; 1887 // TODO: Find exceptions to this rule 1888 if (!!datePickup && !!now && // The pickup date should be at least one hour from now. Applying leeway of half a minute 1889 // allows users to still select 16:00 up to 15:00:29. 1890 !((0, __TURBOPACK__imported__module__861643__["differenceInMilliseconds"])(datePickup, now) >= MS_IN_HOUR - MS_IN_MINUTE / 2)) { 1891 return [ 1892 { 1893 type: "date_pickup_min_one_hour_in_future", 1894 field: "datePickup", 1895 message: "Het ophaalmoment moet minimaal één uur in de toekomst zijn." 1896 } 1897 ]; 1898 } 1899 return []; 1900}; 1901const isPickupDateWithinOneYear = (param)=>{ 1902 let { config, now } = param; 1903 const datePickup = config.datePickup; 1904 if (!!datePickup && (0, __TURBOPACK__imported__module__671857__["isAfter"])(datePickup, (0, __TURBOPACK__imported__module__299378__["addYears"])(now, 1))) { 1905 return [ 1906 { 1907 type: "date_pickup_max_one_year_in_future", 1908 field: "datePickup", 1909 message: "Het ophaalmoment mag maximaal één jaar in de toekomst zijn." 1910 } 1911 ]; 1912 } 1913 return []; 1914}; 1915const isLocationOpenOnPickupDate = (param)=>{ 1916 let { config, now, locations, bookingOffsetMinutes } = param; 1917 const datePickup = config.datePickup; 1918 if (!locations) return []; 1919 const pickupLocation = locations.find((it)=>it.id === config.locationId); 1920 if (!pickupLocation || !datePickup) return []; 1921 // Validate that location is not fully closed on pickup date 1922 const disabledPickupDatesForLocation = (0, __TURBOPACK__imported__module__702305__["getDisabledPickupDatesForLocation"])({ 1923 now, 1924 location: pickupLocation, 1925 bookingOffsetMinutes 1926 }); 1927 const isLocationClosedOnPickupDate = disabledPickupDatesForLocation.some((it)=>(0, __TURBOPACK__imported__module__550516__1["isSameDay"])(datePickup, it)); 1928 if (isLocationClosedOnPickupDate) { 1929 return [ 1930 { 1931 type: "location_closed_on_date_pickup", 1932 field: "datePickup", 1933 message: "Het is helaas niet mogelijk om het voertuig op de gekozen datum op te halen bij deze vestiging." 1934 } 1935 ]; 1936 } 1937 // Validate that pickup time is within opening hours of pickup date 1938 const rangeForPickupDate = (0, __TURBOPACK__imported__module__341184__["getOpeningHoursForDate"])({ 1939 date: datePickup, 1940 location: pickupLocation 1941 }); 1942 if (!rangeForPickupDate.some((range)=>{ 1943 const from = (0, __TURBOPACK__imported__module__385479__["parse"])(range.from, "HH:mm", datePickup, { 1944 in: (0, __TURBOPACK__imported__module__109881__1["tz"])(__TURBOPACK__imported__module__685149__1["TIMEZONE"]) 1945 }); 1946 const to = (0, __TURBOPACK__imported__module__385479__["parse"])(range.to, "HH:mm", datePickup, { 1947 in: (0, __TURBOPACK__imported__module__109881__1["tz"])(__TURBOPACK__imported__module__685149__1["TIMEZONE"]) 1948 }); 1949 return datePickup.getTime() >= from.getTime() && datePickup.getTime() < to.getTime(); 1950 })) { 1951 return [ 1952 { 1953 type: "location_closed_on_time_pickup", 1954 field: "datePickup", 1955 message: "De gekozen vestiging is helaas niet geopend op de gekozen ophaaltijd." 1956 } 1957 ]; 1958 } 1959 return []; 1960}; 1961const isLocationPresent = (param)=>{ 1962 let { config } = param; 1963 if (!config.locationId) { 1964 return [ 1965 { 1966 type: "pickup_location_required", 1967 field: "locationId", 1968 message: "Kies een ophaallocatie." 1969 } 1970 ]; 1971 } 1972 return []; 1973}; 1974const isReturnDatePresent = (param)=>{ 1975 let { config } = param; 1976 if (!config.dateReturn) { 1977 return [ 1978 { 1979 type: "date_return_required", 1980 field: "dateReturn", 1981 message: "Kies een inlevermoment." 1982 } 1983 ]; 1984 } 1985 return []; 1986}; 1987const isReturnLocationValid = (param)=>{ 1988 let { config } = param; 1989 // When the pickup location is not Amsterdam Zuid (id: 1), do not allow to return there 1990 if (config.locationId !== undefined && config.locationId !== 1 && config.returnLocationId === 1) { 1991 return [ 1992 { 1993 type: "location_return_not_allowed_in_amsterdam_zuid", 1994 field: "returnLocationId", 1995 message: "Het is helaas niet mogelijk om een voertuig van een andere vestiging in te leveren in Amsterdam Zuid." 1996 } 1997 ]; 1998 } 1999 return []; 2000}; 2001const rentalConfigurationValidators = [ 2002 isReturnDateAfterPickupDate, 2003 isPickupDateAtLeastOneHourInFuture, 2004 isPickupDateWithinOneYear, 2005 isLocationOpenOnPickupDate, 2006 isReturnDatePresent, 2007 isReturnLocationValid 2008]; 2009const validateRentalConfiguration = composeValidators(rentalConfigurationValidators); 2010function composeValidators(validators) { 2011 return (args)=>validators.flatMap((v)=>v(args)); 2012} 2013__turbopack_context__.s([ 2014 "composeValidators", 2015 0, 2016 composeValidators, 2017 "isLocationPresent", 2018 0, 2019 isLocationPresent, 2020 "rentalConfigurationValidators", 2021 0, 2022 rentalConfigurationValidators, 2023 "validateRentalConfiguration", 2024 0, 2025 validateRentalConfiguration 2026], 732402); 2027// MERGED MODULE: [project]/src/components/form/DateTimeInput/getValidTimeSlotForLocation.ts [app-client] (ecmascript) 2028; 2029var __TURBOPACK__imported__module__671857__1 = __TURBOPACK__imported__module__671857__; 2030var __TURBOPACK__imported__module__974875__1 = __TURBOPACK__imported__module__974875__; 2031// MERGED MODULE: [project]/src/car-rental/findFirstAvailableDateByLocation.ts [app-client] (ecmascript) 2032; 2033var __TURBOPACK__imported__module__929387__2 = __TURBOPACK__imported__module__929387__; 2034var __TURBOPACK__imported__module__109881__2 = __TURBOPACK__imported__module__109881__; 2035var __TURBOPACK__imported__module__988052__1 = __TURBOPACK__imported__module__988052__; 2036var __TURBOPACK__imported__module__595727__1 = __turbopack_context__.i(595727); 2037var __TURBOPACK__imported__module__685149__2 = __TURBOPACK__imported__module__685149__; 2038var __TURBOPACK__imported__module__690740__ = __turbopack_context__.i(690740); 2039var __TURBOPACK__imported__module__341184__1 = __TURBOPACK__imported__module__341184__; 2040; 2041; 2042; 2043; 2044; 2045const MAX_DAYS_TO_SEARCH = 365; 2046const findFirstAvailableDateByLocation = (date, location)=>{ 2047 const startDate = new __TURBOPACK__imported__module__988052__1["TZDate"](date, __TURBOPACK__imported__module__685149__2["TIMEZONE"]); 2048 if (!location) { 2049 return startDate; 2050 } 2051 for(let dayOffset = 0; dayOffset <= MAX_DAYS_TO_SEARCH; dayOffset++){ 2052 const candidateDate = new __TURBOPACK__imported__module__988052__1["TZDate"]((0, __TURBOPACK__imported__module__595727__1["addDays"])(startDate, dayOffset, { 2053 in: (0, __TURBOPACK__imported__module__109881__2["tz"])(__TURBOPACK__imported__module__685149__2["TIMEZONE"]) 2054 }), __TURBOPACK__imported__module__685149__2["TIMEZONE"]); 2055 const openingHours = (0, __TURBOPACK__imported__module__341184__1["getOpeningHoursForDate"])({ 2056 date: candidateDate, 2057 location 2058 }); 2059 for (const openingHour of openingHours){ 2060 const opensAt = (0, __TURBOPACK__imported__module__690740__["parseTimeString"])(openingHour.from,
2060candidateDate); 2061 const closesAt = (0, __TURBOPACK__imported__module__690740__["parseTimeString"])(openingHour.to, candidateDate); 2062 if (dayOffset === 0) { 2063 if (startDate.getTime() < opensAt.getTime()) { 2064 return opensAt; 2065 } 2066 if (startDate.getTime() < closesAt.getTime()) { 2067 return startDate; 2068 } 2069 continue; 2070 } 2071 return opensAt; 2072 } 2073 } 2074 // Avoid an unbounded search when a location is misconfigured and never opens. 2075 return startDate; 2076}; 2077__turbopack_context__.s([ 2078 "findFirstAvailableDateByLocation", 2079 0, 2080 findFirstAvailableDateByLocation 2081], 105047); 2082var __TURBOPACK__imported__module__478569__ = __turbopack_context__.i(478569); 2083var __TURBOPACK__imported__module__864516__ = __turbopack_context__.i(864516); 2084; 2085; 2086; 2087; 2088function getValidTimeSlotForLocationWithFallbackDate(param) { 2089 let { location, date, now, bookingOffsetMinutes } = param; 2090 // Find the first open day, might be equal to current pickupDate 2091 const validDay = findFirstAvailableDateByLocation(date, location); 2092 return getValidTimeSlotForLocation({ 2093 location, 2094 date: validDay, 2095 now, 2096 bookingOffsetMinutes 2097 }); 2098} 2099function getValidTimeSlotForLocation(param) { 2100 let { location, date, now, bookingOffsetMinutes } = param; 2101 // Get available time slots for the valid day 2102 const range = (0, __TURBOPACK__imported__module__478569__["getRangeForLocation"])({ 2103 date: date, 2104 now, 2105 location, 2106 bookingOffsetMinutes 2107 }); 2108 // No valid range found 2109 if (!range) { 2110 return null; 2111 } 2112 const slots = (0, __TURBOPACK__imported__module__864516__["getTimeSlotsForRange"])({ 2113 range 2114 }); 2115 const earliest = slots[0]; 2116 const latest = slots[slots.length - 1]; 2117 if ((0, __TURBOPACK__imported__module__974875__1["isBefore"])(date, earliest)) { 2118 return earliest; 2119 } 2120 if ((0, __TURBOPACK__imported__module__671857__1["isAfter"])(date, latest)) { 2121 return latest; 2122 } 2123 return date; 2124} 2125function shiftDatePreservingTime(param) { 2126 let { prevDateReturn, prevDatePickup, newDatePickup } = param; 2127 const difference = (0, __TURBOPACK__imported__module__209019__["differenceInDays"])((0, __TURBOPACK__imported__module__585890__["startOfDay"])(prevDateReturn), (0, __TURBOPACK__imported__module__585890__["startOfDay"])(prevDatePickup)); 2128 const newDateReturn = (0, __TURBOPACK__imported__module__595727__["addDays"])(newDatePickup, difference); 2129 newDateReturn.setHours(prevDateReturn.getHours()); 2130 newDateReturn.setMinutes(prevDateReturn.getMinutes()); 2131 return newDateReturn; 2132} 2133// MERGED MODULE: [project]/src/car-rental/cookie.ts [app-client] (ecmascript) 2134; 2135const SELECTION_COOKIES = { 2136 mainCategoryId: "diks_main_category_id", 2137 locationId: "diks_location_id", 2138 datePickup: "diks_date_pickup", 2139 dateReturn: "diks_date_return" 2140}; 2141var __TURBOPACK__imported__module__702305__1 = __TURBOPACK__imported__module__702305__; 2142; 2143; 2144; 2145; 2146; 2147; 2148; 2149; 2150; 2151; 2152; 2153const createCarRentalConfigurationStore = (param)=>{ 2154 let { selection, locations, config, touched, errors, defaultMainCategoryId, defaultLocationId, now, bookingOffsetMinutes = 0 } = param; 2155 return (0, __TURBOPACK__imported__module__408155__["createStore"])()((0, __TURBOPACK__imported__module__579473__["subscribeWithSelector"])((0, __TURBOPACK__imported__module__579473__["devtools"])((set)=>{ 2156 const defaultConfig = { 2157 locationId: defaultLocationId !== null && defaultLocationId !== void 0 ? defaultLocationId : selection.locationId, 2158 mainCategoryId: defaultMainCategoryId !== null && defaultMainCategoryId !== void 0 ? defaultMainCategoryId : selection.mainCategoryId, 2159 returnLocationId: defaultLocationId, 2160 datePickup: !!selection.datePickup ? new __TURBOPACK__imported__module__988052__["TZDate"](selection.datePickup, __TURBOPACK__imported__module__685149__["TIMEZONE"]) : undefined, 2161 dateReturn: !!selection.dateReturn ? new __TURBOPACK__imported__module__988052__["TZDate"](selection.dateReturn, __TURBOPACK__imported__module__685149__["TIMEZONE"]) : undefined, 2162 expectedKilometers: undefined 2163 }; 2164 const selectionTouched = config === undefined ? { 2165 locationId: selection.locationId !== undefined && defaultLocationId === undefined, 2166 mainCategoryId: selection.mainCategoryId !== undefined && defaultMainCategoryId === undefined, 2167 datePickup: selection.datePickup !== undefined, 2168 dateReturn: selection.dateReturn !== undefined 2169 } : {}; 2170 const initialTouched = { 2171 ...selectionTouched, 2172 ...touched 2173 }; 2174 return { 2175 locations: locations !== null && locations !== void 0 ? locations : [], 2176 config: deriveDefaults({ 2177 now, 2178 config: config !== null && config !== void 0 ? config : defaultConfig, 2179 touched: initialTouched, 2180 locations: locations !== null && locations !== void 0 ? locations : [], 2181 defaultLocationId, 2182 bookingOffsetMinutes 2183 }), 2184 defaultMainCategoryId, 2185 defaultLocationId, 2186 bookingOffsetMinutes, 2187 errors: errors !== null && errors !== void 0 ? errors : [], 2188 touched: initialTouched, 2189 now, 2190 pushErrors: (errors)=>set((state)=>({ 2191 ...state, 2192 errors: [ 2193 ...state.errors, 2194 ...errors 2195 ] 2196 }), undefined, "pushErrors"), 2197 setNow: (now)=>set((state)=>withValidation({ 2198 ...state, 2199 now 2200 }), undefined, "setNow"), 2201 setErrors: (errors)=>set((state)=>withValidation({ 2202 ...state, 2203 errors 2204 }), undefined, "setErrors"), 2205 setConfig: (config, touched)=>set((state)=>withValidation({ 2206 ...state, 2207 config, 2208 touched: touched ? { 2209 ...state.touched, 2210 ...touched 2211 } : state.touched 2212 }), undefined, "setConfig"), 2213 setLocations: (locations)=>set((state)=>withValidation({ 2214 ...state, 2215 locations: locations !== null && locations !== void 0 ? locations : [] 2216 }), undefined, "setLocations"), 2217 setDefaultLocationId: (defaultLocationId)=>set((state)=>withValidation({ 2218 ...state, 2219 config: { 2220 ...state.config, 2221 locationId: state.touched["locationId"] ? state.config.locationId : defaultLocationId, 2222 returnLocationId: state.touched["returnLocationId"] ? state.config.returnLocationId : defaultLocationId 2223 } 2224 }), undefined, "setDefaultLocationId"), 2225 setDefaultMainCategoryId: (defaultMainCategoryId)=>set((state)=>withValidation({ 2226 ...state, 2227 config: { 2228 ...state.config, 2229 mainCategoryId: state.touched["mainCategoryId"] ? state.config.mainCategoryId : defaultMainCategoryId 2230 } 2231 }), undefined, "setDefaultMainCategoryId"), 2232 setBookingOffsetMinutes: (bookingOffsetMinutes)=>set((state)=>withValidation({ 2233 ...state, 2234 bookingOffsetMinutes 2235 }), undefined, "setBookingOffsetMinutes"), 2236 update: (initializer)=>set((state)=>{ 2237 const newConfig = typeof initializer === "function" ? initializer(state.config) : initializer; 2238 return withValidation({ 2239 ...state, 2240 config: newConfig 2241 }); 2242 }, undefined, "update"), 2243 setMainCategoryId: (mainCategoryId)=>{ 2244 return set((state)=>{ 2245 (0, __TURBOPACK__imported__module__126476__["setCookie"])(SELECTION_COOKIES.mainCategoryId, mainCategoryId); 2246 return withValidation({ 2247 ...state, 2248 config: { 2249 ...state.config, 2250 mainCategoryId 2251 }, 2252 touched: { 2253 ...state.touched, 2254 mainCategoryId: true 2255 } 2256 }); 2257 }, undefined, "setMainCategoryId"); 2258 }, 2259 setLocationId: (locationId)=>{ 2260 return set((state)=>{ 2261 (0, __TURBOPACK__imported__module__126476__["setCookie"])(SELECTION_COOKIES.locationId, locationId); 2262 return withValidation({ 2263 ...state, 2264 config: { 2265 ...state.config, 2266 locationId, 2267 returnLocationId: state.touched["returnLocationId"] ? state.config.returnLocationId : undefined 2268 }, 2269 touched: { 2270 ...state.touched, 2271 locationId: true 2272 } 2273 }); 2274 }, undefined, "setLocationId"); 2275 }, 2276 setReturnLocationId: (returnLocationId)=>{ 2277 return set((state)=>{ 2278 return withValidation({ 2279 ...state, 2280 config: { 2281 ...state.config, 2282 returnLocationId 2283 }, 2284 touched: { 2285 ...state.touched, 2286 returnLocationId: true 2287 } 2288 }); 2289 }, undefined, "setReturnLocationId"); 2290 }, 2291 setRentalPeriod: (rentalPeriod)=>{ 2292 return set((state)=>{ 2293 let datePickup = rentalPeriod === null || rentalPeriod === void 0 ? void 0 : rentalPeriod.from; 2294 let dateReturn = rentalPeriod === null || rentalPeriod === void 0 ? void 0 : rentalPeriod.to; 2295 const location = state.locations.find((it)=>it.id === state.config.locationId); 2296 if (!!datePickup) { 2297 var _getMinPickupTimeForLocation; 2298 const globalMinPickupTime = (0, __TURBOPACK__imported__module__702305__1["getMinPickupTime"])({ 2299 now: state.now, 2300 date: datePickup, 2301 locations: state.locations, 2302 bookingOffsetMinutes: state.bookingOffsetMinutes 2303 }); 2304 const minPickupTime = location ? (_getMinPickupTimeForLocation = (0, __TURBOPACK__imported__module__702305__1["getMinPickupTimeForLocation"])({ 2305 now: state.now, 2306 date: datePickup, 2307 location, 2308 bookingOffsetMinutes: state.bookingOffsetMinutes 2309 })) !== null && _getMinPickupTimeForLocation !== void 0 ? _getMinPickupTimeForLocation : globalMinPickupTime : globalMinPickupTime; 2310 // If the pickup time is earlier than the next available pickup time for the new 2311 // pickup date, update the pickup time to be the next available time slot. 2312 if (!!minPickupTime && (0, __TURBOPACK__imported__module__974875__["isBefore"])(datePickup, minPickupTime)) { 2313 datePickup = minPickupTime; 2314 } 2315 } 2316 // If the pickup and return dates are the same, and the return time is less than 1 2317 // hour from the pickup time... 2318 if (!!datePickup && !!dateReturn && (0, __TURBOPACK__imported__module__550516__["isSameDay"])(datePickup, dateReturn, { 2319 in: (0, __TURBOPACK__imported__module__109881__["tz"])(__TURBOPACK__imported__module__685149__["TIMEZONE"]) 2320 }) && dateReturn < (0, __TURBOPACK__imported__module__952027__["addHours"])(datePickup, 1)) { 2321 // Make sure we're only ever updating the return date if the date has changed, 2322 // otherwise we'll unnecessarily update the object identity of the return date. 2323 // Causing an unnecessary reconciliation. 2324 if (!dateReturn || dateReturn.getTime() !== (0, __TURBOPACK__imported__module__952027__["addHours"])(datePickup, 1).getTime()) { 2325 // Move the return date 1 hour into the future. 2326 dateReturn = (0, __TURBOPACK__imported__module__952027__["addHours"])(datePickup, 1); 2327 } 2328 } 2329 (0, __TURBOPACK__imported__module__126476__["setCookie"])(SELECTION_COOKIES.datePickup, datePickup); 2330 (0, __TURBOPACK__imported__module__126476__["setCookie"])(SELECTION_COOKIES.dateReturn, dateReturn); 2331 return withValidation({ 2332 ...state, 2333 config: { 2334 ...state.config, 2335 datePickup, 2336 dateReturn 2337 }, 2338 touched: { 2339 ...state.touched, 2340 dateReturn: !!dateReturn || dateReturn === null, 2341 datePickup: !!datePickup 2342 } 2343 }); 2344 }, undefined, "setRentalPeriod"); 2345 } 2346 }; 2347 }
2347))); 2348}; 2349function deriveDefaults(param) { 2350 let { now, config, touched, locations, defaultLocationId, bookingOffsetMinutes } = param; 2351 let datePickup = config.datePickup; 2352 let dateReturn = config.dateReturn; 2353 if (!touched["datePickup"]) { 2354 var _getValidTimeSlotForLocationWithFallbackDate; 2355 const location = locations.find((it)=>{ 2356 var _config_locationId; 2357 return it.id === ((_config_locationId = config.locationId) !== null && _config_locationId !== void 0 ? _config_locationId : defaultLocationId); 2358 }); 2359 const desired = (0, __TURBOPACK__imported__module__718580__["default"])(now).defaultPickupDate(); 2360 datePickup = (_getValidTimeSlotForLocationWithFallbackDate = getValidTimeSlotForLocationWithFallbackDate({ 2361 location, 2362 date: desired, 2363 now, 2364 bookingOffsetMinutes 2365 })) !== null && _getValidTimeSlotForLocationWithFallbackDate !== void 0 ? _getValidTimeSlotForLocationWithFallbackDate : desired; 2366 } 2367 if (!touched["dateReturn"] && config.dateReturn !== null) { 2368 dateReturn = (0, __TURBOPACK__imported__module__718580__["default"])(now).defaultReturnDate({ 2369 mainCategoryId: config.mainCategoryId, 2370 pickupDate: datePickup 2371 }); 2372 } 2373 return { 2374 ...config, 2375 datePickup, 2376 dateReturn 2377 }; 2378} 2379function withValidation(state) { 2380 const config = deriveDefaults({ 2381 now: state.now, 2382 config: state.config, 2383 touched: state.touched, 2384 locations: state.locations, 2385 defaultLocationId: state.defaultLocationId, 2386 bookingOffsetMinutes: state.bookingOffsetMinutes 2387 }); 2388 const errors = validateRentalConfiguration({ 2389 config, 2390 locations: state.locations, 2391 now: state.now, 2392 bookingOffsetMinutes: state.bookingOffsetMinutes 2393 }); 2394 return { 2395 ...state, 2396 config, 2397 errors 2398 }; 2399} 2400"use client"; 2401; 2402; 2403; 2404; 2405; 2406; 2407; 2408; 2409; 2410; 2411; 2412; 2413const CarRentalConfigurationStoreContext = /*#__PURE__*/ (0, __TURBOPACK__imported__module__271645__["createContext"])(null); 2414function useCarRentalConfigurationStoreContext() { 2415 const store = (0, __TURBOPACK__imported__module__271645__["useContext"])(CarRentalConfigurationStoreContext); 2416 if (!store) { 2417 throw Error("Missing <CarRentalConfigurationProvider>"); 2418 } 2419 return store; 2420} 2421function useCarRentalConfigurationStore(selector) { 2422 const store = useCarRentalConfigurationStoreContext(); 2423 return (0, __TURBOPACK__imported__module__414083__["useStoreWithEqualityFn"])(store, selector, __TURBOPACK__imported__module__898892__["default"]); 2424} 2425const CarRentalConfigurationProvider = /*#__PURE__*/ __TURBOPACK__imported__module__271645__["default"].memo(function CarRentalConfigurationProvider(param) { 2426 let { children, config, errors, touched, selection = {}, ...params } = param; 2427 const { data: _locations = [] } = (0, __TURBOPACK__imported__module__330079__["useLocationList"])({ 2428 queryOptions: { 2429 select: (data)=>data.locations, 2430 enabled: params.locations === undefined 2431 } 2432 }); 2433 const _now = (0, __TURBOPACK__imported__module__773447__["useNow"])(); 2434 const now = (0, __TURBOPACK__imported__module__271645__["useMemo"])(()=>{ 2435 var _params_now; 2436 return (_params_now = params.now) !== null && _params_now !== void 0 ? _params_now : _now; 2437 }, [ 2438 _now, 2439 params.now 2440 ]); 2441 const locations = (0, __TURBOPACK__imported__module__271645__["useMemo"])(()=>{ 2442 return _locations !== null && _locations !== void 0 ? _locations : params.locations; 2443 }, [ 2444 _locations, 2445 params.locations 2446 ]); 2447 const bookingOffsetMinutes = useBookingOffsetMinutes(); 2448 const [store] = (0, __TURBOPACK__imported__module__271645__["useState"])(()=>{ 2449 // Pass parameters during store creation, in case the data is already available. 2450 // This allows skipping a client-side re-render when the data was already fetched server-side. 2451 return createCarRentalConfigurationStore({ 2452 ...params, 2453 now, 2454 locations, 2455 config, 2456 touched, 2457 errors, 2458 selection, 2459 bookingOffsetMinutes 2460 }); 2461 }); 2462 const { defaultLocationId, defaultMainCategoryId } = params; 2463 // Sync default location id, in case it changes client-side. 2464 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2465 store.getState().setDefaultLocationId(defaultLocationId); 2466 }, [ 2467 defaultLocationId, 2468 store 2469 ]); 2470 // Sync default location id, in case it changes client-side. 2471 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2472 store.getState().setDefaultMainCategoryId(defaultMainCategoryId); 2473 }, [ 2474 defaultMainCategoryId, 2475 store 2476 ]); 2477 // Sync location data, in case it changes client-side. 2478 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2479 store.getState().setLocations(locations); 2480 }, [ 2481 locations, 2482 store 2483 ]); 2484 // Sync now, in case it changes client-side. 2485 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2486 store.getState().setNow(now); 2487 }, [ 2488 now, 2489 store 2490 ]); 2491 // Just like the lines above, sync it. Although we shouldn't strictly need this as the data is 2492 // prefetched, it can't hurt. 2493 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2494 store.getState().setBookingOffsetMinutes(bookingOffsetMinutes); 2495 }, [ 2496 bookingOffsetMinutes, 2497 store 2498 ]); 2499 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2500 if (!!errors) { 2501 store.getState().setErrors(errors); 2502 } 2503 }, [ 2504 errors, 2505 store 2506 ]); 2507 (0, __TURBOPACK__imported__module__271645__["useEffect"])(()=>{ 2508 if (!!config) { 2509 store.getState().setConfig(config, touched); 2510 } 2511 }, [ 2512 config, 2513 store, 2514 touched 2515 ]); 2516 return /*#__PURE__*/ (0, __TURBOPACK__imported__module__843476__["jsx"])(CarRentalConfigurationStoreContext.Provider, { 2517 value: store, 2518 children: children 2519 }); 2520}); 2521__turbopack_context__.s([ 2522 "CarRentalConfigurationProvider", 2523 0, 2524 CarRentalConfigurationProvider, 2525 "CarRentalConfigurationStoreContext", 2526 0, 2527 CarRentalConfigurationStoreContext, 2528 "useCarRentalConfigurationStore", 2529 0, 2530 useCarRentalConfigurationStore, 2531 "useCarRentalConfigurationStoreContext", 2532 0, 2533 useCarRentalConfigurationStoreContext 2534], 218330); 2535}), 2536]); 2537 2538//# debugId=b103cc16-c8d7-9cb3-29d6-05866152c5d5
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.