@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.
@@ -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 $3hooq$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($3hooq$depictaiutilishared.base64_decode_unicode(encoded_data));
165
+ } catch (e) {
166
+ $3hooq$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
+ $3hooq$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__*/$3hooq$solidjs.createContext();
77
257
  function $d067f3a30f047b41$export$e68cff63f76bd15b(props) {
78
258
  const our_object = {};
@@ -1043,6 +1223,14 @@ function $083b2336093176cf$export$3b621d86b1566b2() {
1043
1223
  "viewBox": "0 0 21.064 21.064"
1044
1224
  }), () => $3hooq$solidjsweb.ssr($083b2336093176cf$var$_tmpl$), true);
1045
1225
  }
1226
+
1227
+ /**
1228
+ * Lower cases a string if possible. Mostly used to make the filter url values case-insensitive.
1229
+ */
1230
+ function $e2d74bb03cc5252e$export$325f75597868c4f0(stuff) {
1231
+ if (typeof stuff !== "string") return stuff;
1232
+ return stuff.toLowerCase();
1233
+ }
1046
1234
  const $c5842bdb10e57229$var$_tmpl$ = ["<button", ' class="clear-all-filters minor">', "</button>"],
1047
1235
  $c5842bdb10e57229$var$_tmpl$2 = ["<div", ' class="inner"><span class="title"><!--#-->', "<!--/-->: </span><!--#-->", "<!--/--></div>"],
1048
1236
  $c5842bdb10e57229$var$_tmpl$3 = ["<button", ' class="clear-filter major"><!--#-->', "<!--/--><span><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--> – <!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></button>"],
@@ -1110,7 +1298,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1110
1298
  let created_an_object = false;
1111
1299
  for (let j = 0; j < value.length; j++) {
1112
1300
  var _pointer;
1113
- const this_categories_name = value[j];
1301
+ const this_categories_name = $e2d74bb03cc5252e$export$325f75597868c4f0(value[j]);
1114
1302
  const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
1115
1303
  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;
1116
1304
  const created_obj = {
@@ -1184,7 +1372,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1184
1372
  var _meta, _meta$values;
1185
1373
  const sel_d = selected_data();
1186
1374
  return (_meta = meta()) === null || _meta === void 0 ? void 0 : (_meta$values = _meta.values) === null || _meta$values === void 0 ? void 0 : _meta$values.findIndex(value => {
1187
- return value === sel_d || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => sel_d[index] === item);
1375
+ 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));
1188
1376
  });
1189
1377
  });
1190
1378
  const name = $3hooq$solidjs.createMemo(() => {
@@ -1200,7 +1388,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1200
1388
  let pointer = structure;
1201
1389
  for (const step of selected_data()) {
1202
1390
  var _pointer2, _we_in_structure;
1203
- we_in_structure = (_pointer2 = pointer) === null || _pointer2 === void 0 ? void 0 : _pointer2[step];
1391
+ we_in_structure = (_pointer2 = pointer) === null || _pointer2 === void 0 ? void 0 : _pointer2[$e2d74bb03cc5252e$export$325f75597868c4f0(step)];
1204
1392
  pointer = (_we_in_structure = we_in_structure) === null || _we_in_structure === void 0 ? void 0 : _we_in_structure.children_;
1205
1393
  }
1206
1394
  return we_in_structure;
@@ -1215,7 +1403,7 @@ function $c5842bdb10e57229$export$fecbb157621501bd(_ref) {
1215
1403
  let {
1216
1404
  value_: value_
1217
1405
  } = _ref2;
1218
- 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));
1406
+ 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)));
1219
1407
  });
1220
1408
  return false;
1221
1409
  });
@@ -1334,6 +1522,12 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
1334
1522
  });
