@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.
@@ -10,6 +10,8 @@ function $parcel$export(e, n, v, s) {
10
10
  configurable: true
11
11
  });
12
12
  }
13
+ $parcel$export(module.exports, "encode_filters", () => $1ab22f2cd39b3061$export$58aa3f171519b6d7);
14
+ $parcel$export(module.exports, "decode_filters", () => $1ab22f2cd39b3061$export$f934fa24c3a86811);
13
15
  $parcel$export(module.exports, "shopifyContainedImageContextSymbol", () => $a33065cfed827fc0$export$d7b7ab832c20e2f4);
14
16
  $parcel$export(module.exports, "ListingProvider", () => $84798aaa863a4909$export$e68cff63f76bd15b);
15
17
  $parcel$export(module.exports, "useListing", () => $84798aaa863a4909$export$8d0c4fdbb05a2f2e);
@@ -66,7 +68,180 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
66
68
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
67
69
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
68
70
  /*! Depict.ai search and product listing SDK */
69
- const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.21";
71
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "2.0.23";
72
+ const $1ab22f2cd39b3061$var$fallback_operator = "in";
73
+ const $1ab22f2cd39b3061$var$fallback_token = "";
74
+ const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
75
+ const $1ab22f2cd39b3061$var$operator_map = {
76
+ "eq": "≡",
77
+ "neq": "≠",
78
+ "in": "∈",
79
+ "nin": "∉",
80
+ "leq": "≤",
81
+ "geq": "≥",
82
+ "inrange": "\uD83D\uDD22"
83
+ };
84
+ const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
85
+ const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
86
+ const $1ab22f2cd39b3061$var$range_delimiter = "-";
87
+ const $1ab22f2cd39b3061$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
88
+ const $1ab22f2cd39b3061$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
89
+ const $1ab22f2cd39b3061$var$empty_item_replacement = "0️⃣";
90
+ const $1ab22f2cd39b3061$var$op_to_token = op => {
91
+ if (op === $1ab22f2cd39b3061$var$fallback_operator) return $1ab22f2cd39b3061$var$fallback_token;
92
+ return $1ab22f2cd39b3061$var$operator_map[op];
93
+ };
94
+ /**
95
+ * 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.
96
+ * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
97
+ * No deep or mixed nesting levels are supported.
98
+ */
99
+ function $1ab22f2cd39b3061$var$array_is_serializable(array, is_root = true) {
100
+ if (array.every(item => Array.isArray(item))) {
101
+ if (!is_root)
102
+ // Deeply nested arrays are not supported, but also don't exist as filters (yet)
103
+ return false;
104
+ return array.every(item => $1ab22f2cd39b3061$var$array_is_serializable(item, false));
105
+ }
106
+ if (array.some(item => typeof item !== "string"))
107
+ // Numbers are not supported, since 1 and "1" would encode to the same thing
108
+ return false;
109
+ // Encoding reserved characters is not supported
110
+ return !array.some(item => item.includes($1ab22f2cd39b3061$var$array_item_delimiter) || item.includes($1ab22f2cd39b3061$var$string_item_delimiter) || item === $1ab22f2cd39b3061$var$empty_item_replacement);
111
+ }
112
+ /**
113
+ * Human readable string[] or string[][] serialization for URLs.
114
+ * @param array
115
+ * @returns
116
+ */
117
+ function $1ab22f2cd39b3061$var$encode_array(array) {
118
+ const is_nested = array.every(item => Array.isArray(item));
119
+ if (is_nested) return array.map($1ab22f2cd39b3061$var$encode_array).join($1ab22f2cd39b3061$var$array_item_delimiter) + $1ab22f2cd39b3061$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
120
+ return array.map(item => item === "" ? $1ab22f2cd39b3061$var$empty_item_replacement : item).join($1ab22f2cd39b3061$var$string_item_delimiter);
121
+ }
122
+ function $1ab22f2cd39b3061$var$decode_array(encoded_array) {
123
+ const is_nested = encoded_array.includes($1ab22f2cd39b3061$var$array_item_delimiter);
124
+ if (is_nested) return encoded_array.split($1ab22f2cd39b3061$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
125
+ .map($1ab22f2cd39b3061$var$decode_array);
126
+ return encoded_array.split($1ab22f2cd39b3061$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
127
+ .map(item => item === $1ab22f2cd39b3061$var$empty_item_replacement ? "" : item);
128
+ }
129
+ function $1ab22f2cd39b3061$var$encode_filter_data(op, data) {
130
+ if (data === "true")
131
+ // boolean encoding
132
+ return "1";
133
+ if (data === "false")
134
+ // boolean encoding
135
+ return "0";
136
+ const data_is_array = Array.isArray(data);
137
+ if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
138
+ // numeric range filter encoding
139
+ return data.join($1ab22f2cd39b3061$var$range_delimiter);
140
+ if (data_is_array && $1ab22f2cd39b3061$var$array_is_serializable(data)) {
141
+ const encoded_data = $1ab22f2cd39b3061$var$encode_array(data);
142
+ if (!encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter) && !encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter))
143
+ // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
144
+ // In that case we add a delimiter suffix at the end
145
+ return encoded_data + $1ab22f2cd39b3061$var$string_item_delimiter;
146
+ return encoded_data;
147
+ }
148
+ // Fallback encoding
149
+ return $5vyXB$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
150
+ }
151
+ function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
152
+ if (encoded_data === "1") return "true";
153
+ if (encoded_data === "0") return "false";
154
+ if (op === "inrange" && encoded_data.includes($1ab22f2cd39b3061$var$range_delimiter)) return encoded_data.split($1ab22f2cd39b3061$var$range_delimiter).map(x => parseFloat(x));
155
+ if (encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter) || encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter)) return $1ab22f2cd39b3061$var$decode_array(encoded_data);
156
+ try {
157
+ return JSON.parse($5vyXB$depictaiutilishared.base64_decode_unicode(encoded_data));
158
+ } catch (e) {
159
+ $5vyXB$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
160
+ }
161
+ return null;
162
+ }
163
+ function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
164
+ for (const filter of filters) {
165
+ const {
166
+ field: field,
167
+ op: op,
168
+ data: data
169
+ } = filter;
170
+ const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
171
+ search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$op_to_token(op), encoded_data);
172
+ }
173
+ }
174
+ function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
175
+ const found_filters = [];
176
+ for (const key of search_params.keys()) {
177
+ // Allow for backwards compatibility with the old filter query param prefix
178
+ let chosen_prefix = filter_query_param_prefix;
179
+ if (!key.startsWith(chosen_prefix)) {
180
+ chosen_prefix = $1ab22f2cd39b3061$var$legacy_filter_prefix;
181
+ if (!key.startsWith(chosen_prefix)) continue;
182
+ }
183
+ const encoded_data = search_params.get(key);
184
+ if (!encoded_data) continue;
185
+ const [op, token] = Object.entries($1ab22f2cd39b3061$var$operator_map).find(([, token]) => key.endsWith(token)) || [$1ab22f2cd39b3061$var$fallback_operator, $1ab22f2cd39b3061$var$fallback_token];
186
+ const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
187
+ if (!data) continue;
188
+ const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
189
+ found_filters.push({
190
+ field: field,
191
+ op: op,
192
+ data: data
193
+ });
194
+ }
195
+ return found_filters;
196
+ }
197
+ function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
198
+ if (!sorting) return;
199
+ const {
200
+ field: field,
201
+ order: order
202
+ } = sorting;
203
+ const ascending = order === "asc";
204
+ search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
205
+ }
206
+ function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
207
+ const encoded_sorting = search_params.get(sorting_query_param_);
208
+ if (!encoded_sorting) return;
209
+ if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
210
+ field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
211
+ order: "asc"
212
+ };
213
+ if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$descending_token)) return {
214
+ field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$descending_token.length),
215
+ order: "desc"
216
+ };
217
+ $5vyXB$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
218
+ return;
219
+ }
220
+ function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
221
+ // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
222
+ const keys = [...search_params.keys()];
223
+ for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($1ab22f2cd39b3061$var$legacy_filter_prefix)) search_params.delete(key);
224
+ }
225
+ const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
226
+ function $1ab22f2cd39b3061$export$43cd1e747fecd42e({
227
+ to_url_: to_url_,
228
+ set_clearing_flag_: set_clearing_flag_,
229
+ from_search_params_ = new URLSearchParams(location.search),
230
+ sorting_query_param_: sorting_query_param_,
231
+ filter_query_param_prefix_: filter_query_param_prefix_
232
+ }) {
233
+ if (!to_url_) return to_url_;
234
+ const was_url_object = to_url_ instanceof URL;
235
+ const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
236
+ const {
237
+ searchParams: searchParams
238
+ } = url_object;
239
+ if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
240
+ if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
241
+ for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
242
+ if (was_url_object) return url_object;
243
+ return url_object.href;
244
+ }
70
245
  const $84798aaa863a4909$var$ListingContext = /*@__PURE__*/$5vyXB$solidjs.createContext();
