@depict-ai/utilishared 2.1.7 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/latest/index.js CHANGED
@@ -1,19 +1,11 @@
1
1
  import { onCleanup as $qgKv4$onCleanup, createEffect as $qgKv4$createEffect, createSignal as $qgKv4$createSignal } from "solid-js";
2
- import { template as $qgKv4$template, getNextElement as $qgKv4$getNextElement, insert as $qgKv4$insert, className as $qgKv4$className, setAttribute as $qgKv4$setAttribute, spread as $qgKv4$spread, mergeProps as $qgKv4$mergeProps, runHydrationEvents as $qgKv4$runHydrationEvents, addEventListener as $qgKv4$addEventListener, getNextMarker as $qgKv4$getNextMarker, delegateEvents as $qgKv4$delegateEvents, effect as $qgKv4$effect, style as $qgKv4$style, createComponent as $qgKv4$createComponent } from "solid-js/web";
2
+ import { template as $qgKv4$template, getNextElement as $qgKv4$getNextElement, className as $qgKv4$className, insert as $qgKv4$insert, setAttribute as $qgKv4$setAttribute, spread as $qgKv4$spread, mergeProps as $qgKv4$mergeProps, runHydrationEvents as $qgKv4$runHydrationEvents, addEventListener as $qgKv4$addEventListener, getNextMarker as $qgKv4$getNextMarker, delegateEvents as $qgKv4$delegateEvents, effect as $qgKv4$effect, style as $qgKv4$style, createComponent as $qgKv4$createComponent } from "solid-js/web";
3
3
  import { register_es_version } from "../multi_import_deduplicator.mjs";
4
4
  register_es_version("utilishared", "latest");
5
- function $parcel$export(e, n, v, s) {
6
- Object.defineProperty(e, n, {
7
- get: v,
8
- set: s,
9
- enumerable: true,
10
- configurable: true
11
- });
12
- }
13
5
  function $parcel$interopDefault(a) {
14
6
  return a && a.__esModule ? a.default : a;
15
7
  }
16
- const $0766c85d387a9765$export$83d89fbfd8236492 = "2.1.7";
8
+ const $0766c85d387a9765$export$83d89fbfd8236492 = "2.3.0";
17
9
  const $571bce04eb920cd8$export$55fe61489d2c7417 = /*@__PURE__*/(() => process.env.STRIP_DEBUG === "true" ? false : process.env.DEBUG === "true" || process.env.NODE_ENV === "development" || process.env.BUILD_TARGET !== "node" && (globalThis?.document?.currentScript?.dataset?.debug === "true" || globalThis?.localStorage?.getItem?.("debug") === "true"))();
18
10
  const $649f456f663da9fc$var$browser_prefix_styling = "color: #fff;";
19
11
  let $649f456f663da9fc$var$browser_prefix = "[Depict]";
@@ -902,7 +894,7 @@ function $460df8550f9d084d$export$656831b7e9c341c3() {
902
894
  function $460df8550f9d084d$export$a6db784f019668ba() {
903
895
  return "x" + $460df8550f9d084d$export$656831b7e9c341c3().replaceAll(".", "");
904
896
  }
905
- const $6c2b49f3f564b0d1$export$362abebb4b313340 = process.env.BASE_URL || "https://api.depict.ai";
897
+ const $6c2b49f3f564b0d1$export$362abebb4b313340 = process.env.DEPICT_BASE_URL || "https://api.depict.ai";
906
898
  const $cafa1ff1049985c2$var$c = (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9);
907
899
  const $cafa1ff1049985c2$var$ws_instance = /*@__PURE__*/$cafa1ff1049985c2$var$c(() => new (0, $4ce764ddfee055ef$export$1d9c6fddbff3441f)("wss://ws.v2.depict.ai/ws/create-events"))();
908
900
  const $cafa1ff1049985c2$var$allowed_keys = ["tenant", "market", "type", "session_id", "product_id", "entity_identifiers", "url", "entity_price", "currency", "document_referrer", "document_width", "attribution_id", "recommendation_id", "click_location", "ab_test_group", "variant_ids", "transaction_id", "error_type", "detail", "recommendation_type", "search_result_id", "product_listing_result_id"];
@@ -1134,39 +1126,85 @@ function $b55a70757989faf4$export$16d7c76794a38a4(element, event, track_id, func
1134
1126
  }
1135
1127
  }
1136
1128
 
