@depict-ai/ui 2.0.21 → 2.0.23

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/ES10/index.cjs CHANGED
@@ -16,6 +16,8 @@ function $parcel$export(e, n, v, s) {
16
16
  function $parcel$interopDefault(a) {
17
17
  return a && a.__esModule ? a.default : a;
18
18
  }
19
+ $parcel$export(module.exports, "encode_filters", () => $a68b73fd7ba0853f$export$58aa3f171519b6d7);
20
+ $parcel$export(module.exports, "decode_filters", () => $a68b73fd7ba0853f$export$f934fa24c3a86811);
19
21
  $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $28535bb7671c63d1$export$d7b7ab832c20e2f4);
20
22
  $parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export$e68cff63f76bd15b);
21
23
  $parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
@@ -72,7 +74,185 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
72
74
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
73
75
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
74
76
  /*! Depict.ai search and product listing SDK */
75
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.21";
77
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.0.23";
78
+ const $a68b73fd7ba0853f$var$fallback_operator = "in";
79
+ const $a68b73fd7ba0853f$var$fallback_token = "";
80
+ const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
81
+ const $a68b73fd7ba0853f$var$operator_map = {
82
+ "eq": "≡",
83
+ "neq": "≠",
84
+ "in": "∈",
85
+ "nin": "∉",
86
+ "leq": "≤",
87
+ "geq": "≥",
88
+ "inrange": "\uD83D\uDD22"
89
+ };
90
+ const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
91
+ const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
92
+ const $a68b73fd7ba0853f$var$range_delimiter = "-";
93
+ const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
94
+ const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
95
+ const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
96
+ const $a68b73fd7ba0853f$var$op_to_token = op => {
97
+ if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
98
+ return $a68b73fd7ba0853f$var$operator_map[op];
99
+ };
100
+ /**
101
+ * Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
102
+ * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
103
+ * No deep or mixed nesting levels are supported.
104
+ */
105
+ function $a68b73fd7ba0853f$var$array_is_serializable(array) {
106
+ let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
107
+ if (array.every(item => Array.isArray(item))) {
108
+ if (!is_root)
109
+ // Deeply nested arrays are not supported, but also don't exist as filters (yet)
110
+ return false;
111
+ return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
112
+ }
113
+ if (array.some(item => typeof item !== "string"))
114
+ // Numbers are not supported, since 1 and "1" would encode to the same thing
115
+ return false;
116
+ // Encoding reserved characters is not supported
117
+ return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
118
+ }
119
+ /**
120
+ * Human readable string[] or string[][] serialization for URLs.
121
+ * @param array
122
+ * @returns
123
+ */
124
+ function $a68b73fd7ba0853f$var$encode_array(array) {
125
+ const is_nested = array.every(item => Array.isArray(item));
126
+ if (is_nested) return array.map($a68b73fd7ba0853f$var$encode_array).join($a68b73fd7ba0853f$var$array_item_delimiter) + $a68b73fd7ba0853f$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
127
+ return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
128
+ }
129
+ function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
130
+ const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
131
+ if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
132
+ .map($a68b73fd7ba0853f$var$decode_array);
133
+ return encoded_array.split($a68b73fd7ba0853f$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
134
+ .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
135
+ }
136
+ function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
137
+ if (data === "true")
138
+ // boolean encoding
139
+ return "1";
140
+ if (data === "false")
141
+ // boolean encoding
142
+ return "0";
143
+ const data_is_array = Array.isArray(data);
144
+ if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
145
+ // numeric range filter encoding
146
+ return data.join($a68b73fd7ba0853f$var$range_delimiter);
147
+ if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
148
+ const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
149
+ if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
150
+ // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
151
+ // In that case we add a delimiter suffix at the end
152
+ return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
153
+ return encoded_data;
154
+ }
155
+ // Fallback encoding
156
+ return $52FdA$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
157
+ }
158
+ function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
159
+ if (encoded_data === "1") return "true";
160
+ if (encoded_data === "0") return "false";
161
+ if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
162
+ if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
163
+ try {
164
+ return JSON.parse($52FdA$depictaiutilishared.base64_decode_unicode(encoded_data));
165
+ } catch (e) {
166
+ $52FdA$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
167
+ }
168
+ return null;
169
+ }
170
+ function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
171
+ for (const filter of filters) {
172
+ const {
173
+ field: field,
174
+ op: op,
175
+ data: data
176
+ } = filter;
177
+ const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
178
+ search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
179
+ }
180
+ }
181
+ function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
182
+ const found_filters = [];
183
+ for (const key of search_params.keys()) {
184
+ // Allow for backwards compatibility with the old filter query param prefix
185
+ let chosen_prefix = filter_query_param_prefix;
186
+ if (!key.startsWith(chosen_prefix)) {
187
+ chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
188
+ if (!key.startsWith(chosen_prefix)) continue;
189
+ }
190
+ const encoded_data = search_params.get(key);
191
+ if (!encoded_data) continue;
192
+ const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
193
+ let [, token] = _ref;
194
+ return key.endsWith(token);
195
+ }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
196
+ const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
197
+ if (!data) continue;
198
+ const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
199
+ found_filters.push({
200
+ field: field,
201
+ op: op,
202
+ data: data
203
+ });
204
+ }
205
+ return found_filters;
206
+ }
207
+ function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
208
+ if (!sorting) return;
209
+ const {
210
+ field: field,
211
+ order: order
212
+ } = sorting;
213
+ const ascending = order === "asc";
214
+ search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
215
+ }
216
+ function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
217
+ const encoded_sorting = search_params.get(sorting_query_param_);
218
+ if (!encoded_sorting) return;
219
+ if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
220
+ field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
221
+ order: "asc"
222
+ };
223
+ if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
224
+ field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
225
+ order: "desc"
226
+ };
227
+ $52FdA$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
228
+ return;
229
+ }
230
+ function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
231
+ // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
232
+ const keys = [...search_params.keys()];
233
+ for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($a68b73fd7ba0853f$var$legacy_filter_prefix)) search_params.delete(key);
234
+ }
235
+ const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
236
+ function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
237
+ let {
238
+ to_url_: to_url_,
239
+ set_clearing_flag_: set_clearing_flag_,
240
+ from_search_params_ = new URLSearchParams(location.search),
241
+ sorting_query_param_: sorting_query_param_,
242
+ filter_query_param_prefix_: filter_query_param_prefix_
243
+ } = _ref2;
244
+ if (!to_url_) return to_url_;
245
+ const was_url_object = to_url_ instanceof URL;
246
+ const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
247
+ const {
248
+ searchParams: searchParams
249
+ } = url_object;
250
+ if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
251
+ if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
252
+ for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
253
+ if (was_url_object) return url_object;
254
+ return url_object.href;
255
+ }
76
256
  const $d067f3a30f047b41$var$ListingContext = /*@__PURE__*/$52FdA$solidjs.createContext();