71
246
  function $84798aaa863a4909$export$e68cff63f76bd15b(props) {
72
247
  const our_object = {};
@@ -990,6 +1165,14 @@ function $c77c68e559a1506c$export$3b621d86b1566b2(props = {}) {
990
1165
  "viewBox": "0 0 21.064 21.064"
991
1166
  }), () => $5vyXB$solidjsweb.ssr($c77c68e559a1506c$var$_tmpl$), true);
992
1167
  }
1168
+
1169
+ /**
1170
+ * Lower cases a string if possible. Mostly used to make the filter url values case-insensitive.
1171
+ */
1172
+ function $daa394359b026187$export$325f75597868c4f0(stuff) {
1173
+ if (typeof stuff !== "string") return stuff;
1174
+ return stuff.toLowerCase();
1175
+ }
993
1176
  const $235a2771a44e28e9$var$_tmpl$ = ["<button", ' class="clear-all-filters minor">', "</button>"],
994
1177
  $235a2771a44e28e9$var$_tmpl$2 = ["<div", ' class="inner"><span class="title"><!--#-->', "<!--/-->: </span><!--#-->", "<!--/--></div>"],
995
1178
  $235a2771a44e28e9$var$_tmpl$3 = ["<button", ' class="clear-filter major"><!--#-->', "<!--/--><span><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--> – <!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></button>"],