1335
1523
  const render_checkbox = checkbox => {
1336
1524
  // Checkbox always calls the getters in props, so we don't wrap these values into memos
1525
+ const is_checked = $3hooq$solidjs.createMemo(() => {
1526
+ var _existing_filter;
1527
+ const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
1528
+ const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
1529
+ return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
1530
+ });
1337
1531
  return $3hooq$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
1338
1532
  get value_() {
1339
1533
  return checkbox().value_;
@@ -1345,8 +1539,7 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
1345
1539
  return checkbox().count_;
1346
1540
  },
1347
1541
  get checked_() {
1348
- var _existing_filter, _existing_filter$data;
1349
- 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_);
1542
+ return is_checked();
1350
1543
  }
1351
1544
  });
1352
1545
  };
@@ -1433,7 +1626,7 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
1433
1626
  var _existing_filter;
1434
1627
  const v = value();
1435
1628
  const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
1436
- if (data === v) return true;
1629
+ if ($e2d74bb03cc5252e$export$325f75597868c4f0(data) === $e2d74bb03cc5252e$export$325f75597868c4f0(v)) return true;
1437
1630
  return Array.isArray(data) && data.every((item, index) => item === v[index]);
1438
1631
  })(), true), $3hooq$solidjsweb.escape($3hooq$solidjs.createMemo(() => {
1439
1632
  var _filter_$meta, _filter_$meta$names;
@@ -2012,7 +2205,7 @@ function $9c1d49181fb3002a$var$create_updating_signal(_ref3) {
2012
2205
  var _existing_filter_$dat, _existing_filter_$dat2;
2013
2206
  // wait for the children to have populated and us to have received the correct value_ and name_ values
2014
2207
  let updating_blocked = false;
2015
- 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));
2208
+ 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)));
2016
2209
  signal_.push(...$3hooq$solidjs.createSignal(index_of_us_in_selected_filter >= 0));
2017
2210
  const [read_checked, write_checked] = signal_;
2018
2211
  const child_objects = Object.values(self_.children_);
@@ -2199,8 +2392,10 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
2199
2392
  },
2200
2393
  children: value => {
2201
2394
  const is_selected = $3hooq$solidjs.createMemo(() => {
2202
- var _existing_filter, _existing_filter$data;
2203
- 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_);
2395
+ var _existing_filter;
2396
+ const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
2397
+ const current_value = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
2398
+ return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === current_value));
2204
2399
  });
2205
2400
  const MakeButton = attributes => $3hooq$solidjsweb.ssrElement("button", () => ({
2206
2401
  ...attributes,
@@ -2299,16 +2494,6 @@ function $cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes, set_cols_at_
2299
2494
  overrides: column_to_row_result
2300
2495
  }]]);
2301
2496
  }
2302
- function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
2303
- const signal = $3hooq$solidjs.createSignal(false);
2304
- $3hooq$solidjs.onCleanup($3hooq$depictaiutilishared.javascript_media_query(media_query, _ref => {
2305
- let {
2306
- matches: matches
2307
- } = _ref;
2308
- return signal[1](matches);
2309
- }).remove);
2310
- return signal[0];
2311
- }
2312
2497
  const $476a3dc36afc1938$var$_tmpl$ = ["<form", ' class="checkbox-color"><!--#-->', "<!--/--><!--#-->", "<!--/--></form>"];
2313
2498
  const $476a3dc36afc1938$var$max_visible_without_collapsing = 30;
2314
2499
  const $476a3dc36afc1938$var$show_non_collapsible_when_collapsed = 8;
@@ -2319,7 +2504,6 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
2319
2504
  i18n_: i18n_,
2320
2505
  view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
2321
2506
  } = _ref;
2322
- const supports_hover = $3e17e871e9d0911d$export$d9f36cf74e24d595("not all and (hover: none)");
2323
2507
  // same as in CheckboxFilter, maybe we should make this DRY at some point
