@wayke-se/components-react 3.0.0-beta.12 → 3.0.0-beta.13

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.
package/dist/index.mjs CHANGED
@@ -1,8 +1,13 @@
1
1
  var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2
3
  var __export = (target, all) => {
3
4
  for (var name in all)
4
5
  __defProp(target, name, { get: all[name], enumerable: true });
5
6
  };
7
+ var __publicField = (obj, key, value) => {
8
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
9
+ return value;
10
+ };
6
11
 
7
12
  // src/layouts/search/index.tsx
8
13
  import React31, { useEffect as useEffect6, useCallback as useCallback12, useMemo as useMemo2 } from "react";
@@ -774,16 +779,17 @@ var getTranslatedSortOptionDisplayName = (str) => {
774
779
 
775
780
  // src/components/Result/index.tsx
776
781
  var Result = ({ children }) => {
782
+ var _a;
777
783
  const { loading, response, documents, queryFilter, onLoadMore, onFilterUpdate } = useSearch_default();
778
784
  const onSortOptionChange = useCallback(
779
785
  (e) => onFilterUpdate(e.currentTarget.value),
780
786
  []
781
787
  );
782
- const numberOfDocuments = documents?.length || 0;
783
- const numberOfHits = response?.documentList.numberOfHits || 0;
784
- const useSkeletons = !!queryFilter?.concatResult;
785
- const selectedSortOption = response?.documentList.sortOptions.find((x) => x.selected)?.query;
786
- const sortOptions = response?.documentList.sortOptions.filter((x) => x.displayName !== "relevance").map(
788
+ const numberOfDocuments = (documents == null ? void 0 : documents.length) || 0;
789
+ const numberOfHits = (response == null ? void 0 : response.documentList.numberOfHits) || 0;
790
+ const useSkeletons = !!(queryFilter == null ? void 0 : queryFilter.concatResult);
791
+ const selectedSortOption = (_a = response == null ? void 0 : response.documentList.sortOptions.find((x) => x.selected)) == null ? void 0 : _a.query;
792
+ const sortOptions = response == null ? void 0 : response.documentList.sortOptions.filter((x) => x.displayName !== "relevance").map(
787
793
  (so) => ({
788
794
  value: so.query,
789
795
  displayName: getTranslatedSortOptionDisplayName(so.displayName)
@@ -1342,7 +1348,7 @@ var ChecklistItem = ({ label, onClick, active, radio }) => /* @__PURE__ */ React
1342
1348
  className: active ? "wayke__theme wayke__font--bold wayke__color--primary-text" : ""
1343
1349
  }, label)));
1344
1350
  var Checklist = ({ items, radio }) => {
1345
- if (!items?.length) {
1351
+ if (!(items == null ? void 0 : items.length)) {
1346
1352
  return null;
1347
1353
  }
1348
1354
  return /* @__PURE__ */ React11.createElement(List3, null, items.map((item) => /* @__PURE__ */ React11.createElement(ChecklistItem, {
@@ -1393,7 +1399,7 @@ var ChecklistFacet = ({ facet }) => {
1393
1399
  items: facet.filters.sort((a, b) => a.displayName.localeCompare(b.displayName)).map((f) => ({
1394
1400
  label: f.displayName,
1395
1401
  onClick: () => onClick(f),
1396
- active: selected?.[f.displayName] !== void 0 ? selected[f.displayName] : f.selected
1402
+ active: (selected == null ? void 0 : selected[f.displayName]) !== void 0 ? selected[f.displayName] : f.selected
1397
1403
  }))
1398
1404
  }));
1399
1405
  };
@@ -1562,7 +1568,7 @@ var ColorSelectFacet = ({ facet }) => {
1562
1568
  items: facet.filters.sort((a, b) => a.displayName.localeCompare(b.displayName)).map((f) => ({
1563
1569
  label: f.displayName,
1564
1570
  onClick: () => onClick(f),
1565
- active: selected?.[f.displayName] !== void 0 ? selected[f.displayName] : f.selected,
1571
+ active: (selected == null ? void 0 : selected[f.displayName]) !== void 0 ? selected[f.displayName] : f.selected,
1566
1572
  hex: [getHexColorFromDisplayName(f.displayName)]
1567
1573
  }))
1568
1574
  });
@@ -1777,9 +1783,9 @@ var RangeSlider_default = RangeSlider;
1777
1783
  // src/components/FilterPanel/rangeFacet.tsx
1778
1784
  var getInitialValues = (domain, facet, searchParams) => {
1779
1785
  const facetMin = domain[0];
1780
- const _queryMin = searchParams?.get(`${facet.id}.min`) || null;
1786
+ const _queryMin = (searchParams == null ? void 0 : searchParams.get(`${facet.id}.min`)) || null;
1781
1787
  const facetMax = domain[domain.length - 1];
1782
- const _queryMax = searchParams?.get(`${facet.id}.max`) || null;
1788
+ const _queryMax = (searchParams == null ? void 0 : searchParams.get(`${facet.id}.max`)) || null;
1783
1789
  const queryMin = parseInt(_queryMin === null ? `${facetMin}` : _queryMin, 10);
1784
1790
  const min = facetMin > queryMin ? facetMin : queryMin;
1785
1791
  const queryMax = parseInt(_queryMax === null ? `${facetMax}` : _queryMax, 10);
@@ -1801,38 +1807,40 @@ var getSteps2 = (initialAllValues) => {
1801
1807
  return initialAllValues;
1802
1808
  };
1803
1809
  var RangeFacet = ({ facet, unit, formatValues }) => {
1810
+ var _a, _b, _c;
1804
1811
  const { loading, queryFilter, initialFacets, onFilterUpdate } = useSearch_default();
1805
- const initialFacet = initialFacets?.find((x) => x.id === facet.id);
1806
- const maxPrefix = initialFacet?.filters[initialFacet?.filters.length - 1]?.displayName?.includes("+");
1812
+ const initialFacet = initialFacets == null ? void 0 : initialFacets.find((x) => x.id === facet.id);
1813
+ const maxPrefix = (_b = (_a = initialFacet == null ? void 0 : initialFacet.filters[(initialFacet == null ? void 0 : initialFacet.filters.length) - 1]) == null ? void 0 : _a.displayName) == null ? void 0 : _b.includes("+");
1807
1814
  const [state, setValues] = useState5(void 0);
1808
1815
  useEffect4(() => {
1809
- const _initialAllValues = initialFacet?.filters.map(
1816
+ const _initialAllValues = (initialFacet == null ? void 0 : initialFacet.filters.map(
1810
1817
  (f) => parseInt(f.displayName.replace(/[\<\>+-]+/g, ""), 10)
1811
- ) || [1, 2];
1818
+ )) || [1, 2];
1812
1819
  const _steps = getSteps2(_initialAllValues);
1813
1820
  const domain = [_steps[0], _steps[_steps.length - 1]];
1814
1821
  setValues({
1815
- id: initialFacet?.id,
1822
+ id: initialFacet == null ? void 0 : initialFacet.id,
1816
1823
  steps: _steps,
1817
1824
  domain: [_steps[0], _steps[_steps.length - 1]],
1818
- values: initialFacet?.filters.length ? getInitialValues(domain, initialFacet, queryFilter.searchParams) : [0, 0]
1825
+ values: (initialFacet == null ? void 0 : initialFacet.filters.length) ? getInitialValues(domain, initialFacet, queryFilter.searchParams) : [0, 0]
1819
1826
  });
1820
- }, [initialFacet?.id]);
1827
+ }, [initialFacet == null ? void 0 : initialFacet.id]);
1821
1828
  useEffect4(() => {
1822
- if (state?.id) {
1823
- const init = initialFacet?.filters.length ? getInitialValues(state.domain, initialFacet, queryFilter.searchParams) : [0, 0];
1824
- const minStr = queryFilter.searchParams?.get(`${facet.id}.min`);
1825
- const maxStr = queryFilter.searchParams?.get(`${facet.id}.max`);
1829
+ var _a2, _b2;
1830
+ if (state == null ? void 0 : state.id) {
1831
+ const init = (initialFacet == null ? void 0 : initialFacet.filters.length) ? getInitialValues(state.domain, initialFacet, queryFilter.searchParams) : [0, 0];
1832
+ const minStr = (_a2 = queryFilter.searchParams) == null ? void 0 : _a2.get(`${facet.id}.min`);
1833
+ const maxStr = (_b2 = queryFilter.searchParams) == null ? void 0 : _b2.get(`${facet.id}.max`);
1826
1834
  const min = minStr ? parseFloat(minStr) : init[0];
1827
1835
  const max = maxStr ? parseFloat(maxStr) : init[1];
1828
1836
  if (min !== state.values[0] || max !== state.values[1]) {
1829
1837
  onChange([min, max]);
1830
1838
  }
1831
1839
  }
1832
- }, [queryFilter.searchParams?.toString()]);
1840
+ }, [(_c = queryFilter.searchParams) == null ? void 0 : _c.toString()]);
1833
1841
  const onChange = useCallback6(
1834
1842
  (nextValues) => {
1835
- if (state?.id) {
1843
+ if (state == null ? void 0 : state.id) {
1836
1844
  if (state.values[0] !== nextValues[0] || state.values[1] !== nextValues[1]) {
1837
1845
  setValues({ ...state, values: nextValues.slice() });
1838
1846
  const query = new URLSearchParams(queryFilter.searchParams);
@@ -1937,7 +1945,7 @@ var FilterPanel = ({
1937
1945
  }, /* @__PURE__ */ React21.createElement(Accordion_default, null, filteredFacets.filter((x) => x.filters.length).map((f) => /* @__PURE__ */ React21.createElement(AccordionItem, {
1938
1946
  key: f.displayName,
1939
1947
  heading: f.displayName,
1940
- isActive: f.id === facet?.id
1948
+ isActive: f.id === (facet == null ? void 0 : facet.id)
1941
1949
  }, /* @__PURE__ */ React21.createElement(Repeat, null, /* @__PURE__ */ React21.createElement(faceSelector_default, {
1942
1950
  facet: f
1943
1951
  }))))));
@@ -1956,8 +1964,9 @@ var isSelected = (f, searchParams) => {
1956
1964
  }
1957
1965
  };
1958
1966
  var Filter = ({ filterList }) => {
1967
+ var _a;
1959
1968
  const { queryFilter, initialFacets, loading, response, onFilterUpdate } = useSearch_default();
1960
- const facets = response?.facets;
1969
+ const facets = response == null ? void 0 : response.facets;
1961
1970
  const [facet, setFacet] = useState6();
1962
1971
  const onSelectFacet = useCallback8((nextFacet) => setFacet(nextFacet), []);
1963
1972
  const onClose = useCallback8(() => setFacet(void 0), []);
@@ -1965,11 +1974,11 @@ var Filter = ({ filterList }) => {
1965
1974
  return null;
1966
1975
  }
1967
1976
  const filterNames = filterList ? filterList.map((x) => x.filterName) : void 0;
1968
- const filteredFacets = facets?.filter((x) => x.id !== "segment")?.filter((f) => filterNames ? filterNames.includes(f.id) : true).sort(
1977
+ const filteredFacets = (_a = facets == null ? void 0 : facets.filter((x) => x.id !== "segment")) == null ? void 0 : _a.filter((f) => filterNames ? filterNames.includes(f.id) : true).sort(
1969
1978
  (a, b) => filterNames ? filterNames.indexOf(a.id) - filterNames.indexOf(b.id) : 0
1970
1979
  ).map((x) => {
1971
- const match = filterList?.find((y) => y.filterName === x.id);
1972
- if (match?.displayName) {
1980
+ const match = filterList == null ? void 0 : filterList.find((y) => y.filterName === x.id);
1981
+ if (match == null ? void 0 : match.displayName) {
1973
1982
  return {
1974
1983
  ...x,
1975
1984
  displayName: match.displayName
@@ -1985,7 +1994,7 @@ var Filter = ({ filterList }) => {
1985
1994
  facet,
1986
1995
  loading,
1987
1996
  filteredFacets,
1988
- numberOfHits: response?.documentList.numberOfHits || 0,
1997
+ numberOfHits: (response == null ? void 0 : response.documentList.numberOfHits) || 0,
1989
1998
  onFilterUpdate,
1990
1999
  onClose
1991
2000
  }), /* @__PURE__ */ React22.createElement(List, null, filteredFacets.filter((x) => x.filters.length).map((f) => {
@@ -2345,7 +2354,8 @@ var ProductCard_default = ProductCard;
2345
2354
 
2346
2355
  // src/components/Grid/index.tsx
2347
2356
  var resolveImage = (document2) => {
2348
- const img = document2.featuredImage?.files?.[0]?.url;
2357
+ var _a, _b, _c;
2358
+ const img = (_c = (_b = (_a = document2.featuredImage) == null ? void 0 : _a.files) == null ? void 0 : _b[0]) == null ? void 0 : _c.url;
2349
2359
  if (img) {
2350
2360
  return `${img}?w=567&q=72`;
2351
2361
  }
@@ -2356,7 +2366,7 @@ var Grid = ({ documents, placeholderImage, hashRoute, pathRoute, onClickItem })
2356
2366
  return null;
2357
2367
  }
2358
2368
  return /* @__PURE__ */ React25.createElement(Wrapper8, null, /* @__PURE__ */ React25.createElement(List5, null, documents.map((document2) => {
2359
- const _path = pathRoute?.replace(/^\/|\/$/g, "");
2369
+ const _path = pathRoute == null ? void 0 : pathRoute.replace(/^\/|\/$/g, "");
2360
2370
  const prefix = _path ? `/${_path}/` : "/";
2361
2371
  const pathRouteUrl = window.location.pathname === "/" ? `${prefix}${document2._id}` : `${window.location.pathname}${prefix}${document2._id}`;
2362
2372
  return /* @__PURE__ */ React25.createElement(Item5, {
@@ -2755,7 +2765,7 @@ var Snackbar_default = Snackbar;
2755
2765
  var _PubSub = class {
2756
2766
  };
2757
2767
  var PubSub = _PubSub;
2758
- PubSub.events = {
2768
+ __publicField(PubSub, "events", {
2759
2769
  HashRouteChange: [],
2760
2770
  ItemClicked: [],
2761
2771
  EcomOnInit: [],
@@ -2769,13 +2779,13 @@ PubSub.events = {
2769
2779
  InsuranceInterest: [],
2770
2780
  FinanceInterest: [],
2771
2781
  All: []
2772
- };
2773
- PubSub.actions = {
2782
+ });
2783
+ __publicField(PubSub, "actions", {
2774
2784
  onFilterUpdate: [],
2775
2785
  All: []
2776
- };
2777
- PubSub.subscribeAction = (event) => _PubSub.actions[event.actionName].push(event);
2778
- PubSub.unsubscribeAction = (event) => {
2786
+ });
2787
+ __publicField(PubSub, "subscribeAction", (event) => _PubSub.actions[event.actionName].push(event));
2788
+ __publicField(PubSub, "unsubscribeAction", (event) => {
2779
2789
  if (_PubSub.actions[event.actionName]) {
2780
2790
  for (let i = 0; i < _PubSub.actions[event.actionName].length; i++) {
2781
2791
  if (_PubSub.actions[event.actionName][i] === event) {
@@ -2784,8 +2794,8 @@ PubSub.unsubscribeAction = (event) => {
2784
2794
  }
2785
2795
  }
2786
2796
  }
2787
- };
2788
- PubSub.publishAction = (eventName, ...args) => {
2797
+ });
2798
+ __publicField(PubSub, "publishAction", (eventName, ...args) => {
2789
2799
  if (_PubSub.actions.All) {
2790
2800
  _PubSub.events.All.forEach((event) => event.callback(eventName, args));
2791
2801
  }
@@ -2800,9 +2810,9 @@ PubSub.publishAction = (eventName, ...args) => {
2800
2810
  }
2801
2811
  });
2802
2812
  }
2803
- };
2804
- PubSub.subscribe = (event) => _PubSub.events[event.eventName].push(event);
2805
- PubSub.unsubscribe = (event) => {
2813
+ });
2814
+ __publicField(PubSub, "subscribe", (event) => _PubSub.events[event.eventName].push(event));
2815
+ __publicField(PubSub, "unsubscribe", (event) => {
2806
2816
  if (_PubSub.events[event.eventName]) {
2807
2817
  for (let i = 0; i < _PubSub.events[event.eventName].length; i++) {
2808
2818
  if (_PubSub.events[event.eventName][i] === event) {
@@ -2811,8 +2821,8 @@ PubSub.unsubscribe = (event) => {
2811
2821
  }
2812
2822
  }
2813
2823
  }
2814
- };
2815
- PubSub.publish = (eventName, ...args) => {
2824
+ });
2825
+ __publicField(PubSub, "publish", (eventName, ...args) => {
2816
2826
  if (_PubSub.events.All) {
2817
2827
  _PubSub.events.All.forEach((event) => event.callback(eventName, args));
2818
2828
  }
@@ -2844,7 +2854,7 @@ PubSub.publish = (eventName, ...args) => {
2844
2854
  }
2845
2855
  });
2846
2856
  }
2847
- };
2857
+ });
2848
2858
  var pubsub_default = PubSub;
2849
2859
 
2850
2860
  // src/layouts/search/index.tsx
@@ -3171,7 +3181,7 @@ var ExtendContent = ({ children, actionTitle, onClick }) => {
3171
3181
  }
3172
3182
  }, []);
3173
3183
  const onRef = (ref) => {
3174
- const refHeight = ref?.clientHeight || 0;
3184
+ const refHeight = (ref == null ? void 0 : ref.clientHeight) || 0;
3175
3185
  if (refHeight < 207) {
3176
3186
  setExtend(true);
3177
3187
  }
@@ -3603,12 +3613,12 @@ var getYoutubeThumbnail = (url) => {
3603
3613
  };
3604
3614
  };
3605
3615
  var onImageLoad = (e, thumbnail) => {
3606
- if (thumbnail?.length === 2 && e.currentTarget.src === thumbnail[0] && e.currentTarget.naturalWidth === 120 && e.currentTarget.naturalHeight === 90) {
3616
+ if ((thumbnail == null ? void 0 : thumbnail.length) === 2 && e.currentTarget.src === thumbnail[0] && e.currentTarget.naturalWidth === 120 && e.currentTarget.naturalHeight === 90) {
3607
3617
  e.currentTarget.src = thumbnail[1];
3608
3618
  }
3609
3619
  };
3610
3620
  var onImageError = (e, thumbnail) => {
3611
- if (thumbnail?.length === 2) {
3621
+ if ((thumbnail == null ? void 0 : thumbnail.length) === 2) {
3612
3622
  e.currentTarget.src = thumbnail[1];
3613
3623
  }
3614
3624
  };
@@ -4182,7 +4192,7 @@ var Lightbox = ({ index, media, onClose }) => {
4182
4192
  }
4183
4193
  };
4184
4194
  return /* @__PURE__ */ React47.createElement(Wrapper18, {
4185
- ref: (ref) => ref?.focus(),
4195
+ ref: (ref) => ref == null ? void 0 : ref.focus(),
4186
4196
  onKeyDown,
4187
4197
  tabIndex: 0
4188
4198
  }, /* @__PURE__ */ React47.createElement(UiBlock2, {
@@ -4222,7 +4232,7 @@ import { useEffect as useEffect10, useState as useState13 } from "react";
4222
4232
  // src/hooks/useFetch.ts
4223
4233
  import { useEffect as useEffect9, useState as useState12, useCallback as useCallback15 } from "react";
4224
4234
  var cache = {};
4225
- var getCachedResult = (key) => cache?.[key] || void 0;
4235
+ var getCachedResult = (key) => (cache == null ? void 0 : cache[key]) || void 0;
4226
4236
  var setCachedResult = (key, value) => {
4227
4237
  cache[key] = value;
4228
4238
  };
@@ -4293,7 +4303,7 @@ var useVimeoThumbnail = (id, small) => {
4293
4303
  true
4294
4304
  );
4295
4305
  useEffect10(() => {
4296
- if (data?.[0]) {
4306
+ if (data == null ? void 0 : data[0]) {
4297
4307
  if (small && data[0].thumbnail_small) {
4298
4308
  setThumbnail(data[0].thumbnail_small);
4299
4309
  } else if (data[0].thumbnail_large) {
@@ -4307,7 +4317,7 @@ var useVimeoThumbnail_default = useVimeoThumbnail;
4307
4317
 
4308
4318
  // src/components/Video/useThumbnail.ts
4309
4319
  var useThumbnail = (url, small) => {
4310
- if (url?.toLowerCase().endsWith(".mp4"))
4320
+ if (url == null ? void 0 : url.toLowerCase().endsWith(".mp4"))
4311
4321
  return;
4312
4322
  const [thumbnail, setThumbnail] = useState14();
4313
4323
  const vimeoId = url ? getVimeoId(url) : void 0;
@@ -4483,7 +4493,7 @@ var GalleryEmbed = ({ src, index }) => {
4483
4493
  [thumbnail]
4484
4494
  );
4485
4495
  const customVideo = src.toLowerCase().endsWith(".mp4");
4486
- if (thumbnail?.length && !customVideo) {
4496
+ if ((thumbnail == null ? void 0 : thumbnail.length) && !customVideo) {
4487
4497
  return /* @__PURE__ */ React49.createElement(React49.Fragment, null, /* @__PURE__ */ React49.createElement(ImageFull, {
4488
4498
  onLoad,
4489
4499
  src: thumbnail[0],
@@ -4530,8 +4540,8 @@ var QuickNavEmbeded = ({ src, index }) => {
4530
4540
  (e) => onImageLoad(e, thumbnail),
4531
4541
  [thumbnail]
4532
4542
  );
4533
- const customVideo = src?.toLowerCase().endsWith(".mp4");
4534
- if (thumbnail?.length && !customVideo)
4543
+ const customVideo = src == null ? void 0 : src.toLowerCase().endsWith(".mp4");
4544
+ if ((thumbnail == null ? void 0 : thumbnail.length) && !customVideo)
4535
4545
  return /* @__PURE__ */ React50.createElement(QuickNavImg, {
4536
4546
  onLoad,
4537
4547
  src: thumbnail[0],
@@ -4628,7 +4638,8 @@ var Gallery = ({ media, placeholderImage }) => {
4628
4638
  const [lightbox, setLightbox] = useState16(false);
4629
4639
  const [navigationDisabled, setNavigationDisabled] = useState16(false);
4630
4640
  const beforeChange = useCallback18((_, newIndex) => {
4631
- const element = quickNavRef.current?.querySelectorAll("li")?.[newIndex];
4641
+ var _a, _b;
4642
+ const element = (_b = (_a = quickNavRef.current) == null ? void 0 : _a.querySelectorAll("li")) == null ? void 0 : _b[newIndex];
4632
4643
  if (element) {
4633
4644
  scrollIntoView(element, { scrollMode: "if-needed", block: "nearest", inline: "nearest" });
4634
4645
  }
@@ -4646,7 +4657,7 @@ var Gallery = ({ media, placeholderImage }) => {
4646
4657
  }, []);
4647
4658
  const onClick = useCallback18(() => {
4648
4659
  pubsub_default.publish("ImagesClick");
4649
- if (!isDragging.current && !lightbox && !!media?.length) {
4660
+ if (!isDragging.current && !lightbox && !!(media == null ? void 0 : media.length)) {
4650
4661
  setLightbox(true);
4651
4662
  }
4652
4663
  }, [lightbox, media]);
@@ -4681,7 +4692,7 @@ var Gallery = ({ media, placeholderImage }) => {
4681
4692
  setNavigationDisabled(false);
4682
4693
  };
4683
4694
  const onToggleLightbox = useCallback18(() => setLightbox(!lightbox), [lightbox]);
4684
- const mediaLength = media?.length || 0;
4695
+ const mediaLength = (media == null ? void 0 : media.length) || 0;
4685
4696
  const placeholder = useMemo3(
4686
4697
  () => placeholderImage || DEFAULT_PLACEHOLDER_IMAGE,
4687
4698
  [placeholderImage]
@@ -4697,26 +4708,29 @@ var Gallery = ({ media, placeholderImage }) => {
4697
4708
  swipeToSlide: !navigationDisabled,
4698
4709
  ref: slider,
4699
4710
  beforeChange
4700
- }, !!media?.length ? media.map((m, i) => /* @__PURE__ */ React53.createElement(Item8, {
4701
- key: m.files[0].url || i
4702
- }, m.type === "image" && /* @__PURE__ */ React53.createElement(Image2, {
4703
- src: m.files[0].formats.filter(notEmpty).find((x) => x.format === "1170x")?.url,
4704
- alt: `Bild ${i + 1}`
4705
- }), m.type === "threesixty" && /* @__PURE__ */ React53.createElement(ThreeSixty_default, {
4706
- urls: m.files.map((x) => x.url),
4707
- visible: i === index,
4708
- onDisableNavigation,
4709
- navigationDisabled
4710
- }), m.type === "embedded" && /* @__PURE__ */ React53.createElement(EmbededVideo_default, {
4711
- src: m.files[0].url,
4712
- index: i + 1
4713
- }), m.type === "sphere" && /* @__PURE__ */ React53.createElement(Sphere_default, {
4714
- visible: i === index,
4715
- url: m.files[0].url,
4716
- preview: m.files[0].url,
4717
- onDisableNavigation,
4718
- navigationDisabled
4719
- }))) : /* @__PURE__ */ React53.createElement(Item8, {
4711
+ }, !!(media == null ? void 0 : media.length) ? media.map((m, i) => {
4712
+ var _a;
4713
+ return /* @__PURE__ */ React53.createElement(Item8, {
4714
+ key: m.files[0].url || i
4715
+ }, m.type === "image" && /* @__PURE__ */ React53.createElement(Image2, {
4716
+ src: (_a = m.files[0].formats.filter(notEmpty).find((x) => x.format === "1170x")) == null ? void 0 : _a.url,
4717
+ alt: `Bild ${i + 1}`
4718
+ }), m.type === "threesixty" && /* @__PURE__ */ React53.createElement(ThreeSixty_default, {
4719
+ urls: m.files.map((x) => x.url),
4720
+ visible: i === index,
4721
+ onDisableNavigation,
4722
+ navigationDisabled
4723
+ }), m.type === "embedded" && /* @__PURE__ */ React53.createElement(EmbededVideo_default, {
4724
+ src: m.files[0].url,
4725
+ index: i + 1
4726
+ }), m.type === "sphere" && /* @__PURE__ */ React53.createElement(Sphere_default, {
4727
+ visible: i === index,
4728
+ url: m.files[0].url,
4729
+ preview: m.files[0].url,
4730
+ onDisableNavigation,
4731
+ navigationDisabled
4732
+ }));
4733
+ }) : /* @__PURE__ */ React53.createElement(Item8, {
4720
4734
  key: placeholder
4721
4735
  }, /* @__PURE__ */ React53.createElement(Image2, {
4722
4736
  src: placeholder,
@@ -4736,8 +4750,9 @@ var Gallery = ({ media, placeholderImage }) => {
4736
4750
  block: true
4737
4751
  })))), /* @__PURE__ */ React53.createElement(Alt, null, /* @__PURE__ */ React53.createElement(QuickNav, {
4738
4752
  ref: quickNavRef
4739
- }, !!media?.length ? media.map((m, i) => {
4740
- const src = m.files[0].formats.filter(notEmpty).find((x) => x.format === "225x150")?.url || m.files[0].url;
4753
+ }, !!(media == null ? void 0 : media.length) ? media.map((m, i) => {
4754
+ var _a;
4755
+ const src = ((_a = m.files[0].formats.filter(notEmpty).find((x) => x.format === "225x150")) == null ? void 0 : _a.url) || m.files[0].url;
4741
4756
  return /* @__PURE__ */ React53.createElement(QuickNavItem, {
4742
4757
  key: src || i,
4743
4758
  active: index === i
@@ -4766,7 +4781,7 @@ var Gallery = ({ media, placeholderImage }) => {
4766
4781
  }, /* @__PURE__ */ React53.createElement(QuickNavImg, {
4767
4782
  src: placeholder,
4768
4783
  alt: `Bild 1`
4769
- })))))), lightbox && !!media?.length && /* @__PURE__ */ React53.createElement(Lightbox_default, {
4784
+ })))))), lightbox && !!(media == null ? void 0 : media.length) && /* @__PURE__ */ React53.createElement(Lightbox_default, {
4770
4785
  media,
4771
4786
  index,
4772
4787
  onClose: onToggleLightbox
@@ -5226,14 +5241,14 @@ var Leasing = ({ financialOption }) => {
5226
5241
  },
5227
5242
  {
5228
5243
  label: "Bindningstid",
5229
- value: `${duration?.current} m\xE5nader`
5244
+ value: `${duration == null ? void 0 : duration.current} m\xE5nader`
5230
5245
  },
5231
5246
  {
5232
5247
  label: "\xC5rlig k\xF6rstr\xE4cka",
5233
- value: `${numberSeparator(mileage?.current || 0)} mil/\xE5r`
5248
+ value: `${numberSeparator((mileage == null ? void 0 : mileage.current) || 0)} mil/\xE5r`
5234
5249
  }
5235
5250
  ]
5236
- })))), /* @__PURE__ */ React56.createElement(OptionBox_default, null, /* @__PURE__ */ React56.createElement(React56.Fragment, null, monthlyCost !== null && monthlyCost !== void 0 && /* @__PURE__ */ React56.createElement(OptionBoxHeading, null, `ca ${numberSeparator(monthlyCost)} kr/m\xE5n`)), /* @__PURE__ */ React56.createElement(OptionBoxContent, null, /* @__PURE__ */ React56.createElement("p", null, "Privatleasing", " ", mileage?.current && duration?.current && /* @__PURE__ */ React56.createElement(React56.Fragment, null, /* @__PURE__ */ React56.createElement(UtilityTextPrimary, null, numberSeparator(mileage?.current), " mil/\xE5r"), " ", "i ", /* @__PURE__ */ React56.createElement(UtilityTextPrimary, null, duration?.current, " m\xE5n"), ".", " ")), /* @__PURE__ */ React56.createElement("p", null, /* @__PURE__ */ React56.createElement(ButtonInline, {
5251
+ })))), /* @__PURE__ */ React56.createElement(OptionBox_default, null, /* @__PURE__ */ React56.createElement(React56.Fragment, null, monthlyCost !== null && monthlyCost !== void 0 && /* @__PURE__ */ React56.createElement(OptionBoxHeading, null, `ca ${numberSeparator(monthlyCost)} kr/m\xE5n`)), /* @__PURE__ */ React56.createElement(OptionBoxContent, null, /* @__PURE__ */ React56.createElement("p", null, "Privatleasing", " ", (mileage == null ? void 0 : mileage.current) && (duration == null ? void 0 : duration.current) && /* @__PURE__ */ React56.createElement(React56.Fragment, null, /* @__PURE__ */ React56.createElement(UtilityTextPrimary, null, numberSeparator(mileage == null ? void 0 : mileage.current), " mil/\xE5r"), " ", "i ", /* @__PURE__ */ React56.createElement(UtilityTextPrimary, null, duration == null ? void 0 : duration.current, " m\xE5n"), ".", " ")), /* @__PURE__ */ React56.createElement("p", null, /* @__PURE__ */ React56.createElement(ButtonInline, {
5237
5252
  onClick: toggleModal
5238
5253
  }, "L\xE4s mer")))));
5239
5254
  };
@@ -5431,7 +5446,7 @@ var SliderWithLabel = ({
5431
5446
  }, [loading]);
5432
5447
  return /* @__PURE__ */ React59.createElement(React59.Fragment, null, /* @__PURE__ */ React59.createElement(RepeatTiny, null, /* @__PURE__ */ React59.createElement(RangeSliderLabel_default, {
5433
5448
  label,
5434
- value: `${numberSeparator(local?.[0] || values[0])}${unit ? ` ${unit}` : ""}`
5449
+ value: `${numberSeparator((local == null ? void 0 : local[0]) || values[0])}${unit ? ` ${unit}` : ""}`
5435
5450
  })), /* @__PURE__ */ React59.createElement(RepeatTiny, null, /* @__PURE__ */ React59.createElement(RangeSliderSimple_default, {
5436
5451
  loading,
5437
5452
  values,
@@ -5457,6 +5472,7 @@ var stepGenerator = (step, max, steps = [], current) => {
5457
5472
  return stepGenerator(step, max, steps, nextCurrent);
5458
5473
  };
5459
5474
  var LoanModal = ({ id, financialOption, onClose }) => {
5475
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
5460
5476
  const [tmp, setTmp] = useState19();
5461
5477
  const [extend, setExtend] = React60.useState(false);
5462
5478
  const onToggleExtend = React60.useCallback(() => {
@@ -5466,27 +5482,28 @@ var LoanModal = ({ id, financialOption, onClose }) => {
5466
5482
  setExtend(!extend);
5467
5483
  }, [extend]);
5468
5484
  const [variables, setVariables] = useState19({
5469
- duration: financialOption.duration?.current,
5470
- downPayment: financialOption.downPayment?.current,
5471
- residual: financialOption.residual?.current
5485
+ duration: (_a = financialOption.duration) == null ? void 0 : _a.current,
5486
+ downPayment: (_b = financialOption.downPayment) == null ? void 0 : _b.current,
5487
+ residual: (_c = financialOption.residual) == null ? void 0 : _c.current
5472
5488
  });
5473
5489
  const { duration, downPayment, residual } = variables;
5474
5490
  const { loading, data } = useLoan_default(id, duration, downPayment, residual);
5475
5491
  useEffect13(() => {
5492
+ var _a2, _b2, _c2, _d2, _e2, _f2;
5476
5493
  if (data) {
5477
5494
  setTmp(data);
5478
5495
  setVariables({
5479
- duration: data?.loan?.duration?.current || 0,
5480
- downPayment: data?.loan?.downPayment?.current || 0,
5481
- residual: data?.loan?.residual?.current || 0
5496
+ duration: ((_b2 = (_a2 = data == null ? void 0 : data.loan) == null ? void 0 : _a2.duration) == null ? void 0 : _b2.current) || 0,
5497
+ downPayment: ((_d2 = (_c2 = data == null ? void 0 : data.loan) == null ? void 0 : _c2.downPayment) == null ? void 0 : _d2.current) || 0,
5498
+ residual: ((_f2 = (_e2 = data == null ? void 0 : data.loan) == null ? void 0 : _e2.residual) == null ? void 0 : _f2.current) || 0
5482
5499
  });
5483
5500
  }
5484
5501
  }, [data]);
5485
- const loan = data?.loan || tmp?.loan;
5486
- const downPaymentCurrent = loan?.downPayment?.current || 0;
5487
- const downPaymentMin = loan?.downPayment?.min || 0;
5488
- const downPaymentMax = loan?.downPayment?.max || 0;
5489
- const downPaymentStep = loan?.downPayment?.step || 0;
5502
+ const loan = (data == null ? void 0 : data.loan) || (tmp == null ? void 0 : tmp.loan);
5503
+ const downPaymentCurrent = ((_d = loan == null ? void 0 : loan.downPayment) == null ? void 0 : _d.current) || 0;
5504
+ const downPaymentMin = ((_e = loan == null ? void 0 : loan.downPayment) == null ? void 0 : _e.min) || 0;
5505
+ const downPaymentMax = ((_f = loan == null ? void 0 : loan.downPayment) == null ? void 0 : _f.max) || 0;
5506
+ const downPaymentStep = ((_g = loan == null ? void 0 : loan.downPayment) == null ? void 0 : _g.step) || 0;
5490
5507
  const downPaymentSteps = stepGenerator(downPaymentStep, downPaymentMax);
5491
5508
  const onDownPaymentChange = useCallback21(
5492
5509
  (values) => {
@@ -5495,10 +5512,10 @@ var LoanModal = ({ id, financialOption, onClose }) => {
5495
5512
  },
5496
5513
  [variables]
5497
5514
  );
5498
- const durationCurrent = loan?.duration?.current || 0;
5499
- const durationMin = loan?.duration?.min || 0;
5500
- const durationMax = loan?.duration?.max || 0;
5501
- const durationStep = loan?.duration?.step || 0;
5515
+ const durationCurrent = ((_h = loan == null ? void 0 : loan.duration) == null ? void 0 : _h.current) || 0;
5516
+ const durationMin = ((_i = loan == null ? void 0 : loan.duration) == null ? void 0 : _i.min) || 0;
5517
+ const durationMax = ((_j = loan == null ? void 0 : loan.duration) == null ? void 0 : _j.max) || 0;
5518
+ const durationStep = ((_k = loan == null ? void 0 : loan.duration) == null ? void 0 : _k.step) || 0;
5502
5519
  const durationSteps = stepGenerator(durationStep, durationMax);
5503
5520
  const onDurationChange = useCallback21(
5504
5521
  (values) => {
@@ -5507,10 +5524,10 @@ var LoanModal = ({ id, financialOption, onClose }) => {
5507
5524
  },
5508
5525
  [variables]
5509
5526
  );
5510
- const residualCurrent = (loan?.residual?.current || 0) * 100 || 0;
5511
- const residualMin = (loan?.residual?.min || 0) * 100 || 0;
5512
- const residualMax = (loan?.residual?.max || 0) * 100 || 0;
5513
- const residualStep = (loan?.residual?.step || 0) * 100 || 0;
5527
+ const residualCurrent = (((_l = loan == null ? void 0 : loan.residual) == null ? void 0 : _l.current) || 0) * 100 || 0;
5528
+ const residualMin = (((_m = loan == null ? void 0 : loan.residual) == null ? void 0 : _m.min) || 0) * 100 || 0;
5529
+ const residualMax = (((_n = loan == null ? void 0 : loan.residual) == null ? void 0 : _n.max) || 0) * 100 || 0;
5530
+ const residualStep = (((_o = loan == null ? void 0 : loan.residual) == null ? void 0 : _o.step) || 0) * 100 || 0;
5514
5531
  const residualSteps = stepGenerator(residualStep, residualMax);
5515
5532
  const onResidualChange = useCallback21(
5516
5533
  (values) => {
@@ -5519,12 +5536,12 @@ var LoanModal = ({ id, financialOption, onClose }) => {
5519
5536
  },
5520
5537
  [variables]
5521
5538
  );
5522
- const interestText = ((loan?.interest || 0) * 100).toFixed(2);
5523
- const effectiveInterestText = ((loan?.effectiveInterest || 0) * 100).toFixed(2);
5539
+ const interestText = (((loan == null ? void 0 : loan.interest) || 0) * 100).toFixed(2);
5540
+ const effectiveInterestText = (((loan == null ? void 0 : loan.effectiveInterest) || 0) * 100).toFixed(2);
5524
5541
  return /* @__PURE__ */ React60.createElement(Modal_default, {
5525
5542
  title: "L\xE5nealternativ",
5526
5543
  onClose
5527
- }, /* @__PURE__ */ React60.createElement(Repeat, null, /* @__PURE__ */ React60.createElement(ContentLogo, null, financialOption?.description && /* @__PURE__ */ React60.createElement(ContentLogoText, null, /* @__PURE__ */ React60.createElement(Content_default, null, /* @__PURE__ */ React60.createElement("p", null, financialOption.description))), financialOption?.image && /* @__PURE__ */ React60.createElement(ContentLogoMedia, null, /* @__PURE__ */ React60.createElement(LogoBox_default, {
5544
+ }, /* @__PURE__ */ React60.createElement(Repeat, null, /* @__PURE__ */ React60.createElement(ContentLogo, null, (financialOption == null ? void 0 : financialOption.description) && /* @__PURE__ */ React60.createElement(ContentLogoText, null, /* @__PURE__ */ React60.createElement(Content_default, null, /* @__PURE__ */ React60.createElement("p", null, financialOption.description))), (financialOption == null ? void 0 : financialOption.image) && /* @__PURE__ */ React60.createElement(ContentLogoMedia, null, /* @__PURE__ */ React60.createElement(LogoBox_default, {
5528
5545
  logo: financialOption.image,
5529
5546
  alt: financialOption.name || "Logotyp",
5530
5547
  wide: true
@@ -5555,7 +5572,7 @@ var LoanModal = ({ id, financialOption, onClose }) => {
5555
5572
  onChange: onResidualChange
5556
5573
  })), /* @__PURE__ */ React60.createElement(RepeatSmall, null, /* @__PURE__ */ React60.createElement(RepeatTiny, null, /* @__PURE__ */ React60.createElement(Content_default, {
5557
5574
  small: true
5558
- }, /* @__PURE__ */ React60.createElement("p", null, `*Ber\xE4knat p\xE5 ${interestText} % r\xE4nta (effektivt ${effectiveInterestText} %)${loan?.mileage !== null ? `och en \xE5rlig k\xF6rstr\xE4cka om ${loan?.mileage} mil.` : ""}`)))), /* @__PURE__ */ React60.createElement(RepeatSmall, null, /* @__PURE__ */ React60.createElement(ButtonClear, {
5575
+ }, /* @__PURE__ */ React60.createElement("p", null, `*Ber\xE4knat p\xE5 ${interestText} % r\xE4nta (effektivt ${effectiveInterestText} %)${(loan == null ? void 0 : loan.mileage) !== null ? `och en \xE5rlig k\xF6rstr\xE4cka om ${loan == null ? void 0 : loan.mileage} mil.` : ""}`)))), /* @__PURE__ */ React60.createElement(RepeatSmall, null, /* @__PURE__ */ React60.createElement(ButtonClear, {
5559
5576
  onClick: onToggleExtend,
5560
5577
  title: extend ? "Visa mindre information" : "Visa mer information"
5561
5578
  }, /* @__PURE__ */ React60.createElement(ButtonContent, null, extend ? "Mindre information" : "Mer information"))), /* @__PURE__ */ React60.createElement(React60.Fragment, null, extend && /* @__PURE__ */ React60.createElement(ModalFoldout, null, /* @__PURE__ */ React60.createElement(ModalFoldoutBody, null, /* @__PURE__ */ React60.createElement(DataList_default, {
@@ -5570,15 +5587,15 @@ var LoanModal = ({ id, financialOption, onClose }) => {
5570
5587
  },
5571
5588
  {
5572
5589
  label: "Uppl\xE4ggningskostnad",
5573
- value: `${numberSeparator(financialOption?.setupFee || 0)} kr`
5590
+ value: `${numberSeparator((financialOption == null ? void 0 : financialOption.setupFee) || 0)} kr`
5574
5591
  },
5575
5592
  {
5576
5593
  label: "Administrativa avgifter",
5577
- value: `${numberSeparator(financialOption?.administrationFee || 0)} kr/m\xE5n`
5594
+ value: `${numberSeparator((financialOption == null ? void 0 : financialOption.administrationFee) || 0)} kr/m\xE5n`
5578
5595
  },
5579
5596
  {
5580
5597
  label: "Total kreditkostnad",
5581
- value: `${numberSeparator(loan?.totalCreditCost || 0)} kr`
5598
+ value: `${numberSeparator((loan == null ? void 0 : loan.totalCreditCost) || 0)} kr`
5582
5599
  }
5583
5600
  ]
5584
5601
  }))))));
@@ -5587,18 +5604,19 @@ var LoanModal_default = LoanModal;
5587
5604
 
5588
5605
  // src/components/FinancialOptions/loan.tsx
5589
5606
  var Loan = ({ id, financialOption }) => {
5607
+ var _a, _b, _c, _d, _e, _f, _g;
5590
5608
  const [modal, setModal] = useState20(false);
5591
5609
  const toggleModal = useCallback22(() => setModal(!modal), [modal]);
5592
5610
  const { data } = useLoan_default(
5593
5611
  id,
5594
- financialOption.duration?.current,
5595
- financialOption.downPayment?.current,
5596
- financialOption.residual?.current
5612
+ (_a = financialOption.duration) == null ? void 0 : _a.current,
5613
+ (_b = financialOption.downPayment) == null ? void 0 : _b.current,
5614
+ (_c = financialOption.residual) == null ? void 0 : _c.current
5597
5615
  );
5598
- const interest = data?.loan?.interest;
5599
- const duration = data?.loan?.duration?.current;
5600
- const monthlyCost = data?.loan?.monthlyCost;
5601
- const logo = financialOption?.logotype || "https://placehold.it/67x10";
5616
+ const interest = (_d = data == null ? void 0 : data.loan) == null ? void 0 : _d.interest;
5617
+ const duration = (_f = (_e = data == null ? void 0 : data.loan) == null ? void 0 : _e.duration) == null ? void 0 : _f.current;
5618
+ const monthlyCost = (_g = data == null ? void 0 : data.loan) == null ? void 0 : _g.monthlyCost;
5619
+ const logo = (financialOption == null ? void 0 : financialOption.logotype) || "https://placehold.it/67x10";
5602
5620
  if (financialOption.loanAmount === void 0 || financialOption.loanAmount === null || interest === void 0 || duration === void 0 || monthlyCost === void 0 || interest === null || duration === null || monthlyCost === null) {
5603
5621
  return /* @__PURE__ */ React61.createElement(OptionBox_default, {
5604
5622
  logo,
@@ -5988,7 +6006,7 @@ var InputSelect = ({ value, options, onChange, unit, title }) => /* @__PURE__ */
5988
6006
  onChange,
5989
6007
  title,
5990
6008
  "aria-label": title
5991
- }, options?.map((option) => /* @__PURE__ */ React69.createElement(Option2, {
6009
+ }, options == null ? void 0 : options.map((option) => /* @__PURE__ */ React69.createElement(Option2, {
5992
6010
  key: option.value,
5993
6011
  value: option.value
5994
6012
  }, option.displayName || option.value, unit ? ` ${unit}` : ""))), /* @__PURE__ */ React69.createElement(Icon5, null, /* @__PURE__ */ React69.createElement(IconChevronDown, {
@@ -6106,9 +6124,9 @@ var InsuranceModal = ({ id, branch, onClose, insuranceOptions }) => {
6106
6124
  const [payload, setPayload] = useState22();
6107
6125
  const { loading, data, error } = useInsurance_default(
6108
6126
  id,
6109
- branch?.id ? branch?.id : void 0,
6110
- ssnIsValid(payload?.ssn) ? payload?.ssn : void 0,
6111
- payload?.drivingDistance
6127
+ (branch == null ? void 0 : branch.id) ? branch == null ? void 0 : branch.id : void 0,
6128
+ ssnIsValid(payload == null ? void 0 : payload.ssn) ? payload == null ? void 0 : payload.ssn : void 0,
6129
+ payload == null ? void 0 : payload.drivingDistance
6112
6130
  );
6113
6131
  const onChangeSsn = useCallback24(
6114
6132
  (e) => setForm({ ...form, ssn: e.currentTarget.value }),
@@ -6140,7 +6158,7 @@ var InsuranceModal = ({ id, branch, onClose, insuranceOptions }) => {
6140
6158
  return /* @__PURE__ */ React70.createElement(Modal_default, {
6141
6159
  title: "F\xF6rs\xE4kring",
6142
6160
  onClose
6143
- }, (insuranceOptions?.description || insuranceOptions?.logotype) && /* @__PURE__ */ React70.createElement(Repeat, null, /* @__PURE__ */ React70.createElement(ContentLogo, null, insuranceOptions.description && /* @__PURE__ */ React70.createElement(ContentLogoText, null, /* @__PURE__ */ React70.createElement(Content_default, null, /* @__PURE__ */ React70.createElement("p", null, insuranceOptions.description))), insuranceOptions.logotype && /* @__PURE__ */ React70.createElement(ContentLogoMedia, null, /* @__PURE__ */ React70.createElement(LogoBox_default, {
6161
+ }, ((insuranceOptions == null ? void 0 : insuranceOptions.description) || (insuranceOptions == null ? void 0 : insuranceOptions.logotype)) && /* @__PURE__ */ React70.createElement(Repeat, null, /* @__PURE__ */ React70.createElement(ContentLogo, null, insuranceOptions.description && /* @__PURE__ */ React70.createElement(ContentLogoText, null, /* @__PURE__ */ React70.createElement(Content_default, null, /* @__PURE__ */ React70.createElement("p", null, insuranceOptions.description))), insuranceOptions.logotype && /* @__PURE__ */ React70.createElement(ContentLogoMedia, null, /* @__PURE__ */ React70.createElement(LogoBox_default, {
6144
6162
  logo: insuranceOptions.logotype,
6145
6163
  alt: insuranceOptions.name || "Logotyp",
6146
6164
  wide: true
@@ -6171,7 +6189,7 @@ var InsuranceModal = ({ id, branch, onClose, insuranceOptions }) => {
6171
6189
  severity: "error",
6172
6190
  icon: true,
6173
6191
  heading: "Ett fel har intr\xE4ffat"
6174
- }, "Kunde inte h\xE4mta f\xF6rs\xE4kringar. V\xE4nligen f\xF6rs\xF6k igen.")), /* @__PURE__ */ React70.createElement(React70.Fragment, null, data?.insurances && /* @__PURE__ */ React70.createElement(Repeat, null, data?.insurances.map((insurance) => /* @__PURE__ */ React70.createElement(Repeat, {
6192
+ }, "Kunde inte h\xE4mta f\xF6rs\xE4kringar. V\xE4nligen f\xF6rs\xF6k igen.")), /* @__PURE__ */ React70.createElement(React70.Fragment, null, (data == null ? void 0 : data.insurances) && /* @__PURE__ */ React70.createElement(Repeat, null, data == null ? void 0 : data.insurances.map((insurance) => /* @__PURE__ */ React70.createElement(Repeat, {
6175
6193
  key: insurance.name
6176
6194
  }, /* @__PURE__ */ React70.createElement(DetailBox_default, {
6177
6195
  heading: `${numberSeparator(insurance.price)} ${insurance.unit}`,
@@ -6224,18 +6242,18 @@ import React72 from "react";
6224
6242
  import { marked } from "marked";
6225
6243
  var InsuranceFreeModal = ({ onClose, insuranceOptions }) => {
6226
6244
  return /* @__PURE__ */ React72.createElement(Modal_default, {
6227
- title: insuranceOptions?.insuranceHeader ?? "F\xF6rs\xE4kring",
6245
+ title: (insuranceOptions == null ? void 0 : insuranceOptions.insuranceHeader) ?? "F\xF6rs\xE4kring",
6228
6246
  onClose
6229
- }, insuranceOptions?.longDescription && /* @__PURE__ */ React72.createElement(Repeat, null, /* @__PURE__ */ React72.createElement(Content_default, {
6247
+ }, (insuranceOptions == null ? void 0 : insuranceOptions.longDescription) && /* @__PURE__ */ React72.createElement(Repeat, null, /* @__PURE__ */ React72.createElement(Content_default, {
6230
6248
  dangerouslySetInnerHTML: {
6231
6249
  __html: marked(insuranceOptions.longDescription)
6232
6250
  }
6233
- })), insuranceOptions?.url && /* @__PURE__ */ React72.createElement(Repeat, null, /* @__PURE__ */ React72.createElement(ButtonInline, {
6251
+ })), (insuranceOptions == null ? void 0 : insuranceOptions.url) && /* @__PURE__ */ React72.createElement(Repeat, null, /* @__PURE__ */ React72.createElement(ButtonInline, {
6234
6252
  as: "a",
6235
6253
  href: insuranceOptions.url,
6236
6254
  target: "_blank",
6237
6255
  rel: "noopener noreferrer"
6238
- }, "L\xE4s mer om f\xF6rs\xE4kringen (\xD6ppnas i ett nytt f\xF6nster)")), insuranceOptions?.logotype && /* @__PURE__ */ React72.createElement(Repeat, null, /* @__PURE__ */ React72.createElement(LogoBox_default, {
6256
+ }, "L\xE4s mer om f\xF6rs\xE4kringen (\xD6ppnas i ett nytt f\xF6nster)")), (insuranceOptions == null ? void 0 : insuranceOptions.logotype) && /* @__PURE__ */ React72.createElement(Repeat, null, /* @__PURE__ */ React72.createElement(LogoBox_default, {
6239
6257
  logo: insuranceOptions.logotype,
6240
6258
  alt: insuranceOptions.name || "Logotyp",
6241
6259
  wide: true
@@ -6245,6 +6263,7 @@ var InsuranceFreeModal_default = InsuranceFreeModal;
6245
6263
 
6246
6264
  // src/components/InsuranceOptions/InsuranceFree.tsx
6247
6265
  var Insurance2 = ({ insuranceOptions }) => {
6266
+ var _a;
6248
6267
  const [modal, setModal] = useState24(false);
6249
6268
  const toggleModal = useCallback26(() => setModal(!modal), [modal]);
6250
6269
  if (!insuranceOptions.length) {
@@ -6253,7 +6272,7 @@ var Insurance2 = ({ insuranceOptions }) => {
6253
6272
  return /* @__PURE__ */ React73.createElement(React73.Fragment, null, modal && /* @__PURE__ */ React73.createElement(InsuranceFreeModal_default, {
6254
6273
  onClose: toggleModal,
6255
6274
  insuranceOptions: insuranceOptions[0]
6256
- }), /* @__PURE__ */ React73.createElement(Repeat, null, /* @__PURE__ */ React73.createElement(RepeatTiny, null, /* @__PURE__ */ React73.createElement(VisualHeading, null, insuranceOptions[0]?.insuranceHeader ?? "F\xF6rs\xE4kring")), /* @__PURE__ */ React73.createElement(RepeatTiny, null, /* @__PURE__ */ React73.createElement(React73.Fragment, null, insuranceOptions.map((insuranceOption, index) => /* @__PURE__ */ React73.createElement(OptionBox_default, {
6275
+ }), /* @__PURE__ */ React73.createElement(Repeat, null, /* @__PURE__ */ React73.createElement(RepeatTiny, null, /* @__PURE__ */ React73.createElement(VisualHeading, null, ((_a = insuranceOptions[0]) == null ? void 0 : _a.insuranceHeader) ?? "F\xF6rs\xE4kring")), /* @__PURE__ */ React73.createElement(RepeatTiny, null, /* @__PURE__ */ React73.createElement(React73.Fragment, null, insuranceOptions.map((insuranceOption, index) => /* @__PURE__ */ React73.createElement(OptionBox_default, {
6257
6276
  key: `${insuranceOption.url}-${index}`,
6258
6277
  logo: insuranceOption.logotype || void 0,
6259
6278
  logoAlt: insuranceOption.name || "Logotyp"
@@ -6291,6 +6310,7 @@ var InsuranceOptions_default = InsuranceOptions;
6291
6310
  import React75 from "react";
6292
6311
  import { marked as marked3 } from "marked";
6293
6312
  var ManufacturerPackageOption = ({ packageOption }) => {
6313
+ var _a;
6294
6314
  if (!packageOption) {
6295
6315
  return null;
6296
6316
  }
@@ -6298,7 +6318,7 @@ var ManufacturerPackageOption = ({ packageOption }) => {
6298
6318
  noMargin: true
6299
6319
  }, packageOption.title)), packageOption.description && /* @__PURE__ */ React75.createElement(Repeat, null, /* @__PURE__ */ React75.createElement(Content_default, {
6300
6320
  dangerouslySetInnerHTML: { __html: marked3(packageOption.description) }
6301
- })), packageOption.link?.url && /* @__PURE__ */ React75.createElement(Repeat, null, /* @__PURE__ */ React75.createElement(ButtonInline, {
6321
+ })), ((_a = packageOption.link) == null ? void 0 : _a.url) && /* @__PURE__ */ React75.createElement(Repeat, null, /* @__PURE__ */ React75.createElement(ButtonInline, {
6302
6322
  as: "a",
6303
6323
  href: packageOption.link.url,
6304
6324
  target: "_blank",
@@ -6451,7 +6471,7 @@ var formatPhonenumber = (text) => {
6451
6471
  text.replace("-", "").replace(/ /g, ""),
6452
6472
  typedMetadata
6453
6473
  );
6454
- return parsed?.formatNational() || text;
6474
+ return (parsed == null ? void 0 : parsed.formatNational()) || text;
6455
6475
  } catch (e) {
6456
6476
  return text;
6457
6477
  }
@@ -6459,8 +6479,9 @@ var formatPhonenumber = (text) => {
6459
6479
 
6460
6480
  // src/components/ActionList/index.tsx
6461
6481
  var ActionList = ({ contact, branch }) => {
6462
- const email = contact?.email || branch?.contact?.email;
6463
- const phonenumber = contact?.phonenumber || branch?.contact?.phonenumber;
6482
+ var _a, _b;
6483
+ const email = (contact == null ? void 0 : contact.email) || ((_a = branch == null ? void 0 : branch.contact) == null ? void 0 : _a.email);
6484
+ const phonenumber = (contact == null ? void 0 : contact.phonenumber) || ((_b = branch == null ? void 0 : branch.contact) == null ? void 0 : _b.phonenumber);
6464
6485
  const onClickMailVisible = useCallback28(() => pubsub_default.publish("MailVisible"), []);
6465
6486
  const onClickPhoneVisible = useCallback28(() => pubsub_default.publish("PhonenumberVisible"), []);
6466
6487
  const onClickPhoneValue = useCallback28(() => pubsub_default.publish("PhonenumberCall"), []);
@@ -6644,7 +6665,7 @@ var BranchModal = ({ loading, connections, onClose }) => {
6644
6665
  }, /* @__PURE__ */ React80.createElement(Repeat, null, /* @__PURE__ */ React80.createElement(RepeatTiny, null, /* @__PURE__ */ React80.createElement(Content_default, null, /* @__PURE__ */ React80.createElement("p", null, "V\xE4lj den anl\xE4ggning du vill visa kontaktuppgifter f\xF6r."))), /* @__PURE__ */ React80.createElement(RepeatTiny, null, /* @__PURE__ */ React80.createElement(InputLabel_default, null, "V\xE4lj anl\xE4ggning"), /* @__PURE__ */ React80.createElement(InputSelect_default, {
6645
6666
  value: localValue,
6646
6667
  onChange,
6647
- options: connections?.map((x) => ({
6668
+ options: connections == null ? void 0 : connections.map((x) => ({
6648
6669
  value: x.id,
6649
6670
  displayName: x.name
6650
6671
  })),
@@ -6660,21 +6681,24 @@ var BranchModal_default = BranchModal;
6660
6681
  // src/layouts/searchItem/PackageOptionModal.tsx
6661
6682
  import React81 from "react";
6662
6683
  import { marked as marked4 } from "marked";
6663
- var PackageOptionModal = ({ packageOption, onClose }) => /* @__PURE__ */ React81.createElement(Modal_default, {
6664
- title: packageOption.title || "",
6665
- onClose
6666
- }, packageOption.image && /* @__PURE__ */ React81.createElement(Repeat, null, /* @__PURE__ */ React81.createElement(LogoBox_default, {
6667
- logo: packageOption.image,
6668
- alt: packageOption.title || void 0,
6669
- wide: true
6670
- })), packageOption.description && /* @__PURE__ */ React81.createElement(Repeat, null, /* @__PURE__ */ React81.createElement(Content_default, {
6671
- dangerouslySetInnerHTML: { __html: marked4(packageOption.description) }
6672
- })), packageOption.link?.href && packageOption.link.title && /* @__PURE__ */ React81.createElement(Repeat, null, /* @__PURE__ */ React81.createElement(ButtonInline, {
6673
- as: "a",
6674
- href: packageOption.link.href,
6675
- target: "_blank",
6676
- rel: "noopener noreferrer nofollow"
6677
- }, packageOption.link.title)));
6684
+ var PackageOptionModal = ({ packageOption, onClose }) => {
6685
+ var _a;
6686
+ return /* @__PURE__ */ React81.createElement(Modal_default, {
6687
+ title: packageOption.title || "",
6688
+ onClose
6689
+ }, packageOption.image && /* @__PURE__ */ React81.createElement(Repeat, null, /* @__PURE__ */ React81.createElement(LogoBox_default, {
6690
+ logo: packageOption.image,
6691
+ alt: packageOption.title || void 0,
6692
+ wide: true
6693
+ })), packageOption.description && /* @__PURE__ */ React81.createElement(Repeat, null, /* @__PURE__ */ React81.createElement(Content_default, {
6694
+ dangerouslySetInnerHTML: { __html: marked4(packageOption.description) }
6695
+ })), ((_a = packageOption.link) == null ? void 0 : _a.href) && packageOption.link.title && /* @__PURE__ */ React81.createElement(Repeat, null, /* @__PURE__ */ React81.createElement(ButtonInline, {
6696
+ as: "a",
6697
+ href: packageOption.link.href,
6698
+ target: "_blank",
6699
+ rel: "noopener noreferrer nofollow"
6700
+ }, packageOption.link.title)));
6701
+ };
6678
6702
  var PackageOptionModal_default = PackageOptionModal;
6679
6703
 
6680
6704
  // src/layouts/searchItem/CheckList.tsx
@@ -6698,41 +6722,41 @@ var CheckList = ({
6698
6722
  setModalBranch(false);
6699
6723
  }
6700
6724
  }, [branch, contact]);
6701
- const packageOption = manufacturer?.packageOption;
6725
+ const packageOption = manufacturer == null ? void 0 : manufacturer.packageOption;
6702
6726
  return /* @__PURE__ */ React82.createElement(React82.Fragment, null, modalBranch && /* @__PURE__ */ React82.createElement(BranchModal_default, {
6703
6727
  loading: loadingCentralStorageVehicle,
6704
- connections: branch?.connections,
6728
+ connections: branch == null ? void 0 : branch.connections,
6705
6729
  onClose: closeModalBranch
6706
6730
  }), modal && /* @__PURE__ */ React82.createElement(PackageOptionModal_default, {
6707
6731
  packageOption: modal,
6708
6732
  onClose
6709
- }), /* @__PURE__ */ React82.createElement(Repeat, null, /* @__PURE__ */ React82.createElement(CheckMarkList_default, null, packageOption?.title && /* @__PURE__ */ React82.createElement(CheckMarkListItem, null, /* @__PURE__ */ React82.createElement(React82.Fragment, null, "Inkl.", " ", /* @__PURE__ */ React82.createElement(ButtonInline, {
6733
+ }), /* @__PURE__ */ React82.createElement(Repeat, null, /* @__PURE__ */ React82.createElement(CheckMarkList_default, null, (packageOption == null ? void 0 : packageOption.title) && /* @__PURE__ */ React82.createElement(CheckMarkListItem, null, /* @__PURE__ */ React82.createElement(React82.Fragment, null, "Inkl.", " ", /* @__PURE__ */ React82.createElement(ButtonInline, {
6710
6734
  onClick: () => onOpen({
6711
- title: packageOption?.title,
6712
- image: packageOption?.image,
6713
- description: packageOption?.description,
6714
- link: packageOption?.link
6735
+ title: packageOption == null ? void 0 : packageOption.title,
6736
+ image: packageOption == null ? void 0 : packageOption.image,
6737
+ description: packageOption == null ? void 0 : packageOption.description,
6738
+ link: packageOption == null ? void 0 : packageOption.link
6715
6739
  })
6716
- }, packageOption.title), " ", "begagnatgaranti")), packageOptions?.map((packageOption2, index) => /* @__PURE__ */ React82.createElement(CheckMarkListItem, {
6740
+ }, packageOption.title), " ", "begagnatgaranti")), packageOptions == null ? void 0 : packageOptions.map((packageOption2, index) => /* @__PURE__ */ React82.createElement(CheckMarkListItem, {
6717
6741
  key: packageOption2.title || index
6718
6742
  }, /* @__PURE__ */ React82.createElement(React82.Fragment, null, "Inkl.", " ", /* @__PURE__ */ React82.createElement(ButtonInline, {
6719
6743
  onClick: () => onOpen({
6720
- title: packageOption2?.title,
6721
- image: packageOption2?.image,
6722
- description: packageOption2?.description,
6723
- link: packageOption2?.link
6744
+ title: packageOption2 == null ? void 0 : packageOption2.title,
6745
+ image: packageOption2 == null ? void 0 : packageOption2.image,
6746
+ description: packageOption2 == null ? void 0 : packageOption2.description,
6747
+ link: packageOption2 == null ? void 0 : packageOption2.link
6724
6748
  })
6725
- }, packageOption2.title)))), ecommerce?.withHomeDelivery && /* @__PURE__ */ React82.createElement(CheckMarkListItem, null, "Hemleverans"))), /* @__PURE__ */ React82.createElement(Repeat, null, ecommerce && ecommerce.enabled && /* @__PURE__ */ React82.createElement(RepeatTiny, null, /* @__PURE__ */ React82.createElement(ButtonPrimary, {
6749
+ }, packageOption2.title)))), (ecommerce == null ? void 0 : ecommerce.withHomeDelivery) && /* @__PURE__ */ React82.createElement(CheckMarkListItem, null, "Hemleverans"))), /* @__PURE__ */ React82.createElement(Repeat, null, ecommerce && ecommerce.enabled && /* @__PURE__ */ React82.createElement(RepeatTiny, null, /* @__PURE__ */ React82.createElement(ButtonPrimary, {
6726
6750
  disabled: !!ecommerce.reserved,
6727
6751
  fullWidth: true,
6728
6752
  onClick: toggleEcomModal
6729
- }, /* @__PURE__ */ React82.createElement(ButtonContent, null, "K\xF6p bilen online"))), ecommerce?.reserved && /* @__PURE__ */ React82.createElement(RepeatTiny, null, /* @__PURE__ */ React82.createElement(SwitchBar_default, {
6753
+ }, /* @__PURE__ */ React82.createElement(ButtonContent, null, "K\xF6p bilen online"))), (ecommerce == null ? void 0 : ecommerce.reserved) && /* @__PURE__ */ React82.createElement(RepeatTiny, null, /* @__PURE__ */ React82.createElement(SwitchBar_default, {
6730
6754
  title: "Bilen \xE4r reserverad",
6731
6755
  body: "Denna bil \xE4r reserverad av en annan k\xF6pare."
6732
6756
  }, /* @__PURE__ */ React82.createElement(Content_default, null, /* @__PURE__ */ React82.createElement("p", null, "Denna bil \xE4r reserverad av en annan k\xF6pare.")))), /* @__PURE__ */ React82.createElement(ActionList_default, {
6733
6757
  branch,
6734
6758
  contact
6735
- })), (branch?.connections.length || 0) > 1 && /* @__PURE__ */ React82.createElement(Repeat, null, /* @__PURE__ */ React82.createElement(SwitchBar_default, {
6759
+ })), ((branch == null ? void 0 : branch.connections.length) || 0) > 1 && /* @__PURE__ */ React82.createElement(Repeat, null, /* @__PURE__ */ React82.createElement(SwitchBar_default, {
6736
6760
  title: "Centrallagerbil",
6737
6761
  actionTitle: "Byt anl\xE4ggning",
6738
6762
  onClick: openModalBranch
@@ -6883,7 +6907,7 @@ var Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
6883
6907
  onClickSearchItem(id2);
6884
6908
  }
6885
6909
  }, []);
6886
- if (!response?.documentList.documents.length || response?.documentList.documents.length === 0) {
6910
+ if (!(response == null ? void 0 : response.documentList.documents.length) || (response == null ? void 0 : response.documentList.documents.length) === 0) {
6887
6911
  return null;
6888
6912
  }
6889
6913
  if (loading) {
@@ -6904,7 +6928,8 @@ var Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
6904
6928
  actionTitle: "Visa alla"
6905
6929
  }, /* @__PURE__ */ React84.createElement(H2, {
6906
6930
  noMargin: true
6907
- }, "Senast inkomna"))), /* @__PURE__ */ React84.createElement(Repeat, null, /* @__PURE__ */ React84.createElement(OverflowGrid, null, /* @__PURE__ */ React84.createElement(OverflowGridList, null, response?.documentList.documents.map((document2) => {
6931
+ }, "Senast inkomna"))), /* @__PURE__ */ React84.createElement(Repeat, null, /* @__PURE__ */ React84.createElement(OverflowGrid, null, /* @__PURE__ */ React84.createElement(OverflowGridList, null, response == null ? void 0 : response.documentList.documents.map((document2) => {
6932
+ var _a, _b, _c;
6908
6933
  const prefix = pathRoute ? `/${pathRoute}` : "/";
6909
6934
  const r = regexPathGuid(pathRoute);
6910
6935
  const pathRouteUrl = window.location.pathname === "/" ? `${prefix}${document2._id}` : r.test(`${pathRoute}${id}`) ? window.location.pathname.replace(r, `${pathRoute}${document2._id}`) : `${window.location.pathname}${prefix}${document2._id}`;
@@ -6915,7 +6940,7 @@ var Related = ({ id, hashRoute, pathRoute, onClickSearchItem }) => {
6915
6940
  onClick: onItemClicked,
6916
6941
  title: document2.title,
6917
6942
  href: pathRoute ? pathRouteUrl : hashRoute ? `#${document2._id}` : void 0,
6918
- image: document2.featuredImage?.files?.[0]?.url,
6943
+ image: (_c = (_b = (_a = document2.featuredImage) == null ? void 0 : _a.files) == null ? void 0 : _b[0]) == null ? void 0 : _c.url,
6919
6944
  description: document2.shortDescription,
6920
6945
  uspList: [
6921
6946
  {
@@ -6946,22 +6971,25 @@ var PackageOptions = ({ packageOptions }) => {
6946
6971
  if (!packageOptions) {
6947
6972
  return null;
6948
6973
  }
6949
- return /* @__PURE__ */ React85.createElement(React85.Fragment, null, packageOptions.map((packageOption, index) => /* @__PURE__ */ React85.createElement(ProductPageMainSection, {
6950
- key: packageOption.title || index
6951
- }, /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(H2, {
6952
- noMargin: true
6953
- }, packageOption.title)), packageOption.description && /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(Content_default, {
6954
- dangerouslySetInnerHTML: { __html: marked5(packageOption.description) }
6955
- })), packageOption.link?.url && /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(ButtonInline, {
6956
- as: "a",
6957
- href: packageOption.link.url,
6958
- target: "_blank",
6959
- rel: "noopener noreferrer"
6960
- }, packageOption.link.title ? packageOption.link.title : "L\xE4s mer (\xD6ppnas i ett nytt f\xF6nster)")), packageOption.image && /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(LogoBox_default, {
6961
- logo: packageOption.image,
6962
- alt: "Logotyp",
6963
- wide: true
6964
- })))));
6974
+ return /* @__PURE__ */ React85.createElement(React85.Fragment, null, packageOptions.map((packageOption, index) => {
6975
+ var _a;
6976
+ return /* @__PURE__ */ React85.createElement(ProductPageMainSection, {
6977
+ key: packageOption.title || index
6978
+ }, /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(H2, {
6979
+ noMargin: true
6980
+ }, packageOption.title)), packageOption.description && /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(Content_default, {
6981
+ dangerouslySetInnerHTML: { __html: marked5(packageOption.description) }
6982
+ })), ((_a = packageOption.link) == null ? void 0 : _a.url) && /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(ButtonInline, {
6983
+ as: "a",
6984
+ href: packageOption.link.url,
6985
+ target: "_blank",
6986
+ rel: "noopener noreferrer"
6987
+ }, packageOption.link.title ? packageOption.link.title : "L\xE4s mer (\xD6ppnas i ett nytt f\xF6nster)")), packageOption.image && /* @__PURE__ */ React85.createElement(Repeat, null, /* @__PURE__ */ React85.createElement(LogoBox_default, {
6988
+ logo: packageOption.image,
6989
+ alt: "Logotyp",
6990
+ wide: true
6991
+ })));
6992
+ }));
6965
6993
  };
6966
6994
  var PackageOptions_default = PackageOptions;
6967
6995
 
@@ -7050,14 +7078,14 @@ var arr = [];
7050
7078
  var GetOpeningHours = (o) => KeyOrder.reduce((prev, current) => {
7051
7079
  const title = TranslateWeekDays(current);
7052
7080
  const item = o[current];
7053
- const previous = prev?.[prev.length - 1];
7054
- if (previous && previous.from == item?.from && previous.until === item?.until) {
7081
+ const previous = prev == null ? void 0 : prev[prev.length - 1];
7082
+ if (previous && previous.from == (item == null ? void 0 : item.from) && previous.until === (item == null ? void 0 : item.until)) {
7055
7083
  prev[prev.length - 1].titleTo = title;
7056
7084
  } else {
7057
7085
  prev.push({
7058
7086
  titleFrom: title,
7059
- from: item?.from,
7060
- until: item?.until
7087
+ from: item == null ? void 0 : item.from,
7088
+ until: item == null ? void 0 : item.until
7061
7089
  });
7062
7090
  }
7063
7091
  return prev;
@@ -7068,8 +7096,8 @@ var GetOpeningHoursToday = (o) => {
7068
7096
  const current = o[day];
7069
7097
  return {
7070
7098
  title: current ? "\xD6ppetider idag" : "St\xE4ngt idag",
7071
- from: current?.from,
7072
- until: current?.until
7099
+ from: current == null ? void 0 : current.from,
7100
+ until: current == null ? void 0 : current.until
7073
7101
  };
7074
7102
  };
7075
7103
  var valuOfDateString = (s) => {
@@ -7083,7 +7111,7 @@ var OpeningHours = ({ openingHours }) => {
7083
7111
  );
7084
7112
  const currentlyOpen = useMemo4(() => {
7085
7113
  try {
7086
- if (today?.from && today?.until) {
7114
+ if ((today == null ? void 0 : today.from) && (today == null ? void 0 : today.until)) {
7087
7115
  const currentDate = new Date().valueOf();
7088
7116
  const from = valuOfDateString(today.from);
7089
7117
  const until = valuOfDateString(today.until);
@@ -7100,7 +7128,7 @@ var OpeningHours = ({ openingHours }) => {
7100
7128
  return /* @__PURE__ */ React87.createElement(React87.Fragment, null, /* @__PURE__ */ React87.createElement(RepeatSmall, null, /* @__PURE__ */ React87.createElement(Badge_default, {
7101
7129
  label: currentlyOpen ? "\xD6ppet" : "St\xE4ngt",
7102
7130
  severity: currentlyOpen ? "positive" : "negative"
7103
- })), /* @__PURE__ */ React87.createElement(RepeatSmall, null, /* @__PURE__ */ React87.createElement(TableColumn, null, /* @__PURE__ */ React87.createElement(TableColumnRow, null, /* @__PURE__ */ React87.createElement(TableColumnCell, null, /* @__PURE__ */ React87.createElement(UtilityTextBold, null, today?.title)), /* @__PURE__ */ React87.createElement(TableColumnCell, null, /* @__PURE__ */ React87.createElement(UtilityTextBold, null, today?.from ? `${today.from}-${today.until}` : "St\xE4ngt"))), oh.map((o) => /* @__PURE__ */ React87.createElement(TableColumnRow, {
7131
+ })), /* @__PURE__ */ React87.createElement(RepeatSmall, null, /* @__PURE__ */ React87.createElement(TableColumn, null, /* @__PURE__ */ React87.createElement(TableColumnRow, null, /* @__PURE__ */ React87.createElement(TableColumnCell, null, /* @__PURE__ */ React87.createElement(UtilityTextBold, null, today == null ? void 0 : today.title)), /* @__PURE__ */ React87.createElement(TableColumnCell, null, /* @__PURE__ */ React87.createElement(UtilityTextBold, null, (today == null ? void 0 : today.from) ? `${today.from}-${today.until}` : "St\xE4ngt"))), oh.map((o) => /* @__PURE__ */ React87.createElement(TableColumnRow, {
7104
7132
  key: o.titleFrom
7105
7133
  }, /* @__PURE__ */ React87.createElement(TableColumnCell, null, o.titleTo ? `${o.titleFrom}-${o.titleTo}` : o.titleFrom), /* @__PURE__ */ React87.createElement(TableColumnCell, null, o.from ? `${o.from}-${o.until}` : "St\xE4ngt"))))));
7106
7134
  };
@@ -7201,6 +7229,7 @@ var Map_default = StaticMap;
7201
7229
 
7202
7230
  // src/layouts/searchItem/Branch.tsx
7203
7231
  var Branch2 = ({ branch, loading }) => {
7232
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
7204
7233
  const [modal, setModal] = useState31(false);
7205
7234
  const openModal = useCallback35(() => setModal(true), []);
7206
7235
  const closeModal = useCallback35(() => setModal(false), []);
@@ -7214,20 +7243,20 @@ var Branch2 = ({ branch, loading }) => {
7214
7243
  }
7215
7244
  return /* @__PURE__ */ React90.createElement(React90.Fragment, null, modal && /* @__PURE__ */ React90.createElement(BranchModal_default, {
7216
7245
  loading,
7217
- connections: branch?.connections,
7246
+ connections: branch == null ? void 0 : branch.connections,
7218
7247
  onClose: closeModal
7219
7248
  }), /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(H2, {
7220
7249
  noMargin: true
7221
- }, branch?.location?.city ? `Den h\xE4r bilen finns p\xE5 v\xE5r anl\xE4ggning i ${branch?.location?.city}` : "Kontakt")), /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(Map_default, {
7222
- position: branch?.location?.position
7223
- })), (branch?.connections?.length || 0) > 1 && /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(Content_default, null, /* @__PURE__ */ React90.createElement("p", null, "Denna bil tillh\xF6r ett centrallager och g\xE5r att k\xF6pa genom flera anl\xE4ggningar.", " ", /* @__PURE__ */ React90.createElement(ButtonInline, {
7250
+ }, ((_a = branch == null ? void 0 : branch.location) == null ? void 0 : _a.city) ? `Den h\xE4r bilen finns p\xE5 v\xE5r anl\xE4ggning i ${(_b = branch == null ? void 0 : branch.location) == null ? void 0 : _b.city}` : "Kontakt")), /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(Map_default, {
7251
+ position: (_c = branch == null ? void 0 : branch.location) == null ? void 0 : _c.position
7252
+ })), (((_d = branch == null ? void 0 : branch.connections) == null ? void 0 : _d.length) || 0) > 1 && /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(Content_default, null, /* @__PURE__ */ React90.createElement("p", null, "Denna bil tillh\xF6r ett centrallager och g\xE5r att k\xF6pa genom flera anl\xE4ggningar.", " ", /* @__PURE__ */ React90.createElement(ButtonInline, {
7224
7253
  as: "span",
7225
7254
  role: "button",
7226
7255
  onClick: openModal,
7227
7256
  inline: true
7228
- }, "Klicka h\xE4r f\xF6r att visa kontaktuppgifter till en annan anl\xE4ggning"), "."))), /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(ProductPageContentLimit, null, /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(TableColumn, null, branch?.location?.streetAddress && branch?.location?.city && /* @__PURE__ */ React90.createElement(TableColumnRow, null, /* @__PURE__ */ React90.createElement(TableColumnCell, null, "Adress"), /* @__PURE__ */ React90.createElement(TableColumnCell, null, /* @__PURE__ */ React90.createElement(ButtonInlineBold, null, /* @__PURE__ */ React90.createElement(ButtonContent, null, `${branch?.location?.streetAddress}, ${branch?.location?.city}`)))), branch?.contact?.phonenumber && /* @__PURE__ */ React90.createElement(PhoneNumber_default, {
7257
+ }, "Klicka h\xE4r f\xF6r att visa kontaktuppgifter till en annan anl\xE4ggning"), "."))), /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(ProductPageContentLimit, null, /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(TableColumn, null, ((_e = branch == null ? void 0 : branch.location) == null ? void 0 : _e.streetAddress) && ((_f = branch == null ? void 0 : branch.location) == null ? void 0 : _f.city) && /* @__PURE__ */ React90.createElement(TableColumnRow, null, /* @__PURE__ */ React90.createElement(TableColumnCell, null, "Adress"), /* @__PURE__ */ React90.createElement(TableColumnCell, null, /* @__PURE__ */ React90.createElement(ButtonInlineBold, null, /* @__PURE__ */ React90.createElement(ButtonContent, null, `${(_g = branch == null ? void 0 : branch.location) == null ? void 0 : _g.streetAddress}, ${(_h = branch == null ? void 0 : branch.location) == null ? void 0 : _h.city}`)))), ((_i = branch == null ? void 0 : branch.contact) == null ? void 0 : _i.phonenumber) && /* @__PURE__ */ React90.createElement(PhoneNumber_default, {
7229
7258
  phoneNumber: formatPhonenumber(branch.contact.phonenumber)
7230
- }))), branch?.openingHours && /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(OpeningHours_default, {
7259
+ }))), (branch == null ? void 0 : branch.openingHours) && /* @__PURE__ */ React90.createElement(Repeat, null, /* @__PURE__ */ React90.createElement(OpeningHours_default, {
7231
7260
  openingHours: branch.openingHours
7232
7261
  })))));
7233
7262
  };
@@ -7367,15 +7396,16 @@ var useSearchItemBranch_default = useSearchItemBranch;
7367
7396
 
7368
7397
  // src/State/CentralStorage/useCentralStorage.ts
7369
7398
  var useCentralStorage = (vehicle) => {
7399
+ var _a, _b;
7370
7400
  const { centralStorageId, setCentralStorageId } = useContext6(CentralStorageContext);
7371
- const connections = vehicle?.branch?.connections;
7372
- const branchId = centralStorageId ? connections?.find((x) => x.id === centralStorageId)?.id : void 0;
7373
- const { data, loading } = useSearchItemBranch_default(vehicle?.id, branchId);
7401
+ const connections = (_a = vehicle == null ? void 0 : vehicle.branch) == null ? void 0 : _a.connections;
7402
+ const branchId = centralStorageId ? (_b = connections == null ? void 0 : connections.find((x) => x.id === centralStorageId)) == null ? void 0 : _b.id : void 0;
7403
+ const { data, loading } = useSearchItemBranch_default(vehicle == null ? void 0 : vehicle.id, branchId);
7374
7404
  useEffect17(() => {
7375
- if ((connections?.length || 0) > 0) {
7376
- const match = centralStorageId ? connections?.find((x) => x.id === centralStorageId) : void 0;
7405
+ if (((connections == null ? void 0 : connections.length) || 0) > 0) {
7406
+ const match = centralStorageId ? connections == null ? void 0 : connections.find((x) => x.id === centralStorageId) : void 0;
7377
7407
  if (!match) {
7378
- const first = connections?.[0];
7408
+ const first = connections == null ? void 0 : connections[0];
7379
7409
  if (first) {
7380
7410
  setCentralStorageId(first.id);
7381
7411
  }
@@ -7383,7 +7413,7 @@ var useCentralStorage = (vehicle) => {
7383
7413
  }
7384
7414
  }, [connections]);
7385
7415
  return {
7386
- vehicle: (connections?.length || 0) > 0 ? data?.vehicle : vehicle,
7416
+ vehicle: ((connections == null ? void 0 : connections.length) || 0) > 0 ? data == null ? void 0 : data.vehicle : vehicle,
7387
7417
  loading
7388
7418
  };
7389
7419
  };
@@ -7410,15 +7440,8 @@ import React95, { useCallback as useCallback37, useEffect as useEffect18, useMem
7410
7440
 
7411
7441
  // src/utils/vehicle-properties/property-tree-creator.ts
7412
7442
  var _PropertyTreeCreator = class {
7443
+ properties;
7413
7444
  constructor(properties) {
7414
- this.propertiesWithCategory = (propertyKey) => !!this.properties[propertyKey].category?.id;
7415
- this.propertiesWithoutCategory = (propertyKey) => !this.propertiesWithCategory(propertyKey);
7416
- this.isList = (property) => property.type === _PropertyTreeCreator.TEXT_LIST_TYPE;
7417
- this.isNonList = (property) => !this.isList(property);
7418
- this.hasCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.id === categoryId;
7419
- this.propertiesWithSubCategory = (propertyKey) => !!this.properties[propertyKey].category?.subCategory?.id;
7420
- this.propertiesWithoutSubCategory = (propertyKey) => !this.propertiesWithSubCategory(propertyKey);
7421
- this.hasSubCategoryWithId = (propertyKey, categoryId) => this.properties[propertyKey].category?.subCategory?.id === categoryId;
7422
7445
  this.properties = properties;
7423
7446
  }
7424
7447
  create() {
@@ -7441,6 +7464,13 @@ var _PropertyTreeCreator = class {
7441
7464
  const rootProperties = Object.keys(this.properties).filter(this.propertiesWithoutCategory).map((key) => this.properties[key]).filter(this.isNonList);
7442
7465
  return rootProperties;
7443
7466
  }
7467
+ propertiesWithCategory = (propertyKey) => {
7468
+ var _a;
7469
+ return !!((_a = this.properties[propertyKey].category) == null ? void 0 : _a.id);
7470
+ };
7471
+ propertiesWithoutCategory = (propertyKey) => !this.propertiesWithCategory(propertyKey);
7472
+ isList = (property) => property.type === _PropertyTreeCreator.TEXT_LIST_TYPE;
7473
+ isNonList = (property) => !this.isList(property);
7444
7474
  createTreeCategories() {
7445
7475
  const categories = this.getCategories();
7446
7476
  const treeCategories = this.convertToTreeCategories(categories);
@@ -7462,6 +7492,15 @@ var _PropertyTreeCreator = class {
7462
7492
  };
7463
7493
  });
7464
7494
  }
7495
+ hasCategoryWithId = (propertyKey, categoryId) => {
7496
+ var _a;
7497
+ return ((_a = this.properties[propertyKey].category) == null ? void 0 : _a.id) === categoryId;
7498
+ };
7499
+ propertiesWithSubCategory = (propertyKey) => {
7500
+ var _a, _b;
7501
+ return !!((_b = (_a = this.properties[propertyKey].category) == null ? void 0 : _a.subCategory) == null ? void 0 : _b.id);
7502
+ };
7503
+ propertiesWithoutSubCategory = (propertyKey) => !this.propertiesWithSubCategory(propertyKey);
7465
7504
  createTreeSubCategories(categoryId) {
7466
7505
  const subCategories = this.getSubCategoriesOfCategory(categoryId);
7467
7506
  const convertedSubCategories = subCategories.map((subCategory) => this.convertSubCategory(subCategory)).filter((category) => category.properties.length > 0);
@@ -7470,7 +7509,10 @@ var _PropertyTreeCreator = class {
7470
7509
  return treeCategories;
7471
7510
  }
7472
7511
  getSubCategoriesOfCategory(id) {
7473
- const categories = Object.keys(this.properties).filter((key) => this.hasCategoryWithId(key, id)).filter(this.propertiesWithSubCategory).map((key) => this.properties[key].category?.subCategory).filter(_PropertyTreeCreator.distinctCategories);
7512
+ const categories = Object.keys(this.properties).filter((key) => this.hasCategoryWithId(key, id)).filter(this.propertiesWithSubCategory).map((key) => {
7513
+ var _a;
7514
+ return (_a = this.properties[key].category) == null ? void 0 : _a.subCategory;
7515
+ }).filter(_PropertyTreeCreator.distinctCategories);
7474
7516
  return categories;
7475
7517
  }
7476
7518
  convertSubCategory(subCategory) {
@@ -7482,6 +7524,10 @@ var _PropertyTreeCreator = class {
7482
7524
  subCategories: []
7483
7525
  };
7484
7526
  }
7527
+ hasSubCategoryWithId = (propertyKey, categoryId) => {
7528
+ var _a, _b;
7529
+ return ((_b = (_a = this.properties[propertyKey].category) == null ? void 0 : _a.subCategory) == null ? void 0 : _b.id) === categoryId;
7530
+ };
7485
7531
  createListSubCategories(categoryId) {
7486
7532
  const listProperties = Object.keys(this.properties).filter((key) => this.hasCategoryWithId(key, categoryId)).map((key) => this.properties[key]).filter(this.isList).filter((prop) => prop.value.length > 0);
7487
7533
  const createdSubCategories = listProperties.map((property, index) => ({
@@ -7505,14 +7551,14 @@ var _PropertyTreeCreator = class {
7505
7551
  }
7506
7552
  };
7507
7553
  var PropertyTreeCreator = _PropertyTreeCreator;
7508
- PropertyTreeCreator.distinctCategories = (category, index, self) => {
7554
+ __publicField(PropertyTreeCreator, "distinctCategories", (category, index, self) => {
7509
7555
  const firstOccuranceOfId = self.find((value) => value.id === category.id);
7510
7556
  return !!firstOccuranceOfId && self.indexOf(firstOccuranceOfId) === index;
7511
- };
7512
- PropertyTreeCreator.DEFAULT_CATEGORY_NAME = "Okategoriserat";
7513
- PropertyTreeCreator.DEFAULT_CATEGORY_ID = 0;
7514
- PropertyTreeCreator.TEXT_LIST_TYPE = "text-list";
7515
- PropertyTreeCreator.LIST_CATEGORY_START_ID = 1e5;
7557
+ });
7558
+ __publicField(PropertyTreeCreator, "DEFAULT_CATEGORY_NAME", "Okategoriserat");
7559
+ __publicField(PropertyTreeCreator, "DEFAULT_CATEGORY_ID", 0);
7560
+ __publicField(PropertyTreeCreator, "TEXT_LIST_TYPE", "text-list");
7561
+ __publicField(PropertyTreeCreator, "LIST_CATEGORY_START_ID", 1e5);
7516
7562
  var property_tree_creator_default = PropertyTreeCreator;
7517
7563
 
7518
7564
  // src/utils/vehicle-properties/compare-categories.ts
@@ -7806,14 +7852,12 @@ var ENGINE_SUBCATEGORY = Object.freeze({
7806
7852
  }
7807
7853
  });
7808
7854
  var PropertyBuilder = class {
7809
- constructor() {
7810
- this.name = "";
7811
- this.value = "";
7812
- this.type = "unknown";
7813
- this.unit = null;
7814
- this.hint = null;
7815
- this.category = null;
7816
- }
7855
+ name = "";
7856
+ value = "";
7857
+ type = "unknown";
7858
+ unit = null;
7859
+ hint = null;
7860
+ category = null;
7817
7861
  withName(name) {
7818
7862
  this.name = name;
7819
7863
  return this;
@@ -8075,6 +8119,7 @@ var MetadataCategory = ({ properties, subCategories }) => /* @__PURE__ */ React9
8075
8119
  key: `${subCategory.name}-${index}`
8076
8120
  })));
8077
8121
  var PropertySet = ({ propertySet, vehicleData }) => {
8122
+ var _a, _b;
8078
8123
  const [activeCategoryId, setActiveCategoryId] = useState33(-1);
8079
8124
  const mappedProperties = useMemo5(() => {
8080
8125
  if (!propertySet) {
@@ -8088,20 +8133,21 @@ var PropertySet = ({ propertySet, vehicleData }) => {
8088
8133
  return tree;
8089
8134
  }, [propertySet]);
8090
8135
  useEffect18(() => {
8091
- const categories = mappedProperties?.categories?.length !== void 0 ? mappedProperties?.categories : void 0;
8136
+ var _a2;
8137
+ const categories = ((_a2 = mappedProperties == null ? void 0 : mappedProperties.categories) == null ? void 0 : _a2.length) !== void 0 ? mappedProperties == null ? void 0 : mappedProperties.categories : void 0;
8092
8138
  if (activeCategoryId < 0 && categories !== void 0 && categories.length > 0) {
8093
8139
  setActiveCategoryId(categories[0].id);
8094
8140
  }
8095
8141
  }, [mappedProperties]);
8096
8142
  const onTab = useCallback37((id) => setActiveCategoryId(parseInt(id, 10)), []);
8097
- const activeCategory = mappedProperties?.categories?.find(
8143
+ const activeCategory = (_a = mappedProperties == null ? void 0 : mappedProperties.categories) == null ? void 0 : _a.find(
8098
8144
  (category) => category.id === activeCategoryId
8099
8145
  );
8100
8146
  return /* @__PURE__ */ React95.createElement(React95.Fragment, null, /* @__PURE__ */ React95.createElement(Repeat, null, /* @__PURE__ */ React95.createElement(Tabs_default, {
8101
- tabs: mappedProperties?.categories?.map((category) => ({
8147
+ tabs: ((_b = mappedProperties == null ? void 0 : mappedProperties.categories) == null ? void 0 : _b.map((category) => ({
8102
8148
  name: `${category.id}`,
8103
8149
  displayName: category.name
8104
- })) || [],
8150
+ }))) || [],
8105
8151
  active: `${activeCategoryId}`,
8106
8152
  onClick: onTab
8107
8153
  })), activeCategory && /* @__PURE__ */ React95.createElement(Repeat, null, /* @__PURE__ */ React95.createElement(MetadataCategory, {
@@ -8192,10 +8238,11 @@ var WaykeSearchItem = ({
8192
8238
  modifyDocumentTitleItem,
8193
8239
  onClickSearchItem
8194
8240
  }) => {
8241
+ var _a, _b, _c;
8195
8242
  const { ecomSettings } = useSettings_default();
8196
8243
  const ecomContext = useRef4();
8197
8244
  const { loading, data: result } = useSearchItem_default(id);
8198
- const { vehicle: centralStorageVehicle, loading: loadingCentralStorageVehicle } = useCentralStorage_default(result?.vehicle);
8245
+ const { vehicle: centralStorageVehicle, loading: loadingCentralStorageVehicle } = useCentralStorage_default(result == null ? void 0 : result.vehicle);
8199
8246
  useEffect19(() => {
8200
8247
  if (ecomSettings) {
8201
8248
  ecomContext.current = new WaykeEcomWeb({
@@ -8204,7 +8251,7 @@ var WaykeSearchItem = ({
8204
8251
  api: {
8205
8252
  address: ecomSettings.url
8206
8253
  },
8207
- bankIdThumbprint: ecomSettings?.bankIdThumbprint
8254
+ bankIdThumbprint: ecomSettings == null ? void 0 : ecomSettings.bankIdThumbprint
8208
8255
  },
8209
8256
  logo: ecomSettings.serviceLogotypeUrl,
8210
8257
  logoX2: ecomSettings.serviceLogotypeUrl,
@@ -8225,26 +8272,30 @@ var WaykeSearchItem = ({
8225
8272
  }
8226
8273
  }, []);
8227
8274
  useEffect19(() => {
8228
- if (result?.vehicle?.data && modifyDocumentTitleItem) {
8275
+ var _a2;
8276
+ if (((_a2 = result == null ? void 0 : result.vehicle) == null ? void 0 : _a2.data) && modifyDocumentTitleItem) {
8229
8277
  const { vehicle: vehicle2 } = result;
8230
8278
  const { registrationNumber } = vehicle2.data;
8231
8279
  document.title = `${registrationNumber} | ${vehicle2.title} | ${vehicle2.shortDescription}`;
8232
8280
  }
8233
8281
  }, [result]);
8234
8282
  const options = useMemo6(
8235
- () => result?.vehicle?.data?.options?.filter(notEmpty).map((opt) => ({ title: opt })),
8236
- [result?.vehicle?.data?.options]
8283
+ () => {
8284
+ var _a2, _b2, _c2;
8285
+ return (_c2 = (_b2 = (_a2 = result == null ? void 0 : result.vehicle) == null ? void 0 : _a2.data) == null ? void 0 : _b2.options) == null ? void 0 : _c2.filter(notEmpty).map((opt) => ({ title: opt }));
8286
+ },
8287
+ [(_b = (_a = result == null ? void 0 : result.vehicle) == null ? void 0 : _a.data) == null ? void 0 : _b.options]
8237
8288
  );
8238
8289
  const onShowMoreOptionsClick = useCallback38(() => pubsub_default.publish("OptionsClick"), []);
8239
8290
  if (loading) {
8240
8291
  return /* @__PURE__ */ React97.createElement(PageLoading_default, null);
8241
8292
  }
8242
- if (!result?.vehicle?.data) {
8293
+ if (!((_c = result == null ? void 0 : result.vehicle) == null ? void 0 : _c.data)) {
8243
8294
  return /* @__PURE__ */ React97.createElement(Page404_default, null);
8244
8295
  }
8245
8296
  const { vehicle } = result;
8246
- const contact = centralStorageVehicle?.contact;
8247
- const branch = centralStorageVehicle?.branch;
8297
+ const contact = centralStorageVehicle == null ? void 0 : centralStorageVehicle.contact;
8298
+ const branch = centralStorageVehicle == null ? void 0 : centralStorageVehicle.branch;
8248
8299
  const {
8249
8300
  title,
8250
8301
  shortDescription,
@@ -8258,7 +8309,7 @@ var WaykeSearchItem = ({
8258
8309
  publishedAt,
8259
8310
  documents
8260
8311
  } = vehicle;
8261
- const insuranceOptions = centralStorageVehicle?.insuranceOptions ? centralStorageVehicle.insuranceOptions : vehicle.insuranceOptions;
8312
+ const insuranceOptions = (centralStorageVehicle == null ? void 0 : centralStorageVehicle.insuranceOptions) ? centralStorageVehicle.insuranceOptions : vehicle.insuranceOptions;
8262
8313
  const { fuelType, mileage, gearbox, modelYear, propertySet } = vehicle.data;
8263
8314
  const uspList = [
8264
8315
  {
@@ -8284,7 +8335,7 @@ var WaykeSearchItem = ({
8284
8335
  title: "Tillbaka till bils\xF6k"
8285
8336
  }, /* @__PURE__ */ React97.createElement(ButtonContent, null, /* @__PURE__ */ React97.createElement(IconChevronLeft, {
8286
8337
  block: true
8287
- })), /* @__PURE__ */ React97.createElement(ButtonContent, null, "Tillbaka till bils\xF6k")))) : null, manufacturer?.logotype && /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(LogoBox_default, {
8338
+ })), /* @__PURE__ */ React97.createElement(ButtonContent, null, "Tillbaka till bils\xF6k")))) : null, (manufacturer == null ? void 0 : manufacturer.logotype) && /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(LogoBox_default, {
8288
8339
  logo: manufacturer.logotype,
8289
8340
  alt: manufacturer.name
8290
8341
  })), /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(RepeatSmall, null, /* @__PURE__ */ React97.createElement(H1, {
@@ -8303,7 +8354,7 @@ var WaykeSearchItem = ({
8303
8354
  financialOptions
8304
8355
  }), insuranceOptions.length > 0 && /* @__PURE__ */ React97.createElement(InsuranceOptions_default, {
8305
8356
  id,
8306
- branch: centralStorageVehicle?.branch,
8357
+ branch: centralStorageVehicle == null ? void 0 : centralStorageVehicle.branch,
8307
8358
  insuranceOptions
8308
8359
  })), /* @__PURE__ */ React97.createElement(ProductPageAsideSection, {
8309
8360
  mobileOrder: 5
@@ -8312,9 +8363,12 @@ var WaykeSearchItem = ({
8312
8363
  packageOptions,
8313
8364
  ecommerce,
8314
8365
  branch,
8315
- contact: centralStorageVehicle?.contact,
8366
+ contact: centralStorageVehicle == null ? void 0 : centralStorageVehicle.contact,
8316
8367
  loadingCentralStorageVehicle,
8317
- toggleEcomModal: () => ecomContext.current?.start()
8368
+ toggleEcomModal: () => {
8369
+ var _a2;
8370
+ return (_a2 = ecomContext.current) == null ? void 0 : _a2.start();
8371
+ }
8318
8372
  }))), /* @__PURE__ */ React97.createElement(ProductPageMain, null, /* @__PURE__ */ React97.createElement(ProductPageAsideSection, {
8319
8373
  mobileOrder: 3
8320
8374
  }, /* @__PURE__ */ React97.createElement(Gallery_default, {
@@ -8328,8 +8382,8 @@ var WaykeSearchItem = ({
8328
8382
  }))), description && /* @__PURE__ */ React97.createElement(ProductPageMainSection, null, /* @__PURE__ */ React97.createElement(Blockquote_default, {
8329
8383
  author: contact && contact.name ? contact.name : null,
8330
8384
  date: publishedAt ? dateTimeFormat.format(publishedAt, dateTimeFormat.DayMonth) : void 0,
8331
- avatar: contact?.avatar || void 0
8332
- }, !!description && /* @__PURE__ */ React97.createElement("p", null, description))), (options?.length || 0) > 0 && /* @__PURE__ */ React97.createElement(ProductPageMainSection, null, /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(H2, {
8385
+ avatar: (contact == null ? void 0 : contact.avatar) || void 0
8386
+ }, !!description && /* @__PURE__ */ React97.createElement("p", null, description))), ((options == null ? void 0 : options.length) || 0) > 0 && /* @__PURE__ */ React97.createElement(ProductPageMainSection, null, /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(H2, {
8333
8387
  noMargin: true
8334
8388
  }, "Utrustning")), /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(Content_default, null, /* @__PURE__ */ React97.createElement("p", null, "Kompletterande uppgifter om bilen."))), /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(ExtendContent_default, {
8335
8389
  actionTitle: "Visa mer",
@@ -8346,11 +8400,14 @@ var WaykeSearchItem = ({
8346
8400
  }), ecommerce && ecommerce.enabled && /* @__PURE__ */ React97.createElement(Repeat, null, /* @__PURE__ */ React97.createElement(ButtonPrimary, {
8347
8401
  disabled: !!ecommerce.reserved,
8348
8402
  title: "K\xF6p bilen online",
8349
- onClick: () => ecomContext.current?.start()
8403
+ onClick: () => {
8404
+ var _a2;
8405
+ return (_a2 = ecomContext.current) == null ? void 0 : _a2.start();
8406
+ }
8350
8407
  }, "K\xF6p bilen online"))), /* @__PURE__ */ React97.createElement(PackageOptions_default, {
8351
8408
  packageOptions
8352
8409
  }), /* @__PURE__ */ React97.createElement(ManufacturerPackagesOption_default, {
8353
- packageOption: manufacturer?.packageOption
8410
+ packageOption: manufacturer == null ? void 0 : manufacturer.packageOption
8354
8411
  }))))), /* @__PURE__ */ React97.createElement(Related_default, {
8355
8412
  id,
8356
8413
  hashRoute,
@@ -8520,7 +8577,7 @@ var SettingsProvider_default = SettingsProvider;
8520
8577
  import React103, { useState as useState35, useCallback as useCallback39 } from "react";
8521
8578
  var RelatedSearchProvider = ({ url, urlMlt, apiKey, children }) => {
8522
8579
  const [queryFilter, setQueryFilter] = useState35();
8523
- const query = queryFilter?.searchParams.toString();
8580
+ const query = queryFilter == null ? void 0 : queryFilter.searchParams.toString();
8524
8581
  const {
8525
8582
  loading,
8526
8583
  data: response,
@@ -8659,7 +8716,10 @@ var PathProvider = ({ children }) => {
8659
8716
  }
8660
8717
  dispatch({ type: SET_PATH, path });
8661
8718
  }, []);
8662
- const id = useMemo7(() => state.path.match(regexGuidAnyWhere)?.pop(), [state.path]);
8719
+ const id = useMemo7(() => {
8720
+ var _a;
8721
+ return (_a = state.path.match(regexGuidAnyWhere)) == null ? void 0 : _a.pop();
8722
+ }, [state.path]);
8663
8723
  const value = useMemo7(
8664
8724
  () => ({
8665
8725
  ...state,
@@ -8738,7 +8798,7 @@ var SearchProvider = ({
8738
8798
  "x-api-key": apiKey
8739
8799
  } : {}
8740
8800
  },
8741
- !initialize || !!queryFilter?.block
8801
+ !initialize || !!(queryFilter == null ? void 0 : queryFilter.block)
8742
8802
  );
8743
8803
  const popStateEvent = (event) => {
8744
8804
  const { currentTarget } = event;
@@ -8782,7 +8842,7 @@ var SearchProvider = ({
8782
8842
  const nextSearch = nextSearchParams.toString() ? `?${nextSearchParams}` : "";
8783
8843
  if (initialize) {
8784
8844
  if (window.location.search.localeCompare(nextSearch) !== 0) {
8785
- const _path = pathRoute?.replace(/^\/|\/$/g, "");
8845
+ const _path = pathRoute == null ? void 0 : pathRoute.replace(/^\/|\/$/g, "");
8786
8846
  const prefix = _path ? `/${_path}/` : "/";
8787
8847
  const index = _path ? window.location.pathname.indexOf(prefix) : -1;
8788
8848
  let pathname = window.location.pathname;
@@ -8795,11 +8855,12 @@ var SearchProvider = ({
8795
8855
  }
8796
8856
  }, [queryFilter, initialize, useQueryParamsFromUrl]);
8797
8857
  useEffect24(() => {
8858
+ var _a;
8798
8859
  if (response) {
8799
8860
  if (!initialFacets && !useQueryParamsFromUrl) {
8800
8861
  setInitialFacets(response.facets);
8801
8862
  }
8802
- if (useQueryParamsFromUrl && response.query?.parameters) {
8863
+ if (useQueryParamsFromUrl && ((_a = response.query) == null ? void 0 : _a.parameters)) {
8803
8864
  const nextSearchParams = new URLSearchParams(response.query.parameters);
8804
8865
  nextSearchParams.delete("hits");
8805
8866
  nextSearchParams.delete("offset");
@@ -8812,7 +8873,7 @@ var SearchProvider = ({
8812
8873
  });
8813
8874
  }
8814
8875
  }
8815
- if (queryFilter?.concatResult) {
8876
+ if (queryFilter == null ? void 0 : queryFilter.concatResult) {
8816
8877
  setDocuments([...documents || [], ...response.documentList.documents || []]);
8817
8878
  } else {
8818
8879
  setDocuments(response.documentList.documents || []);
@@ -8833,9 +8894,10 @@ var SearchProvider = ({
8833
8894
  [initialize]
8834
8895
  );
8835
8896
  const onLoadMore = useCallback43(() => {
8897
+ var _a;
8836
8898
  if (response) {
8837
8899
  setQueryFilter({
8838
- searchParams: new URLSearchParams(response?.documentList.pagination.nextPage?.query),
8900
+ searchParams: new URLSearchParams((_a = response == null ? void 0 : response.documentList.pagination.nextPage) == null ? void 0 : _a.query),
8839
8901
  concatResult: true
8840
8902
  });
8841
8903
  }
@@ -8847,8 +8909,9 @@ var SearchProvider = ({
8847
8909
  const initialQueryParams = useQueryParamsFromUrl ? searchParamsFromUrl : _initialQueryParams;
8848
8910
  if (useQueryParamsFromUrl && _initialQueryParams) {
8849
8911
  _initialQueryParams.forEach((value2, key) => {
8850
- if (!initialQueryParams?.getAll(key)?.some((v) => v === value2)) {
8851
- initialQueryParams?.append(key, value2);
8912
+ var _a;
8913
+ if (!((_a = initialQueryParams == null ? void 0 : initialQueryParams.getAll(key)) == null ? void 0 : _a.some((v) => v === value2))) {
8914
+ initialQueryParams == null ? void 0 : initialQueryParams.append(key, value2);
8852
8915
  }
8853
8916
  });
8854
8917
  }