@@ -1052,7 +1235,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1052
1235
  let parent_ = {};
1053
1236
  let created_an_object = false;
1054
1237
  for (let j = 0; j < value.length; j++) {
1055
- const this_categories_name = value[j];
1238
+ const this_categories_name = $daa394359b026187$export$325f75597868c4f0(value[j]);
1056
1239
  const obj = pointer[this_categories_name] ||= (() => {
1057
1240
  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;
1058
1241
  const created_obj = {
@@ -1124,7 +1307,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1124
1307
  const index_of_us_in_meta = $5vyXB$solidjs.createMemo(() => {
1125
1308
  const sel_d = selected_data();
1126
1309
  return meta()?.values?.findIndex(value => {
1127
- return value === sel_d || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => sel_d[index] === item);
1310
+ return $daa394359b026187$export$325f75597868c4f0(value) === $daa394359b026187$export$325f75597868c4f0(sel_d) || Array.isArray(value) && Array.isArray(sel_d) && value.length === sel_d.length && value.every((item, index) => $daa394359b026187$export$325f75597868c4f0(sel_d[index]) === $daa394359b026187$export$325f75597868c4f0(item));
1128
1311
  });
1129
1312
  });
1130
1313
  const name = $5vyXB$solidjs.createMemo(() => {
@@ -1138,7 +1321,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1138
1321
  let we_in_structure;
1139
1322
  let pointer = structure;
1140
1323
  for (const step of selected_data()) {
1141
- we_in_structure = pointer?.[step];
1324
+ we_in_structure = pointer?.[$daa394359b026187$export$325f75597868c4f0(step)];
1142
1325
  pointer = we_in_structure?.children_;
1143
1326
  }
1144
1327
  return we_in_structure;
@@ -1149,7 +1332,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
1149
1332
  const siblings = parent?.children_;
1150
1333
  if (siblings) return [parent, ...Object.values(siblings)].every(({
1151
1334
  value_: value_
1152
- }) => iterable_selected_filter_data()?.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => v[index] === val)));
1335
+ }) => iterable_selected_filter_data()?.some(v => Array.isArray(v) && v.length === value_.length && value_.every((val, index) => $daa394359b026187$export$325f75597868c4f0(v[index]) === $daa394359b026187$export$325f75597868c4f0(val))));
1153
1336
  return false;
1154
1337
  });
1155
1338
  return $5vyXB$solidjsweb.createComponent((0, $5vyXB$solidjs.Show), {
@@ -1259,6 +1442,11 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
1259
1442
  });
1260
1443
  const render_checkbox = checkbox => {
1261
1444
  // Checkbox always calls the getters in props, so we don't wrap these values into memos
1445
+ const is_checked = $5vyXB$solidjs.createMemo(() => {
1446
+ const data = existing_filter()?.data;
1447
+ const value = $daa394359b026187$export$325f75597868c4f0(checkbox().value_);
1448
+ return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
1449
+ });
1262
1450
  return $5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
1263
1451
  get value_() {
1264
1452
  return checkbox().value_;
@@ -1270,7 +1458,7 @@ function $d94869c80e337a3d$export$dd948f91abc3a1c4({
1270
1458
  return checkbox().count_;
1271
1459
  },
1272
1460
  get checked_() {
1273
- return existing_filter()?.data?.includes(checkbox().value_);
1461
+ return is_checked();
1274
1462
  }
1275
1463
  });
1276
1464
  };