2324
2508
  const existing_filter = $3hooq$solidjs.createMemo(() => {
2325
2509
  const {
@@ -2357,6 +2541,12 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
2357
2541
  });
2358
2542
  const rgb_color = $3hooq$solidjs.createMemo(() => $3hooq$depictaiutilishared.hex_to_rgb(hex_color()));
2359
2543
  const black_contrast_better = $3hooq$solidjs.createMemo(() => rgb_color() ? $476a3dc36afc1938$var$does_black_contrast_better(rgb_color()) : false);
2544
+ const is_checked = $3hooq$solidjs.createMemo(() => {
2545
+ var _existing_filter;
2546
+ const data = (_existing_filter = existing_filter()) === null || _existing_filter === void 0 ? void 0 : _existing_filter.data;
2547
+ const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
2548
+ return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
2549
+ });
2360
2550
  const input_row = $3hooq$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
2361
2551
  get value_() {
2362
2552
  return checkbox().value_;
@@ -2368,8 +2558,7 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
2368
2558
  return checkbox().count_;
2369
2559
  },
2370
2560
  get checked_() {
2371
- var _existing_filter, _existing_filter$data;
2372
- 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_);
2561
+ return is_checked();
2373
2562
  },
2374
2563
  custom_indicator_ref: span => {
2375
2564
  const {
@@ -2525,7 +2714,7 @@ function $958981128e559776$export$53c59af873b303c9(_ref) {
2525
2714
  break try_specific;
2526
2715
  }
2527
2716
  const needle = data_is_array ? data[0] : data;
2528
- 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));
2717
+ 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)));
2529
2718
  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]);
2530
2719
  }
2531
2720
  }
@@ -3041,7 +3230,8 @@ function $367b536a2a94d24e$export$e183a13865960371(params_to_default_value, rout
3041
3230
  const signals = {};
3042
3231
  const entries = Object.entries(params_to_default_value);
3043
3232
  const event_handler = $3hooq$depictaiutilishared.catchify((what_happened, args) => {
3044
- if (what_happened == "popstate") $367b536a2a94d24e$var$history_state_change(signals, entries, args.state);
3233
+ // 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
3234
+ $367b536a2a94d24e$var$history_state_change(signals, entries, what_happened === "popstate" ? args.state : history.state);
3045
3235
  });
3046
3236
  // createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
3047
3237
  $3hooq$solidjs.createRenderEffect(() => {
@@ -3475,6 +3665,16 @@ async function $e270e9f953fcbc58$var$_cached_post_request2(endpoint, input_req,
3475
3665
  delete cache_obj.in_progress_[body];
3476
3666
  }
3477
3667
  }
3668
+ function $3e17e871e9d0911d$export$d9f36cf74e24d595(media_query) {
3669
+ const signal = $3hooq$solidjs.createSignal(false);
3670
+ $3hooq$solidjs.onCleanup($3hooq$depictaiutilishared.javascript_media_query(media_query, _ref => {
3671
+ let {
3672
+ matches: matches
3673
+ } = _ref;
3674
+ return signal[1](matches);
3675
+ }).remove);
3676
+ return signal[0];
3677
+ }
3478
3678
  const $55f06aa93e360e7f$var$get_available_range = (available_filters_, search_for_field) => {
3479
3679
  var _untrack, _untrack$find;
3480
3680
  const maybe_meta = (_untrack = $3hooq$solidjs.untrack(available_filters_)) === null || _untrack === void 0 ? void 0 : (_untrack$find = _untrack.find(_ref => {
@@ -4773,184 +4973,6 @@ function $b7cbae23560f11b9$var$ActualFloatingButtons(_ref2) {
4773
4973
  }));
4774
4974
  return $3hooq$solidjsweb.ssr($b7cbae23560f11b9$var$_tmpl$, $3hooq$solidjsweb.ssrHydrationKey(), "floating-buttons ".concat(is_scrolling_upwards() && modal_is_closed() && !regular_buttons_are_in_view() && !get_is_showing_toast() ? "show-them" : ""), $3hooq$solidjsweb.ssrAttribute("aria-label", $3hooq$solidjsweb.escape(i18n_.filter_text_(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $9bde34303b3e9ace$export$28f6150e232898de), {})), $3hooq$solidjsweb.ssrAttribute("aria-label", $3hooq$solidjsweb.escape(i18n_.sorting_text_(), true), false), ((_current_sorting_$ = current_sorting_[0]()) === null || _current_sorting_$ === void 0 ? void 0 : _current_sorting_$.order) === "asc" ? $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $0b45ba458cbff67a$export$da32f7add8a22e86), {})) : $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $549632402b57d811$export$d10e63059ddb9fd4), {})), $3hooq$solidjsweb.ssrAttribute("aria-label", $3hooq$solidjsweb.escape(i18n_.scroll_to_top_(), true), false), $3hooq$solidjsweb.escape($3hooq$solidjsweb.createComponent((0, $31f4a789db864adb$export$2624c5890f1bbcf7), {})));
