@orderingstack/front-components-product-configurator 1.2.3 → 1.3.1

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.
Files changed (46) hide show
  1. package/dist/components/Counter/Counter.d.ts +0 -1
  2. package/dist/components/Counter/Counter.d.ts.map +1 -1
  3. package/dist/components/DisplayState/DisplayState.d.ts +0 -1
  4. package/dist/components/DisplayState/DisplayState.d.ts.map +1 -1
  5. package/dist/components/GroupStateInfo/GroupStateInfo.d.ts +0 -1
  6. package/dist/components/GroupStateInfo/GroupStateInfo.d.ts.map +1 -1
  7. package/dist/components/InfoLine/InfoLine.d.ts +0 -1
  8. package/dist/components/InfoLine/InfoLine.d.ts.map +1 -1
  9. package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts +0 -1
  10. package/dist/components/MenuItemsDispatcher/MenuItemsDispatcher.d.ts.map +1 -1
  11. package/dist/components/MenuOptions/MenuOptions.d.ts +0 -1
  12. package/dist/components/MenuOptions/MenuOptions.d.ts.map +1 -1
  13. package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts +0 -1
  14. package/dist/components/MenuOptions/MenuOptionsDefaultUI.d.ts.map +1 -1
  15. package/dist/components/MenuProduct/MenuProduct.d.ts +0 -1
  16. package/dist/components/MenuProduct/MenuProduct.d.ts.map +1 -1
  17. package/dist/components/MenuProductRoot/MenuProductRoot.d.ts +0 -1
  18. package/dist/components/MenuProductRoot/MenuProductRoot.d.ts.map +1 -1
  19. package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts +0 -1
  20. package/dist/components/MenuProductRoot/MenuProductRootDefaultUI.d.ts.map +1 -1
  21. package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts +0 -1
  22. package/dist/components/MenuProductRoot/MenuProductRootDefaultUIModal.d.ts.map +1 -1
  23. package/dist/components/Price/Price.d.ts +0 -1
  24. package/dist/components/Price/Price.d.ts.map +1 -1
  25. package/dist/components/ProductConfigurator/ProductConfigurator.d.ts +0 -1
  26. package/dist/components/ProductConfigurator/ProductConfigurator.d.ts.map +1 -1
  27. package/dist/components/ProductConfigurator/useProductConfigurator.d.ts.map +1 -1
  28. package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts +0 -1
  29. package/dist/components/SimpleCheckbox/SimpleCheckbox.d.ts.map +1 -1
  30. package/dist/components/SimpleRadio/SimpleRadio.d.ts +0 -1
  31. package/dist/components/SimpleRadio/SimpleRadio.d.ts.map +1 -1
  32. package/dist/components/SubmitRow/SubmitRow.d.ts +0 -1
  33. package/dist/components/SubmitRow/SubmitRow.d.ts.map +1 -1
  34. package/dist/context/Components.d.ts +3 -11
  35. package/dist/context/Components.d.ts.map +1 -1
  36. package/dist/context/ProductData.d.ts +11 -0
  37. package/dist/context/ProductData.d.ts.map +1 -0
  38. package/dist/index.cjs.js +9 -6
  39. package/dist/index.cjs.js.map +1 -1
  40. package/dist/index.es.js +411 -293
  41. package/dist/index.es.js.map +1 -1
  42. package/dist/types/index.d.ts +0 -1
  43. package/dist/types/index.d.ts.map +1 -1
  44. package/dist/utils/formatValues.d.ts +3 -1
  45. package/dist/utils/formatValues.d.ts.map +1 -1
  46. package/package.json +88 -88
package/dist/index.es.js CHANGED
@@ -4903,225 +4903,6 @@ const countComplexProductPrice = (product) => {
4903
4903
  }
4904
4904
  return price;
4905
4905
  };