@@ -1349,7 +1537,7 @@ function $c1dc1554c1b94233$export$430444115f70a734({
1349
1537
  return $5vyXB$solidjsweb.ssr($c1dc1554c1b94233$var$_tmpl$3, $5vyXB$solidjsweb.ssrHydrationKey(), `input-row ${count() === 0 ? "count-0" : ""}`, $5vyXB$solidjsweb.ssrAttribute("for", $5vyXB$solidjsweb.escape(random_selector, true), false), $5vyXB$solidjsweb.ssrAttribute("id", $5vyXB$solidjsweb.escape(random_selector, true), false) + $5vyXB$solidjsweb.ssrAttribute("name", $5vyXB$solidjsweb.escape(radio_name, true), false), $5vyXB$solidjsweb.ssrAttribute("checked", $5vyXB$solidjs.createMemo(() => {
1350
1538
  const v = value();
1351
1539
  const data = existing_filter()?.data;
1352
- if (data === v) return true;
1540
+ if ($daa394359b026187$export$325f75597868c4f0(data) === $daa394359b026187$export$325f75597868c4f0(v)) return true;
1353
1541
  return Array.isArray(data) && data.every((item, index) => item === v[index]);
1354
1542
  })(), true), $5vyXB$solidjsweb.escape($5vyXB$solidjs.createMemo(() => {
1355
1543
  const name = filter_().meta?.names?.[index];
@@ -1887,7 +2075,7 @@ function $3bdc00a1353c1150$var$create_updating_signal({
1887
2075
  const on_structure_complete_ = () => {
1888
2076
  // wait for the children to have populated and us to have received the correct value_ and name_ values
1889
2077
  let updating_blocked = false;
1890
- const index_of_us_in_selected_filter = existing_filter_?.data?.findIndex?.(el => el.length === self_.value_.length && el.every((sub_el, index) => self_.value_[index] === sub_el));
2078
+ const index_of_us_in_selected_filter = existing_filter_?.data?.findIndex?.(el => el.length === self_.value_.length && el.every((sub_el, index) => $daa394359b026187$export$325f75597868c4f0(self_.value_[index]) === $daa394359b026187$export$325f75597868c4f0(sub_el)));
1891
2079
  signal_.push(...$5vyXB$solidjs.createSignal(index_of_us_in_selected_filter >= 0));
1892
2080
  const [read_checked, write_checked] = signal_;
1893
2081
  const child_objects = Object.values(self_.children_);
@@ -2053,7 +2241,11 @@ const $0ef1681699140f1a$export$414f6a19d38e655c = ({
2053
2241
  return buttons();
2054
2242
  },
2055
2243
  children: value => {
2056
- const is_selected = $5vyXB$solidjs.createMemo(() => existing_filter()?.data?.includes(value().value_));
2244
+ const is_selected = $5vyXB$solidjs.createMemo(() => {
2245
+ const data = existing_filter()?.data;
2246
+ const current_value = $daa394359b026187$export$325f75597868c4f0(value().value_);
2247
+ return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === current_value);
2248
+ });
2057
2249
  const MakeButton = attributes => $5vyXB$solidjsweb.ssrElement("button", () => ({
2058
2250
  ...attributes,
2059
2251
  "disabled": value().count_ === 0 && !is_selected(),
@@ -2150,13 +2342,6 @@ function $0ef1681699140f1a$var$adjust_sizes(container_width, sizes, set_cols_at_
2150
2342
  overrides: column_to_row_result
2151
2343
  }]]);
2152
2344
  }
2153
- function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
2154
- const signal = $5vyXB$solidjs.createSignal(false);
2155
- $5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
2156
- matches: matches
2157
- }) => signal[1](matches)).remove);
2158
- return signal[0];
2159
- }
2160
2345
  const $b51a2b8b9355e66c$var$_tmpl$ = ["<form", ' class="checkbox-color"><!--#-->', "<!--/--><!--#-->", "<!--/--></form>"];
2161
2346
  const $b51a2b8b9355e66c$var$max_visible_without_collapsing = 30;
2162
2347
  const $b51a2b8b9355e66c$var$show_non_collapsible_when_collapsed = 8;
@@ -2166,7 +2351,6 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
2166
2351
  i18n_: i18n_,
2167
2352
  view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
2168
2353
  }) {
2169
- const supports_hover = $b54e6192d0caa293$export$d9f36cf74e24d595("not all and (hover: none)");
2170
2354
  // same as in CheckboxFilter, maybe we should make this DRY at some point
2171
2355
  const existing_filter = $5vyXB$solidjs.createMemo(() => {
2172
2356
  const {
@@ -2194,6 +2378,11 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
2194
2378
  const hex_color = $5vyXB$solidjs.createMemo(() => checkbox().value_.split(";")?.[1] || "");
2195
2379
  const rgb_color = $5vyXB$solidjs.createMemo(() => $5vyXB$depictaiutilishared.hex_to_rgb(hex_color()));
2196
2380
  const black_contrast_better = $5vyXB$solidjs.createMemo(() => rgb_color() ? $b51a2b8b9355e66c$var$does_black_contrast_better(rgb_color()) : false);
2381
+ const is_checked = $5vyXB$solidjs.createMemo(() => {
2382
+ const data = existing_filter()?.data;
2383
+ const value = $daa394359b026187$export$325f75597868c4f0(checkbox().value_);
2384
+ return !!data?.some(item => $daa394359b026187$export$325f75597868c4f0(item) === value);
2385
+ });
2197
2386
  const input_row = $5vyXB$solidjsweb.createComponent((0, $1c63082b2da848ad$export$48513f6b9f8ce62d), {
2198
2387
  get value_() {
2199
2388
  return checkbox().value_;
@@ -2205,7 +2394,7 @@ function $b51a2b8b9355e66c$export$82ed4b28ecb67608({
2205
2394
  return checkbox().count_;
2206
2395
  },
2207
2396
  get checked_() {
2208
- return existing_filter()?.data?.includes(checkbox().value_);
2397
+ return is_checked();
2209
2398
  },
2210
2399
  custom_indicator_ref: span => {
2211
2400
  const {
@@ -2358,7 +2547,7 @@ function $b064919833b3e80b$export$53c59af873b303c9({
2358
2547
  break try_specific;
2359
2548
  }
2360
2549
  const needle = data_is_array ? data[0] : data;
2361
- 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));
2550
+ const index_in_meta = meta.values.findIndex(value => $daa394359b026187$export$325f75597868c4f0(needle) === $daa394359b026187$export$325f75597868c4f0(value) || Array.isArray(needle) && Array.isArray(value) && needle.length === value.length && value.every((item, index) => $daa394359b026187$export$325f75597868c4f0(needle[index]) === $daa394359b026187$export$325f75597868c4f0(item)));
2362
2551
  return meta.names?.[index_in_meta] || meta.values?.[index_in_meta];
2363
2552
  }
2364
2553
  }
@@ -2829,7 +3018,8 @@ function $6e22b5314fb52f4c$export$e183a13865960371(params_to_default_value, rout
2829
3018
  const signals = {};
2830
3019
  const entries = Object.entries(params_to_default_value);
2831
3020
  const event_handler = $5vyXB$depictaiutilishared.catchify((what_happened, args) => {
2832
- if (what_happened == "popstate") $6e22b5314fb52f4c$var$history_state_change(signals, entries, args.state);
3021
+ // 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
3022
+ $6e22b5314fb52f4c$var$history_state_change(signals, entries, what_happened === "popstate" ? args.state : history.state);
2833
3023
  });
2834
3024
  // createRenderEffect because we need the instant execution so the signals always contain values, even before solid's render phase
2835
3025
  $5vyXB$solidjs.createRenderEffect(() => {
@@ -3198,6 +3388,13 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
3198
3388
  }));
3199
3389
  }
3200
3390
  }
3391
+ function $b54e6192d0caa293$export$d9f36cf74e24d595(media_query) {
3392
+ const signal = $5vyXB$solidjs.createSignal(false);
3393
+ $5vyXB$solidjs.onCleanup($5vyXB$depictaiutilishared.javascript_media_query(media_query, ({
3394
+ matches: matches
3395
+ }) => signal[1](matches)).remove);
3396
+ return signal[0];
3397
+ }
3201
3398
  const $6b384adf40a5f4d7$var$get_available_range = (available_filters_, search_for_field) => {
3202
3399
  const maybe_meta = $5vyXB$solidjs.untrack(available_filters_)?.find(({
3203
3400
  op: op,
@@ -4417,179 +4614,6 @@ function $2fb324fbcc7b4a7b$var$ActualFloatingButtons({
4417
4614
  }));
4418
4615
  return $5vyXB$solidjsweb.ssr($2fb324fbcc7b4a7b$var$_tmpl$, $5vyXB$solidjsweb.ssrHydrationKey(), `floating-buttons ${is_scrolling_upwards() && modal_is_closed() && !regular_buttons_are_in_view() && !get_is_showing_toast() ? "show-them" : ""}`, $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.filter_text_(), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $02215fefc955d01e$export$28f6150e232898de), {})), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.sorting_text_(), true), false), current_sorting_[0]()?.order === "asc" ? $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $f958b5ac0e4a78da$export$da32f7add8a22e86), {})) : $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $046db47e0326c715$export$d10e63059ddb9fd4), {})), $5vyXB$solidjsweb.ssrAttribute("aria-label", $5vyXB$solidjsweb.escape(i18n_.scroll_to_top_(), true), false), $5vyXB$solidjsweb.escape($5vyXB$solidjsweb.createComponent((0, $084b6a0ee1d481de$export$2624c5890f1bbcf7), {})));