4775
4975
  }
4776
- const $a68b73fd7ba0853f$var$fallback_operator = "in";
4777
- const $a68b73fd7ba0853f$var$fallback_token = "";
4778
- const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
4779
- const $a68b73fd7ba0853f$var$operator_map = {
4780
- "eq": "≡",
4781
- "neq": "≠",
4782
- "in": "∈",
4783
- "nin": "∉",
4784
- "leq": "≤",
4785
- "geq": "≥",
4786
- "inrange": "\uD83D\uDD22"
4787
- };
4788
- const $a68b73fd7ba0853f$var$ascending_token = "\uD83D\uDCC8";
4789
- const $a68b73fd7ba0853f$var$descending_token = "\uD83D\uDCC9";
4790
- const $a68b73fd7ba0853f$var$range_delimiter = "-";
4791
- const $a68b73fd7ba0853f$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
4792
- const $a68b73fd7ba0853f$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
4793
- const $a68b73fd7ba0853f$var$empty_item_replacement = "0️⃣";
4794
- const $a68b73fd7ba0853f$var$op_to_token = op => {
4795
- if (op === $a68b73fd7ba0853f$var$fallback_operator) return $a68b73fd7ba0853f$var$fallback_token;
4796
- return $a68b73fd7ba0853f$var$operator_map[op];
4797
- };
4798
- /**
4799
- * 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.
4800
- * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
4801
- * No deep or mixed nesting levels are supported.
4802
- */
4803
- function $a68b73fd7ba0853f$var$array_is_serializable(array) {
4804
- let is_root = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
4805
- if (array.every(item => Array.isArray(item))) {
4806
- if (!is_root)
4807
- // Deeply nested arrays are not supported, but also don't exist as filters (yet)
4808
- return false;
4809
- return array.every(item => $a68b73fd7ba0853f$var$array_is_serializable(item, false));
4810
- }
4811
- if (array.some(item => typeof item !== "string"))
4812
- // Numbers are not supported, since 1 and "1" would encode to the same thing
4813
- return false;
4814
- // Encoding reserved characters is not supported
4815
- return !array.some(item => item.includes($a68b73fd7ba0853f$var$array_item_delimiter) || item.includes($a68b73fd7ba0853f$var$string_item_delimiter) || item === $a68b73fd7ba0853f$var$empty_item_replacement);
4816
- }
4817
- /**
4818
- * Human readable string[] or string[][] serialization for URLs.
4819
- * @param array
4820
- * @returns
4821
- */
4822
- function $a68b73fd7ba0853f$var$encode_array(array) {
4823
- const is_nested = array.every(item => Array.isArray(item));
4824
- 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
4825
- return array.map(item => item === "" ? $a68b73fd7ba0853f$var$empty_item_replacement : item).join($a68b73fd7ba0853f$var$string_item_delimiter);
4826
- }
4827
- function $a68b73fd7ba0853f$var$decode_array(encoded_array) {
4828
- const is_nested = encoded_array.includes($a68b73fd7ba0853f$var$array_item_delimiter);
4829
- if (is_nested) return encoded_array.split($a68b73fd7ba0853f$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
4830
- .map($a68b73fd7ba0853f$var$decode_array);
4831
- 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
4832
- .map(item => item === $a68b73fd7ba0853f$var$empty_item_replacement ? "" : item);
4833
- }
4834
- function $a68b73fd7ba0853f$var$encode_filter_data(op, data) {
4835
- if (data === "true")
4836
- // boolean encoding
4837
- return "1";
4838
- if (data === "false")
4839
- // boolean encoding
4840
- return "0";
4841
- const data_is_array = Array.isArray(data);
4842
- if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
4843
- // numeric range filter encoding
4844
- return data.join($a68b73fd7ba0853f$var$range_delimiter);
4845
- if (data_is_array && $a68b73fd7ba0853f$var$array_is_serializable(data)) {
4846
- const encoded_data = $a68b73fd7ba0853f$var$encode_array(data);
4847
- if (!encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter) && !encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter))
4848
- // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
4849
- // In that case we add a delimiter suffix at the end
4850
- return encoded_data + $a68b73fd7ba0853f$var$string_item_delimiter;
4851
- return encoded_data;
4852
- }
4853
- // Fallback encoding
4854
- return $3hooq$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
4855
- }
4856
- function $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data) {
4857
- if (encoded_data === "1") return "true";
4858
- if (encoded_data === "0") return "false";
4859
- if (op === "inrange" && encoded_data.includes($a68b73fd7ba0853f$var$range_delimiter)) return encoded_data.split($a68b73fd7ba0853f$var$range_delimiter).map(x => parseFloat(x));
4860
- if (encoded_data.includes($a68b73fd7ba0853f$var$string_item_delimiter) || encoded_data.includes($a68b73fd7ba0853f$var$array_item_delimiter)) return $a68b73fd7ba0853f$var$decode_array(encoded_data);
4861
- try {
4862
- return JSON.parse($3hooq$depictaiutilishared.base64_decode_unicode(encoded_data));
4863
- } catch (e) {
4864
- $3hooq$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
4865
- }
4866
- return null;
4867
- }
4868
- function $a68b73fd7ba0853f$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
4869
- for (const filter of filters) {
4870
- const {
4871
- field: field,
4872
- op: op,
4873
- data: data
4874
- } = filter;
4875
- const encoded_data = $a68b73fd7ba0853f$var$encode_filter_data(op, data);
4876
- search_params.set(filter_query_param_prefix + field + $a68b73fd7ba0853f$var$op_to_token(op), encoded_data);
4877
- }
4878
- }
4879
- function $a68b73fd7ba0853f$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
4880
- const found_filters = [];
4881
- for (const key of search_params.keys()) {
4882
- // Allow for backwards compatibility with the old filter query param prefix
4883
- let chosen_prefix = filter_query_param_prefix;
4884
- if (!key.startsWith(chosen_prefix)) {
4885
- chosen_prefix = $a68b73fd7ba0853f$var$legacy_filter_prefix;
4886
- if (!key.startsWith(chosen_prefix)) continue;
4887
- }
4888
- const encoded_data = search_params.get(key);
4889
- if (!encoded_data) continue;
4890
- const [op, token] = Object.entries($a68b73fd7ba0853f$var$operator_map).find(_ref => {
4891
- let [, token] = _ref;
4892
- return key.endsWith(token);
4893
- }) || [$a68b73fd7ba0853f$var$fallback_operator, $a68b73fd7ba0853f$var$fallback_token];
4894
- const data = $a68b73fd7ba0853f$var$decode_filter_data(op, encoded_data);
4895
- if (!data) continue;
4896
- const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
4897
- found_filters.push({
4898
- field: field,
4899
- op: op,
4900
- data: data
4901
- });
4902
- }
4903
- return found_filters;
4904
- }
4905
- function $a68b73fd7ba0853f$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
4906
- if (!sorting) return;
4907
- const {
4908
- field: field,
4909
- order: order
4910
- } = sorting;
4911
- const ascending = order === "asc";
4912
- search_params.set(sorting_query_param, field + (ascending ? $a68b73fd7ba0853f$var$ascending_token : $a68b73fd7ba0853f$var$descending_token));
4913
- }
4914
- function $a68b73fd7ba0853f$export$766e9676e74997d3(search_params, sorting_query_param_) {
4915
- const encoded_sorting = search_params.get(sorting_query_param_);
4916
- if (!encoded_sorting) return;
4917
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$ascending_token)) return {
4918
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$ascending_token.length),
4919
- order: "asc"
4920
- };
4921
- if (encoded_sorting.endsWith($a68b73fd7ba0853f$var$descending_token)) return {
4922
- field: encoded_sorting.slice(0, -$a68b73fd7ba0853f$var$descending_token.length),
4923
- order: "desc"
4924
- };
4925
- $3hooq$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
4926
- return;
4927
- }
4928
- function $a68b73fd7ba0853f$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
4929
- // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
4930
- const keys = [...search_params.keys()];
4931
- 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);
4932
- }
4933
- const $a68b73fd7ba0853f$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
4934
- function $a68b73fd7ba0853f$export$43cd1e747fecd42e(_ref2) {
4935
- let {
4936
- to_url_: to_url_,
4937
- set_clearing_flag_: set_clearing_flag_,
4938
- from_search_params_ = new URLSearchParams(location.search),
4939
- sorting_query_param_: sorting_query_param_,
4940
- filter_query_param_prefix_: filter_query_param_prefix_
4941
- } = _ref2;
4942
- if (!to_url_) return to_url_;
4943
- const was_url_object = to_url_ instanceof URL;
4944
- const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
4945
- const {
4946
- searchParams: searchParams
4947
- } = url_object;
4948
- if (set_clearing_flag_) searchParams.set($a68b73fd7ba0853f$export$cf5feb2102aec7f2, "true");
4949
- if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
4950
- for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
4951
- if (was_url_object) return url_object;
4952
- return url_object.href;
4953
- }
4954
4976
  const $1c819dc9d820a149$var$_tmpl$ = ["<nav", ' class="crumbs"', ">", "</nav>"],