1137
- // @ts-nocheck
1138
-
1139
- const $39ef887981612535$var$needs_patching = typeof window === "object" ? /*@__PURE__*/$39ef887981612535$var$check_if_querySelectorAll_needs_patching() : false;
1140
- function $39ef887981612535$export$33f937d741e49339(element, selector) {
1141
- if (!(element instanceof Element) || !$39ef887981612535$var$needs_patching || !selector.includes("#") || !selector.includes("+"))
1142
- // covers most cases, we don't need patching or don't hit the bug
1143
- return element?.querySelectorAll?.(selector);
1144
- const result = [];
1145
- const elements_to_check = [];
1146
- // intentionally not recursive since it's possible to have deeper nested elements than max stack size
1147
- for (let i = element.children.length; i--;) elements_to_check.push(element.children[i]);
1148
- while (elements_to_check.length) {
1149
- const child_element = elements_to_check.pop();
1150
- if (child_element.matches(selector)) result.push(child_element);
1151
- for (let i = child_element.children.length; i--;)
1152
- // kudos to Karl for algorithm help
1153
- elements_to_check.push(child_element.children[i]);
1154
- }
1155
- return result;
1129
+ /**
1130
+ * @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
1131
+ */
1132
+ function $92b7ea2cf75c4aec$export$55621c1ce3cd536b() {
1133
+ // the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
1134
+ let internal_resolve; // copy and pasted from iconbeauty
1135
+ const cart_promise_object = {
1136
+ // I feel like Anton is not going to like this extremely awesome approach
1137
+ promise: new Promise(r => internal_resolve = r),
1138
+ // which is why I'm reluctant with making it a library
1139
+ internal_resolve: internal_resolve,
1140
+ // Edit from later on: I have realised that this is actually very useful, it just has a steep learning curve.
1141
+ resolve: argument => {
1142
+ // it allows both not having to call functions in a loop and instead just awaiting the promise from multiple places
1143
+ const oldresolve = cart_promise_object.internal_resolve; // and to effortlessly ensure a process is never running twice with 100% reliability
1144
+ cart_promise_object.promise = new Promise(r => cart_promise_object.internal_resolve = r); // it could be made a class, but I already know this works, so I'll leave it as is
1145
+ oldresolve(argument);
1146
+ }
1147
+ };
1148
+ return cart_promise_object;
1156
1149
  }
1157
- function $39ef887981612535$var$check_if_querySelectorAll_needs_patching() {
1158
- const id_div = document.createElement("div");
1159
- const element = document.createElement("section");
1160
- const selector = "#a+*";
1161
- id_div.id = "a";
1162
- document.documentElement.append(id_div, element);
1163
- try {
1164
- return element === element.querySelectorAll(selector)[0];
1165
- } finally {
1166
- id_div.remove();
1167
- element.remove();
1150
+ function $e867e2f1fb3bcc09$export$c7187bbd1a7a9244(...args) {
1151
+ $e867e2f1fb3bcc09$var$placeholder_worker(...args).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
1152
+ return args[0];
1153
+ }
1154
+ async function $e867e2f1fb3bcc09$var$placeholder_worker(placeholder_elements, final_elements, switching_trigger) {
1155
+ let state = false;
1156
+ let has_sanitized_elements = false;
1157
+ const sanit_el_if_needed = async () => {
1158
+ if (!has_sanitized_elements) {
1159
+ has_sanitized_elements = true;
1160
+ placeholder_elements = await $e867e2f1fb3bcc09$var$convert_to_node_array(placeholder_elements);
1161
+ final_elements = await $e867e2f1fb3bcc09$var$convert_to_node_array(final_elements);
1162
+ }
1163
+ };
1164
+ if (switching_trigger instanceof (0, $09ff985c7c424fb3$export$32ccf3a614c84258)) while (true) {
1165
+ const new_state = await switching_trigger.promise;
1166
+ if (new_state != state) {
1167
+ await sanit_el_if_needed();
1168
+ await $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
1169
+ state = new_state;
1170
+ }
1171
+ } else if (switching_trigger instanceof Promise) {
1172
+ const new_state = await switching_trigger;
1173
+ if (state != new_state) {
1174
+ await sanit_el_if_needed();
1175
+ await $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
1176
+ state = new_state;
1177
+ }
1178
+ } else {
1179
+ await sanit_el_if_needed();
1180
+ placeholder_elements[0].addEventListener("placeholder_switch", $511123bb28a7b6f7$export$535946eb77c946dd(async e => {
1181
+ const new_state = e.detail.state;
1182
+ if (state != new_state) {
1183
+ await sanit_el_if_needed();
1184
+ await $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
1185
+ state = new_state;
1186
+ }
1187
+ }));
1168
1188
  }
1169
1189
  }
1190
+ async function $e867e2f1fb3bcc09$var$convert_to_node_array(elements) {
1191
+ if (typeof elements == "function") elements = elements();
1192
+ elements = await elements;
1193
+ if (typeof elements[Symbol.iterator] != "function") elements = [elements];
1194
+ return elements;
1195
+ }
1196
+ async function $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, switch_to_final) {
1197
+ if (switch_to_final) $e867e2f1fb3bcc09$var$switch_elements(placeholder_elements, final_elements);else $e867e2f1fb3bcc09$var$switch_elements(final_elements, placeholder_elements);
1198
+ }
1199
+ function $e867e2f1fb3bcc09$var$switch_elements(from, to) {
1200
+ if (!from.length || !to.length) $649f456f663da9fc$export$c2363754d4758444("Cannot switch elements as from or to is empty", from, to);
1201
+ from[0].replaceWith(...to);
1202
+ for (let i = 1; i < from.length; i++) from[i].remove();
1203
+ }
1204
+
1205
+ // @ts-ignore
1206
+ var $413613e86d0ffb68$exports = {};
1207
+ $413613e86d0ffb68$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict-slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict-slider button.right {\n right: 0;\n}\n\n.depict-slider button.left, .depict-slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict-slider button.left.hidden, .depict-slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict-slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict-slider button.left img, .depict-slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict-slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
1170
1208
  let $8be08add28592faf$var$has_queued_microtask = false;
1171
1209
  const $8be08add28592faf$var$queued_callbacks = /*@__PURE__*/new Map();
1172
1210
  const $8be08add28592faf$var$catchified_deduplicate_and_dispatch = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9($8be08add28592faf$var$deduplicate_and_dispatch, "error in observer event processing", "error");
@@ -1225,6 +1263,37 @@ class $cb50cd7a49e824ee$export$ea60432919e69303 {
1225
1263
  opts.event_ && (this.event = opts.event_);
1226
1264
  }
1227
1265
  }
1266
+ const $39ef887981612535$var$needs_patching = typeof window === "object" ? /*@__PURE__*/$39ef887981612535$var$check_if_querySelectorAll_needs_patching() : false;
1267
+ function $39ef887981612535$export$33f937d741e49339(element, selector) {
1268
+ if (!(element instanceof Element) || !$39ef887981612535$var$needs_patching || !selector.includes("#") || !selector.includes("+"))
1269
+ // covers most cases, we don't need patching or don't hit the bug
1270
+ return element?.querySelectorAll?.(selector);
1271
+ const result = [];
1272
+ const elements_to_check = [];
1273
+ // intentionally not recursive since it's possible to have deeper nested elements than max stack size
1274
+ for (let i = element.children.length; i--;) elements_to_check.push(element.children[i]);
1275
+ while (elements_to_check.length) {
1276
+ const child_element = elements_to_check.pop();
1277
+ if (child_element.matches(selector)) result.push(child_element);
1278
+ for (let i = child_element.children.length; i--;)
1279
+ // kudos to Karl for algorithm help
1280
+ elements_to_check.push(child_element.children[i]);
1281
+ }
1282
+ return result;
1283
+ }
1284
+ function $39ef887981612535$var$check_if_querySelectorAll_needs_patching() {
1285
+ const id_div = document.createElement("div");
1286
+ const element = document.createElement("section");
1287
+ const selector = "#a+*";
1288
+ id_div.id = "a";
1289
+ document.documentElement.append(id_div, element);
1290
+ try {
1291
+ return element === element.querySelectorAll(selector)[0];
1292
+ } finally {
1293
+ id_div.remove();
1294
+ element.remove();
1295
+ }
1296
+ }
1228
1297
  class $cdca9fea6eb103e5$export$12e07a2a9f87578a {
1229
1298
  #the_mutation_observer;
1230
1299
  #observing = {};
@@ -1722,6 +1791,21 @@ function $0b48ba2f40ce6067$var$make_default_observer() {
1722
1791
  $b04e44fad5ea42c7$export$f18d5b0af29128b7([error, "error starting ElementObserver"], "error");
1723
1792
  }
1724
1793
  }
1794
+
1795
+ /**
1796
+ * Useful for the `thresholds` option of IntersectionObserver - if you want to be notified at a 10% change, call this and set num_steps to 10. Pls see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
1797
+ * @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
1798
+ * @return Stuff to give to IntersectionObserver
1799
+ */
1800
+ function $9ab9ecb74920f343$export$f8ea2e7b15b5d129(numSteps) {
1801
+ const thresholds = [];
1802
+ for (let i = 1.0; i <= numSteps; i++) {
1803
+ const ratio = i / numSteps;
1804
+ thresholds.push(ratio);
1805
+ }
1806
+ thresholds.push(0);
1807
+ return thresholds;
1808
+ }
1725
1809
  function $0bdb8dbcf1bc7f34$export$925772df9b4d16e5(url, param, value) {
1726
1810
  const url_object = new URL(url),
1727
1811
  search_params = new URLSearchParams(url_object.search);
@@ -1818,1794 +1902,97 @@ function $0bdb8dbcf1bc7f34$export$9590700a594aef08(obj, step1, ...path) {
1818
1902
  if (typeof obj[step1] === "undefined") obj[step1] = {};
1819
1903
  if (path.length) return $0bdb8dbcf1bc7f34$export$9590700a594aef08(obj[step1], ...path);else return obj[step1];
1820
1904
  }
1821
-
1822
- // https://stackoverflow.com/a/39941616
1823
- function $bb3252f70898acd6$var$invert_promise(promise) {
1824
- return new Promise((res, rej) => promise.then(rej, res));
1825
- }
1826
- function $bb3252f70898acd6$export$947a20746936143d(promises) {
1827
- return Promise?.any?.(promises) ?? $bb3252f70898acd6$var$invert_promise(Promise.all([...promises].map($bb3252f70898acd6$var$invert_promise)));
1828
- }
1829
- async function $61b3c9e5f2cf8171$export$836f70a28c317905(product_id) {
1830
- if (typeof BroadcastChannel != "function") return;
1831
- const bc = new BroadcastChannel("right_click_attribution");
1832
- $649f456f663da9fc$export$de56f1198d121036("Broadcasting", product_id, "to", bc);
1833
- bc.postMessage(product_id);
1834
- bc.close();
1835
- }
1836
- function $61b3c9e5f2cf8171$export$58c56fe2313fdbe3(elements, display, info, get_event_listener_remover) {
1837
- if (typeof BroadcastChannel != "function") return elements;
1838
- const disconnectors = [];
1839
- const handler = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, ("variant_index" in display ? display.variant_displays[display.variant_index] : display).product_id));
1840
- const auxclick_handler = e => e.button === 1 && handler(e);
1841
- for (let i = 0; i < elements?.length; i++) {
1842
- const element = elements[i];
1843
- element.addEventListener("contextmenu", handler);
1844
- element.addEventListener("auxclick", auxclick_handler); // actual wheel click - some mouses / OS:es also dispatch auxclick on rightclick
1845
- if (get_event_listener_remover) disconnectors.push(() => {
1846
- element.removeEventListener("contextmenu", handler);
1847
- element.removeEventListener("auxclick", auxclick_handler);
1848
- });
1849
- }
1850
- get_event_listener_remover?.(() => disconnectors.forEach(disconnector => disconnector()));
1851
- return elements;
1852
- }
1853
- async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
1854
- $649f456f663da9fc$export$de56f1198d121036("Contextmenu was invoked", e);
1855
- const element = e.currentTarget || e.target;
1856
- const bc = new BroadcastChannel("right_click_attribution");
1857
- const got_wanted_event = await $bb3252f70898acd6$export$947a20746936143d([new Promise(resolve => {
1858
- bc.addEventListener("message", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(msg => {
1859
- const {
1860
- data: data
1861
- } = msg;
1862
- $649f456f663da9fc$export$de56f1198d121036("Recieved broadcast channel event", data, msg);
1863
- if (data == product_id) resolve(true);
1864
- }));
1865
- }), new Promise(r => setTimeout(r, 60000, false))]);
1866
- if (got_wanted_event) {
1867
- const click = new MouseEvent("click", {
1868
- view: window,
1869
- bubbles: true,
1870
- cancelable: true,
1871
- metaKey: true
1872
- });
1873
- $649f456f663da9fc$export$de56f1198d121036("Someone broadcasted our product_id! Simulating a click event on the element that was contextmenu'd", element, click);
1874
- element.addEventListener("click", e => (e.preventDefault(), false), {
1875
- once: true
1876
- });
1877
- element.dispatchEvent(click);
1878
- } else $649f456f663da9fc$export$de56f1198d121036("Our product_id did not get broadcasted, closing channel");
1879
- bc.close();
1880
- }
1881
-
1882
- /**
1883
- * Useful for the `thresholds` option of IntersectionObserver - if you want to be notified at a 10% change, call this and set num_steps to 10. Pls see https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserver/thresholds
1884
- * @param numSteps How many steps (notifications) there should be between 0 and 100% intersection
1885
- * @return Stuff to give to IntersectionObserver
1886
- */
1887
- function $9ab9ecb74920f343$export$f8ea2e7b15b5d129(numSteps) {
1888
- const thresholds = [];
1889
- for (let i = 1.0; i <= numSteps; i++) {
1890
- const ratio = i / numSteps;
1891
- thresholds.push(ratio);
1892
- }
1893
- thresholds.push(0);
1894
- return thresholds;
1895
- }
1896
-
1897
- /**
1898
- * Elements currently intersecting with the viewport.
1899
- * If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
1900
- */
1901
- const $f24c14db771b471d$var$current_intersections = /*@__PURE__*/new WeakMap();
1902
- /**
1903
- * Currently watched elements by the intersection observer with their respective callback
1904
- * */
1905
- const $f24c14db771b471d$var$watched_elements = /*@__PURE__*/new WeakMap();
1906
- const $f24c14db771b471d$var$unwatch_element = element => {
1907
- $f24c14db771b471d$var$intersection_observer?.unobserve(element);
1908
- $f24c14db771b471d$var$watched_elements.delete(element);
1909
- $f24c14db771b471d$var$current_intersections.delete(element);
1910
- };
1911
- const $f24c14db771b471d$export$4c51576248bcdf31 = (element, callback) => {
1912
- if ($f24c14db771b471d$var$watched_elements.has(element)) {
1913
- $649f456f663da9fc$export$de56f1198d121036("Not watching", element, "as it's already being watched");
1914
- return () => {};
1915
- }
1916
- $f24c14db771b471d$var$intersection_observer?.observe(element);
1917
- /** Calls the given callback and makes sure to stop watching the element */
1918
- const wrapped_callback = element => {
1919
- callback(element);
1920
- $f24c14db771b471d$var$unwatch_element(element);
1921
- };
1922
- $f24c14db771b471d$var$watched_elements.set(element, wrapped_callback);
1923
- const disconnect_observer = (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onremoved(element, () => {
1924
- // Sometimes it has already rapidly been reinserted. The observer events lag by one tick.
1925
- // For that case, make sure we're really out of the DOM
1926
- if (document.documentElement.contains(element)) return;
1927
- $f24c14db771b471d$var$unwatch_element(element);
1928
- });
1929
- return () => {
1930
- disconnect_observer();
1931
- $f24c14db771b471d$var$unwatch_element(element);
1932
- };
1933
- };
1934
- const $f24c14db771b471d$var$intersection_observer_callback = entries => {
1935
- for (const record of entries) {
1936
- const {
1937
- target: target
1938
- } = record;
1939
- const callback = $f24c14db771b471d$var$watched_elements.get(target);
1940
- // Skip the element if it's no longer being watched.
1941
- if (!callback) {
1942
- $f24c14db771b471d$var$intersection_observer?.unobserve(target);
1943
- continue;
1944
- }
1945
- const currently_intersecting = $f24c14db771b471d$var$current_intersections.has(target);
1946
- if (!currently_intersecting && record.intersectionRatio >= (0, $ccf918da074d7243$export$135da44d0ba958bc)[0]) {
1947
- // we're intersecting enough and not already in the process of "measuring"
1948
- const started_intersecting_at_ = +new Date(); // save start time
1949
- // Schedule the callback function to be called after the element has been intersecting for the required duration
1950
- const callback_timeout_ = setTimeout(callback, (0, $ccf918da074d7243$export$ca8321ea61dc2544), target);
1951
- $f24c14db771b471d$var$current_intersections.set(target, {
1952
- started_intersecting_at_: started_intersecting_at_,
1953
- callback_timeout_: callback_timeout_
1954
- });
1955
- } else if (currently_intersecting && record.intersectionRatio < (0, $ccf918da074d7243$export$135da44d0ba958bc)[1]) {
1956
- // we are in the process of "measuring" and went below the threshold
1957
- const {
1958
- started_intersecting_at_: started_intersecting_at_,
1959
- callback_timeout_: callback_timeout_
1960
- } = $f24c14db771b471d$var$current_intersections.get(target);
1961
- const time_elapsed = +new Date() - started_intersecting_at_;
1962
- // If we stopped intersecting too early we want to abort our timeout.
1963
- // if we did not we also want to abort the timeout since it's been lagging and just instantly send the event
1964
- // (the browser can delay setTimeout timers)
1965
- clearTimeout(callback_timeout_);
1966
- if (time_elapsed <= (0, $ccf918da074d7243$export$ca8321ea61dc2544)) $f24c14db771b471d$var$current_intersections.delete(target);else {
1967
- // we intersected long enough
1968
- $649f456f663da9fc$export$de56f1198d121036("intersection_observer: setTimeout lagged", time_elapsed, (0, $ccf918da074d7243$export$ca8321ea61dc2544), "ms", target);
1969
- callback(target);
1970
- }
1971
- }
1972
- }
1973
- };
1974
- /**
1975
- * Global IntersectionObserver used for all impression tracking.
1976
- * It's faster to use one observer for all elements than to create a new one for each element.
1977
- */
1978
- const $f24c14db771b471d$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/new IntersectionObserver( /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9($f24c14db771b471d$var$intersection_observer_callback), {
1979
- threshold: /*@__PURE__*/$9ab9ecb74920f343$export$f8ea2e7b15b5d129(8)
1980
- }) : undefined;
1981
- const $405969d60b37fdac$export$d0efd8ed14f5c33 = (items, display, info) => {
1982
- if (!items?.length) return items;
1983
- const node_array = Array.isArray(items) ? items : [...items]; // if it's a NodeList convert it to an array
1984
- const first_watchable_el = node_array.find(el => el instanceof Element);
1985
- if (!first_watchable_el) {
1986
- $649f456f663da9fc$export$de56f1198d121036("Impression tracking: Can't observe", items, display);
1987
- return items;
1988
- }
1989
- if (!info.t) {
1990
- $649f456f663da9fc$export$de56f1198d121036("Impression tracking: No tenant instance, can't track", items, display);
1991
- return items;
1992
- }
1993
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({
1994
- element: element
1995
- }) => {
1996
- $f24c14db771b471d$export$4c51576248bcdf31(element, () => {
1997
- const {
1998
- recommendation_id: recommendation_id,
1999
- search_result_id: search_result_id,
2000
- product_listing_result_id: product_listing_result_id,
2001
- suggestions_result_id: suggestions_result_id
2002
- } = display;
2003
- $ccf918da074d7243$export$4205dc6835bc0d9f({
2004
- ...$43683b1103edab15$export$8c6f26a5b6921b95(),
2005
- recommendation_type: info.rendering_options.type,
2006
- entity_price: display.sale_price,
2007
- market: info.t.market,
2008
- tenant: info.t.tenant,
2009
- product_id: display.product_id,
2010
- recommendation_id: recommendation_id,
2011
- search_result_id: search_result_id,
2012
- product_listing_result_id: product_listing_result_id,
2013
- suggestions_result_id: suggestions_result_id
2014
- });
2015
- });
2016
- });
2017
- return items;
2018
- };
2019
- const $21285393646b9849$export$37125ccc5dd98050 = ({
2020
- element: element,
2021
- data: data,
2022
- wait_for_dom_insertion = true
2023
- }) => {
2024
- const disconnectors = [];
2025
- const impression_track = () => {
2026
- const disconnector = $f24c14db771b471d$export$4c51576248bcdf31(element, () => {
2027
- $ccf918da074d7243$export$4205dc6835bc0d9f({
2028
- ...$43683b1103edab15$export$8c6f26a5b6921b95(),
2029
- ...data
2030
- });
2031
- });
2032
- disconnectors.push(disconnector);
2033
- };
2034
- if (wait_for_dom_insertion) disconnectors.push((0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(element, impression_track));else impression_track();
2035
- return () => disconnectors.forEach(disconnector => disconnector());
2036
- };
2037
- let $ccf918da074d7243$export$135da44d0ba958bc = [0.6, 0.5];
2038
- const $ccf918da074d7243$export$c543ee4cdb0d0964 = (start, end) => $ccf918da074d7243$export$135da44d0ba958bc = [start, end];
2039
- const $ccf918da074d7243$export$ca8321ea61dc2544 = 500;
2040
- const $ccf918da074d7243$export$4205dc6835bc0d9f = data => {
2041
- data.type = "element_visible"; // Set the type to element_visible as this is optional to pass here.
2042
- $cafa1ff1049985c2$export$28cacbd9b4306ffc([data], true);
2043
- };
2044
- function $91b2e49f92ed636c$export$82a685f2da2fb027(a_element, product_id, recommendation_id, additional_listener) {
2045
- if (!a_element ||
2046
- // @ts-ignore
2047
- !a_element.depict_tracked ||
2048
- // @ts-ignore
2049
- a_element?.depict_tracked?.recommendation_id != recommendation_id ||
2050
- // @ts-ignore
2051
- a_element?.depict_tracked?.product_id != product_id) {
2052
- const listener = e => {
2053
- localStorage.setItem(`depict_attribution_${product_id}`, recommendation_id);
2054
- if (additional_listener) additional_listener(e, product_id, recommendation_id);
2055
- };
2056
- // @ts-ignore
2057
- if (a_element.depict_tracked)
2058
- // @ts-ignore
2059
- a_element.removeEventListener("click", a_element.depict_tracked?.listener);
2060
- // @ts-ignore
2061
- a_element.depict_tracked = {
2062
- product_id: product_id,
2063
- recommendation_id: recommendation_id,
2064
- listener: listener
2065
- };
2066
- a_element.addEventListener("click", listener);
2067
- return listener;
2068
- }
2069
- }
2070
- async function $91b2e49f92ed636c$export$2c34560c3749dc63(button, get_product_id, tracking_fn, unmatching_tracking, event) {
2071
- // @ts-ignore
2072
- if (!button || button.depict_tracked) return;
2073
- button.addEventListener(event ? event : "click", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async e => {
2074
- if (!e.isTrusted) {
2075
- $649f456f663da9fc$export$de56f1198d121036("ignoring event", e, "because it's not user generated");
2076
- return;
2077
- }
2078
- const product_id = await get_product_id(undefined, e);
2079
- if (product_id) {
2080
- const item_name = `depict_attribution_${product_id}`;
2081
- const recommendation_id = localStorage.getItem(item_name);
2082
- if (recommendation_id) {
2083
- localStorage.removeItem(item_name);
2084
- tracking_fn(product_id, recommendation_id, false, e);
2085
- } else if (unmatching_tracking) tracking_fn(product_id, recommendation_id, true, e);
2086
- }
2087
- }));
2088
- // @ts-ignore
2089
- button.depict_tracked = true;
2090
- }
2091
- const $0d2acf276472ebf7$export$20e9533e68ee72e7 = /*@__PURE__*/$607fc90221d440a6$export$e806c6c1615a59ae(false);
2092
- const $0d2acf276472ebf7$export$a9d39e43ae273d26 = /*@__PURE__*/$607fc90221d440a6$export$e806c6c1615a59ae();
2093
- const $0d2acf276472ebf7$export$7500cdfd37aafd43 = /*@__PURE__*/new Set();
2094
- let $0d2acf276472ebf7$var$old_url;
2095
- const $0d2acf276472ebf7$var$maybe_navigation = (what_happened, args) => {
2096
- if (typeof location === "undefined") return;
2097
- const new_url = location.href;
2098
- if ($0d2acf276472ebf7$var$old_url !== new_url) {
2099
- $0d2acf276472ebf7$export$a9d39e43ae273d26(new_url);
2100
- if ($0d2acf276472ebf7$var$old_url !== undefined)
2101
- // don't resolve stateless href change ipns with the initial value - it's not a navigation
2102
- $0d2acf276472ebf7$export$20e9533e68ee72e7(new_url);
2103
- $0d2acf276472ebf7$var$old_url = new_url;
2104
- }
2105
- for (const fn of $0d2acf276472ebf7$export$7500cdfd37aafd43) fn(what_happened, args);
2106
- };
2107
- $0d2acf276472ebf7$export$baccefee4a395d8f((args, what_happened) => $0d2acf276472ebf7$var$maybe_navigation(what_happened, args));
2108
- $0d2acf276472ebf7$var$maybe_navigation();
2109
- globalThis?.window?.addEventListener("popstate", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => $0d2acf276472ebf7$var$maybe_navigation("popstate", e)));
2110
- async function $0d2acf276472ebf7$export$1cd22bab0d2c3b0b(callback) {
2111
- const catchified_callback = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(callback);
2112
- for await (const href of $0d2acf276472ebf7$export$20e9533e68ee72e7) {
2113
- catchified_callback(href);
2114
- break;
2115
- }
2116
- }
2117
- async function $0d2acf276472ebf7$export$baccefee4a395d8f(after_navigation, replace_replaceState = true) {
2118
- if (typeof History === "undefined") return;
2119
- const {
2120
- prototype: prototype
2121
- } = History;
2122
- const instance = history;
2123
- const polyfill_dance = the_thing => {
2124
- const proxy_the_thing = obj => {
2125
- const orig_pushState = obj[the_thing];
2126
- obj[the_thing] = new Proxy(orig_pushState, {
2127
- apply: (target, this_arg, arguments_list) => {
2128
- const nav_result = Reflect.apply(target, this_arg, arguments_list);
2129
- try {
2130
- after_navigation(arguments_list, the_thing);
2131
- } catch (e) {
2132
- $7547e32486a3abc0$export$8048b892d651b310(e);
2133
- }
2134
- return nav_result;
2135
- }
2136
- });
2137
- };
2138
- proxy_the_thing(prototype);
2139
- if (Object.getOwnPropertyNames(instance).includes(the_thing))
2140
- // we don't want to just change the instance because that's not the way to do it, but we don't want to not work because someone else did it wrong
2141
- proxy_the_thing(instance);
2142
- };
2143
- polyfill_dance("pushState");
2144
- if (replace_replaceState) polyfill_dance("replaceState");
2145
- }
2146
- let $aa0140679dc70b7a$var$last_page_pageview_sent_for;
2147
- async function $aa0140679dc70b7a$export$eee4c4d924348b05(data) {
2148
- // Send page view to depict if needed
2149
- try {
2150
- const {
2151
- href: href
2152
- } = location;
2153
- if ($aa0140679dc70b7a$var$last_page_pageview_sent_for !== href) {
2154
- $aa0140679dc70b7a$var$last_page_pageview_sent_for = href;
2155
- $43683b1103edab15$export$82badda1f9923310({
2156
- ...data,
2157
- type: "page_view"
2158
- });
2159
- if (data.product_id) await $61b3c9e5f2cf8171$export$836f70a28c317905(data.product_id); // this takes care of right click click attribution - broadcasts the URL of the current page
2160
- }
2161
- } catch (error) {
2162
- $b04e44fad5ea42c7$export$f18d5b0af29128b7([error, "Sending page view failed"], "warning");
2163
- }
2164
- }
2165
- let $aa0140679dc70b7a$var$sending_on_navigation = false;
2166
- async function $aa0140679dc70b7a$export$f7cb1bd47199ec38(data) {
2167
- if (!$aa0140679dc70b7a$var$sending_on_navigation) {
2168
- $aa0140679dc70b7a$var$sending_on_navigation = true;
2169
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async () => {
2170
- for await (const _href of (0, $0d2acf276472ebf7$export$a9d39e43ae273d26)) $aa0140679dc70b7a$export$eee4c4d924348b05({
2171
- tenant: data.tenant,
2172
- market: data.market,
2173
- product_id: await data.get_product_id(_href)
2174
- });
2175
- })();
2176
- }
2177
- }
2178
- function $42bbbba8196bd057$export$edfedd0557ca5a2d(ga_tracker, append_to_url) {
2179
- if (!ga_tracker) return;
2180
- // Docs for analytics.js Tasks:
2181
- // https://developers.google.com/analytics/devguides/collection/analyticsjs/tasks
2182
- const sendHitTask = "sendHitTask";
2183
- const originalSendHitTask = ga_tracker.get(sendHitTask);
2184
- ga_tracker.set(sendHitTask, model => {
2185
- originalSendHitTask(model);
2186
- // console.log('Sent original hit, now sending to depict');
2187
- try {
2188
- const payLoad = model.get("hitPayload");
2189
- const path = (0, $6c2b49f3f564b0d1$export$362abebb4b313340) + "/collect-ga";
2190
- let url = path + "?" + payLoad;
2191
- if (append_to_url) url += append_to_url;
2192
- const n = navigator;
2193
- const sb = "sendBeacon";
2194
- if (n[sb])
2195
- // this is actually smaller, I tested
2196
- n[sb](url);else {
2197
- const xhttp = new XMLHttpRequest();
2198
- xhttp.open("GET", url);
2199
- xhttp.send();
2200
- }
2201
- } catch (e) {
2202
- // console.log('Could not send beacon to /collect-ga', e);
2203
- }
2204
- });
2205
- }
2206
- function $42bbbba8196bd057$export$674d8cd8b6868154() {
2207
- // Snippet to load GA async
2208
- const w = window;
2209
- // @ts-ignore
2210
- w.ga ||= function () {
2211
- (w.ga.q ||= []).push(arguments);
2212
- };
2213
- w.ga.l = +new Date();
2214
- }
2215
- var $155540b3b8aca771$exports = {};
2216
- /*@__PURE__*/$parcel$export($155540b3b8aca771$exports, "cookiebot_get_consent", () => $155540b3b8aca771$export$fce59460a1699957);
2217
- /*@__PURE__*/$parcel$export($155540b3b8aca771$exports, "cookiebot_wait_for_consent", () => $155540b3b8aca771$export$56c2e8be65fb14ae);
2218
- /*@__PURE__*/$parcel$export($155540b3b8aca771$exports, "cookiebot_get_cookie_ipns", () => $155540b3b8aca771$export$8827362e5e938d26);
2219
- /*@__PURE__*/$parcel$export($155540b3b8aca771$exports, "init_cookiebot_tracking", () => $155540b3b8aca771$export$abec7fd9f0b9cc22);
2220
- const $155540b3b8aca771$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
2221
- function $155540b3b8aca771$var$consent_from_cookie() {
2222
- const cookie = $43683b1103edab15$export$622991c71a1f52b3("CookieConsent");
2223
- if (!cookie) return;
2224
- const consent_json = cookie.replace(/%2C/g, ",").replace(/%27/g, "'").replace(/'/g, '"').replace(/([{[,])\s*([\w]+?):/g, '$1"$2":');
2225
- try {
2226
- return JSON.parse(consent_json);
2227
- } catch ({
2228
- message: message
2229
- }) {
2230
- $649f456f663da9fc$export$de56f1198d121036("Error parsing cookie json", consent_json, message);
2231
- return;
2232
- }
2233
- }
2234
- let $155540b3b8aca771$var$cookie_ipns;
2235
- let $155540b3b8aca771$var$has_consent = /*@__PURE__*/(() => $155540b3b8aca771$var$required_consent_level ? $155540b3b8aca771$var$consent_from_cookie()?.[$155540b3b8aca771$var$required_consent_level] || false : true)();
2236
- const $155540b3b8aca771$export$fce59460a1699957 = () => $155540b3b8aca771$var$has_consent;
2237
- async function $155540b3b8aca771$export$56c2e8be65fb14ae() {
2238
- for await (const consent_obj of $155540b3b8aca771$export$8827362e5e938d26()) return consent_obj[process.env.DEPICT_TRACKING_CONSENT_LEVEL];
2239
- // Impossible
2240
- return false;
2241
- }
2242
- function $155540b3b8aca771$export$8827362e5e938d26() {
2243
- if ($155540b3b8aca771$var$cookie_ipns) return $155540b3b8aca771$var$cookie_ipns;
2244
- $155540b3b8aca771$var$cookie_ipns = $607fc90221d440a6$export$e806c6c1615a59ae();
2245
- const existing_consent = $155540b3b8aca771$var$consent_from_cookie();
2246
- if (existing_consent) $155540b3b8aca771$var$cookie_ipns(existing_consent);
2247
- const consent_maybe_changed = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
2248
- const {
2249
- consent: {
2250
- marketing: marketing,
2251
- necessary: necessary,
2252
- preferences: preferences,
2253
- statistics: statistics
2254
- }
2255
- } = window.Cookiebot;
2256
- const new_consent_obj = {
2257
- marketing: marketing,
2258
- necessary: necessary,
2259
- preferences: preferences,
2260
- statistics: statistics
2261
- };
2262
- if (!Object.keys(new_consent_obj).every(k => $155540b3b8aca771$var$cookie_ipns.latest_call_value?.[k] === new_consent_obj[k])) {
2263
- $649f456f663da9fc$export$de56f1198d121036("Consent changed", new_consent_obj);
2264
- $155540b3b8aca771$var$cookie_ipns(new_consent_obj);
2265
- }
2266
- }, "extracting consent failed");
2267
- $d0e7629fb3179e02$export$2fc1a072736ae2f6(window, "Cookiebot", "consent").then(consent_maybe_changed);
2268
- ["CookiebotOnAccept", "CookiebotOnDecline"].forEach(e => window.addEventListener(e, consent_maybe_changed, false));
2269
- return $155540b3b8aca771$var$cookie_ipns;
2270
- }
2271
- const $155540b3b8aca771$export$abec7fd9f0b9cc22 = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async (anon_id = "anonymous") => {
2272
- $649f456f663da9fc$export$de56f1198d121036("Initializing Cookiebot tracking");
2273
- if (!$155540b3b8aca771$var$required_consent_level) return $649f456f663da9fc$export$de56f1198d121036("No consent level set for Depict tracking. Ignoring consent and tracking everything.");
2274
- const original_get_session_id = (0, $43683b1103edab15$export$61e7e1f11e96692f);
2275
- $43683b1103edab15$export$93ae15b1ae509334(() => $155540b3b8aca771$var$has_consent ? original_get_session_id() : anon_id);
2276
- for await (const consent_obj of $155540b3b8aca771$export$8827362e5e938d26()) {
2277
- // Changing this will change the return value of function given to set_depict_id_fn above
2278
- $155540b3b8aca771$var$has_consent = consent_obj[$155540b3b8aca771$var$required_consent_level];
2279
- if (!$155540b3b8aca771$var$has_consent) $649f456f663da9fc$export$de56f1198d121036(`dsid will be set to, "${anon_id}", until Cookiebot has consent for "${$155540b3b8aca771$var$required_consent_level}"`);else $649f456f663da9fc$export$de56f1198d121036(`Cookiebot obtained consent for "${$155540b3b8aca771$var$required_consent_level}", will use true dsid/session_id`);
2280
- }
2281
- });
2282
- const $5dbacdc6a3feeb15$var$required_consent_level = process.env.DEPICT_TRACKING_CONSENT_LEVEL;
2283
- /*
2284
- The Optanon cookie format can vary slightly between integrations. To figure out the key values used for a particular customer,
2285
- visit their web, finish the consent dialog, then run
2286
- new URLSearchParams(document.cookie.match("(^|;)\\s*OptanonConsent\\s*=\\s*([^;]+)")?.pop()).get("groups")
2287
- in the console. You should see something like
2288
- 'NECES:1,ANALY:1,PERON:1,MARKE:1'
2289
- Which tells you what the key values for each consent level is. Enter them in the correct order, comma separated,
2290
- as OPTANON_KEYS in the tenants .env file. For the cookie output above, the .env entry would be
2291
- OPTANON_KEYS="NECES,ANALY,PERON,MARKE"
2292
- If it's not obvious which consent level each key represents, open the consent dialog again and start de-selecting consent options,
2293
- then check the cookie value again.
2294
- */
2295
- const $5dbacdc6a3feeb15$var$KEY_ORDER = ["necessary", "statistics", "preferences", "marketing"];
2296
- const $5dbacdc6a3feeb15$var$OPTANON_TO_COOKIEBOT = Object.fromEntries((process.env.OPTANON_KEYS || "").split(",").filter(k => k).map((k, i) => [k, $5dbacdc6a3feeb15$var$KEY_ORDER[i]]));
2297
- function $5dbacdc6a3feeb15$var$consent_from_cookie() {
2298
- const cookie = $43683b1103edab15$export$622991c71a1f52b3("OptanonConsent");
2299
- if (!cookie) return;
2300
- const groups = new URLSearchParams(cookie).get("groups") || "";
2301
- const matches = groups.matchAll(/(\w+):(\d)/g);
2302
- const consent = {};
2303
- for (const match of matches) consent[$5dbacdc6a3feeb15$var$OPTANON_TO_COOKIEBOT[match[1]]] = match[2] == "1";
2304
- return consent;
2305
- }
2306
- let $5dbacdc6a3feeb15$var$cookie_ipns;
2307
- let $5dbacdc6a3feeb15$var$has_consent = /*@__PURE__*/(() => $5dbacdc6a3feeb15$var$required_consent_level ? $5dbacdc6a3feeb15$var$consent_from_cookie()?.[$5dbacdc6a3feeb15$var$required_consent_level] || false : true)();
2308
- const $5dbacdc6a3feeb15$export$1dd9ce50e201eff1 = () => $5dbacdc6a3feeb15$var$has_consent;
2309
- async function $5dbacdc6a3feeb15$export$7a6d436e0782c6ed() {
2310
- for await (const consent_obj of $5dbacdc6a3feeb15$export$7e4427e80d5fc619()) return consent_obj[process.env.DEPICT_TRACKING_CONSENT_LEVEL];
2311
- // Impossible
2312
- return false;
2313
- }
2314
- function $5dbacdc6a3feeb15$export$7e4427e80d5fc619() {
2315
- if ($5dbacdc6a3feeb15$var$cookie_ipns) return $5dbacdc6a3feeb15$var$cookie_ipns;
2316
- $5dbacdc6a3feeb15$var$cookie_ipns = $607fc90221d440a6$export$e806c6c1615a59ae();
2317
- const existing_consent = $5dbacdc6a3feeb15$var$consent_from_cookie();
2318
- if (existing_consent?.necessary)
2319
- // If "necessary" isn't set, user hasn't actually given/withold consent yet.
2320
- $5dbacdc6a3feeb15$var$cookie_ipns(existing_consent);
2321
- window.addEventListener("consent.onetrust", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(evt => {
2322
- const c = evt;
2323
- // Cast because TS doesn't know about the forEach coming up
2324
- const consent_obj = {};
2325
- Object.keys($5dbacdc6a3feeb15$var$OPTANON_TO_COOKIEBOT).forEach(k => {
2326
- consent_obj[$5dbacdc6a3feeb15$var$OPTANON_TO_COOKIEBOT[k]] = c.detail.includes(k);
2327
- });
2328
- if (!consent_obj.necessary)
2329
- // If "necessary" isn't set, user hasn't actually given/withold consent yet.
2330
- return;
2331
- if (!Object.keys(consent_obj).every(k => $5dbacdc6a3feeb15$var$cookie_ipns.latest_call_value?.[k] === consent_obj[k])) $5dbacdc6a3feeb15$var$cookie_ipns(consent_obj);
2332
- }));
2333
- return $5dbacdc6a3feeb15$var$cookie_ipns;
2334
- }
2335
- const $5dbacdc6a3feeb15$export$f0f6c846d96fdbec = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async (anon_id = "anonymous") => {
2336
- $649f456f663da9fc$export$de56f1198d121036("Initializing OptAnon tracking");
2337
- if (!$5dbacdc6a3feeb15$var$required_consent_level) return $649f456f663da9fc$export$de56f1198d121036("No consent level set for Depict tracking. Ignoring consent and tracking everything.");
2338
- const original_get_session_id = (0, $43683b1103edab15$export$61e7e1f11e96692f);
2339
- $43683b1103edab15$export$93ae15b1ae509334(() => $5dbacdc6a3feeb15$var$has_consent ? original_get_session_id() : anon_id);
2340
- for await (const consent_obj of $5dbacdc6a3feeb15$export$7e4427e80d5fc619()) {
2341
- // Changing this will change the return value of function given to set_depict_id_fn above
2342
- $5dbacdc6a3feeb15$var$has_consent = consent_obj[$5dbacdc6a3feeb15$var$required_consent_level];
2343
- if (!$5dbacdc6a3feeb15$var$has_consent) $649f456f663da9fc$export$de56f1198d121036(`dsid/session_id will be set to, "${anon_id}", until Optanon has consent for "${$5dbacdc6a3feeb15$var$required_consent_level}"`);else $649f456f663da9fc$export$de56f1198d121036(`Optanon obtained consent for "${$5dbacdc6a3feeb15$var$required_consent_level}", will use true dsid/session_id`);
2344
- }
2345
- });
2346
- const $c749fe63b72056ef$var$g = typeof globalThis == "object" && globalThis || window;
2347
- const $c749fe63b72056ef$export$f3354ec2ce95ebd9 = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async (GA_ID, strict) => {
2348
- if (process.env.GTAG === "false") return;
2349
- if (!GA_ID) {
2350
- $649f456f663da9fc$export$c2363754d4758444("Couldn't load gtag, GA_ID not specified", GA_ID);
2351
- return;
2352
- }
2353
- const required_consent_level = process.env.GTAG_LOADING_CONSENT_LEVEL;
2354
- if (required_consent_level !== undefined) {
2355
- $649f456f663da9fc$export$de56f1198d121036(`GTag loading waiting for consent level ${required_consent_level}`);
2356
- const ipns = process.env.CONSENT_FRAMEWORK == "optanon" ? $5dbacdc6a3feeb15$export$7e4427e80d5fc619() : $155540b3b8aca771$export$8827362e5e938d26();
2357
- for await (const consent_status of ipns) {
2358
- const status_for_level = consent_status[required_consent_level];
2359
- if (status_for_level) {
2360
- $649f456f663da9fc$export$de56f1198d121036("got consent for", required_consent_level, "loading gtag");
2361
- break;
2362
- }
2363
- }
2364
- }
2365
- // delay loading of script because it's huge and slow according to nordiska galleriet
2366
- // @ts-ignore
2367
- const page_hasnt_loaded = $c749fe63b72056ef$var$g?.performance?.getEntriesByType?.("navigation")?.every?.(e => e?.loadEventEnd) === false;
2368
- // Source: comment on https://stackoverflow.com/a/53525488
2369
- // don't use readyState, source: personal experience and comment on https://stackoverflow.com/a/28093606
2370
- $649f456f663da9fc$export$de56f1198d121036("Loading gtag after " + (page_hasnt_loaded ? "pageload and " : "") + "3s" + (strict ? "" : ", but setting up queues already"));
2371
- if (!strict) $c749fe63b72056ef$export$d031e55ccd4c52dc(GA_ID);
2372
- if (page_hasnt_loaded) {
2373
- const load_event = await new Promise(r => window.addEventListener("load", r, {
2374
- once: true
2375
- }));
2376
- $649f456f663da9fc$export$de56f1198d121036("page has loaded", load_event);
2377
- }
2378
- await new Promise(r => setTimeout(r, 3000));
2379
- const script = document.createElement("script"),
2380
- head = document.head;
2381
- script.async = true;
2382
- script.src = "https://www.googletagmanager.com/gtag/js?id=" + GA_ID;
2383
- head.appendChild(script);
2384
- $649f456f663da9fc$export$de56f1198d121036("Loading gtag now", script);
2385
- });
2386
- const $c749fe63b72056ef$export$d031e55ccd4c52dc = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(GA_ID => {
2387
- if (process.env.GTAG === "false") return;
2388
- $c749fe63b72056ef$var$g.dataLayer ||= [];
2389
- function gtag() {
2390
- $c749fe63b72056ef$var$g.dataLayer.push(arguments);
2391
- }
2392
- $c749fe63b72056ef$var$g.gtag = gtag;
2393
- $c749fe63b72056ef$var$g.gtag("js", new Date());
2394
- $c749fe63b72056ef$var$g.gtag("config", GA_ID, {
2395
- "send_page_view": false
2396
- });
2397
- $649f456f663da9fc$export$de56f1198d121036("configuring gtag with", GA_ID);
2398
- });
2399
- const $c749fe63b72056ef$export$7babcd5d4056b2ca = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async (raw_displays, get_product_id, more) => {
2400
- const displays = raw_displays; // gtag tracking is "obsolete" and we don't expect any customers using something else than LegacyDisplay to use it
2401
- if (process.env.GTAG === "false") return;
2402
- if (process.env.GTAG_VIEW === "false") return;
2403
- if (process.env.GTAG_EVENT_CONSENT_LEVEL !== undefined && !(await $c749fe63b72056ef$var$can_send_gtag_events(displays, get_product_id, more))) return;
2404
- if (typeof $c749fe63b72056ef$var$g.gtag == "function") {
2405
- const make_item = (display, index, id) => ({
2406
- id: id,
2407
- "list_name": "depict",
2408
- "list_position": display?.index || index + 1,
2409
- ...(typeof more === "function" ? more(display) : more)
2410
- });
2411
- const gtag_items = [
2412
- // spread works around safari 11 bug where Array returned by Promise.all is not an instance of the global Array
2413
- // https://sentry.io/organizations/depictai-0o/issues/2794688692/?project=5476183
2414
- ...(await Promise.all(displays.map(async (display, index) => display.ga_product_ids ? display.ga_product_ids.map(id => make_item(display, index, id)) : make_item(display, index, display.ga_product_id || display.product_id || (await get_product_id(display.page_url)) || (await get_product_id(display)) // the last statement is this row allows for special product_id getter functions that not only use the page_url. They need to check the typeof their argument tho and ignore the first calls
2415
- ))))].flat();
2416
- const max_products_per_request = 100;
2417
- for (let i = 0; i < gtag_items.length; i += max_products_per_request) {
2418
- const gtag_args = ["event", "view_item_list", {
2419
- "items": gtag_items.slice(i, i + max_products_per_request)
2420
- }];
2421
- $649f456f663da9fc$export$de56f1198d121036("Sending product view to gtag", gtag_args);
2422
- $c749fe63b72056ef$var$g.gtag(...gtag_args);
2423
- }
2424
- } else $649f456f663da9fc$export$c2363754d4758444("not sending gtag tracking as there is no gtag");
2425
- });
2426
- const $c749fe63b72056ef$export$f522672c9379e339 = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async (product_id, index, more) => {
2427
- if (process.env.GTAG === "false") return;
2428
- if (process.env.GTAG_EVENT_CONSENT_LEVEL !== undefined && !(await $c749fe63b72056ef$var$can_send_gtag_events(product_id, index, more))) return;
2429
- if (typeof $c749fe63b72056ef$var$g.gtag == "function") {
2430
- const gtag_args = ["event", "select_content", {
2431
- "content_type": "product",
2432
- "items": [{
2433
- "id": product_id,
2434
- "list_name": "depict",
2435
- "list_position": index + 1,
2436
- ...more
2437
- }]
2438
- }];
2439
- $649f456f663da9fc$export$de56f1198d121036("calling gtag with arguments", gtag_args);
2440
- return $c749fe63b72056ef$var$g.gtag(...gtag_args);
2441
- } else $649f456f663da9fc$export$c2363754d4758444("not sending gtag tracking as there is no gtag");
2442
- });
2443
- const $c749fe63b72056ef$export$f75172d2e289cd02 = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(action => {
2444
- if (process.env.GA === "false") return;
2445
- if (typeof $c749fe63b72056ef$var$g.ga != "function") {
2446
- $649f456f663da9fc$export$c2363754d4758444("Not sending to ga as there is no ga");
2447
- return;
2448
- }
2449
- $649f456f663da9fc$export$de56f1198d121036("sending", action, "to GA");
2450
- return $c749fe63b72056ef$var$g.ga("depict.send", {
2451
- hitType: "event",
2452
- eventCategory: "Depict",
2453
- eventAction: action,
2454
- eventLabel: "rec-bar-tracking",
2455
- nonInteraction: 1
2456
- });
2457
- });
2458
- const $c749fe63b72056ef$export$ac7296527cb52311 = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(GAID => {
2459
- if (process.env.GA === "false") return;
2460
- if (!GAID) {
2461
- $649f456f663da9fc$export$c2363754d4758444(new Error("No GAID specified"));
2462
- return;
2463
- }
2464
- if (typeof $c749fe63b72056ef$var$g.ga != "function") {
2465
- $649f456f663da9fc$export$de56f1198d121036("Creating GA queue");
2466
- $42bbbba8196bd057$export$674d8cd8b6868154();
2467
- }
2468
- $649f456f663da9fc$export$de56f1198d121036("Creating ga with GA-ID", GAID);
2469
- $c749fe63b72056ef$var$g.ga("create", GAID, "auto", "depict");
2470
- $c749fe63b72056ef$export$f3354ec2ce95ebd9(GAID, false);
2471
- });
2472
- const $c749fe63b72056ef$export$127751e82111fcf = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => $c749fe63b72056ef$export$f75172d2e289cd02("rec_bar_click"));
2473
- const $c749fe63b72056ef$export$bf205937e5e012cb = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => $c749fe63b72056ef$export$f75172d2e289cd02("add_to_cart_after_rec_bar_click"));
2474
- async function $c749fe63b72056ef$var$can_send_gtag_events(...stuff_to_log) {
2475
- const required_consent_level = process.env.GTAG_LOADING_CONSENT_LEVEL;
2476
- if (required_consent_level !== undefined) return true; // just in case
2477
- const ipns = process.env.CONSENT_FRAMEWORK == "optanon" ? $5dbacdc6a3feeb15$export$7e4427e80d5fc619() : $155540b3b8aca771$export$8827362e5e938d26();
2478
- for await (const consent_obj of ipns) {
2479
- const can_send = consent_obj[required_consent_level];
2480
- if (!can_send) $649f456f663da9fc$export$de56f1198d121036("Got no consent for", required_consent_level, "not sending gtag event for", ...stuff_to_log);
2481
- return can_send;
2482
- }
2483
- }
2484
- let $0a581f1dfa083522$var$existing_style_tag;
2485
- let $0a581f1dfa083522$var$reactions_in_last_s = 0;
2486
- const $0a581f1dfa083522$export$59ba1eb2c083f0cd = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async css => {
2487
- const style_tag = await ($0a581f1dfa083522$var$existing_style_tag ||= (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element("head").then(head => {
2488
- const tag = document.createElement("style");
2489
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onremoved(
2490
- // reinsertion for next.js's "portable" <head>
2491
- tag, eoe => {
2492
- if (document.head.contains(tag))
2493
- // just make sure to not freak out if it's already been added again
2494
- return;
2495
- if ($0a581f1dfa083522$var$reactions_in_last_s >= 10) {
2496
- $b04e44fad5ea42c7$export$f18d5b0af29128b7(new Error("Someone removed our styling but insists on it (10 removals in previous second). Giving up \uD83D\uDE2B"), "error");
2497
- return;
2498
- }
2499
- $649f456f663da9fc$export$de56f1198d121036("Someone removed our styling \uD83D\uDE24, reinserting", eoe);
2500
- $0a581f1dfa083522$var$reactions_in_last_s++;
2501
- setTimeout(() => $0a581f1dfa083522$var$reactions_in_last_s--, 1000);
2502
- document.head.append(tag); // we're sure that head exists now since we inserted it there previously
2503
- });
2504
-
2505
- $649f456f663da9fc$export$de56f1198d121036("inserting", tag, "into", head);
2506
- return head.appendChild(tag);
2507
- }));
2508
- style_tag.append(css);
2509
- });
2510
- const $0a581f1dfa083522$export$a96c18473f2af463 = (tenant, selector, validator) => {
2511
- return (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(selector, ({
2512
- element: element
2513
- }) => $91b2e49f92ed636c$export$2c34560c3749dc63(element, tenant.get_product_id, (p_id, r_id, was_unmatching, event) => {
2514
- if (typeof validator === "function" && !validator(event)) return;
2515
- if (!was_unmatching) $c749fe63b72056ef$export$bf205937e5e012cb();
2516
- $43683b1103edab15$export$9028351cb994757e({
2517
- ...tenant,
2518
- product_id: p_id,
2519
- ...(was_unmatching ? {
2520
- attribution_id: "recommendation"
2521
- } : {
2522
- recommendation_id: r_id
2523
- })
2524
- });
2525
- }, true));
2526
- };
2527
- const $0a581f1dfa083522$export$a4f97b27a0592e6c = url => (url ? new URL(url, window.location.origin) : window.location).pathname.split("/").filter(a => a).pop()?.replace(/\.html?$/i, "") || "";
2528
- const $0a581f1dfa083522$export$692b606677218a16 = callback => {
2529
- if (document.depictwashere) {
2530
- if (process.env.BUILD_TARGET === "dev") {
2531
- $649f456f663da9fc$export$de56f1198d121036("HMR tried to rerun us, reloading page");
2532
- /* eslint-disable no-self-assign */
2533
- location.href = location.href;
2534
- }
2535
- $649f456f663da9fc$export$de56f1198d121036("Script has already ran", document.currentScript, "is exiting");
2536
- return;
2537
- }
2538
- if (process.env.BUILD_TARGET === "dev") /* eslint-disable no-console */console.clear = new Proxy(console.clear, {
2539
- apply(target, this_arg, arg_list) {
2540
- if (new Error().stack?.split("\n").filter(Boolean).some(s => s.includes("http://localhost:1234/depict-ai.js"))) {
2541
- /* eslint-disable no-console */console.log("CSS change detected through hack, reloading");
2542
- location.reload();
2543
- }
2544
- return target.apply(this_arg, arg_list);
2545
- }
2546
- });
2547
- document.depictwashere = true;
2548
- callback().catch((0, $7547e32486a3abc0$export$8048b892d651b310));
2549
- };
2550
- function $0a581f1dfa083522$export$328e81c44cddf3c0(callback, get_market, supported_markets, unsupported_markets, preferred_demo_market) {
2551
- $0a581f1dfa083522$export$692b606677218a16(async () => {
2552
- // Handle override for debug scripts (could be used on demo pages too)
2553
- if (process.env.DEBUG === "true") {
2554
- let localstorage_override;
2555
- const query_param_override = new URLSearchParams(location.search).get("depict-override-market");
2556
- if (query_param_override !== null) {
2557
- $649f456f663da9fc$export$de56f1198d121036(`Found ?depict-override-market=${query_param_override}. Using that as the market`);
2558
- get_market = () => query_param_override;
2559
- localStorage.setItem("depict-override-market", query_param_override);
2560
- } else if ((localstorage_override = localStorage.getItem("depict-override-market")) !== null) {
2561
- $649f456f663da9fc$export$de56f1198d121036(`Found depict-override-market="${localstorage_override}" in localStorage. Using that as the market`);
2562
- get_market = () => localstorage_override;
2563
- }
2564
- }
2565
- const market = await get_market();
2566
- if (supported_markets.includes(market)) {
2567
- $649f456f663da9fc$export$de56f1198d121036(`Initializing with market: ${market}`);
2568
- return callback(market).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
2569
- } else if (unsupported_markets.includes(market)) {
2570
- $649f456f663da9fc$export$de56f1198d121036(`Unsupported market: ${market}. Exiting...`);
2571
- return;
2572
- } else if (process.env.DEBUG === "true" && location.host.endsWith(".demo.depict.ai") && preferred_demo_market) {
2573
- $649f456f663da9fc$export$de56f1198d121036(`On demosite with default market override. Setting market to ${preferred_demo_market}`);
2574
- return callback(preferred_demo_market).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
2575
- } else {
2576
- $7547e32486a3abc0$export$8048b892d651b310(new Error(`Unknown market: "${market}". Exiting...`));
2577
- return;
2578
- }
2579
- });
2580
- }
2581
- class $26eaaddf434c84f1$export$8d42ce4827f43582 {
2582
- constructor(options) {
2583
- this.dataset = {
2584
- ...((options.current_script_override || document.currentScript || {}).dataset || {})
2585
- };
2586
- this.modify = this.dataset.modify === "true";
2587
- this.is_debug = (0, $571bce04eb920cd8$export$55fe61489d2c7417);
2588
- this.dlog = (0, $649f456f663da9fc$export$de56f1198d121036);
2589
- this.TENANT = options.TENANT || process.env.TENANT || "sandbox";
2590
- this.MARKET = options.MARKET;
2591
- this.Sentry = (0, $eba382943196079c$export$af2e17a20c2ea3c5);
2592
- this.GA_ID = options.GA_ID ?? "";
2593
- this.TYPE = options.TYPE || "normal";
2594
- this.catchify = (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9);
2595
- this.err = (0, $7547e32486a3abc0$export$8048b892d651b310);
2596
- if (this.GA_ID) $c749fe63b72056ef$export$ac7296527cb52311(this.GA_ID);
2597
- // https://gitlab.com/depict-ai/depict.ai/-/merge_requests/2318#note_927887712
2598
- this.get_product_id = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9((...args) => {
2599
- const id = options.get_product_id(...args);
2600
- if (id instanceof Promise) return id.then(id => id || "");
2601
- return id || "";
2602
- });
2603
- this.product_id = this.get_product_id; // template tool compatible alias
2604
- this.tenant = this.TENANT;
2605
- this.market = this.MARKET;
2606
- this.gaid = this.GA_ID; // template tool compatible alias
2607
- this.type = this.TYPE;
2608
- this.catchify = (0, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9);
2609
- this.err = (0, $7547e32486a3abc0$export$8048b892d651b310);
2610
- if (localStorage.getItem("highlight-depict") === "true") $0a581f1dfa083522$export$59ba1eb2c083f0cd(".depict { background: #f00a !important; }");
2611
- if (options.pageview_tracking ?? true) (async () => {
2612
- $aa0140679dc70b7a$export$f7cb1bd47199ec38({
2613
- market: this.market,
2614
- tenant: this.tenant,
2615
- get_product_id: this.get_product_id
2616
- });
2617
- })();
2618
- }
2619
- } /**
2620
- * This is a list of alpha-2 country codes plus some two letter combinations commonly used to describe markets
2621
- */ // albania
2622
-
2623
- const $d4ffde0b9fca0369$var$default_get_rec_id = elem => elem?.dataset?.depict_recommendation_id || elem?.dataset?.recommendationId;
2624
- const $d4ffde0b9fca0369$var$default_get_prod_id = elem => elem?.dataset?.depict_product_id || elem?.dataset?.productId;
2625
- const $d4ffde0b9fca0369$var$default_get_ga_prod_id = elem => elem?.dataset?.ga_ids;
2626
- const $d4ffde0b9fca0369$var$get_index_in_children_of_el = el => [...(el?.parentElement?.children || [])].indexOf(el);
2627
- const $d4ffde0b9fca0369$export$29a6094e0bd8bc5f = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async (options, gtag_options) => {
2628
- const {
2629
- product_selector: product_selector,
2630
- a2c_selector: a2c_selector,
2631
- rec_a2c_selector: rec_a2c_selector,
2632
- rec_a2c_unbubbled: rec_a2c_unbubbled,
2633
- get_product_id = options.t?.get_product_id,
2634
- get_rec_id = $d4ffde0b9fca0369$var$default_get_rec_id,
2635
- get_prod_id = $d4ffde0b9fca0369$var$default_get_prod_id,
2636
- get_ga_prod_id = $d4ffde0b9fca0369$var$default_get_ga_prod_id,
2637
- get_display: get_display,
2638
- impression_tracking: impression_tracking,
2639
- a2c_elements: a2c_elements,
2640
- product_elements: product_elements,
2641
- t: t,
2642
- click_location_prefix = elem => elem?.parentElement?.dataset?.type + "_"
2643
- } = options;
2644
- const get_display_data = async elem => {
2645
- const data = {};
2646
- if (get_prod_id) data.product_id = (await get_prod_id(elem)) || (get_product_id ? await get_product_id(elem.querySelector("a")?.href || elem?.href) : undefined);
2647
- if (get_ga_prod_id) data.ga_product_id = await get_ga_prod_id(elem);
2648
- if (get_rec_id) data.recommendation_id = get_rec_id(elem);
2649
- if (get_display) Object.assign(data, get_display(elem));
2650
- return data;
2651
- };
2652
- const impression_tracked_els = new WeakSet();
2653
- const view_tracked_els = new WeakSet();
2654
- const a2c_tracked_els = new WeakSet();
2655
- const click_tracked_els = new WeakSet();
2656
- const gtag_view_product_ids = {};
2657
- // Page view
2658
- if (t instanceof (0, $26eaaddf434c84f1$export$8d42ce4827f43582)) (async () => {
2659
- $aa0140679dc70b7a$export$eee4c4d924348b05({
2660
- tenant: t.tenant,
2661
- market: t.market,
2662
- product_id: await t.get_product_id()
2663
- });
2664
- })();
2665
- // Product card
2666
- const add_tracking_to_product_card = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async ({
2667
- element: elem
2668
- }) => {
2669
- const index = $d4ffde0b9fca0369$var$get_index_in_children_of_el(elem);
2670
- const data = await get_display_data(elem);
2671
- const prefix = typeof click_location_prefix === "function" && click_location_prefix(elem) || "depict_";
2672
- const gtag_list_name = "depict_" + (prefix[prefix.length - 1] == "_" ? prefix.substr(0, prefix.length - 1) : prefix);
2673
- // Impression tracking
2674
- if (impression_tracking && !impression_tracked_els.has(elem)) {
2675
- impression_tracked_els.add(elem);
2676
- $21285393646b9849$export$37125ccc5dd98050({
2677
- element: elem,
2678
- data: {
2679
- recommendation_id: data.recommendation_id,
2680
- product_id: data.product_id,
2681
- tenant: t.tenant,
2682
- recommendation_type: prefix.slice(-1) === "_" ? prefix.slice(0, -1) : prefix,
2683
- entity_price: data.entity_price,
2684
- market: t.market
2685
- },
2686
- wait_for_dom_insertion: false
2687
- });
2688
- }
2689
- // Gtag view tracking
2690
- if (data.product_id && options.attempt_gtag_view_tracking && !view_tracked_els.has(elem)) {
2691
- view_tracked_els.add(elem);
2692
- const gtag_view_product_ids_for_product = gtag_view_product_ids[gtag_list_name] ||= [];
2693
- gtag_view_product_ids_for_product.push({
2694
- product_id: data.ga_product_id || data.product_id,
2695
- index: index
2696
- });
2697
- if (data.ga_product_ids) gtag_view_product_ids_for_product.push(...data.ga_product_ids.map(product_id => ({
2698
- product_id: product_id,
2699
- index: index
2700
- })));
2701
- try {
2702
- const ga_ids = elem?.dataset?.ga_ids;
2703
- if (ga_ids) gtag_view_product_ids_for_product.push(...ga_ids.split(",").map(id => ({
2704
- product_id: id,
2705
- index: index
2706
- })));
2707
- } catch (e) {
2708
- $649f456f663da9fc$export$c2363754d4758444("Something went wrong on a product with multiple ga_ids", e);
2709
- }
2710
- }
2711
- if (typeof BroadcastChannel == "function") {
2712
- // right click and mouse wheel click tracking
2713
- const handler = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, data.product_id));
2714
- elem.addEventListener("contextmenu", handler);
2715
- elem.addEventListener("auxclick", e => e.button === 1 && handler(e)); // actual wheel click - some mouses / OS:es also dispatch auxclick on rightclick
2716
- }
2717
-
2718
- click_tracking: {
2719
- if (click_tracked_els.has(elem)) break click_tracking;
2720
- click_tracked_els.add(elem);
2721
- elem.addEventListener("click", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
2722
- const product_id = data.product_id || "DNT";
2723
- const recommendation_id = data.recommendation_id || "not_depict";
2724
- localStorage.setItem(`depict_attribution_${product_id}`, recommendation_id);
2725
- const index = $d4ffde0b9fca0369$var$get_index_in_children_of_el(elem);
2726
- const click_location = prefix + (index + 1);
2727
- $c749fe63b72056ef$export$127751e82111fcf();
2728
- $43683b1103edab15$export$15f8a0cd5a8c0ebb({
2729
- ...(options.t || {}),
2730
- ...options,
2731
- ...data,
2732
- ...(data.recommendation_id ? {} : {
2733
- attribution_id: "recommendation"
2734
- }),
2735
- click_location: click_location
2736
- });
2737
- if (!options.no_gtag) {
2738
- const gtag_options_with_click_location = {
2739
- list_name: gtag_list_name,
2740
- ...gtag_options
2741
- };
2742
- $c749fe63b72056ef$export$f522672c9379e339(data.product_id, index, gtag_options_with_click_location);
2743
- try {
2744
- const to_iterate = [];
2745
- if (data.ga_product_id) to_iterate.push(...(data.ga_product_id.toString?.().split(",") ?? []));
2746
- to_iterate.push(...(data.ga_product_ids || []));
2747
- to_iterate.forEach(id => $c749fe63b72056ef$export$f522672c9379e339(id, index, gtag_options_with_click_location));
2748
- } catch (e) {
2749
- $649f456f663da9fc$export$c2363754d4758444("Something went wrong when sending gtag click tracking on a product with multiple ga_ids");
2750
- $b04e44fad5ea42c7$export$f18d5b0af29128b7(e, "error");
2751
- }
2752
- }
2753
- }), {
2754
- once: true
2755
- });
2756
- }
2757
- // Product card A2C button tracking
2758
- if (rec_a2c_selector && !a2c_tracked_els.has(elem)) {
2759
- const track_rec_a2c = async element => {
2760
- const rec_a2c_button = element.querySelector(rec_a2c_selector);
2761
- if (!rec_a2c_button) return;
2762
- const data = await get_display_data(element);
2763
- rec_a2c_button.addEventListener("click", () => {
2764
- if (rec_a2c_unbubbled) {
2765
- // If their script cancels the event before it reaches the rec card,
2766
- // we will only attribute an a2c but not a click. This is inconsistent with what we usually do.
2767
- // Create a fake click event on the main rec card,
2768
- // so our click_tracking above can send tracking for a click as well.
2769
- const click = new MouseEvent("click", {
2770
- view: window,
2771
- bubbles: true,
2772
- cancelable: true,
2773
- metaKey: true
2774
- });
2775
- element.addEventListener("click", e => (e.preventDefault(), false), {
2776
- once: true
2777
- });
2778
- element.dispatchEvent(click);
2779
- }
2780
- $c749fe63b72056ef$export$bf205937e5e012cb();
2781
- $43683b1103edab15$export$9028351cb994757e({
2782
- ...(options.t || {}),
2783
- ...options,
2784
- ...data
2785
- });
2786
- });
2787
- a2c_tracked_els.add(elem);
2788
- };
2789
- track_rec_a2c(elem);
2790
- }
2791
- if (options.shade) $d4ffde0b9fca0369$export$6ebd242c09192cec(elem);
2792
- if (options.attempt_gtag_view_tracking && Object.keys(gtag_view_product_ids)?.length)
2793
- // setTimeout to batch the requests / put it all into one gtag view event
2794
- setTimeout($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
2795
- for (const key in gtag_view_product_ids) {
2796
- const product_ids = gtag_view_product_ids[key];
2797
- if (product_ids?.length) {
2798
- $c749fe63b72056ef$export$7babcd5d4056b2ca(product_ids, () => "", {
2799
- list_name: key,
2800
- ...gtag_options
2801
- });
2802
- delete gtag_view_product_ids[key];
2803
- }
2804
- }
2805
- }));
2806
- });
2807
- if (typeof product_selector == "string") (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(product_selector, add_tracking_to_product_card);else if (product_elements && typeof product_elements?.[Symbol.iterator] == "function") for (const element of product_elements) add_tracking_to_product_card({
2808
- element: element
2809
- });else $649f456f663da9fc$export$c2363754d4758444(new Error("AIO can't find elements, try adding a selector or els")); // don't throw so that a2c tracking keeps working
2810
- // Page A2C button tracking
2811
- const a2c_handler = ({
2812
- element: element
2813
- }) => {
2814
- $91b2e49f92ed636c$export$2c34560c3749dc63(element, get_product_id, (product_id, recommendation_id, was_unmatching) => {
2815
- if (!was_unmatching) $c749fe63b72056ef$export$bf205937e5e012cb();
2816
- $43683b1103edab15$export$9028351cb994757e({
2817
- ...(options.t || {}),
2818
- ...options,
2819
- product_id: product_id,
2820
- ...(recommendation_id == "not_depict" || was_unmatching ? {
2821
- attribution_id: "recommendation"
2822
- } : {
2823
- recommendation_id: recommendation_id
2824
- })
2825
- });
2826
- }, options.always_track_a2c);
2827
- if (options.shade) $d4ffde0b9fca0369$export$6ebd242c09192cec(element);
2828
- };
2829
- if (typeof a2c_selector == "string") (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(a2c_selector, a2c_handler);else if (a2c_elements && typeof a2c_elements?.[Symbol.iterator] == "function") for (const element of a2c_elements) a2c_handler({
2830
- element: element
2831
- });else $649f456f663da9fc$export$c2363754d4758444(new Error("Can't find a2c button, try adding a selector or els"));
2832
- return {
2833
- add_a2c_element: element => a2c_handler({
2834
- element: element
2835
- }),
2836
- add_product_element: element => add_tracking_to_product_card({
2837
- element: element
2838
- })
2839
- };
2840
- });
2841
- const $d4ffde0b9fca0369$export$6ebd242c09192cec = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(element => {
2842
- element.style.boxShadow = "rgba(255,0,0,0.5) 10px 10px 30px 40px";
2843
- element.style.background = "rgba(255,0,0,0.5)";
2844
- element.style.color = "white";
2845
- });
2846
-
2847
- // not ideal but can help when debugging via sentry
2848
- /**
2849
- * A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
2850
- * @param anything Something to try to serialize - this function is crappy and your mileage may vary
2851
- * @param depth How deep to go when recursing
2852
- * @return An object that is somehow closer to text (better serializable by sentry) or text
2853
- */
2854
- function $5c4afc453f904a1f$export$39d526a1194b6499(anything, depth) {
2855
- depth ??= 0;
2856
- depth++;
2857
- if (depth > 30) return anything;
2858
- const output = {};
2859
- for (const key in anything) {
2860
- const value = anything[key];
2861
- let serialized_value;
2862
- if (value instanceof Element) serialized_value = value.cloneNode(false).outerHTML;else if (value instanceof Headers) serialized_value = Object.fromEntries(value.entries());else if (typeof value == "object" && value != null && (typeof value[Symbol.iterator] === "function" || value instanceof Response)) serialized_value = $5c4afc453f904a1f$export$39d526a1194b6499(value, depth);else serialized_value = value?.toString?.();
2863
- output[key] = serialized_value;
2864
- }
2865
- return output;
2866
- }
2867
- const $2cbe7e0ca2ce5438$export$5c069c93d2b7493f = delay => new Promise(resolve => setTimeout(resolve, delay));
2868
- async function $2d1ffbfaa1c2d9e3$export$bcd70d5ed1cf6313(url, options, max_retries = 10, useFetch = fetch) {
2869
- const ONE_MINUTE = 60000;
2870
- const max_backoff_ms = ONE_MINUTE;
2871
- const {
2872
- stack: stack
2873
- } = new Error();
2874
- const calculate_retry = delay => {
2875
- delay *= 2 + Math.random();
2876
- if (delay > max_backoff_ms) delay = max_backoff_ms * (1 + Math.random() / 10);
2877
- return delay;
2878
- };
2879
- let try_again_in_ms = 100;
2880
- let has_succeeded = false;
2881
- let result = false;
2882
- while (max_retries && !has_succeeded) try {
2883
- const response = await useFetch(url, options);
2884
- const {
2885
- status: status,
2886
- ok: ok
2887
- } = response;
2888
- if (!response || !ok || status !== 200) {
2889
- if (status >= 400 && status < 500) {
2890
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9($2d1ffbfaa1c2d9e3$var$send_sentry_4xx)(response, options?.body || {}, stack);
2891
- has_succeeded = true;
2892
- } else if (status === 404) has_succeeded = true;
2893
- $649f456f663da9fc$export$de56f1198d121036("Response not ok", response);
2894
- } else has_succeeded = true;
2895
- result = response;
2896
- } catch (error) {
2897
- $649f456f663da9fc$export$de56f1198d121036("Error while fetching: ", error, url, options);
2898
- // Don't retry CORS
2899
- if (error.message.includes("CORS") && error.name.includes("CORS")) has_succeeded = true;
2900
- } finally {
2901
- if (!has_succeeded) await $2cbe7e0ca2ce5438$export$5c069c93d2b7493f(try_again_in_ms);
2902
- try_again_in_ms = calculate_retry(try_again_in_ms);
2903
- max_retries -= 1;
2904
- }
2905
- return result;
2906
- }
2907
- async function $2d1ffbfaa1c2d9e3$var$send_sentry_4xx(response, body, stack) {
2908
- if (process.env.TENANT === "shopify-config" && response.status === 403)
2909
- // Don't send requests in the shopify admin that say we need to re-authorize to sentry
2910
- return;
2911
- const msg = `Validation error: got 4XX from API`;
2912
- const text = await response.clone().text();
2913
- $649f456f663da9fc$export$de56f1198d121036(msg, "body", body, "response", response, "text", text, "stack", stack);
2914
- (0, $eba382943196079c$export$af2e17a20c2ea3c5).withScope(function (scope) {
2915
- scope.setExtra("stack", stack);
2916
- scope.setExtra("request_body", body);
2917
- scope.setExtra("response", response);
2918
- scope.setExtra("serialized_response", $5c4afc453f904a1f$export$39d526a1194b6499(response));
2919
- scope.setExtra("response_text", text);
2920
- scope.setLevel("error");
2921
- this.captureException(new Error(msg));
2922
- });
2923
- }
2924
- async function $2d47b009af5bc0a4$export$1bc0df10745d5412(t, options, headers, get_url = $2d47b009af5bc0a4$var$default_get_fetch_url) {
2925
- const res = await $2d47b009af5bc0a4$export$d40679eb4cf32f09(t, options, headers, get_url);
2926
- return res?.displays || [];
2927
- }
2928
- async function $2d47b009af5bc0a4$export$d40679eb4cf32f09(t, options, headers, get_url = $2d47b009af5bc0a4$var$default_get_fetch_url) {
2929
- const session_id = options.session_id || $43683b1103edab15$export$61e7e1f11e96692f();
2930
- const body = {
2931
- tenant: t.tenant,
2932
- market: t.market,
2933
- session_id: session_id,
2934
- document_referrer: document.referrer,
2935
- ...options
2936
- };
2937
- const endpoint = $2d47b009af5bc0a4$var$get_fetch_endpoint_from_options(options);
2938
- return await $2d1ffbfaa1c2d9e3$export$bcd70d5ed1cf6313(get_url(endpoint), {
2939
- body: JSON.stringify(body),
2940
- ...(headers ? {
2941
- headers: headers
2942
- } : {}),
2943
- method: "POST"
2944
- }) // @ts-ignore
2945
- .then(r => r.json()).catch(e => $649f456f663da9fc$export$de56f1198d121036("fetch_retry threw", e));
2946
- }
2947
- function $2d47b009af5bc0a4$var$default_get_fetch_url(type) {
2948
- return $f564adbc4675ceaf$export$fe609f0216e4ebef(`${(0, $6c2b49f3f564b0d1$export$362abebb4b313340)}/v2/recommend/products/${type}`);
2949
- }
2950
- function $2d47b009af5bc0a4$var$get_fetch_endpoint_from_options(options) {
2951
- if (options["category_id"] !== undefined) return "category";else if (options["product_id"] !== undefined) return "product";else if (options["product_ids"] !== undefined) return "products";
2952
- return "general";
2953
- }
2954
- async function $5cbe24d064a033ed$export$a9fc160c5ed83bd7(t, rendering_options) {
2955
- // clone options to prevent nasty bugs where changes of options change the options somewhere else too
2956
- rendering_options = $5cbe24d064a033ed$export$c42139a43c877ecd(rendering_options);
2957
- const {
2958
- type: type
2959
- } = rendering_options;
2960
- const displays = await $5cbe24d064a033ed$var$make_sure_we_have_displays(t, rendering_options);
2961
- if (!displays?.length) {
2962
- $649f456f663da9fc$export$de56f1198d121036("RR: Got no displays for type " + type + ", can't recover.", t, rendering_options);
2963
- return {};
2964
- }
2965
- // return if too few displays
2966
- const {
2967
- min_items_to_run: min_items_to_run
2968
- } = rendering_options;
2969
- const good_displays = await $5cbe24d064a033ed$var$check_displays(displays, min_items_to_run).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
2970
- if (!good_displays) return {};
2971
- const processed_displays = await $5cbe24d064a033ed$export$c22e610107c5a15a(t, rendering_options, displays);
2972
- if (!processed_displays.length) {
2973
- $649f456f663da9fc$export$de56f1198d121036("RR: No displays left after preprocessing");
2974
- return {};
2975
- }
2976
- const {
2977
- template: template,
2978
- post_processors = []
2979
- } = rendering_options;
2980
- const caught_post_processing_functions = post_processors.map(post_pro => $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(post_pro));
2981
- let a;
2982
- const caught_html2elems = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9((0, $0bdb8dbcf1bc7f34$export$44951404cb8d0583));
2983
- let output_elements;
2984
- if (typeof template === "function") {
2985
- const caught_template = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(template);
2986
- output_elements = (await Promise.allSettled(processed_displays.map(async (display, index) => {
2987
- const event_listeners = [];
2988
- let keep = true;
2989
- const info = new $5cbe24d064a033ed$export$da854280fb61cd32(t, rendering_options, displays, index, () => keep = false, event_listeners);
2990
- const template_result = await caught_template(display, info);
2991
- if (!keep) throw keep;
2992
- const elements = (typeof template_result == "string" ? caught_html2elems(template_result) : template_result) || [];
2993
- const post_processed_elements = await $5cbe24d064a033ed$export$cf7cbc6b76039101(t, rendering_options, processed_displays, index, caught_post_processing_functions, elements, event_listeners);
2994
- return Array.from(post_processed_elements);
2995
- }))).filter(p => p.status === "fulfilled").map(p => p.value).flat();
2996
- // I don't want to use anything using spread since spread is a nice form of apply and
2997
- // there's a - browser engine dependant - limit of arguments that can be applied to a function
2998
- // we don't know how this will be used and want it to be robust
2999
- } else output_elements = (await Promise.all(processed_displays.map(async (display, index) => {
3000
- const html = $5cbe24d064a033ed$export$e0009e7da572f99b(template, display);
3001
- const elements = caught_html2elems(html) || [];
3002
- const post_processed_elements = await $5cbe24d064a033ed$export$cf7cbc6b76039101(t, rendering_options, processed_displays, index, caught_post_processing_functions, elements);
3003
- return Array.from(post_processed_elements);
3004
- }))).flat();
3005
- if (!output_elements.length) {
3006
- $649f456f663da9fc$export$de56f1198d121036("RR: No displays left after postprocessing/rendering");
3007
- return {};
3008
- }
3009
- return {
3010
- elements: output_elements,
3011
- displays: processed_displays
3012
- };
3013
- }
3014
- function $5cbe24d064a033ed$export$e0009e7da572f99b(template, display = {}) {
3015
- const discount_matcher = /{DISCOUNT{([\s\S]+?)}}/g;
3016
- const no_discount_matcher = /{NODISCOUNT{([\s\S]+?)}}/g;
3017
- if ("variant_index" in display) throw new Error("Modern display in ancient templating");
3018
- const {
3019
- sale_price: sale_price,
3020
- original_price: original_price
3021
- } = display;
3022
- if (sale_price !== original_price) template = template.replaceAll(discount_matcher, "$1").replaceAll(no_discount_matcher, "");else template = template.replaceAll(discount_matcher, "").replaceAll(no_discount_matcher, "$1");
3023
- // Conditional statements
3024
- // {if VAR_NAME}
3025
- // print this if true
3026
- // {else}
3027
- // print this if false
3028
- // {end}
3029
- // Note: these can't be nested. Else statement is optional
3030
- template = template.replace(/{if\s+(.+?)}([\S\s]*?)(?:{else}([\S\s]*?))?{end}/g, (_, variable, if_yes, if_no) => {
3031
- if (typeof if_no !== "string")
3032
- // if_no is a number if there's no {else} statement
3033
- if_no = "";
3034
- return display[variable] ? if_yes : if_no;
3035
- });
3036
- return template.replace(/\${(.*?)}/g, (_, g) => display[g] ?? "");
3037
- // this is copied from here, I hope I'm not breaking any licenses. Need it to transpile for IE11 compatiblity:
3038
- // https://github.com/mikemaccana/dynamic-template/blob/master/index.js
3039
- }
3040
-
3041
- function $5cbe24d064a033ed$export$c42139a43c877ecd(obj) {
3042
- if (obj && typeof obj === "object" && !(obj instanceof Promise)) {
3043
- // @ts-ignore (I don't know how to type this)
3044
- const new_obj = Object.assign(new obj.constructor(), obj);
3045
- for (const key in new_obj) if (typeof new_obj[key] === "object") new_obj[key] = $5cbe24d064a033ed$export$c42139a43c877ecd(new_obj[key]);
3046
- return new_obj;
3047
- }
3048
- return obj;
3049
- }
3050
- async function $5cbe24d064a033ed$export$cf7cbc6b76039101(t, rendering_options, displays, index, functions, elements, event_listeners = []) {
3051
- let keep = true;
3052
- const info = new $5cbe24d064a033ed$export$da854280fb61cd32(t, rendering_options, displays, index, () => keep = false, event_listeners);
3053
- for (let i = 0; i < functions.length; i++) {
3054
- const result = await functions[i](elements, displays[index], info);
3055
- if (result) elements = result;
3056
- if (!keep) break;
3057
- }
3058
- if (keep) {
3059
- for (let i = 0; i < event_listeners.length; i++) for (let j = 0; j < elements.length; j++) elements[j].addEventListener(...event_listeners[i]);
3060
- }
3061
- return keep ? elements : [];
3062
- }
3063
- async function $5cbe24d064a033ed$export$c22e610107c5a15a(t, rendering_options, displays) {
3064
- const {
3065
- max_items: max_items,
3066
- pre_processors = []
3067
- } = rendering_options;
3068
- const caught_pre_processors = pre_processors.map(pre_pro => $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(pre_pro));
3069
- const processed_displays = [];
3070
- for (let i = 0; i < displays.length; i++) {
3071
- // classic for loop is both fast and can be stopped with break
3072
- let keep = true;
3073
- const info_for_pre_pro = new $5cbe24d064a033ed$export$da854280fb61cd32(t, rendering_options, displays, i, () => keep = false);
3074
- let display = displays[i];
3075
- for (let j = 0; j < caught_pre_processors.length; j++) {
3076
- const pre_processor = caught_pre_processors[j];
3077
- const result = await pre_processor(display, info_for_pre_pro);
3078
- if (result) display = result; // Don't understand why this cast is needed
3079
- if (!keep) break;
3080
- }
3081
- if (keep) processed_displays.push(display);
3082
- if (processed_displays.length >= max_items) break;
3083
- }
3084
- return processed_displays;
3085
- }
3086
- class $5cbe24d064a033ed$export$da854280fb61cd32 {
3087
- constructor(t, rendering_options, displays, index, remove_display, event_listeners) {
3088
- // @ts-ignore Support for no-tenant recommendation rendering for js-ui/react-ui
3089
- this.t = t;
3090
- this.rendering_options = rendering_options;
3091
- this.displays = displays;
3092
- if (index != null) this.index = index;
3093
- if (remove_display) this.remove_display = remove_display;
3094
- if (event_listeners) {
3095
- this.event_listeners = event_listeners;
3096
- this.register_event_listener = (...args) => this.event_listeners.push(args);
3097
- }
3098
- }
3099
- }
3100
- async function $5cbe24d064a033ed$var$check_displays(displays, min_items_to_run) {
3101
- // don't run if too few recs
3102
- if (min_items_to_run && displays.length < min_items_to_run) {
3103
- $649f456f663da9fc$export$de56f1198d121036("RR: Got too few displays, exiting");
3104
- return false;
3105
- }
3106
- return true;
3107
- }
3108
- async function $5cbe24d064a033ed$var$make_sure_we_have_displays(t, rendering_options) {
3109
- const recs = await rendering_options.recs;
3110
- if (Array.isArray(recs)) return $5cbe24d064a033ed$export$c42139a43c877ecd(recs);
3111
- if (!t)
3112
- // No recs and no tenant, so we can't get any. Should never happen.
3113
- return [];
3114
- // get displays with get_displays if none are provided
3115
- const get_displays_options = {
3116
- type: rendering_options.type,
3117
- ...(rendering_options.extra_api_options || {})
3118
- };
3119
- for (const key of ["product_ids", "category_id", "product_id"]) if (key in rendering_options) get_displays_options[key] = rendering_options[key];
3120
- return await $2d47b009af5bc0a4$export$1bc0df10745d5412(t, get_displays_options, rendering_options.headers || {}).catch(t.err);
3121
- }
3122
- async function $f1396aa84761fbe5$export$c83d8da642b5104a(t, options, GWVM_opts) {
3123
- const {
3124
- catchify: catchify,
3125
- dlog: dlog,
3126
- is_debug: is_debug
3127
- } = t;
3128
- const {
3129
- container_selector = ".grid",
3130
- container_template: container_template,
3131
- start_rows = 1,
3132
- rows_per_click = 1,
3133
- override_rec_renderer: override_rec_renderer,
3134
- button: button,
3135
- title: title,
3136
- title_selector: title_selector,
3137
- only_full_rows = false,
3138
- should_preload = true
3139
- } = GWVM_opts;
3140
- const outer_els = typeof container_template === "string" ? [...$0bdb8dbcf1bc7f34$export$44951404cb8d0583(container_template)] : container_template;
3141
- const [root] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(outer_els, container_selector);
3142
- const cut_off_promise_obj = /*@__PURE__*/new (0, $09ff985c7c424fb3$export$32ccf3a614c84258)();
3143
- const i_observer = new IntersectionObserver(catchify($f1396aa84761fbe5$var$observer_callback));
3144
- let cut_off_point = 0;
3145
- const recs_per_row = () => typeof GWVM_opts.recs_per_row === "function" ? GWVM_opts.recs_per_row(cut_off_point) : GWVM_opts.recs_per_row ?? 6;
3146
- cut_off_point = recs_per_row() * start_rows;
3147
- const get_show_next_num = () => recs_per_row() * rows_per_click;
3148
- const preload_next_row = catchify(() => {
3149
- const preload_these = [...rendering_results.displays].slice(cut_off_point, cut_off_point + get_show_next_num());
3150
- for (const elem of preload_these) {
3151
- const img = new Image();
3152
- img.src = elem.image_url;
3153
- // Element should be garbage collected, and the image source put in cache
3154
- // https://stackoverflow.com/questions/3646036/preloading-images-with-javascript
3155
- }
3156
- });
3157
-
3158
- const load_more = catchify(num => {
3159
- const adds = typeof num == "number" ? num : get_show_next_num();
3160
- cut_off_point += adds;
3161
- cut_off_promise_obj.resolve(cut_off_point);
3162
- if ((only_full_rows ? cut_off_point + adds : cut_off_point) >= displays.length)
3163
- // TODO: make it remove/add back the button depending on viewport
3164
- load_more_cont.remove();
3165
- if (adds > 0 && should_preload) preload_next_row();
3166
- });
3167
- const our_post_pro = (elements, display, info) => $f1396aa84761fbe5$var$post_processor(elements, display, info, cut_off_point, i_observer, cut_off_promise_obj, load_more);
3168
- const rendering_results = await (override_rec_renderer || (0, $5cbe24d064a033ed$export$a9fc160c5ed83bd7))(t, {
3169
- ...options,
3170
- post_processors: [our_post_pro, ...(options.post_processors || [])]
3171
- });
3172
- const {
3173
- elements: rendered_elements,
3174
- displays: displays
3175
- } = rendering_results;
3176
- if (!rendered_elements) {
3177
- dlog("Grid with view more is stopping because it got no elements");
3178
- return rendering_results;
3179
- }
3180
- root.append(...rendered_elements);
3181
- const load_more_cont = $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787(`<div class="load-more-container"></div>`);
3182
- const button_element = button instanceof Element ? button : $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787(`<button class="load_more">${button || "Visa mer"}</button>`);
3183
- button_element.addEventListener("click", load_more);
3184
- load_more_cont.append(button_element);
3185
- root.after(load_more_cont);
3186
- if (should_preload) {
3187
- const load_more_intersection = async (entries, intersection_observer) => {
3188
- // Multiple observe calls could potentially (?) be batched into one fn call, so check everything
3189
- let intersected = false;
3190
- for (let i = 0; i < entries.length; i++) if (entries[i].isIntersecting) {
3191
- intersected = true;
3192
- break;
3193
- }
3194
- if (!intersected) return;
3195
- preload_next_row();
3196
- intersection_observer.disconnect(); // The load_more button has its own preload call, so this only needs to happen the first time.
3197
- };
3198
-
3199
- const load_more_observer = new IntersectionObserver(catchify(load_more_intersection));
3200
- load_more_observer.observe(load_more_cont);
3201
- }
3202
- if (title) {
3203
- const [title_el] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(outer_els, title_selector || "h1.title");
3204
- if (title_el) {
3205
- if (title instanceof Element) title_el.replaceWith(title);else title_el.innerText = title;
3206
- } else if (is_debug) {
3207
- console.error("GWVM: Title set but couldn't find title element. Please specify title_selector", () => {});
3208
- console.trace();
3209
- }
3210
- }
3211
- return {
3212
- ...rendering_results,
3213
- elements: outer_els,
3214
- load_more: load_more
3215
- };
3216
- }
3217
- function $f1396aa84761fbe5$var$observer_callback(entries) {
3218
- for (let i = 0; i < entries.length; i++) if (entries[i].isIntersecting) {
3219
- const target = entries[i].target;
3220
- if (!target.src?.length && target.dataset?.src?.length) {
3221
- target.src = target.dataset.src;
3222
- target.removeAttribute("data-src");
3223
- }
3224
- }
3225
- }
3226
- function $f1396aa84761fbe5$var$post_processor(elements, _,
3227
- //display: display,
3228
- info, cut_off_point, i_observer, cut_off_promise_obj, load_more) {
3229
- const {
3230
- catchify: catchify,
3231
- err: err,
3232
- dlog: dlog
3233
- } = info.t;
3234
- const {
3235
- index: index
3236
- } = info;
3237
- const elements_arr = [...elements];
3238
- const [an_element_node] = elements_arr.filter(node => node.nodeType == Node.ELEMENT_NODE);
3239
- const is_initially_hidden = index + 1 > cut_off_point;
3240
- const extras = info.extras ||= {};
3241
- extras.load_more ||= load_more;
3242
- extras.load_more_ipo ||= cut_off_promise_obj;
3243
- $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(elements_arr, "img:not(.filler):not(.ngl):not(.nolazy)").forEach(image => {
3244
- // "img" also selects "image" in IE11 which can be an SVG element which doesn't have a src property, therefore optional chaining
3245
- if ((image?.src?.length || image?.dataset?.src) && image?.src?.substr?.(0, 6) != "data:") {
3246
- if (is_initially_hidden && !image?.dataset.src) {
3247
- image.dataset.src = image.src;
3248
- image.removeAttribute("src");
3249
- }
3250
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element(an_element_node).then(catchify(el => {
3251
- if (el?.offsetParent !== null) image.src ||= image.dataset.src;else i_observer.observe(image);
3252
- }));
3253
- }
3254
- });
3255
- (async function () {
3256
- if (is_initially_hidden) for (let i = 0; i < elements_arr.length; i++) {
3257
- // HTMLElement is a lie, but TS is too dumb to understand that we check for it being a Node the line below this
3258
- const {
3259
- style: style
3260
- } = elements_arr[i];
3261
- if (style) style.display = "none";
3262
- }
3263
- while (true) {
3264
- cut_off_point = await cut_off_promise_obj.promise;
3265
- extras.load_more_currently_showing = cut_off_point;
3266
- if (index + 1 <= cut_off_point) {
3267
- for (let i = 0; i < elements_arr.length; i++) {
3268
- const {
3269
- style: style
3270
- } = elements_arr[i];
3271
- if (style) style.display = "";
3272
- }
3273
- break;
3274
- }
3275
- }
3276
- })().catch(err);
3277
- return elements;
3278
- }
3279
- async function $ea554f5a28904975$export$41de2959a8dd405d(t, options, GWVM_opts, {
3280
- rec_selector = ".rec_outer"
3281
- } = {}) {
3282
- const {
3283
- start_rows: wished_start_rows = 1
3284
- } = GWVM_opts;
3285
- const {
3286
- dlog: dlog,
3287
- err: err,
3288
- catchify: catchify
3289
- } = t;
3290
- let result;
3291
- let rec;
3292
- let first = true;
3293
- const modified_GWVM_opts = {
3294
- ...GWVM_opts,
3295
- start_rows: 1 / 6,
3296
- recs_per_row(num) {
3297
- try {
3298
- if (result?.elements && rec) {
3299
- let {
3300
- parentElement: parentElement
3301
- } = rec;
3302
- if (!parentElement) {
3303
- // first rec was removed
3304
- [rec] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(result?.elements || [], rec_selector);
3305
- parentElement = rec?.parentElement;
3306
- if (!parentElement) throw new Error("Could not find element matching " + rec_selector + "to calculate width");
3307
- }
3308
- const recs_fitting_in_row = Math.floor(parentElement.getBoundingClientRect().width / Math.floor(rec.getBoundingClientRect().width));
3309
- // this is not entirely accurate because of margins but seems to work 100% of the time for our use case
3310
- if (recs_fitting_in_row != Infinity) {
3311
- dlog("We think there are currently", recs_fitting_in_row, "columns");
3312
- const {
3313
- children: children
3314
- } = parentElement;
3315
- const last_visible = $ea554f5a28904975$var$find_last_visible(children);
3316
- if (!last_visible) {
3317
- dlog("It seems like no elements are visible, not loading any");
3318
- return 0;
3319
- }
3320
- if (num % recs_fitting_in_row !== 0) {
3321
- // X % 0 is NaN, prevent this from happening
3322
- const fill_last_row = recs_fitting_in_row === 0 ? 0 : recs_fitting_in_row - num % recs_fitting_in_row;
3323
- result.load_more?.(fill_last_row + recs_fitting_in_row * (wished_start_rows - 1));
3324
- }
3325
- // Special case for when it's the first "load more" (which is automatically triggered)
3326
- if (num === 1 && first) {
3327
- first = false;
3328
- return 0;
3329
- }
3330
- return recs_fitting_in_row;
3331
- }
3332
- }
3333
- } catch (e) {
3334
- err(e);
3335
- }
3336
- return 6;
3337
- }
3338
- };
3339
- // @ts-ignore
3340
- result = await $f1396aa84761fbe5$export$c83d8da642b5104a(t, options, modified_GWVM_opts);
3341
- if (!result?.elements)
3342
- // no chance in finding any elements, API didn't return recs
3343
- return result;
3344
- if (typeof result?.load_more == "function") (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element(rec_selector).then(() => {
3345
- // we load 1 card to be able to determine the width
3346
- // in this situation recs_per_row will not return actual recs per row but recs_to_complete_row, so we add one card to get actual recs per row
3347
- // then we remove the one card again from total calculation
3348
- result.load_more?.();
3349
- });else err("Could not find recommendation to calculate recs per row. rec_selector: " + rec_selector);
3350
- return result;
3351
- }
3352
- function $ea554f5a28904975$var$find_last_visible(items) {
3353
- for (let i = items.length - 1; i > -1; i--) {
3354
- // @ts-ignore
3355
- if (items[i]?.offsetParent !== null) return items[i];
3356
- }
3357
- }
3358
-
3359
- /**
3360
- * @deprecated use async_iterable_ipns instead. This can skip values which yields unexpected results.
3361
- */
3362
- function $92b7ea2cf75c4aec$export$55621c1ce3cd536b() {
3363
- // the idea is to have a new promise available immediately before one resolves, so to say an infinite promise
3364
- let internal_resolve; // copy and pasted from iconbeauty
3365
- const cart_promise_object = {
3366
- // I feel like Anton is not going to like this extremely awesome approach
3367
- promise: new Promise(r => internal_resolve = r),
3368
- // which is why I'm reluctant with making it a library
3369
- internal_resolve: internal_resolve,
3370
- // Edit from later on: I have realised that this is actually very useful, it just has a steep learning curve.
3371
- resolve: argument => {
3372
- // it allows both not having to call functions in a loop and instead just awaiting the promise from multiple places
3373
- const oldresolve = cart_promise_object.internal_resolve; // and to effortlessly ensure a process is never running twice with 100% reliability
3374
- cart_promise_object.promise = new Promise(r => cart_promise_object.internal_resolve = r); // it could be made a class, but I already know this works, so I'll leave it as is
3375
- oldresolve(argument);
3376
- }
3377
- };
3378
- return cart_promise_object;
3379
- }
3380
-
3381
- // import { buildThresholdList } from "../../helpers/build_threshold_list";
3382
-
3383
- async function $075589a94064cf2e$export$c0a4d29bc45a38c6(t, options, GWVM_opts, {
3384
- rec_selector = ".rec_outer"
3385
- } = {}) {
3386
- const options_for_auto_gwvm = {
3387
- ...GWVM_opts,
3388
- start_rows: 1
3389
- };
3390
- let all_rendered_elements = [];
3391
- options.post_processors = [...(options.post_processors || []), (elements, display, info) => {
3392
- all_rendered_elements.push(elements);
3393
- if (!info.index)
3394
- // the plan:
3395
- // observe first element - after dom insertion, count the visible elements and observe the last one thereof
3396
- // once it enters the view port, unobserve it
3397
- // once new elements have been loaded, count the visible elements - only once tho, in response of the first one being visible
3398
- // then attach to last element again and repeat
3399
- $075589a94064cf2e$var$observe_first_el_after_dominsertion(all_rendered_elements, elements, info.extras.load_more);
3400
- return elements;
3401
- }];
3402
- return await $ea554f5a28904975$export$41de2959a8dd405d(t, options, options_for_auto_gwvm, {
3403
- rec_selector: rec_selector
3404
- });
3405
- }
3406
- function $075589a94064cf2e$var$observe_first_el_after_dominsertion(all_rendered_elements, elements, load_more) {
3407
- const element = $075589a94064cf2e$var$find_html_element(elements);
3408
- if (!element) {
3409
- $649f456f663da9fc$export$de56f1198d121036("Infinite scroll won't work, couldn't find element to observe", elements);
3410
- return;
3411
- }
3412
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element(element).then($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
3413
- $075589a94064cf2e$var$find_last_el_and_observe(all_rendered_elements, load_more);
3414
- }));
3415
- }
3416
- function $075589a94064cf2e$var$find_last_el_and_observe(all_rendered_elements, load_more) {
3417
- const last_visible_el = $075589a94064cf2e$var$find_last_visible(all_rendered_elements);
3418
- if (!last_visible_el) return;
3419
- const i_o = new IntersectionObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(records => {
3420
- for (const record of records) if (record.isIntersecting) {
3421
- $649f456f663da9fc$export$de56f1198d121036("loading more because of", record);
3422
- load_more();
3423
- setTimeout($b04e44fad5ea42c7$export$b3bbfd758f11cfa9($075589a94064cf2e$var$find_last_el_and_observe), 0, all_rendered_elements, load_more);
3424
- i_o.disconnect();
3425
- }
3426
- }));
3427
- i_o.observe(last_visible_el);
3428
- }
3429
- function $075589a94064cf2e$var$find_html_element(elements) {
3430
- // intersection observers don't work on text nodes
3431
- let element;
3432
- for (let i = 0; !((element = elements[i++]) instanceof HTMLElement) && element;);
3433
- return element;
3434
- }
3435
- function $075589a94064cf2e$var$find_last_visible(bunch_of_elements) {
3436
- const considered_elements = bunch_of_elements.map(els => $075589a94064cf2e$var$find_html_element(els));
3437
- // this is a potentially dangerous assumption - that the visibility status of the first element is the same as all other elements, but it should be true 100% of the time right now since GWVM sets display: none uniformally and why tf would you want it differently?
3438
- for (let i = 0; i < considered_elements.length; i++) {
3439
- const respected_element = considered_elements[i];
3440
- if (!respected_element) {
3441
- $649f456f663da9fc$export$de56f1198d121036("Infinite scroll error: couldn't find last visible element", bunch_of_elements);
3442
- return;
3443
- }
3444
- if (respected_element.offsetParent === null) {
3445
- if (!i) {
3446
- // if index is 0 and we are not visible don't return the element at index -1 from the array - shit will hit the fan. Return the first one and everything should work out fine
3447
- $649f456f663da9fc$export$de56f1198d121036("Inf scroll: No elements visible, ", considered_elements, "will attach to first el", respected_element);
3448
- return considered_elements[i];
3449
- }
3450
- return considered_elements[i - 1];
3451
- }
3452
- }
3453
- $649f456f663da9fc$export$de56f1198d121036("Seems like all elements are loaded");
3454
- }
3455
- async function $efda45906c6cbac7$export$9eae832ae57fbf(t, css, extra_html) {
3456
- const head = await (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element("head"),
3457
- {
3458
- dlog: dlog
3459
- } = t,
3460
- elems = $0bdb8dbcf1bc7f34$export$44951404cb8d0583(`<style type="text/css">${css}</style>` + (extra_html ? extra_html : ""));
3461
- dlog("inserting", ...elems, "into", head);
3462
- head.append(...elems);
3463
- }
3464
- function $e867e2f1fb3bcc09$export$c7187bbd1a7a9244(...args) {
3465
- $e867e2f1fb3bcc09$var$placeholder_worker(...args).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
3466
- return args[0];
3467
- }
3468
- async function $e867e2f1fb3bcc09$var$placeholder_worker(placeholder_elements, final_elements, switching_trigger) {
3469
- let state = false;
3470
- let has_sanitized_elements = false;
3471
- const sanit_el_if_needed = async () => {
3472
- if (!has_sanitized_elements) {
3473
- has_sanitized_elements = true;
3474
- placeholder_elements = await $e867e2f1fb3bcc09$var$convert_to_node_array(placeholder_elements);
3475
- final_elements = await $e867e2f1fb3bcc09$var$convert_to_node_array(final_elements);
3476
- }
3477
- };
3478
- if (switching_trigger instanceof (0, $09ff985c7c424fb3$export$32ccf3a614c84258)) while (true) {
3479
- const new_state = await switching_trigger.promise;
3480
- if (new_state != state) {
3481
- await sanit_el_if_needed();
3482
- await $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
3483
- state = new_state;
3484
- }
3485
- } else if (switching_trigger instanceof Promise) {
3486
- const new_state = await switching_trigger;
3487
- if (state != new_state) {
3488
- await sanit_el_if_needed();
3489
- await $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
3490
- state = new_state;
3491
- }
3492
- } else {
3493
- await sanit_el_if_needed();
3494
- placeholder_elements[0].addEventListener("placeholder_switch", $511123bb28a7b6f7$export$535946eb77c946dd(async e => {
3495
- const new_state = e.detail.state;
3496
- if (state != new_state) {
3497
- await sanit_el_if_needed();
3498
- await $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, new_state);
3499
- state = new_state;
3500
- }
3501
- }));
3502
- }
3503
- }
3504
- async function $e867e2f1fb3bcc09$var$convert_to_node_array(elements) {
3505
- if (typeof elements == "function") elements = elements();
3506
- elements = await elements;
3507
- if (typeof elements[Symbol.iterator] != "function") elements = [elements];
3508
- return elements;
3509
- }
3510
- async function $e867e2f1fb3bcc09$var$decide_direction_and_switch(placeholder_elements, final_elements, switch_to_final) {
3511
- if (switch_to_final) $e867e2f1fb3bcc09$var$switch_elements(placeholder_elements, final_elements);else $e867e2f1fb3bcc09$var$switch_elements(final_elements, placeholder_elements);
3512
- }
3513
- function $e867e2f1fb3bcc09$var$switch_elements(from, to) {
3514
- if (!from.length || !to.length) $649f456f663da9fc$export$c2363754d4758444("Cannot switch elements as from or to is empty", from, to);
3515
- from[0].replaceWith(...to);
3516
- for (let i = 1; i < from.length; i++) from[i].remove();
3517
- }
3518
- class $b83068cbd26dcc41$export$3be7054c61590ee3 {
3519
- #verbose = false;
3520
- #images_on_first_page = [];
3521
- #default_lazyfinder = (() => {
3522
- const class_this = this;
3523
- return {
3524
- unload(image) {
3525
- for (const element of [image, ...$b83068cbd26dcc41$export$e4741190ccada479(image, "source")]) for (const attr of ["src", "srcset"]) {
3526
- // I spent 30 minutes on debugging and it turns out IE11 always returns undefined for HTMLImageElementWithLoaded.srcset
3527
- const attribute_value = element.getAttribute(attr);
3528
- if (attribute_value?.length) {
3529
- element.dataset[attr] = attribute_value;
3530
- element.removeAttribute(attr);
3531
- }
3532
- }
3533
- },
3534
- load: $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async image => {
3535
- for (const element of [...$b83068cbd26dcc41$export$e4741190ccada479(image, "source"), image]) {
3536
- if ("loaded" in element) {
3537
- if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036(element, "is already loading, not loading again");
3538
- continue;
3539
- }
3540
- if (document?.body?.contains?.(image) === false) {
3541
- if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036(element, "has been removed from the DOM, can't load");
3542
- const {
3543
- elements: elements
3544
- } = class_this.lazyfinder;
3545
- const index = elements.indexOf(image);
3546
- if (index >= 0) elements.splice(index, 1);
3547
- continue;
3548
- }
3549
- const has_src = element.dataset?.src?.length;
3550
- const has_srcset = element.dataset?.srcset?.length;
3551
- if (has_src || has_srcset) {
3552
- if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036("Loading", element);
3553
- element.loaded = false;
3554
- // here it's of importance that we give the browser the srcset first, otherwise it (safari) might start loading the fallback src at first
3555
- if (has_srcset) {
3556
- // in Safari for some reason sometimes the .sizes attribute isn't set yet, like in https://www.notion.so/depictai/Pictures-in-recommendations-are-not-displayed-88e30e0f98de421e94b9eb273aea21dc. In that case, wait up to one event loop execution for it
3557
- if (!element.sizes) await new Promise(resolve => {
3558
- const mo = new MutationObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(_records => {
3559
- if (element.sizes) {
3560
- resolve();
3561
- mo.disconnect();
3562
- }
3563
- }));
3564
- mo.observe(element, {
3565
- attributes: true,
3566
- attributeFilter: ["sizes"]
3567
- });
3568
- setTimeout($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
3569
- resolve(); // in case ResizeObserver doesn't set .sizes or something
3570
- mo.disconnect();
3571
- }));
3572
- });
3573
- element.setAttribute("srcset", element.dataset.srcset);
3574
- element.removeAttribute("data-srcset");
3575
- }
3576
- if (has_src) {
3577
- element.src = element.dataset.src;
3578
- element.removeAttribute("data-src");
3579
- }
3580
- class_this.intersection_observer.unobserve(element);
3581
- } else {
3582
- if (element.src?.startsWith?.("data:")) continue;
3583
- // This happens quite often for reasons unknown. One day we will figure out why, or replace this lazyloader with a new one/native.
3584
- if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036("Cannot load", element, "as it doesn't have a data-src or data-srcset attribute");
3585
- }
3586
- }
3587
- }),
3588
- get elements() {
3589
- // define ourselves away with an array containing all elements we find. Said array is "listening" and calling unload and add_load_event_listener on every pushed element
3590
- const lazyfinder_this = this;
3591
- const currently_existing = [];
3592
- Object.defineProperty(lazyfinder_this, "elements", {
3593
- value: currently_existing
3594
- });
3595
- class_this.start_observing_for_new_children_();
3596
- return currently_existing;
3597
- }
3598
- };
3599
- })();
3600
- #initiate_new_image(image) {
3601
- if (image.loaded === true || image.loaded === false) {
3602
- if (this.#verbose) $649f456f663da9fc$export$de56f1198d121036("Not lazyloading", image, "because it was loaded before or is loading");
3603
- return;
3604
- }
3605
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(this.lazyfinder.unload)(image);
3606
- this.#add_load_event_listener(image);
3607
- this.intersection_observer?.observe?.(image); // observe if observer already exists, otherwise it won't and start_observer will do it
3608
- }
1905
+ class $b83068cbd26dcc41$export$3be7054c61590ee3 {
1906
+ #verbose = false;
1907
+ #images_on_first_page = [];
1908
+ #default_lazyfinder = (() => {
1909
+ const class_this = this;
1910
+ return {
1911
+ unload(image) {
1912
+ for (const element of [image, ...$b83068cbd26dcc41$export$e4741190ccada479(image, "source")]) for (const attr of ["src", "srcset"]) {
1913
+ // I spent 30 minutes on debugging and it turns out IE11 always returns undefined for HTMLImageElementWithLoaded.srcset
1914
+ const attribute_value = element.getAttribute(attr);
1915
+ if (attribute_value?.length) {
1916
+ element.dataset[attr] = attribute_value;
1917
+ element.removeAttribute(attr);
1918
+ }
1919
+ }
1920
+ },
1921
+ load: $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async image => {
1922
+ for (const element of [...$b83068cbd26dcc41$export$e4741190ccada479(image, "source"), image]) {
1923
+ if ("loaded" in element) {
1924
+ if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036(element, "is already loading, not loading again");
1925
+ continue;
1926
+ }
1927
+ if (document?.body?.contains?.(image) === false) {
1928
+ if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036(element, "has been removed from the DOM, can't load");
1929
+ const {
1930
+ elements: elements
1931
+ } = class_this.lazyfinder;
1932
+ const index = elements.indexOf(image);
1933
+ if (index >= 0) elements.splice(index, 1);
1934
+ continue;
1935
+ }
1936
+ const has_src = element.dataset?.src?.length;
1937
+ const has_srcset = element.dataset?.srcset?.length;
1938
+ if (has_src || has_srcset) {
1939
+ if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036("Loading", element);
1940
+ element.loaded = false;
1941
+ // here it's of importance that we give the browser the srcset first, otherwise it (safari) might start loading the fallback src at first
1942
+ if (has_srcset) {
1943
+ // in Safari for some reason sometimes the .sizes attribute isn't set yet, like in https://www.notion.so/depictai/Pictures-in-recommendations-are-not-displayed-88e30e0f98de421e94b9eb273aea21dc. In that case, wait up to one event loop execution for it
1944
+ if (!element.sizes) await new Promise(resolve => {
1945
+ const mo = new MutationObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(_records => {
1946
+ if (element.sizes) {
1947
+ resolve();
1948
+ mo.disconnect();
1949
+ }
1950
+ }));
1951
+ mo.observe(element, {
1952
+ attributes: true,
1953
+ attributeFilter: ["sizes"]
1954
+ });
1955
+ setTimeout($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
1956
+ resolve(); // in case ResizeObserver doesn't set .sizes or something
1957
+ mo.disconnect();
1958
+ }));
1959
+ });
1960
+ element.setAttribute("srcset", element.dataset.srcset);
1961
+ element.removeAttribute("data-srcset");
1962
+ }
1963
+ if (has_src) {
1964
+ element.src = element.dataset.src;
1965
+ element.removeAttribute("data-src");
1966
+ }
1967
+ class_this.intersection_observer.unobserve(element);
1968
+ } else {
1969
+ if (element.src?.startsWith?.("data:")) continue;
1970
+ // This happens quite often for reasons unknown. One day we will figure out why, or replace this lazyloader with a new one/native.
1971
+ if (class_this.#verbose) $649f456f663da9fc$export$de56f1198d121036("Cannot load", element, "as it doesn't have a data-src or data-srcset attribute");
1972
+ }
1973
+ }
1974
+ }),
1975
+ get elements() {
1976
+ // define ourselves away with an array containing all elements we find. Said array is "listening" and calling unload and add_load_event_listener on every pushed element
1977
+ const lazyfinder_this = this;
1978
+ const currently_existing = [];
1979
+ Object.defineProperty(lazyfinder_this, "elements", {
1980
+ value: currently_existing
1981
+ });
1982
+ class_this.start_observing_for_new_children_();
1983
+ return currently_existing;
1984
+ }
1985
+ };
1986
+ })();
1987
+ #initiate_new_image(image) {
1988
+ if (image.loaded === true || image.loaded === false) {
1989
+ if (this.#verbose) $649f456f663da9fc$export$de56f1198d121036("Not lazyloading", image, "because it was loaded before or is loading");
1990
+ return;
1991
+ }
1992
+ $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(this.lazyfinder.unload)(image);
1993
+ this.#add_load_event_listener(image);
1994
+ this.intersection_observer?.observe?.(image); // observe if observer already exists, otherwise it won't and start_observer will do it
1995
+ }
3609
1996
 