77
257
  function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
78
258
  const our_object = {};
@@ -1314,6 +1494,14 @@ function $083b2336093176cf$export$3b621d86b1566b2() {
1314
1494
  return _el$;
1315
1495
  })();
1316
1496
  }
1497
+
1498
+ /**
1499
+ * Lower cases a string if possible. Mostly used to make the filter url values case-insensitive.
1500
+ */
1501
+ function $e2d74bb03cc5252e$export$325f75597868c4f0(stuff) {
1502
+ if (typeof stuff !== "string") return stuff;
1503
+ return stuff.toLowerCase();
1504
+ }
1317
1505
  const $c5842bdb10e57229$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class="clear-all-filters minor"></button>`, 2),
1318
1506
  $c5842bdb10e57229$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="inner"><span class="title"><!#><!/>: </span><!#><!/></div>`, 8),
1319
1507
  $c5842bdb10e57229$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class="clear-filter major"><!#><!/><span><!#><!/><!#><!/><!#><!/> – <!#><!/><!#><!/><!#><!/></span></button>`, 18),
@@ -1404,7 +1592,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1404
1592
  let created_an_object = false;
1405
1593
  for (let j = 0; j < value.length; j++) {
1406
1594
  var _pointer;
1407
- const this_categories_name = value[j];
1595
+ const this_categories_name = $e2d74bb03cc5252e$export$325f75597868c4f0(value[j]);
1408
1596
  const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
1409
1597
  const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
1410
1598
  const created_obj = {
@@ -1510,7 +1698,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1510
1698
  var _meta, _meta$values;
1511
1699
  const sel_d = selected_data();
1512
1700
  return (_meta = meta()) === null || _meta === void 0 ? void 0 : (_meta$values = _meta.values) === null || _meta$values === void 0 ? void 0 : _meta$values.findIndex(value => {
1513
- return value === sel_d || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => sel_d[index] === item);
1701
+ return $e2d74bb03cc5252e$export$325f75597868c4f0(value) === $e2d74bb03cc5252e$export$325f75597868c4f0(sel_d) || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => $e2d74bb03cc5252e$export$325f75597868c4f0(sel_d[index]) === $e2d74bb03cc5252e$export$325f75597868c4f0(item));
1514
1702
  });
