@wix/entity-advanced-permissions 1.1132.0 → 1.1134.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33493,7 +33493,7 @@ var __webpack_exports__ = {};
33493
33493
  (() => {
33494
33494
  "use strict";
33495
33495
  /*!********************************!*\
33496
- !*** ./index.ts + 453 modules ***!
33496
+ !*** ./index.ts + 456 modules ***!
33497
33497
  \********************************/
33498
33498
  // ESM COMPAT FLAG
33499
33499
  __webpack_require__.r(__webpack_exports__);
@@ -54075,6 +54075,19 @@ var index = manageState(Select);
54075
54075
  /* harmony default export */ const react_select_browser_esm = (index);
54076
54076
 
54077
54077
 
54078
+ ;// CONCATENATED MODULE: ../../../node_modules/@vtaits/use-lazy-ref/dist/index.js
54079
+ // src/index.ts
54080
+
54081
+ var EMPTY_VALUE = Symbol("useLazyRef empty value");
54082
+ var useLazyRef = (init) => {
54083
+ const resultRef = (0,external_React_.useRef)(EMPTY_VALUE);
54084
+ if (resultRef.current === EMPTY_VALUE) {
54085
+ resultRef.current = init();
54086
+ }
54087
+ return resultRef;
54088
+ };
54089
+
54090
+ //# sourceMappingURL=index.js.map
54078
54091
  ;// CONCATENATED MODULE: ../../../node_modules/use-is-mounted-ref/dist/use-is-mounted-ref.es.js
54079
54092
 
54080
54093
 
@@ -54092,18 +54105,194 @@ function useIsMountedRef() {
54092
54105
 
54093
54106
  //# sourceMappingURL=use-is-mounted-ref.es.js.map
54094
54107
 
54095
- ;// CONCATENATED MODULE: ../../../node_modules/@vtaits/use-lazy-ref/dist/use-lazy-ref.js
54108
+ ;// CONCATENATED MODULE: ../../../node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.browser.esm.js
54096
54109
 
54097
- const EMPTY_VALUE = Symbol("useLazyRef empty value");
54098
- const useLazyRef = (init) => {
54099
- const resultRef = (0,external_React_.useRef)(EMPTY_VALUE);
54100
- if (resultRef.current === EMPTY_VALUE) {
54101
- resultRef.current = init();
54110
+
54111
+ var use_isomorphic_layout_effect_browser_esm_index = external_React_.useLayoutEffect ;
54112
+
54113
+ /* harmony default export */ const use_isomorphic_layout_effect_browser_esm = (use_isomorphic_layout_effect_browser_esm_index);
54114
+
54115
+ ;// CONCATENATED MODULE: ../../../node_modules/use-latest/dist/use-latest.esm.js
54116
+
54117
+
54118
+
54119
+ var useLatest = function useLatest(value) {
54120
+ var ref = external_React_.useRef(value);
54121
+ use_isomorphic_layout_effect_browser_esm(function () {
54122
+ ref.current = value;
54123
+ });
54124
+ return ref;
54125
+ };
54126
+
54127
+
54128
+
54129
+ ;// CONCATENATED MODULE: ../../../node_modules/krustykrab/dist/esm/index.js
54130
+ // src/option_result.ts
54131
+ function Ok(result) {
54132
+ const self = {
54133
+ isOk: () => true,
54134
+ isOkAnd: (fn) => fn(result),
54135
+ isErr: () => false,
54136
+ isErrAnd: () => false,
54137
+ ok: () => Some(result),
54138
+ err: () => None(),
54139
+ map: (fn) => Ok(fn(result)),
54140
+ mapOr: (_, fn) => fn(result),
54141
+ mapOrElse: (_, fn) => fn(result),
54142
+ mapErr: () => Ok(result),
54143
+ expect: () => result,
54144
+ expectErr: (msg) => {
54145
+ throw new Error(msg);
54146
+ },
54147
+ unwrap: () => result,
54148
+ unwrapErr: () => {
54149
+ throw new Error(`${result}`);
54150
+ },
54151
+ unwrapOr: () => result,
54152
+ unwrapOrElse: () => result,
54153
+ and: (res) => res,
54154
+ andThen: (getRes) => getRes(result),
54155
+ or: () => Ok(result),
54156
+ orElse: () => Ok(result)
54157
+ };
54158
+ return self;
54159
+ }
54160
+ function Err(err) {
54161
+ const self = {
54162
+ isOk: () => false,
54163
+ isOkAnd: () => false,
54164
+ isErr: () => true,
54165
+ isErrAnd: (fn) => fn(err),
54166
+ ok: () => None(),
54167
+ err: () => Some(err),
54168
+ map: () => Err(err),
54169
+ mapOr: (defaultValue) => defaultValue,
54170
+ mapOrElse: (getDefaultValue) => getDefaultValue(err),
54171
+ mapErr: (fn) => Err(fn(err)),
54172
+ expect: (msg) => {
54173
+ throw new Error(msg);
54174
+ },
54175
+ expectErr: () => err,
54176
+ unwrap: () => {
54177
+ throw new Error(`${err}`);
54178
+ },
54179
+ unwrapErr: () => err,
54180
+ unwrapOr: (defaultValue) => defaultValue,
54181
+ unwrapOrElse: (getDefaultValue) => getDefaultValue(err),
54182
+ and: () => Err(err),
54183
+ andThen: () => Err(err),
54184
+ or: (res) => res,
54185
+ orElse: (getRes) => getRes(err)
54186
+ };
54187
+ return self;
54188
+ }
54189
+ function None() {
54190
+ const self = {
54191
+ and: () => None(),
54192
+ andThen: () => None(),
54193
+ expect: (msg) => {
54194
+ throw new Error(msg);
54195
+ },
54196
+ filter: () => self,
54197
+ isSome: () => false,
54198
+ isSomeAnd: () => false,
54199
+ isNone: () => true,
54200
+ map: () => None(),
54201
+ mapOr: (defaultValue) => defaultValue,
54202
+ mapOrElse: (getDefaultValue) => getDefaultValue(),
54203
+ okOr: (err) => Err(err),
54204
+ okOrElse: (getErr) => Err(getErr()),
54205
+ or: (opt) => opt,
54206
+ orElse: (fn) => fn(),
54207
+ unwrap: () => {
54208
+ throw new Error("panic! call `unwrap` on a `None` value");
54209
+ },
54210
+ unwrapOr: (defaultValue) => defaultValue,
54211
+ unwrapOrElse: (getDefaultValue) => getDefaultValue(),
54212
+ xor: (opt) => {
54213
+ if (opt.isSome()) {
54214
+ return opt;
54215
+ }
54216
+ return self;
54217
+ }
54218
+ };
54219
+ return self;
54220
+ }
54221
+ function Some(value) {
54222
+ const self = {
54223
+ and: (opt) => opt,
54224
+ andThen: (fn) => fn(value),
54225
+ expect: () => value,
54226
+ filter: (fn) => {
54227
+ if (fn(value)) {
54228
+ return self;
54229
+ }
54230
+ return None();
54231
+ },
54232
+ isSome: () => true,
54233
+ isSomeAnd: (fn) => fn(value),
54234
+ isNone: () => false,
54235
+ map: (fn) => Some(fn(value)),
54236
+ mapOr: (_, fn) => fn(value),
54237
+ mapOrElse: (_, fn) => fn(value),
54238
+ okOr: () => Ok(value),
54239
+ okOrElse: () => Ok(value),
54240
+ or: () => self,
54241
+ orElse: () => self,
54242
+ unwrap: () => value,
54243
+ unwrapOr: () => value,
54244
+ unwrapOrElse: () => value,
54245
+ xor: (opt) => {
54246
+ if (opt.isNone()) {
54247
+ return self;
54248
+ }
54249
+ return None();
54250
+ }
54251
+ };
54252
+ return self;
54253
+ }
54254
+
54255
+ // src/to_option.ts
54256
+ function toOption(arg) {
54257
+ if (arg === null || arg === void 0) {
54258
+ return None();
54102
54259
  }
54103
- return resultRef;
54104
- };
54260
+ return Some(arg);
54261
+ }
54262
+
54263
+ // src/get_result.ts
54264
+ function getResult(promise) {
54265
+ return promise.then(
54266
+ (response) => Ok(response),
54267
+ (err) => Err(err)
54268
+ );
54269
+ }
54270
+
54271
+ // src/unwrap.ts
54272
+ function esm_unwrap(value) {
54273
+ if (value === null || value === void 0) {
54274
+ throw new Error(`panic! call \`unwrap\` on a \`${value}\` value`);
54275
+ }
54276
+ return value;
54277
+ }
54278
+
54279
+ // src/unwrap_or.ts
54280
+ function unwrapOr(value, defaultValue) {
54281
+ if (value === null || value === void 0) {
54282
+ return defaultValue;
54283
+ }
54284
+ return value;
54285
+ }
54105
54286
 
54287
+ // src/unwrap_or_else.ts
54288
+ function unwrapOrElse(value, getDefaultValue) {
54289
+ if (value === null || value === void 0) {
54290
+ return getDefaultValue();
54291
+ }
54292
+ return value;
54293
+ }
54106
54294
 
54295
+ //# sourceMappingURL=index.js.map
54107
54296
  ;// CONCATENATED MODULE: ../../../node_modules/sleep-promise/build/esm.mjs
54108
54297
  var e=setTimeout;function esm_t(t,n){var u=n.useCachedSetTimeout?e:setTimeout;return new Promise((function(e){u(e,t)}))}function esm_n(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=n.useCachedSetTimeout,r=esm_t(e,{useCachedSetTimeout:u});function o(e){return r.then((function(){return e}))}return o.then=function(){return r.then.apply(r,arguments)},o.catch=Promise.resolve().catch,o}/* harmony default export */ const esm = (esm_n);
54109
54298
 
@@ -54123,6 +54312,17 @@ var jsx_runtime = __webpack_require__(4512);
54123
54312
 
54124
54313
 
54125
54314
 
54315
+
54316
+ // src/defaultReduceOptions.ts
54317
+ var defaultReduceOptions = (prevOptions, loadedOptions) => [...prevOptions, ...loadedOptions];
54318
+
54319
+ // src/defaultShouldLoadMore.ts
54320
+ var AVAILABLE_DELTA = 10;
54321
+ var defaultShouldLoadMore = (scrollHeight, clientHeight, scrollTop) => {
54322
+ const bottomBorder = scrollHeight - clientHeight - AVAILABLE_DELTA;
54323
+ return bottomBorder < scrollTop;
54324
+ };
54325
+
54126
54326
  // src/getInitialCache.ts
54127
54327
  var getInitialCache = (params) => ({
54128
54328
  isFirstLoad: true,
@@ -54139,7 +54339,7 @@ var getInitialOptionsCache = ({
54139
54339
  additional,
54140
54340
  defaultAdditional
54141
54341
  }) => {
54142
- const initialOptions = defaultOptions === true ? null : defaultOptions instanceof Array ? defaultOptions : options;
54342
+ const initialOptions = defaultOptions === true ? null : Array.isArray(defaultOptions) ? defaultOptions : options;
54143
54343
  if (initialOptions) {
54144
54344
  return {
54145
54345
  "": {
@@ -54154,29 +54354,17 @@ var getInitialOptionsCache = ({
54154
54354
  return {};
54155
54355
  };
54156
54356
 
54157
- // src/defaultShouldLoadMore.ts
54158
- var AVAILABLE_DELTA = 10;
54159
- var defaultShouldLoadMore = (scrollHeight, clientHeight, scrollTop) => {
54160
- const bottomBorder = scrollHeight - clientHeight - AVAILABLE_DELTA;
54161
- return bottomBorder < scrollTop;
54162
- };
54163
-
54164
- // src/defaultReduceOptions.ts
54165
- var defaultReduceOptions = (prevOptions, loadedOptions) => [...prevOptions, ...loadedOptions];
54166
-
54167
54357
  // src/requestOptions.ts
54168
54358
 
54169
54359
 
54360
+
54170
54361
  // src/validateResponse.ts
54171
54362
  var errorText = '[react-select-async-paginate] response of "loadOptions" should be an object with "options" prop, which contains array of options.';
54172
54363
  var checkIsResponse = (response) => {
54173
54364
  if (!response) {
54174
54365
  return false;
54175
54366
  }
54176
- const {
54177
- options,
54178
- hasMore
54179
- } = response;
54367
+ const { options, hasMore } = response;
54180
54368
  if (!Array.isArray(options)) {
54181
54369
  return false;
54182
54370
  }
@@ -54201,23 +54389,22 @@ var requestOptions = async (caller, paramsRef, optionsCacheRef, debounceTimeout,
54201
54389
  if (currentOptions.isLoading || !currentOptions.hasMore) {
54202
54390
  return;
54203
54391
  }
54204
- setOptionsCache((prevOptionsCache) => ({
54205
- ...prevOptionsCache,
54206
- [currentInputValue]: {
54207
- ...currentOptions,
54208
- isLoading: true
54209
- }
54210
- }));
54392
+ setOptionsCache(
54393
+ (prevOptionsCache) => ({
54394
+ ...prevOptionsCache,
54395
+ [currentInputValue]: {
54396
+ ...currentOptions,
54397
+ isLoading: true
54398
+ }
54399
+ })
54400
+ );
54211
54401
  if (debounceTimeout > 0 && caller === "input-change") {
54212
54402
  await esm(debounceTimeout);
54213
54403
  const newInputValue = paramsRef.current.inputValue;
54214
54404
  if (currentInputValue !== newInputValue) {
54215
54405
  setOptionsCache((prevOptionsCache) => {
54216
54406
  if (isCacheEmpty) {
54217
- const {
54218
- [currentInputValue]: itemForDelete,
54219
- ...restCache
54220
- } = prevOptionsCache;
54407
+ const { [currentInputValue]: itemForDelete, ...restCache } = prevOptionsCache;
54221
54408
  return restCache;
54222
54409
  }
54223
54410
  return {
@@ -54231,21 +54418,17 @@ var requestOptions = async (caller, paramsRef, optionsCacheRef, debounceTimeout,
54231
54418
  return;
54232
54419
  }
54233
54420
  }
54234
- let response;
54235
- let hasError = false;
54236
- try {
54237
- const {
54238
- loadOptions
54239
- } = paramsRef.current;
54240
- response = await loadOptions(
54241
- currentInputValue,
54242
- currentOptions.options,
54243
- currentOptions.additional
54244
- );
54245
- } catch (e) {
54246
- hasError = true;
54247
- }
54248
- if (hasError) {
54421
+ const { loadOptions } = paramsRef.current;
54422
+ const result = await getResult(
54423
+ Promise.resolve().then(
54424
+ () => loadOptions(
54425
+ currentInputValue,
54426
+ currentOptions.options,
54427
+ currentOptions.additional
54428
+ )
54429
+ )
54430
+ );
54431
+ if (result.isErr()) {
54249
54432
  setOptionsCache((prevOptionsCache) => ({
54250
54433
  ...prevOptionsCache,
54251
54434
  [currentInputValue]: {
@@ -54255,12 +54438,10 @@ var requestOptions = async (caller, paramsRef, optionsCacheRef, debounceTimeout,
54255
54438
  }));
54256
54439
  return;
54257
54440
  }
54441
+ const response = result.unwrap();
54258
54442
  if (validateResponse(response)) {
54259
- const {
54260
- options,
54261
- hasMore
54262
- } = response;
54263
- const newAdditional = response.hasOwnProperty("additional") ? response.additional : currentOptions.additional;
54443
+ const { options, hasMore } = response;
54444
+ const newAdditional = Object.hasOwn(response, "additional") ? response.additional : currentOptions.additional;
54264
54445
  setOptionsCache((prevOptionsCache) => ({
54265
54446
  ...prevOptionsCache,
54266
54447
  [currentInputValue]: {
@@ -54289,33 +54470,37 @@ var useAsyncPaginateBase = (params, deps = []) => {
54289
54470
  shouldLoadMore = defaultShouldLoadMore
54290
54471
  } = params;
54291
54472
  const isMountedRef = useIsMountedRef();
54473
+ const reduceOptionsRef = useLatest(reduceOptions);
54474
+ const loadOptionsOnMenuOpenRef = useLatest(loadOptionsOnMenuOpen);
54292
54475
  const isInitRef = (0,external_React_.useRef)(true);
54293
54476
  const paramsRef = (0,external_React_.useRef)(params);
54294
54477
  paramsRef.current = params;
54295
- const setStateId = (0,external_React_.useState)(0)[1];
54478
+ const [_stateId, setStateId] = (0,external_React_.useState)(0);
54296
54479
  const optionsCacheRef = useLazyRef(() => getInitialOptionsCache(params));
54297
- const callRequestOptions = (0,external_React_.useCallback)((caller) => {
54298
- requestOptions(
54299
- caller,
54300
- paramsRef,
54301
- optionsCacheRef,
54302
- debounceTimeout,
54303
- (reduceState) => {
54304
- optionsCacheRef.current = reduceState(optionsCacheRef.current);
54305
- if (isMountedRef.current) {
54306
- setStateId(increaseStateId);
54307
- }
54308
- },
54309
- reduceOptions
54310
- );
54311
- }, [debounceTimeout]);
54480
+ const callRequestOptionsRef = useLatest(
54481
+ (caller) => {
54482
+ requestOptions(
54483
+ caller,
54484
+ paramsRef,
54485
+ optionsCacheRef,
54486
+ debounceTimeout,
54487
+ (reduceState) => {
54488
+ optionsCacheRef.current = reduceState(optionsCacheRef.current);
54489
+ if (isMountedRef.current) {
54490
+ setStateId(increaseStateId);
54491
+ }
54492
+ },
54493
+ reduceOptionsRef.current
54494
+ );
54495
+ }
54496
+ );
54312
54497
  const handleScrolledToBottom = (0,external_React_.useCallback)(() => {
54313
54498
  const currentInputValue = paramsRef.current.inputValue;
54314
54499
  const currentOptions2 = optionsCacheRef.current[currentInputValue];
54315
54500
  if (currentOptions2) {
54316
- callRequestOptions("menu-scroll");
54501
+ callRequestOptionsRef.current("menu-scroll");
54317
54502
  }
54318
- }, [callRequestOptions]);
54503
+ }, [callRequestOptionsRef, optionsCacheRef]);
54319
54504
  (0,external_React_.useEffect)(() => {
54320
54505
  if (isInitRef.current) {
54321
54506
  isInitRef.current = false;
@@ -54324,19 +54509,24 @@ var useAsyncPaginateBase = (params, deps = []) => {
54324
54509
  setStateId(increaseStateId);
54325
54510
  }
54326
54511
  if (defaultOptions === true) {
54327
- callRequestOptions("autoload");
54512
+ callRequestOptionsRef.current("autoload");
54328
54513
  }
54329
54514
  }, deps);
54330
54515
  (0,external_React_.useEffect)(() => {
54331
54516
  if (menuIsOpen && !optionsCacheRef.current[inputValue]) {
54332
- callRequestOptions("input-change");
54517
+ callRequestOptionsRef.current("input-change");
54333
54518
  }
54334
- }, [inputValue]);
54519
+ }, [callRequestOptionsRef, inputValue, menuIsOpen, optionsCacheRef]);
54335
54520
  (0,external_React_.useEffect)(() => {
54336
- if (menuIsOpen && !optionsCacheRef.current[""] && loadOptionsOnMenuOpen) {
54337
- callRequestOptions("menu-toggle");
54521
+ if (menuIsOpen && !optionsCacheRef.current[""] && loadOptionsOnMenuOpenRef.current) {
54522
+ callRequestOptionsRef.current("menu-toggle");
54338
54523
  }
54339
- }, [menuIsOpen]);
54524
+ }, [
54525
+ callRequestOptionsRef,
54526
+ loadOptionsOnMenuOpenRef,
54527
+ menuIsOpen,
54528
+ optionsCacheRef
54529
+ ]);
54340
54530
  const currentOptions = optionsCacheRef.current[inputValue] || getInitialCache(params);
54341
54531
  return {
54342
54532
  handleScrolledToBottom,
@@ -54362,17 +54552,18 @@ var useAsyncPaginate = (params, deps = []) => {
54362
54552
  const [inputValueState, setInputValue] = (0,external_React_.useState)(
54363
54553
  defaultInputValueParam || ""
54364
54554
  );
54365
- const [menuIsOpenState, setMenuIsOpen] = (0,external_React_.useState)(
54366
- !!defaultMenuIsOpenParam
54367
- );
54555
+ const [menuIsOpenState, setMenuIsOpen] = (0,external_React_.useState)(!!defaultMenuIsOpenParam);
54368
54556
  const inputValue = typeof inputValueParam === "string" ? inputValueParam : inputValueState;
54369
54557
  const menuIsOpen = typeof menuIsOpenParam === "boolean" ? menuIsOpenParam : menuIsOpenState;
54370
- const onInputChange = (0,external_React_.useCallback)((nextInputValue, actionMeta) => {
54371
- if (onInputChangeParam) {
54372
- onInputChangeParam(nextInputValue, actionMeta);
54373
- }
54374
- setInputValue(nextInputValue);
54375
- }, [onInputChangeParam]);
54558
+ const onInputChange = (0,external_React_.useCallback)(
54559
+ (nextInputValue, actionMeta) => {
54560
+ if (onInputChangeParam) {
54561
+ onInputChangeParam(nextInputValue, actionMeta);
54562
+ }
54563
+ setInputValue(nextInputValue);
54564
+ },
54565
+ [onInputChangeParam]
54566
+ );
54376
54567
  const onMenuClose = (0,external_React_.useCallback)(() => {
54377
54568
  if (onMenuCloseParam) {
54378
54569
  onMenuCloseParam();
@@ -54414,14 +54605,8 @@ var useAsyncPaginate = (params, deps = []) => {
54414
54605
  var CHECK_TIMEOUT = 300;
54415
54606
  function wrapMenuList(MenuList2) {
54416
54607
  function WrappedMenuList(props) {
54417
- const {
54418
- selectProps,
54419
- innerRef
54420
- } = props;
54421
- const {
54422
- handleScrolledToBottom,
54423
- shouldLoadMore
54424
- } = selectProps;
54608
+ const { selectProps, innerRef } = props;
54609
+ const { handleScrolledToBottom, shouldLoadMore } = selectProps;
54425
54610
  const checkTimeoutRef = (0,external_React_.useRef)();
54426
54611
  const menuListRef = (0,external_React_.useRef)(null);
54427
54612
  const shouldHandle = (0,external_React_.useCallback)(() => {
@@ -54429,11 +54614,7 @@ function wrapMenuList(MenuList2) {
54429
54614
  if (!el) {
54430
54615
  return false;
54431
54616
  }
54432
- const {
54433
- scrollTop,
54434
- scrollHeight,
54435
- clientHeight
54436
- } = el;
54617
+ const { scrollTop, scrollHeight, clientHeight } = el;
54437
54618
  return shouldLoadMore(scrollHeight, clientHeight, scrollTop);
54438
54619
  }, [shouldLoadMore]);
54439
54620
  const checkAndHandle = (0,external_React_.useCallback)(() => {
@@ -54443,9 +54624,12 @@ function wrapMenuList(MenuList2) {
54443
54624
  }
54444
54625
  }
54445
54626
  }, [shouldHandle, handleScrolledToBottom]);
54446
- const setCheckAndHandleTimeout = (0,external_React_.useCallback)(() => {
54447
- checkAndHandle();
54448
- checkTimeoutRef.current = setTimeout(setCheckAndHandleTimeout, CHECK_TIMEOUT);
54627
+ const setCheckAndHandleTimeout = (0,external_React_.useMemo)(() => {
54628
+ const res = () => {
54629
+ checkAndHandle();
54630
+ checkTimeoutRef.current = setTimeout(res, CHECK_TIMEOUT);
54631
+ };
54632
+ return res;
54449
54633
  }, [checkAndHandle]);
54450
54634
  (0,external_React_.useEffect)(() => {
54451
54635
  setCheckAndHandleTimeout();
@@ -54468,10 +54652,13 @@ function wrapMenuList(MenuList2) {
54468
54652
 
54469
54653
  // src/useComponents.ts
54470
54654
  var esm_MenuList = wrapMenuList(components.MenuList);
54471
- var useComponents = (components) => (0,external_React_.useMemo)(() => ({
54472
- MenuList: esm_MenuList,
54473
- ...components
54474
- }), [components]);
54655
+ var useComponents = (components) => (0,external_React_.useMemo)(
54656
+ () => ({
54657
+ MenuList: esm_MenuList,
54658
+ ...components
54659
+ }),
54660
+ [components]
54661
+ );
54475
54662
 
54476
54663
  // src/withAsyncPaginate.tsx
54477
54664
 
@@ -54486,11 +54673,10 @@ function withAsyncPaginate(SelectComponent) {
54486
54673
  cacheUniqs = defaultCacheUniqs,
54487
54674
  ...rest
54488
54675
  } = props;
54489
- const asyncPaginateProps = useAsyncPaginate(
54490
- rest,
54491
- cacheUniqs
54676
+ const asyncPaginateProps = useAsyncPaginate(rest, cacheUniqs);
54677
+ const processedComponents = useComponents(
54678
+ components
54492
54679
  );
54493
- const processedComponents = useComponents(components);
54494
54680
  const isLoading = typeof isLoadingProp === "boolean" ? isLoadingProp : asyncPaginateProps.isLoading;
54495
54681
  return /* @__PURE__ */ (0,jsx_runtime.jsx)(
54496
54682
  SelectComponent,
@@ -54511,10 +54697,7 @@ var checkGroup = (group) => {
54511
54697
  if (!group) {
54512
54698
  return false;
54513
54699
  }
54514
- const {
54515
- label,
54516
- options
54517
- } = group;
54700
+ const { label, options } = group;
54518
54701
  if (typeof label !== "string" && typeof label !== "undefined") {
54519
54702
  return false;
54520
54703
  }
@@ -54528,13 +54711,11 @@ var reduceGroupedOptions = (prevOptions, loadedOptions) => {
54528
54711
  const mapLabelToIndex = {};
54529
54712
  let prevOptionsIndex = 0;
54530
54713
  const prevOptionsLength = prevOptions.length;
54531
- loadedOptions.forEach((optionOrGroup) => {
54714
+ for (const optionOrGroup of loadedOptions) {
54532
54715
  const group = checkGroup(optionOrGroup) ? optionOrGroup : {
54533
54716
  options: [optionOrGroup]
54534
54717
  };
54535
- const {
54536
- label = ""
54537
- } = group;
54718
+ const { label = "" } = group;
54538
54719
  let groupIndex = mapLabelToIndex[label];
54539
54720
  if (typeof groupIndex !== "number") {
54540
54721
  for (; prevOptionsIndex < prevOptionsLength && typeof mapLabelToIndex[label] !== "number"; ++prevOptionsIndex) {
@@ -54548,13 +54729,13 @@ var reduceGroupedOptions = (prevOptions, loadedOptions) => {
54548
54729
  if (typeof groupIndex !== "number") {
54549
54730
  mapLabelToIndex[label] = res.length;
54550
54731
  res.push(group);
54551
- return;
54732
+ } else {
54733
+ res[groupIndex] = {
54734
+ ...res[groupIndex],
54735
+ options: [...res[groupIndex].options, ...group.options]
54736
+ };
54552
54737
  }
54553
- res[groupIndex] = {
54554
- ...res[groupIndex],
54555
- options: [...res[groupIndex].options, ...group.options]
54556
- };
54557
- });
54738
+ }
54558
54739
  return res;
54559
54740
  };
54560
54741