4906
- const properyToEncode = ["id", "selCtx", "fltCtx"];
4907
- const CHAR_TO_REPLACE = ".";
4908
- const REPLACEMENT_CHAR = "#dot";
4909
- const replaceIn = (value) => {
4910
- return value.replaceAll(CHAR_TO_REPLACE, REPLACEMENT_CHAR);
4911
- };
4912
- const replaceOut = (value) => {
4913
- return value.replaceAll(REPLACEMENT_CHAR, CHAR_TO_REPLACE);
4914
- };
4915
- const encodeValue = (key, value) => {
4916
- return codeValue(key, value, replaceIn);
4917
- };
4918
- const decodeValue = (key, value) => {
4919
- return codeValue(key, value, replaceOut);
4920
- };
4921
- const codeValue = (key, value, replaceCb) => {
4922
- let resValue = value;
4923
- if (properyToEncode.includes(key) && (typeof value === "string" || value instanceof String)) {
4924
- resValue = replaceCb(value);
4925
- }
4926
- if (key === "selected" || key === "filter") {
4927
- const stringified = JSON.stringify(value);
4928
- const stringifiedReplaced = replaceCb(stringified);
4929
- resValue = JSON.parse(stringifiedReplaced);
4930
- }
4931
- return resValue;
4932
- };
4933
- const iterateOverObject = (obj, cb) => {
4934
- Object.keys(obj).forEach((key) => {
4935
- const value = obj[key];
4936
- obj[key] = cb(key, value);
4937
- if (typeof value === "object" && value !== null) {
4938
- iterateOverObject(value, cb);
4939
- }
4940
- });
4941
- return obj;
4942
- };
4943
- const cleanSelected = (selected) => {
4944
- const selectedCopy = JSON.parse(JSON.stringify(selected));
4945
- for (const [contextName, value] of Object.entries(selectedCopy)) {
4946
- if (value && !Array.isArray(value)) {
4947
- const nestedObj = selectedCopy[contextName];
4948
- for (const [nestedKey, nestedValue] of Object.entries(nestedObj)) {
4949
- if (nestedValue === false) {
4950
- delete nestedObj[nestedKey];
4951
- }
4952
- }
4953
- if (Object.keys(nestedObj).length === 0) {
4954
- delete selectedCopy[contextName];
4955
- }
4956
- } else {
4957
- delete selectedCopy[contextName];
4958
- }
4959
- }
4960
- return selectedCopy;
4961
- };
4962
- const decodeSelected = (selected) => {
4963
- return decodeValue("selected", selected);
4964
- };
4965
- const isApiBooleanTrue = (value) => {
4966
- if (value === "true" || value === true) {
4967
- return true;
4968
- }
4969
- return false;
4970
- };
4971
- const scrollToId = (id) => {
4972
- const element = document.getElementById(id);
4973
- if (element) {
4974
- element.scrollIntoView({ behavior: "smooth" });
4975
- } else {
4976
- console.warn(`Error: scrollToId: id: ${id} not found in html structure`);
4977
- }
4978
- };
4979
- const getOptionsKindId = (contextName) => {
4980
- return `options--${contextName}`;
4981
- };
4982
- const getItemImage = (item) => {
4983
- const { details: { media = [] } = {} } = item;
4984
- const mainMedia = media.find((el) => el.name === "MAIN_IMG") || media[0] || {};
4985
- return (mainMedia == null ? void 0 : mainMedia.url) || "";
4986
- };
4987
- const isVisible = (item) => {
4988
- var _a, _b;
4989
- const isHidden = ((_a = item == null ? void 0 : item.attrs) == null ? void 0 : _a.hidden) === true || ((_b = item == null ? void 0 : item["_"]) == null ? void 0 : _b.hidden) === "true";
4990
- return !isHidden;
4991
- };
4992
- function createStore(createState) {
4993
- let state;
4994
- const listeners = /* @__PURE__ */ new Set();
4995
- const setState = (partial, replace) => {
4996
- const nextState = typeof partial === "function" ? partial(state) : partial;
4997
- if (nextState !== state) {
4998
- const previousState = state;
4999
- state = replace ? nextState : Object.assign({}, state, nextState);
5000
- listeners.forEach((listener) => listener(state, previousState));
5001
- }
5002
- };
5003
- const getState = () => state;
5004
- const subscribeWithSelector = (listener, selector = getState, equalityFn = Object.is) => {
5005
- console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");
5006
- let currentSlice = selector(state);
5007
- function listenerToAdd() {
5008
- const nextSlice = selector(state);
5009
- if (!equalityFn(currentSlice, nextSlice)) {
5010
- const previousSlice = currentSlice;
5011
- listener(currentSlice = nextSlice, previousSlice);
5012
- }
5013
- }
5014
- listeners.add(listenerToAdd);
5015
- return () => listeners.delete(listenerToAdd);
5016
- };
5017
- const subscribe = (listener, selector, equalityFn) => {
5018
- if (selector || equalityFn) {
5019
- return subscribeWithSelector(listener, selector, equalityFn);
5020
- }
5021
- listeners.add(listener);
5022
- return () => listeners.delete(listener);
5023
- };
5024
- const destroy = () => listeners.clear();
5025
- const api = { setState, getState, subscribe, destroy };
5026
- state = createState(setState, getState, api);
5027
- return api;
5028
- }
5029
- const isSSR = typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent);
5030
- const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
5031
- function create(createState) {
5032
- const api = typeof createState === "function" ? createStore(createState) : createState;
5033
- const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
5034
- const [, forceUpdate] = useReducer((c) => c + 1, 0);
5035
- const state = api.getState();
5036
- const stateRef = useRef(state);
5037
- const selectorRef = useRef(selector);
5038
- const equalityFnRef = useRef(equalityFn);
5039
- const erroredRef = useRef(false);
5040
- const currentSliceRef = useRef();
5041
- if (currentSliceRef.current === void 0) {
5042
- currentSliceRef.current = selector(state);
5043
- }
5044
- let newStateSlice;
5045
- let hasNewStateSlice = false;
5046
- if (stateRef.current !== state || selectorRef.current !== selector || equalityFnRef.current !== equalityFn || erroredRef.current) {
5047
- newStateSlice = selector(state);
5048
- hasNewStateSlice = !equalityFn(currentSliceRef.current, newStateSlice);
5049
- }
5050
- useIsomorphicLayoutEffect(() => {
5051
- if (hasNewStateSlice) {
5052
- currentSliceRef.current = newStateSlice;
5053
- }
5054
- stateRef.current = state;
5055
- selectorRef.current = selector;
5056
- equalityFnRef.current = equalityFn;
5057
- erroredRef.current = false;
5058
- });
5059
- const stateBeforeSubscriptionRef = useRef(state);
5060
- useIsomorphicLayoutEffect(() => {
5061
- const listener = () => {
5062
- try {
5063
- const nextState = api.getState();
5064
- const nextStateSlice = selectorRef.current(nextState);
5065
- if (!equalityFnRef.current(currentSliceRef.current, nextStateSlice)) {
5066
- stateRef.current = nextState;
5067
- currentSliceRef.current = nextStateSlice;
5068
- forceUpdate();
5069
- }
5070
- } catch (error2) {
5071
- erroredRef.current = true;
5072
- forceUpdate();
5073
- }
5074
- };
5075
- const unsubscribe = api.subscribe(listener);
5076
- if (api.getState() !== stateBeforeSubscriptionRef.current) {
5077
- listener();
5078
- }
5079
- return unsubscribe;
5080
- }, []);
5081
- const sliceToReturn = hasNewStateSlice ? newStateSlice : currentSliceRef.current;
5082
- useDebugValue(sliceToReturn);
5083
- return sliceToReturn;
5084
- };
5085
- Object.assign(useStore2, api);
5086
- useStore2[Symbol.iterator] = function() {
5087
- console.warn("[useStore, api] = create() is deprecated and will be removed in v4");
5088
- const items = [useStore2, api];
5089
- return {
5090
- next() {
5091
- const done = items.length <= 0;
5092
- return { value: items.shift(), done };
5093
- }
5094
- };
5095
- };
5096
- return useStore2;
5097
- }
5098
- const createFilterSlice = (set2) => ({
5099
- filter: {},
5100
- initialSelected: {},
5101
- setInitialFilter: (productFilter) => {
5102
- set2(() => ({
5103
- filter: {
5104
- ...productFilter
5105
- }
5106
- }));
5107
- },
5108
- setInitialSelected: (selected) => {
5109
- set2(() => ({
5110
- initialSelected: selected
5111
- }));
5112
- },
5113
- setFilter: (fltCtx, emit) => {
5114
- set2(({ filter }) => ({
5115
- filter: {
5116
- ...filter,
5117
- [fltCtx]: {
5118
- ...filter[fltCtx],
5119
- ...emit
5120
- }
5121
- }
5122
- }));
5123
- }
5124
- });
5125
4906
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
5126
4907
  var freeGlobal$1 = freeGlobal;
5127
4908
  var freeSelf = typeof self == "object" && self && self.Object === Object && self;
@@ -5130,11 +4911,11 @@ var root$1 = root;
5130
4911
  var Symbol$1 = root$1.Symbol;
5131
4912
  var Symbol$2 = Symbol$1;
5132
4913
  var objectProto$f = Object.prototype;