1515
1703
  });
1516
1704
  const name = $52FdA$solidjs.createMemo(() => {
@@ -1526,7 +1714,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1526
1714
  let pointer = structure;
1527
1715
  for (const step of selected_data()) {
1528
1716
  var _pointer2, _we_in_structure;
1529
- we_in_structure = (_pointer2 = pointer) === null || _pointer2 === void 0 ? void 0 : _pointer2[step];
1717
+ we_in_structure = (_pointer2 = pointer) === null || _pointer2 === void 0 ? void 0 : _pointer2[$e2d74bb03cc5252e$export$325f75597868c4f0(step)];
1530
1718
  pointer = (_we_in_structure = we_in_structure) === null || _we_in_structure === void 0 ? void 0 : _we_in_structure.children_;
1531
1719
  }
1532
1720
  return we_in_structure;
@@ -1541,7 +1729,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1541
1729
  let {
1542
1730
  value_: value_
1543
1731
  } = _ref2;
1544
- return (_iterable_selected_fi = iterable_selected_filter_data()) === null || _iterable_selected_fi === void 0 ? void 0 : _iterable_selected_fi.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => v[index] === val));
1732
+ return (_iterable_selected_fi = iterable_selected_filter_data()) === null || _iterable_selected_fi === void 0 ? void 0 : _iterable_selected_fi.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => $e2d74bb03cc5252e$export$325f75597868c4f0(v[index]) === $e2d74bb03cc5252e$export$325f75597868c4f0(val)));
1545
1733
  });
1546
1734
  return false;
1547
1735
  });
@@ -1564,7 +1752,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1564
1752
  cloned_selected_filters.splice(index_in_selected_filters, 1);
1565
1753
  const data = filter().data;
1566
1754
  const cloned_data = Array.isArray(data) ? [...data] : [data];
1567
- const index_of_item = cloned_data.findIndex(item => item === to_remove);
1755
+ const index_of_item = cloned_data.findIndex(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === $e2d74bb03cc5252e$export$325f75597868c4f0(to_remove));
1568
1756
  if (index_of_item >= 0) cloned_data.splice(index_of_item, 1);
1569
1757
  const in_structure = us_in_structure();
1570
1758
  if (in_structure) {
@@ -1575,7 +1763,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1575
1763
  const {
1576
1764
  value_: value_
1577
1765
  } = kid;
1578
- const index_to_remove = cloned_data.findIndex(item => Array.isArray(item) && item.length === value_.length && value_.every((val, index) => item[index] === val));
1766
+ const index_to_remove = cloned_data.findIndex(item => Array.isArray(item) && item.length === value_.length && value_.every((val, index) => $e2d74bb03cc5252e$export$325f75597868c4f0(item[index]) === $e2d74bb03cc5252e$export$325f75597868c4f0(val)));
1579
1767
  if (index_to_remove >= 0) cloned_data.splice(index_to_remove, 1);
1580
1768
  recursive_kids.push(...Object.values(kid.children_));
1581
1769
  }
@@ -1766,6 +1954,12 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
1766
1954
  });
1767
1955
  const render_checkbox = checkbox => {
1768
1956
  // Checkbox always calls the getters in props, so we don't wrap these values into memos
1957
+ const is_checked = $52FdA$solidjs.createMemo(() => {
1958
+ var _existing_filter;
1959
+ const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
1960
+ const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
1961
+ return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
1962
+ });
1769
1963
  return $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
1770
1964
  get value_() {
1771
1965
  return checkbox().value_;
@@ -1777,8 +1971,7 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
1777
1971
  return checkbox().count_;
1778
1972
  },
1779
1973
  get checked_() {
1780
- var _existing_filter, _existing_filter$data;
1781
- return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(checkbox().value_);
1974
+ return is_checked();
1782
1975
  }
1783
1976
  });
1784
1977
  };
@@ -1945,7 +2138,7 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
1945
2138
  var _existing_filter;