3610
1997
  start_observing_for_new_children_(override_container) {
3611
1998
  // should ONLY run on our "stock" elements array and is therefore called if "elements" is get in it - which means it's being used
@@ -4128,535 +2515,57 @@ class $ef9394fafebd5eab$export$692b27c28639e5b9 {
4128
2515
  autoinvalidate_cache: autoinvalidate_cache
4129
2516
  }) {
4130
2517
  dist_to_hide_left && (this.dist_to_hide_left = dist_to_hide_left);
4131
- dist_to_hide_right && (this.dist_to_hide_right = dist_to_hide_right);
4132
- stepstoslide && (this.stepstoslide = stepstoslide);
4133
- center_target && (this.center_target = true);
4134
- mutation_plugins && (this.#mutation_plugins = mutation_plugins);
4135
- correct_bs_targets == false && (this.correct_bs_targets = correct_bs_targets);
4136
- if (button_elems) {
4137
- this.#elements.right_ = button_elems.right;
4138
- this.#elements.left_ = button_elems.left;
4139
- }
4140
- if (button_contents?.right) this.#elements.right_.append(...button_contents.right);
4141
- if (button_contents?.left) this.#elements.left_.append(...button_contents.left);
4142
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(this.#create_element_structure).call(this, autoinvalidate_cache);
4143
- // @ts-ignore
4144
- this.#elements.sliding_el_.slider = this; // dunno if this is dumb? So far nordicagolf/kondomvaruhuset depend on it
4145
- // plugin functionality i.e. for dots
4146
- const constructor_args = arguments;
4147
- constructor_plugins?.forEach?.(mplugin => {
4148
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(mplugin).call(this, constructor_args);
4149
- });
4150
- }
4151
- }
4152
- class $c33c6faf8acc7442$export$68babfc5be0de5da extends (0, $ef9394fafebd5eab$export$692b27c28639e5b9) {
4153
- constructor(options, lazyfier_options) {
4154
- super(options);
4155
- const lazy_promise = new Promise(r => {
4156
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(this.insert_here, ({
4157
- element: element,
4158
- disconnector: disconnector
4159
- }) => {
4160
- const i_o = new IntersectionObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(records => {
4161
- for (const record of records) if (record.intersectionRatio > 0) {
4162
- r(true);
4163
- i_o.disconnect();
4164
- disconnector();
4165
- return;
4166
- }
4167
- }),
4168
- // Fixes https://gitlab.com/depict-ai/depict.ai/-/merge_requests/5816/diffs, don't understand why
4169
- {
4170
- threshold: $9ab9ecb74920f343$export$f8ea2e7b15b5d129(10)
4171
- });
4172
- i_o.observe(element);
4173
- });
4174
- });
4175
- this.lazyfier = new (0, $b83068cbd26dcc41$export$3be7054c61590ee3)({
4176
- container: this.insert_here,
4177
- wait_for_dominsertion: lazy_promise,
4178
- ...(lazyfier_options || {})
4179
- });
4180
- }
4181
- }
4182
- const $c1503704e45e6a15$export$f37c58ab3d3e3b75 = [$c1503704e45e6a15$export$9e1caada6901f552, (0, $405969d60b37fdac$export$d0efd8ed14f5c33), $c1503704e45e6a15$export$fb9afe9f540ae069, ...(process.env.GTAG_VIEW === "true" ? [$c1503704e45e6a15$export$1bffac19f9f0d6fc] : [])];
4183
- const $c1503704e45e6a15$export$6830ae1fbe21e589 = [$c1503704e45e6a15$export$e9106d6e723510d2, $c1503704e45e6a15$export$32eb5dd18e963410, (0, $61b3c9e5f2cf8171$export$58c56fe2313fdbe3), ...(process.env.GTAG === "true" ? [$c1503704e45e6a15$export$8d72437623fef90c] : [])];
4184
- const $c1503704e45e6a15$export$ed8a68dacd075983 = /*@__PURE__*/new Map();
4185
- const $c1503704e45e6a15$export$4b50a4de9c6bbe09 = /*@__PURE__*/new WeakSet();
4186
- function $c1503704e45e6a15$export$fb9afe9f540ae069(elements, _display, info) {
4187
- if (!elements?.length) return elements;
4188
- if (!info.t) return elements;
4189
- const elements_as_array = [...elements];
4190
- const handler = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async () => {
4191
- const {
4192
- rendering_options: rendering_options,
4193
- t: t
4194
- } = info;
4195
- if (!$c1503704e45e6a15$export$4b50a4de9c6bbe09.has(rendering_options) && elements_as_array.some(e => document.documentElement.contains(e)) // check, just in case
4196
- ) {
4197
- $c1503704e45e6a15$export$4b50a4de9c6bbe09.add(rendering_options);
4198
- $43683b1103edab15$export$82badda1f9923310({
4199
- ...t,
4200
- product_id: await t.get_product_id(),
4201
- recommendation_type: info.rendering_options.type,
4202
- type: "recommendations_inserted"
4203
- });
4204
- }
4205
- });
4206
- $c1503704e45e6a15$var$push_function($c1503704e45e6a15$export$fb9afe9f540ae069, handler);
4207
- const first_el = elements_as_array?.[0];
4208
- if (first_el instanceof Node) (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element(first_el).then(handler);
4209
- return elements;
4210
- }
4211
- const $c1503704e45e6a15$export$3777a14dd8c2363d = /*@__PURE__*/new WeakSet();
4212
- function $c1503704e45e6a15$export$1bffac19f9f0d6fc(elements, _display, info) {
4213
- if (!elements?.length)
4214
- // don't make it hurt even more that rendering failed
4215
- return elements;
4216
- if (!info.t)
4217
- // GTAG tracking is deprecated, if we're doing no-tenant recommendation rendering it's SDK anyway.
4218
- return elements;
4219
- const [first_element] = elements;
4220
- const handler = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
4221
- const {
4222
- rendering_options: rendering_options,
4223
- displays: displays
4224
- } = info;
4225
- if (!$c1503704e45e6a15$export$3777a14dd8c2363d.has(displays)) {
4226
- $c1503704e45e6a15$export$3777a14dd8c2363d.add(displays);
4227
- const {
4228
- get_product_id: get_product_id
4229
- } = info.t;
4230
- const {
4231
- type: type
4232
- } = rendering_options;
4233
- $c749fe63b72056ef$export$7babcd5d4056b2ca(displays, get_product_id /* yes this might create errors if there's no page_url in the display but don't have time to fix, sorry */, {
4234
- list_name: "depict_" + type
4235
- });
4236
- }
4237
- });
4238
- $c1503704e45e6a15$var$push_function($c1503704e45e6a15$export$1bffac19f9f0d6fc, handler);
4239
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(first_element, handler);
4240
- return elements;
4241
- }
4242
- function $c1503704e45e6a15$export$9e1caada6901f552(elements, _display, info) {
4243
- const {
4244
- t: t
4245
- } = info;
4246
- if (!t) return elements;
4247
- (async () => {
4248
- $aa0140679dc70b7a$export$eee4c4d924348b05({
4249
- tenant: t.tenant,
4250
- market: t.market,
4251
- product_id: await t.get_product_id()
4252
- }).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
4253
- })();
4254
- return elements;
4255
- }
4256
- function $c1503704e45e6a15$export$8d72437623fef90c(elements, display, info) {
4257
- const handler = () => {
4258
- const {
4259
- ga_product_ids: ga_product_ids,
4260
- ga_product_id: ga_product_id,
4261
- product_id: product_id
4262
- } = display;
4263
- if (Array.isArray(ga_product_ids)) for (let i = 0; i < ga_product_ids.length; i++) $c749fe63b72056ef$export$f522672c9379e339(ga_product_ids[i], info.index, {
4264
- list_name: "depict_" + info.rendering_options.type
4265
- });else $c749fe63b72056ef$export$f522672c9379e339(ga_product_id || product_id, info.index, {
4266
- list_name: "depict_" + info.rendering_options.type
4267
- });
4268
- };
4269
- $c1503704e45e6a15$var$push_function($c1503704e45e6a15$export$8d72437623fef90c, handler);
4270
- info.register_event_listener("click", handler, {
4271
- once: true
4272
- });
4273
- return elements;
4274
- }
4275
- function $c1503704e45e6a15$export$e9106d6e723510d2(elements, display, info) {
4276
- const handler = () => {
4277
- const {
4278
- t: t,
4279
- index: index,
4280
- rendering_options: rendering_options
4281
- } = info;
4282
- return $43683b1103edab15$export$15f8a0cd5a8c0ebb({
4283
- ...t,
4284
- ...rendering_options,
4285
- ...display,
4286
- click_location: rendering_options.type + "_" + (index + 1),
4287
- recommendation_type: rendering_options.type,
4288
- product_id: "variant_index" in display ? display.variant_displays[display.variant_index].product_id : display.product_id
4289
- });
4290
- };
4291
- $c1503704e45e6a15$var$push_function($c1503704e45e6a15$export$e9106d6e723510d2, handler);
4292
- info.register_event_listener("click", handler, {
4293
- once: true
4294
- });
4295
- return elements;
4296
- }
4297
- function $c1503704e45e6a15$export$32eb5dd18e963410(elements, display, info) {
4298
- const {
4299
- search_result_id: search_result_id
4300
- } = display;
4301
- const {
4302
- product_id: product_id,
4303
- recommendation_id: recommendation_id
4304
- } = "variant_index" in display ? display.variant_displays[display.variant_index] : display;
4305
- if (!elements?.length) return elements;
4306
- for (const element of elements) {
4307
- const handler = $91b2e49f92ed636c$export$82a685f2da2fb027(element, product_id, recommendation_id || search_result_id);
4308
- if (handler) $c1503704e45e6a15$var$push_function($c1503704e45e6a15$export$32eb5dd18e963410, handler);
4309
- }
4310
- return elements;
4311
- }
4312
- function $c1503704e45e6a15$export$dd32cb565eae0a1f(elements, display, info) {
4313
- const handler = () => {
4314
- $c749fe63b72056ef$export$127751e82111fcf();
4315
- };
4316
- $c1503704e45e6a15$var$push_function($c1503704e45e6a15$export$dd32cb565eae0a1f, handler);
4317
- info.register_event_listener("click", handler, {
4318
- once: true
4319
- });
4320
- return elements;
4321
- }
4322
- function $c1503704e45e6a15$var$push_function(fn1, handler) {
4323
- const fn_array = $c1503704e45e6a15$export$ed8a68dacd075983.get(fn1) || [];
4324
- fn_array.push(new WeakRef(handler));
4325
- $c1503704e45e6a15$export$ed8a68dacd075983.set(fn1, fn_array);
4326
- }
4327
- const $893f9af5dbae6bc8$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/localStorage.getItem("colorize-logics") === "true";
4328
- function $893f9af5dbae6bc8$export$16501883f477737a(elements, display) {
4329
- elements.forEach(elem => {
4330
- if (elem.nodeType !== Node.TEXT_NODE) {
4331
- // calc a hash for given string
4332
- const hc = (str = "") => {
4333
- let hash = 0;
4334
- if (str.length === 0) return hash;
4335
- for (let i = 0; i < str.length; i++) {
4336
- const chr = str.charCodeAt(i);
4337
- hash = (hash << 5) - hash + chr;
4338
- hash |= 0;
4339
- }
4340
- return hash;
4341
- };
4342
- const hash = hc(display.logic);
4343
- // Change hue based on hash
4344
- const color = "hsl(" + hash % 360 + ",100%,75%)";
4345
- if ("style" in elem) elem.style.background = color;
4346
- // @ts-ignore
4347
- elem?.setAttribute?.("data-logic", display.logic);
4348
- // @ts-ignore
4349
- elem?.setAttribute?.("title", "Logic: " + display.logic);
4350
- }
4351
- });
4352
- return elements;
4353
- }
4354
- var $6be99244fa573db5$export$2e2bcd8739ae039 = $6be99244fa573db5$export$50ce83ace0cdd87e;
4355
- async function $6be99244fa573db5$export$50ce83ace0cdd87e(t, rendering_options) {
4356
- const {
4357
- view_tracking: view_tracking,
4358
- click_tracking: click_tracking
4359
- } = rendering_options;
4360
- return await $5cbe24d064a033ed$export$a9fc160c5ed83bd7(t, {
4361
- ...rendering_options,
4362
- headers: {
4363
- ...((0, $893f9af5dbae6bc8$export$deca40f48c0569f8) ? {
4364
- "x-debug": "true"
4365
- } : {}),
4366
- ...(rendering_options.headers || {})
4367
- },
4368
- pre_processors: [...(rendering_options.pre_processors || [])],
4369
- post_processors: [...(Array.isArray(view_tracking) ? view_tracking : (0, $c1503704e45e6a15$export$f37c58ab3d3e3b75)), ...(Array.isArray(click_tracking) ? click_tracking : (0, $c1503704e45e6a15$export$6830ae1fbe21e589)), ...((0, $893f9af5dbae6bc8$export$deca40f48c0569f8) ? [(0, $893f9af5dbae6bc8$export$16501883f477737a)] : []), ...(rendering_options.post_processors || [])]
4370
- });
4371
- }
4372
- async function $7e2d59b061c2c528$export$cab8bc58c64c2013(t, rendering_options, options_for_us, slider_options) {
4373
- options_for_us ||= {};
4374
- const {
4375
- root_selector: root_selector,
4376
- override_rec_renderer: local_rr = (0, $6be99244fa573db5$export$2e2bcd8739ae039),
4377
- insertion_verb = "replaceWith",
4378
- lazyfier_options: lazyfier_options
4379
- } = options_for_us;
4380
- let {
4381
- container: container
4382
- } = options_for_us;
4383
- if (typeof container == "string") container = [...$0bdb8dbcf1bc7f34$export$44951404cb8d0583(container)];
4384
- if (container && !Array.isArray(container)) container = [...container];
4385
- const slider = new (0, $c33c6faf8acc7442$export$68babfc5be0de5da)({
4386
- dist_to_hide_left: 10,
4387
- dist_to_hide_right: 10,
4388
- ...slider_options
4389
- }, lazyfier_options);
4390
- const recs = await local_rr(t, {
4391
- ...rendering_options,
4392
- post_processors: [(elements, display) => {
4393
- $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(elements, ".rec_outer").forEach(ro => ro.classList.add("noautospacing"));
4394
- return elements;
4395
- }, ...(rendering_options.post_processors || [])]
4396
- });
4397
- if (!recs.elements) {
4398
- $649f456f663da9fc$export$de56f1198d121036("Pro_Slider says bye bye cuz no recs");
4399
- return {};
4400
- }
4401
- slider.insert_here.append(...recs.elements);
4402
- if (container) {
4403
- const [root] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(container, root_selector || ".grid");
4404
- root[insertion_verb](slider.container);
4405
- }
4406
- return {
4407
- ...recs,
4408
- displays: recs.displays,
4409
- elements: container ? container : [slider.container]
4410
- };
4411
- }
4412
- const $366fff12da348e66$var$discountMatcher = /{DISCOUNT{([\s\S]+?)}}/g;
4413
- const $366fff12da348e66$var$noDiscountMatcher = /{NODISCOUNT{([\s\S]+?)}}/g;
4414
- let $366fff12da348e66$var$pageview_sent = false;
4415
- class $366fff12da348e66$export$1a8782481a9af507 {
4416
- constructor(settings) {
4417
- this.settings = settings;
4418
- }
4419
- #dispatched_recs_inserted = false;
4420
- init(callback, existingDisplays) {
4421
- if (!this.settings.DNT) this.trackPageView();
4422
- if (!existingDisplays) this.loadRecommendations(callback);else {
4423
- this.data = existingDisplays;
4424
- callback();
4425
- }
4426
- }
4427
- loadRecommendations(callback) {
4428
- const {
4429
- tenant: tenant,
4430
- product_id: product_id,
4431
- type: type,
4432
- market: market
4433
- } = this.settings;
4434
- $2d47b009af5bc0a4$export$1bc0df10745d5412(
4435
- // @ts-ignore - Quick workaround, as we don't have a tenant object here
4436
- {
4437
- tenant: tenant,
4438
- market: market
4439
- }, {
4440
- type: type,
4441
- product_id: product_id()
4442
- }).then(recs => {
4443
- this.data = recs;
4444
- $66b898e9bfcef532$export$8582cf3716962dc2({
4445
- ...this.settings,
4446
- recs: this.data,
4447
- min_recs: this.settings.min_items || this.settings.max_items
4448
- });
4449
- }).catch(e => {
4450
- if (this.settings.debug) console.warn("template-tool: error fetching: ", e);
4451
- }).finally(() => callback());
4452
- }
4453
- trackGAEvent(action, index, product_id, ga_product_ids) {
4454
- if (this.settings.sendGa === false) return;
4455
- // @ts-ignore
4456
- if (typeof ga !== "function") {
4457
- console.log("Could not send", action, "to GA. analytics.js not loaded.");
4458
- return;
4459
- }
4460
- if (!action || action instanceof Event) action = "rec_bar_click";
4461
- if (action == "rec_bar_click" && typeof index != "undefined" && product_id) {
4462
- if (Array.isArray(ga_product_ids)) for (const id of ga_product_ids) $c749fe63b72056ef$export$f522672c9379e339(id, index, {
4463
- list_name: "depict_" + this.settings.type
4464
- });else $c749fe63b72056ef$export$f522672c9379e339(product_id, index, {
4465
- list_name: "depict_" + this.settings.type
4466
- });
4467
- }
4468
- if (this.tracker === undefined)
4469
- // @ts-ignore
4470
- this.tracker = ga("create", this.settings.gaid, "auto", "depict");
4471
- $c749fe63b72056ef$export$f75172d2e289cd02(action);
4472
- }
4473
- trackPageView() {
4474
- if ($366fff12da348e66$var$pageview_sent) {
4475
- if (this.settings.debug) console.log("template-tool: not sending page view tracking to depict as it has already been sent");
4476
- return;
2518
+ dist_to_hide_right && (this.dist_to_hide_right = dist_to_hide_right);
2519
+ stepstoslide && (this.stepstoslide = stepstoslide);
2520
+ center_target && (this.center_target = true);
2521
+ mutation_plugins && (this.#mutation_plugins = mutation_plugins);
2522
+ correct_bs_targets == false && (this.correct_bs_targets = correct_bs_targets);
2523
+ if (button_elems) {
2524
+ this.#elements.right_ = button_elems.right;
2525
+ this.#elements.left_ = button_elems.left;
4477
2526
  }
4478
- $366fff12da348e66$var$pageview_sent = true;
4479
- const {
4480
- product_id: product_id
4481
- } = this.settings;
4482
- $aa0140679dc70b7a$export$eee4c4d924348b05(typeof product_id === "function" ? product_id() : product_id);
4483
- }
4484
- trackClick(index) {
4485
- const item = this.data[index];
4486
- if (item === undefined) return;
4487
- return $43683b1103edab15$export$15f8a0cd5a8c0ebb({
4488
- ...this.settings,
4489
- ...item,
4490
- click_location: `${this.settings.type}_${index + 1}`,
4491
- product_id: item.product_id || this.settings.product_id(item.page_url)
4492
- });
4493
- }
4494
- trackAddToCart(pId) {
4495
- return $43683b1103edab15$export$9028351cb994757e({
4496
- ...this.settings,
4497
- product_id: pId && !(pId instanceof Event) ? pId : this.settings.product_id()
2527
+ if (button_contents?.right) this.#elements.right_.append(...button_contents.right);
2528
+ if (button_contents?.left) this.#elements.left_.append(...button_contents.left);
2529
+ $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(this.#create_element_structure).call(this, autoinvalidate_cache);
2530
+ // @ts-ignore
2531
+ this.#elements.sliding_el_.slider = this; // dunno if this is dumb? So far nordicagolf/kondomvaruhuset depend on it
2532
+ // plugin functionality i.e. for dots
2533
+ const constructor_args = arguments;
2534
+ constructor_plugins?.forEach?.(mplugin => {
2535
+ $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(mplugin).call(this, constructor_args);
4498
2536
  });
4499
2537
  }
4500
- createContainer(root, container, prepend = false) {
4501
- function htmlToElements(html) {
4502
- const template = document.createElement("template");
4503
- template.innerHTML = html;
4504
- return template.content.childNodes;
4505
- }
4506
- const elements = Array.from(htmlToElements(container));
4507
- if (prepend) {
4508
- elements.reverse();
4509
- for (const el of elements) root.prepend(el);
4510
- } else for (const el of elements) root.appendChild(el);
4511
- }
4512
- renderTemplate({
4513
- prep: prep,
4514
- root: root,
4515
- template: template,
4516
- itemPreprocessor: itemPreprocessor,
4517
- itemPostprocessor: itemPostprocessor
4518
- } = this.settings) {
4519
- if (document._depict_modify !== true) {
4520
- if (this.settings.debug) console.warn("Template-tool: not running because document._depict_modify is false!", this);
4521
- return;
4522
- }
4523
- if (!this.data) return;
4524
- const product_id_at_rendering = this.settings.product_id();
4525
- if (typeof prep === "function") prep();
4526
- const interpolator = t => {
4527
- return function (item) {
4528
- // Conditional statements
4529
- // {if VAR_NAME}
4530
- // print this if true
4531
- // {else}
4532
- // print this if false
4533
- // {end}
4534
- // Note: these can't be nested
4535
- t = t.replace(/{if\s+(.+?)}([\S\s]*?)(?:{else}([\S\s]*?))?{end}/g, (_, variable, if_yes, if_no) => {
4536
- if (typeof if_no !== "string")
4537
- // if_no is a number if there's no {else} statement
4538
- if_no = "";
4539
- return item[variable] ? if_yes : if_no;
4540
- });
4541
- return t.replace(/\${(.*?)}/g, (_, g) => item[g]); // this is copied from here, I hope I'm not breaking any licenses. Need it to transpile for IE11 compatiblity: https://github.com/mikemaccana/dynamic-template/blob/master/index.js
4542
- // if you need variables that go over multiple lines:
4543
- // const matcher = /\${([^}]+)}/g;
4544
- };
4545
- };
4546
-
4547
- const elementsFromHTML = html => new DOMParser().parseFromString(html, "text/html").body.children;
4548
- const getContent = () => {
4549
- const recsArray = [];
4550
- const resultingElements = [];
4551
- this.data.forEach((item, rec_index) => {
4552
- if (typeof itemPreprocessor === "function") {
4553
- item = itemPreprocessor(item, rec_index);
4554
- if (!Object.keys(item).length) {
4555
- if (this.settings.debug) console.info("template-tool: discarding display", item, "because it is empty");
2538
+ }
2539
+ class $c33c6faf8acc7442$export$68babfc5be0de5da extends (0, $ef9394fafebd5eab$export$692b27c28639e5b9) {
2540
+ constructor(options, lazyfier_options) {
2541
+ super(options);
2542
+ const lazy_promise = new Promise(r => {
2543
+ (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(this.insert_here, ({
2544
+ element: element,
2545
+ disconnector: disconnector
2546
+ }) => {
2547
+ const i_o = new IntersectionObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(records => {
2548
+ for (const record of records) if (record.intersectionRatio > 0) {
2549
+ r(true);
2550
+ i_o.disconnect();
2551
+ disconnector();
4556
2552
  return;
4557
2553
  }
4558
- }
4559
- if (recsArray.length >= this.settings.max_items) return;
4560
- recsArray.push(item);
4561
- let itemTemplate;
4562
- if (item.sale_price !== item.original_price) {
4563
- itemTemplate = template.replaceAll($366fff12da348e66$var$discountMatcher, "$1").replaceAll($366fff12da348e66$var$noDiscountMatcher, "");
4564
- item.discount = `\u{2013}${Math.round(100 * (1 - item.sale_price / item.original_price))}%`;
4565
- } else {
4566
- itemTemplate = template.replaceAll($366fff12da348e66$var$discountMatcher, "").replaceAll($366fff12da348e66$var$noDiscountMatcher, "$1");
4567
- item.discount = "";
4568
- }
4569
- const resultHTML = interpolator(itemTemplate)(item);
4570
- let elements = elementsFromHTML(resultHTML);
4571
- if (!this.settings.DNT) for (const element of elements) {
4572
- // recommendations_inserted event
4573
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).oncreation(element, () => {
4574
- if (!this.#dispatched_recs_inserted) {
4575
- this.#dispatched_recs_inserted = true;
4576
- $43683b1103edab15$export$82badda1f9923310({
4577
- ...this.settings,
4578
- product_id: product_id_at_rendering,
4579
- recommendation_type: this.settings.type,
4580
- type: "recommendations_inserted"
4581
- });
4582
- }
4583
- });
4584
- const listener = e => {
4585
- this.trackClick(rec_index);
4586
- this.trackGAEvent("rec_bar_click", rec_index, item.ga_product_id || item.product_id || this.settings.product_id(item.page_url), item.ga_product_ids);
4587
- };
4588
- element.addEventListener("click", listener);
4589
- $91b2e49f92ed636c$export$82a685f2da2fb027(element, item.product_id, item.recommendation_id);
4590
- if (this.settings.shade) $d4ffde0b9fca0369$export$6ebd242c09192cec(element);
4591
- // @ts-ignore
4592
- if (!element.depict_event_listeners)
4593
- // @ts-ignore
4594
- element.depict_event_listeners = [];
4595
- // @ts-ignore
4596
- element.depict_event_listeners.push(listener);
4597
- }
4598
- if (typeof itemPostprocessor === "function") elements = itemPostprocessor(elements, item);
4599
- resultingElements.push(...elements);
4600
- });
4601
- this.data = recsArray;
4602
- if (!this.settings.DNT) $c749fe63b72056ef$export$7babcd5d4056b2ca(recsArray, this.settings.product_id, {
4603
- list_name: "depict_" + this.settings.type
2554
+ }),
2555
+ // Fixes https://gitlab.com/depict-ai/depict.ai/-/merge_requests/5816/diffs, don't understand why
2556
+ {
2557
+ threshold: $9ab9ecb74920f343$export$f8ea2e7b15b5d129(10)
2558
+ });
2559
+ i_o.observe(element);
4604
2560
  });
4605
- return resultingElements;
4606
- };
4607
- const renderedContent = getContent();
4608
- if (typeof root === "function") {
4609
- if (this.settings.loadHack === true) {
4610
- const SLEEP_TIME_MS = 50;
4611
- let MAX_RETRY = Math.round(10000 / SLEEP_TIME_MS);
4612
- const tick = setInterval(() => {
4613
- const r = root();
4614
- if (MAX_RETRY === 0) clearInterval(tick);
4615
- MAX_RETRY--;
4616
- if (r !== null) {
4617
- r.append(...renderedContent);
4618
- clearInterval(tick);
4619
- }
4620
- }, SLEEP_TIME_MS);
4621
- } else if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", () => {
4622
- const r = root();
4623
- r.append(...renderedContent);
4624
- }, {
4625
- once: true
4626
- });else {
4627
- const r = root();
4628
- r.append(...renderedContent);
4629
- }
4630
- return;
4631
- }
4632
- root.append(...renderedContent);
2561
+ });
2562
+ this.lazyfier = new (0, $b83068cbd26dcc41$export$3be7054c61590ee3)({
2563
+ container: this.insert_here,
2564
+ wait_for_dominsertion: lazy_promise,
2565
+ ...(lazyfier_options || {})
2566
+ });
4633
2567
  }
4634
2568
  }
4635
- var
4636
- /**
4637
- * @deprecated Please use RecommendationRenderer instead
4638
- */
4639
- $51bbc74e39f5e5c6$export$2e2bcd8739ae039 = async options => {
4640
- const depict = new (0, $366fff12da348e66$export$1a8782481a9af507)(options.options),
4641
- done = new Promise(itsdone => {
4642
- document._depict_modify = true;
4643
- depict.init(() => {
4644
- depict.renderTemplate({
4645
- itemPostprocessor: options.postProcessor,
4646
- itemPreprocessor: options.preProcessor,
4647
- root: options.root,
4648
- template: options.template
4649
- });
4650
- itsdone();
4651
- }, options.recs);
4652
- });
4653
- await done;
4654
- return depict;
4655
- };
4656
-
4657
- // @ts-ignore
4658
- var $413613e86d0ffb68$exports = {};
4659
- $413613e86d0ffb68$exports = ".depict .rec_outer.noautospacing {\n width: 6cm;\n max-width: 46vw;\n margin-left: 1%;\n margin-right: 1%;\n}\n\n.depict .rec_outer.noautospacing:nth-child(1) {\n margin-left: 0;\n}\n\n.depict .rec_outer.noautospacing:nth-last-child(1) {\n margin-right: 0;\n}\n\n.depict-slider .slider_snap {\n scroll-snap-type: x mandatory;\n}\n\n.depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n margin-top: -1%;\n margin-bottom: -2%;\n padding-top: 1%;\n padding-bottom: 2%;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n.depict-slider button.right {\n right: 0;\n}\n\n.depict-slider button.left, .depict-slider button.right {\n z-index: 2;\n touch-action: manipulation;\n width: 1cm;\n height: 1cm;\n cursor: pointer;\n background: #fff;\n border: none;\n padding: .5%;\n transition-duration: .2s;\n position: absolute;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.depict-slider button.left.hidden, .depict-slider button.right.hidden {\n opacity: 0;\n cursor: default;\n}\n\n.depict-slider button.left {\n left: 0;\n transform: translateY(-50%)rotate(180deg);\n}\n\n.depict-slider button.left img, .depict-slider button.right img {\n width: 100%;\n height: 100%;\n}\n\n.depict-slider .rec_outer {\n margin-top: 0 !important;\n}\n\n";
4660
2569
  const $762a881271a51d1b$var$default_image_src = "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhLS0gR2VuZXJhdG9yOiBBZG9iZSBJbGx1c3RyYXRvciAyMy4wLjYsIFNWRyBFeHBvcnQgUGx1Zy1JbiAuIFNWRyBWZXJzaW9uOiA2LjAwIEJ1aWxkIDApICAtLT4NCjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHZpZXdCb3g9IjAgMCAxNiAxNiIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTYgMTY7IiB4bWw6c3BhY2U9InByZXNlcnZlIj4NCjxwb2x5Z29uIHBvaW50cz0iOSwyLjYgOC4zLDMuNCAxMi40LDcuNSAxLjYsNy41IDEuNiw4LjUgMTIuNCw4LjUgOC4zLDEyLjYgOSwxMy40IDE0LjQsOCAiLz4NCjwvc3ZnPg0K";
4661
2570
  class $762a881271a51d1b$export$4d41c6499d53639c extends (0, $c33c6faf8acc7442$export$68babfc5be0de5da) {
4662
2571
  constructor(static_options, override_lazyfier_options) {
@@ -4690,229 +2599,26 @@ function $762a881271a51d1b$export$f1b8b9fd75ddcab1(slider) {
4690
2599
  style_elem.append((0, /*@__PURE__*/$parcel$interopDefault($413613e86d0ffb68$exports)));
4691
2600
  slider.container.appendChild(style_elem);
4692
2601
  }
4693
- async function $e61f371a9bcdeb2f$export$cd12721587f4f16d(t, rendering_options, options_for_us, slider_options, override_lazyfier_options) {
4694
- options_for_us ||= {};
4695
- const {
4696
- dlog: dlog,
4697
- catchify: catchify
4698
- } = t;
4699
- const {
4700
- root_selector: root_selector,
4701
- Rec_Renderer: local_rr = (0, $6be99244fa573db5$export$2e2bcd8739ae039),
4702
- insertion_verb = "replaceWith"
4703
- } = options_for_us;
4704
- let {
4705
- container: container
4706
- } = options_for_us;
4707
- if (typeof container == "string") container = [...$0bdb8dbcf1bc7f34$export$44951404cb8d0583(container)];
4708
- if (container && !Array.isArray(container)) container = [...container];
4709
- const slider = new (0, $762a881271a51d1b$export$4d41c6499d53639c)({
4710
- dlog: dlog,
4711
- catchify: catchify,
4712
- dist_to_hide_left: 6,
4713
- dist_to_hide_right: 6,
4714
- ...slider_options
4715
- }, override_lazyfier_options);
4716
- const recs = await local_rr(t, {
4717
- ...rendering_options,
4718
- post_processors: [(elements, display) => {
4719
- $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(elements, "a.rec_outer").forEach(ro => ro.classList.add("noautospacing"));
4720
- return elements;
4721
- }, ...(rendering_options.post_processors || [])]
4722
- });
4723
- if (!recs.elements) {
4724
- dlog("RR_Slider says bye bye cuz no recs");
4725
- return {};
4726
- }
4727
- slider.insert_here.append(...recs.elements);
4728
- if (container) {
4729
- const [root] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(container, root_selector || ".grid");
4730
- root[insertion_verb](slider.container);
4731
- }
4732
- return {
4733
- ...recs,
4734
- displays: recs.displays,
4735
- elements: container ? container : [slider.container]
4736
- };
4737
- }
4738
- var $d352a8202024de5c$var$_tmpl$ = /*#__PURE__*/$qgKv4$template(`<button class=load_more>`);
4739
- async function $d352a8202024de5c$export$30933c637c977eef({
4740
- t: t,
4741
- recs: recs,
4742
- title: title,
4743
- infinite_scroll = false,
4744
- with_slider = false,
4745
- with_loadmore = false,
4746
- template_tool_options: template_tool_options,
4747
- slider_options = {},
4748
- pre_processors = [],
4749
- post_processors = [],
4750
- container_template: container_template,
4751
- template:
4752
- // container template
4753
- template,
4754
- // recommendation template
4755
- chunk_size_for_load_more = 4,
4756
- insertion_promise: insertion_promise,
4757
- view_more_text: view_more_text
4758
- }) {
4759
- const {
4760
- catchify: catchify,
4761
- dlog: dlog
4762
- } = t,
4763
- container = [...$0bdb8dbcf1bc7f34$export$44951404cb8d0583(container_template)],
4764
- root = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(container, ".grid")[0],
4765
- internal_pre_processors = [...pre_processors],
4766
- // copy arrays so we don't unintentionally modify an array of a script calling us when doing auto postprocessor for slider if insertion_promise is defined
4767
- internal_post_processors = [...post_processors];
4768
- if (with_slider) var slider = catchify(() => new (0, $762a881271a51d1b$export$4d41c6499d53639c)({
4769
- ...t,
4770
- arrow_image: "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHN0eWxlPSJkaXNwbGF5OiBpbmxpbmUtYmxvY2s7IHZlcnRpY2FsLWFsaWduOiBtaWRkbGU7IiB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4IiB2aWV3Qm94PSIwIDAgOCAxNSI+PHBhdGggc3R5bGU9ImZpbGw6IHJnYigwLCAwLCAwKTsiIGQ9Ik0uNjI5LjAwMWMuMTUuMDA4LjI5My4wNzIuMzk4LjE4bDYuNzkyIDYuODlhLjYwMS42MDEgMCAwIDEgMCAuODZsLTYuNzkyIDYuODg4YS41ODYuNTg2IDAgMCAxLS44NDYgMCAuNjAxLjYwMSAwIDAgMSAwLS44Nkw2LjU1NCA3LjUuMjExIDEuMDAxYS42MDEuNjAxIDAgMCAxIDAtLjg2Yy4xMTUtLjEuMjY2LS4xNS40MTgtLjE0Ij48L3BhdGg+PC9zdmc+",
4771
- ...slider_options
4772
- }))();
4773
- if (slider) {
4774
- root.replaceWith(slider.container);
4775
- if (insertion_promise) internal_post_processors.push((t, items, d) => {
4776
- for (const item of items) insertion_promise.then(() => {
4777
- $21285393646b9849$export$37125ccc5dd98050({
4778
- element: item,
4779
- data: {
4780
- tenant: t.tenant,
4781
- entity_price: d.entity_price,
4782
- recommendation_id: d.recommendation_id,
4783
- market: t.market,
4784
- product_id: d.product_id,
4785
- recommendation_type: d.recommendation_type
4786
- },
4787
- wait_for_dom_insertion: false
4788
- });
4789
- });
4790
- return items;
4791
- });
4792
- }
4793
- if (!slider || !insertion_promise) internal_post_processors.push((t, items, d) => {
4794
- for (const item of items) $21285393646b9849$export$37125ccc5dd98050({
4795
- element: item,
4796
- data: {
4797
- tenant: t.tenant,
4798
- entity_price: d.entity_price,
4799
- recommendation_id: d.recommendation_id,
4800
- market: t.market,
4801
- product_id: d.product_id,
4802
- recommendation_type: d.recommendation_type
4803
- },
4804
- wait_for_dom_insertion: false
4805
- });
4806
- return items;
4807
- });
4808
- const template_tool = await $51bbc74e39f5e5c6$export$2e2bcd8739ae039({
4809
- options: {
4810
- ...t,
4811
- ...(template_tool_options || {})
4812
- },
4813
- root: slider ? slider.insert_here : root,
4814
- recs: recs,
4815
- template: template,
4816
- preProcessor: (d, i) => {
4817
- return internal_pre_processors.reduce((accumulator, currentValue) => {
4818
- // basic pre processor pipeline
4819
- return catchify(currentValue)(t, accumulator, i, with_loadmore, with_slider, infinite_scroll) || accumulator;
4820
- }, d);
4821
- },
4822
- postProcessor: (items, d) => {
4823
- return internal_post_processors.reduce((accumulator, currentValue) => {
4824
- // basic post processor pipeline
4825
- return catchify(currentValue)(t, accumulator, d, slider) || accumulator;
4826
- }, items);
4827
- }
4828
- });
4829
- if (with_loadmore) catchify($d352a8202024de5c$var$setup_load_more)(t, root, chunk_size_for_load_more, view_more_text);
4830
- if (infinite_scroll) catchify($d352a8202024de5c$var$setup_infinite_scroll)(t, root);
4831
- if (title) {
4832
- const [title_element] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(container, "h1.title, h2.title, h3.title, h4.title, h5.title, h6.title");
4833
- if (title_element) {
4834
- if (typeof title == "string") title_element.innerText = title;else title_element.replaceWith(...title);
4835
- }
4836
- }
4837
- if (template_tool?.data?.length) return container;else dlog("Didn't get recs from API", template_tool);
4838
- }
4839
- function $d352a8202024de5c$var$setup_infinite_scroll(t, root) {
4840
- const {
4841
- dlog: dlog,
4842
- catchify: catchify
4843
- } = t,
4844
- get_last_visible_el = () => [...root.querySelectorAll("a.rec_outer:not(.not_visible)")].slice(-1)[0],
4845
- last_visible_el = get_last_visible_el();
4846
- if (!last_visible_el) {
4847
- dlog("not setting up infinite scroll as there are no elements");
4848
- return;
4849
- }
4850
- const intersection_observer = new IntersectionObserver(catchify(records => {
4851
- dlog("Intersection observer for", last_visible_el, "has records", records);
4852
- records.forEach(record => {
4853
- if (record.isIntersecting && record.target == get_last_visible_el()) {
4854
- dlog("Loading more recs because of", record);
4855
- if ($d352a8202024de5c$var$load_more_elements(root)) $d352a8202024de5c$var$setup_infinite_scroll(t, root);
4856
- }
4857
- });
4858
- }));
4859
- dlog("starting to intersection observe", last_visible_el, "for infinite scroll");
4860
- intersection_observer.observe(last_visible_el);
4861
- }
4862
- function $d352a8202024de5c$var$load_more_elements(root, chunk_size = 4) {
4863
- const hidden_elements = root.querySelectorAll("a.rec_outer.not_visible");
4864
- let i = 0;
4865
- for (; i < Math.min(hidden_elements.length, chunk_size); i++) {
4866
- // @ts-ignore
4867
- hidden_elements[i].load_image();
4868
- hidden_elements[i].classList.remove("not_visible");
4869
- }
4870
- const has_more = i >= chunk_size && hidden_elements.length > chunk_size;
4871
- return has_more;
4872
- }
4873
- function $d352a8202024de5c$var$setup_load_more(t, root, chunk_size, view_more_text = "Visa mer") {
4874
- const {
4875
- catchify: catchify
4876
- } = t,
4877
- load_more_cont = $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787(`<div class="load-more-container"></div>`),
4878
- load_button = load_more_cont.appendChild((() => {
4879
- var _el$ = $qgKv4$getNextElement($d352a8202024de5c$var$_tmpl$);
4880
- $qgKv4$insert(_el$, view_more_text);
4881
- return _el$;
4882
- })());
4883
- load_button.addEventListener("click", catchify(load_more_recs_and_hide_button_if_needed));
4884
- root.after(load_more_cont);
4885
- load_more_recs_and_hide_button_if_needed();
4886
- function load_more_recs_and_hide_button_if_needed() {
4887
- if (!$d352a8202024de5c$var$load_more_elements(root, chunk_size))
4888
- // there aren't any recs left to display
4889
- load_button.classList.add("not_visible");
4890
- }
4891
- }
4892
- function $d352a8202024de5c$export$4f39078bdc72ecd0(_t, d, i, with_loadmore, with_slider, infinite_scroll) {
4893
- d.class ||= "";
4894
- if (infinite_scroll) d.class = i >= 4 ? "not_visible" : ""; // this will make it hold image loading until .load_image is called on .rec_outer
4895
- if (with_loadmore) d.class = "not_visible";
4896
- d.percentage_off = Math.round(100 - d.sale_price / d.original_price * 100);
4897
- if (!d.percentage_off || d.percentage_off < 10) d.percentage_off = "";
4898
- return d;
4899
- }
4900
- function $d352a8202024de5c$export$c410ce1205e5118a(_t, itms, d, slider) {
4901
- for (const item of itms) {
4902
- const {
4903
- image_url: image_url
4904
- } = d,
4905
- img = item.querySelector("img.image"),
4906
- load_image = () => {
4907
- img.src = image_url;
4908
- slider?.observe?.(img);
4909
- };
4910
- if (item.classList.contains("not_visible") || slider)
4911
- // @ts-ignore
4912
- item.load_image = load_image;else load_image();
4913
- if (slider) item.classList.add("noautospacing");
2602
+
2603
+ // not ideal but can help when debugging via sentry
2604
+ /**
2605
+ * A function that attempts to "serialize" an object to a text representation that helps with debugging when using sentry
2606
+ * @param anything Something to try to serialize - this function is crappy and your mileage may vary
2607
+ * @param depth How deep to go when recursing
2608
+ * @return An object that is somehow closer to text (better serializable by sentry) or text
2609
+ */
2610
+ function $5c4afc453f904a1f$export$39d526a1194b6499(anything, depth) {
2611
+ depth ??= 0;
2612
+ depth++;
2613
+ if (depth > 30) return anything;
2614
+ const output = {};
2615
+ for (const key in anything) {
2616
+ const value = anything[key];
2617
+ let serialized_value;
2618
+ if (value instanceof Element) serialized_value = value.cloneNode(false).outerHTML;else if (value instanceof Headers) serialized_value = Object.fromEntries(value.entries());else if (typeof value == "object" && value != null && (typeof value[Symbol.iterator] === "function" || value instanceof Response)) serialized_value = $5c4afc453f904a1f$export$39d526a1194b6499(value, depth);else serialized_value = value?.toString?.();
2619
+ output[key] = serialized_value;
4914
2620
  }
4915
- return itms;
2621
+ return output;
4916
2622
  }
4917
2623
  var
4918
2624
  /**
@@ -5053,6 +2759,33 @@ const $9a744f57ab06c32e$export$68c017fd93791405 = ({
5053
2759
  container: container
5054
2760
  };
5055
2761
  };
2762
+ const $893f9af5dbae6bc8$export$deca40f48c0569f8 = typeof window === "undefined" ? false : /*@__PURE__*/localStorage.getItem("colorize-logics") === "true";
2763
+ function $893f9af5dbae6bc8$export$16501883f477737a(elements, display) {
2764
+ elements.forEach(elem => {
2765
+ if (elem.nodeType !== Node.TEXT_NODE) {
2766
+ // calc a hash for given string
2767
+ const hc = (str = "") => {
2768
+ let hash = 0;
2769
+ if (str.length === 0) return hash;
2770
+ for (let i = 0; i < str.length; i++) {
2771
+ const chr = str.charCodeAt(i);
2772
+ hash = (hash << 5) - hash + chr;
2773
+ hash |= 0;
2774
+ }
2775
+ return hash;
2776
+ };
2777
+ const hash = hc(display.logic);
2778
+ // Change hue based on hash
2779
+ const color = "hsl(" + hash % 360 + ",100%,75%)";
2780
+ if ("style" in elem) elem.style.background = color;
2781
+ // @ts-ignore
2782
+ elem?.setAttribute?.("data-logic", display.logic);
2783
+ // @ts-ignore
2784
+ elem?.setAttribute?.("title", "Logic: " + display.logic);
2785
+ }
2786
+ });
2787
+ return elements;
2788
+ }
5056
2789
  function $693e2a1517bef984$export$f8913c8a18f7ca21(iterables) {
5057
2790
  const ourselves = $607fc90221d440a6$export$e806c6c1615a59ae();
5058
2791
  const values = new Array(iterables.length);
@@ -5295,98 +3028,6 @@ class $30e801eaa3dc319e$var$CSSMeasurement {
5295
3028
  this.u = unit;
5296
3029
  }
5297
3030
  }
5298
- async function $090b8182afa1b2a6$export$b0a773486c1c2312(t, recommendation_renderer_options, {
5299
- container_elements: container_elements,
5300
- container_selector: container_selector,
5301
- override_rec_renderer: override_rec_renderer,
5302
- lazyfier_options = {},
5303
- eager_images: eager_images,
5304
- ...options_for_grid
5305
- }) {
5306
- const [insertion_point] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(container_elements, container_selector || ".grid");
5307
- const rendering_result = await (override_rec_renderer || (0, $6be99244fa573db5$export$2e2bcd8739ae039))(t, recommendation_renderer_options);
5308
- const {
5309
- elements: elements
5310
- } = rendering_result;
5311
- if (!elements) return rendering_result;
5312
- if (!eager_images)
5313
- // convoluted lazy loading that
5314
- // when the elements are in the DOM starts IntersectionObserver on whole grid
5315
- // when grid intersects starts Lazyfier
5316
- // this is because Lazyfier is fucking stupid
5317
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element(insertion_point).then($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(element => {
5318
- let start_lazy_loading;
5319
- const lazy_loading_promise = new Promise(r => start_lazy_loading = r);
5320
- const lf = new (0, $b83068cbd26dcc41$export$3be7054c61590ee3)({
5321
- only_load_intersecting: true,
5322
- wait_for_dominsertion: lazy_loading_promise,
5323
- ...lazyfier_options
5324
- });
5325
- lf.start_observing_for_new_children_(element);
5326
- const i_o = new IntersectionObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(records => {
5327
- for (const record of records) if (record.intersectionRatio > 0) {
5328
- start_lazy_loading();
5329
- i_o.disconnect();
5330
- return;
5331
- }
5332
- }));
5333
- i_o.observe(insertion_point);
5334
- }));
5335
- insertion_point.append(...elements);
5336
- $30e801eaa3dc319e$export$c84671f46d6a1ca({
5337
- ...options_for_grid,
5338
- container_element: insertion_point,
5339
- layout: "grid"
5340
- }).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
5341
- return {
5342
- ...rendering_result,
5343
- elements: container_elements
5344
- };
5345
- }
5346
-
5347
- // @ts-ignore
5348
- var $9ce43cb18264f271$exports = {};
5349
- $9ce43cb18264f271$exports = ".depict-slider {\n width: 100%;\n position: relative;\n}\n\n.depict-slider .sliding {\n scroll-behavior: smooth;\n -ms-overflow-style: none;\n scrollbar-width: none;\n flex-flow: row;\n display: flex;\n overflow-x: scroll;\n}\n\n.depict-slider .sliding::-webkit-scrollbar {\n display: none;\n}\n\n.depict-slider .sliding > * {\n box-sizing: border-box;\n flex: none;\n}\n\n";
5350
- let $30f78542ed78cd31$var$slider_styling_was_inserted = false;
5351
- async function $30f78542ed78cd31$export$82cfdc85a4d15688(t, recommendation_renderer_options, {
5352
- container_elements: container_elements,
5353
- container_selector: container_selector,
5354
- override_rec_renderer: override_rec_renderer,
5355
- lazyfier_options = {},
5356
- eager_images: eager_images,
5357
- grid_spacing: grid_spacing,
5358
- cols_at_size: cols_at_size,
5359
- override_vertical_spacing: override_vertical_spacing,
5360
- rows = "all",
5361
- ...slider_options
5362
- }) {
5363
- const [insertion_point] = $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(container_elements, container_selector || ".grid");
5364
- const slider = eager_images ? new (0, $ef9394fafebd5eab$export$692b27c28639e5b9)(slider_options) : new (0, $c33c6faf8acc7442$export$68babfc5be0de5da)(slider_options, lazyfier_options);
5365
- const rendering_result = await (override_rec_renderer || (0, $6be99244fa573db5$export$2e2bcd8739ae039))(t, recommendation_renderer_options);
5366
- const {
5367
- elements: elements
5368
- } = rendering_result;
5369
- if (!elements) return rendering_result;
5370
- if (!$30f78542ed78cd31$var$slider_styling_was_inserted) {
5371
- $30f78542ed78cd31$var$slider_styling_was_inserted = true;
5372
- $0a581f1dfa083522$export$59ba1eb2c083f0cd((0, /*@__PURE__*/$parcel$interopDefault($9ce43cb18264f271$exports)));
5373
- }
5374
- insertion_point.replaceWith(slider.container);
5375
- slider.insert_here.append(...elements);
5376
- $30e801eaa3dc319e$export$c84671f46d6a1ca({
5377
- grid_spacing: grid_spacing,
5378
- cols_at_size: cols_at_size,
5379
- container_element: slider.insert_here,
5380
- rows: rows,
5381
- layout: "slider",
5382
- override_vertical_spacing: override_vertical_spacing
5383
- }).catch(e => $b04e44fad5ea42c7$export$f18d5b0af29128b7([e, "Grid had an error"], "warning"));
5384
- return {
5385
- ...rendering_result,
5386
- slider: slider,
5387
- elements: container_elements
5388
- };
5389
- }
5390
3031
  function $be40b7bf11a47cc4$export$8cbd8aa1c70f9a13(interval = 5000) {
5391
3032
  let timer;
5392
3033
  let direction = 1;
@@ -5434,16 +3075,11 @@ function $a75adf1478c4522f$export$af88b4929c2dc86() {
5434
3075
  }
5435
3076
  var $2436f68ea927d4a8$var$_tmpl$ = /*#__PURE__*/$qgKv4$template(`<label class=checkbox_container><input type=radio><span class=checkmark>`);
5436
3077
  function $2436f68ea927d4a8$export$1d17a045bcc711b1({
5437
- t: t,
5438
3078
  navcont_insertion_fn: navcont_insertion_fn,
5439
3079
  navdot: navdot,
5440
3080
  dontshowonedot = false,
5441
3081
  bitesize: bitesize
5442
3082
  }) {
5443
- const {
5444
- dlog: dlog,
5445
- catchify: catchify
5446
- } = t;
5447
3083
  const button_states = [];
5448
3084
  const unique_name = Math.round(Math.random() * 1000000);
5449
3085
  function constructor_plugin() {
@@ -5480,14 +3116,14 @@ function $2436f68ea927d4a8$export$1d17a045bcc711b1({
5480
3116
  const position = Math.round(first_shown_element / amount_of_elements * number_of_slides);
5481
3117
  const get_inputs = () => navcont.querySelectorAll("input");
5482
3118
  if (number_of_radio_buttons != number_of_slides) {
5483
- dlog("Number of buttons doesn't match number of slides, rerendering buttons", button_states);
3119
+ $649f456f663da9fc$export$de56f1198d121036("Number of buttons doesn't match number of slides, rerendering buttons", button_states);
5484
3120
  navcont.innerHTML = "";
5485
3121
  if (number_of_slides === 1 && dontshowonedot) {
5486
- dlog("dontshowonedot is on, not rendering any dots");
3122
+ $649f456f663da9fc$export$de56f1198d121036("dontshowonedot is on, not rendering any dots");
5487
3123
  return;
5488
3124
  }
5489
3125
  if (number_of_slides == Infinity) {
5490
- dlog("Infinite number of slides, wtf", number_of_slides);
3126
+ $649f456f663da9fc$export$de56f1198d121036("Infinite number of slides, wtf", number_of_slides);
5491
3127
  return;
5492
3128
  }
5493
3129
  for (let i = 0; i < number_of_slides; i++) {
@@ -5495,10 +3131,10 @@ function $2436f68ea927d4a8$export$1d17a045bcc711b1({
5495
3131
  const input = a_navdot.querySelector("input");
5496
3132
  if (process.env.DEBUG === "true" && !input) throw new Error("You need to provide a navdot that contains an <input> element to slider_dots");
5497
3133
  input.checked = button_states[i];
5498
- input.addEventListener("click", catchify(e => {
3134
+ input.addEventListener("click", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => {
5499
3135
  e.preventDefault();
5500
3136
  e.stopPropagation();
5501
- dlog("Someone checked a box", e);
3137
+ $649f456f663da9fc$export$de56f1198d121036("Someone checked a box", e);
5502
3138
  this.scroll_to_abs(Math.round(amount_of_visible_elements * i));
5503
3139
  return false;
5504
3140
  }));
@@ -5538,12 +3174,7 @@ function $2436f68ea927d4a8$export$a09282b33e69b43f(unique_name) {
5538
3174
  // });
5539
3175
  // });
5540
3176
 
5541
- function $9bb2400c4e2e9335$export$411b0f20794697ce(t) {
5542
- const {
5543
- dlog: dlog,
5544
- catchify: catchify,
5545
- err: err
5546
- } = t;
3177
+ function $9bb2400c4e2e9335$export$411b0f20794697ce() {
5547
3178
  function constructor_plugin(slider_options) {
5548
3179
  const {
5549
3180
  insert_here: sliding
@@ -5551,7 +3182,7 @@ function $9bb2400c4e2e9335$export$411b0f20794697ce(t) {
5551
3182
  let last_mouse_position = 0;
5552
3183
  let starting_position = 0;
5553
3184
  let block_anchor_clicks = false;
5554
- sliding.addEventListener("mousedown", catchify(e => {
3185
+ sliding.addEventListener("mousedown", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => {
5555
3186
  sliding.classList.remove("slider_snap");
5556
3187
  const {
5557
3188
  snap_style: snap_style
@@ -5561,7 +3192,7 @@ function $9bb2400c4e2e9335$export$411b0f20794697ce(t) {
5561
3192
  last_mouse_position = starting_position = e.clientX;
5562
3193
  sliding.addEventListener("mousemove", scroll_on_mousemove);
5563
3194
  }));
5564
- window.addEventListener("mouseup", catchify(e => {
3195
+ window.addEventListener("mouseup", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => {
5565
3196
  // use window to prevent dragging from getting stuck
5566
3197
  sliding.classList.remove("grabbing");
5567
3198
  sliding.classList.add("slider_snap");
@@ -5581,9 +3212,9 @@ function $9bb2400c4e2e9335$export$411b0f20794697ce(t) {
5581
3212
  });
5582
3213
  }
5583
3214
  }));
5584
- sliding.addEventListener("click", catchify(e => {
3215
+ sliding.addEventListener("click", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => {
5585
3216
  if (block_anchor_clicks) {
5586
- dlog("Block anchor clicks is true, blocking click", e);
3217
+ $649f456f663da9fc$export$de56f1198d121036("Block anchor clicks is true, blocking click", e);
5587
3218
  block_anchor_clicks = false;
5588
3219
  e.preventDefault();
5589
3220
  return false;
@@ -5600,7 +3231,7 @@ function $9bb2400c4e2e9335$export$411b0f20794697ce(t) {
5600
3231
  });
5601
3232
  last_mouse_position = clientX;
5602
3233
  } catch (e) {
5603
- err(e);
3234
+ $7547e32486a3abc0$export$8048b892d651b310(e);
5604
3235
  }
5605
3236
  }
5606
3237
  }
@@ -5874,228 +3505,61 @@ function $40bfd400d76a6ec1$export$dac64fd35a4805a4(options = {}) {
5874
3505
  mutation_plugin: $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(mutation_plugin)
5875
3506
  };
5876
3507
  }
5877
- function $556d9c321900f1d4$export$53306504b987cbf7({
5878
- clones_per_side = 8
5879
- } = {}) {
5880
- // YOU NEED TO USE slider_snap_css FOR THIS TO WORK
5881
- // only for usage with recommendation_renderer which you need to pass post_processor as LAST post processor
5882
- const time_of_no_events_to_count_as_scroll_idle = 150;
5883
- const originally_rendered_elements = [];
5884
- const sets_of_els = [originally_rendered_elements];
5885
- const removed_by_us = new Set();
5886
- let mutation_busy = false;
5887
- let surplus_in_body = true;
5888
- let last_move = window?.performance?.now?.() || +new Date();
5889
- let touches = 0;
5890
- let inactive_checker_running = false;
5891
- let smallest_seen_intersection_ratio = 0.1;
5892
- let largest_seen_interection_ratio = 0.9;
5893
- let are_far_right = false;
5894
- let inactive_checker_timeout;
5895
- // let elgreen;
5896
- const check_if_we_inactive = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(function () {
5897
- // const { insert_here: sliding } = this;
5898
- const now = window?.performance?.now?.() || +new Date();
5899
- const time_since_ran = now - last_move;
5900
- const last_left_intersection = this.first_intersecting;
5901
- // dlog(last_left_intersection.intersectionRatio, smallest_seen_intersection_ratio, largest_seen_interection_ratio);
5902
- if (time_since_ran > time_of_no_events_to_count_as_scroll_idle && !touches && last_left_intersection && (last_left_intersection.intersectionRatio <= smallest_seen_intersection_ratio || last_left_intersection.intersectionRatio >= largest_seen_interection_ratio || are_far_right)) {
5903
- // if (!elgreen) {
5904
- // sliding.style.background = "green";
5905
- // elgreen = true;
5906
- // }
5907
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9($556d9c321900f1d4$var$scroll_idle)(this, originally_rendered_elements.length, clones_per_side);
5908
- inactive_checker_running = false;
5909
- } else {
5910
- // if (elgreen !== false) {
5911
- // sliding.style.background = "red";
5912
- // elgreen = false;
5913
- // }
5914
- const timeleft = time_of_no_events_to_count_as_scroll_idle - time_since_ran;
5915
- if (timeleft < 1) requestAnimationFrame(check_if_we_inactive.bind(this));else setTimeout(check_if_we_inactive.bind(this), timeleft);
5916
- }
5917
- });
5918
- function constructor_plugin() {
5919
- window.addEventListener("touchstart", () => touches++);
5920
- window.addEventListener("touchend", () => touches--);
5921
- this.insert_here.addEventListener("scroll", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(() => {
5922
- last_move = window?.performance?.now?.() || +new Date();
5923
- }));
5924
- const mo = new MutationObserver($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(records => {
5925
- for (const record of records) for (const node of record.removedNodes) {
5926
- if (removed_by_us.has(node)) {
5927
- removed_by_us.delete(node);
5928
- continue;
5929
- }
5930
- for (const a_set of sets_of_els) {
5931
- const index_in_el_set = a_set.indexOf(node);
5932
- if (index_in_el_set >= 0) {
5933
- $649f456f663da9fc$export$de56f1198d121036("Removing", node, "from el set", a_set);
5934
- a_set.splice(index_in_el_set, 1);
5935
- }
5936
- }
5937
- }
5938
- }));
5939
- mo.observe(this.insert_here, {
5940
- childList: true
5941
- });
5942
- }
5943
- function mutation_plugin(intersections, intersecting_mutations) {
5944
- for (let i = 0; i < intersections.length; i++) {
5945
- const {
5946
- intersectionRatio: intersectionRatio
5947
- } = intersections[i];
5948
- const target_large = intersectionRatio * 0.95;
5949
- const target_small = intersectionRatio * 1.05;
5950
- if (target_large > largest_seen_interection_ratio && target_large < 0.999) largest_seen_interection_ratio = target_large;else if (intersectionRatio && target_small < smallest_seen_intersection_ratio && target_small > 0.0001) smallest_seen_intersection_ratio = target_small;
5951
- }
5952
- if (mutation_busy) return;
5953
- mutation_busy = true;
5954
- last_move = window?.performance?.now?.() || +new Date();
5955
- const first_element = this.element_by_index(0);
5956
- const second_element = this.element_by_index(1);
5957
- let dont_wraparound = false;
5958
- if (!first_element || !second_element) dont_wraparound = true;else {
5959
- // calculate how many cards including margin the slider fits
5960
- const first_rect = first_element.getBoundingClientRect();
5961
- if (!first_rect.width) {
5962
- $649f456f663da9fc$export$de56f1198d121036(first_rect);
5963
- throw new Error("First rect doesn't have width");
5964
- }
5965
- const second_rect = second_element.getBoundingClientRect();
5966
- const container_rect = this.insert_here.getBoundingClientRect();
5967
- const margin = second_rect.left - first_rect.right;
5968
- let width = 0;
5969
- let amount = 0;
5970
- while (width < container_rect.width) {
5971
- if (width < 0) throw new Error("width can't be < 0");
5972
- width += first_rect.width + margin;
5973
- amount++;
5974
- }
5975
- // dlog(originally_rendered_elements.length, amount);
5976
- if (originally_rendered_elements.length <= amount) dont_wraparound = true;
5977
- }
5978
- if (dont_wraparound) {
5979
- if (surplus_in_body) {
5980
- $649f456f663da9fc$export$de56f1198d121036("Removing surplus of els. Total els: ", sets_of_els);
5981
- // @ts-ignore
5982
- for (let i = (sets_of_els.length || 1) - 1; i--;) for (let j = 0; j < sets_of_els[i].length; j++) {
5983
- const el = sets_of_els[i][j];
5984
- if ("remove" in el) {
5985
- removed_by_us.add(el);
5986
- el.remove();
5987
- }
5988
- }
5989
- this.invalidate_cache();
5990
- surplus_in_body = false;
5991
- }
5992
- mutation_busy = false;
5993
- return;
5994
- }
5995
- if (!surplus_in_body) {
5996
- $649f456f663da9fc$export$de56f1198d121036("Adding surplus of els");
5997
- this.insert_here.append(...sets_of_els.slice(0, -1).flat());
5998
- this.invalidate_cache();
5999
- surplus_in_body = true;
6000
- }
6001
- are_far_right = intersecting_mutations[this.index_of_last_element]?.intersectionRatio >= largest_seen_interection_ratio;
6002
- clearTimeout(inactive_checker_timeout);
6003
- inactive_checker_timeout = setTimeout(function () {
6004
- if (!inactive_checker_running) {
6005
- inactive_checker_running = true;
6006
- check_if_we_inactive.call(this);
6007
- }
6008
- }.bind(this), time_of_no_events_to_count_as_scroll_idle * 0.8 // schedule a bit earlier so we hit our target
6009
- );
6010
-
6011
- mutation_busy = false;
3508
+ const $0d2acf276472ebf7$export$20e9533e68ee72e7 = /*@__PURE__*/$607fc90221d440a6$export$e806c6c1615a59ae(false);
3509
+ const $0d2acf276472ebf7$export$a9d39e43ae273d26 = /*@__PURE__*/$607fc90221d440a6$export$e806c6c1615a59ae();
3510
+ const $0d2acf276472ebf7$export$7500cdfd37aafd43 = /*@__PURE__*/new Set();
3511
+ let $0d2acf276472ebf7$var$old_url;
3512
+ const $0d2acf276472ebf7$var$maybe_navigation = (what_happened, args) => {
3513
+ if (typeof location === "undefined") return;
3514
+ const new_url = location.href;
3515
+ if ($0d2acf276472ebf7$var$old_url !== new_url) {
3516
+ $0d2acf276472ebf7$export$a9d39e43ae273d26(new_url);
3517
+ if ($0d2acf276472ebf7$var$old_url !== undefined)
3518
+ // don't resolve stateless href change ipns with the initial value - it's not a navigation
3519
+ $0d2acf276472ebf7$export$20e9533e68ee72e7(new_url);
3520
+ $0d2acf276472ebf7$var$old_url = new_url;
6012
3521
  }
6013
- async function post_processor(elements, _display, info) {
6014
- const {
6015
- index: index,
6016
- rendering_options: rendering_options
6017
- } = info;
6018
- originally_rendered_elements.push(...elements);
6019
- if (index === 0) {
6020
- const {
6021
- event_listeners: event_listeners
6022
- } = info; // so we don't want event listeners to be added twice. We will return our actual index 0 elements and all elements of all indexes. Tracking needs to be right per element per index. That's why we will now add our event listeners to our elements and then prevent RR from doing it for us on all returned elements, on which each RR run will get to add the correct individual ones
6023
- while (event_listeners?.length) {
6024
- // order shouldn't matter, this is fast
6025
- const event_listener = event_listeners.pop();
6026
- for (let i = 0; i < elements.length; i++) elements[i].addEventListener(...event_listener);
6027
- }
6028
- // render all elements again four times and adds them to the beginning
6029
- const post_processors = [...(rendering_options.post_processors || [])];
6030
- const our_index = post_processors.indexOf(post_processor);
6031
- if (our_index >= 0) post_processors.splice(our_index, 1);else {
6032
- const msg = "Couldn't find ourselves in post processors, infinite loop might ensue. Exiting. Wraparound will be broken.";
6033
- (0, $eba382943196079c$export$af2e17a20c2ea3c5).captureException(new Error(msg));
6034
- $649f456f663da9fc$export$de56f1198d121036(msg, () => {});
6035
- return elements;
6036
- }
6037
- for (let i = 0; i < clones_per_side * 2; i++) {
6038
- const additional_render = await $5cbe24d064a033ed$export$a9fc160c5ed83bd7(info.t, {
6039
- ...rendering_options,
6040
- post_processors: post_processors,
6041
- pre_processors: [],
6042
- // don't need to execute pre processors again, displays are already pre-processed
6043
- recs: info.displays
6044
- });
6045
- sets_of_els.push([...additional_render.elements]);
6046
- }
6047
- sets_of_els.reverse(); // here sets_of_els gets modified and reversed
6048
- const sets_of_els_without_items_1_plus_n_from_first_render = [...sets_of_els];
6049
- const index_of_first_render = sets_of_els_without_items_1_plus_n_from_first_render.indexOf(originally_rendered_elements);
6050
- if (index_of_first_render < 0) throw new Error("Something's weird, pls check");
6051
- sets_of_els_without_items_1_plus_n_from_first_render[index_of_first_render] = elements;
6052
- // we cannot return the array that _might_ contain the elements from the other rendering passes that run asynchronously, this might lead to duplicated event listeners
6053
- return sets_of_els_without_items_1_plus_n_from_first_render.flat();
6054
- } else return elements;
3522
+ for (const fn of $0d2acf276472ebf7$export$7500cdfd37aafd43) fn(what_happened, args);
3523
+ };
3524
+ $0d2acf276472ebf7$export$baccefee4a395d8f((args, what_happened) => $0d2acf276472ebf7$var$maybe_navigation(what_happened, args));
3525
+ $0d2acf276472ebf7$var$maybe_navigation();
3526
+ globalThis?.window?.addEventListener("popstate", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => $0d2acf276472ebf7$var$maybe_navigation("popstate", e)));
3527
+ async function $0d2acf276472ebf7$export$1cd22bab0d2c3b0b(callback) {
3528
+ const catchified_callback = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(callback);
3529
+ for await (const href of $0d2acf276472ebf7$export$20e9533e68ee72e7) {
3530
+ catchified_callback(href);
3531
+ break;
6055
3532
  }
6056
- return {
6057
- constructor_plugin: constructor_plugin,
6058
- mutation_plugin: mutation_plugin,
6059
- post_processor: post_processor
6060
- };
6061
3533
  }
6062
- function $556d9c321900f1d4$var$scroll_idle(slider, chunk_size, clones_per_side) {
6063
- const {
6064
- insert_here: sliding
6065
- } = slider;
6066
- const slider_box = sliding.getBoundingClientRect();
6067
- const leftmost_rect = slider.element_by_index(0).getBoundingClientRect();
6068
- const rightmost_rect = slider.element_by_index(slider.index_of_last_element).getBoundingClientRect();
6069
- const leftmost_card_to_left_viewport_edge = slider_box.left - leftmost_rect.left;
6070
- const rightmost_card_to_right_viewport_edge = rightmost_rect.right - slider_box.right;
6071
- const children = [...sliding.children];
3534
+ async function $0d2acf276472ebf7$export$baccefee4a395d8f(after_navigation, replace_replaceState = true) {
3535
+ if (typeof History === "undefined") return;
6072
3536
  const {
6073
- intersecting_items_object: intersecting_items_object
6074
- } = slider;
6075
- const index_of_first_intersecting = slider.first_intersecting_index();
6076
- const index_of_last_intersecting = Math.max(...Object.keys(intersecting_items_object).map(v => +v));
6077
- const post_move = direction => {
6078
- // slider.invalidate_cache();
6079
- // for (const key in intersecting_items_object) {
6080
- // const value = intersecting_items_object[key];
6081
- // delete intersecting_items_object[key];
6082
- // intersecting_items_object[slider.get_index_of_element(value.target)] = value;
6083
- // }
6084
- slider.scroll_to_abs(index_of_first_intersecting - direction * chunk_size, true);
3537
+ prototype: prototype
3538
+ } = History;
3539
+ const instance = history;
3540
+ const polyfill_dance = the_thing => {
3541
+ const proxy_the_thing = obj => {
3542
+ const orig_pushState = obj[the_thing];
3543
+ obj[the_thing] = new Proxy(orig_pushState, {
3544
+ apply: (target, this_arg, arguments_list) => {
3545
+ const nav_result = Reflect.apply(target, this_arg, arguments_list);
3546
+ try {
3547
+ after_navigation(arguments_list, the_thing);
3548
+ } catch (e) {
3549
+ $7547e32486a3abc0$export$8048b892d651b310(e);
3550
+ }
3551
+ return nav_result;
3552
+ }
3553
+ });
3554
+ };
3555
+ proxy_the_thing(prototype);
3556
+ if (Object.getOwnPropertyNames(instance).includes(the_thing))
3557
+ // we don't want to just change the instance because that's not the way to do it, but we don't want to not work because someone else did it wrong
3558
+ proxy_the_thing(instance);
6085
3559
  };
6086
- // dlog(index_of_first_intersecting, index_of_last_intersecting);
6087
- if (index_of_first_intersecting >= chunk_size * clones_per_side && index_of_first_intersecting <= chunk_size * (clones_per_side + 1)) ;else {
6088
- if (leftmost_card_to_left_viewport_edge > rightmost_card_to_right_viewport_edge * 1.1 /* add 10% margin */)
6089
- // dlog("Moving", chunk_size, "to the right");
6090
- // sliding.append(...children.slice(0, chunk_size));
6091
- post_move(1);else if (rightmost_card_to_right_viewport_edge > leftmost_card_to_left_viewport_edge * 1.1)
6092
- // dlog("Moving", chunk_size, "to the left");
6093
- // sliding.prepend(...children.slice(-chunk_size));
6094
- post_move(-1);
6095
- }
6096
- // dlog("Scroll idle", leftmost_card_to_left_viewport_edge, rightmost_card_to_right_viewport_edge);
3560
+ polyfill_dance("pushState");
3561
+ if (replace_replaceState) polyfill_dance("replaceState");
6097
3562
  }
6098
-
6099
3563
  const $49c4fa2e27e642fa$var$connection_map = /*@__PURE__*/new WeakMap();
6100
3564
  function $49c4fa2e27e642fa$export$3d04c40e7acc1a32(initial_value) {
6101
3565
  let subscribed = false;
@@ -6259,122 +3723,329 @@ function $159237486410355f$export$419f84efad7d9fe(surface_per_size, cleanup_prom
6259
3723
  function $159237486410355f$export$be95cb0e8cfd099e() {
6260
3724
  return new Promise(r => $0d2acf276472ebf7$export$1cd22bab0d2c3b0b(r));
6261
3725
  }
6262
- function $847e4a06ea6767c0$export$3ebd86018b39d9d2(t, selector, filter) {
6263
- (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(selector, eoe => {
6264
- $649f456f663da9fc$export$de56f1198d121036("Order confirmation element showed up!", eoe);
6265
- const {
6266
- element: element
6267
- } = eoe;
6268
- const the_id = element.innerText;
6269
- $847e4a06ea6767c0$export$1ac466d53a6636ac(t, the_id, $43683b1103edab15$export$61e7e1f11e96692f(), filter);
3726
+ function $91b2e49f92ed636c$export$82a685f2da2fb027(a_element, product_id, recommendation_id, additional_listener) {
3727
+ if (!a_element ||
3728
+ // @ts-ignore
3729
+ !a_element.depict_tracked ||
3730
+ // @ts-ignore
3731
+ a_element?.depict_tracked?.recommendation_id != recommendation_id ||
3732
+ // @ts-ignore
3733
+ a_element?.depict_tracked?.product_id != product_id) {
3734
+ const listener = e => {
3735
+ localStorage.setItem(`depict_attribution_${product_id}`, recommendation_id);
3736
+ if (additional_listener) additional_listener(e, product_id, recommendation_id);
3737
+ };
3738
+ // @ts-ignore
3739
+ if (a_element.depict_tracked)
3740
+ // @ts-ignore
3741
+ a_element.removeEventListener("click", a_element.depict_tracked?.listener);
3742
+ // @ts-ignore
3743
+ a_element.depict_tracked = {
3744
+ product_id: product_id,
3745
+ recommendation_id: recommendation_id,
3746
+ listener: listener
3747
+ };
3748
+ a_element.addEventListener("click", listener);
3749
+ return listener;
3750
+ }
3751
+ }
3752
+ async function $91b2e49f92ed636c$export$2c34560c3749dc63(button, get_product_id, tracking_fn, unmatching_tracking, event) {
3753
+ // @ts-ignore
3754
+ if (!button || button.depict_tracked) return;
3755
+ button.addEventListener(event ? event : "click", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async e => {
3756
+ if (!e.isTrusted) {
3757
+ $649f456f663da9fc$export$de56f1198d121036("ignoring event", e, "because it's not user generated");
3758
+ return;
3759
+ }
3760
+ const product_id = await get_product_id(undefined, e);
3761
+ if (product_id) {
3762
+ const item_name = `depict_attribution_${product_id}`;
3763
+ const recommendation_id = localStorage.getItem(item_name);
3764
+ if (recommendation_id) {
3765
+ localStorage.removeItem(item_name);
3766
+ tracking_fn(product_id, recommendation_id, false, e);
3767
+ } else if (unmatching_tracking) tracking_fn(product_id, recommendation_id, true, e);
3768
+ }
3769
+ }));
3770
+ // @ts-ignore
3771
+ button.depict_tracked = true;
3772
+ }
3773
+ function $42bbbba8196bd057$export$edfedd0557ca5a2d(ga_tracker, append_to_url) {
3774
+ if (!ga_tracker) return;
3775
+ // Docs for analytics.js Tasks:
3776
+ // https://developers.google.com/analytics/devguides/collection/analyticsjs/tasks
3777
+ const sendHitTask = "sendHitTask";
3778
+ const originalSendHitTask = ga_tracker.get(sendHitTask);
3779
+ ga_tracker.set(sendHitTask, model => {
3780
+ originalSendHitTask(model);
3781
+ // console.log('Sent original hit, now sending to depict');
3782
+ try {
3783
+ const payLoad = model.get("hitPayload");
3784
+ const path = (0, $6c2b49f3f564b0d1$export$362abebb4b313340) + "/collect-ga";
3785
+ let url = path + "?" + payLoad;
3786
+ if (append_to_url) url += append_to_url;
3787
+ const n = navigator;
3788
+ const sb = "sendBeacon";
3789
+ if (n[sb])
3790
+ // this is actually smaller, I tested
3791
+ n[sb](url);else {
3792
+ const xhttp = new XMLHttpRequest();
3793
+ xhttp.open("GET", url);
3794
+ xhttp.send();
3795
+ }
3796
+ } catch (e) {
3797
+ // console.log('Could not send beacon to /collect-ga', e);
3798
+ }
6270
3799
  });
6271
3800
  }
6272
- function $847e4a06ea6767c0$export$b11248fa13a8a86c(tenant, id_extractor) {
6273
- // Use the given extractor to find a transaction ID from each entry pushed to dataLayer.
6274
- // If it finds any IDs, send them.
6275
- $847e4a06ea6767c0$export$9ed4fbc47d558f94(layer_entry => {
6276
- const id = id_extractor(layer_entry);
6277
- if (id && typeof id === "string") $847e4a06ea6767c0$export$1ac466d53a6636ac(tenant, id);
3801
+ function $42bbbba8196bd057$export$674d8cd8b6868154() {
3802
+ // Snippet to load GA async
3803
+ const w = window;
3804
+ // @ts-ignore
3805
+ w.ga ||= function () {
3806
+ (w.ga.q ||= []).push(arguments);
3807
+ };
3808
+ w.ga.l = +new Date();
3809
+ }
3810
+
3811
+ /**
3812
+ * Elements currently intersecting with the viewport.
3813
+ * If they are intersecting for the `has_to_be_intersecting_for` duration, we count it as an impression, and call the callback.
3814
+ */
3815
+ const $f24c14db771b471d$var$current_intersections = /*@__PURE__*/new WeakMap();
3816
+ /**
3817
+ * Currently watched elements by the intersection observer with their respective callback
3818
+ * */
3819
+ const $f24c14db771b471d$var$watched_elements = /*@__PURE__*/new WeakMap();
3820
+ const $f24c14db771b471d$var$unwatch_element = element => {
3821
+ $f24c14db771b471d$var$intersection_observer?.unobserve(element);
3822
+ $f24c14db771b471d$var$watched_elements.delete(element);
3823
+ $f24c14db771b471d$var$current_intersections.delete(element);
3824
+ };
3825
+ const $f24c14db771b471d$export$4c51576248bcdf31 = (element, callback) => {
3826
+ if ($f24c14db771b471d$var$watched_elements.has(element)) {
3827
+ $649f456f663da9fc$export$de56f1198d121036("Not watching", element, "as it's already being watched");
3828
+ return () => {};
3829
+ }
3830
+ $f24c14db771b471d$var$intersection_observer?.observe(element);
3831
+ /** Calls the given callback and makes sure to stop watching the element */
3832
+ const wrapped_callback = element => {
3833
+ callback(element);
3834
+ $f24c14db771b471d$var$unwatch_element(element);
3835
+ };
3836
+ $f24c14db771b471d$var$watched_elements.set(element, wrapped_callback);
3837
+ const disconnect_observer = (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onremoved(element, () => {
3838
+ // Sometimes it has already rapidly been reinserted. The observer events lag by one tick.
3839
+ // For that case, make sure we're really out of the DOM
3840
+ if (document.documentElement.contains(element)) return;
3841
+ $f24c14db771b471d$var$unwatch_element(element);
3842
+ });
3843
+ return () => {
3844
+ disconnect_observer();
3845
+ $f24c14db771b471d$var$unwatch_element(element);
3846
+ };
3847
+ };
3848
+ const $f24c14db771b471d$var$intersection_observer_callback = entries => {
3849
+ for (const record of entries) {
3850
+ const {
3851
+ target: target
3852
+ } = record;
3853
+ const callback = $f24c14db771b471d$var$watched_elements.get(target);
3854
+ // Skip the element if it's no longer being watched.
3855
+ if (!callback) {
3856
+ $f24c14db771b471d$var$intersection_observer?.unobserve(target);
3857
+ continue;
3858
+ }
3859
+ const currently_intersecting = $f24c14db771b471d$var$current_intersections.has(target);
3860
+ if (!currently_intersecting && record.intersectionRatio >= (0, $ccf918da074d7243$export$135da44d0ba958bc)[0]) {
3861
+ // we're intersecting enough and not already in the process of "measuring"
3862
+ const started_intersecting_at_ = +new Date(); // save start time
3863
+ // Schedule the callback function to be called after the element has been intersecting for the required duration
3864
+ const callback_timeout_ = setTimeout(callback, (0, $ccf918da074d7243$export$ca8321ea61dc2544), target);
3865
+ $f24c14db771b471d$var$current_intersections.set(target, {
3866
+ started_intersecting_at_: started_intersecting_at_,
3867
+ callback_timeout_: callback_timeout_
3868
+ });
3869
+ } else if (currently_intersecting && record.intersectionRatio < (0, $ccf918da074d7243$export$135da44d0ba958bc)[1]) {
3870
+ // we are in the process of "measuring" and went below the threshold
3871
+ const {
3872
+ started_intersecting_at_: started_intersecting_at_,
3873
+ callback_timeout_: callback_timeout_
3874
+ } = $f24c14db771b471d$var$current_intersections.get(target);
3875
+ const time_elapsed = +new Date() - started_intersecting_at_;
3876
+ // If we stopped intersecting too early we want to abort our timeout.
3877
+ // if we did not we also want to abort the timeout since it's been lagging and just instantly send the event
3878
+ // (the browser can delay setTimeout timers)
3879
+ clearTimeout(callback_timeout_);
3880
+ if (time_elapsed <= (0, $ccf918da074d7243$export$ca8321ea61dc2544)) $f24c14db771b471d$var$current_intersections.delete(target);else {
3881
+ // we intersected long enough
3882
+ $649f456f663da9fc$export$de56f1198d121036("intersection_observer: setTimeout lagged", time_elapsed, (0, $ccf918da074d7243$export$ca8321ea61dc2544), "ms", target);
3883
+ callback(target);
3884
+ }
3885
+ }
3886
+ }
3887
+ };
3888
+ /**
3889
+ * Global IntersectionObserver used for all impression tracking.
3890
+ * It's faster to use one observer for all elements than to create a new one for each element.
3891
+ */
3892
+ const $f24c14db771b471d$var$intersection_observer = typeof window === "object" ? /*@__PURE__*/new IntersectionObserver( /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9($f24c14db771b471d$var$intersection_observer_callback), {
3893
+ threshold: /*@__PURE__*/$9ab9ecb74920f343$export$f8ea2e7b15b5d129(8)
3894
+ }) : undefined;
3895
+ const $405969d60b37fdac$export$d0efd8ed14f5c33 = (items, display, info) => {
3896
+ if (!items?.length) return items;
3897
+ const node_array = Array.isArray(items) ? items : [...items]; // if it's a NodeList convert it to an array
3898
+ const first_watchable_el = node_array.find(el => el instanceof Element);
3899
+ if (!first_watchable_el) {
3900
+ $649f456f663da9fc$export$de56f1198d121036("Impression tracking: Can't observe", items, display);
3901
+ return items;
3902
+ }
3903
+ if (!info.t) {
3904
+ $649f456f663da9fc$export$de56f1198d121036("Impression tracking: No tenant instance, can't track", items, display);
3905
+ return items;
3906
+ }
3907
+ (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(first_watchable_el, ({
3908
+ element: element
3909
+ }) => {
3910
+ $f24c14db771b471d$export$4c51576248bcdf31(element, () => {
3911
+ const {
3912
+ recommendation_id: recommendation_id,
3913
+ search_result_id: search_result_id,
3914
+ product_listing_result_id: product_listing_result_id,
3915
+ suggestions_result_id: suggestions_result_id
3916
+ } = display;
3917
+ $ccf918da074d7243$export$4205dc6835bc0d9f({
3918
+ ...$43683b1103edab15$export$8c6f26a5b6921b95(),
3919
+ recommendation_type: info.rendering_options.type,
3920
+ entity_price: display.sale_price,
3921
+ market: info.t.market,
3922
+ tenant: info.t.tenant,
3923
+ product_id: display.product_id,
3924
+ recommendation_id: recommendation_id,
3925
+ search_result_id: search_result_id,
3926
+ product_listing_result_id: product_listing_result_id,
3927
+ suggestions_result_id: suggestions_result_id
3928
+ });
3929
+ });
6278
3930
  });
3931
+ return items;
3932
+ };
3933
+ const $21285393646b9849$export$37125ccc5dd98050 = ({
3934
+ element: element,
3935
+ data: data,
3936
+ wait_for_dom_insertion = true
3937
+ }) => {
3938
+ const disconnectors = [];
3939
+ const impression_track = () => {
3940
+ const disconnector = $f24c14db771b471d$export$4c51576248bcdf31(element, () => {
3941
+ $ccf918da074d7243$export$4205dc6835bc0d9f({
3942
+ ...$43683b1103edab15$export$8c6f26a5b6921b95(),
3943
+ ...data
3944
+ });
3945
+ });
3946
+ disconnectors.push(disconnector);
3947
+ };
3948
+ if (wait_for_dom_insertion) disconnectors.push((0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onexists(element, impression_track));else impression_track();
3949
+ return () => disconnectors.forEach(disconnector => disconnector());
3950
+ };
3951
+ let $ccf918da074d7243$export$135da44d0ba958bc = [0.6, 0.5];
3952
+ const $ccf918da074d7243$export$c543ee4cdb0d0964 = (start, end) => $ccf918da074d7243$export$135da44d0ba958bc = [start, end];
3953
+ const $ccf918da074d7243$export$ca8321ea61dc2544 = 500;
3954
+ const $ccf918da074d7243$export$4205dc6835bc0d9f = data => {
3955
+ data.type = "element_visible"; // Set the type to element_visible as this is optional to pass here.
3956
+ $cafa1ff1049985c2$export$28cacbd9b4306ffc([data], true);
3957
+ };
3958
+
3959
+ // https://stackoverflow.com/a/39941616
3960
+ function $bb3252f70898acd6$var$invert_promise(promise) {
3961
+ return new Promise((res, rej) => promise.then(rej, res));
6279
3962
  }
6280
- function $847e4a06ea6767c0$export$9ed4fbc47d558f94(interception_callback) {
6281
- const process_entries = entries => entries.forEach(interception_callback);
6282
- const dataLayer = globalThis.dataLayer ||= [];
6283
- // Process entries that are already queued at this point
6284
- process_entries(dataLayer);
6285
- // And then process any future entries, making sure to pass them on to other potential proxies to the push function
6286
- dataLayer.push = new Proxy(dataLayer.push, {
6287
- apply(target, this_arg, args_list) {
6288
- try {
6289
- process_entries(args_list);
6290
- } catch (e) {
6291
- $b04e44fad5ea42c7$export$f18d5b0af29128b7([e, "Processing entries from dataLayer failed"], "warning");
6292
- }
6293
- return target.apply(this_arg, args_list);
6294
- }
6295
- });
3963
+ function $bb3252f70898acd6$export$947a20746936143d(promises) {
3964
+ return Promise?.any?.(promises) ?? $bb3252f70898acd6$var$invert_promise(Promise.all([...promises].map($bb3252f70898acd6$var$invert_promise)));
6296
3965
  }
6297
- function $847e4a06ea6767c0$export$ff8673d5dea82bd4(tenant, id_extractor) {
6298
- (async () => {
6299
- for await (const href of (0, $0d2acf276472ebf7$export$a9d39e43ae273d26)) {
6300
- const order_id = id_extractor(new URL(href));
6301
- if (order_id && typeof order_id === "string") $847e4a06ea6767c0$export$1ac466d53a6636ac(tenant, order_id);
6302
- }
6303
- })().catch(e => $b04e44fad5ea42c7$export$f18d5b0af29128b7([e, "Extracting and sending transaction IDs from URL failed"], "warning"));
3966
+ async function $61b3c9e5f2cf8171$export$836f70a28c317905(product_id) {
3967
+ if (typeof BroadcastChannel != "function") return;
3968
+ const bc = new BroadcastChannel("right_click_attribution");
3969
+ $649f456f663da9fc$export$de56f1198d121036("Broadcasting", product_id, "to", bc);
3970
+ bc.postMessage(product_id);
3971
+ bc.close();
6304
3972
  }
6305
- function $847e4a06ea6767c0$export$1ac466d53a6636ac(t, input_id, session_id = $43683b1103edab15$export$61e7e1f11e96692f(), filter) {
6306
- const transaction_id = typeof filter == "function" ? filter(input_id) : input_id;
6307
- if (!transaction_id) {
6308
- $649f456f663da9fc$export$de56f1198d121036("Not sending", transaction_id, "because it didn't pass filter");
6309
- return;
3973
+ function $61b3c9e5f2cf8171$export$58c56fe2313fdbe3(elements, display, info, get_event_listener_remover) {
3974
+ if (typeof BroadcastChannel != "function") return elements;
3975
+ const disconnectors = [];
3976
+ const handler = $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(e => $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, ("variant_index" in display ? display.variant_displays[display.variant_index] : display).product_id));
3977
+ const auxclick_handler = e => e.button === 1 && handler(e);
3978
+ for (let i = 0; i < elements?.length; i++) {
3979
+ const element = elements[i];
3980
+ element.addEventListener("contextmenu", handler);
3981
+ element.addEventListener("auxclick", auxclick_handler); // actual wheel click - some mouses / OS:es also dispatch auxclick on rightclick
3982
+ if (get_event_listener_remover) disconnectors.push(() => {
3983
+ element.removeEventListener("contextmenu", handler);
3984
+ element.removeEventListener("auxclick", auxclick_handler);
3985
+ });
6310
3986
  }
6311
- $649f456f663da9fc$export$de56f1198d121036("Sending this order id:", transaction_id, "(before filtering it was", input_id, ")");
6312
- const payload = {
6313
- tenant: t.tenant,
6314
- market: t.market,
6315
- events: [{
6316
- event_type: "transaction_mapping",
6317
- transaction_id: transaction_id,
6318
- session_id: session_id
6319
- }]
6320
- };
6321
- $cafa1ff1049985c2$export$cc3b6ddf805f6156((0, $6c2b49f3f564b0d1$export$362abebb4b313340) + "/v2/track", payload);
3987
+ get_event_listener_remover?.(() => disconnectors.forEach(disconnector => disconnector()));
3988
+ return elements;
6322
3989
  }
6323
- function $3abef00489070e23$export$1ff14fec60ed5697(t, filter) {
6324
- try {
6325
- $42bbbba8196bd057$export$674d8cd8b6868154();
6326
- // @ts-ignore
6327
- ga($b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async function (tracker) {
6328
- let get_all_function = window?.ga?.getAll; // https://sentry.io/organizations/depictai-0o/issues/3621911835/?project=5476183&referrer=slack
6329
- if (typeof get_all_function !== "function") get_all_function = await $d0e7629fb3179e02$export$2fc1a072736ae2f6(window, "ga", "getAll");
6330
- // @ts-ignore
6331
- const all_trackers = get_all_function.call(ga);
6332
- $649f456f663da9fc$export$de56f1198d121036("we have trackers", all_trackers);
6333
- // @ts-ignore
3990
+ async function $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2(e, product_id) {
3991
+ $649f456f663da9fc$export$de56f1198d121036("Contextmenu was invoked", e);
3992
+ const element = e.currentTarget || e.target;
3993
+ const bc = new BroadcastChannel("right_click_attribution");
3994
+ const got_wanted_event = await $bb3252f70898acd6$export$947a20746936143d([new Promise(resolve => {
3995
+ bc.addEventListener("message", $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(msg => {
6334
3996
  const {
6335
- P: P
6336
- } = ga;
6337
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(modify_trackers_of_iterable)(all_trackers);
6338
- if (typeof P?.push === "function")
6339
- // this check is just so we don't fail if this doesn't exist for some reason, but it always should
6340
- P.push = new Proxy(P.push, {
6341
- apply(target, this_arg, args_list) {
6342
- const retval = target.apply(this_arg, args_list);
6343
- $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(modify_trackers_of_iterable)(args_list);
6344
- return retval;
6345
- }
6346
- });
6347
- function modify_trackers_of_iterable(array) {
6348
- for (const tracker of array) $b04e44fad5ea42c7$export$b3bbfd758f11cfa9($3abef00489070e23$var$make_tracker_send_to_depict)(tracker, t, filter);
6349
- }
3997
+ data: data
3998
+ } = msg;
3999
+ $649f456f663da9fc$export$de56f1198d121036("Recieved broadcast channel event", data, msg);
4000
+ if (data == product_id) resolve(true);
6350
4001
  }));
4002
+ }), new Promise(r => setTimeout(r, 60000, false))]);
4003
+ if (got_wanted_event) {
4004
+ const click = new MouseEvent("click", {
4005
+ view: window,
4006
+ bubbles: true,
4007
+ cancelable: true,
4008
+ metaKey: true
4009
+ });
4010
+ $649f456f663da9fc$export$de56f1198d121036("Someone broadcasted our product_id! Simulating a click event on the element that was contextmenu'd", element, click);
4011
+ element.addEventListener("click", e => (e.preventDefault(), false), {
4012
+ once: true
4013
+ });
4014
+ element.dispatchEvent(click);
4015
+ } else $649f456f663da9fc$export$de56f1198d121036("Our product_id did not get broadcasted, closing channel");
4016
+ bc.close();
4017
+ }
4018
+ let $aa0140679dc70b7a$var$last_page_pageview_sent_for;
4019
+ async function $aa0140679dc70b7a$export$eee4c4d924348b05(data) {
4020
+ // Send page view to depict if needed
4021
+ try {
4022
+ const {
4023
+ href: href
4024
+ } = location;
4025
+ if ($aa0140679dc70b7a$var$last_page_pageview_sent_for !== href) {
4026
+ $aa0140679dc70b7a$var$last_page_pageview_sent_for = href;
4027
+ $43683b1103edab15$export$82badda1f9923310({
4028
+ ...data,
4029
+ type: "page_view"
4030
+ });
4031
+ if (data.product_id) await $61b3c9e5f2cf8171$export$836f70a28c317905(data.product_id); // this takes care of right click click attribution - broadcasts the URL of the current page
4032
+ }
6351
4033
  } catch (error) {
6352
- $b04e44fad5ea42c7$export$f18d5b0af29128b7(error, "error");
4034
+ $b04e44fad5ea42c7$export$f18d5b0af29128b7([error, "Sending page view failed"], "warning");
6353
4035
  }
6354
4036
  }
6355
- function $3abef00489070e23$var$make_tracker_send_to_depict(
6356
- // @ts-ignore
6357
- ga_tracker, t, filter) {
6358
- // Docs for analytics.js Tasks:
6359
- // https://developers.google.com/analytics/devguides/collection/analyticsjs/tasks
6360
- const sendHitTask = "sendHitTask";
6361
- const originalSendHitTask = ga_tracker.get(sendHitTask);
6362
- ga_tracker.set(sendHitTask, model => {
6363
- originalSendHitTask(model);
6364
- // console.log('Sent original hit, now sending to depict');
6365
- try {
6366
- const dsid = $43683b1103edab15$export$61e7e1f11e96692f();
6367
- const payload = model.get("hitPayload");
6368
- const sp = new URLSearchParams(payload);
6369
- const id = sp.get("ti");
6370
- if (id) {
6371
- $649f456f663da9fc$export$de56f1198d121036("Got interesting analytics request", payload, id);
6372
- $847e4a06ea6767c0$export$1ac466d53a6636ac(t, id, dsid, filter);
6373
- }
6374
- } catch (e) {
6375
- $b04e44fad5ea42c7$export$f18d5b0af29128b7(e, "error");
6376
- }
6377
- });
4037
+ let $aa0140679dc70b7a$var$sending_on_navigation = false;
4038
+ async function $aa0140679dc70b7a$export$f7cb1bd47199ec38(data) {
4039
+ if (!$aa0140679dc70b7a$var$sending_on_navigation) {
4040
+ $aa0140679dc70b7a$var$sending_on_navigation = true;
4041
+ $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async () => {
4042
+ for await (const _href of (0, $0d2acf276472ebf7$export$a9d39e43ae273d26)) $aa0140679dc70b7a$export$eee4c4d924348b05({
4043
+ tenant: data.tenant,
4044
+ market: data.market,
4045
+ product_id: await data.get_product_id(_href)
4046
+ });
4047
+ })();
4048
+ }
6378
4049
  }
6379
4050
 
6380
4051
  /**
@@ -6572,40 +4243,62 @@ const $802201ed0a316c43$export$783ef16647773b3d = /*@__PURE__*/$511123bb28a7b6f7
6572
4243
  const meta = await $d0e7629fb3179e02$export$2fc1a072736ae2f6(window, "ShopifyAnalytics", "meta");
6573
4244
  return meta?.product;
6574
4245
  }));
6575
- async function $1813f33dd0fc7e1d$export$b404e20f3c4a490e({
6576
- t: t,
6577
- experiment_id: experiment_id,
6578
- functions_to_variants: functions_to_variants
6579
- }) {
4246
+ const $2cbe7e0ca2ce5438$export$5c069c93d2b7493f = delay => new Promise(resolve => setTimeout(resolve, delay));
4247
+ async function $2d1ffbfaa1c2d9e3$export$bcd70d5ed1cf6313(url, options, max_retries = 10, useFetch = fetch) {
4248
+ const ONE_MINUTE = 60000;
4249
+ const max_backoff_ms = ONE_MINUTE;
6580
4250
  const {
6581
- dlog: dlog,
6582
- err: err,
6583
- Sentry: Sentry
6584
- } = t,
6585
- start = new Date().getTime(),
6586
- optimize = await $d0e7629fb3179e02$export$2fc1a072736ae2f6(window, "google_optimize"),
6587
- end = new Date().getTime();
6588
- dlog("Waited for google_optimize for", end - start, "ms");
6589
- // if (!optimize.get) {
6590
- // debugger;
6591
- // }
6592
- let modify_asnum = Number(optimize.get(experiment_id));
6593
- dlog("optimize says variant is", modify_asnum);
6594
- if (isNaN(modify_asnum)) {
6595
- fail_hard("couldn't get if we're version A or B from google optimize, please check experiment id (" + experiment_id + ")");
6596
- return;
4251
+ stack: stack
4252
+ } = new Error();
4253
+ const calculate_retry = delay => {
4254
+ delay *= 2 + Math.random();
4255
+ if (delay > max_backoff_ms) delay = max_backoff_ms * (1 + Math.random() / 10);
4256
+ return delay;
4257
+ };
4258
+ let try_again_in_ms = 100;
4259
+ let has_succeeded = false;
4260
+ let result = false;
4261
+ while (max_retries && !has_succeeded) try {
4262
+ const response = await useFetch(url, options);
4263
+ const {
4264
+ status: status,
4265
+ ok: ok
4266
+ } = response;
4267
+ if (!response || !ok || status !== 200) {
4268
+ if (status >= 400 && status < 500) {
4269
+ $b04e44fad5ea42c7$export$b3bbfd758f11cfa9($2d1ffbfaa1c2d9e3$var$send_sentry_4xx)(response, options?.body || {}, stack);
4270
+ has_succeeded = true;
4271
+ } else if (status === 404) has_succeeded = true;
4272
+ $649f456f663da9fc$export$de56f1198d121036("Response not ok", response);
4273
+ } else has_succeeded = true;
4274
+ result = response;
4275
+ } catch (error) {
4276
+ $649f456f663da9fc$export$de56f1198d121036("Error while fetching: ", error, url, options);
4277
+ // Don't retry CORS
4278
+ if (error.message.includes("CORS") && error.name.includes("CORS")) has_succeeded = true;
4279
+ } finally {
4280
+ if (!has_succeeded) await $2cbe7e0ca2ce5438$export$5c069c93d2b7493f(try_again_in_ms);
4281
+ try_again_in_ms = calculate_retry(try_again_in_ms);
4282
+ max_retries -= 1;
6597
4283
  }
6598
- const function_for_variant = functions_to_variants[modify_asnum];
6599
- if (!function_for_variant) {
6600
- fail_hard("Invalid variant " + modify_asnum);
4284
+ return result;
4285
+ }
4286
+ async function $2d1ffbfaa1c2d9e3$var$send_sentry_4xx(response, body, stack) {
4287
+ if (process.env.TENANT === "shopify-config" && response.status === 403)
4288
+ // Don't send requests in the shopify admin that say we need to re-authorize to sentry
6601
4289
  return;
6602
- }
6603
- dlog("found function for variant", function_for_variant, "executing");
6604
- return function_for_variant.call(t); // be nice to someone who needs t
6605
- function fail_hard(msg) {
6606
- dlog(msg);
6607
- Sentry.captureMessage(msg);
6608
- }
4290
+ const msg = `Validation error: got 4XX from API`;
4291
+ const text = await response.clone().text();
4292
+ $649f456f663da9fc$export$de56f1198d121036(msg, "body", body, "response", response, "text", text, "stack", stack);
4293
+ (0, $eba382943196079c$export$af2e17a20c2ea3c5).withScope(function (scope) {
4294
+ scope.setExtra("stack", stack);
4295
+ scope.setExtra("request_body", body);
4296
+ scope.setExtra("response", response);
4297
+ scope.setExtra("serialized_response", $5c4afc453f904a1f$export$39d526a1194b6499(response));
4298
+ scope.setExtra("response_text", text);
4299
+ scope.setLevel("error");
4300
+ this.captureException(new Error(msg));
4301
+ });
6609
4302
  }
6610
4303
  function $4f24151f2cddad7b$export$2c2f50b30b7b2576(el, attribute_name, async_iterable, quit_after_navigation = true) {
6611
4304
  (async () => {
@@ -6853,80 +4546,85 @@ function $8bed543774ca0dd4$var$deal_w_removal_of_node_array(node_array, push_dis
6853
4546
  push_disconnector(disconnect_observer);
6854
4547
  }
6855
4548
  }
6856
- const $78270f2ea7ca229f$export$3b75288f46cadd96 = () => new Array($d89638655e64f324$export$bb0a9c36cf454ea0(3, 8)).fill("\u2B1C").join("");
6857
- const $78270f2ea7ca229f$var$make_sel = (image_url, attribute) => `[${attribute}=${JSON.stringify(image_url)}]`;
6858
- const $78270f2ea7ca229f$export$a4eccf92efefa04d = (image_width, image_height, color = "#f6f7f8") => `data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='${image_width}' height='${image_height}' xmlns:v='https://vecta.io/nano'%3e%3cpath d='M0 0h${image_width}.016v${image_height}.01H0' fill='${encodeURIComponent(color)}'/%3e%3c/svg%3e`;
6859
- async function $78270f2ea7ca229f$export$2dd69958012e3e49({
6860
- override_rec_renderer = (0, $6be99244fa573db5$export$50ce83ace0cdd87e),
6861
- image_width = 2000,
6862
- image_height = 2000,
6863
- num_items = 10,
6864
- color = "#d9d9d9",
6865
- on_no_rendering_result: on_no_rendering_result,
6866
- post_rendering: post_rendering
6867
- } = {}) {
6868
- const image_url = $78270f2ea7ca229f$export$a4eccf92efefa04d(image_width, image_height, color);
6869
- return async (t, rendering_options) => {
6870
- // @ts-ignore FIXME: this is a hack to make the type checker happy
6871
- const actual_rendering = override_rec_renderer(t, rendering_options).catch((0, $7547e32486a3abc0$export$8048b892d651b310)); // start rendering first
6872
- const placeholder_opts = {
6873
- ...rendering_options,
6874
- type: "placeholder",
6875
- recs: Array(num_items).fill(1).map(_ => ({
6876
- sale_price: NaN,
6877
- page_url: "#",
6878
- image_url: image_url,
6879
- original_price: NaN,
6880
- product_id: "placeholder",
6881
- recommendation_id: "placeholder",
6882
- title: $78270f2ea7ca229f$export$3b75288f46cadd96(),
6883
- brand: $78270f2ea7ca229f$export$3b75288f46cadd96()
6884
- })),
6885
- view_tracking: [],
6886
- click_tracking: [],
6887
- pre_processors: [],
6888
- post_processors: [elems => {
6889
- if (!elems?.length) return elems;
6890
- for (const elem of elems) {
6891
- if (elem instanceof HTMLElement) elem.style.cursor = "default";
6892
- elem?.classList?.add?.("placeholder");
6893
- elem.addEventListener("click", e => ($649f456f663da9fc$export$de56f1198d121036("Supressing placeholder click", e), e.preventDefault(), e.stopPropagation(), false), true);
6894
- }
6895
- for (const img of $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0(elems, ["src", "srcset", "data-src", "data-srcset"].map(attribute => $78270f2ea7ca229f$var$make_sel(image_url, attribute)).join(", "))) img.classList.add("nolazy"); // this gets ignored by all lazyloaders
6896
- return elems;
6897
- }]
6898
- };
6899
- // @ts-ignore FIXME: this is a hack to make the type checker happy
6900
- const placeholder_rendering = await override_rec_renderer(t, placeholder_opts).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
6901
- let set_should_stay_inserted;
6902
- const should_stay_inserted = new Promise(r => set_should_stay_inserted = r);
6903
- if (placeholder_rendering?.elements) {
6904
- const [template_els, _get_state, set_state] = $49c4fa2e27e642fa$export$3d04c40e7acc1a32(placeholder_rendering.elements);
6905
- actual_rendering.then(async rendering_result => {
6906
- if (typeof post_rendering == "function") await $b04e44fad5ea42c7$export$b3bbfd758f11cfa9(post_rendering)(rendering_result);
6907
- const {
6908
- elements: elements
6909
- } = rendering_result || {};
6910
- await (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element(placeholder_rendering.elements[0]);
6911
- // await new Promise(r => window.addEventListener("contextmenu", r, { once: true }));
6912
- // it's possible that something after this ruins the array reference (aka [...elements]) and therefore it's not safe to call set_state again before the elements are sure to have a parentElement aka being in the DOM
6913
- set_state(elements ?? "");
6914
- if (!elements) {
6915
- on_no_rendering_result?.(rendering_result);
6916
- set_should_stay_inserted(false);
4549
+ let $0a581f1dfa083522$var$existing_style_tag;
4550
+ let $0a581f1dfa083522$var$reactions_in_last_s = 0;
4551
+ const $0a581f1dfa083522$export$59ba1eb2c083f0cd = /*@__PURE__*/$b04e44fad5ea42c7$export$b3bbfd758f11cfa9(async css => {
4552
+ const style_tag = await ($0a581f1dfa083522$var$existing_style_tag ||= (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).wait_for_element("head").then(head => {
4553
+ const tag = document.createElement("style");
4554
+ (0, $0b48ba2f40ce6067$export$b6ae1bc530f4c149).onremoved(
4555
+ // reinsertion for next.js's "portable" <head>
4556
+ tag, eoe => {
4557
+ if (document.head.contains(tag))
4558
+ // just make sure to not freak out if it's already been added again
4559
+ return;
4560
+ if ($0a581f1dfa083522$var$reactions_in_last_s >= 10) {
4561
+ $b04e44fad5ea42c7$export$f18d5b0af29128b7(new Error("Someone removed our styling but insists on it (10 removals in previous second). Giving up \uD83D\uDE2B"), "error");
4562
+ return;
4563
+ }
4564
+ $649f456f663da9fc$export$de56f1198d121036("Someone removed our styling \uD83D\uDE24, reinserting", eoe);
4565
+ $0a581f1dfa083522$var$reactions_in_last_s++;
4566
+ setTimeout(() => $0a581f1dfa083522$var$reactions_in_last_s--, 1000);
4567
+ document.head.append(tag); // we're sure that head exists now since we inserted it there previously
4568
+ });
4569
+
4570
+ $649f456f663da9fc$export$de56f1198d121036("inserting", tag, "into", head);
4571
+ return head.appendChild(tag);
4572
+ }));
4573
+ style_tag.append(css);
4574
+ });
4575
+ const $0a581f1dfa083522$export$a4f97b27a0592e6c = url => (url ? new URL(url, window.location.origin) : window.location).pathname.split("/").filter(a => a).pop()?.replace(/\.html?$/i, "") || "";
4576
+ const $0a581f1dfa083522$export$692b606677218a16 = callback => {
4577
+ if (document.depictwashere) {
4578
+ if (process.env.BUILD_TARGET === "dev") {
4579
+ $649f456f663da9fc$export$de56f1198d121036("HMR tried to rerun us, reloading page");
4580
+ /* eslint-disable no-self-assign */
4581
+ location.href = location.href;
4582
+ }
4583
+ $649f456f663da9fc$export$de56f1198d121036("Script has already ran", document.currentScript, "is exiting");
4584
+ return;
4585
+ }
4586
+ if (process.env.BUILD_TARGET === "dev") /* eslint-disable no-console */console.clear = new Proxy(console.clear, {
4587
+ apply(target, this_arg, arg_list) {
4588
+ if (new Error().stack?.split("\n").filter(Boolean).some(s => s.includes("http://localhost:1234/depict-ai.js"))) {
4589
+ /* eslint-disable no-console */console.log("CSS change detected through hack, reloading");
4590
+ location.reload();
6917
4591
  }
6918
- set_should_stay_inserted(true);
6919
- }).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
6920
- return {
6921
- ...placeholder_rendering,
6922
- elements: template_els,
6923
- should_stay_inserted: should_stay_inserted
6924
- };
4592
+ return target.apply(this_arg, arg_list);
4593
+ }
4594
+ });
4595
+ document.depictwashere = true;
4596
+ callback().catch((0, $7547e32486a3abc0$export$8048b892d651b310));
4597
+ };
4598
+ function $0a581f1dfa083522$export$328e81c44cddf3c0(callback, get_market, supported_markets, unsupported_markets, preferred_demo_market) {
4599
+ $0a581f1dfa083522$export$692b606677218a16(async () => {
4600
+ // Handle override for debug scripts (could be used on demo pages too)
4601
+ if (process.env.DEBUG === "true") {
4602
+ let localstorage_override;
4603
+ const query_param_override = new URLSearchParams(location.search).get("depict-override-market");
4604
+ if (query_param_override !== null) {
4605
+ $649f456f663da9fc$export$de56f1198d121036(`Found ?depict-override-market=${query_param_override}. Using that as the market`);
4606
+ get_market = () => query_param_override;
4607
+ localStorage.setItem("depict-override-market", query_param_override);
4608
+ } else if ((localstorage_override = localStorage.getItem("depict-override-market")) !== null) {
4609
+ $649f456f663da9fc$export$de56f1198d121036(`Found depict-override-market="${localstorage_override}" in localStorage. Using that as the market`);
4610
+ get_market = () => localstorage_override;
4611
+ }
4612
+ }
4613
+ const market = await get_market();
4614
+ if (supported_markets.includes(market)) {
4615
+ $649f456f663da9fc$export$de56f1198d121036(`Initializing with market: ${market}`);
4616
+ return callback(market).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
4617
+ } else if (unsupported_markets.includes(market)) {
4618
+ $649f456f663da9fc$export$de56f1198d121036(`Unsupported market: ${market}. Exiting...`);
4619
+ return;
4620
+ } else if (process.env.DEBUG === "true" && location.host.endsWith(".demo.depict.ai") && preferred_demo_market) {
4621
+ $649f456f663da9fc$export$de56f1198d121036(`On demosite with default market override. Setting market to ${preferred_demo_market}`);
4622
+ return callback(preferred_demo_market).catch((0, $7547e32486a3abc0$export$8048b892d651b310));
6925
4623
  } else {
6926
- $649f456f663da9fc$export$de56f1198d121036("Placeholder rendering went wrong, this is bad! Ditching placeholders");
6927
- return (await actual_rendering) || {};
4624
+ $7547e32486a3abc0$export$8048b892d651b310(new Error(`Unknown market: "${market}". Exiting...`));
4625
+ return;
6928
4626
  }
6929
- };
4627
+ });
6930
4628
  }
6931
4629
  function $a79c7168700020ff$export$8ec5c86406f333ff() {
6932
4630
  const element_weak_set = new WeakSet();
@@ -7843,6 +5541,7 @@ var $914971fb43986a16$var$_tmpl$ = /*#__PURE__*/$qgKv4$template(`<div>`),
7843
5541
  const $914971fb43986a16$var$rendering_options_to_sourceset_component = /*@__PURE__*/new WeakMap();
7844
5542
  // Add nolazy to placeholders to avoid errors with the stupid lazyfier
7845
5543
  const $914971fb43986a16$var$add_nolazy_to_placeholder = type => type === "placeholder" ? "nolazy" : "";
5544
+ const $914971fb43986a16$export$a4eccf92efefa04d = (image_width, image_height, color = "#f6f7f8") => `data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='${image_width}' height='${image_height}' xmlns:v='https://vecta.io/nano'%3e%3cpath d='M0 0h${image_width}.016v${image_height}.01H0' fill='${encodeURIComponent(color)}'/%3e%3c/svg%3e`;
7846
5545
  let $914971fb43986a16$var$inserted = false;
7847
5546
  const $914971fb43986a16$export$788756b42446dc2d = ({
7848
5547
  init_with_placeholder: init_with_placeholder,
@@ -7856,7 +5555,7 @@ const $914971fb43986a16$export$788756b42446dc2d = ({
7856
5555
  const img = process.env.BUILD_TARGET === "modern" || process.env.BUILD_TARGET === "dev" ? $914971fb43986a16$var$Image(options) : $914971fb43986a16$var$CompatibleImage(options);
7857
5556
  if (init_with_placeholder)
7858
5557
  // 10000 is a magic value, that is just supposed to be bigger than the size of the actual image.
7859
- img.querySelectorAll("img").forEach(i => i.src = $78270f2ea7ca229f$export$a4eccf92efefa04d(10000 * options.aspect_ratio, 10000));
5558
+ img.querySelectorAll("img").forEach(i => i.src = $914971fb43986a16$export$a4eccf92efefa04d(10000 * options.aspect_ratio, 10000));
7860
5559
  return img;
7861
5560
  };
7862
5561
  function $914971fb43986a16$var$Image({
@@ -8203,4 +5902,4 @@ function $76266de9d545e64d$export$e35115e6d0715f77() {
8203
5902
  return href;
8204
5903
  }
8205
5904
  $f564adbc4675ceaf$export$2cefb7e61fcbae00("utilishared", (0, $0766c85d387a9765$export$83d89fbfd8236492));
8206
- export { $a035d75d336cf506$export$a13bb02a27aaa5e6 as setOverrideSentryEnvironment, $dadba8832a894987$export$2d9dc2897d88588 as findMostFrequentItem, $5ea3131c5e08d52e$export$a7e53ec3b3fdd030 as base64_decode_unicode, $5ea3131c5e08d52e$export$a1893782a2a6be0d as base64_encode_unicode, $f809bc98a1cb5f92$export$6f051469dd676a8b as make_plp_recommendations_inserted_handler, $f564adbc4675ceaf$export$60d1d0e3cfc8b9ed as version_info, $f564adbc4675ceaf$export$fe609f0216e4ebef as add_version_query_params, $a1c80794e6bf4cc2$export$6e7454c733fa1fb2 as cache_args, $66b898e9bfcef532$export$8582cf3716962dc2 as check_displays, $7547e32486a3abc0$export$8048b892d651b310 as err, $b55a70757989faf4$export$16d7c76794a38a4 as require_event_listener, $ea554f5a28904975$export$41de2959a8dd405d as Auto_GWVM, $f1396aa84761fbe5$export$c83d8da642b5104a as GWVM_Renderer, $92b7ea2cf75c4aec$export$55621c1ce3cd536b as infinite_promise_creator, $09ff985c7c424fb3$export$32ccf3a614c84258 as infinite_promise_no_skip, $075589a94064cf2e$export$c0a4d29bc45a38c6 as infinite_renderer, $efda45906c6cbac7$export$9eae832ae57fbf as deprecated_insert_styling, $e867e2f1fb3bcc09$export$c7187bbd1a7a9244 as placeholder, $7e2d59b061c2c528$export$cab8bc58c64c2013 as Pro_Slider, $51bbc74e39f5e5c6$export$2e2bcd8739ae039 as simplified_template_tool, $762a881271a51d1b$export$f1b8b9fd75ddcab1 as insert_styling_into_slider, $e61f371a9bcdeb2f$export$cd12721587f4f16d as RR_Slider, $366fff12da348e66$export$1a8782481a9af507 as Depict, $d352a8202024de5c$export$30933c637c977eef as get_recs_with_template, $d352a8202024de5c$export$c410ce1205e5118a as default_post_processor, $d352a8202024de5c$export$4f39078bdc72ecd0 as default_pre_processor, $acf11540344875ed$export$2e2bcd8739ae039 as wpff, $cdca9fea6eb103e5$export$12e07a2a9f87578a as ElementObserver, $0b48ba2f40ce6067$export$b6ae1bc530f4c149 as observer, $63cbb5de51d11596$export$34b9dba7ce09269b as jsx, $63cbb5de51d11596$export$25062201e9e25d76 as jsxs, $b9b0dba897847b2a$export$eb0b9ed911409b57 as use_element, $b9b0dba897847b2a$export$f63fcc839cb0f734 as use_listener, $b9b0dba897847b2a$export$22a65337c1b43b1f as classlist, $63cbb5de51d11596$export$ffb0004e005737fa as Fragment, $649f456f663da9fc$export$de56f1198d121036 as dlog, $649f456f663da9fc$export$997143d41f6a0c9b as derror, $649f456f663da9fc$export$c2363754d4758444 as dwarn, $649f456f663da9fc$export$2dd75a6b038dc8cb as set_browser_prefix, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9 as catchify, $b04e44fad5ea42c7$export$f18d5b0af29128b7 as report, $571bce04eb920cd8$export$55fe61489d2c7417 as is_debug, $ca66c9553e84df02$export$6038895ac52bd044 as chevronLeft, $ca66c9553e84df02$export$dc84183312f0c201 as chevronRight, $9a744f57ab06c32e$export$68c017fd93791405 as expandingContainer, $b83068cbd26dcc41$export$3be7054c61590ee3 as Lazyfier, $b83068cbd26dcc41$export$b87d7e0da8b5cbe3 as test_array_proxy_support, $ef9394fafebd5eab$export$692b27c28639e5b9 as Amazing_Slider, $893f9af5dbae6bc8$export$16501883f477737a as colorize_elements, $893f9af5dbae6bc8$export$deca40f48c0569f8 as should_colorizeLogics, $6be99244fa573db5$export$50ce83ace0cdd87e as default_rr, $2d47b009af5bc0a4$export$1bc0df10745d5412 as fetch_recs, $2d47b009af5bc0a4$export$d40679eb4cf32f09 as fetch_recs_whole_response, $5cbe24d064a033ed$export$c42139a43c877ecd as clone_deep, $5cbe24d064a033ed$export$e0009e7da572f99b as regex_templating, $5cbe24d064a033ed$export$a9fc160c5ed83bd7 as Rec_Renderer, $30e801eaa3dc319e$export$17c3166a7ebd4688 as n_col_styling_with_dist, $30e801eaa3dc319e$export$c84671f46d6a1ca as Layout, $30e801eaa3dc319e$export$483bdd1f1186de13 as layout_get_visible_recs_without_partial_rows, $30e801eaa3dc319e$export$3dc5e2383c924ebf as layout_get_total_rec_amount_for_row, $30e801eaa3dc319e$export$717f13d9ba00ca19 as layout_media_query_header, $090b8182afa1b2a6$export$b0a773486c1c2312 as RecommendationGrid, $30f78542ed78cd31$export$82cfdc85a4d15688 as RecommendationSlider, $c1503704e45e6a15$export$6830ae1fbe21e589 as default_click_tracking, $c1503704e45e6a15$export$f37c58ab3d3e3b75 as default_view_tracking, $c1503704e45e6a15$export$dd32cb565eae0a1f as ga_click, $c1503704e45e6a15$export$8d72437623fef90c as gtag_click_post_processor, $c1503704e45e6a15$export$1bffac19f9f0d6fc as gtag_view_post_processor, $c1503704e45e6a15$export$e9106d6e723510d2 as depict_click_tracking_post_processor, $c1503704e45e6a15$export$fb9afe9f540ae069 as recs_inserted_tracking, $c1503704e45e6a15$export$32eb5dd18e963410 as add_to_localstorage, $c1503704e45e6a15$export$9e1caada6901f552 as depict_page_view, $be40b7bf11a47cc4$export$8cbd8aa1c70f9a13 as slider_autoscroll_factory, $d31b48b85102c1ec$export$80039a49055269fb as make_button1, $a75adf1478c4522f$export$af88b4929c2dc86 as make_button2, $2436f68ea927d4a8$export$1d17a045bcc711b1 as slider_dots_factory, $2436f68ea927d4a8$export$a09282b33e69b43f as navdot, $9bb2400c4e2e9335$export$411b0f20794697ce as slider_draggable_factory, $1ce2ae6f640f393f$export$5129719c04a52f8c as slider_fading_factory, $52292921bc0fc31f$export$5723caf9a8335aa6 as slider_fractional_factory, $f78bc6a06402a6cf$export$93223e488e7ee078 as slider_show_scroll, $06fe260f91efff62$export$b36d2489a5a16728 as slider_snap_css, $06fe260f91efff62$export$49b950309ab787ad as can_use_snapping_and_still_scroll, $40bfd400d76a6ec1$export$dac64fd35a4805a4 as slider_snapping_factory, $c33c6faf8acc7442$export$68babfc5be0de5da as Amazing_Lazy_Slider, $556d9c321900f1d4$export$53306504b987cbf7 as slider_wraparound_factory, $159237486410355f$export$419f84efad7d9fe as sizes_to_surface, $159237486410355f$export$417ef0ab13d8b984 as surface_mixer, $159237486410355f$export$be95cb0e8cfd099e as promise_until_next_navigation, $d4ffde0b9fca0369$export$29a6094e0bd8bc5f as AIO, $d4ffde0b9fca0369$export$6ebd242c09192cec as paint_red, $91b2e49f92ed636c$export$2c34560c3749dc63 as bind_to_a2c_button, $91b2e49f92ed636c$export$82a685f2da2fb027 as bind_tracking_to_link, $43683b1103edab15$export$15f8a0cd5a8c0ebb as depict_click, $43683b1103edab15$export$82badda1f9923310 as depict_prefilled, $43683b1103edab15$export$9028351cb994757e as depict_add_to_cart, $43683b1103edab15$export$93ae15b1ae509334 as set_session_id_fn, $43683b1103edab15$export$61e7e1f11e96692f as get_session_id, $43683b1103edab15$export$622991c71a1f52b3 as get_cookie, $43683b1103edab15$export$8c6f26a5b6921b95 as get_tracking_event_context_data, $cafa1ff1049985c2$export$72036d950e1fae95 as filter_depict_payload, $cafa1ff1049985c2$export$28cacbd9b4306ffc as send_depict, $cafa1ff1049985c2$export$cc3b6ddf805f6156 as foolproof_send_beacon, $cafa1ff1049985c2$export$608478473a3304a0 as send_depict_unfiltered, $cafa1ff1049985c2$export$aa26019042811d4f as send_websocket, $42bbbba8196bd057$export$674d8cd8b6868154 as create_ga_queue, $42bbbba8196bd057$export$edfedd0557ca5a2d as make_tracker_send_to_depict, $3abef00489070e23$export$1ff14fec60ed5697 as ga_to_transaction_api, $c749fe63b72056ef$export$f75172d2e289cd02 as send_ga, $c749fe63b72056ef$export$ac7296527cb52311 as setup_ga, $c749fe63b72056ef$export$d031e55ccd4c52dc as setup_gtag, $c749fe63b72056ef$export$f522672c9379e339 as gtag_click, $c749fe63b72056ef$export$bf205937e5e012cb as ga_purchase_click, $c749fe63b72056ef$export$127751e82111fcf as ga_rec_click, $c749fe63b72056ef$export$7babcd5d4056b2ca as gtag_view, $c749fe63b72056ef$export$f3354ec2ce95ebd9 as load_gtag, $ccf918da074d7243$export$4205dc6835bc0d9f as send_impression_event, $21285393646b9849$export$37125ccc5dd98050 as impression_track_element, $405969d60b37fdac$export$d0efd8ed14f5c33 as impression_tracking_post_processor, $ccf918da074d7243$export$c543ee4cdb0d0964 as set_impression_threshold, $ccf918da074d7243$export$135da44d0ba958bc as impression_threshold, $ccf918da074d7243$export$ca8321ea61dc2544 as has_to_be_intersecting_for, $61b3c9e5f2cf8171$export$58c56fe2313fdbe3 as add_new_tab_listener, $61b3c9e5f2cf8171$export$836f70a28c317905 as broadcast_product_id, $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2 as contextmenu_callback, $5dbacdc6a3feeb15$export$7e4427e80d5fc619 as optanon_get_cookie_ipns, $5dbacdc6a3feeb15$export$f0f6c846d96fdbec as init_optanon_tracking, $5dbacdc6a3feeb15$export$1dd9ce50e201eff1 as optanon_get_consent, $5dbacdc6a3feeb15$export$7a6d436e0782c6ed as optanon_wait_for_consent, $847e4a06ea6767c0$export$1ac466d53a6636ac as send_transaction_id_to_depict, $847e4a06ea6767c0$export$9ed4fbc47d558f94 as datalayer_interceptor, $847e4a06ea6767c0$export$b11248fa13a8a86c as datalayer_transaction_id_extractor, $847e4a06ea6767c0$export$3ebd86018b39d9d2 as orderpage_transaction_id_extractor, $847e4a06ea6767c0$export$ff8673d5dea82bd4 as url_transaction_id_extractor, $aa0140679dc70b7a$export$eee4c4d924348b05 as send_page_view_if_needed, $aa0140679dc70b7a$export$f7cb1bd47199ec38 as send_page_view_on_navigation, $4ce764ddfee055ef$export$1d9c6fddbff3441f as DepictAPIWS, $2030306bed68a8c7$export$74108888f38788f3 as ListenableSet, $511123bb28a7b6f7$export$535946eb77c946dd as deparallelize, $511123bb28a7b6f7$export$f241be8e610f5c77 as deparallelize_no_drop, $9ab9ecb74920f343$export$f8ea2e7b15b5d129 as buildThresholdList, $1ce9aeebfbcb93f9$export$d9fdc6ce2907f95b as chaotic_closest, $0bdb8dbcf1bc7f34$export$cfef5d5c9ac09253 as standard_price_format, $0bdb8dbcf1bc7f34$export$9590700a594aef08 as ensure_object_path, $0bdb8dbcf1bc7f34$export$925772df9b4d16e5 as ensure_parameter_in_url, $0bdb8dbcf1bc7f34$export$44951404cb8d0583 as html2elems, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787 as html2elem, $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0 as querySelectorAllElements, $0bdb8dbcf1bc7f34$export$785f04709990c4ec as querySelectorUpwards, $0bdb8dbcf1bc7f34$export$f124e3ee16e6b45d as intl_number_format_with_fallback, $0bdb8dbcf1bc7f34$export$d4bd03f19260ef1c as relativify, $d832040ef2097a0e$export$6b75200e58bc97d0 as deduplicate, $d832040ef2097a0e$export$9426572bd5645bc1 as dedup_products, $ead1f6ae93c69da9$export$82539d9817116aff as navigate_with_next_router, $802201ed0a316c43$export$774bc87373c4fc6c as add_item, $802201ed0a316c43$export$337197b94b3bd680 as get_items_in_cart, $802201ed0a316c43$export$783ef16647773b3d as get_shopify_analytics_meta_product, $802201ed0a316c43$export$ab0f802c05dd969b as intercept, $b6f5b218b1a73900$export$85be83e1935d93c2 as fetch_replacer, $b6f5b218b1a73900$export$f8da66bc4f1d059e as FakeResponse, $2d1ffbfaa1c2d9e3$export$bcd70d5ed1cf6313 as fetch_retry, $1813f33dd0fc7e1d$export$b404e20f3c4a490e as get_optimize_variant, $0d2acf276472ebf7$export$20e9533e68ee72e7 as stateless_href_change_ipns, $0d2acf276472ebf7$export$a9d39e43ae273d26 as href_change_ipns, $0d2acf276472ebf7$export$baccefee4a395d8f as history_replacer, $0d2acf276472ebf7$export$1cd22bab0d2c3b0b as on_next_navigation, $0d2acf276472ebf7$export$7500cdfd37aafd43 as instant_exec_on_suspect_history_change, $607fc90221d440a6$export$e806c6c1615a59ae as async_iterable_ipns, $607fc90221d440a6$export$10c3e52ef388b81b as make_ipns_stateful, $607fc90221d440a6$export$90740b5bc9c2b3b7 as make_ipns_stateless, $ec58be30798d6e95$export$3e42f5078e3abfc0 as make_simple_async_iterable, $ec58be30798d6e95$export$e2c811ae0eb35313 as RawObservableInformation, $4f24151f2cddad7b$export$2c2f50b30b7b2576 as iterable_to_attribute, $8c97019b5f7b0d0e$export$7c081fdbc65b6a2a as iterable_to_elems, $b8270fcf290bb3af$export$927664b47117acb0 as make_asyncIterable_exiter, $693e2a1517bef984$export$f8913c8a18f7ca21 as zip_async_iterables, $8bed543774ca0dd4$export$f811d2ce0aa6019b as insert_surfaces, $8bed543774ca0dd4$export$b8d1e1d07a3f3776 as prevent_infinite_loop, $8bed543774ca0dd4$export$e3f70ef7e3d00501 as revertable_remove, $0a581f1dfa083522$export$59ba1eb2c083f0cd as insert_styling, $0a581f1dfa083522$export$692b606677218a16 as depict_init, $0a581f1dfa083522$export$328e81c44cddf3c0 as depict_init_with_market_logic, $0a581f1dfa083522$export$a4f97b27a0592e6c as normal_get_product_id, $0a581f1dfa083522$export$a96c18473f2af463 as track_a2c, $29407d8301dc2f23$export$515c3ea4d599b05a as javascript_media_query, $39ef887981612535$export$33f937d741e49339 as patched_querySelectorAll, $78270f2ea7ca229f$export$a4eccf92efefa04d as placeholder_svg, $78270f2ea7ca229f$export$2dd69958012e3e49 as make_placeholder_rr, $78270f2ea7ca229f$export$3b75288f46cadd96 as random_text_placeholder, $bb3252f70898acd6$export$947a20746936143d as Promise_Any, $9e268c1aeeb86b34$export$c50e1901e8ed0615 as queueMacroTask, $d89638655e64f324$export$bb0a9c36cf454ea0 as rand, $460df8550f9d084d$export$656831b7e9c341c3 as random_string, $460df8550f9d084d$export$a6db784f019668ba as make_random_classname, $49c4fa2e27e642fa$export$3d04c40e7acc1a32 as reactive_template, $a79c7168700020ff$export$8ec5c86406f333ff as removeChild_error_swallowing_factory, $1dd4146ad893cfb2$export$38e89c688f9d553a as replace_promise_with_native_if_exists_and_enforce, $1dd4146ad893cfb2$export$e647444ed9403635 as get_iframe_promise, $bbb9f33eb5feb86a$export$2a1cc61cffa1f36f as rp_relativify_fetch, $bbb9f33eb5feb86a$export$f14a775632a826c4 as rp_relativify_history, $bbb9f33eb5feb86a$export$2a38b176ce969e2c as rp_relativify_xhr, $bbb9f33eb5feb86a$export$83ec13b10b391f13 as default_rp_fixes, $5c4afc453f904a1f$export$39d526a1194b6499 as serialize_object, $8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4 as sort_obj, $eda086e0899e75b0$export$a422d714c8cb1a5d as standard_get_market, $e72f2f1d48dc3a53$export$3427ec8268623f1 as listenToLocalStorage, $26eaaddf434c84f1$export$8d42ce4827f43582 as Tenant, $55698e6e298abcb0$export$cd1adfb8059b5fcd as timeout_promise, $d0e7629fb3179e02$export$79f910a98828378d as variable_setter_to_ipns, $d0e7629fb3179e02$export$d5062f468a0454f3 as find_descriptor, $d0e7629fb3179e02$export$2fc1a072736ae2f6 as is_available_in, $690d8897acf7a743$export$a739d9a07da7f9ce as use_voyado_id, $2cbe7e0ca2ce5438$export$5c069c93d2b7493f as wait, $4a6ab5f7377729b1$export$f314addd5f976083 as xhr_load, $4a6ab5f7377729b1$export$8e16c51fd2b6507 as xhr_read_interceptor, $4a6ab5f7377729b1$export$c74578d2cd47a84a as xhr_send_interceptor, $4a6ab5f7377729b1$export$33d1643df63073a8 as xhr_replace, $769ce417b39aa7d3$export$4a3043e508dd72f0 as DefaultViewMoreButton, $cf7ca80454d7b4c0$export$8a0e4d6f6abf7e90 as GeneralSideSlidein, $72d170fd5c7cb3fe$export$c068ad5361be7646 as GeneralSizeSelector, $ad592d9ddbcffe72$export$84712d0562a614b8 as Placeholder, $ad592d9ddbcffe72$export$d613f5b6d0a331a8 as ContainedPlaceholderImage, $fbe64cf2cf408e4f$export$97f31f44c68c1d5 as RecommendationContainer, $7693290d077384da$export$ddd70fdae1b350e6 as LeftChevron, $7693290d077384da$export$32a55d57d151bc5a as RightChevron, $6f1582c15e13f2f0$export$590326cc34f49e2d as createColorPicker, $7f57d546b5d5b3d6$export$237455ad7e59d4e5 as useExpandingContainer, $8483d1d9fcee52ec$export$2369f6fc1c911576 as ContainedHoverImage, $914971fb43986a16$export$788756b42446dc2d as ContainedImage, $45af9e834781a9bc$export$f39a7d0667e924a as make_sizes_setter, $45af9e834781a9bc$export$a62825542f1bfcf5 as make_sourceset_component, $45af9e834781a9bc$export$a98fc8a2c818d3d8 as is_safari, $45af9e834781a9bc$export$f7c915448031deac as make_url_with_query_params, $45af9e834781a9bc$export$3d13beba9b52c947 as resize_base_url, $6c2b49f3f564b0d1$export$362abebb4b313340 as base_url, $eba382943196079c$export$af2e17a20c2ea3c5 as Sentry, $4d49697a7a9a77a6$export$9dc8f3a0aa3efc85 as camelCasifyObject, $4d49697a7a9a77a6$export$b481488de1caa85 as snakeCasifyObject, $b828952b0fe1df8f$export$499ef00a6a3417f8 as rgb_to_hsl, $b828952b0fe1df8f$export$e4fd3b61e79357a7 as hsl_to_rgb, $b828952b0fe1df8f$export$98c2b3491e76c1f as relative_luminance_from_rgb, $b828952b0fe1df8f$export$486b165479b9284f as hsb_to_rgb, $b828952b0fe1df8f$export$ca305c142c6fc3cf as hex_to_rgb, $0766c85d387a9765$export$83d89fbfd8236492 as version, $f564adbc4675ceaf$export$2cefb7e61fcbae00 as add_to_version_info, $5dc0c20a00189d47$export$c3f56a35e076f139 as sync_el_content_with_accessor, $76266de9d545e64d$export$e35115e6d0715f77 as use_href_accessor, $155540b3b8aca771$export$fce59460a1699957 as cookiebot_get_consent, $155540b3b8aca771$export$56c2e8be65fb14ae as cookiebot_wait_for_consent, $155540b3b8aca771$export$8827362e5e938d26 as cookiebot_get_cookie_ipns, $155540b3b8aca771$export$abec7fd9f0b9cc22 as init_cookiebot_tracking };
5905
+ export { $a035d75d336cf506$export$a13bb02a27aaa5e6 as setOverrideSentryEnvironment, $dadba8832a894987$export$2d9dc2897d88588 as findMostFrequentItem, $5ea3131c5e08d52e$export$a7e53ec3b3fdd030 as base64_decode_unicode, $5ea3131c5e08d52e$export$a1893782a2a6be0d as base64_encode_unicode, $f809bc98a1cb5f92$export$6f051469dd676a8b as make_plp_recommendations_inserted_handler, $f564adbc4675ceaf$export$60d1d0e3cfc8b9ed as version_info, $f564adbc4675ceaf$export$fe609f0216e4ebef as add_version_query_params, $a1c80794e6bf4cc2$export$6e7454c733fa1fb2 as cache_args, $66b898e9bfcef532$export$8582cf3716962dc2 as check_displays, $7547e32486a3abc0$export$8048b892d651b310 as err, $b55a70757989faf4$export$16d7c76794a38a4 as require_event_listener, $92b7ea2cf75c4aec$export$55621c1ce3cd536b as infinite_promise_creator, $09ff985c7c424fb3$export$32ccf3a614c84258 as infinite_promise_no_skip, $e867e2f1fb3bcc09$export$c7187bbd1a7a9244 as placeholder, $762a881271a51d1b$export$f1b8b9fd75ddcab1 as insert_styling_into_slider, $acf11540344875ed$export$2e2bcd8739ae039 as wpff, $cdca9fea6eb103e5$export$12e07a2a9f87578a as ElementObserver, $0b48ba2f40ce6067$export$b6ae1bc530f4c149 as observer, $63cbb5de51d11596$export$34b9dba7ce09269b as jsx, $63cbb5de51d11596$export$25062201e9e25d76 as jsxs, $b9b0dba897847b2a$export$eb0b9ed911409b57 as use_element, $b9b0dba897847b2a$export$f63fcc839cb0f734 as use_listener, $b9b0dba897847b2a$export$22a65337c1b43b1f as classlist, $63cbb5de51d11596$export$ffb0004e005737fa as Fragment, $649f456f663da9fc$export$de56f1198d121036 as dlog, $649f456f663da9fc$export$997143d41f6a0c9b as derror, $649f456f663da9fc$export$c2363754d4758444 as dwarn, $649f456f663da9fc$export$2dd75a6b038dc8cb as set_browser_prefix, $b04e44fad5ea42c7$export$b3bbfd758f11cfa9 as catchify, $b04e44fad5ea42c7$export$f18d5b0af29128b7 as report, $571bce04eb920cd8$export$55fe61489d2c7417 as is_debug, $ca66c9553e84df02$export$6038895ac52bd044 as chevronLeft, $ca66c9553e84df02$export$dc84183312f0c201 as chevronRight, $9a744f57ab06c32e$export$68c017fd93791405 as expandingContainer, $b83068cbd26dcc41$export$3be7054c61590ee3 as Lazyfier, $b83068cbd26dcc41$export$b87d7e0da8b5cbe3 as test_array_proxy_support, $ef9394fafebd5eab$export$692b27c28639e5b9 as Amazing_Slider, $893f9af5dbae6bc8$export$16501883f477737a as colorize_elements, $893f9af5dbae6bc8$export$deca40f48c0569f8 as should_colorizeLogics, $30e801eaa3dc319e$export$17c3166a7ebd4688 as n_col_styling_with_dist, $30e801eaa3dc319e$export$c84671f46d6a1ca as Layout, $30e801eaa3dc319e$export$483bdd1f1186de13 as layout_get_visible_recs_without_partial_rows, $30e801eaa3dc319e$export$3dc5e2383c924ebf as layout_get_total_rec_amount_for_row, $30e801eaa3dc319e$export$717f13d9ba00ca19 as layout_media_query_header, $be40b7bf11a47cc4$export$8cbd8aa1c70f9a13 as slider_autoscroll_factory, $d31b48b85102c1ec$export$80039a49055269fb as make_button1, $a75adf1478c4522f$export$af88b4929c2dc86 as make_button2, $2436f68ea927d4a8$export$1d17a045bcc711b1 as slider_dots_factory, $2436f68ea927d4a8$export$a09282b33e69b43f as navdot, $9bb2400c4e2e9335$export$411b0f20794697ce as slider_draggable_factory, $1ce2ae6f640f393f$export$5129719c04a52f8c as slider_fading_factory, $52292921bc0fc31f$export$5723caf9a8335aa6 as slider_fractional_factory, $f78bc6a06402a6cf$export$93223e488e7ee078 as slider_show_scroll, $06fe260f91efff62$export$b36d2489a5a16728 as slider_snap_css, $06fe260f91efff62$export$49b950309ab787ad as can_use_snapping_and_still_scroll, $40bfd400d76a6ec1$export$dac64fd35a4805a4 as slider_snapping_factory, $c33c6faf8acc7442$export$68babfc5be0de5da as Amazing_Lazy_Slider, $159237486410355f$export$419f84efad7d9fe as sizes_to_surface, $159237486410355f$export$417ef0ab13d8b984 as surface_mixer, $159237486410355f$export$be95cb0e8cfd099e as promise_until_next_navigation, $91b2e49f92ed636c$export$2c34560c3749dc63 as bind_to_a2c_button, $91b2e49f92ed636c$export$82a685f2da2fb027 as bind_tracking_to_link, $43683b1103edab15$export$15f8a0cd5a8c0ebb as depict_click, $43683b1103edab15$export$82badda1f9923310 as depict_prefilled, $43683b1103edab15$export$9028351cb994757e as depict_add_to_cart, $43683b1103edab15$export$93ae15b1ae509334 as set_session_id_fn, $43683b1103edab15$export$61e7e1f11e96692f as get_session_id, $43683b1103edab15$export$622991c71a1f52b3 as get_cookie, $43683b1103edab15$export$8c6f26a5b6921b95 as get_tracking_event_context_data, $cafa1ff1049985c2$export$72036d950e1fae95 as filter_depict_payload, $cafa1ff1049985c2$export$28cacbd9b4306ffc as send_depict, $cafa1ff1049985c2$export$cc3b6ddf805f6156 as foolproof_send_beacon, $cafa1ff1049985c2$export$608478473a3304a0 as send_depict_unfiltered, $cafa1ff1049985c2$export$aa26019042811d4f as send_websocket, $42bbbba8196bd057$export$674d8cd8b6868154 as create_ga_queue, $42bbbba8196bd057$export$edfedd0557ca5a2d as make_tracker_send_to_depict, $ccf918da074d7243$export$4205dc6835bc0d9f as send_impression_event, $21285393646b9849$export$37125ccc5dd98050 as impression_track_element, $405969d60b37fdac$export$d0efd8ed14f5c33 as impression_tracking_post_processor, $ccf918da074d7243$export$c543ee4cdb0d0964 as set_impression_threshold, $ccf918da074d7243$export$135da44d0ba958bc as impression_threshold, $ccf918da074d7243$export$ca8321ea61dc2544 as has_to_be_intersecting_for, $61b3c9e5f2cf8171$export$58c56fe2313fdbe3 as add_new_tab_listener, $61b3c9e5f2cf8171$export$836f70a28c317905 as broadcast_product_id, $61b3c9e5f2cf8171$export$8f66c4c7fb96eda2 as contextmenu_callback, $aa0140679dc70b7a$export$eee4c4d924348b05 as send_page_view_if_needed, $aa0140679dc70b7a$export$f7cb1bd47199ec38 as send_page_view_on_navigation, $4ce764ddfee055ef$export$1d9c6fddbff3441f as DepictAPIWS, $2030306bed68a8c7$export$74108888f38788f3 as ListenableSet, $511123bb28a7b6f7$export$535946eb77c946dd as deparallelize, $511123bb28a7b6f7$export$f241be8e610f5c77 as deparallelize_no_drop, $9ab9ecb74920f343$export$f8ea2e7b15b5d129 as buildThresholdList, $1ce9aeebfbcb93f9$export$d9fdc6ce2907f95b as chaotic_closest, $0bdb8dbcf1bc7f34$export$cfef5d5c9ac09253 as standard_price_format, $0bdb8dbcf1bc7f34$export$9590700a594aef08 as ensure_object_path, $0bdb8dbcf1bc7f34$export$925772df9b4d16e5 as ensure_parameter_in_url, $0bdb8dbcf1bc7f34$export$44951404cb8d0583 as html2elems, $0bdb8dbcf1bc7f34$export$d3e2a0560cbf4787 as html2elem, $0bdb8dbcf1bc7f34$export$5e63aea0cac01fa0 as querySelectorAllElements, $0bdb8dbcf1bc7f34$export$785f04709990c4ec as querySelectorUpwards, $0bdb8dbcf1bc7f34$export$f124e3ee16e6b45d as intl_number_format_with_fallback, $0bdb8dbcf1bc7f34$export$d4bd03f19260ef1c as relativify, $d832040ef2097a0e$export$6b75200e58bc97d0 as deduplicate, $d832040ef2097a0e$export$9426572bd5645bc1 as dedup_products, $ead1f6ae93c69da9$export$82539d9817116aff as navigate_with_next_router, $802201ed0a316c43$export$774bc87373c4fc6c as add_item, $802201ed0a316c43$export$337197b94b3bd680 as get_items_in_cart, $802201ed0a316c43$export$783ef16647773b3d as get_shopify_analytics_meta_product, $802201ed0a316c43$export$ab0f802c05dd969b as intercept, $b6f5b218b1a73900$export$85be83e1935d93c2 as fetch_replacer, $b6f5b218b1a73900$export$f8da66bc4f1d059e as FakeResponse, $2d1ffbfaa1c2d9e3$export$bcd70d5ed1cf6313 as fetch_retry, $0d2acf276472ebf7$export$20e9533e68ee72e7 as stateless_href_change_ipns, $0d2acf276472ebf7$export$a9d39e43ae273d26 as href_change_ipns, $0d2acf276472ebf7$export$baccefee4a395d8f as history_replacer, $0d2acf276472ebf7$export$1cd22bab0d2c3b0b as on_next_navigation, $0d2acf276472ebf7$export$7500cdfd37aafd43 as instant_exec_on_suspect_history_change, $607fc90221d440a6$export$e806c6c1615a59ae as async_iterable_ipns, $607fc90221d440a6$export$10c3e52ef388b81b as make_ipns_stateful, $607fc90221d440a6$export$90740b5bc9c2b3b7 as make_ipns_stateless, $ec58be30798d6e95$export$3e42f5078e3abfc0 as make_simple_async_iterable, $ec58be30798d6e95$export$e2c811ae0eb35313 as RawObservableInformation, $4f24151f2cddad7b$export$2c2f50b30b7b2576 as iterable_to_attribute, $8c97019b5f7b0d0e$export$7c081fdbc65b6a2a as iterable_to_elems, $b8270fcf290bb3af$export$927664b47117acb0 as make_asyncIterable_exiter, $693e2a1517bef984$export$f8913c8a18f7ca21 as zip_async_iterables, $8bed543774ca0dd4$export$f811d2ce0aa6019b as insert_surfaces, $8bed543774ca0dd4$export$b8d1e1d07a3f3776 as prevent_infinite_loop, $8bed543774ca0dd4$export$e3f70ef7e3d00501 as revertable_remove, $0a581f1dfa083522$export$59ba1eb2c083f0cd as insert_styling, $0a581f1dfa083522$export$692b606677218a16 as depict_init, $0a581f1dfa083522$export$328e81c44cddf3c0 as depict_init_with_market_logic, $0a581f1dfa083522$export$a4f97b27a0592e6c as normal_get_product_id, $29407d8301dc2f23$export$515c3ea4d599b05a as javascript_media_query, $39ef887981612535$export$33f937d741e49339 as patched_querySelectorAll, $bb3252f70898acd6$export$947a20746936143d as Promise_Any, $9e268c1aeeb86b34$export$c50e1901e8ed0615 as queueMacroTask, $d89638655e64f324$export$bb0a9c36cf454ea0 as rand, $460df8550f9d084d$export$656831b7e9c341c3 as random_string, $460df8550f9d084d$export$a6db784f019668ba as make_random_classname, $49c4fa2e27e642fa$export$3d04c40e7acc1a32 as reactive_template, $a79c7168700020ff$export$8ec5c86406f333ff as removeChild_error_swallowing_factory, $1dd4146ad893cfb2$export$38e89c688f9d553a as replace_promise_with_native_if_exists_and_enforce, $1dd4146ad893cfb2$export$e647444ed9403635 as get_iframe_promise, $bbb9f33eb5feb86a$export$2a1cc61cffa1f36f as rp_relativify_fetch, $bbb9f33eb5feb86a$export$f14a775632a826c4 as rp_relativify_history, $bbb9f33eb5feb86a$export$2a38b176ce969e2c as rp_relativify_xhr, $bbb9f33eb5feb86a$export$83ec13b10b391f13 as default_rp_fixes, $5c4afc453f904a1f$export$39d526a1194b6499 as serialize_object, $8d4dfadc5e12c7fb$export$12b4c6cbc6b8b4e4 as sort_obj, $eda086e0899e75b0$export$a422d714c8cb1a5d as standard_get_market, $e72f2f1d48dc3a53$export$3427ec8268623f1 as listenToLocalStorage, $55698e6e298abcb0$export$cd1adfb8059b5fcd as timeout_promise, $d0e7629fb3179e02$export$79f910a98828378d as variable_setter_to_ipns, $d0e7629fb3179e02$export$d5062f468a0454f3 as find_descriptor, $d0e7629fb3179e02$export$2fc1a072736ae2f6 as is_available_in, $690d8897acf7a743$export$a739d9a07da7f9ce as use_voyado_id, $2cbe7e0ca2ce5438$export$5c069c93d2b7493f as wait, $4a6ab5f7377729b1$export$f314addd5f976083 as xhr_load, $4a6ab5f7377729b1$export$8e16c51fd2b6507 as xhr_read_interceptor, $4a6ab5f7377729b1$export$c74578d2cd47a84a as xhr_send_interceptor, $4a6ab5f7377729b1$export$33d1643df63073a8 as xhr_replace, $769ce417b39aa7d3$export$4a3043e508dd72f0 as DefaultViewMoreButton, $cf7ca80454d7b4c0$export$8a0e4d6f6abf7e90 as GeneralSideSlidein, $72d170fd5c7cb3fe$export$c068ad5361be7646 as GeneralSizeSelector, $ad592d9ddbcffe72$export$84712d0562a614b8 as Placeholder, $ad592d9ddbcffe72$export$d613f5b6d0a331a8 as ContainedPlaceholderImage, $fbe64cf2cf408e4f$export$97f31f44c68c1d5 as RecommendationContainer, $7693290d077384da$export$ddd70fdae1b350e6 as LeftChevron, $7693290d077384da$export$32a55d57d151bc5a as RightChevron, $6f1582c15e13f2f0$export$590326cc34f49e2d as createColorPicker, $7f57d546b5d5b3d6$export$237455ad7e59d4e5 as useExpandingContainer, $8483d1d9fcee52ec$export$2369f6fc1c911576 as ContainedHoverImage, $914971fb43986a16$export$788756b42446dc2d as ContainedImage, $45af9e834781a9bc$export$f39a7d0667e924a as make_sizes_setter, $45af9e834781a9bc$export$a62825542f1bfcf5 as make_sourceset_component, $45af9e834781a9bc$export$a98fc8a2c818d3d8 as is_safari, $45af9e834781a9bc$export$f7c915448031deac as make_url_with_query_params, $45af9e834781a9bc$export$3d13beba9b52c947 as resize_base_url, $6c2b49f3f564b0d1$export$362abebb4b313340 as base_url, $eba382943196079c$export$af2e17a20c2ea3c5 as Sentry, $4d49697a7a9a77a6$export$9dc8f3a0aa3efc85 as camelCasifyObject, $4d49697a7a9a77a6$export$b481488de1caa85 as snakeCasifyObject, $b828952b0fe1df8f$export$499ef00a6a3417f8 as rgb_to_hsl, $b828952b0fe1df8f$export$e4fd3b61e79357a7 as hsl_to_rgb, $b828952b0fe1df8f$export$98c2b3491e76c1f as relative_luminance_from_rgb, $b828952b0fe1df8f$export$486b165479b9284f as hsb_to_rgb, $b828952b0fe1df8f$export$ca305c142c6fc3cf as hex_to_rgb, $0766c85d387a9765$export$83d89fbfd8236492 as version, $f564adbc4675ceaf$export$2cefb7e61fcbae00 as add_to_version_info, $5dc0c20a00189d47$export$c3f56a35e076f139 as sync_el_content_with_accessor, $76266de9d545e64d$export$e35115e6d0715f77 as use_href_accessor };