4955
4977
  $1c819dc9d820a149$var$_tmpl$2 = ["<a", ' class="crumb"', ">", "</a>"],
4956
4978
  $1c819dc9d820a149$var$_tmpl$3 = ["<span", ' class="separator">', "</span>"];
@@ -9856,7 +9878,7 @@ function $33e797e57f1b6354$var$_get_rendered_recs2() {
9856
9878
  }
9857
9879
  function $33e797e57f1b6354$var$_empty_page_bugfix2() {
9858
9880
  // Called when a "page" is "opened" using PageReplacer
9859
- const on_maybe_popstate = what_happened => {
9881
+ const on_maybe_popstate = $3hooq$depictaiutilishared.catchify(what_happened => {
9860
9882
  if (what_happened !== "popstate") return;
9861
9883
  const cleaned_current_url = $33e797e57f1b6354$var$clean_url(location.href);
9862
9884
  if (!$33e797e57f1b6354$var$_classStaticPrivateFieldSpecGet($33e797e57f1b6354$export$3ccaa27d81dd8556, $33e797e57f1b6354$export$3ccaa27d81dd8556, $33e797e57f1b6354$var$_visited_urls).has(cleaned_current_url)) {
@@ -9885,7 +9907,7 @@ function $33e797e57f1b6354$var$_empty_page_bugfix2() {
9885
9907
  $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.
9886
9908
  $parcel$interopDefault($3hooq$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.
9887
9909
  }
9888
- };
9910
+ });
9889
9911
 
9890
9912
  (0, $3hooq$depictaiutilishared.instant_exec_on_suspect_history_change).add(on_maybe_popstate);
9891
9913
  $parcel$interopDefault($3hooq$babelruntimehelpersclassPrivateFieldGet)(this, $33e797e57f1b6354$var$_revert_fns).push(() => (0, $3hooq$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