1946
2139
  const v = value();
1947
2140
  const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
1948
- if (data === v) return true;
2141
+ if ($e2d74bb03cc5252e$export$325f75597868c4f0(data) === $e2d74bb03cc5252e$export$325f75597868c4f0(v)) return true;
1949
2142
  return Array.isArray(data) && data.every((item, index) => item === v[index]);
1950
2143
  })());
1951
2144
  return _el$2;
@@ -2714,7 +2907,7 @@ function $9c1d49181fb3002a$var$create_updating_signal(_ref3) {
2714
2907
  var _existing_filter_$dat, _existing_filter_$dat2;
2715
2908
  // wait for the children to have populated and us to have received the correct value_ and name_ values
2716
2909
  let updating_blocked = false;
2717
- const index_of_us_in_selected_filter = existing_filter_ === null || existing_filter_ === void 0 ? void 0 : (_existing_filter_$dat = existing_filter_.data) === null || _existing_filter_$dat === void 0 ? void 0 : (_existing_filter_$dat2 = _existing_filter_$dat.findIndex) === null || _existing_filter_$dat2 === void 0 ? void 0 : _existing_filter_$dat2.call(_existing_filter_$dat, el => el.length === self_.value_.length && el.every((sub_el, index) => self_.value_[index] === sub_el));
2910
+ const index_of_us_in_selected_filter = existing_filter_ === null || existing_filter_ === void 0 ? void 0 : (_existing_filter_$dat = existing_filter_.data) === null || _existing_filter_$dat === void 0 ? void 0 : (_existing_filter_$dat2 = _existing_filter_$dat.findIndex) === null || _existing_filter_$dat2 === void 0 ? void 0 : _existing_filter_$dat2.call(_existing_filter_$dat, el => el.length === self_.value_.length && el.every((sub_el, index) => $e2d74bb03cc5252e$export$325f75597868c4f0(self_.value_[index]) === $e2d74bb03cc5252e$export$325f75597868c4f0(sub_el)));
2718
2911
  signal_.push(...$52FdA$solidjs.createSignal(index_of_us_in_selected_filter >= 0));
2719
2912
  const [read_checked, write_checked] = signal_;
2720
2913
  const child_objects = Object.values(self_.children_);
@@ -2906,8 +3099,10 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
2906
3099
  },
2907
3100
  children: value => {
2908
3101
  const is_selected = $52FdA$solidjs.createMemo(() => {
2909
- var _existing_filter, _existing_filter$data;
2910
- return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(value().value_);
3102
+ var _existing_filter;
3103
+ const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
3104
+ const current_value = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3105
+ return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === current_value));
2911
3106
  });
2912
3107
  const MakeButton = attributes => (() => {
2913
3108
  const _el$2 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$3),
@@ -2943,7 +3138,10 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
2943
3138
  ...base_object,
2944
3139
  data: new_data
2945
3140
  };
2946
- if (!is_selected()) new_filter_object.data.push(value().value_);else new_filter_object.data = new_filter_object.data.filter(v => v !== value().value_);
3141
+ if (!is_selected()) new_filter_object.data.push(value().value_);else {
3142
+ const current_value_lower = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3143
+ new_filter_object.data = new_filter_object.data.filter(v => $e2d74bb03cc5252e$export$325f75597868c4f0(v) !== current_value_lower);
3144
+ }
2947
3145
  const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
2948
3146
  set_selected_filters(selected_filters);
2949
3147
  });
@@ -3045,16 +3243,6 @@ function $cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes, set_cols_at_
3045
3243
  overrides: column_to_row_result
3046
3244
  }]]);
3047
3245
  }
3048
- function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
3049
- const signal = $52FdA$solidjs.createSignal(false);
3050
- $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
3051
- let {
3052
- matches: matches
3053
- } = _ref;
3054
- return signal[1](matches);
3055
- }).remove);
3056
- return signal[0];
3057
- }
3058
3246
  const $476a3dc36afc1938$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<form class="checkbox-color"><!#><!/><!#><!/></form>`, 6);
3059
3247
  const $476a3dc36afc1938$var$max_visible_without_collapsing = 30;
3060
3248
  const $476a3dc36afc1938$var$show_non_collapsible_when_collapsed = 8;
@@ -3065,7 +3253,6 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3065
3253
  i18n_: i18n_,
3066
3254
  view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