4419
4616
  }
4420
- const $1ab22f2cd39b3061$var$fallback_operator = "in";
4421
- const $1ab22f2cd39b3061$var$fallback_token = "";
4422
- const $1ab22f2cd39b3061$var$legacy_filter_prefix = "filter_";
4423
- const $1ab22f2cd39b3061$var$operator_map = {
4424
- "eq": "≡",
4425
- "neq": "≠",
4426
- "in": "∈",
4427
- "nin": "∉",
4428
- "leq": "≤",
4429
- "geq": "≥",
4430
- "inrange": "\uD83D\uDD22"
4431
- };
4432
- const $1ab22f2cd39b3061$var$ascending_token = "\uD83D\uDCC8";
4433
- const $1ab22f2cd39b3061$var$descending_token = "\uD83D\uDCC9";
4434
- const $1ab22f2cd39b3061$var$range_delimiter = "-";
4435
- const $1ab22f2cd39b3061$var$string_item_delimiter = "‚"; // This is not a comma but a comma-like character that browsers will render in the URL bar.
4436
- const $1ab22f2cd39b3061$var$array_item_delimiter = "‣"; // FIXME: decide on a character. Could theoretically be a double string delimiter.
4437
- const $1ab22f2cd39b3061$var$empty_item_replacement = "0️⃣";
4438
- const $1ab22f2cd39b3061$var$op_to_token = op => {
4439
- if (op === $1ab22f2cd39b3061$var$fallback_operator) return $1ab22f2cd39b3061$var$fallback_token;
4440
- return $1ab22f2cd39b3061$var$operator_map[op];
4441
- };
4442
- /**
4443
- * 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.
4444
- * The requirements are either an array of strings, containing no reserved characters, or an array of arrays of strings, containing no reserved characters.
4445
- * No deep or mixed nesting levels are supported.
4446
- */
4447
- function $1ab22f2cd39b3061$var$array_is_serializable(array, is_root = true) {
4448
- if (array.every(item => Array.isArray(item))) {
4449
- if (!is_root)
4450
- // Deeply nested arrays are not supported, but also don't exist as filters (yet)
4451
- return false;
4452
- return array.every(item => $1ab22f2cd39b3061$var$array_is_serializable(item, false));
4453
- }
4454
- if (array.some(item => typeof item !== "string"))
4455
- // Numbers are not supported, since 1 and "1" would encode to the same thing
4456
- return false;
4457
- // Encoding reserved characters is not supported
4458
- return !array.some(item => item.includes($1ab22f2cd39b3061$var$array_item_delimiter) || item.includes($1ab22f2cd39b3061$var$string_item_delimiter) || item === $1ab22f2cd39b3061$var$empty_item_replacement);
4459
- }
4460
- /**
4461
- * Human readable string[] or string[][] serialization for URLs.
4462
- * @param array
4463
- * @returns
4464
- */
4465
- function $1ab22f2cd39b3061$var$encode_array(array) {
4466
- const is_nested = array.every(item => Array.isArray(item));
4467
- if (is_nested) return array.map($1ab22f2cd39b3061$var$encode_array).join($1ab22f2cd39b3061$var$array_item_delimiter) + $1ab22f2cd39b3061$var$array_item_delimiter; // Nested arrays require a suffix to close nesting levels
4468
- return array.map(item => item === "" ? $1ab22f2cd39b3061$var$empty_item_replacement : item).join($1ab22f2cd39b3061$var$string_item_delimiter);
4469
- }
4470
- function $1ab22f2cd39b3061$var$decode_array(encoded_array) {
4471
- const is_nested = encoded_array.includes($1ab22f2cd39b3061$var$array_item_delimiter);
4472
- if (is_nested) return encoded_array.split($1ab22f2cd39b3061$var$array_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter
4473
- .map($1ab22f2cd39b3061$var$decode_array);
4474
- return encoded_array.split($1ab22f2cd39b3061$var$string_item_delimiter).filter(s => s !== "") // Remove empty segments, caused by trailing delimiter in the single item special case
4475
- .map(item => item === $1ab22f2cd39b3061$var$empty_item_replacement ? "" : item);
4476
- }
4477
- function $1ab22f2cd39b3061$var$encode_filter_data(op, data) {
4478
- if (data === "true")
4479
- // boolean encoding
4480
- return "1";
4481
- if (data === "false")
4482
- // boolean encoding
4483
- return "0";
4484
- const data_is_array = Array.isArray(data);
4485
- if (op === "inrange" && data_is_array && data.every(item => typeof item === "number"))
4486
- // numeric range filter encoding
4487
- return data.join($1ab22f2cd39b3061$var$range_delimiter);
4488
- if (data_is_array && $1ab22f2cd39b3061$var$array_is_serializable(data)) {
4489
- const encoded_data = $1ab22f2cd39b3061$var$encode_array(data);
4490
- if (!encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter) && !encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter))
4491
- // A string[] with only one item will encode without delimiters, which is indistinguishable from a plain string during decoding
4492
- // In that case we add a delimiter suffix at the end
4493
- return encoded_data + $1ab22f2cd39b3061$var$string_item_delimiter;
4494
- return encoded_data;
4495
- }
4496
- // Fallback encoding
4497
- return $5vyXB$depictaiutilishared.base64_encode_unicode(JSON.stringify(data));
4498
- }
4499
- function $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data) {
4500
- if (encoded_data === "1") return "true";
4501
- if (encoded_data === "0") return "false";
4502
- if (op === "inrange" && encoded_data.includes($1ab22f2cd39b3061$var$range_delimiter)) return encoded_data.split($1ab22f2cd39b3061$var$range_delimiter).map(x => parseFloat(x));
4503
- if (encoded_data.includes($1ab22f2cd39b3061$var$string_item_delimiter) || encoded_data.includes($1ab22f2cd39b3061$var$array_item_delimiter)) return $1ab22f2cd39b3061$var$decode_array(encoded_data);
4504
- try {
4505
- return JSON.parse($5vyXB$depictaiutilishared.base64_decode_unicode(encoded_data));
4506
- } catch (e) {
4507
- $5vyXB$depictaiutilishared.dlog("Failed to fallback parse filter data", op, encoded_data, e);
4508
- }
4509
- return null;
4510
- }
4511
- function $1ab22f2cd39b3061$export$58aa3f171519b6d7(filters, search_params, filter_query_param_prefix) {
4512
- for (const filter of filters) {
4513
- const {
4514
- field: field,
4515
- op: op,
4516
- data: data
4517
- } = filter;
4518
- const encoded_data = $1ab22f2cd39b3061$var$encode_filter_data(op, data);
4519
- search_params.set(filter_query_param_prefix + field + $1ab22f2cd39b3061$var$op_to_token(op), encoded_data);
4520
- }
4521
- }
4522
- function $1ab22f2cd39b3061$export$f934fa24c3a86811(search_params, filter_query_param_prefix) {
4523
- const found_filters = [];
4524
- for (const key of search_params.keys()) {
4525
- // Allow for backwards compatibility with the old filter query param prefix
4526
- let chosen_prefix = filter_query_param_prefix;
4527
- if (!key.startsWith(chosen_prefix)) {
4528
- chosen_prefix = $1ab22f2cd39b3061$var$legacy_filter_prefix;
4529
- if (!key.startsWith(chosen_prefix)) continue;
4530
- }
4531
- const encoded_data = search_params.get(key);
4532
- if (!encoded_data) continue;
4533
- const [op, token] = Object.entries($1ab22f2cd39b3061$var$operator_map).find(([, token]) => key.endsWith(token)) || [$1ab22f2cd39b3061$var$fallback_operator, $1ab22f2cd39b3061$var$fallback_token];
4534
- const data = $1ab22f2cd39b3061$var$decode_filter_data(op, encoded_data);
4535
- if (!data) continue;
4536
- const field = key.slice(chosen_prefix.length, token ? -token.length : undefined);
4537
- found_filters.push({
4538
- field: field,
4539
- op: op,
4540
- data: data
4541
- });
4542
- }
4543
- return found_filters;
4544
- }
4545
- function $1ab22f2cd39b3061$export$62acb285a7579555(sorting, search_params, sorting_query_param) {
4546
- if (!sorting) return;
4547
- const {
4548
- field: field,
4549
- order: order
4550
- } = sorting;
4551
- const ascending = order === "asc";
4552
- search_params.set(sorting_query_param, field + (ascending ? $1ab22f2cd39b3061$var$ascending_token : $1ab22f2cd39b3061$var$descending_token));
4553
- }
4554
- function $1ab22f2cd39b3061$export$766e9676e74997d3(search_params, sorting_query_param_) {
4555
- const encoded_sorting = search_params.get(sorting_query_param_);
4556
- if (!encoded_sorting) return;
4557
- if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$ascending_token)) return {
4558
- field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$ascending_token.length),
4559
- order: "asc"
4560
- };
4561
- if (encoded_sorting.endsWith($1ab22f2cd39b3061$var$descending_token)) return {
4562
- field: encoded_sorting.slice(0, -$1ab22f2cd39b3061$var$descending_token.length),
4563
- order: "desc"
4564
- };
4565
- $5vyXB$depictaiutilishared.dlog("Invalid sorting query param value", encoded_sorting);
4566
- return;
4567
- }
4568
- function $1ab22f2cd39b3061$export$916e6850778505f6(search_params, filter_query_param_prefix, sorting_query_param) {
4569
- // We'll be modifying the URLSearchParams object, so we need to make a copy of the keys first
4570
- const keys = [...search_params.keys()];
4571
- for (const key of keys) if (key.startsWith(filter_query_param_prefix) || key === sorting_query_param || key.startsWith($1ab22f2cd39b3061$var$legacy_filter_prefix)) search_params.delete(key);
4572
- }
4573
- const $1ab22f2cd39b3061$export$cf5feb2102aec7f2 = "went_sideways_clear_filters";
4574
- function $1ab22f2cd39b3061$export$43cd1e747fecd42e({
4575
- to_url_: to_url_,
4576
- set_clearing_flag_: set_clearing_flag_,
4577
- from_search_params_ = new URLSearchParams(location.search),
4578
- sorting_query_param_: sorting_query_param_,
4579
- filter_query_param_prefix_: filter_query_param_prefix_
4580
- }) {
4581
- if (!to_url_) return to_url_;
4582
- const was_url_object = to_url_ instanceof URL;
4583
- const url_object = was_url_object ? to_url_ : new URL(to_url_, location.origin);
4584
- const {
4585
- searchParams: searchParams
4586
- } = url_object;
4587
- if (set_clearing_flag_) searchParams.set($1ab22f2cd39b3061$export$cf5feb2102aec7f2, "true");
4588
- if (from_search_params_.has(sorting_query_param_)) searchParams.set(sorting_query_param_, from_search_params_.get(sorting_query_param_));
4589
- for (const key of from_search_params_.keys()) if (key.startsWith(filter_query_param_prefix_)) searchParams.set(key, from_search_params_.get(key));
4590
- if (was_url_object) return url_object;
4591
- return url_object.href;
4592
- }
4593
4617
  const $e53b2e7e632ac4cb$var$_tmpl$ = ["<nav", ' class="crumbs"', ">", "</nav>"],