5133
- var hasOwnProperty$c = objectProto$f.hasOwnProperty;
4914
+ var hasOwnProperty$d = objectProto$f.hasOwnProperty;
5134
4915
  var nativeObjectToString$1 = objectProto$f.toString;
5135
4916
  var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
5136
4917
  function getRawTag(value) {
5137
- var isOwn = hasOwnProperty$c.call(value, symToStringTag$1), tag = value[symToStringTag$1];
4918
+ var isOwn = hasOwnProperty$d.call(value, symToStringTag$1), tag = value[symToStringTag$1];
5138
4919
  try {
5139
4920
  value[symToStringTag$1] = void 0;
5140
4921
  var unmasked = true;
@@ -5258,9 +5039,9 @@ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
5258
5039
  var reIsHostCtor = /^\[object .+?Constructor\]$/;
5259
5040
  var funcProto = Function.prototype, objectProto$d = Object.prototype;
5260
5041
  var funcToString = funcProto.toString;
5261
- var hasOwnProperty$b = objectProto$d.hasOwnProperty;
5042
+ var hasOwnProperty$c = objectProto$d.hasOwnProperty;
5262
5043
  var reIsNative = RegExp(
5263
- "^" + funcToString.call(hasOwnProperty$b).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5044
+ "^" + funcToString.call(hasOwnProperty$c).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
5264
5045
  );
5265
5046
  function baseIsNative(value) {
5266
5047
  if (!isObject(value) || isMasked(value)) {
@@ -5345,10 +5126,10 @@ function eq(value, other) {
5345
5126
  return value === other || value !== value && other !== other;
5346
5127
  }
5347
5128
  var objectProto$c = Object.prototype;
5348
- var hasOwnProperty$a = objectProto$c.hasOwnProperty;
5129
+ var hasOwnProperty$b = objectProto$c.hasOwnProperty;
5349
5130
  function assignValue(object, key, value) {
5350
5131
  var objValue = object[key];
5351
- if (!(hasOwnProperty$a.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
5132
+ if (!(hasOwnProperty$b.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) {
5352
5133
  baseAssignValue(object, key, value);
5353
5134
  }
5354
5135
  }
@@ -5394,12 +5175,12 @@ function baseIsArguments(value) {
5394
5175
  return isObjectLike(value) && baseGetTag(value) == argsTag$3;
5395
5176
  }
5396
5177
  var objectProto$a = Object.prototype;
5397
- var hasOwnProperty$9 = objectProto$a.hasOwnProperty;
5178
+ var hasOwnProperty$a = objectProto$a.hasOwnProperty;
5398
5179
  var propertyIsEnumerable$1 = objectProto$a.propertyIsEnumerable;
5399
5180
  var isArguments = baseIsArguments(function() {
5400
5181
  return arguments;
5401
5182
  }()) ? baseIsArguments : function(value) {
5402
- return isObjectLike(value) && hasOwnProperty$9.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
5183
+ return isObjectLike(value) && hasOwnProperty$a.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
5403
5184
  };
5404
5185
  var isArguments$1 = isArguments;
5405
5186
  function stubFalse() {
@@ -5444,11 +5225,11 @@ var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
5444
5225
  var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
5445
5226
  var isTypedArray$1 = isTypedArray;
5446
5227
  var objectProto$9 = Object.prototype;
5447
- var hasOwnProperty$8 = objectProto$9.hasOwnProperty;
5228
+ var hasOwnProperty$9 = objectProto$9.hasOwnProperty;
5448
5229
  function arrayLikeKeys(value, inherited) {
5449
5230
  var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$1(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
5450
5231
  for (var key in value) {
5451
- if ((inherited || hasOwnProperty$8.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
5232
+ if ((inherited || hasOwnProperty$9.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
5452
5233
  result.push(key);
5453
5234
  }
5454
5235
  }
@@ -5462,14 +5243,14 @@ function overArg(func, transform) {
5462
5243
  var nativeKeys = overArg(Object.keys, Object);
5463
5244
  var nativeKeys$1 = nativeKeys;
5464
5245
  var objectProto$8 = Object.prototype;
5465
- var hasOwnProperty$7 = objectProto$8.hasOwnProperty;
5246
+ var hasOwnProperty$8 = objectProto$8.hasOwnProperty;
5466
5247
  function baseKeys(object) {
5467
5248
  if (!isPrototype(object)) {
5468
5249
  return nativeKeys$1(object);
5469
5250
  }
5470
5251
  var result = [];
5471
5252
  for (var key in Object(object)) {
5472
- if (hasOwnProperty$7.call(object, key) && key != "constructor") {
5253
+ if (hasOwnProperty$8.call(object, key) && key != "constructor") {
5473
5254
  result.push(key);
5474
5255
  }
5475
5256
  }
@@ -5488,14 +5269,14 @@ function nativeKeysIn(object) {
5488
5269
  return result;
5489
5270
  }
5490
5271
  var objectProto$7 = Object.prototype;
5491
- var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
5272
+ var hasOwnProperty$7 = objectProto$7.hasOwnProperty;
5492
5273
  function baseKeysIn(object) {
5493
5274
  if (!isObject(object)) {
5494
5275
  return nativeKeysIn(object);
5495
5276
  }
5496
5277
  var isProto = isPrototype(object), result = [];
5497
5278
  for (var key in object) {
5498
- if (!(key == "constructor" && (isProto || !hasOwnProperty$6.call(object, key)))) {
5279
+ if (!(key == "constructor" && (isProto || !hasOwnProperty$7.call(object, key)))) {
5499
5280
  result.push(key);
5500
5281
  }
5501
5282
  }
@@ -5517,20 +5298,20 @@ function hashDelete(key) {
5517
5298
  }
5518
5299
  var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
5519
5300
  var objectProto$6 = Object.prototype;
5520
- var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
5301
+ var hasOwnProperty$6 = objectProto$6.hasOwnProperty;
5521
5302
  function hashGet(key) {
5522
5303
  var data = this.__data__;
5523
5304
  if (nativeCreate$1) {
5524
5305
  var result = data[key];
5525
5306
  return result === HASH_UNDEFINED$2 ? void 0 : result;
5526
5307
  }
5527
- return hasOwnProperty$5.call(data, key) ? data[key] : void 0;
5308
+ return hasOwnProperty$6.call(data, key) ? data[key] : void 0;
5528
5309
  }
5529
5310
  var objectProto$5 = Object.prototype;
5530
- var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
5311
+ var hasOwnProperty$5 = objectProto$5.hasOwnProperty;
5531
5312
  function hashHas(key) {
5532
5313
  var data = this.__data__;
5533
- return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$4.call(data, key);
5314
+ return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$5.call(data, key);
5534
5315
  }
5535
5316
  var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
5536
5317
  function hashSet(key, value) {
@@ -5810,10 +5591,10 @@ if (DataView$1 && getTag(new DataView$1(new ArrayBuffer(1))) != dataViewTag$3 ||
5810
5591
  }
5811
5592
  var getTag$1 = getTag;
5812
5593
  var objectProto$3 = Object.prototype;
5813
- var hasOwnProperty$3 = objectProto$3.hasOwnProperty;
5594
+ var hasOwnProperty$4 = objectProto$3.hasOwnProperty;
5814
5595
  function initCloneArray(array) {
5815
5596
  var length = array.length, result = new array.constructor(length);
5816
- if (length && typeof array[0] == "string" && hasOwnProperty$3.call(array, "index")) {
5597
+ if (length && typeof array[0] == "string" && hasOwnProperty$4.call(array, "index")) {
5817
5598
  result.index = array.index;
5818
5599
  result.input = array.input;
5819
5600
  }
@@ -6105,7 +5886,7 @@ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
6105
5886
  }
6106
5887
  var COMPARE_PARTIAL_FLAG$1 = 1;
6107
5888
  var objectProto$2 = Object.prototype;
6108
- var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
5889
+ var hasOwnProperty$3 = objectProto$2.hasOwnProperty;
6109
5890
  function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
6110
5891
  var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
6111
5892
  if (objLength != othLength && !isPartial) {
@@ -6114,7 +5895,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
6114
5895
  var index = objLength;
6115
5896
  while (index--) {
6116
5897
  var key = objProps[index];
6117
- if (!(isPartial ? key in other : hasOwnProperty$2.call(other, key))) {
5898
+ if (!(isPartial ? key in other : hasOwnProperty$3.call(other, key))) {
6118
5899
  return false;
6119
5900
  }
6120
5901
  }
@@ -6152,7 +5933,7 @@ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
6152
5933
  var COMPARE_PARTIAL_FLAG = 1;
6153
5934
  var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
6154
5935
  var objectProto$1 = Object.prototype;
6155
- var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
5936
+ var hasOwnProperty$2 = objectProto$1.hasOwnProperty;
6156
5937
  function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
6157
5938
  var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
6158
5939
  objTag = objTag == argsTag ? objectTag : objTag;
@@ -6170,7 +5951,7 @@ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
6170
5951
  return objIsArr || isTypedArray$1(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
6171
5952
  }
6172
5953
  if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
6173
- var objIsWrapped = objIsObj && hasOwnProperty$1.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$1.call(other, "__wrapped__");
5954
+ var objIsWrapped = objIsObj && hasOwnProperty$2.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty$2.call(other, "__wrapped__");
6174
5955
  if (objIsWrapped || othIsWrapped) {
6175
5956
  var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
6176
5957
  stack || (stack = new Stack());
@@ -6209,7 +5990,7 @@ function inRange(number, start, end) {
6209
5990
  }
6210
5991
  var mapTag = "[object Map]", setTag = "[object Set]";
6211
5992
  var objectProto = Object.prototype;
6212
- var hasOwnProperty = objectProto.hasOwnProperty;
5993
+ var hasOwnProperty$1 = objectProto.hasOwnProperty;
6213
5994
  function isEmpty(value) {
6214
5995
  if (value == null) {
6215
5996
  return true;
@@ -6225,7 +6006,7 @@ function isEmpty(value) {
6225
6006
  return !baseKeys(value).length;
6226
6007
  }
6227
6008
  for (var key in value) {
6228
- if (hasOwnProperty.call(value, key)) {
6009
+ if (hasOwnProperty$1.call(value, key)) {
6229
6010
  return false;
6230
6011
  }
6231
6012
  }
@@ -6234,6 +6015,246 @@ function isEmpty(value) {
6234
6015
  function isEqual(value, other) {
6235
6016
  return baseIsEqual(value, other);
6236
6017
  }
6018
+ const propertyToEncode = ["id", "selCtx", "fltCtx"];
6019
+ const CHAR_TO_REPLACE = ".";
6020
+ const REPLACEMENT_CHAR = "#dot";
6021
+ const FIX_NUMBER_PREFIX = "#FIX_NUMBER";
6022
+ const encodeProduct = (product) => {
6023
+ return iterateOverObject(cloneDeep(product), encodeValue);
6024
+ };
6025
+ const replaceIn = (value) => {
6026
+ const replaced = value.replaceAll(CHAR_TO_REPLACE, REPLACEMENT_CHAR);
6027
+ if (/^\d+$/.test(replaced)) {
6028
+ return `${FIX_NUMBER_PREFIX}${replaced}`;
6029
+ } else {
6030
+ return replaced;
6031
+ }
6032
+ };
6033
+ const replaceOut = (value) => {
6034
+ return value.replaceAll(REPLACEMENT_CHAR, CHAR_TO_REPLACE).replaceAll(FIX_NUMBER_PREFIX, "");
6035
+ };
6036
+ const encodeValue = (key, value) => {
6037
+ return codeValue(key, value, replaceIn);
6038
+ };
6039
+ const decodeValue = (key, value) => {
6040
+ return codeValue(key, value, replaceOut);
6041
+ };
6042
+ const codeValue = (key, value, replaceCb) => {
6043
+ let resValue = value;
6044
+ function handleState(obj) {
6045
+ const processedObj = {};
6046
+ for (const key2 in obj) {
6047
+ if (obj.hasOwnProperty(key2)) {
6048
+ const processedKey = replaceCb(key2);
6049
+ let processedValue = obj[key2];
6050
+ if (typeof obj[key2] === "object" && obj[key2] !== null) {
6051
+ processedValue = handleState(obj[key2]);
6052
+ }
6053
+ processedObj[processedKey] = processedValue;
6054
+ }
6055
+ }
6056
+ return processedObj;
6057
+ }
6058
+ if (propertyToEncode.includes(key) && (typeof value === "string" || value instanceof String)) {
6059
+ resValue = replaceCb(value);
6060
+ }
6061
+ if (key === "selected" || key === "filter") {
6062
+ resValue = handleState(value);
6063
+ }
6064
+ return resValue;
6065
+ };
6066
+ const iterateOverObject = (obj, cb) => {
6067
+ Object.keys(obj).forEach((key) => {
6068
+ const value = obj[key];
6069
+ obj[key] = cb(key, value);
6070
+ if (typeof value === "object" && value !== null) {
6071
+ iterateOverObject(value, cb);
6072
+ }
6073
+ });
6074
+ return obj;
6075
+ };
6076
+ const cleanSelected = (selected) => {
6077
+ const selectedCopy = JSON.parse(JSON.stringify(selected));
6078
+ for (const [contextName, value] of Object.entries(selectedCopy)) {
6079
+ if (value && !Array.isArray(value)) {
6080
+ const nestedObj = selectedCopy[contextName];
6081
+ for (const [nestedKey, nestedValue] of Object.entries(nestedObj)) {
6082
+ if (nestedValue === false) {
6083
+ delete nestedObj[nestedKey];
6084
+ }
6085
+ }
6086
+ if (Object.keys(nestedObj).length === 0) {
6087
+ delete selectedCopy[contextName];
6088
+ }
6089
+ } else {
6090
+ delete selectedCopy[contextName];
6091
+ }
6092
+ }
6093
+ return selectedCopy;
6094
+ };
6095
+ const decodeSelected = (selected) => {
6096
+ return decodeValue("selected", selected);
6097
+ };
6098
+ const isApiBooleanTrue = (value) => {
6099
+ if (value === "true" || value === true) {
6100
+ return true;
6101
+ }
6102
+ return false;
6103
+ };
6104
+ const scrollToId = (id) => {
6105
+ const element = document.getElementById(id);
6106
+ if (element) {
6107
+ element.scrollIntoView({ behavior: "smooth" });
6108
+ } else {
6109
+ console.warn(`Error: scrollToId: id: ${id} not found in html structure`);
6110
+ }
6111
+ };
6112
+ const getOptionsKindId = (contextName) => {
6113
+ return `options--${contextName}`;
6114
+ };
6115
+ const getItemImage = (item) => {
6116
+ const { details: { media = [] } = {} } = item;
6117
+ const mainMedia = media.find((el) => el.name === "MAIN_IMG") || media[0] || {};
6118
+ return (mainMedia == null ? void 0 : mainMedia.url) || "";
6119
+ };
6120
+ const isVisible = (item) => {
6121
+ var _a, _b;
6122
+ const isHidden = ((_a = item == null ? void 0 : item.attrs) == null ? void 0 : _a.hidden) === true || ((_b = item == null ? void 0 : item["_"]) == null ? void 0 : _b.hidden) === "true";
6123
+ return !isHidden;
6124
+ };
6125
+ function createStore(createState) {
6126
+ let state;
6127
+ const listeners = /* @__PURE__ */ new Set();
6128
+ const setState = (partial, replace) => {
6129
+ const nextState = typeof partial === "function" ? partial(state) : partial;
6130
+ if (nextState !== state) {
6131
+ const previousState = state;
6132
+ state = replace ? nextState : Object.assign({}, state, nextState);
6133
+ listeners.forEach((listener) => listener(state, previousState));
6134
+ }
6135
+ };
6136
+ const getState = () => state;
6137
+ const subscribeWithSelector = (listener, selector = getState, equalityFn = Object.is) => {
6138
+ console.warn("[DEPRECATED] Please use `subscribeWithSelector` middleware");
6139
+ let currentSlice = selector(state);
6140
+ function listenerToAdd() {
6141
+ const nextSlice = selector(state);
6142
+ if (!equalityFn(currentSlice, nextSlice)) {
6143
+ const previousSlice = currentSlice;
6144
+ listener(currentSlice = nextSlice, previousSlice);
6145
+ }
6146
+ }
6147
+ listeners.add(listenerToAdd);
6148
+ return () => listeners.delete(listenerToAdd);
6149
+ };
6150
+ const subscribe = (listener, selector, equalityFn) => {
6151
+ if (selector || equalityFn) {
6152
+ return subscribeWithSelector(listener, selector, equalityFn);
6153
+ }
6154
+ listeners.add(listener);
6155
+ return () => listeners.delete(listener);
6156
+ };
6157
+ const destroy = () => listeners.clear();
6158
+ const api = { setState, getState, subscribe, destroy };
6159
+ state = createState(setState, getState, api);
6160
+ return api;
6161
+ }
6162
+ const isSSR = typeof window === "undefined" || !window.navigator || /ServerSideRendering|^Deno\//.test(window.navigator.userAgent);
6163
+ const useIsomorphicLayoutEffect = isSSR ? useEffect : useLayoutEffect;
6164
+ function create(createState) {
6165
+ const api = typeof createState === "function" ? createStore(createState) : createState;
6166
+ const useStore2 = (selector = api.getState, equalityFn = Object.is) => {
6167
+ const [, forceUpdate] = useReducer((c) => c + 1, 0);
6168
+ const state = api.getState();
6169
+ const stateRef = useRef(state);
6170
+ const selectorRef = useRef(selector);
6171
+ const equalityFnRef = useRef(equalityFn);
6172
+ const erroredRef = useRef(false);
6173
+ const currentSliceRef = useRef();
6174
+ if (currentSliceRef.current === void 0) {
6175
+ currentSliceRef.current = selector(state);
6176
+ }
6177
+ let newStateSlice;
6178
+ let hasNewStateSlice = false;
6179
+ if (stateRef.current !== state || selectorRef.current !== selector || equalityFnRef.current !== equalityFn || erroredRef.current) {
6180
+ newStateSlice = selector(state);
6181
+ hasNewStateSlice = !equalityFn(currentSliceRef.current, newStateSlice);
6182
+ }
6183
+ useIsomorphicLayoutEffect(() => {
6184
+ if (hasNewStateSlice) {
6185
+ currentSliceRef.current = newStateSlice;
6186
+ }
6187
+ stateRef.current = state;
6188
+ selectorRef.current = selector;
6189
+ equalityFnRef.current = equalityFn;
6190
+ erroredRef.current = false;
6191
+ });
6192
+ const stateBeforeSubscriptionRef = useRef(state);
6193
+ useIsomorphicLayoutEffect(() => {
6194
+ const listener = () => {
6195
+ try {
6196
+ const nextState = api.getState();
6197
+ const nextStateSlice = selectorRef.current(nextState);
6198
+ if (!equalityFnRef.current(currentSliceRef.current, nextStateSlice)) {
6199
+ stateRef.current = nextState;
6200
+ currentSliceRef.current = nextStateSlice;
6201
+ forceUpdate();
6202
+ }
6203
+ } catch (error2) {
6204
+ erroredRef.current = true;
6205
+ forceUpdate();
6206
+ }
6207
+ };
6208
+ const unsubscribe = api.subscribe(listener);
6209
+ if (api.getState() !== stateBeforeSubscriptionRef.current) {
6210
+ listener();
6211
+ }
6212
+ return unsubscribe;
6213
+ }, []);
6214
+ const sliceToReturn = hasNewStateSlice ? newStateSlice : currentSliceRef.current;
6215
+ useDebugValue(sliceToReturn);
6216
+ return sliceToReturn;
6217
+ };
6218
+ Object.assign(useStore2, api);
6219
+ useStore2[Symbol.iterator] = function() {
6220
+ console.warn("[useStore, api] = create() is deprecated and will be removed in v4");
6221
+ const items = [useStore2, api];
6222
+ return {
6223
+ next() {
6224
+ const done = items.length <= 0;
6225
+ return { value: items.shift(), done };
6226
+ }
6227
+ };
6228
+ };
6229
+ return useStore2;
6230
+ }
6231
+ const createFilterSlice = (set2) => ({
6232
+ filter: {},
6233
+ initialSelected: {},
6234
+ setInitialFilter: (productFilter) => {
6235
+ set2(() => ({
6236
+ filter: {
6237
+ ...productFilter
6238
+ }
6239
+ }));
6240
+ },
6241
+ setInitialSelected: (selected) => {
6242
+ set2(() => ({
6243
+ initialSelected: selected
6244
+ }));
6245
+ },
6246
+ setFilter: (fltCtx, emit) => {
6247
+ set2(({ filter }) => ({
6248
+ filter: {
6249
+ ...filter,
6250
+ [fltCtx]: {
6251
+ ...filter[fltCtx],
6252
+ ...emit
6253
+ }
6254
+ }
6255
+ }));
6256
+ }
6257
+ });
6237
6258
  const isInputEnabled = (item, validationMap) => {
6238
6259
  var _a;
6239
6260
  const { selCtx } = item;
@@ -6457,9 +6478,12 @@ function getValidSelectedState(product, selected) {
6457
6478
  function useProductConfigurator(product) {
6458
6479
  var _a;
6459
6480
  const [productQuantity, setProductQuantity] = useState(1);
6460
- const encodedProduct = iterateOverObject(product, encodeValue);
6481
+ const encodedProduct = encodeProduct(product);
6461
6482
  const { state: { filter: initFilter = {} } = {} } = encodedProduct;
6462
- const initSelected = getValidSelectedState(product, (_a = product.state) == null ? void 0 : _a.selected);
6483
+ const initSelected = getValidSelectedState(
6484
+ encodedProduct,
6485
+ (_a = encodedProduct.state) == null ? void 0 : _a.selected
6486
+ );
6463
6487
  const setInitialFilter = useStore((state) => state.setInitialFilter);
6464
6488
  const setInitialSelected = useStore((state) => state.setInitialSelected);
6465
6489
  const setInitialValidate = useStore((state) => state.setInitialValidate);
@@ -6716,8 +6740,75 @@ function useMenuOptions(product, nestedLvl, parentKind, parentSelCtx) {
6716
6740
  }
6717
6741
  var jsxRuntime = { exports: {} };
6718
6742
  var reactJsxRuntime_production_min = {};
6719
- /**
6720
- * @license React
6743
+ /*
6744
+ object-assign
6745
+ (c) Sindre Sorhus
6746
+ @license MIT
6747
+ */
6748
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
6749
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
6750
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
6751
+ function toObject(val) {
6752
+ if (val === null || val === void 0) {
6753
+ throw new TypeError("Object.assign cannot be called with null or undefined");
6754
+ }
6755
+ return Object(val);
6756
+ }
6757
+ function shouldUseNative() {
6758
+ try {
6759
+ if (!Object.assign) {
6760
+ return false;
6761
+ }
6762
+ var test1 = new String("abc");
6763
+ test1[5] = "de";
6764
+ if (Object.getOwnPropertyNames(test1)[0] === "5") {
6765
+ return false;
6766
+ }
6767
+ var test2 = {};
6768
+ for (var i2 = 0; i2 < 10; i2++) {
6769
+ test2["_" + String.fromCharCode(i2)] = i2;
6770
+ }
6771
+ var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
6772
+ return test2[n2];
6773
+ });
6774
+ if (order2.join("") !== "0123456789") {
6775
+ return false;
6776
+ }
6777
+ var test3 = {};
6778
+ "abcdefghijklmnopqrst".split("").forEach(function(letter) {
6779
+ test3[letter] = letter;
6780
+ });
6781
+ if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
6782
+ return false;
6783
+ }
6784
+ return true;
6785
+ } catch (err) {
6786
+ return false;
6787
+ }
6788
+ }
6789
+ shouldUseNative() ? Object.assign : function(target, source) {
6790
+ var from;
6791
+ var to = toObject(target);
6792
+ var symbols;
6793
+ for (var s2 = 1; s2 < arguments.length; s2++) {
6794
+ from = Object(arguments[s2]);
6795
+ for (var key in from) {
6796
+ if (hasOwnProperty.call(from, key)) {
6797
+ to[key] = from[key];
6798
+ }
6799
+ }
6800
+ if (getOwnPropertySymbols) {
6801
+ symbols = getOwnPropertySymbols(from);
6802
+ for (var i2 = 0; i2 < symbols.length; i2++) {
6803
+ if (propIsEnumerable.call(from, symbols[i2])) {
6804
+ to[symbols[i2]] = from[symbols[i2]];
6805
+ }
6806
+ }
6807
+ }
6808
+ }
6809
+ return to;
6810
+ };
6811
+ /** @license React v17.0.2
6721
6812
  * react-jsx-runtime.production.min.js
6722
6813
  *
6723
6814
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -6725,20 +6816,26 @@ var reactJsxRuntime_production_min = {};
6725
6816
  * This source code is licensed under the MIT license found in the
6726
6817
  * LICENSE file in the root directory of this source tree.
6727
6818
  */
6728
- var f$3 = React, k$2 = Symbol.for("react.element"), l$4 = Symbol.for("react.fragment"), m$3 = Object.prototype.hasOwnProperty, n$2 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p$3 = { key: true, ref: true, __self: true, __source: true };
6729
- function q(c, a2, g) {
6730
- var b, d2 = {}, e2 = null, h2 = null;
6731
- void 0 !== g && (e2 = "" + g);
6819
+ var f$3 = React, g = 60103;
6820
+ reactJsxRuntime_production_min.Fragment = 60107;
6821
+ if ("function" === typeof Symbol && Symbol.for) {
6822
+ var h$3 = Symbol.for;
6823
+ g = h$3("react.element");
6824
+ reactJsxRuntime_production_min.Fragment = h$3("react.fragment");
6825
+ }
6826
+ var m$3 = f$3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n$2 = Object.prototype.hasOwnProperty, p$3 = { key: true, ref: true, __self: true, __source: true };
6827
+ function q(c, a2, k2) {
6828
+ var b, d2 = {}, e2 = null, l2 = null;
6829
+ void 0 !== k2 && (e2 = "" + k2);
6732
6830
  void 0 !== a2.key && (e2 = "" + a2.key);
6733
- void 0 !== a2.ref && (h2 = a2.ref);
6831
+ void 0 !== a2.ref && (l2 = a2.ref);
6734
6832
  for (b in a2)
6735
- m$3.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
6833
+ n$2.call(a2, b) && !p$3.hasOwnProperty(b) && (d2[b] = a2[b]);
6736
6834
  if (c && c.defaultProps)
6737
6835
  for (b in a2 = c.defaultProps, a2)
6738
6836
  void 0 === d2[b] && (d2[b] = a2[b]);
6739
- return { $$typeof: k$2, type: c, key: e2, ref: h2, props: d2, _owner: n$2.current };
6837
+ return { $$typeof: g, type: c, key: e2, ref: l2, props: d2, _owner: m$3.current };
6740
6838
  }
6741
- reactJsxRuntime_production_min.Fragment = l$4;
6742
6839
  reactJsxRuntime_production_min.jsx = q;
6743
6840
  reactJsxRuntime_production_min.jsxs = q;
6744
6841
  {
@@ -7288,7 +7385,7 @@ var Dinero = function Dinero2(options) {
7288
7385
  var factor = Math.pow(10, digits);
7289
7386
  return calculator$1.divide(calculator$1.round(calculator$1.multiply(this.toUnit(), factor), roundingMode), factor);
7290
7387
  },
7291
- toObject: function toObject() {
7388
+ toObject: function toObject2() {
7292
7389
  return {
7293
7390
  amount,
7294
7391
  currency,
@@ -9332,8 +9429,8 @@ function p$1(r2, t2 = {}, e2, a2) {
9332
9429
  let d2 = {};
9333
9430
  if (t2) {
9334
9431
  let f2 = false, y2 = [];
9335
- for (let [h2, g] of Object.entries(t2))
9336
- typeof g == "boolean" && (f2 = true), g === true && y2.push(h2);
9432
+ for (let [h2, g2] of Object.entries(t2))
9433
+ typeof g2 == "boolean" && (f2 = true), g2 === true && y2.push(h2);
9337
9434
  f2 && (d2["data-headlessui-state"] = y2.join(" "));
9338
9435
  }
9339
9436
  if (o2 === Fragment$1 && Object.keys(F$3(s2)).length > 0) {
@@ -9757,31 +9854,31 @@ let Se$1 = "div", Le = S$1.RenderStrategy | S$1.Static, Me = C$1(function(e2, r2
9757
9854
  throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${a2}`);
9758
9855
  if (typeof o2 != "function")
9759
9856
  throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${o2}`);
9760
- let g = a2 ? 0 : 1, [h2, Q2] = useReducer(Ce$1, { titleId: null, descriptionId: null, panelRef: createRef() }), R = o$3(() => o2(false)), j2 = o$3((T2) => Q2({ type: 0, id: T2 })), x2 = a$2() ? f2 ? false : g === 0 : false, w2 = n$12 > 1, X2 = useContext(H) !== null, Z = w2 ? "parent" : "leaf";
9857
+ let g2 = a2 ? 0 : 1, [h2, Q2] = useReducer(Ce$1, { titleId: null, descriptionId: null, panelRef: createRef() }), R = o$3(() => o2(false)), j2 = o$3((T2) => Q2({ type: 0, id: T2 })), x2 = a$2() ? f2 ? false : g2 === 0 : false, w2 = n$12 > 1, X2 = useContext(H) !== null, Z = w2 ? "parent" : "leaf";
9761
9858
  M$3(u2, w2 ? x2 : false);
9762
9859
  let N2 = o$3(() => {
9763
9860
  var b, D2;
9764
9861
  return [...Array.from((b = y$1 == null ? void 0 : y$1.querySelectorAll("body > *, [data-headlessui-portal]")) != null ? b : []).filter((E2) => !(!(E2 instanceof HTMLElement) || E2.contains(U2.current) || h2.panelRef.current && E2.contains(h2.panelRef.current))), (D2 = h2.panelRef.current) != null ? D2 : u2.current];
9765
9862
  });
9766
9863
  L(() => N2(), R, x2 && !w2), E(y$1 == null ? void 0 : y$1.defaultView, "keydown", (T2) => {
9767
- T2.defaultPrevented || T2.key === o$1.Escape && g === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
9768
- }), Oe(y$1, g === 0 && !X2, N2), useEffect(() => {
9769
- if (g !== 0 || !u2.current)
9864
+ T2.defaultPrevented || T2.key === o$1.Escape && g2 === 0 && (w2 || (T2.preventDefault(), T2.stopPropagation(), R()));
9865
+ }), Oe(y$1, g2 === 0 && !X2, N2), useEffect(() => {
9866
+ if (g2 !== 0 || !u2.current)
9770
9867
  return;
9771
9868
  let T2 = new IntersectionObserver((b) => {
9772
9869
  for (let D2 of b)
9773
9870
  D2.boundingClientRect.x === 0 && D2.boundingClientRect.y === 0 && D2.boundingClientRect.width === 0 && D2.boundingClientRect.height === 0 && R();
9774
9871
  });
9775
9872
  return T2.observe(u2.current), () => T2.disconnect();
9776
- }, [g, u2, R]);
9777
- let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState: g, close: R, setTitleId: j2 }, h2], [g, h2, R, j2]), V = useMemo(() => ({ open: g === 0 }), [g]), re2 = { ref: _24, id: d2, role: "dialog", "aria-modal": g === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": ee };
9778
- return React.createElement(M$2, { type: "Dialog", enabled: g === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
9873
+ }, [g2, u2, R]);
9874
+ let [ee, te] = k$1(), oe2 = useMemo(() => [{ dialogState: g2, close: R, setTitleId: j2 }, h2], [g2, h2, R, j2]), V = useMemo(() => ({ open: g2 === 0 }), [g2]), re2 = { ref: _24, id: d2, role: "dialog", "aria-modal": g2 === 0 ? true : void 0, "aria-labelledby": h2.titleId, "aria-describedby": ee };
9875
+ return React.createElement(M$2, { type: "Dialog", enabled: g2 === 0, element: u2, onUpdate: o$3((T2, b, D2) => {
9779
9876
  b === "Dialog" && u$3(T2, { [s.Add]() {
9780
9877
  P2.current.add(D2), i2((E2) => E2 + 1);
9781
9878
  }, [s.Remove]() {
9782
9879
  P2.current.add(D2), i2((E2) => E2 - 1);
9783
9880
  } });
9784
- }) }, React.createElement(P$1, { force: true }, React.createElement($, null, React.createElement(H.Provider, { value: oe2 }, React.createElement($.Group, { target: u2 }, React.createElement(P$1, { force: false }, React.createElement(te, { slot: V, name: "Dialog.Description" }, React.createElement(de, { initialFocus: p$12, containers: P2, features: x2 ? u$3(Z, { parent: de.features.RestoreFocus, leaf: de.features.All & ~de.features.FocusLock }) : de.features.None }, $$1({ ourProps: re2, theirProps: c, slot: V, defaultTag: Se$1, features: Le, visible: g === 0, name: "Dialog" })))))))), React.createElement(h$1, { features: s$4.Hidden, ref: U2 }));
9881
+ }) }, React.createElement(P$1, { force: true }, React.createElement($, null, React.createElement(H.Provider, { value: oe2 }, React.createElement($.Group, { target: u2 }, React.createElement(P$1, { force: false }, React.createElement(te, { slot: V, name: "Dialog.Description" }, React.createElement(de, { initialFocus: p$12, containers: P2, features: x2 ? u$3(Z, { parent: de.features.RestoreFocus, leaf: de.features.All & ~de.features.FocusLock }) : de.features.None }, $$1({ ourProps: re2, theirProps: c, slot: V, defaultTag: Se$1, features: Le, visible: g2 === 0, name: "Dialog" })))))))), React.createElement(h$1, { features: s$4.Hidden, ref: U2 }));
9785
9882
  }), ke = "div", we = C$1(function(e2, r2) {
9786
9883
  let s2 = I$2(), { id: d2 = `headlessui-dialog-overlay-${s2}`, ...a2 } = e2, [{ dialogState: o2, close: p2 }] = k("Dialog.Overlay"), f2 = y(r2), c = o$3((l2) => {
9787
9884
  if (l2.target === l2.currentTarget) {
@@ -9828,7 +9925,7 @@ function F(t2, e2) {
9828
9925
  if (!t2)
9829
9926
  return n2.dispose;
9830
9927
  let { transitionDuration: a2, transitionDelay: i2 } = getComputedStyle(t2), [m2, d2] = [a2, i2].map((o2) => {
9831
- let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g) => g - l2);
9928
+ let [r2 = 0] = o2.split(",").filter(Boolean).map((l2) => l2.includes("ms") ? parseFloat(l2) : parseFloat(l2) * 1e3).sort((l2, g2) => g2 - l2);
9832
9929
  return r2;
9833
9930
  });
9834
9931
  if (m2 + d2 !== 0) {
@@ -10257,6 +10354,25 @@ const MenuProductRoot = (props) => {
10257
10354
  });
10258
10355
  };
10259
10356
  var style = "";
10357
+ const ProductDataContext = React.createContext(null);
10358
+ function ProductDataProvider({
10359
+ rootProduct,
10360
+ children
10361
+ }) {
10362
+ return /* @__PURE__ */ jsx(ProductDataContext.Provider, {
10363
+ value: {
10364
+ rootProduct
10365
+ },
10366
+ children
10367
+ });
10368
+ }
10369
+ function useProductData() {
10370
+ const context = useContext(ProductDataContext);
10371
+ if (!context) {
10372
+ throw new Error("Missing ComponentsContext");
10373
+ }
10374
+ return context;
10375
+ }
10260
10376
  function ProductConfigurator(props) {
10261
10377
  const {
10262
10378
  product,
@@ -10302,7 +10418,6 @@ function ProductConfigurator(props) {
10302
10418
  }
10303
10419
  });
10304
10420
  const {
10305
- handleSubmit,
10306
10421
  getValues
10307
10422
  } = methods;
10308
10423
  const countedProductPrice = Number((parseFloat(price || "0") + countPrice(getValues("selected"), product)).toFixed(2));
@@ -10329,32 +10444,35 @@ function ProductConfigurator(props) {
10329
10444
  };
10330
10445
  const handleOnSubmit = () => onSubmit();
10331
10446
  return /* @__PURE__ */ jsx(Fragment, {
10332
- children: /* @__PURE__ */ jsx(ComponentsContext.Provider, {
10333
- value: props.components,
10334
- children: /* @__PURE__ */ jsx(FormProvider, {
10335
- ...methods,
10336
- children: /* @__PURE__ */ jsxs("form", {
10337
- children: [showDebugState && /* @__PURE__ */ jsx("div", {
10338
- className: "hidden",
10339
- children: /* @__PURE__ */ jsx(DisplayState, {})
10340
- }), /* @__PURE__ */ jsx(MenuProductRoot, {
10341
- product: encodedProduct,
10342
- productQuantity,
10343
- validationMap,
10344
- isOpen,
10345
- handleClose,
10346
- handleGoBack,
10347
- handleOnSubmit,
10348
- countedProductPrice,
10349
- countedProductTotalPrice: countedProductPrice * productQuantity,
10350
- increaseProductQuantity,
10351
- decreaseProductQuantity,
10352
- currency
10353
- })]
10447
+ children: /* @__PURE__ */ jsx(ProductDataProvider, {
10448
+ rootProduct: product,
10449
+ children: /* @__PURE__ */ jsx(ComponentsContext.Provider, {
10450
+ value: props.components,
10451
+ children: /* @__PURE__ */ jsx(FormProvider, {
10452
+ ...methods,
10453
+ children: /* @__PURE__ */ jsxs("form", {
10454
+ children: [showDebugState && /* @__PURE__ */ jsx("div", {
10455
+ className: "hidden",
10456
+ children: /* @__PURE__ */ jsx(DisplayState, {})
10457
+ }), /* @__PURE__ */ jsx(MenuProductRoot, {
10458
+ product: encodedProduct,
10459
+ productQuantity,
10460
+ validationMap,
10461
+ isOpen,
10462
+ handleClose,
10463
+ handleGoBack,
10464
+ handleOnSubmit,
10465
+ countedProductPrice,
10466
+ countedProductTotalPrice: countedProductPrice * productQuantity,
10467
+ increaseProductQuantity,
10468
+ decreaseProductQuantity,
10469
+ currency
10470
+ })]
10471
+ })
10354
10472
  })
10355
10473
  })
10356
10474
  })
10357
10475
  });
10358
10476
  }
10359
- export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, index_esm as hookForm };
10477
+ export { ContextType, MainView, ProductConfigurator, ProductKinds, ProductTypes, SelMinSelMaxStatus, index_esm as hookForm, useProductData };
10360
10478
  //# sourceMappingURL=index.es.js.map