3067
3255
  } = _ref;
3068
- const supports_hover = $3e17e871e9d0911d$export$d9f36cf74e24d595("not all and (hover: none)");
3069
3256
  // same as in CheckboxFilter, maybe we should make this DRY at some point
3070
3257
  const existing_filter = $52FdA$solidjs.createMemo(() => {
3071
3258
  const {
@@ -3103,6 +3290,12 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3103
3290
  });
3104
3291
  const rgb_color = $52FdA$solidjs.createMemo(() => $52FdA$depictaiutilishared.hex_to_rgb(hex_color()));
3105
3292
  const black_contrast_better = $52FdA$solidjs.createMemo(() => rgb_color() ? $476a3dc36afc1938$var$does_black_contrast_better(rgb_color()) : false);
3293
+ const is_checked = $52FdA$solidjs.createMemo(() => {
3294
+ var _existing_filter;
3295
+ const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
3296
+ const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
3297
+ return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
3298
+ });
3106
3299
  const input_row = $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
3107
3300
  get value_() {
3108
3301
  return checkbox().value_;
@@ -3114,8 +3307,7 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3114
3307
  return checkbox().count_;
3115
3308
  },
3116
3309
  get checked_() {
3117
- var _existing_filter, _existing_filter$data;
3118
- return (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : (_existing_filter$data = _existing_filter.data) === null || _existing_filter$data === void 0 ? void 0 : _existing_filter$data.includes(checkbox().value_);
3310
+ return is_checked();
3119
3311
  },
3120
3312
  custom_indicator_ref: span => {
3121
3313
  const {
@@ -3307,7 +3499,7 @@ function $958981128e559776$export$53c59af873b303c9(_ref) {
3307
3499
  break try_specific;
3308
3500
  }
3309
3501
  const needle = data_is_array ? data[0] : data;
3310
- const index_in_meta = meta.values.findIndex(value => needle === value || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => needle[index] === item));
3502
+ const index_in_meta = meta.values.findIndex(value => $e2d74bb03cc5252e$export$325f75597868c4f0(needle) === $e2d74bb03cc5252e$export$325f75597868c4f0(value) || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => $e2d74bb03cc5252e$export$325f75597868c4f0(needle[index]) === $e2d74bb03cc5252e$export$325f75597868c4f0(item)));
3311
3503
  return ((_names = meta.names) === null || _names === void 0 ? void 0 : _names[index_in_meta]) || ((_values = meta.values) === null || _values === void 0 ? void 0 : _values[index_in_meta]);
3312
3504
  }
3313
3505
  }