4594
4618
  $e53b2e7e632ac4cb$var$_tmpl$2 = ["<a", ' class="crumb"', ">", "</a>"],
4595
4619
  $e53b2e7e632ac4cb$var$_tmpl$3 = ["<span", ' class="separator">', "</span>"];
@@ -8990,7 +9014,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
8990
9014
  }, "failed to open page");
8991
9015
  #empty_page_bugfix() {
8992
9016
  // Called when a "page" is "opened" using PageReplacer
8993
- const on_maybe_popstate = what_happened => {
9017
+ const on_maybe_popstate = $5vyXB$depictaiutilishared.catchify(what_happened => {
8994
9018
  if (what_happened !== "popstate") return;
8995
9019
  const cleaned_current_url = $0a6acf31d1eae57c$var$clean_url(location.href);
8996
9020
  if (!$0a6acf31d1eae57c$export$3ccaa27d81dd8556.#visited_urls.has(cleaned_current_url)) {
@@ -9019,7 +9043,7 @@ class $0a6acf31d1eae57c$export$3ccaa27d81dd8556 extends EventTarget {
9019
9043
  $0a6acf31d1eae57c$export$3ccaa27d81dd8556.#reverting_permitted = false; // Disallow any reverting since we can't - it would flash a white page until the reload has finished.
9020
9044
  this.#unload(); // 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.
9021
9045
  }
9022
- };
9046
+ });
9023
9047
 
9024
9048
  (0, $5vyXB$depictaiutilishared.instant_exec_on_suspect_history_change).add(on_maybe_popstate);
9025
9049
  this.#revert_fns.push(() => (0, $5vyXB$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