@@ -3913,7 +4105,8 @@ function $367b536a2a94d24e$export$e183a13865960371(params_to_default_value, rout
3913
4105
  const signals = {};
3914
4106
  const entries = Object.entries(params_to_default_value);
3915
4107
  const event_handler = $52FdA$depictaiutilishared.catchify((what_happened, args) => {
3916
- if (what_happened == "popstate") $367b536a2a94d24e$var$history_state_change(signals, entries, args.state);
4108
+ // Intentionally always update our signals to the history state to allow external control of SDK state for doing things like https://linear.app/depictai/issue/X-1432/is-this-possible-with-the-depict-sdk
4109
+ $367b536a2a94d24e$var$history_state_change(signals, entries, what_happened === "popstate" ? args.state : history.state);
3917
4110
  });
3918
4111
  // createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
3919
4112
  $52FdA$solidjs.createRenderEffect(() => {
@@ -4347,6 +4540,16 @@ async function $e270e9f953fcbc58$var$_cached_post_request2(endpoint, input_req,
4347
4540
  delete cache_obj.in_progress_[body];
4348
4541
  }
4349
4542
  }
4543
+ function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
4544
+ const signal = $52FdA$solidjs.createSignal(false);
4545
+ $52FdA$solidjs.onCleanup($52FdA$depictaiutilishared.javascript_media_query(media_query, _ref => {
4546
+ let {
4547
+ matches: matches
4548
+ } = _ref;
4549
+ return signal[1](matches);
4550
+ }).remove);
4551
+ return signal[0];
4552
+ }
4350
4553
  const $55f06aa93e360e7f$var$get_available_range = (available_filters_, search_for_field) => {
4351
4554
  var _untrack, _untrack$find;
4352
4555
  const maybe_meta = (_untrack = $52FdA$solidjs.untrack(available_filters_)) === null || _untrack === void 0 ? void 0 : (_untrack$find = _untrack.find(_ref => {
@@ -6026,184 +6229,6 @@ function $b7cbae23560f11b9$var$ActualFloatingButtons(_ref2) {
6026
6229
  })();
6027
6230
  }
6028
6231
  $52FdA$solidjsweb.delegateEvents(["click"]);
6029
- const $a68b73fd7ba0853f$var$fallback_operator = "in";
6030
- const $a68b73fd7ba0853f$var$fallback_token = "";
6031
- const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
6032
- const $a68b73fd7ba0853f$var$operator_map = {
6033
- "eq": "≡",
6034
- "neq": "≠",
6035
- "in": "∈",
6036
- "nin": "∉",
6037
- "leq": "≤",
6038
- "geq": "≥",
6039
- "inrange": "\uD83D\uDD22"
6040
- };
6041
- const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
6042
- const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
6043
- const $a68b73fd7ba0853f$var$range_delimiter = "-";
6044
- const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
6045
- const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
6046
- const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
6047
- const $a68b73fd7ba0853f$var$op_to_token = op => {
6048
- if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
6049
- return $a68b73fd7ba0853f$var$operator_map[op];
6050
- };
6051
- /**
6052
- * Checks if a given array of filter data can be neatly serialized into an URL query parameter, or if it should fall back to JSON+base64.
6053
- * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
6054
- * No deep or mixed nesting levels are supported.
6055
- */
6056
- function $a68b73fd7ba0853f$var$array_is_serializable(array) {
6057
- let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
6058
- if (array.every(item => Array.isArray(item))) {
6059
- if (!is_root)
6060
- // Deeply nested arrays are not supported, but also don't exist as filters (yet)
6061
- return false;
6062
- return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
6063
- }
6064
- if (array.some(item => typeof item !== "string"))
6065
- // Numbers are not supported, since 1 and "1" would encode to the same thing
6066
- return false;
6067
- // Encoding reserved characters is not supported
6068
- return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
6069
- }
6070
- /**
6071
- * Human readable string[] or string[][] serialization for URLs.
6072
- * @param array
6073
- * @returns
6074
- */
6075
- function $a68b73fd7ba0853f$var$encode_array(array) {
6076
- const is_nested = array.every(item => Array.isArray(item));
6077
- if (is_nested) return array.map($a68b73fd7ba0853f$var$encode_array).join($a68b73fd7ba0853f$var$array_item_delimiter) + $a68b73fd7ba0853f$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
6078
- return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
6079
- }
6080
- function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
6081
- const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
6082
- if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
6083
- .map($a68b73fd7ba0853f$var$decode_array);
6084
- return encoded_array.split($a68b73fd7ba0853f$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
6085
- .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
6086
- }
6087
- function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
6088
- if (data === "true")
6089
- // boolean encoding
6090
- return "1";
6091
- if (data === "false")
6092
- // boolean encoding
6093
- return "0";
6094
- const data_is_array = Array.isArray(data);
6095
- if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
6096
- // numeric range filter encoding
6097
- return data.join($a68b73fd7ba0853f$var$range_delimiter);
6098
- if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
6099
- const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
6100
- if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
6101
- // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
6102
- // In that case we add a delimiter suffix at the end
6103
- return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
6104
- return encoded_data;
6105
- }
6106
- // Fallback encoding
6107
- return $52FdA$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
6108
- }
6109
- function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
6110
- if (encoded_data === "1") return "true";
6111
- if (encoded_data === "0") return "false";
6112
- if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
6113
- if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
6114
- try {
6115
- return JSON.parse($52FdA$depictaiutilishared.base64_decode_unicode(encoded_data));
6116
- } catch (e) {
6117
- $52FdA$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
6118
- }
6119
- return null;
6120
- }
6121
- function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
6122
- for (const filter of filters) {
6123
- const {
6124
- field: field,
6125
- op: op,
6126
- data: data
6127
- } = filter;
6128
- const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
6129
- search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
6130
- }
6131
- }
6132
- function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
6133
- const found_filters = [];
6134
- for (const key of search_params.keys()) {
6135
- // Allow for backwards compatibility with the old filter query param prefix
6136
- let chosen_prefix = filter_query_param_prefix;
6137
- if (!key.startsWith(chosen_prefix)) {
6138
- chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
6139
- if (!key.startsWith(chosen_prefix)) continue;
6140
- }
6141
- const encoded_data = search_params.get(key);
6142
- if (!encoded_data) continue;
6143
- const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
6144
- let [, token] = _ref;
6145
- return key.endsWith(token);
6146
- }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
6147
- const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
6148
- if (!data) continue;
6149
- const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
6150
- found_filters.push({
6151
- field: field,
6152
- op: op,
6153
- data: data
6154
- });
6155
- }
6156
- return found_filters;
6157
- }
6158
- function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
6159
- if (!sorting) return;
6160
- const {
6161
- field: field,
6162
- order: order
6163
- } = sorting;
6164
- const ascending = order === "asc";
6165
- search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
6166
- }
6167
- function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
6168
- const encoded_sorting = search_params.get(sorting_query_param_);
6169
- if (!encoded_sorting) return;
6170
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
6171
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
6172
- order: "asc"
6173
- };
6174
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
6175
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
6176
- order: "desc"
6177
- };
6178
- $52FdA$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
6179
- return;
6180
- }
6181
- function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
6182
- // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
6183
- const keys = [...search_params.keys()];
6184
- for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($a68b73fd7ba0853f$var$legacy_filter_prefix)) search_params.delete(key);
6185
- }
6186
- const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
6187
- function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
6188
- let {
6189
- to_url_: to_url_,
6190
- set_clearing_flag_: set_clearing_flag_,
6191
- from_search_params_ = new URLSearchParams(location.search),
6192
- sorting_query_param_: sorting_query_param_,
6193
- filter_query_param_prefix_: filter_query_param_prefix_
6194
- } = _ref2;
6195
- if (!to_url_) return to_url_;
6196
- const was_url_object = to_url_ instanceof URL;
6197
- const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
6198
- const {
6199
- searchParams: searchParams
6200
- } = url_object;
6201
- if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
6202
- if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
6203
- for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
6204
- if (was_url_object) return url_object;
6205
- return url_object.href;
6206
- }
6207
6232
  const $1c819dc9d820a149$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<nav class="crumbs"></nav>`, 2),
6208
6233
  $1c819dc9d820a149$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<a class="crumb"></a>`, 2),
6209
6234
  $1c819dc9d820a149$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class="separator"></span>`, 2);
@@ -11828,7 +11853,7 @@ function $33e797e57f1b6354$var$_get_rendered_recs2() {
11828
11853
  }
11829
11854
  function $33e797e57f1b6354$var$_empty_page_bugfix2() {
11830
11855
  // Called when a "page" is "opened" using PageReplacer
11831
- const on_maybe_popstate = what_happened => {
11856
+ const on_maybe_popstate = $52FdA$depictaiutilishared.catchify(what_happened => {
11832
11857
  if (what_happened !== "popstate") return;
11833
11858
  const cleaned_current_url = $33e797e57f1b6354$var$clean_url(location.href);
11834
11859
  if (!$33e797e57f1b6354$var$_classStaticPrivateFieldSpecGet($33e797e57f1b6354$export$3ccaa27d81dd8556, $33e797e57f1b6354$export$3ccaa27d81dd8556, $33e797e57f1b6354$var$_visited_urls).has(cleaned_current_url)) {
@@ -11857,7 +11882,7 @@ function $33e797e57f1b6354$var$_empty_page_bugfix2() {
11857
11882
  $33e797e57f1b6354$var$_classStaticPrivateFieldSpecSet($33e797e57f1b6354$export$3ccaa27d81dd8556, $33e797e57f1b6354$export$3ccaa27d81dd8556, $33e797e57f1b6354$var$_reverting_permitted, false); // Disallow any reverting since we can't - it would flash a white page until the reload has finished.
11858
11883
  $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_unload).call(this); // Call unload to "kill" the solid-js stuff quicker so that it stops updating - the user is expecting the next thing that happens to be a navigation to the actual page the URL says they're on.
11859
11884
  }
11860
- };
11885
+ });
11861
11886
 
11862
11887
  (0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).add(on_maybe_popstate);
11863
11888
  $parcel$interopDefault($52FdA$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_revert_fns).push(() => (0, $52FdA$depictaiutilishared.instant_exec_on_suspect_history_change).delete(on_maybe_popstate)); // Don't run the bugfixer if there isn't a PageReplacer page open since I assume the bug only happens when going back from a PageReplace'd page