@orangelogic/orange-dam-content-browser-sdk 2.4.8 → 2.4.9

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.
Files changed (26) hide show
  1. package/build/GlobalConfigContext.d.ts +4 -0
  2. package/build/OrangeDAMContentBrowserSDK.min.js +738 -337
  3. package/build/api/asset/asset.d.ts +2 -1
  4. package/build/api/asset/asset.types.d.ts +9 -0
  5. package/build/components/content-browser/content-browser.d.ts +73 -2
  6. package/build/components/content-browser-asset-card/content-browser-asset-card.d.ts +25 -1
  7. package/build/components/content-browser-control-bar/content-browser-control-bar.d.ts +1 -0
  8. package/build/components/content-browser-control-view/content-browser-control-view.d.ts +5 -2
  9. package/build/components/content-browser-format-dialog/content-browser-format-dialog.d.ts +27 -1
  10. package/build/components/content-browser-grid/content-browser-grid.d.ts +5 -1
  11. package/build/components/content-browser-table/column-layout.d.ts +29 -0
  12. package/build/components/content-browser-table/content-browser-table.d.ts +302 -0
  13. package/build/components/content-browser-table/content-browser-table.styles.d.ts +2 -0
  14. package/build/content-browser.mjs +2506 -450
  15. package/build/events/cx-content-browser-control-view-change.d.ts +2 -2
  16. package/build/events/cx-content-browser-request-change.d.ts +2 -2
  17. package/build/events/cx-content-browser-table-column-resize.d.ts +26 -0
  18. package/build/events/index.d.ts +1 -0
  19. package/build/index.d.ts +40 -2
  20. package/build/index.html +4 -0
  21. package/build/index.mjs +2531 -635
  22. package/build/tools/fetch-and-merge-assets.d.ts +15 -3
  23. package/build/types/asset.d.ts +5 -0
  24. package/build/types/content-browser.d.ts +69 -0
  25. package/build/utils/table-column-widths.d.ts +5 -0
  26. package/package.json +2 -2
package/build/index.mjs CHANGED
@@ -148,6 +148,7 @@ import CxResizeObserver from "@orangelogic/design-system/components/resize-obser
148
148
  import CxArrayLineClamp from "@orangelogic/design-system/components/array-line-clamp";
149
149
  import CxCard from "@orangelogic/design-system/components/card";
150
150
  import CxCheckbox from "@orangelogic/design-system/components/checkbox";
151
+ import CxColorSwatchGroup from "@orangelogic/design-system/components/color-swatch-group";
151
152
  import "@orangelogic/design-system/assets/design-system.css";
152
153
  import "@orangelogic/design-system/assets/outlined.css";
153
154
  import "@orangelogic/design-system/css/ol-light.css";
@@ -1222,13 +1223,13 @@ var camelCase = createCompounder(function(result, word, index) {
1222
1223
  word = word.toLowerCase();
1223
1224
  return result + (index ? capitalize(word) : word);
1224
1225
  });
1225
- var __defProp$h = Object.defineProperty;
1226
- var __decorateClass$h = (decorators, target, key, kind) => {
1226
+ var __defProp$i = Object.defineProperty;
1227
+ var __decorateClass$i = (decorators, target, key, kind) => {
1227
1228
  var result = void 0;
1228
1229
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
1229
1230
  if (decorator = decorators[i4])
1230
1231
  result = decorator(target, key, result) || result;
1231
- if (result) __defProp$h(target, key, result);
1232
+ if (result) __defProp$i(target, key, result);
1232
1233
  return result;
1233
1234
  };
1234
1235
  const _CortexElement = class _CortexElement extends i$4 {
@@ -1355,16 +1356,16 @@ const _CortexElement = class _CortexElement extends i$4 {
1355
1356
  _CortexElement.version = "1";
1356
1357
  _CortexElement.dependencies = {};
1357
1358
  let CortexElement = _CortexElement;
1358
- __decorateClass$h([
1359
+ __decorateClass$i([
1359
1360
  n$6()
1360
1361
  ], CortexElement.prototype, "dir");
1361
- __decorateClass$h([
1362
+ __decorateClass$i([
1362
1363
  n$6()
1363
1364
  ], CortexElement.prototype, "lang");
1364
- __decorateClass$h([
1365
+ __decorateClass$i([
1365
1366
  n$6()
1366
1367
  ], CortexElement.prototype, "theme");
1367
- __decorateClass$h([
1368
+ __decorateClass$i([
1368
1369
  n$6({ attribute: "pre-render", type: Boolean })
1369
1370
  ], CortexElement.prototype, "preRender");
1370
1371
  function rescueElementPrototype(element) {
@@ -5816,7 +5817,7 @@ function watch(propertyName, options) {
5816
5817
  };
5817
5818
  };
5818
5819
  }
5819
- const styles$e = i$7`
5820
+ const styles$f = i$7`
5820
5821
  :host {
5821
5822
  display: contents;
5822
5823
  }
@@ -5905,14 +5906,14 @@ const styles$e = i$7`
5905
5906
  display: block;
5906
5907
  }
5907
5908
  `;
5908
- var __defProp$g = Object.defineProperty;
5909
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
5910
- var __decorateClass$g = (decorators, target, key, kind) => {
5911
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
5909
+ var __defProp$h = Object.defineProperty;
5910
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
5911
+ var __decorateClass$h = (decorators, target, key, kind) => {
5912
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
5912
5913
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
5913
5914
  if (decorator = decorators[i4])
5914
5915
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5915
- if (kind && result) __defProp$g(target, key, result);
5916
+ if (kind && result) __defProp$h(target, key, result);
5916
5917
  return result;
5917
5918
  };
5918
5919
  const LIBRARY_FOLDER_TITLE = "Library";
@@ -6181,7 +6182,7 @@ let CxContentBrowserBrowser = class extends CortexElement {
6181
6182
  `;
6182
6183
  }
6183
6184
  };
6184
- CxContentBrowserBrowser.styles = [componentStyles, styles$e];
6185
+ CxContentBrowserBrowser.styles = [componentStyles, styles$f];
6185
6186
  CxContentBrowserBrowser.dependencies = {
6186
6187
  "cx-drawer": CxDrawer,
6187
6188
  "cx-folder-select": CxFolderSelect,
@@ -6191,70 +6192,70 @@ CxContentBrowserBrowser.dependencies = {
6191
6192
  "cx-tooltip": CxTooltip,
6192
6193
  "cx-typography": CxTypography
6193
6194
  };
6194
- __decorateClass$g([
6195
+ __decorateClass$h([
6195
6196
  e$7(".drawer-trigger")
6196
6197
  ], CxContentBrowserBrowser.prototype, "trigger", 2);
6197
- __decorateClass$g([
6198
+ __decorateClass$h([
6198
6199
  e$7(".content-browser-browser")
6199
6200
  ], CxContentBrowserBrowser.prototype, "drawer", 2);
6200
- __decorateClass$g([
6201
+ __decorateClass$h([
6201
6202
  n$6({ attribute: "folder-id", type: String })
6202
6203
  ], CxContentBrowserBrowser.prototype, "folderId", 2);
6203
- __decorateClass$g([
6204
+ __decorateClass$h([
6204
6205
  n$6({ attribute: "folder-title", type: String })
6205
6206
  ], CxContentBrowserBrowser.prototype, "folderTitle", 2);
6206
- __decorateClass$g([
6207
+ __decorateClass$h([
6207
6208
  n$6({ attribute: "allowed-folders", type: Array })
6208
6209
  ], CxContentBrowserBrowser.prototype, "allowedFolders", 2);
6209
- __decorateClass$g([
6210
+ __decorateClass$h([
6210
6211
  n$6({ attribute: "can-pin", type: Boolean })
6211
6212
  ], CxContentBrowserBrowser.prototype, "canPin", 2);
6212
- __decorateClass$g([
6213
+ __decorateClass$h([
6213
6214
  n$6({ attribute: "collection-path", type: String })
6214
6215
  ], CxContentBrowserBrowser.prototype, "collectionPath", 2);
6215
- __decorateClass$g([
6216
+ __decorateClass$h([
6216
6217
  n$6({ attribute: "favorite-folder-id", type: String })
6217
6218
  ], CxContentBrowserBrowser.prototype, "favoriteFolderId", 2);
6218
- __decorateClass$g([
6219
+ __decorateClass$h([
6219
6220
  n$6({ attribute: "show-collections", type: Boolean })
6220
6221
  ], CxContentBrowserBrowser.prototype, "showCollections", 2);
6221
- __decorateClass$g([
6222
+ __decorateClass$h([
6222
6223
  n$6({ attribute: "show-favorite-folder", type: Boolean })
6223
6224
  ], CxContentBrowserBrowser.prototype, "showFavoriteFolder", 2);
6224
- __decorateClass$g([
6225
+ __decorateClass$h([
6225
6226
  n$6({ attribute: "force-overlay", type: Boolean })
6226
6227
  ], CxContentBrowserBrowser.prototype, "forceOverlay", 2);
6227
- __decorateClass$g([
6228
+ __decorateClass$h([
6228
6229
  n$6({ attribute: "see-thru", type: Boolean })
6229
6230
  ], CxContentBrowserBrowser.prototype, "seeThru", 2);
6230
- __decorateClass$g([
6231
+ __decorateClass$h([
6231
6232
  n$6({ attribute: "min-query-length", type: Number })
6232
6233
  ], CxContentBrowserBrowser.prototype, "minQueryLength", 2);
6233
- __decorateClass$g([
6234
+ __decorateClass$h([
6234
6235
  n$6({ attribute: "token", type: String })
6235
6236
  ], CxContentBrowserBrowser.prototype, "token", 2);
6236
- __decorateClass$g([
6237
+ __decorateClass$h([
6237
6238
  n$6({ attribute: "bearer-token", type: String })
6238
6239
  ], CxContentBrowserBrowser.prototype, "bearerToken", 2);
6239
- __decorateClass$g([
6240
+ __decorateClass$h([
6240
6241
  n$6({ attribute: "base-url", type: String })
6241
6242
  ], CxContentBrowserBrowser.prototype, "baseUrl", 2);
6242
- __decorateClass$g([
6243
+ __decorateClass$h([
6243
6244
  n$6({ attribute: "use-site-session", type: Boolean })
6244
6245
  ], CxContentBrowserBrowser.prototype, "useSiteSession", 2);
6245
- __decorateClass$g([
6246
+ __decorateClass$h([
6246
6247
  r$6()
6247
6248
  ], CxContentBrowserBrowser.prototype, "searchTerm", 2);
6248
- __decorateClass$g([
6249
+ __decorateClass$h([
6249
6250
  r$6()
6250
6251
  ], CxContentBrowserBrowser.prototype, "isPersistent", 2);
6251
- __decorateClass$g([
6252
+ __decorateClass$h([
6252
6253
  r$6()
6253
6254
  ], CxContentBrowserBrowser.prototype, "collectionsOpen", 2);
6254
- __decorateClass$g([
6255
+ __decorateClass$h([
6255
6256
  watch("forceOverlay", { waitUntilFirstUpdate: true })
6256
6257
  ], CxContentBrowserBrowser.prototype, "handleForceOverlayChange", 1);
6257
- CxContentBrowserBrowser = __decorateClass$g([
6258
+ CxContentBrowserBrowser = __decorateClass$h([
6258
6259
  customElement("cx-content-browser-browser")
6259
6260
  ], CxContentBrowserBrowser);
6260
6261
  /**
@@ -6385,6 +6386,7 @@ var GridView$1 = /* @__PURE__ */ ((GridView2) => {
6385
6386
  GridView2["Small"] = "small";
6386
6387
  return GridView2;
6387
6388
  })(GridView$1 || {});
6389
+ const TABLE_VIEW = "table";
6388
6390
  const ASSET_SIZE = {
6389
6391
  [
6390
6392
  "small"
@@ -6417,19 +6419,46 @@ var TransformationAction = /* @__PURE__ */ ((TransformationAction2) => {
6417
6419
  TransformationAction2["Rotate"] = "Rotate";
6418
6420
  return TransformationAction2;
6419
6421
  })(TransformationAction || {});
6422
+ const autoSelectFormatConverter = {
6423
+ fromAttribute: (value) => {
6424
+ if (value === null) {
6425
+ return false;
6426
+ }
6427
+ const normalized = value.trim();
6428
+ if (normalized === "" || normalized.toLowerCase() === "true") {
6429
+ return true;
6430
+ }
6431
+ if (normalized.toLowerCase() === "false") {
6432
+ return false;
6433
+ }
6434
+ return normalized;
6435
+ },
6436
+ toAttribute: (value) => {
6437
+ return value === false ? null : String(value);
6438
+ }
6439
+ };
6440
+ function isAutoSelectFormatActive(value) {
6441
+ return value === true || typeof value === "string" && value.trim() !== "";
6442
+ }
6443
+ function toTableRowActionPosition(value) {
6444
+ return value === "row-end" ? "row-end" : "host-edge";
6445
+ }
6420
6446
  var ContentBrowserFormatDialogVariant = /* @__PURE__ */ ((ContentBrowserFormatDialogVariant2) => {
6421
6447
  ContentBrowserFormatDialogVariant2["Dialog"] = "dialog";
6422
6448
  ContentBrowserFormatDialogVariant2["Drawer"] = "drawer";
6423
6449
  return ContentBrowserFormatDialogVariant2;
6424
6450
  })(ContentBrowserFormatDialogVariant || {});
6425
- var __defProp$f = Object.defineProperty;
6426
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
6427
- var __decorateClass$f = (decorators, target, key, kind) => {
6428
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
6451
+ function toFieldKey(field) {
6452
+ return field.trim().toLowerCase();
6453
+ }
6454
+ var __defProp$g = Object.defineProperty;
6455
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
6456
+ var __decorateClass$g = (decorators, target, key, kind) => {
6457
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
6429
6458
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6430
6459
  if (decorator = decorators[i4])
6431
6460
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6432
- if (kind && result) __defProp$f(target, key, result);
6461
+ if (kind && result) __defProp$g(target, key, result);
6433
6462
  return result;
6434
6463
  };
6435
6464
  let CxContentBrowserControlFilterFacet = class extends CortexElement {
@@ -6565,37 +6594,37 @@ CxContentBrowserControlFilterFacet.dependencies = {
6565
6594
  "cx-typography": CxTypography
6566
6595
  };
6567
6596
  CxContentBrowserControlFilterFacet.itemsPerPage = 10;
6568
- __decorateClass$f([
6597
+ __decorateClass$g([
6569
6598
  n$6({ attribute: "loading", reflect: false, type: Boolean })
6570
6599
  ], CxContentBrowserControlFilterFacet.prototype, "loading", 2);
6571
- __decorateClass$f([
6600
+ __decorateClass$g([
6572
6601
  n$6({ attribute: "display-name", reflect: false, type: String })
6573
6602
  ], CxContentBrowserControlFilterFacet.prototype, "displayName", 2);
6574
- __decorateClass$f([
6603
+ __decorateClass$g([
6575
6604
  n$6({ attribute: "type", reflect: true, type: String })
6576
6605
  ], CxContentBrowserControlFilterFacet.prototype, "type", 2);
6577
- __decorateClass$f([
6606
+ __decorateClass$g([
6578
6607
  n$6({ attribute: "values", reflect: false, type: Array })
6579
6608
  ], CxContentBrowserControlFilterFacet.prototype, "values", 2);
6580
- __decorateClass$f([
6609
+ __decorateClass$g([
6581
6610
  n$6({ attribute: "collections", reflect: false, type: Array })
6582
6611
  ], CxContentBrowserControlFilterFacet.prototype, "collections", 2);
6583
- __decorateClass$f([
6612
+ __decorateClass$g([
6584
6613
  r$6()
6585
6614
  ], CxContentBrowserControlFilterFacet.prototype, "mappedSubtypes", 2);
6586
- __decorateClass$f([
6615
+ __decorateClass$g([
6587
6616
  r$6()
6588
6617
  ], CxContentBrowserControlFilterFacet.prototype, "mappedDisplayNames", 2);
6589
- __decorateClass$f([
6618
+ __decorateClass$g([
6590
6619
  r$6()
6591
6620
  ], CxContentBrowserControlFilterFacet.prototype, "page", 2);
6592
- __decorateClass$f([
6621
+ __decorateClass$g([
6593
6622
  watch("values")
6594
6623
  ], CxContentBrowserControlFilterFacet.prototype, "handleValuesChange", 1);
6595
- CxContentBrowserControlFilterFacet = __decorateClass$f([
6624
+ CxContentBrowserControlFilterFacet = __decorateClass$g([
6596
6625
  customElement("cx-content-browser-control-filter-facet")
6597
6626
  ], CxContentBrowserControlFilterFacet);
6598
- const styles$d = i$7`
6627
+ const styles$e = i$7`
6599
6628
  :host {
6600
6629
  --details-width: min(240px, 90dvw);
6601
6630
 
@@ -6620,14 +6649,14 @@ const styles$d = i$7`
6620
6649
  border-left-width: 0px;
6621
6650
  }
6622
6651
  `;
6623
- var __defProp$e = Object.defineProperty;
6624
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
6625
- var __decorateClass$e = (decorators, target, key, kind) => {
6626
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
6652
+ var __defProp$f = Object.defineProperty;
6653
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
6654
+ var __decorateClass$f = (decorators, target, key, kind) => {
6655
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
6627
6656
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6628
6657
  if (decorator = decorators[i4])
6629
6658
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6630
- if (kind && result) __defProp$e(target, key, result);
6659
+ if (kind && result) __defProp$f(target, key, result);
6631
6660
  return result;
6632
6661
  };
6633
6662
  let CxContentBrowserControlFilter = class extends CortexElement {
@@ -6852,7 +6881,7 @@ let CxContentBrowserControlFilter = class extends CortexElement {
6852
6881
  `;
6853
6882
  }
6854
6883
  };
6855
- CxContentBrowserControlFilter.styles = [componentStyles, styles$d];
6884
+ CxContentBrowserControlFilter.styles = [componentStyles, styles$e];
6856
6885
  CxContentBrowserControlFilter.dependencies = {
6857
6886
  "cx-badge": CxBadge,
6858
6887
  "cx-button": CxButton,
@@ -6873,52 +6902,52 @@ CxContentBrowserControlFilter.dependencies = {
6873
6902
  "cx-tooltip": CxTooltip,
6874
6903
  "cx-typography": CxTypography
6875
6904
  };
6876
- __decorateClass$e([
6905
+ __decorateClass$f([
6877
6906
  n$6({ attribute: "facets", reflect: false, type: Array })
6878
6907
  ], CxContentBrowserControlFilter.prototype, "facets", 2);
6879
- __decorateClass$e([
6908
+ __decorateClass$f([
6880
6909
  n$6({ attribute: "available-facets", reflect: false, type: Array })
6881
6910
  ], CxContentBrowserControlFilter.prototype, "availableFacets", 2);
6882
- __decorateClass$e([
6911
+ __decorateClass$f([
6883
6912
  n$6({ attribute: "selected-facets", reflect: false, type: Object })
6884
6913
  ], CxContentBrowserControlFilter.prototype, "selectedFacets", 2);
6885
- __decorateClass$e([
6914
+ __decorateClass$f([
6886
6915
  n$6({ attribute: "loading", reflect: false, type: Boolean })
6887
6916
  ], CxContentBrowserControlFilter.prototype, "loading", 2);
6888
- __decorateClass$e([
6917
+ __decorateClass$f([
6889
6918
  n$6({ attribute: "newly-changed-option", reflect: false, type: Object })
6890
6919
  ], CxContentBrowserControlFilter.prototype, "newlyChangedOption", 2);
6891
- __decorateClass$e([
6920
+ __decorateClass$f([
6892
6921
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
6893
6922
  ], CxContentBrowserControlFilter.prototype, "isMobile", 2);
6894
- __decorateClass$e([
6923
+ __decorateClass$f([
6895
6924
  r$6()
6896
6925
  ], CxContentBrowserControlFilter.prototype, "appliedFiltersCount", 2);
6897
- __decorateClass$e([
6926
+ __decorateClass$f([
6898
6927
  r$6()
6899
6928
  ], CxContentBrowserControlFilter.prototype, "mappedDisplayNames", 2);
6900
- __decorateClass$e([
6929
+ __decorateClass$f([
6901
6930
  watch("facets")
6902
6931
  ], CxContentBrowserControlFilter.prototype, "handleFacetsChange", 1);
6903
- __decorateClass$e([
6932
+ __decorateClass$f([
6904
6933
  watch("selectedFacets")
6905
6934
  ], CxContentBrowserControlFilter.prototype, "handleSelectedFacetsChange", 1);
6906
- CxContentBrowserControlFilter = __decorateClass$e([
6935
+ CxContentBrowserControlFilter = __decorateClass$f([
6907
6936
  customElement("cx-content-browser-control-filter")
6908
6937
  ], CxContentBrowserControlFilter);
6909
- const styles$c = i$7`
6938
+ const styles$d = i$7`
6910
6939
  :host {
6911
6940
  display: contents;
6912
6941
  }
6913
6942
  `;
6914
- var __defProp$d = Object.defineProperty;
6915
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
6916
- var __decorateClass$d = (decorators, target, key, kind) => {
6917
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
6943
+ var __defProp$e = Object.defineProperty;
6944
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
6945
+ var __decorateClass$e = (decorators, target, key, kind) => {
6946
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
6918
6947
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6919
6948
  if (decorator = decorators[i4])
6920
6949
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6921
- if (kind && result) __defProp$d(target, key, result);
6950
+ if (kind && result) __defProp$e(target, key, result);
6922
6951
  return result;
6923
6952
  };
6924
6953
  let CxContentBrowserControlSort = class extends CortexElement {
@@ -7057,7 +7086,7 @@ let CxContentBrowserControlSort = class extends CortexElement {
7057
7086
  `;
7058
7087
  }
7059
7088
  };
7060
- CxContentBrowserControlSort.styles = [componentStyles, styles$c];
7089
+ CxContentBrowserControlSort.styles = [componentStyles, styles$d];
7061
7090
  CxContentBrowserControlSort.dependencies = {
7062
7091
  "cx-divider": CxDivider,
7063
7092
  "cx-dropdown": CxDropdown,
@@ -7068,57 +7097,62 @@ CxContentBrowserControlSort.dependencies = {
7068
7097
  "cx-spinner": CxSpinner,
7069
7098
  "cx-tooltip": CxTooltip
7070
7099
  };
7071
- __decorateClass$d([
7100
+ __decorateClass$e([
7072
7101
  n$6({ attribute: "sort-order-name", reflect: true, type: String })
7073
7102
  ], CxContentBrowserControlSort.prototype, "sortOrderName", 2);
7074
- __decorateClass$d([
7103
+ __decorateClass$e([
7075
7104
  n$6({ attribute: "sort-direction", reflect: true, type: String })
7076
7105
  ], CxContentBrowserControlSort.prototype, "sortDirection", 2);
7077
- __decorateClass$d([
7106
+ __decorateClass$e([
7078
7107
  n$6({ attribute: "sort-orders", reflect: false, type: Array })
7079
7108
  ], CxContentBrowserControlSort.prototype, "sortOrders", 2);
7080
- __decorateClass$d([
7109
+ __decorateClass$e([
7081
7110
  n$6({ attribute: "loading", reflect: true, type: Boolean })
7082
7111
  ], CxContentBrowserControlSort.prototype, "loading", 2);
7083
- __decorateClass$d([
7112
+ __decorateClass$e([
7084
7113
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7085
7114
  ], CxContentBrowserControlSort.prototype, "isMobile", 2);
7086
- __decorateClass$d([
7115
+ __decorateClass$e([
7087
7116
  n$6({ attribute: "newly-changed-option", reflect: false, type: Object })
7088
7117
  ], CxContentBrowserControlSort.prototype, "newlyChangedOption", 2);
7089
- __decorateClass$d([
7118
+ __decorateClass$e([
7090
7119
  r$6()
7091
7120
  ], CxContentBrowserControlSort.prototype, "mappedSortDirections", 2);
7092
- __decorateClass$d([
7121
+ __decorateClass$e([
7093
7122
  r$6()
7094
7123
  ], CxContentBrowserControlSort.prototype, "sortDirections", 2);
7095
- __decorateClass$d([
7124
+ __decorateClass$e([
7096
7125
  watch("sortOrderName"),
7097
7126
  watch("sortDirection"),
7098
7127
  watch("sortOrders", { waitUntilFirstUpdate: true }),
7099
7128
  watch("sortDirections", { waitUntilFirstUpdate: true })
7100
7129
  ], CxContentBrowserControlSort.prototype, "handleSortDirectionsChange", 1);
7101
- CxContentBrowserControlSort = __decorateClass$d([
7130
+ CxContentBrowserControlSort = __decorateClass$e([
7102
7131
  customElement("cx-content-browser-control-sort")
7103
7132
  ], CxContentBrowserControlSort);
7104
- const styles$b = i$7`
7133
+ const styles$c = i$7`
7105
7134
  :host {
7106
7135
  display: contents;
7107
7136
  }
7108
7137
 
7138
+ cx-menu[key='default-menu'] > cx-menu-item::part(checked-icon),
7139
+ cx-menu[name='main'] > cx-menu-item::part(checked-icon) {
7140
+ display: none;
7141
+ }
7142
+
7109
7143
  .menu-item--switch {
7110
7144
  --submenu-icon-display: none;
7111
7145
  --checked-icon-display: none;
7112
7146
  }
7113
7147
  `;
7114
- var __defProp$c = Object.defineProperty;
7115
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
7116
- var __decorateClass$c = (decorators, target, key, kind) => {
7117
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
7148
+ var __defProp$d = Object.defineProperty;
7149
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
7150
+ var __decorateClass$d = (decorators, target, key, kind) => {
7151
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
7118
7152
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7119
7153
  if (decorator = decorators[i4])
7120
7154
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7121
- if (kind && result) __defProp$c(target, key, result);
7155
+ if (kind && result) __defProp$d(target, key, result);
7122
7156
  return result;
7123
7157
  };
7124
7158
  let CxContentBrowserControlView = class extends CortexElement {
@@ -7129,6 +7163,10 @@ let CxContentBrowserControlView = class extends CortexElement {
7129
7163
  this.views = [];
7130
7164
  this.isSeeThrough = false;
7131
7165
  this.isMobile = false;
7166
+ this.canUseTable = false;
7167
+ }
7168
+ get isTable() {
7169
+ return this.view === TABLE_VIEW;
7132
7170
  }
7133
7171
  runConnectedCallback() {
7134
7172
  this.handleViewChange();
@@ -7148,6 +7186,21 @@ let CxContentBrowserControlView = class extends CortexElement {
7148
7186
  }
7149
7187
  });
7150
7188
  }
7189
+ renderTableOption() {
7190
+ if (!this.canUseTable) {
7191
+ return A$1;
7192
+ }
7193
+ return b`
7194
+ <cx-menu-item
7195
+ value=${TABLE_VIEW}
7196
+ type="checkbox"
7197
+ ?checked=${this.isTable}
7198
+ >
7199
+ <cx-line-clamp lines="1">${this.localize.term("table")}</cx-line-clamp>
7200
+ <cx-icon slot="prefix" name="table_rows"></cx-icon>
7201
+ </cx-menu-item>
7202
+ `;
7203
+ }
7151
7204
  handleViewChange() {
7152
7205
  this.selectedView = this.views.find((item) => item.value === this.view);
7153
7206
  }
@@ -7165,7 +7218,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7165
7218
  <div slot="trigger">
7166
7219
  <cx-tooltip content=${this.localize.term("view")}>
7167
7220
  <cx-icon-button
7168
- name="dashboard"
7221
+ name=${this.isTable ? "table_rows" : "dashboard"}
7169
7222
  label=${this.localize.term("view")}
7170
7223
  outline
7171
7224
  ></cx-icon-button>
@@ -7179,7 +7232,8 @@ let CxContentBrowserControlView = class extends CortexElement {
7179
7232
  <cx-menu-label>${this.localize.term("view")}</cx-menu-label>
7180
7233
  <cx-menu-item
7181
7234
  menu="submenu"
7182
- always-show-checked-icon
7235
+ type="checkbox"
7236
+ ?checked=${!this.isTable}
7183
7237
  >
7184
7238
  ${this.localize.term("grid")}
7185
7239
  ${n$5(
@@ -7192,6 +7246,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7192
7246
  )}
7193
7247
  <cx-icon slot="prefix" name="grid_view"></cx-icon>
7194
7248
  </cx-menu-item>
7249
+ ${this.renderTableOption()}
7195
7250
  <cx-divider></cx-divider>
7196
7251
  <cx-menu-item value="see-thru" class="menu-item--switch">
7197
7252
  <cx-space direction="horizontal" justify-content="space-between">
@@ -7225,7 +7280,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7225
7280
  () => b`
7226
7281
  <cx-menu key="default-menu" no-uncheck>
7227
7282
  <cx-menu-label>${this.localize.term("view")}</cx-menu-label>
7228
- <cx-menu-item type="checkbox">
7283
+ <cx-menu-item type="checkbox" ?checked=${!this.isTable}>
7229
7284
  ${this.localize.term("grid")}
7230
7285
  ${n$5(
7231
7286
  this.selectedView,
@@ -7254,6 +7309,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7254
7309
  </cx-menu>
7255
7310
  <cx-icon slot="prefix" name="grid_view"></cx-icon>
7256
7311
  </cx-menu-item>
7312
+ ${this.renderTableOption()}
7257
7313
  <cx-divider></cx-divider>
7258
7314
  <cx-menu-item value="see-thru" class="menu-item--switch">
7259
7315
  <cx-space direction="horizontal" justify-content="space-between">
@@ -7271,7 +7327,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7271
7327
  `;
7272
7328
  }
7273
7329
  };
7274
- CxContentBrowserControlView.styles = [componentStyles, styles$b];
7330
+ CxContentBrowserControlView.styles = [componentStyles, styles$c];
7275
7331
  CxContentBrowserControlView.dependencies = {
7276
7332
  "cx-divider": CxDivider,
7277
7333
  "cx-dropdown": CxDropdown,
@@ -7285,28 +7341,31 @@ CxContentBrowserControlView.dependencies = {
7285
7341
  "cx-switch": CxSwitch,
7286
7342
  "cx-tooltip": CxTooltip
7287
7343
  };
7288
- __decorateClass$c([
7344
+ __decorateClass$d([
7289
7345
  n$6({ attribute: "view", reflect: true, type: String })
7290
7346
  ], CxContentBrowserControlView.prototype, "view", 2);
7291
- __decorateClass$c([
7347
+ __decorateClass$d([
7292
7348
  n$6({ attribute: "views", reflect: false, type: Array })
7293
7349
  ], CxContentBrowserControlView.prototype, "views", 2);
7294
- __decorateClass$c([
7350
+ __decorateClass$d([
7295
7351
  n$6({ attribute: "is-see-through", reflect: true, type: Boolean })
7296
7352
  ], CxContentBrowserControlView.prototype, "isSeeThrough", 2);
7297
- __decorateClass$c([
7353
+ __decorateClass$d([
7298
7354
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7299
7355
  ], CxContentBrowserControlView.prototype, "isMobile", 2);
7300
- __decorateClass$c([
7356
+ __decorateClass$d([
7357
+ n$6({ attribute: "can-use-table", reflect: true, type: Boolean })
7358
+ ], CxContentBrowserControlView.prototype, "canUseTable", 2);
7359
+ __decorateClass$d([
7301
7360
  r$6()
7302
7361
  ], CxContentBrowserControlView.prototype, "selectedView", 2);
7303
- __decorateClass$c([
7362
+ __decorateClass$d([
7304
7363
  watch("view", { waitUntilFirstUpdate: true })
7305
7364
  ], CxContentBrowserControlView.prototype, "handleViewChange", 1);
7306
- CxContentBrowserControlView = __decorateClass$c([
7365
+ CxContentBrowserControlView = __decorateClass$d([
7307
7366
  customElement("cx-content-browser-control-view")
7308
7367
  ], CxContentBrowserControlView);
7309
- const styles$a = i$7`
7368
+ const styles$b = i$7`
7310
7369
  :host {
7311
7370
  display: block;
7312
7371
  }
@@ -7329,14 +7388,14 @@ const styles$a = i$7`
7329
7388
  margin-left: auto;
7330
7389
  }
7331
7390
  `;
7332
- var __defProp$b = Object.defineProperty;
7333
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
7334
- var __decorateClass$b = (decorators, target, key, kind) => {
7335
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
7391
+ var __defProp$c = Object.defineProperty;
7392
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
7393
+ var __decorateClass$c = (decorators, target, key, kind) => {
7394
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
7336
7395
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7337
7396
  if (decorator = decorators[i4])
7338
7397
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7339
- if (kind && result) __defProp$b(target, key, result);
7398
+ if (kind && result) __defProp$c(target, key, result);
7340
7399
  return result;
7341
7400
  };
7342
7401
  let CxContentBrowserControlBar = class extends CortexElement {
@@ -7357,6 +7416,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7357
7416
  this.loading = false;
7358
7417
  this.searchText = "";
7359
7418
  this.isMobile = false;
7419
+ this.canUseTable = false;
7360
7420
  }
7361
7421
  handleSearchChange(event) {
7362
7422
  this.searchText = event.target.value;
@@ -7404,6 +7464,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7404
7464
  <cx-content-browser-control-view
7405
7465
  view=${this.view}
7406
7466
  .views=${this.views}
7467
+ ?can-use-table=${this.canUseTable}
7407
7468
  ?is-see-through=${this.isSeeThrough}
7408
7469
  ?is-mobile=${this.isMobile}
7409
7470
  ></cx-content-browser-control-view>
@@ -7420,7 +7481,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7420
7481
  `;
7421
7482
  }
7422
7483
  };
7423
- CxContentBrowserControlBar.styles = [componentStyles, styles$a];
7484
+ CxContentBrowserControlBar.styles = [componentStyles, styles$b];
7424
7485
  CxContentBrowserControlBar.dependencies = {
7425
7486
  "cx-avatar": CxAvatar,
7426
7487
  "cx-content-browser-control-filter": CxContentBrowserControlFilter,
@@ -7432,52 +7493,55 @@ CxContentBrowserControlBar.dependencies = {
7432
7493
  "cx-space": CxSpace,
7433
7494
  "cx-typography": CxTypography
7434
7495
  };
7435
- __decorateClass$b([
7496
+ __decorateClass$c([
7436
7497
  n$6({ attribute: "current-count", type: Number })
7437
7498
  ], CxContentBrowserControlBar.prototype, "currentCount", 2);
7438
- __decorateClass$b([
7499
+ __decorateClass$c([
7439
7500
  n$6({ attribute: "total-count", type: Number })
7440
7501
  ], CxContentBrowserControlBar.prototype, "totalCount", 2);
7441
- __decorateClass$b([
7502
+ __decorateClass$c([
7442
7503
  n$6({ attribute: "sort-order-name", reflect: true, type: String })
7443
7504
  ], CxContentBrowserControlBar.prototype, "sortOrderName", 2);
7444
- __decorateClass$b([
7505
+ __decorateClass$c([
7445
7506
  n$6({ attribute: "sort-direction", reflect: true, type: String })
7446
7507
  ], CxContentBrowserControlBar.prototype, "sortDirection", 2);
7447
- __decorateClass$b([
7508
+ __decorateClass$c([
7448
7509
  n$6({ attribute: "sort-orders", reflect: false, type: Array })
7449
7510
  ], CxContentBrowserControlBar.prototype, "sortOrders", 2);
7450
- __decorateClass$b([
7511
+ __decorateClass$c([
7451
7512
  n$6({ attribute: "view", reflect: true, type: String })
7452
7513
  ], CxContentBrowserControlBar.prototype, "view", 2);
7453
- __decorateClass$b([
7514
+ __decorateClass$c([
7454
7515
  n$6({ attribute: "views", reflect: false, type: Array })
7455
7516
  ], CxContentBrowserControlBar.prototype, "views", 2);
7456
- __decorateClass$b([
7517
+ __decorateClass$c([
7457
7518
  n$6({ attribute: "facets", reflect: false, type: Array })
7458
7519
  ], CxContentBrowserControlBar.prototype, "facets", 2);
7459
- __decorateClass$b([
7520
+ __decorateClass$c([
7460
7521
  n$6({ attribute: "available-facets", reflect: false, type: Array })
7461
7522
  ], CxContentBrowserControlBar.prototype, "availableFacets", 2);
7462
- __decorateClass$b([
7523
+ __decorateClass$c([
7463
7524
  n$6({ attribute: "selected-facets", reflect: false, type: Object })
7464
7525
  ], CxContentBrowserControlBar.prototype, "selectedFacets", 2);
7465
- __decorateClass$b([
7526
+ __decorateClass$c([
7466
7527
  n$6({ attribute: "is-see-through", reflect: true, type: Boolean })
7467
7528
  ], CxContentBrowserControlBar.prototype, "isSeeThrough", 2);
7468
- __decorateClass$b([
7529
+ __decorateClass$c([
7469
7530
  n$6({ attribute: "loading", reflect: true, type: Boolean })
7470
7531
  ], CxContentBrowserControlBar.prototype, "loading", 2);
7471
- __decorateClass$b([
7532
+ __decorateClass$c([
7472
7533
  n$6({ attribute: false, reflect: false, type: Object })
7473
7534
  ], CxContentBrowserControlBar.prototype, "newlyChangedOption", 2);
7474
- __decorateClass$b([
7535
+ __decorateClass$c([
7475
7536
  n$6({ attribute: "search-text", reflect: false, type: String })
7476
7537
  ], CxContentBrowserControlBar.prototype, "searchText", 2);
7477
- __decorateClass$b([
7538
+ __decorateClass$c([
7478
7539
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7479
7540
  ], CxContentBrowserControlBar.prototype, "isMobile", 2);
7480
- CxContentBrowserControlBar = __decorateClass$b([
7541
+ __decorateClass$c([
7542
+ n$6({ attribute: "can-use-table", reflect: true, type: Boolean })
7543
+ ], CxContentBrowserControlBar.prototype, "canUseTable", 2);
7544
+ CxContentBrowserControlBar = __decorateClass$c([
7481
7545
  customElement("cx-content-browser-control-bar")
7482
7546
  ], CxContentBrowserControlBar);
7483
7547
  /**
@@ -7784,14 +7848,14 @@ var Orientation = /* @__PURE__ */ ((Orientation2) => {
7784
7848
  Orientation2["Vertical"] = "vertical";
7785
7849
  return Orientation2;
7786
7850
  })(Orientation || {});
7787
- var __defProp$a = Object.defineProperty;
7788
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
7789
- var __decorateClass$a = (decorators, target, key, kind) => {
7790
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
7851
+ var __defProp$b = Object.defineProperty;
7852
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
7853
+ var __decorateClass$b = (decorators, target, key, kind) => {
7854
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
7791
7855
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7792
7856
  if (decorator = decorators[i4])
7793
7857
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7794
- if (kind && result) __defProp$a(target, key, result);
7858
+ if (kind && result) __defProp$b(target, key, result);
7795
7859
  return result;
7796
7860
  };
7797
7861
  let CxContentBrowserAssetPreviewVideo = class extends CortexElement {
@@ -7907,40 +7971,40 @@ CxContentBrowserAssetPreviewVideo.dependencies = {
7907
7971
  "cx-typography": CxTypography,
7908
7972
  "cx-video": CxVideo
7909
7973
  };
7910
- __decorateClass$a([
7974
+ __decorateClass$b([
7911
7975
  e$7("cx-video")
7912
7976
  ], CxContentBrowserAssetPreviewVideo.prototype, "videoElement", 2);
7913
- __decorateClass$a([
7977
+ __decorateClass$b([
7914
7978
  e$7("img")
7915
7979
  ], CxContentBrowserAssetPreviewVideo.prototype, "imageElement", 2);
7916
- __decorateClass$a([
7980
+ __decorateClass$b([
7917
7981
  n$6({ attribute: "src", reflect: true, type: String })
7918
7982
  ], CxContentBrowserAssetPreviewVideo.prototype, "src", 2);
7919
- __decorateClass$a([
7983
+ __decorateClass$b([
7920
7984
  n$6({ attribute: "alt", reflect: true, type: String })
7921
7985
  ], CxContentBrowserAssetPreviewVideo.prototype, "alt", 2);
7922
- __decorateClass$a([
7986
+ __decorateClass$b([
7923
7987
  n$6({ attribute: "thumbnail-only", reflect: true, type: Boolean })
7924
7988
  ], CxContentBrowserAssetPreviewVideo.prototype, "thumbnailOnly", 2);
7925
- __decorateClass$a([
7989
+ __decorateClass$b([
7926
7990
  n$6({ attribute: "thumbnail-src", reflect: true, type: String })
7927
7991
  ], CxContentBrowserAssetPreviewVideo.prototype, "thumbnailSrc", 2);
7928
- __decorateClass$a([
7992
+ __decorateClass$b([
7929
7993
  n$6({ reflect: true, type: Boolean })
7930
7994
  ], CxContentBrowserAssetPreviewVideo.prototype, "controls", 2);
7931
- __decorateClass$a([
7995
+ __decorateClass$b([
7932
7996
  n$6({ attribute: "loaded", reflect: true, type: Boolean })
7933
7997
  ], CxContentBrowserAssetPreviewVideo.prototype, "loaded", 2);
7934
- __decorateClass$a([
7998
+ __decorateClass$b([
7935
7999
  r$6()
7936
8000
  ], CxContentBrowserAssetPreviewVideo.prototype, "assetDirection", 2);
7937
- __decorateClass$a([
8001
+ __decorateClass$b([
7938
8002
  r$6()
7939
8003
  ], CxContentBrowserAssetPreviewVideo.prototype, "progress", 2);
7940
- CxContentBrowserAssetPreviewVideo = __decorateClass$a([
8004
+ CxContentBrowserAssetPreviewVideo = __decorateClass$b([
7941
8005
  customElement("cx-content-browser-asset-preview-video")
7942
8006
  ], CxContentBrowserAssetPreviewVideo);
7943
- const styles$9 = i$7`
8007
+ const styles$a = i$7`
7944
8008
  :host {
7945
8009
  display: block;
7946
8010
  position: relative;
@@ -8087,14 +8151,14 @@ const styles$9 = i$7`
8087
8151
  transition: none;
8088
8152
  }
8089
8153
  `;
8090
- var __defProp$9 = Object.defineProperty;
8091
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
8092
- var __decorateClass$9 = (decorators, target, key, kind) => {
8093
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
8154
+ var __defProp$a = Object.defineProperty;
8155
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
8156
+ var __decorateClass$a = (decorators, target, key, kind) => {
8157
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
8094
8158
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8095
8159
  if (decorator = decorators[i4])
8096
8160
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8097
- if (kind && result) __defProp$9(target, key, result);
8161
+ if (kind && result) __defProp$a(target, key, result);
8098
8162
  return result;
8099
8163
  };
8100
8164
  const GIF_EXTENSION = ".gif";
@@ -8259,53 +8323,53 @@ let CxContentBrowserAssetPreview = class extends CortexElement {
8259
8323
  `;
8260
8324
  }
8261
8325
  };
8262
- CxContentBrowserAssetPreview.styles = [componentStyles, styles$9];
8326
+ CxContentBrowserAssetPreview.styles = [componentStyles, styles$a];
8263
8327
  CxContentBrowserAssetPreview.dependencies = {
8264
8328
  "cx-content-browser-asset-preview-video": CxContentBrowserAssetPreviewVideo,
8265
8329
  "cx-icon": CxIcon,
8266
8330
  "cx-skeleton": CxSkeleton,
8267
8331
  "cx-typography": CxTypography
8268
8332
  };
8269
- __decorateClass$9([
8333
+ __decorateClass$a([
8270
8334
  e$7("cx-content-browser-asset-preview-video")
8271
8335
  ], CxContentBrowserAssetPreview.prototype, "previewVideo", 2);
8272
- __decorateClass$9([
8336
+ __decorateClass$a([
8273
8337
  n$6({ attribute: "image-url", reflect: true, type: String })
8274
8338
  ], CxContentBrowserAssetPreview.prototype, "imageUrl", 2);
8275
- __decorateClass$9([
8339
+ __decorateClass$a([
8276
8340
  n$6({ attribute: "original-url", reflect: true, type: String })
8277
8341
  ], CxContentBrowserAssetPreview.prototype, "originalUrl", 2);
8278
- __decorateClass$9([
8342
+ __decorateClass$a([
8279
8343
  n$6({ attribute: "preview-url", reflect: true, type: String })
8280
8344
  ], CxContentBrowserAssetPreview.prototype, "previewUrl", 2);
8281
- __decorateClass$9([
8345
+ __decorateClass$a([
8282
8346
  n$6({ attribute: "alt", reflect: true, type: String })
8283
8347
  ], CxContentBrowserAssetPreview.prototype, "alt", 2);
8284
- __decorateClass$9([
8348
+ __decorateClass$a([
8285
8349
  n$6({ attribute: "doc-type", reflect: true, type: String })
8286
8350
  ], CxContentBrowserAssetPreview.prototype, "docType", 2);
8287
- __decorateClass$9([
8351
+ __decorateClass$a([
8288
8352
  n$6({ attribute: "extension", reflect: true, type: String })
8289
8353
  ], CxContentBrowserAssetPreview.prototype, "extension", 2);
8290
- __decorateClass$9([
8354
+ __decorateClass$a([
8291
8355
  n$6({ attribute: "in-cold-storage", reflect: true, type: Boolean })
8292
8356
  ], CxContentBrowserAssetPreview.prototype, "inColdStorage", 2);
8293
- __decorateClass$9([
8357
+ __decorateClass$a([
8294
8358
  n$6({ attribute: "thumbnail-only", reflect: true, type: Boolean })
8295
8359
  ], CxContentBrowserAssetPreview.prototype, "thumbnailOnly", 2);
8296
- __decorateClass$9([
8360
+ __decorateClass$a([
8297
8361
  n$6({ attribute: "controls", reflect: true, type: Boolean })
8298
8362
  ], CxContentBrowserAssetPreview.prototype, "controls", 2);
8299
- __decorateClass$9([
8363
+ __decorateClass$a([
8300
8364
  r$6()
8301
8365
  ], CxContentBrowserAssetPreview.prototype, "isError", 2);
8302
- __decorateClass$9([
8366
+ __decorateClass$a([
8303
8367
  r$6()
8304
8368
  ], CxContentBrowserAssetPreview.prototype, "loaded", 2);
8305
- CxContentBrowserAssetPreview = __decorateClass$9([
8369
+ CxContentBrowserAssetPreview = __decorateClass$a([
8306
8370
  customElement("cx-content-browser-asset-preview")
8307
8371
  ], CxContentBrowserAssetPreview);
8308
- const styles$8 = i$7`
8372
+ const styles$9 = i$7`
8309
8373
  :host {
8310
8374
  display: block;
8311
8375
  padding: var(--cx-spacing-small);
@@ -8315,14 +8379,14 @@ const styles$8 = i$7`
8315
8379
  width: 100%;
8316
8380
  }
8317
8381
  `;
8318
- var __defProp$8 = Object.defineProperty;
8319
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
8320
- var __decorateClass$8 = (decorators, target, key, kind) => {
8321
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
8382
+ var __defProp$9 = Object.defineProperty;
8383
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
8384
+ var __decorateClass$9 = (decorators, target, key, kind) => {
8385
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
8322
8386
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8323
8387
  if (decorator = decorators[i4])
8324
8388
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8325
- if (kind && result) __defProp$8(target, key, result);
8389
+ if (kind && result) __defProp$9(target, key, result);
8326
8390
  return result;
8327
8391
  };
8328
8392
  let CxContentBrowserAssetTrackingParameters = class extends CortexElement {
@@ -8431,7 +8495,7 @@ let CxContentBrowserAssetTrackingParameters = class extends CortexElement {
8431
8495
  `;
8432
8496
  }
8433
8497
  };
8434
- CxContentBrowserAssetTrackingParameters.styles = [componentStyles, styles$8];
8498
+ CxContentBrowserAssetTrackingParameters.styles = [componentStyles, styles$9];
8435
8499
  CxContentBrowserAssetTrackingParameters.dependencies = {
8436
8500
  "cx-button": CxButton,
8437
8501
  "cx-icon": CxIcon,
@@ -8440,13 +8504,13 @@ CxContentBrowserAssetTrackingParameters.dependencies = {
8440
8504
  "cx-input-group": CxInputGroup,
8441
8505
  "cx-space": CxSpace
8442
8506
  };
8443
- __decorateClass$8([
8507
+ __decorateClass$9([
8444
8508
  n$6({ attribute: false, type: Array })
8445
8509
  ], CxContentBrowserAssetTrackingParameters.prototype, "values", 2);
8446
- CxContentBrowserAssetTrackingParameters = __decorateClass$8([
8510
+ CxContentBrowserAssetTrackingParameters = __decorateClass$9([
8447
8511
  customElement("cx-content-browser-asset-tracking-parameters")
8448
8512
  ], CxContentBrowserAssetTrackingParameters);
8449
- const styles$7 = i$7`
8513
+ const styles$8 = i$7`
8450
8514
  :host {
8451
8515
  display: block;
8452
8516
  }
@@ -8555,14 +8619,14 @@ const styles$7 = i$7`
8555
8619
  color: var(--cx-color-primary);
8556
8620
  }
8557
8621
  `;
8558
- var __defProp$7 = Object.defineProperty;
8559
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
8560
- var __decorateClass$7 = (decorators, target, key, kind) => {
8561
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
8622
+ var __defProp$8 = Object.defineProperty;
8623
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
8624
+ var __decorateClass$8 = (decorators, target, key, kind) => {
8625
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
8562
8626
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8563
8627
  if (decorator = decorators[i4])
8564
8628
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8565
- if (kind && result) __defProp$7(target, key, result);
8629
+ if (kind && result) __defProp$8(target, key, result);
8566
8630
  return result;
8567
8631
  };
8568
8632
  const USE_REPRESENTATIVE_VALUE = "use-representative";
@@ -8816,7 +8880,7 @@ let CxContentBrowserAssetProxySelector = class extends CortexElement {
8816
8880
  `;
8817
8881
  }
8818
8882
  };
8819
- CxContentBrowserAssetProxySelector.styles = [componentStyles, styles$7];
8883
+ CxContentBrowserAssetProxySelector.styles = [componentStyles, styles$8];
8820
8884
  CxContentBrowserAssetProxySelector.dependencies = {
8821
8885
  "cx-content-browser-asset-tracking-parameters": CxContentBrowserAssetTrackingParameters,
8822
8886
  "cx-icon": CxIcon,
@@ -8826,49 +8890,49 @@ CxContentBrowserAssetProxySelector.dependencies = {
8826
8890
  "cx-switch": CxSwitch,
8827
8891
  "cx-typography": CxTypography
8828
8892
  };
8829
- __decorateClass$7([
8893
+ __decorateClass$8([
8830
8894
  n$6({ reflect: false, type: Array })
8831
8895
  ], CxContentBrowserAssetProxySelector.prototype, "items", 2);
8832
- __decorateClass$7([
8896
+ __decorateClass$8([
8833
8897
  n$6({ attribute: "can-custom-format", reflect: true, type: Boolean })
8834
8898
  ], CxContentBrowserAssetProxySelector.prototype, "canCustomFormat", 2);
8835
- __decorateClass$7([
8899
+ __decorateClass$8([
8836
8900
  n$6({ attribute: "can-use-representative", reflect: true, type: Boolean })
8837
8901
  ], CxContentBrowserAssetProxySelector.prototype, "canUseRepresentative", 2);
8838
- __decorateClass$7([
8902
+ __decorateClass$8([
8839
8903
  n$6({ attribute: "can-use-ats", reflect: true, type: Boolean })
8840
8904
  ], CxContentBrowserAssetProxySelector.prototype, "canUseATS", 2);
8841
- __decorateClass$7([
8905
+ __decorateClass$8([
8842
8906
  n$6({ attribute: "can-use-tracking", reflect: true, type: Boolean })
8843
8907
  ], CxContentBrowserAssetProxySelector.prototype, "canUseTracking", 2);
8844
- __decorateClass$7([
8908
+ __decorateClass$8([
8845
8909
  n$6({ attribute: "proxies-failed", reflect: true, type: Boolean })
8846
8910
  ], CxContentBrowserAssetProxySelector.prototype, "proxiesFailed", 2);
8847
- __decorateClass$7([
8911
+ __decorateClass$8([
8848
8912
  n$6({ attribute: "selected", reflect: true, type: String })
8849
8913
  ], CxContentBrowserAssetProxySelector.prototype, "selected", 2);
8850
- __decorateClass$7([
8914
+ __decorateClass$8([
8851
8915
  n$6({ attribute: "disabled-selected", reflect: true, type: Boolean })
8852
8916
  ], CxContentBrowserAssetProxySelector.prototype, "disabledSelected", 2);
8853
- __decorateClass$7([
8917
+ __decorateClass$8([
8854
8918
  n$6({ attribute: "custom-width", reflect: true, type: String })
8855
8919
  ], CxContentBrowserAssetProxySelector.prototype, "customWidth", 2);
8856
- __decorateClass$7([
8920
+ __decorateClass$8([
8857
8921
  n$6({ attribute: "custom-height", reflect: true, type: String })
8858
8922
  ], CxContentBrowserAssetProxySelector.prototype, "customHeight", 2);
8859
- __decorateClass$7([
8923
+ __decorateClass$8([
8860
8924
  n$6({ attribute: "custom-extension", reflect: true, type: String })
8861
8925
  ], CxContentBrowserAssetProxySelector.prototype, "customExtension", 2);
8862
- __decorateClass$7([
8926
+ __decorateClass$8([
8863
8927
  n$6({ attribute: "enabled-tracking", reflect: true, type: Boolean })
8864
8928
  ], CxContentBrowserAssetProxySelector.prototype, "enabledTracking", 2);
8865
- __decorateClass$7([
8929
+ __decorateClass$8([
8866
8930
  n$6({ attribute: "tracking-parameters", reflect: false, type: Array })
8867
8931
  ], CxContentBrowserAssetProxySelector.prototype, "trackingParameters", 2);
8868
- CxContentBrowserAssetProxySelector = __decorateClass$7([
8932
+ CxContentBrowserAssetProxySelector = __decorateClass$8([
8869
8933
  customElement("cx-content-browser-asset-proxy-selector")
8870
8934
  ], CxContentBrowserAssetProxySelector);
8871
- const styles$6 = i$7`
8935
+ const styles$7 = i$7`
8872
8936
  :host {
8873
8937
  display: block;
8874
8938
  width: 100%;
@@ -8941,14 +9005,14 @@ const styles$6 = i$7`
8941
9005
  font-size: var(--cx-font-size-3x-large);
8942
9006
  }
8943
9007
  `;
8944
- var __defProp$6 = Object.defineProperty;
8945
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
8946
- var __decorateClass$6 = (decorators, target, key, kind) => {
8947
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
9008
+ var __defProp$7 = Object.defineProperty;
9009
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
9010
+ var __decorateClass$7 = (decorators, target, key, kind) => {
9011
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
8948
9012
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8949
9013
  if (decorator = decorators[i4])
8950
9014
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8951
- if (kind && result) __defProp$6(target, key, result);
9015
+ if (kind && result) __defProp$7(target, key, result);
8952
9016
  return result;
8953
9017
  };
8954
9018
  let CxContentBrowserAssetVersionHistory = class extends CortexElement {
@@ -9020,7 +9084,7 @@ let CxContentBrowserAssetVersionHistory = class extends CortexElement {
9020
9084
  `;
9021
9085
  }
9022
9086
  };
9023
- CxContentBrowserAssetVersionHistory.styles = [componentStyles, styles$6];
9087
+ CxContentBrowserAssetVersionHistory.styles = [componentStyles, styles$7];
9024
9088
  CxContentBrowserAssetVersionHistory.dependencies = {
9025
9089
  "cx-grid": CxGrid,
9026
9090
  "cx-grid-item": CxGridItem,
@@ -9032,13 +9096,13 @@ CxContentBrowserAssetVersionHistory.dependencies = {
9032
9096
  "cx-typography": CxTypography,
9033
9097
  "cx-content-browser-asset-preview": CxContentBrowserAssetPreview
9034
9098
  };
9035
- __decorateClass$6([
9099
+ __decorateClass$7([
9036
9100
  n$6({ reflect: false, type: Array })
9037
9101
  ], CxContentBrowserAssetVersionHistory.prototype, "versions", 2);
9038
- __decorateClass$6([
9102
+ __decorateClass$7([
9039
9103
  n$6({ reflect: true, type: Boolean })
9040
9104
  ], CxContentBrowserAssetVersionHistory.prototype, "loading", 2);
9041
- CxContentBrowserAssetVersionHistory = __decorateClass$6([
9105
+ CxContentBrowserAssetVersionHistory = __decorateClass$7([
9042
9106
  customElement("cx-content-browser-asset-version-history")
9043
9107
  ], CxContentBrowserAssetVersionHistory);
9044
9108
  const dialogStyles = i$7`
@@ -9089,7 +9153,7 @@ const drawerStyles = i$7`
9089
9153
  padding: var(--cx-spacing-medium);
9090
9154
  }
9091
9155
  `;
9092
- const styles$5 = i$7`
9156
+ const styles$6 = i$7`
9093
9157
  :host {
9094
9158
  display: block;
9095
9159
  }
@@ -9129,14 +9193,14 @@ const styles$5 = i$7`
9129
9193
  width: 100%;
9130
9194
  }
9131
9195
  `;
9132
- var __defProp$5 = Object.defineProperty;
9133
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
9134
- var __decorateClass$5 = (decorators, target, key, kind) => {
9135
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
9196
+ var __defProp$6 = Object.defineProperty;
9197
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
9198
+ var __decorateClass$6 = (decorators, target, key, kind) => {
9199
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
9136
9200
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
9137
9201
  if (decorator = decorators[i4])
9138
9202
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9139
- if (kind && result) __defProp$5(target, key, result);
9203
+ if (kind && result) __defProp$6(target, key, result);
9140
9204
  return result;
9141
9205
  };
9142
9206
  const DEFAULT_TRACKING_PARAMETERS = [{
@@ -9178,6 +9242,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9178
9242
  this.canPinAsset = false;
9179
9243
  this.canTrack = false;
9180
9244
  this.canUseProxies = false;
9245
+ this.autoSelectFormat = false;
9181
9246
  this.simplePick = false;
9182
9247
  this.canViewVersions = false;
9183
9248
  this.variant = ContentBrowserFormatDialogVariant.Dialog;
@@ -9231,18 +9296,50 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9231
9296
  }
9232
9297
  return this.filteredProxies.some((proxy) => proxy.id === this.selectedProxy);
9233
9298
  }
9234
- handleSupportedExtensionsChange() {
9235
- var _a2, _b2;
9236
- this.filteredProxies = this.proxies.filter((item) => {
9237
- var _a3, _b3, _c2;
9238
- const assetExtension = (_c2 = (_b3 = (_a3 = this.asset) == null ? void 0 : _a3.extension) == null ? void 0 : _b3.replace(/^\./, "")) != null ? _c2 : "";
9299
+ filterProxies(proxies) {
9300
+ return proxies.filter((item) => {
9301
+ var _a2, _b2, _c2;
9302
+ const assetExtension = (_c2 = (_b2 = (_a2 = this.asset) == null ? void 0 : _a2.extension) == null ? void 0 : _b2.replace(/^\./, "")) != null ? _c2 : "";
9239
9303
  if (!item.extension && this.asset && assetExtension) {
9240
9304
  return this.supportedExtensions.includes(assetExtension);
9241
9305
  }
9242
9306
  return true;
9243
9307
  });
9308
+ }
9309
+ handleSupportedExtensionsChange() {
9310
+ var _a2, _b2;
9311
+ this.filteredProxies = this.filterProxies(this.proxies);
9244
9312
  this.selectedProxy = (_b2 = (_a2 = this.filteredProxies[0]) == null ? void 0 : _a2.id) != null ? _b2 : "";
9245
9313
  }
9314
+ /**
9315
+ * What `autoSelectFormat` resolves to for this asset: the proxy to insert with, or `undefined`
9316
+ * when the dialog should open as usual.
9317
+ *
9318
+ * `{ proxy: undefined }` is deliberate rather than a miss — with the picker switched off there is
9319
+ * no format to name and the original file is the only outcome, which is `handleProxyConfirm`'s
9320
+ * no-proxy branch. With the picker on a proxy must actually resolve: confirming none emits
9321
+ * nothing and would turn the click into a silent no-op, so both an empty proxy list and a format
9322
+ * name that matches nothing fall back to the dialog.
9323
+ */
9324
+ resolveAutoSelection() {
9325
+ const requested = this.autoSelectFormat;
9326
+ if (!isAutoSelectFormatActive(requested)) {
9327
+ return void 0;
9328
+ }
9329
+ if (!this.canUseProxies) {
9330
+ return { proxy: void 0 };
9331
+ }
9332
+ if (requested === true) {
9333
+ const [first] = this.filteredProxies;
9334
+ return first ? { proxy: first } : void 0;
9335
+ }
9336
+ const wanted = String(requested).trim().toLowerCase();
9337
+ const match2 = this.filteredProxies.find((proxy) => {
9338
+ var _a2, _b2;
9339
+ return ((_a2 = proxy.proxyName) == null ? void 0 : _a2.toLowerCase()) === wanted || ((_b2 = proxy.proxyLabel) == null ? void 0 : _b2.toLowerCase()) === wanted;
9340
+ });
9341
+ return match2 ? { proxy: match2 } : void 0;
9342
+ }
9246
9343
  open({
9247
9344
  asset,
9248
9345
  isFavorite,
@@ -9250,16 +9347,51 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9250
9347
  proxies,
9251
9348
  proxiesFailed = false
9252
9349
  }) {
9350
+ var _a2, _b2;
9253
9351
  this.asset = asset;
9254
9352
  this.isFavorite = isFavorite;
9255
9353
  this.isAssetPinned = isAssetPinned;
9256
9354
  this.proxies = proxies;
9257
9355
  this.proxiesFailed = proxiesFailed;
9356
+ this.filteredProxies = this.filterProxies(this.proxies);
9357
+ this.selectedProxy = (_b2 = (_a2 = this.filteredProxies[0]) == null ? void 0 : _a2.id) != null ? _b2 : "";
9358
+ const autoSelection = this.disabledConfirm ? void 0 : this.resolveAutoSelection();
9359
+ if (autoSelection) {
9360
+ if (autoSelection.proxy) {
9361
+ this.selectedProxy = autoSelection.proxy.id;
9362
+ }
9363
+ if (!this.loadingConfirm) {
9364
+ this.handleProxyConfirm();
9365
+ }
9366
+ return;
9367
+ }
9368
+ this.loadingConfirm = false;
9258
9369
  this.isOpen = true;
9259
9370
  }
9260
9371
  hide() {
9261
9372
  this.handleClose();
9262
9373
  }
9374
+ /**
9375
+ * Show a dialog that `open()` skipped through the auto-confirm shortcut. The asset, proxies and
9376
+ * resolved selection are still in place, so this lands the user on exactly the dialog the
9377
+ * shortcut spared them, with its confirm button live again to retry.
9378
+ */
9379
+ revealAfterAutoConfirm() {
9380
+ if (!this.asset) {
9381
+ this.handleClose();
9382
+ return;
9383
+ }
9384
+ const autoSelection = this.resolveAutoSelection();
9385
+ if (autoSelection == null ? void 0 : autoSelection.proxy) {
9386
+ this.selectedProxy = autoSelection.proxy.id;
9387
+ }
9388
+ this.loadingConfirm = false;
9389
+ this.isOpen = true;
9390
+ }
9391
+ /** Whether the dialog is actually on screen — false when `open()` took the auto-confirm path. */
9392
+ get isDialogOpen() {
9393
+ return this.isOpen;
9394
+ }
9263
9395
  setVersionHistory(versions) {
9264
9396
  this.versions = versions;
9265
9397
  this.loadingVersionHistory = false;
@@ -9741,7 +9873,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9741
9873
  <cx-button
9742
9874
  class="content-browser-format__footer__button"
9743
9875
  variant="primary"
9744
- ?loading=${this.loadingProxies}
9876
+ ?loading=${this.loadingConfirm || this.loadingProxies}
9745
9877
  @click=${this.handleProxyConfirm}
9746
9878
  >
9747
9879
  <cx-icon slot="prefix" name="folder"></cx-icon>
@@ -9806,7 +9938,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9806
9938
  `;
9807
9939
  }
9808
9940
  handleRequestClose(event) {
9809
- if (this.loadingFavorites || this.loadingPinAsset) {
9941
+ if (this.loadingConfirm || this.loadingFavorites || this.loadingPinAsset) {
9810
9942
  event.preventDefault();
9811
9943
  return;
9812
9944
  }
@@ -9868,7 +10000,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9868
10000
  `;
9869
10001
  }
9870
10002
  };
9871
- CxContentBrowserFormatDialog.styles = [componentStyles, styles$5];
10003
+ CxContentBrowserFormatDialog.styles = [componentStyles, styles$6];
9872
10004
  CxContentBrowserFormatDialog.dependencies = {
9873
10005
  "cx-asset-link-format": CxAssetLinkFormat,
9874
10006
  "cx-cropper": CxCropper,
@@ -9884,16 +10016,16 @@ CxContentBrowserFormatDialog.dependencies = {
9884
10016
  "cx-tooltip": CxTooltip,
9885
10017
  "cx-typography": CxTypography
9886
10018
  };
9887
- __decorateClass$5([
10019
+ __decorateClass$6([
9888
10020
  e$7("cx-asset-link-format")
9889
10021
  ], CxContentBrowserFormatDialog.prototype, "assetLinkFormat", 2);
9890
- __decorateClass$5([
10022
+ __decorateClass$6([
9891
10023
  n$6({ reflect: false, type: Object })
9892
10024
  ], CxContentBrowserFormatDialog.prototype, "boundary", 2);
9893
- __decorateClass$5([
10025
+ __decorateClass$6([
9894
10026
  n$6({ attribute: false, reflect: false, type: Object })
9895
10027
  ], CxContentBrowserFormatDialog.prototype, "availableExtensions", 2);
9896
- __decorateClass$5([
10028
+ __decorateClass$6([
9897
10029
  n$6({
9898
10030
  attribute: "supported-extensions",
9899
10031
  converter: {
@@ -9904,7 +10036,7 @@ __decorateClass$5([
9904
10036
  type: Array
9905
10037
  })
9906
10038
  ], CxContentBrowserFormatDialog.prototype, "supportedExtensions", 2);
9907
- __decorateClass$5([
10039
+ __decorateClass$6([
9908
10040
  n$6({
9909
10041
  attribute: "supported-representative-subtypes",
9910
10042
  converter: {
@@ -9915,116 +10047,119 @@ __decorateClass$5([
9915
10047
  type: Array
9916
10048
  })
9917
10049
  ], CxContentBrowserFormatDialog.prototype, "supportedRepresentativeSubtypes", 2);
9918
- __decorateClass$5([
10050
+ __decorateClass$6([
9919
10051
  n$6({ attribute: "auto-extension", reflect: false, type: String })
9920
10052
  ], CxContentBrowserFormatDialog.prototype, "autoExtension", 2);
9921
- __decorateClass$5([
10053
+ __decorateClass$6([
9922
10054
  n$6({ attribute: "cta-text", reflect: false, type: String })
9923
10055
  ], CxContentBrowserFormatDialog.prototype, "ctaText", 2);
9924
- __decorateClass$5([
10056
+ __decorateClass$6([
9925
10057
  n$6({ attribute: "cta-text-transform", reflect: false, type: String })
9926
10058
  ], CxContentBrowserFormatDialog.prototype, "ctaTextTransform", 2);
9927
- __decorateClass$5([
10059
+ __decorateClass$6([
9928
10060
  n$6({ attribute: "can-custom-format", reflect: false, type: Boolean })
9929
10061
  ], CxContentBrowserFormatDialog.prototype, "canCustomFormat", 2);
9930
- __decorateClass$5([
10062
+ __decorateClass$6([
9931
10063
  n$6({ attribute: "can-favorite", reflect: false, type: Boolean })
9932
10064
  ], CxContentBrowserFormatDialog.prototype, "canFavorite", 2);
9933
- __decorateClass$5([
10065
+ __decorateClass$6([
9934
10066
  n$6({ attribute: "can-pin-asset", reflect: false, type: Boolean })
9935
10067
  ], CxContentBrowserFormatDialog.prototype, "canPinAsset", 2);
9936
- __decorateClass$5([
10068
+ __decorateClass$6([
9937
10069
  n$6({ attribute: "can-track", reflect: false, type: Boolean })
9938
10070
  ], CxContentBrowserFormatDialog.prototype, "canTrack", 2);
9939
- __decorateClass$5([
10071
+ __decorateClass$6([
9940
10072
  n$6({ attribute: "can-use-proxies", reflect: false, type: Boolean })
9941
10073
  ], CxContentBrowserFormatDialog.prototype, "canUseProxies", 2);
9942
- __decorateClass$5([
10074
+ __decorateClass$6([
10075
+ n$6({ attribute: "auto-select-format", converter: autoSelectFormatConverter, reflect: false })
10076
+ ], CxContentBrowserFormatDialog.prototype, "autoSelectFormat", 2);
10077
+ __decorateClass$6([
9943
10078
  n$6({ attribute: "simple-pick", reflect: false, type: Boolean })
9944
10079
  ], CxContentBrowserFormatDialog.prototype, "simplePick", 2);
9945
- __decorateClass$5([
10080
+ __decorateClass$6([
9946
10081
  n$6({ attribute: "can-view-versions", reflect: false, type: Boolean })
9947
10082
  ], CxContentBrowserFormatDialog.prototype, "canViewVersions", 2);
9948
- __decorateClass$5([
10083
+ __decorateClass$6([
9949
10084
  n$6({ reflect: true, type: String })
9950
10085
  ], CxContentBrowserFormatDialog.prototype, "variant", 2);
9951
- __decorateClass$5([
10086
+ __decorateClass$6([
9952
10087
  n$6({ attribute: "loading-favorites", reflect: true, type: Boolean })
9953
10088
  ], CxContentBrowserFormatDialog.prototype, "loadingFavorites", 2);
9954
- __decorateClass$5([
10089
+ __decorateClass$6([
9955
10090
  n$6({ attribute: "loading-pin-asset", reflect: true, type: Boolean })
9956
10091
  ], CxContentBrowserFormatDialog.prototype, "loadingPinAsset", 2);
9957
- __decorateClass$5([
10092
+ __decorateClass$6([
9958
10093
  n$6({ attribute: "loading-proxies", reflect: true, type: Boolean })
9959
10094
  ], CxContentBrowserFormatDialog.prototype, "loadingProxies", 2);
9960
- __decorateClass$5([
10095
+ __decorateClass$6([
9961
10096
  n$6({ attribute: "disabled-confirm", reflect: true, type: Boolean })
9962
10097
  ], CxContentBrowserFormatDialog.prototype, "disabledConfirm", 2);
9963
- __decorateClass$5([
10098
+ __decorateClass$6([
9964
10099
  n$6({ attribute: "token", type: String })
9965
10100
  ], CxContentBrowserFormatDialog.prototype, "token", 2);
9966
- __decorateClass$5([
10101
+ __decorateClass$6([
9967
10102
  n$6({ attribute: "base-url", type: String })
9968
10103
  ], CxContentBrowserFormatDialog.prototype, "baseUrl", 2);
9969
- __decorateClass$5([
10104
+ __decorateClass$6([
9970
10105
  r$6()
9971
10106
  ], CxContentBrowserFormatDialog.prototype, "asset", 2);
9972
- __decorateClass$5([
10107
+ __decorateClass$6([
9973
10108
  r$6()
9974
10109
  ], CxContentBrowserFormatDialog.prototype, "isOpen", 2);
9975
- __decorateClass$5([
10110
+ __decorateClass$6([
9976
10111
  r$6()
9977
10112
  ], CxContentBrowserFormatDialog.prototype, "isFavorite", 2);
9978
- __decorateClass$5([
10113
+ __decorateClass$6([
9979
10114
  r$6()
9980
10115
  ], CxContentBrowserFormatDialog.prototype, "isAssetPinned", 2);
9981
- __decorateClass$5([
10116
+ __decorateClass$6([
9982
10117
  r$6()
9983
10118
  ], CxContentBrowserFormatDialog.prototype, "proxies", 2);
9984
- __decorateClass$5([
10119
+ __decorateClass$6([
9985
10120
  r$6()
9986
10121
  ], CxContentBrowserFormatDialog.prototype, "proxiesFailed", 2);
9987
- __decorateClass$5([
10122
+ __decorateClass$6([
9988
10123
  r$6()
9989
10124
  ], CxContentBrowserFormatDialog.prototype, "showVersionHistory", 2);
9990
- __decorateClass$5([
10125
+ __decorateClass$6([
9991
10126
  r$6()
9992
10127
  ], CxContentBrowserFormatDialog.prototype, "showCustomFormat", 2);
9993
- __decorateClass$5([
10128
+ __decorateClass$6([
9994
10129
  r$6()
9995
10130
  ], CxContentBrowserFormatDialog.prototype, "loadingVersionHistory", 2);
9996
- __decorateClass$5([
10131
+ __decorateClass$6([
9997
10132
  r$6()
9998
10133
  ], CxContentBrowserFormatDialog.prototype, "versions", 2);
9999
- __decorateClass$5([
10134
+ __decorateClass$6([
10000
10135
  r$6()
10001
10136
  ], CxContentBrowserFormatDialog.prototype, "filteredProxies", 2);
10002
- __decorateClass$5([
10137
+ __decorateClass$6([
10003
10138
  r$6()
10004
10139
  ], CxContentBrowserFormatDialog.prototype, "selectedProxy", 2);
10005
- __decorateClass$5([
10140
+ __decorateClass$6([
10006
10141
  r$6()
10007
10142
  ], CxContentBrowserFormatDialog.prototype, "lastProxyBeforeCustomFormat", 2);
10008
- __decorateClass$5([
10143
+ __decorateClass$6([
10009
10144
  r$6()
10010
10145
  ], CxContentBrowserFormatDialog.prototype, "confirmedTransformations", 2);
10011
- __decorateClass$5([
10146
+ __decorateClass$6([
10012
10147
  r$6()
10013
10148
  ], CxContentBrowserFormatDialog.prototype, "confirmedFormat", 2);
10014
- __decorateClass$5([
10149
+ __decorateClass$6([
10015
10150
  r$6()
10016
10151
  ], CxContentBrowserFormatDialog.prototype, "loadingConfirm", 2);
10017
- __decorateClass$5([
10152
+ __decorateClass$6([
10018
10153
  r$6()
10019
10154
  ], CxContentBrowserFormatDialog.prototype, "enabledTracking", 2);
10020
- __decorateClass$5([
10155
+ __decorateClass$6([
10021
10156
  r$6()
10022
10157
  ], CxContentBrowserFormatDialog.prototype, "trackingParameters", 2);
10023
- __decorateClass$5([
10158
+ __decorateClass$6([
10024
10159
  watch("proxies", { waitUntilFirstUpdate: true }),
10025
10160
  watch("supportedExtensions")
10026
10161
  ], CxContentBrowserFormatDialog.prototype, "handleSupportedExtensionsChange", 1);
10027
- CxContentBrowserFormatDialog = __decorateClass$5([
10162
+ CxContentBrowserFormatDialog = __decorateClass$6([
10028
10163
  customElement("cx-content-browser-format-dialog")
10029
10164
  ], CxContentBrowserFormatDialog);
10030
10165
  function __decorate(decorators, target, key, desc) {
@@ -11823,7 +11958,7 @@ class GridLayout extends GridBaseLayout {
11823
11958
  this._scrollSize = size;
11824
11959
  }
11825
11960
  }
11826
- const styles$4 = i$7`
11961
+ const styles$5 = i$7`
11827
11962
  :host {
11828
11963
  display: block;
11829
11964
  }
@@ -11862,6 +11997,50 @@ const styles$4 = i$7`
11862
11997
  line-height: var(--cx-line-height-small);
11863
11998
  }
11864
11999
 
12000
+ /*
12001
+ * Affordance only, never a second control: pointer-events stay off so the click lands on the card
12002
+ * beneath and takes the one path a card click already takes, and the button is aria-hidden and
12003
+ * untabbable so the card is still the single thing announced and focused.
12004
+ */
12005
+ .content-browser-asset-card__cta {
12006
+ /*
12007
+ * Positioned against the card's base, not the image slot, so the image box has to be described
12008
+ * here: inset by the card's own padding and given the same aspect-ratio ::part(image) carries,
12009
+ * which lands it exactly on the thumbnail. Without this it covers the title row too and centres
12010
+ * the button on the card rather than on the image. Keep the ratio in step with ::part(image).
12011
+ */
12012
+ position: absolute;
12013
+ inset: var(--cx-spacing-x-small);
12014
+ bottom: auto;
12015
+ aspect-ratio: 246 / 180;
12016
+ /*
12017
+ * The image slot's overflow clip does not reach an overlay positioned against the base, so the
12018
+ * rounding is restated. Inherited, not a token: the overlay is slotted into that image slot, so
12019
+ * it takes whatever radius the thumbnail is clipped to, overrides of ::part(image) included.
12020
+ */
12021
+ border-radius: inherit;
12022
+ z-index: 1;
12023
+ display: flex;
12024
+ align-items: center;
12025
+ justify-content: center;
12026
+ background-color: rgb(0 0 0 / 35%);
12027
+ opacity: 0;
12028
+ pointer-events: none;
12029
+ transition: opacity 150ms ease;
12030
+ }
12031
+
12032
+ .content-browser-asset-card:hover .content-browser-asset-card__cta,
12033
+ .content-browser-asset-card:focus-within .content-browser-asset-card__cta,
12034
+ .content-browser-asset-card__cta--busy {
12035
+ opacity: 1;
12036
+ }
12037
+
12038
+ @media (prefers-reduced-motion: reduce) {
12039
+ .content-browser-asset-card__cta {
12040
+ transition: none;
12041
+ }
12042
+ }
12043
+
11865
12044
  .content-browser-asset-card__checkbox {
11866
12045
  position: absolute;
11867
12046
  top: 2px;
@@ -11874,19 +12053,24 @@ const styles$4 = i$7`
11874
12053
  pointer-events: none;
11875
12054
  }
11876
12055
  `;
11877
- var __defProp$4 = Object.defineProperty;
11878
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11879
- var __decorateClass$4 = (decorators, target, key, kind) => {
11880
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
12056
+ var __defProp$5 = Object.defineProperty;
12057
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
12058
+ var __decorateClass$5 = (decorators, target, key, kind) => {
12059
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
11881
12060
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
11882
12061
  if (decorator = decorators[i4])
11883
12062
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11884
- if (kind && result) __defProp$4(target, key, result);
12063
+ if (kind && result) __defProp$5(target, key, result);
11885
12064
  return result;
11886
12065
  };
11887
12066
  let CxContentBrowserAssetCard = class extends CortexElement {
11888
12067
  constructor() {
11889
12068
  super(...arguments);
12069
+ this.localize = new LocalizeController(this);
12070
+ this.showCta = false;
12071
+ this.ctaText = "";
12072
+ this.ctaTextTransform = "capitalize";
12073
+ this.busy = false;
11890
12074
  this.imageUrl = "";
11891
12075
  this.originalUrl = "";
11892
12076
  this.scrubUrl = "";
@@ -11953,6 +12137,26 @@ let CxContentBrowserAssetCard = class extends CortexElement {
11953
12137
  ?thumbnail-only=${this.view === "small"}
11954
12138
  ?in-cold-storage=${this.inColdStorage}
11955
12139
  ></cx-content-browser-asset-preview>
12140
+ ${n$5(
12141
+ this.showCta && !this.inColdStorage,
12142
+ () => b`
12143
+ <div
12144
+ slot="image"
12145
+ class=${e$5({
12146
+ "content-browser-asset-card__cta": true,
12147
+ "content-browser-asset-card__cta--busy": this.busy
12148
+ })}
12149
+ aria-hidden="true"
12150
+ >
12151
+ <cx-button size="small" variant="primary" tabindex="-1" ?loading=${this.busy}>
12152
+ <span style=${o$2({ textTransform: this.ctaTextTransform })}>
12153
+ ${this.ctaText || this.localize.term("insert")}
12154
+ </span>
12155
+ </cx-button>
12156
+ </div>
12157
+ `,
12158
+ () => A$1
12159
+ )}
11956
12160
  <cx-space spacing="small" align-items="center" wrap="nowrap" class="content-browser-asset-card__info">
11957
12161
  ${n$5(
11958
12162
  this.showTitle && this.assetName,
@@ -12063,9 +12267,10 @@ let CxContentBrowserAssetCard = class extends CortexElement {
12063
12267
  `;
12064
12268
  }
12065
12269
  };
12066
- CxContentBrowserAssetCard.styles = [componentStyles, styles$4];
12270
+ CxContentBrowserAssetCard.styles = [componentStyles, styles$5];
12067
12271
  CxContentBrowserAssetCard.dependencies = {
12068
12272
  "cx-array-line-clamp": CxArrayLineClamp,
12273
+ "cx-button": CxButton,
12069
12274
  "cx-card": CxCard,
12070
12275
  "cx-checkbox": CxCheckbox,
12071
12276
  "cx-content-browser-asset-preview": CxContentBrowserAssetPreview,
@@ -12074,46 +12279,58 @@ CxContentBrowserAssetCard.dependencies = {
12074
12279
  "cx-tag": CxTag,
12075
12280
  "cx-typography": CxTypography
12076
12281
  };
12077
- __decorateClass$4([
12282
+ __decorateClass$5([
12283
+ n$6({ attribute: "show-cta", reflect: true, type: Boolean })
12284
+ ], CxContentBrowserAssetCard.prototype, "showCta", 2);
12285
+ __decorateClass$5([
12286
+ n$6({ attribute: "cta-text", reflect: false, type: String })
12287
+ ], CxContentBrowserAssetCard.prototype, "ctaText", 2);
12288
+ __decorateClass$5([
12289
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
12290
+ ], CxContentBrowserAssetCard.prototype, "ctaTextTransform", 2);
12291
+ __decorateClass$5([
12292
+ n$6({ attribute: "busy", reflect: true, type: Boolean })
12293
+ ], CxContentBrowserAssetCard.prototype, "busy", 2);
12294
+ __decorateClass$5([
12078
12295
  n$6({ attribute: "image-url", reflect: true, type: String })
12079
12296
  ], CxContentBrowserAssetCard.prototype, "imageUrl", 2);
12080
- __decorateClass$4([
12297
+ __decorateClass$5([
12081
12298
  n$6({ attribute: "original-url", reflect: true, type: String })
12082
12299
  ], CxContentBrowserAssetCard.prototype, "originalUrl", 2);
12083
- __decorateClass$4([
12300
+ __decorateClass$5([
12084
12301
  n$6({ attribute: "scrub-url", reflect: true, type: String })
12085
12302
  ], CxContentBrowserAssetCard.prototype, "scrubUrl", 2);
12086
- __decorateClass$4([
12303
+ __decorateClass$5([
12087
12304
  n$6({ attribute: "asset-id", reflect: true, type: String })
12088
12305
  ], CxContentBrowserAssetCard.prototype, "assetId", 2);
12089
- __decorateClass$4([
12306
+ __decorateClass$5([
12090
12307
  n$6({ attribute: "asset-name", reflect: true, type: String })
12091
12308
  ], CxContentBrowserAssetCard.prototype, "assetName", 2);
12092
- __decorateClass$4([
12309
+ __decorateClass$5([
12093
12310
  n$6({ attribute: "asset-width", reflect: true, type: String })
12094
12311
  ], CxContentBrowserAssetCard.prototype, "assetWidth", 2);
12095
- __decorateClass$4([
12312
+ __decorateClass$5([
12096
12313
  n$6({ attribute: "asset-height", reflect: true, type: String })
12097
12314
  ], CxContentBrowserAssetCard.prototype, "assetHeight", 2);
12098
- __decorateClass$4([
12315
+ __decorateClass$5([
12099
12316
  n$6({ attribute: "asset-size", reflect: true, type: String })
12100
12317
  ], CxContentBrowserAssetCard.prototype, "assetSize", 2);
12101
- __decorateClass$4([
12318
+ __decorateClass$5([
12102
12319
  n$6({ attribute: "extension", reflect: true, type: String })
12103
12320
  ], CxContentBrowserAssetCard.prototype, "extension", 2);
12104
- __decorateClass$4([
12321
+ __decorateClass$5([
12105
12322
  n$6({ attribute: "in-cold-storage", reflect: true, type: Boolean })
12106
12323
  ], CxContentBrowserAssetCard.prototype, "inColdStorage", 2);
12107
- __decorateClass$4([
12324
+ __decorateClass$5([
12108
12325
  n$6({ attribute: "doc-type", reflect: true, type: String })
12109
12326
  ], CxContentBrowserAssetCard.prototype, "docType", 2);
12110
- __decorateClass$4([
12327
+ __decorateClass$5([
12111
12328
  n$6({ attribute: "view", reflect: true, type: String })
12112
12329
  ], CxContentBrowserAssetCard.prototype, "view", 2);
12113
- __decorateClass$4([
12330
+ __decorateClass$5([
12114
12331
  n$6({ attribute: "selected", reflect: true, type: Boolean })
12115
12332
  ], CxContentBrowserAssetCard.prototype, "selected", 2);
12116
- __decorateClass$4([
12333
+ __decorateClass$5([
12117
12334
  n$6({
12118
12335
  converter: {
12119
12336
  fromAttribute: (value) => value ? value.split(",").map((tag) => tag.trim()).filter(Boolean) : [],
@@ -12128,25 +12345,25 @@ __decorateClass$4([
12128
12345
  type: String
12129
12346
  })
12130
12347
  ], CxContentBrowserAssetCard.prototype, "tags", 2);
12131
- __decorateClass$4([
12348
+ __decorateClass$5([
12132
12349
  n$6({ attribute: "show-tags", reflect: true, type: Boolean })
12133
12350
  ], CxContentBrowserAssetCard.prototype, "showTags", 2);
12134
- __decorateClass$4([
12351
+ __decorateClass$5([
12135
12352
  n$6({ attribute: "show-title", reflect: true, type: Boolean })
12136
12353
  ], CxContentBrowserAssetCard.prototype, "showTitle", 2);
12137
- __decorateClass$4([
12354
+ __decorateClass$5([
12138
12355
  n$6({ attribute: "show-size", reflect: true, type: Boolean })
12139
12356
  ], CxContentBrowserAssetCard.prototype, "showSize", 2);
12140
- __decorateClass$4([
12357
+ __decorateClass$5([
12141
12358
  n$6({ attribute: "show-dimensions", reflect: true, type: Boolean })
12142
12359
  ], CxContentBrowserAssetCard.prototype, "showDimensions", 2);
12143
- __decorateClass$4([
12360
+ __decorateClass$5([
12144
12361
  e$7("cx-content-browser-asset-preview")
12145
12362
  ], CxContentBrowserAssetCard.prototype, "preview", 2);
12146
- CxContentBrowserAssetCard = __decorateClass$4([
12363
+ CxContentBrowserAssetCard = __decorateClass$5([
12147
12364
  customElement("cx-content-browser-asset-card")
12148
12365
  ], CxContentBrowserAssetCard);
12149
- const styles$3 = i$7`
12366
+ const styles$4 = i$7`
12150
12367
  :host {
12151
12368
  display: flex;
12152
12369
  align-items: center;
@@ -12171,14 +12388,14 @@ const styles$3 = i$7`
12171
12388
  font-size: 96px;
12172
12389
  }
12173
12390
  `;
12174
- var __defProp$3 = Object.defineProperty;
12175
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
12176
- var __decorateClass$3 = (decorators, target, key, kind) => {
12177
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
12391
+ var __defProp$4 = Object.defineProperty;
12392
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
12393
+ var __decorateClass$4 = (decorators, target, key, kind) => {
12394
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
12178
12395
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12179
12396
  if (decorator = decorators[i4])
12180
12397
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12181
- if (kind && result) __defProp$3(target, key, result);
12398
+ if (kind && result) __defProp$4(target, key, result);
12182
12399
  return result;
12183
12400
  };
12184
12401
  let CxContentBrowserNoResult = class extends CortexElement {
@@ -12197,17 +12414,17 @@ let CxContentBrowserNoResult = class extends CortexElement {
12197
12414
  `;
12198
12415
  }
12199
12416
  };
12200
- CxContentBrowserNoResult.styles = [componentStyles, styles$3];
12417
+ CxContentBrowserNoResult.styles = [componentStyles, styles$4];
12201
12418
  CxContentBrowserNoResult.dependencies = {
12202
12419
  "cx-icon": CxIcon
12203
12420
  };
12204
- __decorateClass$3([
12421
+ __decorateClass$4([
12205
12422
  n$6({ attribute: "icon", type: String })
12206
12423
  ], CxContentBrowserNoResult.prototype, "icon", 2);
12207
- __decorateClass$3([
12424
+ __decorateClass$4([
12208
12425
  n$6({ attribute: "message", type: String })
12209
12426
  ], CxContentBrowserNoResult.prototype, "message", 2);
12210
- CxContentBrowserNoResult = __decorateClass$3([
12427
+ CxContentBrowserNoResult = __decorateClass$4([
12211
12428
  customElement("cx-content-browser-no-result")
12212
12429
  ], CxContentBrowserNoResult);
12213
12430
  class ScrollAnchorController {
@@ -12259,8 +12476,8 @@ class ScrollAnchorController {
12259
12476
  this.cancelPendingRestore();
12260
12477
  const sequence = ++__privateWrapper(this, _restoreSequence)._;
12261
12478
  void __privateGet(this, _host).updateComplete.then(() => __async(this, null, function* () {
12262
- var _a2;
12263
- yield (_a2 = __privateGet(this, _getContainer).call(this)) == null ? void 0 : _a2.layoutComplete;
12479
+ var _a2, _b2;
12480
+ yield (_b2 = (_a2 = __privateGet(this, _getContainer).call(this)) == null ? void 0 : _a2.layoutComplete) == null ? void 0 : _b2.catch(() => void 0);
12264
12481
  if (sequence !== __privateGet(this, _restoreSequence)) {
12265
12482
  return;
12266
12483
  }
@@ -12337,7 +12554,7 @@ _columnCount = new WeakMap();
12337
12554
  _itemHeight = new WeakMap();
12338
12555
  _pendingRestoreFrames = new WeakMap();
12339
12556
  _restoreSequence = new WeakMap();
12340
- const styles$2 = i$7`
12557
+ const styles$3 = i$7`
12341
12558
  :host {
12342
12559
  display: block;
12343
12560
  flex: 1;
@@ -12379,24 +12596,24 @@ const styles$2 = i$7`
12379
12596
  --height: 4px;
12380
12597
  }
12381
12598
  `;
12382
- var __defProp$2 = Object.defineProperty;
12383
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
12384
- var __typeError2 = (msg) => {
12599
+ var __defProp$3 = Object.defineProperty;
12600
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
12601
+ var __typeError$2 = (msg) => {
12385
12602
  throw TypeError(msg);
12386
12603
  };
12387
- var __decorateClass$2 = (decorators, target, key, kind) => {
12388
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
12604
+ var __decorateClass$3 = (decorators, target, key, kind) => {
12605
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
12389
12606
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12390
12607
  if (decorator = decorators[i4])
12391
12608
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12392
- if (kind && result) __defProp$2(target, key, result);
12609
+ if (kind && result) __defProp$3(target, key, result);
12393
12610
  return result;
12394
12611
  };
12395
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
12396
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
12397
- var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
12398
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
12399
- var _gutter, _lastHeight, _lastWidth;
12612
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
12613
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
12614
+ var __privateAdd$2 = (obj, member, value) => member.has(obj) ? __typeError$2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
12615
+ var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
12616
+ var _gutter, _lastHeight$1, _lastWidth;
12400
12617
  let CxContentBrowserGrid = class extends CortexElement {
12401
12618
  constructor() {
12402
12619
  super();
@@ -12411,12 +12628,16 @@ let CxContentBrowserGrid = class extends CortexElement {
12411
12628
  this.showSize = true;
12412
12629
  this.showDimensions = true;
12413
12630
  this.showTags = false;
12631
+ this.showCta = false;
12632
+ this.ctaText = "";
12633
+ this.ctaTextTransform = "capitalize";
12634
+ this.busyAssetId = void 0;
12414
12635
  this.selectedAssetId = void 0;
12415
12636
  this.assetMap = /* @__PURE__ */ new Map();
12416
12637
  this.columnWidth = 0;
12417
- __privateAdd2(this, _gutter, 8);
12418
- __privateAdd2(this, _lastHeight, 0);
12419
- __privateAdd2(this, _lastWidth, 0);
12638
+ __privateAdd$2(this, _gutter, 8);
12639
+ __privateAdd$2(this, _lastHeight$1, 0);
12640
+ __privateAdd$2(this, _lastWidth, 0);
12420
12641
  this.scrollAnchorController = new ScrollAnchorController(this, {
12421
12642
  getContainer: () => this.virtualizerEl,
12422
12643
  getItemIndexById: (id) => this.assets.findIndex((asset) => asset.id === id),
@@ -12429,7 +12650,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12429
12650
  }
12430
12651
  handleViewChange() {
12431
12652
  this.scrollAnchorController.capture();
12432
- this.calculatePageSize(__privateGet2(this, _lastWidth), __privateGet2(this, _lastHeight), true);
12653
+ this.calculatePageSize(__privateGet$2(this, _lastWidth), __privateGet$2(this, _lastHeight$1), true);
12433
12654
  }
12434
12655
  handleAssetsChange() {
12435
12656
  this.assetMap.clear();
@@ -12447,17 +12668,17 @@ let CxContentBrowserGrid = class extends CortexElement {
12447
12668
  this.debouncedCalculatePageSize(width, height);
12448
12669
  }
12449
12670
  calculatePageSize(width, height, force = false) {
12450
- const lastHeight = __privateGet2(this, _lastHeight);
12451
- const lastWidth = __privateGet2(this, _lastWidth);
12671
+ const lastHeight = __privateGet$2(this, _lastHeight$1);
12672
+ const lastWidth = __privateGet$2(this, _lastWidth);
12452
12673
  if (!force && Math.abs(lastHeight - height) < 10 && Math.abs(lastWidth - width) < 10) {
12453
12674
  return;
12454
12675
  }
12455
- __privateSet2(this, _lastHeight, height);
12456
- __privateSet2(this, _lastWidth, width);
12676
+ __privateSet$2(this, _lastHeight$1, height);
12677
+ __privateSet$2(this, _lastWidth, width);
12457
12678
  const { columnCount, rowCount } = this.calculateColumnCount(width, height);
12458
12679
  this.scrollAnchorController.setLayoutMetrics({
12459
12680
  columnCount,
12460
- itemHeight: Math.max(this.columnWidth, 150) + __privateGet2(this, _gutter)
12681
+ itemHeight: Math.max(this.columnWidth, 150) + __privateGet$2(this, _gutter)
12461
12682
  });
12462
12683
  this.emit("cx-content-browser-grid-resize", {
12463
12684
  detail: {
@@ -12477,12 +12698,12 @@ let CxContentBrowserGrid = class extends CortexElement {
12477
12698
  }
12478
12699
  const effectiveWidth = ((_a2 = this.virtualizerEl) == null ? void 0 : _a2.clientWidth) || width;
12479
12700
  const breakPoint = ((_b2 = ASSET_SIZE[this.view]) == null ? void 0 : _b2.minWidth) || ASSET_SIZE[GridView$1.Large].minWidth;
12480
- const columnCount = Math.max(1, Math.floor((effectiveWidth + __privateGet2(this, _gutter)) / (breakPoint + __privateGet2(this, _gutter))));
12701
+ const columnCount = Math.max(1, Math.floor((effectiveWidth + __privateGet$2(this, _gutter)) / (breakPoint + __privateGet$2(this, _gutter))));
12481
12702
  let rowCount = 0;
12482
12703
  if (height) {
12483
- rowCount = Math.ceil(height / (breakPoint + __privateGet2(this, _gutter)));
12704
+ rowCount = Math.ceil(height / (breakPoint + __privateGet$2(this, _gutter)));
12484
12705
  }
12485
- const newColumnWidth = Math.floor((effectiveWidth - __privateGet2(this, _gutter) * (columnCount + 1)) / columnCount);
12706
+ const newColumnWidth = Math.floor((effectiveWidth - __privateGet$2(this, _gutter) * (columnCount + 1)) / columnCount);
12486
12707
  if (newColumnWidth !== this.columnWidth) {
12487
12708
  this.columnWidth = newColumnWidth;
12488
12709
  }
@@ -12526,6 +12747,10 @@ let CxContentBrowserGrid = class extends CortexElement {
12526
12747
  ?show-size=${this.showSize}
12527
12748
  ?show-dimensions=${this.showDimensions}
12528
12749
  ?show-tags=${this.showTags}
12750
+ ?show-cta=${this.showCta}
12751
+ ?busy=${asset.id === this.busyAssetId}
12752
+ cta-text=${this.ctaText}
12753
+ cta-text-transform=${this.ctaTextTransform}
12529
12754
  ?in-cold-storage=${asset.inColdStorage}
12530
12755
  @click=${this.handleClick}
12531
12756
  ></cx-content-browser-asset-card>
@@ -12580,7 +12805,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12580
12805
  class="content-browser-grid__list"
12581
12806
  scroller
12582
12807
  .layout=${grid({
12583
- gap: `${__privateGet2(this, _gutter)}px`,
12808
+ gap: `${__privateGet$2(this, _gutter)}px`,
12584
12809
  itemSize: {
12585
12810
  height: `${Math.max(this.columnWidth, 150)}px`,
12586
12811
  width: `${this.columnWidth}px`
@@ -12606,7 +12831,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12606
12831
  class="content-browser-grid-loading"
12607
12832
  style=${o$2({
12608
12833
  opacity: this.loading ? 1 : 0,
12609
- padding: `0 ${__privateGet2(this, _gutter) * 2}px ${__privateGet2(this, _gutter)}px`
12834
+ padding: `0 ${__privateGet$2(this, _gutter) * 2}px ${__privateGet$2(this, _gutter)}px`
12610
12835
  })}
12611
12836
  >
12612
12837
  <cx-progress-bar indeterminate></cx-progress-bar>
@@ -12620,9 +12845,9 @@ let CxContentBrowserGrid = class extends CortexElement {
12620
12845
  }
12621
12846
  };
12622
12847
  _gutter = /* @__PURE__ */ new WeakMap();
12623
- _lastHeight = /* @__PURE__ */ new WeakMap();
12848
+ _lastHeight$1 = /* @__PURE__ */ new WeakMap();
12624
12849
  _lastWidth = /* @__PURE__ */ new WeakMap();
12625
- CxContentBrowserGrid.styles = [componentStyles, styles$2];
12850
+ CxContentBrowserGrid.styles = [componentStyles, styles$3];
12626
12851
  CxContentBrowserGrid.dependencies = {
12627
12852
  "cx-button": CxButton,
12628
12853
  "cx-content-browser-asset-card": CxContentBrowserAssetCard,
@@ -12631,61 +12856,73 @@ CxContentBrowserGrid.dependencies = {
12631
12856
  "cx-progress-bar": CxProgressBar,
12632
12857
  "cx-resize-observer": CxResizeObserver
12633
12858
  };
12634
- __decorateClass$2([
12859
+ __decorateClass$3([
12635
12860
  e$7(".content-browser-grid")
12636
12861
  ], CxContentBrowserGrid.prototype, "containerEl", 2);
12637
- __decorateClass$2([
12862
+ __decorateClass$3([
12638
12863
  e$7("lit-virtualizer")
12639
12864
  ], CxContentBrowserGrid.prototype, "virtualizerEl", 2);
12640
- __decorateClass$2([
12865
+ __decorateClass$3([
12641
12866
  n$6({ attribute: "assets", reflect: false, type: Array })
12642
12867
  ], CxContentBrowserGrid.prototype, "assets", 2);
12643
- __decorateClass$2([
12868
+ __decorateClass$3([
12644
12869
  n$6({ attribute: "empty", reflect: true, type: Boolean })
12645
12870
  ], CxContentBrowserGrid.prototype, "empty", 2);
12646
- __decorateClass$2([
12871
+ __decorateClass$3([
12647
12872
  n$6({ attribute: "error", reflect: true, type: Boolean })
12648
12873
  ], CxContentBrowserGrid.prototype, "error", 2);
12649
- __decorateClass$2([
12874
+ __decorateClass$3([
12650
12875
  n$6({ attribute: "view", reflect: true, type: String })
12651
12876
  ], CxContentBrowserGrid.prototype, "view", 2);
12652
- __decorateClass$2([
12877
+ __decorateClass$3([
12653
12878
  n$6({ attribute: "has-more", reflect: true, type: Boolean })
12654
12879
  ], CxContentBrowserGrid.prototype, "hasMore", 2);
12655
- __decorateClass$2([
12880
+ __decorateClass$3([
12656
12881
  n$6({ attribute: "loading", reflect: true, type: Boolean })
12657
12882
  ], CxContentBrowserGrid.prototype, "loading", 2);
12658
- __decorateClass$2([
12883
+ __decorateClass$3([
12659
12884
  n$6({ attribute: "show-title", reflect: true, type: Boolean })
12660
12885
  ], CxContentBrowserGrid.prototype, "showTitle", 2);
12661
- __decorateClass$2([
12886
+ __decorateClass$3([
12662
12887
  n$6({ attribute: "show-size", reflect: true, type: Boolean })
12663
12888
  ], CxContentBrowserGrid.prototype, "showSize", 2);
12664
- __decorateClass$2([
12889
+ __decorateClass$3([
12665
12890
  n$6({ attribute: "show-dimensions", reflect: true, type: Boolean })
12666
12891
  ], CxContentBrowserGrid.prototype, "showDimensions", 2);
12667
- __decorateClass$2([
12892
+ __decorateClass$3([
12668
12893
  n$6({ attribute: "show-tags", reflect: true, type: Boolean })
12669
12894
  ], CxContentBrowserGrid.prototype, "showTags", 2);
12670
- __decorateClass$2([
12895
+ __decorateClass$3([
12896
+ n$6({ attribute: "show-cta", reflect: true, type: Boolean })
12897
+ ], CxContentBrowserGrid.prototype, "showCta", 2);
12898
+ __decorateClass$3([
12899
+ n$6({ attribute: "cta-text", reflect: false, type: String })
12900
+ ], CxContentBrowserGrid.prototype, "ctaText", 2);
12901
+ __decorateClass$3([
12902
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
12903
+ ], CxContentBrowserGrid.prototype, "ctaTextTransform", 2);
12904
+ __decorateClass$3([
12905
+ n$6({ attribute: false })
12906
+ ], CxContentBrowserGrid.prototype, "busyAssetId", 2);
12907
+ __decorateClass$3([
12671
12908
  n$6({ attribute: "selected-asset-id", reflect: true, type: String })
12672
12909
  ], CxContentBrowserGrid.prototype, "selectedAssetId", 2);
12673
- __decorateClass$2([
12910
+ __decorateClass$3([
12674
12911
  r$6()
12675
12912
  ], CxContentBrowserGrid.prototype, "assetMap", 2);
12676
- __decorateClass$2([
12913
+ __decorateClass$3([
12677
12914
  r$6()
12678
12915
  ], CxContentBrowserGrid.prototype, "columnWidth", 2);
12679
- __decorateClass$2([
12916
+ __decorateClass$3([
12680
12917
  watch("view", { waitUntilFirstUpdate: true })
12681
12918
  ], CxContentBrowserGrid.prototype, "handleViewChange", 1);
12682
- __decorateClass$2([
12919
+ __decorateClass$3([
12683
12920
  watch("assets")
12684
12921
  ], CxContentBrowserGrid.prototype, "handleAssetsChange", 1);
12685
- CxContentBrowserGrid = __decorateClass$2([
12922
+ CxContentBrowserGrid = __decorateClass$3([
12686
12923
  customElement("cx-content-browser-grid")
12687
12924
  ], CxContentBrowserGrid);
12688
- const styles$1 = i$7`
12925
+ const styles$2 = i$7`
12689
12926
  :host {
12690
12927
  display: block;
12691
12928
  }
@@ -12744,14 +12981,14 @@ const styles$1 = i$7`
12744
12981
  cursor: default;
12745
12982
  }
12746
12983
  `;
12747
- var __defProp$1 = Object.defineProperty;
12748
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
12749
- var __decorateClass$1 = (decorators, target, key, kind) => {
12750
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
12984
+ var __defProp$2 = Object.defineProperty;
12985
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
12986
+ var __decorateClass$2 = (decorators, target, key, kind) => {
12987
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
12751
12988
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12752
12989
  if (decorator = decorators[i4])
12753
12990
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12754
- if (kind && result) __defProp$1(target, key, result);
12991
+ if (kind && result) __defProp$2(target, key, result);
12755
12992
  return result;
12756
12993
  };
12757
12994
  const LOGOUT_ITEM_VALUE = "logout";
@@ -12884,7 +13121,7 @@ let CxContentBrowserHeader = class extends CortexElement {
12884
13121
  `;
12885
13122
  }
12886
13123
  };
12887
- CxContentBrowserHeader.styles = [componentStyles, styles$1];
13124
+ CxContentBrowserHeader.styles = [componentStyles, styles$2];
12888
13125
  CxContentBrowserHeader.dependencies = {
12889
13126
  "cx-avatar": CxAvatar,
12890
13127
  "cx-divider": CxDivider,
@@ -12898,36 +13135,1359 @@ CxContentBrowserHeader.dependencies = {
12898
13135
  "cx-space": CxSpace,
12899
13136
  "cx-typography": CxTypography
12900
13137
  };
12901
- __decorateClass$1([
13138
+ __decorateClass$2([
12902
13139
  n$6({ type: Boolean })
12903
13140
  ], CxContentBrowserHeader.prototype, "bordered", 2);
12904
- __decorateClass$1([
13141
+ __decorateClass$2([
12905
13142
  n$6({ attribute: "application-name", type: String })
12906
13143
  ], CxContentBrowserHeader.prototype, "applicationName", 2);
12907
- __decorateClass$1([
13144
+ __decorateClass$2([
12908
13145
  n$6({ type: Boolean })
12909
13146
  ], CxContentBrowserHeader.prototype, "loading", 2);
12910
- __decorateClass$1([
13147
+ __decorateClass$2([
12911
13148
  n$6({ attribute: "is-fetching", type: Boolean })
12912
13149
  ], CxContentBrowserHeader.prototype, "isFetching", 2);
12913
- __decorateClass$1([
13150
+ __decorateClass$2([
12914
13151
  n$6({ attribute: "avatar", type: String })
12915
13152
  ], CxContentBrowserHeader.prototype, "avatar", 2);
12916
- __decorateClass$1([
13153
+ __decorateClass$2([
12917
13154
  n$6({ attribute: "full-name", type: String })
12918
13155
  ], CxContentBrowserHeader.prototype, "fullName", 2);
12919
- __decorateClass$1([
13156
+ __decorateClass$2([
12920
13157
  n$6({ attribute: "folder-title", type: String })
12921
13158
  ], CxContentBrowserHeader.prototype, "folderTitle", 2);
12922
- __decorateClass$1([
13159
+ __decorateClass$2([
12923
13160
  n$6({ attribute: "show-close-button", type: Boolean })
12924
13161
  ], CxContentBrowserHeader.prototype, "showCloseButton", 2);
12925
- __decorateClass$1([
13162
+ __decorateClass$2([
12926
13163
  n$6({ attribute: "can-logout", type: Boolean })
12927
13164
  ], CxContentBrowserHeader.prototype, "canLogout", 2);
12928
- CxContentBrowserHeader = __decorateClass$1([
13165
+ CxContentBrowserHeader = __decorateClass$2([
12929
13166
  customElement("cx-content-browser-header")
12930
13167
  ], CxContentBrowserHeader);
13168
+ const MIN_COLUMN_WIDTH = 92;
13169
+ let canvasContext = null;
13170
+ function measureTextWidth(text, font) {
13171
+ canvasContext != null ? canvasContext : canvasContext = document.createElement("canvas").getContext("2d");
13172
+ if (!canvasContext) {
13173
+ return 0;
13174
+ }
13175
+ canvasContext.font = font;
13176
+ return Math.ceil(canvasContext.measureText(text).width);
13177
+ }
13178
+ function fillSpareWidth(widths, columns, available) {
13179
+ const autoFit = columns.flatMap(({ saved }, index) => saved === void 0 ? [index] : []);
13180
+ const spare = available - widths.reduce((sum, width) => sum + width, 0);
13181
+ if (autoFit.length === 0 || spare <= 0) {
13182
+ return;
13183
+ }
13184
+ const part = Math.floor(spare / autoFit.length);
13185
+ autoFit.forEach((index) => {
13186
+ widths[index] += part;
13187
+ });
13188
+ widths[autoFit[autoFit.length - 1]] += spare - part * autoFit.length;
13189
+ }
13190
+ function layoutColumnWidths(columns, available) {
13191
+ const widths = columns.map(({ saved }) => saved === void 0 ? 0 : Math.max(MIN_COLUMN_WIDTH, Math.round(saved)));
13192
+ let left = available - widths.reduce((sum, width) => sum + width, 0);
13193
+ let open = columns.flatMap(({ saved }, index) => saved === void 0 ? [index] : []);
13194
+ const natural = (index) => Math.max(MIN_COLUMN_WIDTH, Math.ceil(columns[index].natural));
13195
+ let fitCount = 1;
13196
+ while (fitCount > 0 && open.length > 0) {
13197
+ const share = left / open.length;
13198
+ const fits = open.filter((index) => natural(index) <= share);
13199
+ for (const index of fits) {
13200
+ widths[index] = natural(index);
13201
+ left -= widths[index];
13202
+ }
13203
+ open = open.filter((index) => !fits.includes(index));
13204
+ fitCount = fits.length;
13205
+ }
13206
+ open.forEach((index) => {
13207
+ widths[index] = Math.max(MIN_COLUMN_WIDTH, Math.floor(left / open.length));
13208
+ });
13209
+ fillSpareWidth(widths, columns, available);
13210
+ return widths;
13211
+ }
13212
+ const styles$1 = i$7`
13213
+ /* Containing block for the absolutely positioned loading bar, which is a direct child. */
13214
+ :host {
13215
+ position: relative;
13216
+ display: flex;
13217
+ flex-direction: column;
13218
+ flex: 1;
13219
+ box-sizing: border-box;
13220
+ /*
13221
+ * A multi-line flex parent stretches an item to its own flex line's cross size rather than to
13222
+ * the container's width, and a row parent's automatic minimum refuses to shrink below content.
13223
+ * A definite width and a zero minimum keep a wide table scrolling inside the picker instead of
13224
+ * widening it (L-429EVG).
13225
+ */
13226
+ width: 100%;
13227
+ min-width: 0;
13228
+ min-height: 0;
13229
+ /*
13230
+ * The gap under the control bar belongs to the table, not to the shared cx-space above it, which
13231
+ * spaces the grid too. Fallback because an unthemed host resolves the token to nothing.
13232
+ */
13233
+ padding-top: var(--cx-spacing-medium, 16px);
13234
+ }
13235
+
13236
+ /*
13237
+ * The table is positioned out of flow, so the rows can never size this box: its height comes from
13238
+ * the container alone, in every host shape. A host slot that takes its height from a flex line
13239
+ * cannot be shorter than the height its contents report, and a table in flow reports every row it
13240
+ * holds, which paints the picker over the page below (L-42BBKC) and makes a row count read off it
13241
+ * grow with each page (L-42BFJC). The floor is the grid's own (lit-virtualizer's scroller
13242
+ * minimum), so a host that gives the picker no height gets a short table that scrolls, never one
13243
+ * that collapses to nothing.
13244
+ */
13245
+ .content-browser-table {
13246
+ position: relative;
13247
+ flex: 1 1 auto;
13248
+ min-height: 150px;
13249
+ }
13250
+
13251
+ .content-browser-table__table {
13252
+ --table-height: 100%;
13253
+ --content-browser-action-boundary: 100%;
13254
+
13255
+ position: absolute;
13256
+ inset: 0;
13257
+ }
13258
+
13259
+ :host([row-action-position='row-end']) .content-browser-table__table {
13260
+ --content-browser-action-boundary: var(--content-browser-table-width);
13261
+ }
13262
+
13263
+ .content-browser-table__table::part(content-browser-header),
13264
+ .content-browser-table__table::part(content-browser-frame)::before {
13265
+ box-sizing: border-box;
13266
+ width: min(100%, var(--content-browser-table-width, 100%));
13267
+ }
13268
+
13269
+ .content-browser-table__table::part(content-browser-header) {
13270
+ background-color: var(--header-background-color, var(--cx-color-neutral-50));
13271
+ border-top-left-radius: var(--border-radius);
13272
+ border-top-right-radius: var(--border-radius);
13273
+ }
13274
+
13275
+ .content-browser-table__table::part(content-browser-scrollport) {
13276
+ scrollbar-width: thin;
13277
+ }
13278
+
13279
+ .content-browser-table__table::part(content-browser-row) {
13280
+ min-width: 100%;
13281
+ }
13282
+
13283
+ /* The zero-width anchor follows the viewport edge without space in the column layout. */
13284
+ .content-browser-table__table::part(content-browser-action-anchor) {
13285
+ position: sticky;
13286
+ right: 0;
13287
+ width: 0;
13288
+ min-width: 0;
13289
+ flex: 0 0 0;
13290
+ margin-left: auto;
13291
+ margin-right: max(0px, calc(100% - var(--content-browser-action-boundary)));
13292
+ align-self: stretch;
13293
+ background-color: inherit;
13294
+ /* The frame can cross the action after a small shrink. Keep its border below the button. */
13295
+ z-index: 2;
13296
+ }
13297
+
13298
+ .content-browser-table__table::part(content-browser-action) {
13299
+ position: absolute;
13300
+ inset: 0 0 0 auto;
13301
+ box-sizing: border-box;
13302
+ display: flex;
13303
+ align-items: center;
13304
+ padding: 0 var(--cell-padding-right, 8px) 0 var(--cell-padding-left, 8px);
13305
+ background-color: inherit;
13306
+ /* Leave the data-cell separator visible without a line across empty space. */
13307
+ background-clip: padding-box;
13308
+ border-bottom: var(--border-width, 1px) solid transparent;
13309
+ border-right: var(--border-width, 1px) solid transparent;
13310
+ }
13311
+
13312
+ .content-browser-table-loading {
13313
+ position: absolute;
13314
+ top: 0;
13315
+ width: 100%;
13316
+ z-index: var(--cx-z-index-drawer);
13317
+ }
13318
+
13319
+ .content-browser-table-loading cx-progress-bar {
13320
+ --height: 4px;
13321
+ }
13322
+
13323
+ .content-browser-table__empty {
13324
+ height: 100%;
13325
+ }
13326
+
13327
+ .content-browser-table__page-error {
13328
+ flex: none;
13329
+ display: flex;
13330
+ align-items: center;
13331
+ justify-content: center;
13332
+ gap: var(--cx-spacing-small, 8px);
13333
+ padding: var(--cx-spacing-small, 8px);
13334
+ border-top: 1px solid var(--cx-color-neutral-200, #e5e5e5);
13335
+ background-color: var(--cx-color-neutral-0, #fff);
13336
+ color: var(--cx-color-neutral);
13337
+ }
13338
+ `;
13339
+ var __defProp$1 = Object.defineProperty;
13340
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13341
+ var __typeError$1 = (msg) => {
13342
+ throw TypeError(msg);
13343
+ };
13344
+ var __decorateClass$1 = (decorators, target, key, kind) => {
13345
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13346
+ for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
13347
+ if (decorator = decorators[i4])
13348
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13349
+ if (kind && result) __defProp$1(target, key, result);
13350
+ return result;
13351
+ };
13352
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
13353
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
13354
+ var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
13355
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
13356
+ var _columnDefinitions, _columnsSignature, _columnKeys, _rowsNeedRebuild, _heldRowKeys, _resizedWidths, _sessionWidths, _ctas, _renderedCtas, _pointerTrackedRows, _hoveredRow, _focusedCta, _ctaFocusedAtRender, _noHoverQueries, _hasNoHover, _builtTable, _syncedAssets, _pendingReplaces, _lastHeight, _containerSize, _lastRowCount, _rowCountHeld, _lastRowObserver, _layoutScrollbarWidth, _naturalWidths, _layoutPending, _fontsPending, _frameWidthObserver;
13357
+ const CxTable = CxColorSwatchGroup.dependencies["cx-table"];
13358
+ const ROW_HEIGHT = 48;
13359
+ const FILLER_FIELD = "filler";
13360
+ const RESIZE_BUFFER_WIDTH = 6;
13361
+ const NO_HOVER_QUERIES = ["(hover: none)"];
13362
+ const COLUMN_DEFAULTS = {
13363
+ headerSort: false,
13364
+ resizable: true
13365
+ };
13366
+ function canvasFont(element) {
13367
+ const { fontFamily, fontSize, fontStyle, fontWeight } = getComputedStyle(element);
13368
+ return `${fontStyle} ${fontWeight} ${fontSize} ${fontFamily}`;
13369
+ }
13370
+ function horizontalPadding(element) {
13371
+ const style = getComputedStyle(element);
13372
+ return (Number.parseFloat(style.paddingLeft) || 0) + (Number.parseFloat(style.paddingRight) || 0) + (Number.parseFloat(style.borderLeftWidth) || 0) + (Number.parseFloat(style.borderRightWidth) || 0);
13373
+ }
13374
+ function unroundedClientWidth(element) {
13375
+ const style = getComputedStyle(element);
13376
+ const width = Number.parseFloat(style.width) || 0;
13377
+ if (style.boxSizing === "border-box") {
13378
+ return width - (Number.parseFloat(style.borderLeftWidth) || 0) - (Number.parseFloat(style.borderRightWidth) || 0);
13379
+ }
13380
+ return width + (Number.parseFloat(style.paddingLeft) || 0) + (Number.parseFloat(style.paddingRight) || 0);
13381
+ }
13382
+ function readCellValue(asset, field) {
13383
+ if (!Object.prototype.hasOwnProperty.call(asset, field)) {
13384
+ return "";
13385
+ }
13386
+ const value = asset[field];
13387
+ if (value === void 0 || value === null || typeof value === "object") {
13388
+ return "";
13389
+ }
13390
+ return String(value);
13391
+ }
13392
+ function columnsSignature(columns) {
13393
+ return JSON.stringify(columns.map(({ field, title }) => [field, title]));
13394
+ }
13395
+ function isAppendOf(previous, next2) {
13396
+ return previous.length > 0 && next2.length > previous.length && previous.every((asset, index) => next2[index] === asset);
13397
+ }
13398
+ function renderCellContent(value, inColdStorage) {
13399
+ const content = document.createElement("cx-line-clamp");
13400
+ content.setAttribute("lines", "1");
13401
+ if (value) {
13402
+ content.title = value;
13403
+ }
13404
+ if (inColdStorage) {
13405
+ content.style.opacity = "0.5";
13406
+ }
13407
+ content.textContent = value;
13408
+ return content;
13409
+ }
13410
+ let CxContentBrowserTable = class extends CortexElement {
13411
+ constructor() {
13412
+ super(...arguments);
13413
+ this.localize = new LocalizeController(this);
13414
+ this.assets = [];
13415
+ this.columns = [];
13416
+ this.ctaText = "";
13417
+ this.ctaTextTransform = "capitalize";
13418
+ this.empty = false;
13419
+ this.error = false;
13420
+ this.hasMore = false;
13421
+ this.loading = false;
13422
+ this.selectedAssetId = void 0;
13423
+ this.busyAssetId = void 0;
13424
+ this.hiddenFields = [];
13425
+ this.savedWidths = {};
13426
+ this.widthScope = void 0;
13427
+ this.rowActionPosition = "host-edge";
13428
+ this.assetMap = /* @__PURE__ */ new Map();
13429
+ __privateAdd$1(this, _columnDefinitions, []);
13430
+ __privateAdd$1(this, _columnsSignature, "");
13431
+ __privateAdd$1(this, _columnKeys, /* @__PURE__ */ new Map());
13432
+ __privateAdd$1(this, _rowsNeedRebuild, false);
13433
+ __privateAdd$1(this, _heldRowKeys, /* @__PURE__ */ new Set());
13434
+ __privateAdd$1(this, _resizedWidths, /* @__PURE__ */ new Map());
13435
+ __privateAdd$1(this, _sessionWidths, /* @__PURE__ */ new Map());
13436
+ __privateAdd$1(this, _ctas, /* @__PURE__ */ new WeakMap());
13437
+ __privateAdd$1(this, _renderedCtas, /* @__PURE__ */ new Set());
13438
+ __privateAdd$1(this, _pointerTrackedRows, /* @__PURE__ */ new WeakSet());
13439
+ __privateAdd$1(this, _hoveredRow);
13440
+ __privateAdd$1(this, _focusedCta);
13441
+ __privateAdd$1(this, _ctaFocusedAtRender);
13442
+ __privateAdd$1(this, _noHoverQueries, []);
13443
+ __privateAdd$1(this, _hasNoHover, false);
13444
+ __privateAdd$1(this, _builtTable);
13445
+ __privateAdd$1(this, _syncedAssets, []);
13446
+ __privateAdd$1(this, _pendingReplaces, 0);
13447
+ __privateAdd$1(this, _lastHeight, 0);
13448
+ __privateAdd$1(this, _containerSize);
13449
+ __privateAdd$1(this, _lastRowCount);
13450
+ __privateAdd$1(this, _rowCountHeld, false);
13451
+ __privateAdd$1(this, _lastRowObserver);
13452
+ __privateAdd$1(this, _layoutScrollbarWidth, 0);
13453
+ __privateAdd$1(this, _naturalWidths, /* @__PURE__ */ new Map());
13454
+ __privateAdd$1(this, _layoutPending, false);
13455
+ __privateAdd$1(this, _fontsPending, false);
13456
+ __privateAdd$1(this, _frameWidthObserver);
13457
+ this.debouncedApplyColumnLayout = debounce(this.applyColumnLayout, 100);
13458
+ this.handleNoHoverChange = () => {
13459
+ this.setNoHover(__privateGet$1(this, _noHoverQueries).some((list) => list.matches));
13460
+ };
13461
+ this.debouncedRedrawTable = debounce(this.redrawTable, 100);
13462
+ this.debouncedCalculatePageSize = debounce(this.calculatePageSize, 200);
13463
+ this.debouncedHandleLastRowVisible = debounce(this.handleLastRowVisible, 200);
13464
+ this.handleResizeHandleDoubleClick = (event) => {
13465
+ var _a2, _b2, _c2, _d2;
13466
+ const handle = (_b2 = (_a2 = event.target) == null ? void 0 : _a2.closest) == null ? void 0 : _b2.call(_a2, ".tabulator-col-resize-handle");
13467
+ if (!handle) {
13468
+ return;
13469
+ }
13470
+ event.stopPropagation();
13471
+ const key = (_c2 = handle.previousElementSibling) == null ? void 0 : _c2.getAttribute("tabulator-field");
13472
+ const field = this.fieldOfKey(key);
13473
+ const column2 = key ? (_d2 = this.tabulator) == null ? void 0 : _d2.getColumn(key) : void 0;
13474
+ if (field === void 0 || !column2) {
13475
+ return;
13476
+ }
13477
+ __privateGet$1(this, _resizedWidths).delete(field.trim());
13478
+ __privateGet$1(this, _sessionWidths).delete(field.trim());
13479
+ this.applyColumnLayout();
13480
+ this.emit("cx-content-browser-table-column-resize", {
13481
+ detail: {
13482
+ field,
13483
+ reset: true,
13484
+ width: Math.round(column2.getWidth())
13485
+ }
13486
+ });
13487
+ };
13488
+ this.debouncedHandleScrollEnd = debounce(this.handleScrollEnd, 200);
13489
+ }
13490
+ get tabulator() {
13491
+ var _a2, _b2;
13492
+ const instance2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0;
13493
+ return instance2 !== void 0 && instance2 === __privateGet$1(this, _builtTable) && !instance2.destroyed ? instance2 : void 0;
13494
+ }
13495
+ /**
13496
+ * The current Tabulator instance, built or not. Tabulator shows its header and frame as it builds,
13497
+ * but fires `tableBuilt` only after its data-load debounce.
13498
+ */
13499
+ get buildingTabulator() {
13500
+ var _a2, _b2;
13501
+ const instance2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0;
13502
+ return instance2 && !instance2.destroyed ? instance2 : void 0;
13503
+ }
13504
+ /** Tabulator's row holder: the one element that scrolls the rows. */
13505
+ get scrollport() {
13506
+ var _a2, _b2, _c2;
13507
+ return (_c2 = (_b2 = (_a2 = this.tabulator) == null ? void 0 : _a2.rowManager) == null ? void 0 : _b2.element) != null ? _c2 : void 0;
13508
+ }
13509
+ /** Each host column's row key, in order: a field the host repeats takes a key per occurrence. */
13510
+ resolveColumnKeys() {
13511
+ const occurrences = /* @__PURE__ */ new Map();
13512
+ return this.columns.map(({ field }) => {
13513
+ var _a2, _b2;
13514
+ const occurrence = (_a2 = occurrences.get(field)) != null ? _a2 : 0;
13515
+ const identity2 = `${field}\0${occurrence}`;
13516
+ const key = (_b2 = __privateGet$1(this, _columnKeys).get(identity2)) != null ? _b2 : `column${__privateGet$1(this, _columnKeys).size}`;
13517
+ occurrences.set(field, occurrence + 1);
13518
+ __privateGet$1(this, _columnKeys).set(identity2, key);
13519
+ return key;
13520
+ });
13521
+ }
13522
+ buildColumnDefinitions() {
13523
+ return [...this.buildDataColumnDefinitions(), this.buildFillerColumnDefinition()];
13524
+ }
13525
+ /**
13526
+ * A pixel width for each column, so the `fitData` layout never sizes it from its content. The
13527
+ * auto-fit sets the real width once the columns are built (see `applyColumnLayout`). Until then a
13528
+ * column keeps the width it had in the previous definitions.
13529
+ */
13530
+ buildDataColumnDefinitions() {
13531
+ const hidden = new Set(this.hiddenFields);
13532
+ const keys2 = this.resolveColumnKeys();
13533
+ const previousWidths = new Map(__privateGet$1(this, _columnDefinitions).map(({ field, width }) => [String(field), width]));
13534
+ return this.columns.map((column2, index) => {
13535
+ var _a2, _b2;
13536
+ const previous = previousWidths.get(keys2[index]);
13537
+ return {
13538
+ field: keys2[index],
13539
+ formatter: (cell) => {
13540
+ var _a3;
13541
+ const row = cell.getRow();
13542
+ const inColdStorage = Boolean(row.getData().inColdStorage);
13543
+ if (inColdStorage) {
13544
+ row.getElement().style.pointerEvents = "none";
13545
+ }
13546
+ return renderCellContent(String((_a3 = cell.getValue()) != null ? _a3 : ""), inColdStorage);
13547
+ },
13548
+ // Never `false`: Tabulator awaits a `show()` for it as it builds the header.
13549
+ hidden: hidden.has(column2.field) || void 0,
13550
+ minWidth: MIN_COLUMN_WIDTH,
13551
+ title: column2.title,
13552
+ // A node, as for a cell: `cx-table` parses a title string as HTML.
13553
+ titleFormatter: (cell) => {
13554
+ var _a3;
13555
+ return renderCellContent(String((_a3 = cell.getValue()) != null ? _a3 : ""), false);
13556
+ },
13557
+ width: (_b2 = (_a2 = __privateGet$1(this, _resizedWidths).get(column2.field.trim())) != null ? _a2 : __privateGet$1(this, _sessionWidths).get(column2.field.trim())) != null ? _b2 : typeof previous === "number" ? previous : MIN_COLUMN_WIDTH
13558
+ };
13559
+ });
13560
+ }
13561
+ /**
13562
+ * Tabulator replaces its rows with a placeholder when no columns remain visible. This invisible
13563
+ * column keeps the rows and their actions available when the host hides every data column.
13564
+ * Its small, fixed width gives the final resize handle a buffer without a visible empty column.
13565
+ */
13566
+ buildFillerColumnDefinition() {
13567
+ return {
13568
+ field: FILLER_FIELD,
13569
+ formatter: (cell) => {
13570
+ const element = cell.getElement();
13571
+ if (element) {
13572
+ element.style.padding = "0";
13573
+ element.style.visibility = "hidden";
13574
+ element.style.pointerEvents = "none";
13575
+ element.setAttribute("aria-hidden", "true");
13576
+ }
13577
+ return "";
13578
+ },
13579
+ headerSort: false,
13580
+ // A column laid out at 0 loses its width style, and renders as wide as its content.
13581
+ minWidth: RESIZE_BUFFER_WIDTH,
13582
+ resizable: false,
13583
+ title: "",
13584
+ titleFormatter: (cell) => {
13585
+ const header = cell.getColumn().getElement();
13586
+ header.style.opacity = "0";
13587
+ header.style.borderRight = "none";
13588
+ header.style.pointerEvents = "none";
13589
+ header.setAttribute("aria-label", this.ctaLabel);
13590
+ return "";
13591
+ },
13592
+ width: RESIZE_BUFFER_WIDTH
13593
+ };
13594
+ }
13595
+ get ctaLabel() {
13596
+ return this.ctaText || this.localize.term("insert");
13597
+ }
13598
+ /** The action overlays its row and takes no column width. */
13599
+ renderRowAction(row) {
13600
+ var _a2;
13601
+ const data = row.getData();
13602
+ const rowElement = row.getElement();
13603
+ const previous = __privateGet$1(this, _ctas).get(rowElement);
13604
+ rowElement.part.add("content-browser-row");
13605
+ previous == null ? void 0 : previous.container.remove();
13606
+ if (previous) {
13607
+ __privateGet$1(this, _renderedCtas).delete(previous);
13608
+ __privateGet$1(this, _ctas).delete(rowElement);
13609
+ }
13610
+ if (data.inColdStorage) {
13611
+ rowElement.style.pointerEvents = "none";
13612
+ return;
13613
+ }
13614
+ rowElement.style.pointerEvents = "";
13615
+ const container = document.createElement("div");
13616
+ const overlay = document.createElement("div");
13617
+ const button = document.createElement("cx-button");
13618
+ const label = document.createElement("span");
13619
+ const cta = { assetId: String((_a2 = data.id) != null ? _a2 : ""), button, container, label, rowElement };
13620
+ container.part.add("content-browser-action-anchor");
13621
+ container.setAttribute("role", "gridcell");
13622
+ overlay.part.add("content-browser-action");
13623
+ overlay.append(button);
13624
+ container.append(overlay);
13625
+ rowElement.append(container);
13626
+ rowElement.style.cursor = "default";
13627
+ button.classList.add("content-browser-table__cta");
13628
+ button.setAttribute("size", "small");
13629
+ button.setAttribute("variant", "primary");
13630
+ button.style.width = "max-content";
13631
+ button.style.maxWidth = "none";
13632
+ label.style.whiteSpace = "nowrap";
13633
+ button.append(label);
13634
+ button.addEventListener("click", (event) => {
13635
+ if (event.detail <= 1) {
13636
+ this.insertAsset(cta.assetId);
13637
+ }
13638
+ });
13639
+ button.addEventListener("focusin", () => {
13640
+ __privateSet$1(this, _focusedCta, cta);
13641
+ this.paintCta(cta);
13642
+ });
13643
+ button.addEventListener("focusout", () => {
13644
+ if (__privateGet$1(this, _focusedCta) === cta) {
13645
+ __privateSet$1(this, _focusedCta, void 0);
13646
+ }
13647
+ this.paintCta(cta);
13648
+ });
13649
+ __privateGet$1(this, _ctas).set(rowElement, cta);
13650
+ __privateGet$1(this, _renderedCtas).add(cta);
13651
+ this.trackPointer(rowElement);
13652
+ this.paintCta(cta);
13653
+ }
13654
+ isCtaShown(cta) {
13655
+ return __privateGet$1(this, _hasNoHover) || cta.assetId === this.busyAssetId || cta.assetId === this.selectedAssetId || cta.rowElement === __privateGet$1(this, _hoveredRow) || cta === __privateGet$1(this, _focusedCta) && cta.button.matches(":focus-within");
13656
+ }
13657
+ /** In place, never rebuilt: a new button would drop the keyboard focus the old one held. */
13658
+ paintCta(cta) {
13659
+ const text = this.ctaLabel;
13660
+ if (cta.label.textContent !== text) {
13661
+ cta.label.textContent = text;
13662
+ }
13663
+ cta.label.style.textTransform = this.ctaTextTransform;
13664
+ cta.button.loading = cta.assetId === this.busyAssetId;
13665
+ const shown = this.isCtaShown(cta);
13666
+ cta.container.style.opacity = shown ? "1" : "0";
13667
+ cta.container.style.pointerEvents = shown ? "" : "none";
13668
+ }
13669
+ paintRowCta(rowElement) {
13670
+ const cta = rowElement ? __privateGet$1(this, _ctas).get(rowElement) : void 0;
13671
+ if (cta) {
13672
+ this.paintCta(cta);
13673
+ }
13674
+ }
13675
+ paintAssetCta(assetId) {
13676
+ var _a2;
13677
+ this.paintRowCta((_a2 = this.findRow(assetId)) == null ? void 0 : _a2.getElement());
13678
+ }
13679
+ trackPointer(rowElement) {
13680
+ if (__privateGet$1(this, _pointerTrackedRows).has(rowElement)) {
13681
+ return;
13682
+ }
13683
+ __privateGet$1(this, _pointerTrackedRows).add(rowElement);
13684
+ rowElement.addEventListener("mouseenter", () => this.setHoveredRow(rowElement));
13685
+ rowElement.addEventListener("mouseleave", () => {
13686
+ if (__privateGet$1(this, _hoveredRow) === rowElement) {
13687
+ this.setHoveredRow(void 0);
13688
+ }
13689
+ });
13690
+ }
13691
+ setHoveredRow(rowElement) {
13692
+ const previous = __privateGet$1(this, _hoveredRow);
13693
+ __privateSet$1(this, _hoveredRow, rowElement);
13694
+ this.paintRowCta(previous);
13695
+ this.paintRowCta(rowElement);
13696
+ }
13697
+ /**
13698
+ * Tabulator takes a row that scrolls out of its render window off the page, and a row taken off
13699
+ * the page gets no `mouseleave` to hide its CTA, nor need its button get a `focusout` for the
13700
+ * focus it drops.
13701
+ */
13702
+ releaseDetachedCta() {
13703
+ var _a2;
13704
+ if (((_a2 = __privateGet$1(this, _hoveredRow)) == null ? void 0 : _a2.isConnected) === false) {
13705
+ this.setHoveredRow(void 0);
13706
+ }
13707
+ const focused = __privateGet$1(this, _focusedCta);
13708
+ if ((focused == null ? void 0 : focused.button.isConnected) === false) {
13709
+ __privateSet$1(this, _focusedCta, void 0);
13710
+ this.paintCta(focused);
13711
+ }
13712
+ }
13713
+ /** Lays the columns and the rendered rows out again. */
13714
+ redrawTable() {
13715
+ var _a2;
13716
+ (_a2 = this.tabulator) == null ? void 0 : _a2.redraw();
13717
+ this.syncTableFrame();
13718
+ }
13719
+ /** The frame ends at the data columns. The scrollport remains available to the row actions. */
13720
+ syncTableFrame() {
13721
+ var _a2, _b2, _c2;
13722
+ const columns = (_a2 = this.buildingTabulator) == null ? void 0 : _a2.getColumns();
13723
+ const widths = (_b2 = columns == null ? void 0 : columns.filter((column2) => column2.getField() !== FILLER_FIELD && column2.isVisible()).map((column2) => column2.getWidth())) != null ? _b2 : [];
13724
+ const width = widths.every((value) => value > 0) ? widths.reduce((total, value) => total + value, 0) : 0;
13725
+ (_c2 = this.tableEl) == null ? void 0 : _c2.style.setProperty("--content-browser-table-width", width > 0 ? `${width + RESIZE_BUFFER_WIDTH}px` : "100%");
13726
+ }
13727
+ /**
13728
+ * Tabulator renders the rows again -- for an appended page, a redraw of its own or one of ours --
13729
+ * by taking every rendered row off the page and back, which drops the keyboard focus, so the CTA
13730
+ * that held it gets it back.
13731
+ */
13732
+ handleRenderStarted(event) {
13733
+ var _a2;
13734
+ event.stopPropagation();
13735
+ const button = (_a2 = __privateGet$1(this, _focusedCta)) == null ? void 0 : _a2.button;
13736
+ __privateSet$1(this, _ctaFocusedAtRender, (button == null ? void 0 : button.matches(":focus-within")) ? button : void 0);
13737
+ }
13738
+ handleRenderComplete(event) {
13739
+ event.stopPropagation();
13740
+ if (this.getScrollbarWidth() !== __privateGet$1(this, _layoutScrollbarWidth)) {
13741
+ this.applyColumnLayout(false);
13742
+ }
13743
+ this.syncTableFrame();
13744
+ const button = __privateGet$1(this, _ctaFocusedAtRender);
13745
+ __privateSet$1(this, _ctaFocusedAtRender, void 0);
13746
+ if ((button == null ? void 0 : button.isConnected) && !button.matches(":focus-within")) {
13747
+ button.focus({ preventScroll: true });
13748
+ }
13749
+ }
13750
+ toRow(asset, keys2) {
13751
+ const row = {
13752
+ id: asset.id,
13753
+ inColdStorage: Boolean(asset.inColdStorage)
13754
+ };
13755
+ this.columns.forEach((column2, index) => {
13756
+ row[keys2[index]] = readCellValue(asset, column2.field);
13757
+ });
13758
+ return row;
13759
+ }
13760
+ findRow(assetId) {
13761
+ var _a2;
13762
+ if (!assetId) {
13763
+ return void 0;
13764
+ }
13765
+ return ((_a2 = this.tabulator) == null ? void 0 : _a2.getRow(assetId)) || void 0;
13766
+ }
13767
+ /**
13768
+ * `aria-current`, not `aria-selected`: this is a `grid` with no selection model of its own. The
13769
+ * row is never selected in Tabulator, so an import does not paint `cx-table`'s selected-row highlight.
13770
+ */
13771
+ markCurrentRow(assetId, current2) {
13772
+ const row = this.findRow(assetId);
13773
+ if (!row) {
13774
+ return;
13775
+ }
13776
+ row.getElement().setAttribute("aria-current", current2 ? "true" : "false");
13777
+ }
13778
+ /**
13779
+ * The fonts and the padding of a rendered header title and data cell. A table with no rendered
13780
+ * cell measures the values in the header font, with the header padding.
13781
+ */
13782
+ readColumnMetrics(columns) {
13783
+ var _a2, _b2, _c2, _d2, _e3;
13784
+ const header = columns.map((column2) => column2.getElement()).find((element) => element.isConnected);
13785
+ const title = (_a2 = header == null ? void 0 : header.querySelector(".tabulator-col-title cx-line-clamp")) != null ? _a2 : header == null ? void 0 : header.querySelector(".tabulator-col-title");
13786
+ if (!header || !title) {
13787
+ return void 0;
13788
+ }
13789
+ const headerFont = canvasFont(title);
13790
+ const headerContent = header.querySelector(".tabulator-col-content");
13791
+ const headerPadding = horizontalPadding(header) + (headerContent ? horizontalPadding(headerContent) : 0) + horizontalPadding((_b2 = title.closest(".tabulator-col-title")) != null ? _b2 : title);
13792
+ const key = (_c2 = header.getAttribute("tabulator-field")) != null ? _c2 : "";
13793
+ const cell = (_e3 = (_d2 = this.tableEl) == null ? void 0 : _d2.shadowRoot) == null ? void 0 : _e3.querySelector(`.tabulator-row .tabulator-cell[tabulator-field="${key}"]`);
13794
+ const text = cell == null ? void 0 : cell.querySelector("cx-line-clamp");
13795
+ if (!cell || !text) {
13796
+ return { cellFont: headerFont, headerFont, padding: headerPadding };
13797
+ }
13798
+ return { cellFont: canvasFont(text), headerFont, padding: Math.max(headerPadding, horizontalPadding(cell)) };
13799
+ }
13800
+ getScrollbarWidth() {
13801
+ var _a2, _b2, _c2;
13802
+ const scrollport = (_c2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) == null ? void 0 : _b2.rowManager) == null ? void 0 : _c2.element;
13803
+ return scrollport ? scrollport.offsetWidth - scrollport.clientWidth : 0;
13804
+ }
13805
+ /** The widest of the title and the values of the loaded rows, plus the padding. */
13806
+ measureNaturalWidth(column2, metrics) {
13807
+ const widest = __privateGet$1(this, _syncedAssets).reduce(
13808
+ (width, asset) => Math.max(width, measureTextWidth(readCellValue(asset, column2.field), metrics.cellFont)),
13809
+ measureTextWidth(column2.title, metrics.headerFont)
13810
+ );
13811
+ return Math.ceil(widest + metrics.padding);
13812
+ }
13813
+ /**
13814
+ * Sets the width of each visible host column: a saved or session width as is, and an auto-fit
13815
+ * width for the other columns, inside the width of the table (see `layoutColumnWidths`). A hidden
13816
+ * column keeps its width. A table with no width, as one in a hidden panel, keeps its widths until
13817
+ * it is shown.
13818
+ * @param measure Measure the natural widths again. Leave it false to reuse the natural widths of
13819
+ * the last full layout, for a change of the available width only.
13820
+ */
13821
+ applyColumnLayout(measure = true) {
13822
+ var _a2;
13823
+ const tabulator = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance;
13824
+ const element = tabulator && !tabulator.destroyed ? tabulator.element : void 0;
13825
+ if (!tabulator || !element) {
13826
+ return;
13827
+ }
13828
+ if (element.clientWidth === 0) {
13829
+ __privateGet$1(this, _layoutPending) || __privateSet$1(this, _layoutPending, measure);
13830
+ return;
13831
+ }
13832
+ if (measure) {
13833
+ __privateSet$1(this, _layoutPending, false);
13834
+ this.layoutAgainWhenFontsLoad();
13835
+ }
13836
+ const hidden = new Set(this.hiddenFields);
13837
+ const keys2 = this.resolveColumnKeys();
13838
+ const shown = this.columns.flatMap((column2, index) => {
13839
+ const tabulatorColumn = hidden.has(column2.field) ? false : tabulator.getColumn(keys2[index]);
13840
+ return tabulatorColumn ? [{ column: column2, key: keys2[index], tabulatorColumn }] : [];
13841
+ });
13842
+ const metrics = this.readColumnMetrics(shown.map(({ tabulatorColumn }) => tabulatorColumn));
13843
+ if (!metrics) {
13844
+ return;
13845
+ }
13846
+ const scrollbar = this.getScrollbarWidth();
13847
+ __privateSet$1(this, _layoutScrollbarWidth, scrollbar);
13848
+ const widths = layoutColumnWidths(shown.map(({ column: column2, key }) => {
13849
+ var _a3;
13850
+ let natural = measure ? void 0 : __privateGet$1(this, _naturalWidths).get(key);
13851
+ if (natural === void 0) {
13852
+ natural = this.measureNaturalWidth(column2, metrics);
13853
+ __privateGet$1(this, _naturalWidths).set(key, natural);
13854
+ }
13855
+ return { natural, saved: (_a3 = __privateGet$1(this, _resizedWidths).get(column2.field.trim())) != null ? _a3 : __privateGet$1(this, _sessionWidths).get(column2.field.trim()) };
13856
+ }), Math.floor(unroundedClientWidth(element) - scrollbar) - RESIZE_BUFFER_WIDTH);
13857
+ shown.forEach(({ key, tabulatorColumn }, index) => {
13858
+ const width = widths[index];
13859
+ void tabulatorColumn.setWidth(width);
13860
+ tabulatorColumn.getDefinition().width = width;
13861
+ const definition = __privateGet$1(this, _columnDefinitions).find(({ field }) => field === key);
13862
+ if (definition) {
13863
+ definition.width = width;
13864
+ }
13865
+ });
13866
+ this.syncTableFrame();
13867
+ }
13868
+ /**
13869
+ * The canvas measures with a fallback font while a web font loads, so measure again once the fonts
13870
+ * are ready. Guarded by one pending wait, and by the connection of the element.
13871
+ */
13872
+ layoutAgainWhenFontsLoad() {
13873
+ var _a2;
13874
+ if (__privateGet$1(this, _fontsPending) || ((_a2 = document.fonts) == null ? void 0 : _a2.status) !== "loading") {
13875
+ return;
13876
+ }
13877
+ __privateSet$1(this, _fontsPending, true);
13878
+ void document.fonts.ready.then(() => {
13879
+ __privateSet$1(this, _fontsPending, false);
13880
+ if (this.isConnected) {
13881
+ this.applyColumnLayout();
13882
+ }
13883
+ });
13884
+ }
13885
+ /**
13886
+ * `content-browser` hands over the whole list on every page, so a list that only grows by a page
13887
+ * is appended: reassigning it would call `setData`, which scrolls the table back to the top. Any
13888
+ * other list -- a new search, sort, filter or folder, or a refetch that brings the assets the rows
13889
+ * show as new objects -- replaces the rows.
13890
+ */
13891
+ syncRows(replace2 = false) {
13892
+ return __async(this, null, function* () {
13893
+ const tabulator = this.tabulator;
13894
+ if (!tabulator) {
13895
+ return;
13896
+ }
13897
+ const columnKeys = this.resolveColumnKeys();
13898
+ const synced = __privateGet$1(this, _syncedAssets);
13899
+ const isNextPage = !replace2 && __privateGet$1(this, _pendingReplaces) === 0 && isAppendOf(synced, this.assets);
13900
+ __privateSet$1(this, _syncedAssets, [...this.assets]);
13901
+ if (isNextPage) {
13902
+ __privateSet$1(this, _heldRowKeys, new Set(columnKeys.filter((key) => __privateGet$1(this, _heldRowKeys).has(key))));
13903
+ yield tabulator.addData(this.assets.slice(synced.length).map((asset) => this.toRow(asset, columnKeys)));
13904
+ } else {
13905
+ __privateSet$1(this, _heldRowKeys, new Set(columnKeys));
13906
+ __privateSet$1(this, _pendingReplaces, __privateGet$1(this, _pendingReplaces) + 1);
13907
+ try {
13908
+ yield tabulator.setData(this.assets.map((asset) => this.toRow(asset, columnKeys)));
13909
+ } finally {
13910
+ __privateSet$1(this, _pendingReplaces, __privateGet$1(this, _pendingReplaces) - 1);
13911
+ }
13912
+ this.applyColumnLayout();
13913
+ }
13914
+ this.markCurrentRow(this.selectedAssetId, true);
13915
+ this.observeLastRow();
13916
+ this.reportRestartedRowCount();
13917
+ this.reportHeldRowCount();
13918
+ });
13919
+ }
13920
+ handleTableBuilt(event) {
13921
+ var _a2, _b2;
13922
+ event.stopPropagation();
13923
+ __privateSet$1(this, _builtTable, (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0);
13924
+ if (__privateGet$1(this, _builtTable)) {
13925
+ __privateGet$1(this, _builtTable).options.rowFormatter = (row) => this.renderRowAction(row);
13926
+ }
13927
+ this.prepareFrame();
13928
+ __privateSet$1(this, _syncedAssets, []);
13929
+ void this.syncRows();
13930
+ }
13931
+ /**
13932
+ * Gives the frame, the scrollport and the header their styles. Runs as soon as Tabulator lays out its
13933
+ * columns: until then the frame takes the width of its content, which is not the width of the header.
13934
+ */
13935
+ prepareFrame() {
13936
+ var _a2, _b2, _c2, _d2, _e3, _f2, _g;
13937
+ const scrollport = (_b2 = (_a2 = this.buildingTabulator) == null ? void 0 : _a2.rowManager) == null ? void 0 : _b2.element;
13938
+ const frame = scrollport == null ? void 0 : scrollport.parentElement;
13939
+ frame == null ? void 0 : frame.style.setProperty("width", "100%");
13940
+ frame == null ? void 0 : frame.part.add("content-browser-frame");
13941
+ scrollport == null ? void 0 : scrollport.part.add("content-browser-scrollport");
13942
+ const header = (_d2 = (_c2 = this.tableEl) == null ? void 0 : _c2.shadowRoot) == null ? void 0 : _d2.querySelector(".tabulator-header");
13943
+ const columns = header == null ? void 0 : header.querySelector(".tabulator-headers");
13944
+ header == null ? void 0 : header.part.add("content-browser-header");
13945
+ (_f2 = (_e3 = this.tableEl) == null ? void 0 : _e3.shadowRoot) == null ? void 0 : _f2.addEventListener("dblclick", this.handleResizeHandleDoubleClick, { capture: true });
13946
+ (_g = __privateGet$1(this, _frameWidthObserver)) == null ? void 0 : _g.disconnect();
13947
+ if (columns) {
13948
+ __privateSet$1(this, _frameWidthObserver, new ResizeObserver(() => this.syncTableFrame()));
13949
+ __privateGet$1(this, _frameWidthObserver).observe(columns);
13950
+ }
13951
+ this.syncTableFrame();
13952
+ }
13953
+ /**
13954
+ * `setData` replaces the rows only once its debounce runs out, and Tabulator emits `dataLoaded` just
13955
+ * before it does. Until then, the old rows stay on the page with their hover and focus.
13956
+ */
13957
+ handleDataLoaded(event) {
13958
+ event.stopPropagation();
13959
+ __privateSet$1(this, _hoveredRow, void 0);
13960
+ __privateSet$1(this, _focusedCta, void 0);
13961
+ __privateGet$1(this, _renderedCtas).clear();
13962
+ }
13963
+ /**
13964
+ * Every `setColumns` builds the columns again from the definitions: Tabulator calls it as it builds,
13965
+ * before `tableBuilt`. `cx-table` calls it again from its own `tableBuilt` handler, after this
13966
+ * component's has run, and for every new column set.
13967
+ */
13968
+ handleColumnsLoaded(event) {
13969
+ event.stopPropagation();
13970
+ this.prepareFrame();
13971
+ this.applyColumnLayout();
13972
+ }
13973
+ willUpdate(changedProperties) {
13974
+ super.willUpdate(changedProperties);
13975
+ const signature = columnsSignature(this.columns);
13976
+ const columnsChanged = signature !== __privateGet$1(this, _columnsSignature);
13977
+ const tableRemounts = changedProperties.get("empty") === true && !this.empty;
13978
+ if (columnsChanged) {
13979
+ __privateSet$1(this, _columnsSignature, signature);
13980
+ __privateSet$1(this, _rowsNeedRebuild, this.hasUpdated && this.resolveColumnKeys().some((key) => !__privateGet$1(this, _heldRowKeys).has(key)));
13981
+ }
13982
+ const savedWidthsChanged = changedProperties.has("savedWidths");
13983
+ const widthScopeChanged = changedProperties.has("widthScope");
13984
+ if (widthScopeChanged) {
13985
+ __privateGet$1(this, _sessionWidths).clear();
13986
+ }
13987
+ if (savedWidthsChanged) {
13988
+ this.applySavedWidths();
13989
+ }
13990
+ if (columnsChanged || tableRemounts) {
13991
+ __privateSet$1(this, _columnDefinitions, this.buildColumnDefinitions());
13992
+ } else if (changedProperties.has("hiddenFields")) {
13993
+ this.applyHiddenFields();
13994
+ } else if (savedWidthsChanged || widthScopeChanged) {
13995
+ this.applyColumnLayout();
13996
+ }
13997
+ }
13998
+ /**
13999
+ * The new saved widths replace all the widths in memory: a width that the new map does not hold,
14000
+ * for example one of another site, goes away. Only a positive width counts: a bad entry has no effect.
14001
+ */
14002
+ applySavedWidths() {
14003
+ var _a2;
14004
+ __privateSet$1(this, _resizedWidths, new Map(Object.entries((_a2 = this.savedWidths) != null ? _a2 : {}).flatMap(([field, width]) => typeof width === "number" && Number.isFinite(width) && width > 0 ? [[field.trim(), Math.round(width)]] : [])));
14005
+ }
14006
+ /**
14007
+ * Through Tabulator's own column visibility: new definitions would reach it through `setColumns`,
14008
+ * and the rows would have to be rebuilt, which scrolls back to the top.
14009
+ */
14010
+ applyHiddenFields() {
14011
+ const hidden = new Set(this.hiddenFields);
14012
+ const keys2 = this.resolveColumnKeys();
14013
+ const shows = [];
14014
+ __privateGet$1(this, _columnDefinitions).forEach((definition) => {
14015
+ var _a2;
14016
+ const field = String(definition.field);
14017
+ const hostColumn = this.columns[keys2.indexOf(field)];
14018
+ if (!hostColumn) {
14019
+ return;
14020
+ }
14021
+ const isHidden = hidden.has(hostColumn.field);
14022
+ const column2 = (_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(field);
14023
+ definition.hidden = isHidden || void 0;
14024
+ if (column2 && column2.isVisible() === isHidden) {
14025
+ if (isHidden) {
14026
+ column2.hide();
14027
+ } else {
14028
+ shows.push(column2.show());
14029
+ }
14030
+ }
14031
+ });
14032
+ void Promise.all(shows).then(() => this.applyColumnLayout());
14033
+ }
14034
+ updated(changedProperties) {
14035
+ var _a2;
14036
+ super.updated(changedProperties);
14037
+ if (this.empty) {
14038
+ (_a2 = __privateGet$1(this, _frameWidthObserver)) == null ? void 0 : _a2.disconnect();
14039
+ }
14040
+ if (__privateGet$1(this, _rowsNeedRebuild)) {
14041
+ __privateSet$1(this, _rowsNeedRebuild, false);
14042
+ void this.rebuildRows();
14043
+ }
14044
+ }
14045
+ /** Once `cx-table` has taken the new column definitions. */
14046
+ rebuildRows() {
14047
+ return __async(this, null, function* () {
14048
+ var _a2;
14049
+ yield (_a2 = this.tableEl) == null ? void 0 : _a2.updateComplete;
14050
+ yield this.syncRows(true);
14051
+ });
14052
+ }
14053
+ handleAssetsChange(previous) {
14054
+ const previousAssets = previous != null ? previous : [];
14055
+ if (this.assets.length === previousAssets.length && this.assets.every((asset, index) => asset === previousAssets[index])) {
14056
+ return;
14057
+ }
14058
+ this.assetMap.clear();
14059
+ this.assets.forEach((item) => this.assetMap.set(item.id, item));
14060
+ if (!isAppendOf(previousAssets, this.assets)) {
14061
+ __privateSet$1(this, _lastRowCount, void 0);
14062
+ }
14063
+ void this.syncRows();
14064
+ }
14065
+ handleLoadingChange() {
14066
+ return __async(this, null, function* () {
14067
+ if (this.loading) {
14068
+ return;
14069
+ }
14070
+ yield this.updateComplete;
14071
+ if (__privateGet$1(this, _pendingReplaces) === 0) {
14072
+ this.reportHeldRowCount();
14073
+ }
14074
+ });
14075
+ }
14076
+ handleSelectedAssetIdChange(previous) {
14077
+ this.markCurrentRow(previous, false);
14078
+ this.markCurrentRow(this.selectedAssetId, true);
14079
+ this.paintAssetCta(previous);
14080
+ this.paintAssetCta(this.selectedAssetId);
14081
+ }
14082
+ handleBusyAssetIdChange(previous) {
14083
+ this.paintAssetCta(previous);
14084
+ this.paintAssetCta(this.busyAssetId);
14085
+ }
14086
+ handleCtaTextChange() {
14087
+ var _a2, _b2;
14088
+ (_b2 = ((_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(FILLER_FIELD)) || void 0) == null ? void 0 : _b2.getElement().setAttribute("aria-label", this.ctaLabel);
14089
+ __privateGet$1(this, _renderedCtas).forEach((cta) => this.paintCta(cta));
14090
+ }
14091
+ /** In place, as a relabel is: a CTA built again would drop the keyboard focus the old one held. */
14092
+ setNoHover(noHover) {
14093
+ if (noHover === __privateGet$1(this, _hasNoHover)) {
14094
+ return;
14095
+ }
14096
+ __privateSet$1(this, _hasNoHover, noHover);
14097
+ __privateGet$1(this, _renderedCtas).forEach((cta) => this.paintCta(cta));
14098
+ }
14099
+ connectedCallback() {
14100
+ super.connectedCallback();
14101
+ __privateSet$1(this, _noHoverQueries, NO_HOVER_QUERIES.map((media) => window.matchMedia(media)));
14102
+ __privateGet$1(this, _noHoverQueries).forEach((list) => list.addEventListener("change", this.handleNoHoverChange));
14103
+ this.handleNoHoverChange();
14104
+ if (this.hasUpdated) {
14105
+ __privateSet$1(this, _columnDefinitions, this.buildColumnDefinitions());
14106
+ this.requestUpdate();
14107
+ }
14108
+ }
14109
+ disconnectedCallback() {
14110
+ var _a2, _b2;
14111
+ super.disconnectedCallback();
14112
+ __privateGet$1(this, _noHoverQueries).forEach((list) => list.removeEventListener("change", this.handleNoHoverChange));
14113
+ __privateSet$1(this, _noHoverQueries, []);
14114
+ (_a2 = __privateGet$1(this, _lastRowObserver)) == null ? void 0 : _a2.disconnect();
14115
+ (_b2 = __privateGet$1(this, _frameWidthObserver)) == null ? void 0 : _b2.disconnect();
14116
+ this.debouncedCalculatePageSize.cancel();
14117
+ this.debouncedHandleScrollEnd.cancel();
14118
+ this.debouncedHandleLastRowVisible.cancel();
14119
+ this.debouncedRedrawTable.cancel();
14120
+ this.debouncedApplyColumnLayout.cancel();
14121
+ }
14122
+ handleResize(event) {
14123
+ event.stopPropagation();
14124
+ const entries = event.detail.entries;
14125
+ if (entries[0].target !== this.containerEl) {
14126
+ return;
14127
+ }
14128
+ const { height, width } = entries[0].contentRect;
14129
+ this.debouncedCalculatePageSize(height);
14130
+ this.refitToContainer(width, height);
14131
+ if (__privateGet$1(this, _layoutPending)) {
14132
+ this.applyColumnLayout();
14133
+ }
14134
+ }
14135
+ /**
14136
+ * A new container width changes the space that the auto-fit shares out, so the columns are laid
14137
+ * out again. `cx-table` renders its rows again for a new container height only until the first drag
14138
+ * of a column divider, so a new height redraws the rows, which leaves no blank area under them.
14139
+ */
14140
+ refitToContainer(width, height) {
14141
+ const size = { height: Math.round(height), width: Math.round(width) };
14142
+ const previous = __privateGet$1(this, _containerSize);
14143
+ __privateSet$1(this, _containerSize, size);
14144
+ if (previous === void 0) {
14145
+ return;
14146
+ }
14147
+ if (previous.width !== size.width) {
14148
+ this.debouncedApplyColumnLayout();
14149
+ }
14150
+ if (previous.height !== size.height) {
14151
+ this.debouncedRedrawTable();
14152
+ }
14153
+ }
14154
+ calculatePageSize(height) {
14155
+ if (Math.abs(__privateGet$1(this, _lastHeight) - height) < 10) {
14156
+ return;
14157
+ }
14158
+ __privateSet$1(this, _lastHeight, height);
14159
+ this.reportRowCount();
14160
+ }
14161
+ /** Counts the rows the last measured height shows, and tells the host when the count changes. */
14162
+ reportRowCount() {
14163
+ const rowCount = Math.ceil(this.resolveVisibleHeight(__privateGet$1(this, _lastHeight)) / ROW_HEIGHT);
14164
+ __privateSet$1(this, _rowCountHeld, this.loading && this.assets.length > 0);
14165
+ if (rowCount === __privateGet$1(this, _lastRowCount) || __privateGet$1(this, _rowCountHeld)) {
14166
+ return;
14167
+ }
14168
+ __privateSet$1(this, _lastRowCount, rowCount);
14169
+ this.emit("cx-content-browser-grid-resize", {
14170
+ detail: {
14171
+ columnCount: 1,
14172
+ rowCount
14173
+ }
14174
+ });
14175
+ }
14176
+ /**
14177
+ * Only once the restarted rows are in: the host asks for the next page at once, and a page that
14178
+ * lands while `setData` waits replaces the rows again and holds them back for another half second.
14179
+ * A measurement still in its debounce reports in the same count, because a second count inside the
14180
+ * host's 200 ms fetch debounce cancels the page the first count asked for.
14181
+ */
14182
+ reportRestartedRowCount() {
14183
+ if (!this.isConnected || __privateGet$1(this, _lastRowCount) !== void 0 || __privateGet$1(this, _lastHeight) === 0) {
14184
+ return;
14185
+ }
14186
+ this.debouncedCalculatePageSize.flush();
14187
+ this.reportRowCount();
14188
+ }
14189
+ /**
14190
+ * Once the load ends and any rows it brings are in, the count measured meanwhile can ask for the
14191
+ * page after it. A table that is not built yet reports it at once.
14192
+ */
14193
+ reportHeldRowCount() {
14194
+ if (!__privateGet$1(this, _rowCountHeld) || !this.isConnected) {
14195
+ return;
14196
+ }
14197
+ this.debouncedCalculatePageSize.flush();
14198
+ this.reportRowCount();
14199
+ }
14200
+ /**
14201
+ * The rows never size the container (see the styles), so this is the height the host gives the
14202
+ * picker, and it can run past the viewport. No scrollport shows more rows than the viewport, so
14203
+ * while the rows do not overflow the scrollport the count stops there, and the page scrolls to the
14204
+ * rest, where the last row coming into view asks for more (`observeLastRow`). One that overflows,
14205
+ * or holds no rows yet, measures the space its container gives it and is used as is.
14206
+ */
14207
+ resolveVisibleHeight(height) {
14208
+ return this.isSizedByRows() ? Math.min(height, window.innerHeight) : height;
14209
+ }
14210
+ isSizedByRows() {
14211
+ var _a2, _b2;
14212
+ const scrollport = this.scrollport;
14213
+ return ((_b2 = (_a2 = this.tabulator) == null ? void 0 : _a2.getDataCount()) != null ? _b2 : 0) > 0 && scrollport !== void 0 && scrollport.scrollHeight <= scrollport.clientHeight + 1;
14214
+ }
14215
+ /**
14216
+ * A scrollport that holds its rows without overflowing never scrolls, so its own scroll never
14217
+ * reaches the end: the page scrolls instead. Once the table is taller than the viewport its count
14218
+ * is capped and stops fetching, which leaves the last row coming into view as the only sign the
14219
+ * user wants more.
14220
+ */
14221
+ observeLastRow() {
14222
+ var _a2, _b2, _c2, _d2;
14223
+ (_a2 = __privateGet$1(this, _lastRowObserver)) == null ? void 0 : _a2.disconnect();
14224
+ const rows = (_c2 = (_b2 = this.tabulator) == null ? void 0 : _b2.getRows()) != null ? _c2 : [];
14225
+ const lastRow = rows[rows.length - 1];
14226
+ if (!lastRow) {
14227
+ return;
14228
+ }
14229
+ (_d2 = __privateGet$1(this, _lastRowObserver)) != null ? _d2 : __privateSet$1(this, _lastRowObserver, new IntersectionObserver((entries) => {
14230
+ if (entries.some((entry) => entry.isIntersecting)) {
14231
+ this.debouncedHandleLastRowVisible();
14232
+ }
14233
+ }));
14234
+ __privateGet$1(this, _lastRowObserver).observe(lastRow.getElement());
14235
+ }
14236
+ handleLastRowVisible() {
14237
+ if (this.isSizedByRows() && this.containerEl.clientHeight > window.innerHeight) {
14238
+ this.handleScrollEnd();
14239
+ }
14240
+ }
14241
+ insertAsset(assetId) {
14242
+ var _a2;
14243
+ if (!assetId || ((_a2 = this.assetMap.get(assetId)) == null ? void 0 : _a2.inColdStorage)) {
14244
+ return;
14245
+ }
14246
+ this.emit("cx-content-browser-grid-click", {
14247
+ detail: {
14248
+ id: assetId
14249
+ }
14250
+ });
14251
+ }
14252
+ /** The host field of a row key, or `undefined` for the filler. */
14253
+ fieldOfKey(key) {
14254
+ var _a2;
14255
+ return key ? (_a2 = this.columns[this.resolveColumnKeys().indexOf(key)]) == null ? void 0 : _a2.field : void 0;
14256
+ }
14257
+ handleColumnResized(event) {
14258
+ event.stopPropagation();
14259
+ const [column2] = event.detail.args;
14260
+ const field = this.fieldOfKey(column2.getField());
14261
+ if (field === void 0) {
14262
+ return;
14263
+ }
14264
+ const width = Math.round(column2.getWidth());
14265
+ column2.getDefinition().width = width;
14266
+ __privateGet$1(this, _resizedWidths).set(field.trim(), width);
14267
+ this.holdOtherAutoFitWidths(field);
14268
+ this.emit("cx-content-browser-table-column-resize", {
14269
+ detail: {
14270
+ field,
14271
+ reset: false,
14272
+ width
14273
+ }
14274
+ });
14275
+ this.applyColumnLayout();
14276
+ }
14277
+ /**
14278
+ * Holds each other visible auto-fit column at its width when the drag ends, for the session. A drag
14279
+ * on one column must not change the width of another column (L-42CA9K issue 2).
14280
+ */
14281
+ holdOtherAutoFitWidths(dragged) {
14282
+ const hidden = new Set(this.hiddenFields);
14283
+ const keys2 = this.resolveColumnKeys();
14284
+ this.columns.forEach((column2, index) => {
14285
+ var _a2;
14286
+ const field = column2.field.trim();
14287
+ if (field === dragged.trim() || hidden.has(column2.field) || __privateGet$1(this, _resizedWidths).has(field)) {
14288
+ return;
14289
+ }
14290
+ const tabulatorColumn = (_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(keys2[index]);
14291
+ const width = tabulatorColumn ? Math.round(tabulatorColumn.getWidth()) : 0;
14292
+ if (width > 0) {
14293
+ __privateGet$1(this, _sessionWidths).set(field, width);
14294
+ }
14295
+ });
14296
+ }
14297
+ handleScrollVertical(event) {
14298
+ event.stopPropagation();
14299
+ this.releaseDetachedCta();
14300
+ const scrollport = this.scrollport;
14301
+ if (scrollport && scrollport.scrollTop + scrollport.clientHeight >= scrollport.scrollHeight - ROW_HEIGHT) {
14302
+ this.debouncedHandleScrollEnd();
14303
+ }
14304
+ }
14305
+ handleScrollEnd() {
14306
+ if (this.hasMore && !this.loading) {
14307
+ this.emit("cx-content-browser-grid-scroll-end");
14308
+ }
14309
+ }
14310
+ handleRetry() {
14311
+ this.emit("cx-content-browser-grid-retry");
14312
+ }
14313
+ renderRetry() {
14314
+ return b`
14315
+ <cx-button class="content-browser-table__retry" variant="primary" @click=${this.handleRetry}>
14316
+ ${this.localize.term("retry")}
14317
+ </cx-button>
14318
+ `;
14319
+ }
14320
+ renderContent() {
14321
+ if (this.error && this.assets.length === 0) {
14322
+ return b`
14323
+ <cx-content-browser-no-result
14324
+ class="content-browser-table__empty"
14325
+ icon="error_outline"
14326
+ message=${this.localize.term("oopsSomethingWentWrong")}
14327
+ role="alert"
14328
+ >
14329
+ ${this.renderRetry()}
14330
+ </cx-content-browser-no-result>
14331
+ `;
14332
+ }
14333
+ if (this.empty) {
14334
+ return b`
14335
+ <cx-content-browser-no-result
14336
+ class="content-browser-table__empty"
14337
+ icon="search_off"
14338
+ message=${this.localize.term("noResults")}
14339
+ ></cx-content-browser-no-result>
14340
+ `;
14341
+ }
14342
+ return b`
14343
+ <cx-table
14344
+ class="content-browser-table__table"
14345
+ layout="fitData"
14346
+ placeholder=""
14347
+ no-selectable
14348
+ no-clipboard
14349
+ .columns=${__privateGet$1(this, _columnDefinitions)}
14350
+ .columnDefaults=${COLUMN_DEFAULTS}
14351
+ .rowHeight=${ROW_HEIGHT}
14352
+ @cx-table.tableBuilt=${this.handleTableBuilt}
14353
+ @cx-table.dataLoaded=${this.handleDataLoaded}
14354
+ @cx-table.columnsLoaded=${this.handleColumnsLoaded}
14355
+ @cx-table.columnResized=${this.handleColumnResized}
14356
+ @cx-table.scrollVertical=${this.handleScrollVertical}
14357
+ @cx-table.renderStarted=${this.handleRenderStarted}
14358
+ @cx-table.renderComplete=${this.handleRenderComplete}
14359
+ ></cx-table>
14360
+ `;
14361
+ }
14362
+ render() {
14363
+ return b`
14364
+ <div
14365
+ class="content-browser-table-loading"
14366
+ style=${o$2({
14367
+ opacity: this.loading ? 1 : 0
14368
+ })}
14369
+ >
14370
+ <cx-progress-bar indeterminate></cx-progress-bar>
14371
+ </div>
14372
+ <cx-resize-observer @cx-resize=${this.handleResize}>
14373
+ <div class="content-browser-table">
14374
+ ${this.renderContent()}
14375
+ </div>
14376
+ </cx-resize-observer>
14377
+ ${n$5(this.error && this.assets.length > 0, () => b`
14378
+ <div class="content-browser-table__page-error" role="alert">
14379
+ <cx-icon name="error_outline"></cx-icon>
14380
+ ${this.localize.term("oopsSomethingWentWrong")}
14381
+ ${this.renderRetry()}
14382
+ </div>
14383
+ `)}
14384
+ `;
14385
+ }
14386
+ };
14387
+ _columnDefinitions = /* @__PURE__ */ new WeakMap();
14388
+ _columnsSignature = /* @__PURE__ */ new WeakMap();
14389
+ _columnKeys = /* @__PURE__ */ new WeakMap();
14390
+ _rowsNeedRebuild = /* @__PURE__ */ new WeakMap();
14391
+ _heldRowKeys = /* @__PURE__ */ new WeakMap();
14392
+ _resizedWidths = /* @__PURE__ */ new WeakMap();
14393
+ _sessionWidths = /* @__PURE__ */ new WeakMap();
14394
+ _ctas = /* @__PURE__ */ new WeakMap();
14395
+ _renderedCtas = /* @__PURE__ */ new WeakMap();
14396
+ _pointerTrackedRows = /* @__PURE__ */ new WeakMap();
14397
+ _hoveredRow = /* @__PURE__ */ new WeakMap();
14398
+ _focusedCta = /* @__PURE__ */ new WeakMap();
14399
+ _ctaFocusedAtRender = /* @__PURE__ */ new WeakMap();
14400
+ _noHoverQueries = /* @__PURE__ */ new WeakMap();
14401
+ _hasNoHover = /* @__PURE__ */ new WeakMap();
14402
+ _builtTable = /* @__PURE__ */ new WeakMap();
14403
+ _syncedAssets = /* @__PURE__ */ new WeakMap();
14404
+ _pendingReplaces = /* @__PURE__ */ new WeakMap();
14405
+ _lastHeight = /* @__PURE__ */ new WeakMap();
14406
+ _containerSize = /* @__PURE__ */ new WeakMap();
14407
+ _lastRowCount = /* @__PURE__ */ new WeakMap();
14408
+ _rowCountHeld = /* @__PURE__ */ new WeakMap();
14409
+ _lastRowObserver = /* @__PURE__ */ new WeakMap();
14410
+ _layoutScrollbarWidth = /* @__PURE__ */ new WeakMap();
14411
+ _naturalWidths = /* @__PURE__ */ new WeakMap();
14412
+ _layoutPending = /* @__PURE__ */ new WeakMap();
14413
+ _fontsPending = /* @__PURE__ */ new WeakMap();
14414
+ _frameWidthObserver = /* @__PURE__ */ new WeakMap();
14415
+ CxContentBrowserTable.styles = [componentStyles, styles$1];
14416
+ CxContentBrowserTable.dependencies = {
14417
+ "cx-button": CxButton,
14418
+ "cx-content-browser-no-result": CxContentBrowserNoResult,
14419
+ "cx-icon": CxIcon,
14420
+ "cx-line-clamp": CxLineClamp,
14421
+ "cx-progress-bar": CxProgressBar,
14422
+ "cx-resize-observer": CxResizeObserver,
14423
+ "cx-table": CxTable
14424
+ };
14425
+ __decorateClass$1([
14426
+ e$7(".content-browser-table")
14427
+ ], CxContentBrowserTable.prototype, "containerEl", 2);
14428
+ __decorateClass$1([
14429
+ e$7("cx-table")
14430
+ ], CxContentBrowserTable.prototype, "tableEl", 2);
14431
+ __decorateClass$1([
14432
+ n$6({ attribute: "assets", reflect: false, type: Array })
14433
+ ], CxContentBrowserTable.prototype, "assets", 2);
14434
+ __decorateClass$1([
14435
+ n$6({ attribute: "columns", reflect: false, type: Array })
14436
+ ], CxContentBrowserTable.prototype, "columns", 2);
14437
+ __decorateClass$1([
14438
+ n$6({ attribute: "cta-text", reflect: false, type: String })
14439
+ ], CxContentBrowserTable.prototype, "ctaText", 2);
14440
+ __decorateClass$1([
14441
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
14442
+ ], CxContentBrowserTable.prototype, "ctaTextTransform", 2);
14443
+ __decorateClass$1([
14444
+ n$6({ attribute: "empty", reflect: true, type: Boolean })
14445
+ ], CxContentBrowserTable.prototype, "empty", 2);
14446
+ __decorateClass$1([
14447
+ n$6({ attribute: "error", reflect: true, type: Boolean })
14448
+ ], CxContentBrowserTable.prototype, "error", 2);
14449
+ __decorateClass$1([
14450
+ n$6({ attribute: "has-more", reflect: true, type: Boolean })
14451
+ ], CxContentBrowserTable.prototype, "hasMore", 2);
14452
+ __decorateClass$1([
14453
+ n$6({ attribute: "loading", reflect: true, type: Boolean })
14454
+ ], CxContentBrowserTable.prototype, "loading", 2);
14455
+ __decorateClass$1([
14456
+ n$6({ attribute: "selected-asset-id", reflect: true, type: String })
14457
+ ], CxContentBrowserTable.prototype, "selectedAssetId", 2);
14458
+ __decorateClass$1([
14459
+ n$6({ attribute: false })
14460
+ ], CxContentBrowserTable.prototype, "busyAssetId", 2);
14461
+ __decorateClass$1([
14462
+ n$6({ attribute: false })
14463
+ ], CxContentBrowserTable.prototype, "hiddenFields", 2);
14464
+ __decorateClass$1([
14465
+ n$6({ attribute: false })
14466
+ ], CxContentBrowserTable.prototype, "savedWidths", 2);
14467
+ __decorateClass$1([
14468
+ n$6({ attribute: false })
14469
+ ], CxContentBrowserTable.prototype, "widthScope", 2);
14470
+ __decorateClass$1([
14471
+ n$6({ attribute: "row-action-position", reflect: true })
14472
+ ], CxContentBrowserTable.prototype, "rowActionPosition", 2);
14473
+ __decorateClass$1([
14474
+ watch("assets")
14475
+ ], CxContentBrowserTable.prototype, "handleAssetsChange", 1);
14476
+ __decorateClass$1([
14477
+ watch("loading", { waitUntilFirstUpdate: true })
14478
+ ], CxContentBrowserTable.prototype, "handleLoadingChange", 1);
14479
+ __decorateClass$1([
14480
+ watch("selectedAssetId", { waitUntilFirstUpdate: true })
14481
+ ], CxContentBrowserTable.prototype, "handleSelectedAssetIdChange", 1);
14482
+ __decorateClass$1([
14483
+ watch("busyAssetId", { waitUntilFirstUpdate: true })
14484
+ ], CxContentBrowserTable.prototype, "handleBusyAssetIdChange", 1);
14485
+ __decorateClass$1([
14486
+ watch(["ctaText", "ctaTextTransform"], { waitUntilFirstUpdate: true })
14487
+ ], CxContentBrowserTable.prototype, "handleCtaTextChange", 1);
14488
+ CxContentBrowserTable = __decorateClass$1([
14489
+ customElement("cx-content-browser-table")
14490
+ ], CxContentBrowserTable);
12931
14491
  const appendPathAndQuery = (baseUrl, pathSuffix, extraQueryParams = []) => {
12932
14492
  const questionMarkIndex = baseUrl.indexOf("?");
12933
14493
  const hashIndex = baseUrl.indexOf("#");
@@ -13330,8 +14890,26 @@ function apiGetAssetsByIDs(_0) {
13330
14890
  }
13331
14891
  });
13332
14892
  }
14893
+ const ASSET_LIST_FIELDS = [
14894
+ DEFAULT_VIEW_SIZE,
14895
+ FIELD_DOC_TITLE,
14896
+ FIELD_DOC_TYPE,
14897
+ FIELD_EXTENSION,
14898
+ FIELD_FILE_SIZE,
14899
+ FIELD_IDENTIFIER,
14900
+ FIELD_KEYWORDS,
14901
+ FIELD_MAX_HEIGHT,
14902
+ FIELD_MAX_WIDTH,
14903
+ FIELD_RECORD_ID,
14904
+ FIELD_SUBTYPE,
14905
+ FIELD_TITLE_WITH_FALLBACK,
14906
+ FIELD_UPDATED_FILE_NAME,
14907
+ FIELD_STORAGE_GROUP,
14908
+ ORIGINAL_VIEW_SIZE
14909
+ ];
13333
14910
  function apiGetAssets(_0) {
13334
14911
  return __async(this, arguments, function* ({
14912
+ fields,
13335
14913
  folderId,
13336
14914
  isSeeThrough,
13337
14915
  limitedToDocTypes = [],
@@ -13342,25 +14920,17 @@ function apiGetAssets(_0) {
13342
14920
  start,
13343
14921
  useSession
13344
14922
  }) {
14923
+ var _a2;
14924
+ const validatedFields = (_a2 = fields == null ? void 0 : fields.filter((field) => field && typeof field === "string")) != null ? _a2 : [];
13345
14925
  try {
13346
14926
  const response = yield http.request({
13347
14927
  data: __spreadValues({
13348
14928
  Fields: [
13349
- DEFAULT_VIEW_SIZE,
13350
- FIELD_DOC_TITLE,
13351
- FIELD_DOC_TYPE,
13352
- FIELD_EXTENSION,
13353
- FIELD_FILE_SIZE,
13354
- FIELD_IDENTIFIER,
13355
- FIELD_KEYWORDS,
13356
- FIELD_MAX_HEIGHT,
13357
- FIELD_MAX_WIDTH,
13358
- FIELD_RECORD_ID,
13359
- FIELD_SUBTYPE,
13360
- FIELD_TITLE_WITH_FALLBACK,
13361
- FIELD_UPDATED_FILE_NAME,
13362
- FIELD_STORAGE_GROUP,
13363
- ORIGINAL_VIEW_SIZE
14929
+ ...ASSET_LIST_FIELDS,
14930
+ ...validatedFields.filter((field, index) => {
14931
+ const seen = [...ASSET_LIST_FIELDS, ...validatedFields.slice(0, index)];
14932
+ return !seen.some((item) => item.toLowerCase() === field.toLowerCase());
14933
+ })
13364
14934
  ],
13365
14935
  Limit: pageSize || void 0,
13366
14936
  LimitedToDocTypes: limitedToDocTypes,
@@ -13376,23 +14946,31 @@ function apiGetAssets(_0) {
13376
14946
  transformResponse: [
13377
14947
  ...Array.isArray(http.defaults.transformResponse) ? http.defaults.transformResponse : [],
13378
14948
  (rawResponse) => {
13379
- var _a2, _b2;
14949
+ var _a3, _b2;
13380
14950
  if (!isSearchResponse(rawResponse)) {
13381
14951
  return {
13382
14952
  facets: [],
13383
14953
  isError: true,
13384
14954
  items: [],
13385
- totalCount: 0
14955
+ totalCount: 0,
14956
+ unreadableFields: []
13386
14957
  };
13387
14958
  }
13388
- const mappedItems = (_b2 = (_a2 = rawResponse.contentItems) == null ? void 0 : _a2.map((item) => {
13389
- var _a3, _b3, _c2, _d2, _e3, _f2, _g, _h, _i, _j, _k, _l;
13390
- let extension = (_a3 = item.fields[FIELD_EXTENSION]) != null ? _a3 : "";
14959
+ const mappedItems = (_b2 = (_a3 = rawResponse.contentItems) == null ? void 0 : _a3.map((item) => {
14960
+ var _a4, _b3, _c2, _d2, _e3, _f2, _g, _h, _i, _j, _k, _l;
14961
+ let extension = (_a4 = item.fields[FIELD_EXTENSION]) != null ? _a4 : "";
13391
14962
  const name = resolveAssetCaption(item.fields);
13392
14963
  if (extension && !extension.startsWith(".")) {
13393
14964
  extension = "." + extension;
13394
14965
  }
13395
- return {
14966
+ return __spreadProps(__spreadValues({}, validatedFields.reduce((acc, field) => {
14967
+ var _a5, _b4;
14968
+ const sourceField = (_a5 = ASSET_LIST_FIELDS.find(
14969
+ (defaultField) => defaultField.toLowerCase() === field.toLowerCase()
14970
+ )) != null ? _a5 : field;
14971
+ acc[field] = (_b4 = item.fields[sourceField]) != null ? _b4 : "";
14972
+ return acc;
14973
+ }, {})), {
13396
14974
  allowATSLink: item.fields[FIELD_ALLOW_ATS_LINK] === "True",
13397
14975
  docSubType: (_b3 = item.fields[FIELD_SUBTYPE]) != null ? _b3 : "",
13398
14976
  docType: (_c2 = item.fields[FIELD_DOC_TYPE]) != null ? _c2 : "",
@@ -13409,13 +14987,14 @@ function apiGetAssets(_0) {
13409
14987
  size: (_j = item.fields[FIELD_FILE_SIZE]) != null ? _j : "0 MB",
13410
14988
  tags: (_k = item.fields[FIELD_KEYWORDS]) != null ? _k : "",
13411
14989
  width: (_l = item.fields[FIELD_MAX_WIDTH]) != null ? _l : "0"
13412
- };
14990
+ });
13413
14991
  })) != null ? _b2 : [];
13414
14992
  return {
13415
14993
  facets: rawResponse.facets,
13416
14994
  isError: false,
13417
14995
  items: mappedItems,
13418
- totalCount: rawResponse.totalCount
14996
+ totalCount: rawResponse.totalCount,
14997
+ unreadableFields: Array.isArray(rawResponse.unreadableFields) ? rawResponse.unreadableFields.filter((field) => typeof field === "string") : []
13419
14998
  };
13420
14999
  }
13421
15000
  ],
@@ -13427,7 +15006,8 @@ function apiGetAssets(_0) {
13427
15006
  facets: [],
13428
15007
  isError: true,
13429
15008
  items: [],
13430
- totalCount: 0
15009
+ totalCount: 0,
15010
+ unreadableFields: []
13431
15011
  };
13432
15012
  }
13433
15013
  });
@@ -13894,8 +15474,16 @@ var intersection = baseRest(function(arrays) {
13894
15474
  var mapped = arrayMap(arrays, castArrayLikeObject);
13895
15475
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
13896
15476
  });
15477
+ function narrowUnreadableFields(unreadableFields, page) {
15478
+ if (page.items.length === 0) {
15479
+ return unreadableFields;
15480
+ }
15481
+ const flagged = new Set(page.unreadableFields.map(toFieldKey));
15482
+ return unreadableFields.filter((field) => flagged.has(toFieldKey(field)));
15483
+ }
13897
15484
  class FetchAndMergeAssetsController {
13898
15485
  constructor(host, {
15486
+ additionalFields,
13899
15487
  availableDocTypes,
13900
15488
  baseUrl,
13901
15489
  bearerToken,
@@ -13922,6 +15510,7 @@ class FetchAndMergeAssetsController {
13922
15510
  this.facets = [];
13923
15511
  this.items = [];
13924
15512
  this.totalCount = 0;
15513
+ this.unreadableFields = [];
13925
15514
  this.lastRequest = null;
13926
15515
  this.failedRequest = null;
13927
15516
  this.sortOrders = {};
@@ -13947,6 +15536,7 @@ class FetchAndMergeAssetsController {
13947
15536
  __privateSet(this, _lastPage, null);
13948
15537
  this.host = host;
13949
15538
  this.availableDocTypes = availableDocTypes;
15539
+ this.additionalFields = additionalFields != null ? additionalFields : [];
13950
15540
  this.defaultFolderId = defaultFolderId;
13951
15541
  this.defaultIsSeeThrough = defaultIsSeeThrough;
13952
15542
  this.defaultSearchText = defaultSearchText;
@@ -14083,6 +15673,14 @@ class FetchAndMergeAssetsController {
14083
15673
  }
14084
15674
  this.host.requestUpdate();
14085
15675
  }
15676
+ /**
15677
+ * Table columns are host configuration and can be reconfigured after mount, unlike the rest of
15678
+ * these options — every later fetch must ask for the current field list, not the one that
15679
+ * happened to be set when the controller was constructed.
15680
+ */
15681
+ updateAdditionalFields(additionalFields) {
15682
+ this.additionalFields = additionalFields;
15683
+ }
14086
15684
  updateAuth(token2, useSession, bearerToken) {
14087
15685
  if (this.useSiteSession) {
14088
15686
  return;
@@ -14249,6 +15847,7 @@ class FetchAndMergeAssetsController {
14249
15847
  }
14250
15848
  }
14251
15849
  request = __spreadProps(__spreadValues({}, request), {
15850
+ fields: this.additionalFields,
14252
15851
  limitedToDocTypes: this.availableDocTypes
14253
15852
  });
14254
15853
  this.lastRequest = request;
@@ -14263,12 +15862,15 @@ class FetchAndMergeAssetsController {
14263
15862
  if (isRestart) {
14264
15863
  this.items = [];
14265
15864
  this.totalCount = 0;
15865
+ this.unreadableFields = [];
14266
15866
  }
14267
15867
  } else {
14268
15868
  if (isRestart) {
14269
15869
  this.items = assets.items;
15870
+ this.unreadableFields = assets.unreadableFields;
14270
15871
  } else {
14271
15872
  this.items = uniqBy([...this.items, ...assets.items], "recordId");
15873
+ this.unreadableFields = narrowUnreadableFields(this.unreadableFields, assets);
14272
15874
  }
14273
15875
  this.facets = this.mergeFacetsWithSelected(assets.facets, this.facets, request.selectedFacets);
14274
15876
  this.totalCount = assets.totalCount;
@@ -14490,6 +16092,7 @@ class FetchAndMergeAssetsController {
14490
16092
  searchError: this.failedRequest !== null,
14491
16093
  sortOrders: this.sortOrders,
14492
16094
  totalCount: this.totalCount,
16095
+ unreadableFields: this.unreadableFields,
14493
16096
  userInfo: this.userInfo
14494
16097
  });
14495
16098
  return __privateGet(this, _lastData);
@@ -14509,6 +16112,7 @@ class FetchAndMergeAssetsController {
14509
16112
  this.facets = [];
14510
16113
  this.items = [];
14511
16114
  this.totalCount = 0;
16115
+ this.unreadableFields = [];
14512
16116
  this.sortOrders = {};
14513
16117
  __privateSet(this, _lastPage, null);
14514
16118
  }
@@ -14527,6 +16131,251 @@ function safeInteger(value) {
14527
16131
  }
14528
16132
  return value;
14529
16133
  }
16134
+ const DATA_EXPIRE_TIME_POSTFIX = "_valid_until";
16135
+ const DEFAULT_EXPIRED_DURATION = 1 * 24 * 60 * 60 * 1e3;
16136
+ const isLocalStorageAvailable = () => {
16137
+ const mod = "test-storage";
16138
+ try {
16139
+ localStorage.setItem(mod, mod);
16140
+ localStorage.removeItem(mod);
16141
+ return true;
16142
+ } catch (e2) {
16143
+ return false;
16144
+ }
16145
+ };
16146
+ const isSessionStorageAvailable = () => {
16147
+ const mod = "test-storage";
16148
+ try {
16149
+ sessionStorage.setItem(mod, mod);
16150
+ sessionStorage.removeItem(mod);
16151
+ return true;
16152
+ } catch (e2) {
16153
+ return false;
16154
+ }
16155
+ };
16156
+ const isCookiesAvailable = () => {
16157
+ try {
16158
+ document.cookie = "test-cookie=test";
16159
+ const available = document.cookie.indexOf("test-cookie=test") !== -1;
16160
+ document.cookie = "test-cookie=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
16161
+ return available;
16162
+ } catch (e2) {
16163
+ return false;
16164
+ }
16165
+ };
16166
+ const isCustomStorageAvailable = () => {
16167
+ try {
16168
+ return !!window.OrangeDAMContentBrowser._customStorage && typeof window.OrangeDAMContentBrowser._customStorage.get === "function" && typeof window.OrangeDAMContentBrowser._customStorage.set === "function" && typeof window.OrangeDAMContentBrowser._customStorage.delete === "function";
16169
+ } catch (e2) {
16170
+ return false;
16171
+ }
16172
+ };
16173
+ const createCookie = (key, value, expireDate = null) => {
16174
+ let expires = "";
16175
+ if (expireDate) {
16176
+ expires = "; expires=" + expireDate;
16177
+ }
16178
+ document.cookie = key + "=" + value + expires + "; path=/";
16179
+ };
16180
+ const getCookie = (key) => {
16181
+ const nameEQ = key + "=";
16182
+ const ca = document.cookie.split(";");
16183
+ for (const c2 of ca) {
16184
+ const cookie = c2.trim();
16185
+ if (cookie.startsWith(nameEQ)) {
16186
+ return cookie.substring(nameEQ.length);
16187
+ }
16188
+ }
16189
+ return null;
16190
+ };
16191
+ const getData = (key, storageType) => __async(null, null, function* () {
16192
+ var _a2, _b2;
16193
+ if (!storageType) {
16194
+ let hasAvailableStorage = false;
16195
+ if (isCustomStorageAvailable()) {
16196
+ hasAvailableStorage = true;
16197
+ const result = yield getData(key, "CustomStorage");
16198
+ if (result !== null) return result;
16199
+ }
16200
+ if (isLocalStorageAvailable()) {
16201
+ hasAvailableStorage = true;
16202
+ const result = yield getData(key, "LocalStorage");
16203
+ if (result !== null) return result;
16204
+ }
16205
+ if (isSessionStorageAvailable()) {
16206
+ hasAvailableStorage = true;
16207
+ const result = yield getData(key, "SessionStorage");
16208
+ if (result !== null) return result;
16209
+ }
16210
+ if (isCookiesAvailable()) {
16211
+ hasAvailableStorage = true;
16212
+ const result = yield getData(key, "Cookies");
16213
+ if (result !== null) return result;
16214
+ }
16215
+ if (!hasAvailableStorage) {
16216
+ throw new Error("No storage is available");
16217
+ }
16218
+ return null;
16219
+ }
16220
+ switch (storageType) {
16221
+ case "CustomStorage":
16222
+ return !isCustomStorageAvailable() || (yield isValueExpired(key, "CustomStorage")) ? null : (_b2 = (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.get(key)) != null ? _b2 : null;
16223
+ case "SessionStorage":
16224
+ return !isSessionStorageAvailable() || (yield isValueExpired(key, "SessionStorage")) ? null : sessionStorage.getItem(key);
16225
+ case "Cookies":
16226
+ return !isCookiesAvailable() ? null : getCookie(key);
16227
+ case "LocalStorage":
16228
+ default:
16229
+ return !isLocalStorageAvailable() || (yield isValueExpired(key, "LocalStorage")) ? null : localStorage.getItem(key);
16230
+ }
16231
+ });
16232
+ const STORAGE_SEARCH_ORDER = ["CustomStorage", "LocalStorage", "SessionStorage", "Cookies"];
16233
+ const getPairedData = (key, pairedKey) => __async(null, null, function* () {
16234
+ for (const storageType of STORAGE_SEARCH_ORDER) {
16235
+ const value = yield getData(key, storageType);
16236
+ if (value !== null) {
16237
+ return [value, yield getData(pairedKey, storageType)];
16238
+ }
16239
+ }
16240
+ return null;
16241
+ });
16242
+ const isValueExpired = (key, type) => __async(null, null, function* () {
16243
+ if (key.endsWith(DATA_EXPIRE_TIME_POSTFIX)) {
16244
+ return false;
16245
+ }
16246
+ const dataExpireTimeKey = key + DATA_EXPIRE_TIME_POSTFIX;
16247
+ const expireDateStr = yield getData(dataExpireTimeKey, type);
16248
+ if (expireDateStr) {
16249
+ const expireDate = new Date(expireDateStr).getTime();
16250
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
16251
+ if (expireDate < currentTime) {
16252
+ deleteData(key);
16253
+ deleteData(dataExpireTimeKey);
16254
+ return true;
16255
+ }
16256
+ }
16257
+ return false;
16258
+ });
16259
+ const storeData = (key, value, storageType, ttl = 0) => {
16260
+ var _a2;
16261
+ const dataExpireTimeKey = key + DATA_EXPIRE_TIME_POSTFIX;
16262
+ const expireDate = /* @__PURE__ */ new Date();
16263
+ expireDate.setTime(expireDate.getTime() + (ttl || DEFAULT_EXPIRED_DURATION));
16264
+ const expireDateStr = expireDate.toUTCString();
16265
+ if (!storageType) {
16266
+ if (isCustomStorageAvailable()) {
16267
+ storageType = "CustomStorage";
16268
+ } else if (isLocalStorageAvailable()) {
16269
+ storageType = "LocalStorage";
16270
+ } else if (isSessionStorageAvailable()) {
16271
+ storageType = "SessionStorage";
16272
+ } else if (isCookiesAvailable()) {
16273
+ storageType = "Cookies";
16274
+ } else {
16275
+ throw new Error("No storage is available");
16276
+ }
16277
+ }
16278
+ switch (storageType) {
16279
+ case "CustomStorage":
16280
+ if (!isCustomStorageAvailable()) {
16281
+ throw new Error("CustomStorage is not available");
16282
+ }
16283
+ const set2 = (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.set;
16284
+ if (ttl) {
16285
+ set2(dataExpireTimeKey, expireDateStr);
16286
+ }
16287
+ return set2(key, value);
16288
+ case "SessionStorage":
16289
+ if (!isSessionStorageAvailable()) {
16290
+ throw new Error("SessionStorage is not available");
16291
+ }
16292
+ if (ttl) {
16293
+ sessionStorage.setItem(dataExpireTimeKey, expireDateStr);
16294
+ }
16295
+ return sessionStorage.setItem(key, value);
16296
+ case "Cookies":
16297
+ if (!isCookiesAvailable()) {
16298
+ throw new Error("Cookies are not available");
16299
+ }
16300
+ return createCookie(key, value, !ttl ? void 0 : expireDateStr);
16301
+ case "LocalStorage":
16302
+ default:
16303
+ if (!isLocalStorageAvailable()) {
16304
+ throw new Error("LocalStorage is not available");
16305
+ }
16306
+ if (ttl) {
16307
+ localStorage.setItem(dataExpireTimeKey, expireDateStr);
16308
+ }
16309
+ return localStorage.setItem(key, value);
16310
+ }
16311
+ };
16312
+ const deleteData = (key) => {
16313
+ var _a2;
16314
+ let hasAvailableStorage = false;
16315
+ if (isSessionStorageAvailable()) {
16316
+ sessionStorage.removeItem(key);
16317
+ hasAvailableStorage = true;
16318
+ }
16319
+ if (isLocalStorageAvailable()) {
16320
+ localStorage.removeItem(key);
16321
+ hasAvailableStorage = true;
16322
+ }
16323
+ if (isCookiesAvailable()) {
16324
+ document.cookie = key + "=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
16325
+ hasAvailableStorage = true;
16326
+ }
16327
+ if (isCustomStorageAvailable()) {
16328
+ (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.delete(key);
16329
+ hasAvailableStorage = true;
16330
+ }
16331
+ if (!hasAvailableStorage) {
16332
+ throw new Error("No storage is available");
16333
+ }
16334
+ };
16335
+ function tableColumnWidthsKey(siteUrl) {
16336
+ return `tableColumnWidths:${siteUrl.replace(/\/+$/, "")}`;
16337
+ }
16338
+ const parseTableColumnWidths = (raw) => {
16339
+ if (!raw) return {};
16340
+ try {
16341
+ const parsed = JSON.parse(raw);
16342
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
16343
+ const widths = {};
16344
+ for (const [field, width] of Object.entries(parsed)) {
16345
+ if (typeof width === "number" && Number.isFinite(width) && width > 0) {
16346
+ widths[field] = width;
16347
+ }
16348
+ }
16349
+ return widths;
16350
+ } catch (e2) {
16351
+ return {};
16352
+ }
16353
+ };
16354
+ function readTableColumnWidths(siteUrl) {
16355
+ return __async(this, null, function* () {
16356
+ try {
16357
+ return parseTableColumnWidths(yield getData(tableColumnWidthsKey(siteUrl)));
16358
+ } catch (e2) {
16359
+ return {};
16360
+ }
16361
+ });
16362
+ }
16363
+ function writeTableColumnWidth(siteUrl, field, width) {
16364
+ return __async(this, null, function* () {
16365
+ const widths = yield readTableColumnWidths(siteUrl);
16366
+ const pixels = width === void 0 ? 0 : Math.round(width);
16367
+ if (pixels > 0) {
16368
+ widths[field] = pixels;
16369
+ } else {
16370
+ delete widths[field];
16371
+ }
16372
+ try {
16373
+ storeData(tableColumnWidthsKey(siteUrl), JSON.stringify(widths));
16374
+ } catch (e2) {
16375
+ }
16376
+ return widths;
16377
+ });
16378
+ }
14530
16379
  const styles = i$7`
14531
16380
  :host {
14532
16381
  --cx-button-text-transform: none;
@@ -14569,6 +16418,9 @@ const styles = i$7`
14569
16418
  `;
14570
16419
  var __defProp2 = Object.defineProperty;
14571
16420
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
16421
+ var __typeError2 = (msg) => {
16422
+ throw TypeError(msg);
16423
+ };
14572
16424
  var __decorateClass = (decorators, target, key, kind) => {
14573
16425
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14574
16426
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
@@ -14577,11 +16429,35 @@ var __decorateClass = (decorators, target, key, kind) => {
14577
16429
  if (kind && result) __defProp2(target, key, result);
14578
16430
  return result;
14579
16431
  };
16432
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
16433
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), member.get(obj));
16434
+ var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError2("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
16435
+ var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
16436
+ var _openingAsset, _insertInFlight;
14580
16437
  const COMPUTED_FIELDS = ["ScrubUrl", "AllowATSLink"];
14581
16438
  const MOBILE_WIDTH_THRESHOLD = 480;
14582
16439
  const FORCE_OVERLAY_THRESHOLD = 650;
14583
16440
  const PERSISTENT_DRAWER_WIDTH = 400;
14584
16441
  const INITIAL_FOLDER_TIMEOUT_MS = 3e3;
16442
+ function resolvePageSize(view) {
16443
+ switch (view) {
16444
+ case GridView$1.Large:
16445
+ return 15;
16446
+ case GridView$1.Small:
16447
+ case TABLE_VIEW:
16448
+ return 30;
16449
+ default:
16450
+ return 20;
16451
+ }
16452
+ }
16453
+ const NO_HIDDEN_FIELDS = [];
16454
+ function findUnreadableColumnFields(columns, unreadableFields) {
16455
+ if (unreadableFields.length === 0) {
16456
+ return NO_HIDDEN_FIELDS;
16457
+ }
16458
+ const unreadable = new Set(unreadableFields.map(toFieldKey));
16459
+ return columns.map((column2) => column2.field).filter((field) => unreadable.has(toFieldKey(field)));
16460
+ }
14585
16461
  let CxContentBrowser = class extends CortexElement {
14586
16462
  constructor() {
14587
16463
  super(...arguments);
@@ -14608,6 +16484,7 @@ let CxContentBrowser = class extends CortexElement {
14608
16484
  this.canFavorite = false;
14609
16485
  this.canPinAsset = false;
14610
16486
  this.canUseProxies = false;
16487
+ this.autoSelectFormat = false;
14611
16488
  this.simplePick = false;
14612
16489
  this.canViewVersions = false;
14613
16490
  this.canTrack = false;
@@ -14616,6 +16493,12 @@ let CxContentBrowser = class extends CortexElement {
14616
16493
  this.ctaTextTransform = "capitalize";
14617
16494
  this.extraFields = [];
14618
16495
  this.defaultGridView = GridView$1.Medium;
16496
+ this.tableColumns = [];
16497
+ this.tableRowActionPosition = "host-edge";
16498
+ this.tableColumnWidths = {};
16499
+ this.tableWidthQueue = Promise.resolve();
16500
+ this.tableWidthTasks = 0;
16501
+ this.tableWidthsChangedInTable = false;
14619
16502
  this.defaultSortOrderName = "";
14620
16503
  this.defaultSortDirection = "ascending";
14621
16504
  this.defaultSelectedFacets = {};
@@ -14655,28 +16538,98 @@ let CxContentBrowser = class extends CortexElement {
14655
16538
  this.isMobile = false;
14656
16539
  this.defaultPageSize = 10;
14657
16540
  this.initialFolderPending = false;
16541
+ this.busyAssetId = void 0;
16542
+ __privateAdd2(this, _openingAsset, false);
16543
+ __privateAdd2(this, _insertInFlight, false);
14658
16544
  }
14659
16545
  willUpdate(changedProperties) {
14660
16546
  super.willUpdate(changedProperties);
14661
16547
  if (!this.hasUpdated) {
14662
- this.view = this.defaultGridView;
16548
+ this.view = this.defaultGridView === TABLE_VIEW && !this.canUseTable ? GridView$1.Medium : this.defaultGridView;
14663
16549
  }
14664
16550
  }
16551
+ /**
16552
+ * Never trust the host's value: it also arrives by direct property assignment, past the converter.
16553
+ * Entries are checked one by one, not just the outer array — `field` is dereferenced while the
16554
+ * fetch controller is being built, where a throw leaves the controller unassigned and the picker
16555
+ * blank. `title` is only rendered, and Lit renders a nullish one as nothing, so a column is not
16556
+ * worth dropping over it.
16557
+ */
16558
+ get tableColumnList() {
16559
+ const columns = this.tableColumns;
16560
+ if (!Array.isArray(columns)) {
16561
+ return [];
16562
+ }
16563
+ const seen = /* @__PURE__ */ new Set();
16564
+ return columns.flatMap((column2) => {
16565
+ if (!column2 || typeof column2 !== "object") {
16566
+ return [];
16567
+ }
16568
+ const { field } = column2;
16569
+ if (typeof field !== "string") {
16570
+ return [];
16571
+ }
16572
+ const trimmed = field.trim();
16573
+ if (trimmed.length === 0 || seen.has(trimmed.toLowerCase())) {
16574
+ return [];
16575
+ }
16576
+ seen.add(trimmed.toLowerCase());
16577
+ return [trimmed === field ? column2 : __spreadProps(__spreadValues({}, column2), { field: trimmed })];
16578
+ });
16579
+ }
16580
+ /**
16581
+ * This reads the configured columns, not the shown ones. The shown columns can change with each
16582
+ * response, and a table view that goes away with them flips the view and its page size. When
16583
+ * Cortex flags each column, the rows stay with only the filler and the CTA column.
16584
+ */
16585
+ get canUseTable() {
16586
+ return this.tableColumnList.length > 0;
16587
+ }
16588
+ /**
16589
+ * Runs a read or a write of the saved widths after the ones queued before it. The table gets the
16590
+ * map of the last task only: an earlier map does not hold the drags and resets that came after it,
16591
+ * and the table already shows them. A map for a site that is no longer the current one is dropped.
16592
+ */
16593
+ queueTableWidthTask(task) {
16594
+ const { baseUrl } = this;
16595
+ const taskNumber = this.tableWidthTasks + 1;
16596
+ this.tableWidthTasks = taskNumber;
16597
+ this.tableWidthQueue = this.tableWidthQueue.then(() => task(baseUrl)).then((widths) => {
16598
+ if (taskNumber === this.tableWidthTasks && baseUrl === this.baseUrl) {
16599
+ this.setTableColumnWidths(widths);
16600
+ }
16601
+ }).catch(() => void 0);
16602
+ }
16603
+ /**
16604
+ * A map with the same entries keeps the old one, so that the table does not lay out its columns
16605
+ * again. After a drag or a reset the table can show widths that the old map does not hold, so the
16606
+ * new map always replaces them.
16607
+ */
16608
+ setTableColumnWidths(widths) {
16609
+ const current2 = this.tableColumnWidths;
16610
+ const fields = Object.keys(widths);
16611
+ if (this.tableWidthsChangedInTable || fields.length !== Object.keys(current2).length || fields.some((field) => current2[field] !== widths[field])) {
16612
+ this.tableWidthsChangedInTable = false;
16613
+ this.tableColumnWidths = widths;
16614
+ }
16615
+ }
16616
+ loadTableColumnWidths() {
16617
+ this.queueTableWidthTask(readTableColumnWidths);
16618
+ }
16619
+ handleBaseUrlChangeForTableWidths() {
16620
+ this.loadTableColumnWidths();
16621
+ }
16622
+ handleTableColumnResize(event) {
16623
+ const { field, reset, width } = event.detail;
16624
+ this.tableWidthsChangedInTable = true;
16625
+ this.queueTableWidthTask((baseUrl) => writeTableColumnWidth(baseUrl, field, reset ? void 0 : width));
16626
+ }
14665
16627
  runFirstUpdated() {
14666
16628
  if (this.useSiteSession) {
14667
16629
  this.baseUrl = resolveSiteSessionUrl(this.baseUrl);
14668
16630
  }
14669
- switch (this.view) {
14670
- case GridView$1.Large:
14671
- this.defaultPageSize = 15;
14672
- break;
14673
- case GridView$1.Medium:
14674
- this.defaultPageSize = 20;
14675
- break;
14676
- case GridView$1.Small:
14677
- this.defaultPageSize = 30;
14678
- break;
14679
- }
16631
+ this.loadTableColumnWidths();
16632
+ this.defaultPageSize = resolvePageSize(this.view);
14680
16633
  this.lastRequest = __spreadProps(__spreadValues({}, this.lastRequest), {
14681
16634
  folderId: this.defaultFolderId,
14682
16635
  isSeeThrough: this.defaultIsSeeThrough,
@@ -14692,6 +16645,7 @@ let CxContentBrowser = class extends CortexElement {
14692
16645
  }
14693
16646
  this.updateComplete.then(() => {
14694
16647
  this.fetchAndMergeAssetsController = new FetchAndMergeAssetsController(this, {
16648
+ additionalFields: this.tableColumnList.map((column2) => column2.field),
14695
16649
  availableDocTypes: this.availableDocTypes,
14696
16650
  baseUrl: this.baseUrl,
14697
16651
  bearerToken: this.bearerToken,
@@ -14743,7 +16697,12 @@ let CxContentBrowser = class extends CortexElement {
14743
16697
  }
14744
16698
  openFormatDialog(id) {
14745
16699
  return __async(this, null, function* () {
16700
+ if (__privateGet2(this, _openingAsset) || __privateGet2(this, _insertInFlight)) {
16701
+ return;
16702
+ }
16703
+ __privateSet2(this, _openingAsset, true);
14746
16704
  this.selectedAssetId = id;
16705
+ this.busyAssetId = id;
14747
16706
  try {
14748
16707
  const asset = yield this.fetchAndMergeAssetsController.fetchAssetByID(id, {
14749
16708
  canFavorite: this.canFavorite,
@@ -14751,6 +16710,7 @@ let CxContentBrowser = class extends CortexElement {
14751
16710
  });
14752
16711
  if (!asset) {
14753
16712
  this.selectedAssetId = void 0;
16713
+ this.busyAssetId = void 0;
14754
16714
  return;
14755
16715
  }
14756
16716
  let isAssetPinned = false;
@@ -14761,8 +16721,14 @@ let CxContentBrowser = class extends CortexElement {
14761
16721
  isAssetPinned = lookupEvent.detail.isAssetPinned;
14762
16722
  }
14763
16723
  this.formatDialog.open(__spreadProps(__spreadValues({}, asset), { isAssetPinned }));
16724
+ if (this.formatDialog.isDialogOpen) {
16725
+ this.busyAssetId = void 0;
16726
+ }
14764
16727
  } catch (e2) {
14765
16728
  this.selectedAssetId = void 0;
16729
+ this.busyAssetId = void 0;
16730
+ } finally {
16731
+ __privateSet2(this, _openingAsset, false);
14766
16732
  }
14767
16733
  });
14768
16734
  }
@@ -14777,6 +16743,18 @@ let CxContentBrowser = class extends CortexElement {
14777
16743
  });
14778
16744
  });
14779
16745
  }
16746
+ handleTableColumnsChange() {
16747
+ if (!this.fetchAndMergeAssetsController) {
16748
+ return;
16749
+ }
16750
+ this.fetchAndMergeAssetsController.updateAdditionalFields(
16751
+ this.tableColumnList.map((column2) => column2.field)
16752
+ );
16753
+ this.lastRequest = __spreadProps(__spreadValues({}, this.lastRequest), { start: 0 });
16754
+ if (!this.initialFolderPending) {
16755
+ void this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest);
16756
+ }
16757
+ }
14780
16758
  handleAuthChange() {
14781
16759
  var _a2;
14782
16760
  (_a2 = this.fetchAndMergeAssetsController) == null ? void 0 : _a2.updateAuth(this.token, this.useSession, this.bearerToken);
@@ -14841,17 +16819,7 @@ let CxContentBrowser = class extends CortexElement {
14841
16819
  yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest);
14842
16820
  }
14843
16821
  }
14844
- switch (event.detail.view) {
14845
- case GridView$1.Large:
14846
- this.defaultPageSize = 15;
14847
- break;
14848
- case GridView$1.Medium:
14849
- this.defaultPageSize = 20;
14850
- break;
14851
- case GridView$1.Small:
14852
- this.defaultPageSize = 30;
14853
- break;
14854
- }
16822
+ this.defaultPageSize = resolvePageSize(event.detail.view);
14855
16823
  this.view = event.detail.view;
14856
16824
  });
14857
16825
  }
@@ -15013,15 +16981,17 @@ let CxContentBrowser = class extends CortexElement {
15013
16981
  selectedProxyMetadata: event.detail.selectedProxyMetadata
15014
16982
  });
15015
16983
  this.formatDialog.hide();
16984
+ this.busyAssetId = void 0;
15016
16985
  return;
15017
16986
  }
16987
+ __privateSet2(this, _insertInFlight, true);
15018
16988
  try {
15019
16989
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
15020
16990
  assets: [event.detail.asset],
15021
16991
  extraFields: this.extraFields
15022
16992
  }));
15023
16993
  if (response.isError) {
15024
- this.formatDialog.setLoadingConfirm(false);
16994
+ this.reportProxyConfirmFailure();
15025
16995
  return;
15026
16996
  }
15027
16997
  this.handleSelectedAsset({
@@ -15031,12 +17001,23 @@ let CxContentBrowser = class extends CortexElement {
15031
17001
  });
15032
17002
  this.formatDialog.hide();
15033
17003
  } catch (e2) {
15034
- this.formatDialog.setLoadingConfirm(false);
17004
+ this.reportProxyConfirmFailure();
17005
+ } finally {
17006
+ __privateSet2(this, _insertInFlight, false);
17007
+ this.busyAssetId = void 0;
15035
17008
  }
15036
17009
  });
15037
17010
  }
17011
+ reportProxyConfirmFailure() {
17012
+ if (this.formatDialog.isDialogOpen) {
17013
+ this.formatDialog.setLoadingConfirm(false);
17014
+ return;
17015
+ }
17016
+ this.formatDialog.revealAfterAutoConfirm();
17017
+ }
15038
17018
  handleFormatConfirm(event) {
15039
17019
  return __async(this, null, function* () {
17020
+ __privateSet2(this, _insertInFlight, true);
15040
17021
  try {
15041
17022
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
15042
17023
  assets: [event.detail.asset],
@@ -15055,6 +17036,9 @@ let CxContentBrowser = class extends CortexElement {
15055
17036
  this.formatDialog.hide();
15056
17037
  } catch (e2) {
15057
17038
  this.formatDialog.setLoadingConfirm(false);
17039
+ } finally {
17040
+ __privateSet2(this, _insertInFlight, false);
17041
+ this.busyAssetId = void 0;
15058
17042
  }
15059
17043
  });
15060
17044
  }
@@ -15133,6 +17117,7 @@ let CxContentBrowser = class extends CortexElement {
15133
17117
  searchError,
15134
17118
  sortOrders,
15135
17119
  totalCount,
17120
+ unreadableFields,
15136
17121
  userInfo
15137
17122
  } = this.fetchAndMergeAssetsController.getData({
15138
17123
  allowedExtensions: this.allowedExtensions,
@@ -15202,6 +17187,7 @@ let CxContentBrowser = class extends CortexElement {
15202
17187
  .newlyChangedOption=${this.newlyChangedOption}
15203
17188
  .sortOrders=${sortOrders}
15204
17189
  .views=${this.views}
17190
+ ?can-use-table=${this.canUseTable}
15205
17191
  ?is-mobile=${this.isMobile}
15206
17192
  ?is-see-through=${request == null ? void 0 : request.isSeeThrough}
15207
17193
  ?loading=${loading}
@@ -15217,23 +17203,55 @@ let CxContentBrowser = class extends CortexElement {
15217
17203
  @cx-content-browser-control-filter-change=${this.handleFilterChange}
15218
17204
  @cx-content-browser-control-bar-search-change=${this.handleSearchChange}
15219
17205
  ></cx-content-browser-control-bar>
15220
- <cx-content-browser-grid
15221
- .assets=${items}
15222
- ?empty=${!loading && !this.initialFolderPending && !searchError && items.length === 0}
15223
- ?error=${searchError}
15224
- ?has-more=${items.length < totalCount}
15225
- ?loading=${loading || this.initialFolderPending}
15226
- ?show-title=${this.showTitle}
15227
- ?show-size=${this.showSize}
15228
- ?show-dimensions=${this.showDimensions}
15229
- ?show-tags=${this.showTags}
15230
- selected-asset-id=${o$5(this.selectedAssetId || void 0)}
15231
- view=${this.view}
15232
- @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
15233
- @cx-content-browser-grid-resize=${this.handleGridResize}
15234
- @cx-content-browser-grid-retry=${this.handleRetry}
15235
- @cx-content-browser-grid-click=${this.handleGridClick}
15236
- ></cx-content-browser-grid>
17206
+ ${n$5(
17207
+ this.view === TABLE_VIEW && this.canUseTable,
17208
+ () => b`
17209
+ <cx-content-browser-table
17210
+ .busyAssetId=${this.busyAssetId}
17211
+ .assets=${items}
17212
+ .columns=${this.tableColumnList}
17213
+ .hiddenFields=${findUnreadableColumnFields(this.tableColumnList, unreadableFields)}
17214
+ .savedWidths=${this.tableColumnWidths}
17215
+ .widthScope=${this.baseUrl}
17216
+ row-action-position=${toTableRowActionPosition(this.tableRowActionPosition)}
17217
+ @cx-content-browser-table-column-resize=${this.handleTableColumnResize}
17218
+ ?empty=${!loading && !this.initialFolderPending && !searchError && items.length === 0}
17219
+ ?error=${searchError}
17220
+ cta-text=${this.ctaText}
17221
+ cta-text-transform=${this.ctaTextTransform}
17222
+ ?has-more=${items.length < totalCount}
17223
+ ?loading=${loading || this.initialFolderPending}
17224
+ selected-asset-id=${o$5(this.selectedAssetId || void 0)}
17225
+ @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
17226
+ @cx-content-browser-grid-resize=${this.handleGridResize}
17227
+ @cx-content-browser-grid-retry=${this.handleRetry}
17228
+ @cx-content-browser-grid-click=${this.handleGridClick}
17229
+ ></cx-content-browser-table>
17230
+ `,
17231
+ () => b`
17232
+ <cx-content-browser-grid
17233
+ .assets=${items}
17234
+ ?empty=${!loading && !this.initialFolderPending && !searchError && items.length === 0}
17235
+ ?error=${searchError}
17236
+ ?has-more=${items.length < totalCount}
17237
+ ?loading=${loading || this.initialFolderPending}
17238
+ ?show-title=${this.showTitle}
17239
+ ?show-size=${this.showSize}
17240
+ ?show-dimensions=${this.showDimensions}
17241
+ ?show-tags=${this.showTags}
17242
+ ?show-cta=${isAutoSelectFormatActive(this.autoSelectFormat)}
17243
+ .busyAssetId=${this.busyAssetId}
17244
+ cta-text=${this.ctaText}
17245
+ cta-text-transform=${this.ctaTextTransform}
17246
+ selected-asset-id=${o$5(this.selectedAssetId || void 0)}
17247
+ view=${this.view}
17248
+ @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
17249
+ @cx-content-browser-grid-resize=${this.handleGridResize}
17250
+ @cx-content-browser-grid-retry=${this.handleRetry}
17251
+ @cx-content-browser-grid-click=${this.handleGridClick}
17252
+ ></cx-content-browser-grid>
17253
+ `
17254
+ )}
15237
17255
  </cx-resize-observer>
15238
17256
  <cx-content-browser-format-dialog
15239
17257
  .availableExtensions=${availableExtensions}
@@ -15246,6 +17264,7 @@ let CxContentBrowser = class extends CortexElement {
15246
17264
  cta-text-transform=${this.ctaTextTransform}
15247
17265
  variant=${this.isMobile ? ContentBrowserFormatDialogVariant.Drawer : ContentBrowserFormatDialogVariant.Dialog}
15248
17266
  token=${this.useSiteSession ? "" : this.token}
17267
+ .autoSelectFormat=${this.autoSelectFormat}
15249
17268
  ?can-custom-format=${!!(parameters == null ? void 0 : parameters.ATSEnabled)}
15250
17269
  ?can-favorite=${this.canFavorite}
15251
17270
  ?can-pin-asset=${this.canPinAsset}
@@ -15265,6 +17284,8 @@ let CxContentBrowser = class extends CortexElement {
15265
17284
  `;
15266
17285
  }
15267
17286
  };
17287
+ _openingAsset = /* @__PURE__ */ new WeakMap();
17288
+ _insertInFlight = /* @__PURE__ */ new WeakMap();
15268
17289
  CxContentBrowser.styles = [componentStyles, styles];
15269
17290
  CxContentBrowser.dependencies = {
15270
17291
  "cx-content-browser-browser": CxContentBrowserBrowser,
@@ -15273,6 +17294,7 @@ CxContentBrowser.dependencies = {
15273
17294
  "cx-content-browser-grid": CxContentBrowserGrid,
15274
17295
  "cx-content-browser-header": CxContentBrowserHeader,
15275
17296
  "cx-content-browser-no-result": CxContentBrowserNoResult,
17297
+ "cx-content-browser-table": CxContentBrowserTable,
15276
17298
  "cx-icon": CxIcon,
15277
17299
  "cx-icon-button": CxIconButton,
15278
17300
  "cx-resize-observer": CxResizeObserver,
@@ -15367,6 +17389,9 @@ __decorateClass([
15367
17389
  __decorateClass([
15368
17390
  n$6({ attribute: "can-use-proxies", reflect: true, type: Boolean })
15369
17391
  ], CxContentBrowser.prototype, "canUseProxies", 2);
17392
+ __decorateClass([
17393
+ n$6({ attribute: "auto-select-format", converter: autoSelectFormatConverter, reflect: false })
17394
+ ], CxContentBrowser.prototype, "autoSelectFormat", 2);
15370
17395
  __decorateClass([
15371
17396
  n$6({ attribute: "simple-pick", reflect: true, type: Boolean })
15372
17397
  ], CxContentBrowser.prototype, "simplePick", 2);
@@ -15399,6 +17424,38 @@ __decorateClass([
15399
17424
  __decorateClass([
15400
17425
  n$6({ attribute: "default-grid-view", type: String })
15401
17426
  ], CxContentBrowser.prototype, "defaultGridView", 2);
17427
+ __decorateClass([
17428
+ n$6({
17429
+ attribute: "table-columns",
17430
+ /**
17431
+ * Lit's stock Array converter returns `null` for anything `JSON.parse` rejects, and a host that
17432
+ * stringifies an array into the attribute hands it `""` or `"[object Object]"`. `null` then
17433
+ * throws on every read below, taking the whole picker down. An unreadable value means "no
17434
+ * columns", which turns the table view off — the same outcome as not configuring one.
17435
+ */
17436
+ converter: {
17437
+ fromAttribute: (value) => {
17438
+ if (!value) {
17439
+ return [];
17440
+ }
17441
+ try {
17442
+ const parsed = JSON.parse(value);
17443
+ return Array.isArray(parsed) ? parsed : [];
17444
+ } catch (e2) {
17445
+ return [];
17446
+ }
17447
+ },
17448
+ toAttribute: (value) => JSON.stringify(value != null ? value : [])
17449
+ },
17450
+ type: Array
17451
+ })
17452
+ ], CxContentBrowser.prototype, "tableColumns", 2);
17453
+ __decorateClass([
17454
+ n$6({ attribute: "table-row-action-position", type: String })
17455
+ ], CxContentBrowser.prototype, "tableRowActionPosition", 2);
17456
+ __decorateClass([
17457
+ r$6()
17458
+ ], CxContentBrowser.prototype, "tableColumnWidths", 2);
15402
17459
  __decorateClass([
15403
17460
  n$6({ attribute: "default-sort-order-name", type: String })
15404
17461
  ], CxContentBrowser.prototype, "defaultSortOrderName", 2);
@@ -15469,8 +17526,17 @@ __decorateClass([
15469
17526
  r$6()
15470
17527
  ], CxContentBrowser.prototype, "initialFolderPending", 2);
15471
17528
  __decorateClass([
15472
- watch("lastRequest", { waitUntilFirstUpdate: true })
17529
+ watch("baseUrl", { waitUntilFirstUpdate: true })
17530
+ ], CxContentBrowser.prototype, "handleBaseUrlChangeForTableWidths", 1);
17531
+ __decorateClass([
17532
+ r$6()
17533
+ ], CxContentBrowser.prototype, "busyAssetId", 2);
17534
+ __decorateClass([
17535
+ watch(["lastRequest", "view"], { waitUntilFirstUpdate: true })
15473
17536
  ], CxContentBrowser.prototype, "handleLastRequestChange", 1);
17537
+ __decorateClass([
17538
+ watch("tableColumns", { waitUntilFirstUpdate: true })
17539
+ ], CxContentBrowser.prototype, "handleTableColumnsChange", 1);
15474
17540
  __decorateClass([
15475
17541
  watch(["token", "useSession", "bearerToken"], { waitUntilFirstUpdate: true })
15476
17542
  ], CxContentBrowser.prototype, "handleAuthChange", 1);
@@ -29649,7 +31715,10 @@ const GlobalConfigContext = reactExports.createContext({
29649
31715
  allowFavorites: false,
29650
31716
  allowPin: false,
29651
31717
  allowFormatDialogPin: false,
29652
- defaultGridView: ""
31718
+ defaultGridView: "",
31719
+ autoSelectFormat: false,
31720
+ tableColumns: [],
31721
+ tableRowActionPosition: "host-edge"
29653
31722
  });
29654
31723
  function formatProdErrorMessage$1(code) {
29655
31724
  return `Minified Redux error #${code}; visit https://redux.js.org/Errors?code=${code} for the full message or use the non-minified dev environment for full errors. `;
@@ -31681,207 +33750,6 @@ const getRequestUrl = (hostUrl, path, token2) => {
31681
33750
  }
31682
33751
  return url.href;
31683
33752
  };
31684
- const DATA_EXPIRE_TIME_POSTFIX = "_valid_until";
31685
- const DEFAULT_EXPIRED_DURATION = 1 * 24 * 60 * 60 * 1e3;
31686
- const isLocalStorageAvailable = () => {
31687
- const mod = "test-storage";
31688
- try {
31689
- localStorage.setItem(mod, mod);
31690
- localStorage.removeItem(mod);
31691
- return true;
31692
- } catch (e2) {
31693
- return false;
31694
- }
31695
- };
31696
- const isSessionStorageAvailable = () => {
31697
- const mod = "test-storage";
31698
- try {
31699
- sessionStorage.setItem(mod, mod);
31700
- sessionStorage.removeItem(mod);
31701
- return true;
31702
- } catch (e2) {
31703
- return false;
31704
- }
31705
- };
31706
- const isCookiesAvailable = () => {
31707
- try {
31708
- document.cookie = "test-cookie=test";
31709
- const available = document.cookie.indexOf("test-cookie=test") !== -1;
31710
- document.cookie = "test-cookie=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
31711
- return available;
31712
- } catch (e2) {
31713
- return false;
31714
- }
31715
- };
31716
- const isCustomStorageAvailable = () => {
31717
- try {
31718
- return !!window.OrangeDAMContentBrowser._customStorage && typeof window.OrangeDAMContentBrowser._customStorage.get === "function" && typeof window.OrangeDAMContentBrowser._customStorage.set === "function" && typeof window.OrangeDAMContentBrowser._customStorage.delete === "function";
31719
- } catch (e2) {
31720
- return false;
31721
- }
31722
- };
31723
- const createCookie = (key, value, expireDate = null) => {
31724
- let expires = "";
31725
- if (expireDate) {
31726
- expires = "; expires=" + expireDate;
31727
- }
31728
- document.cookie = key + "=" + value + expires + "; path=/";
31729
- };
31730
- const getCookie = (key) => {
31731
- const nameEQ = key + "=";
31732
- const ca = document.cookie.split(";");
31733
- for (const c2 of ca) {
31734
- const cookie = c2.trim();
31735
- if (cookie.startsWith(nameEQ)) {
31736
- return cookie.substring(nameEQ.length);
31737
- }
31738
- }
31739
- return null;
31740
- };
31741
- const getData = (key, storageType) => __async(null, null, function* () {
31742
- var _a2, _b2;
31743
- if (!storageType) {
31744
- let hasAvailableStorage = false;
31745
- if (isCustomStorageAvailable()) {
31746
- hasAvailableStorage = true;
31747
- const result = yield getData(key, "CustomStorage");
31748
- if (result !== null) return result;
31749
- }
31750
- if (isLocalStorageAvailable()) {
31751
- hasAvailableStorage = true;
31752
- const result = yield getData(key, "LocalStorage");
31753
- if (result !== null) return result;
31754
- }
31755
- if (isSessionStorageAvailable()) {
31756
- hasAvailableStorage = true;
31757
- const result = yield getData(key, "SessionStorage");
31758
- if (result !== null) return result;
31759
- }
31760
- if (isCookiesAvailable()) {
31761
- hasAvailableStorage = true;
31762
- const result = yield getData(key, "Cookies");
31763
- if (result !== null) return result;
31764
- }
31765
- if (!hasAvailableStorage) {
31766
- throw new Error("No storage is available");
31767
- }
31768
- return null;
31769
- }
31770
- switch (storageType) {
31771
- case "CustomStorage":
31772
- return !isCustomStorageAvailable() || (yield isValueExpired(key, "CustomStorage")) ? null : (_b2 = (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.get(key)) != null ? _b2 : null;
31773
- case "SessionStorage":
31774
- return !isSessionStorageAvailable() || (yield isValueExpired(key, "SessionStorage")) ? null : sessionStorage.getItem(key);
31775
- case "Cookies":
31776
- return !isCookiesAvailable() ? null : getCookie(key);
31777
- case "LocalStorage":
31778
- default:
31779
- return !isLocalStorageAvailable() || (yield isValueExpired(key, "LocalStorage")) ? null : localStorage.getItem(key);
31780
- }
31781
- });
31782
- const STORAGE_SEARCH_ORDER = ["CustomStorage", "LocalStorage", "SessionStorage", "Cookies"];
31783
- const getPairedData = (key, pairedKey) => __async(null, null, function* () {
31784
- for (const storageType of STORAGE_SEARCH_ORDER) {
31785
- const value = yield getData(key, storageType);
31786
- if (value !== null) {
31787
- return [value, yield getData(pairedKey, storageType)];
31788
- }
31789
- }
31790
- return null;
31791
- });
31792
- const isValueExpired = (key, type) => __async(null, null, function* () {
31793
- if (key.endsWith(DATA_EXPIRE_TIME_POSTFIX)) {
31794
- return false;
31795
- }
31796
- const dataExpireTimeKey = key + DATA_EXPIRE_TIME_POSTFIX;
31797
- const expireDateStr = yield getData(dataExpireTimeKey, type);
31798
- if (expireDateStr) {
31799
- const expireDate = new Date(expireDateStr).getTime();
31800
- const currentTime = (/* @__PURE__ */ new Date()).getTime();
31801
- if (expireDate < currentTime) {
31802
- deleteData(key);
31803
- deleteData(dataExpireTimeKey);
31804
- return true;
31805
- }
31806
- }
31807
- return false;
31808
- });
31809
- const storeData = (key, value, storageType, ttl = 0) => {
31810
- var _a2;
31811
- const dataExpireTimeKey = key + DATA_EXPIRE_TIME_POSTFIX;
31812
- const expireDate = /* @__PURE__ */ new Date();
31813
- expireDate.setTime(expireDate.getTime() + (ttl || DEFAULT_EXPIRED_DURATION));
31814
- const expireDateStr = expireDate.toUTCString();
31815
- if (!storageType) {
31816
- if (isCustomStorageAvailable()) {
31817
- storageType = "CustomStorage";
31818
- } else if (isLocalStorageAvailable()) {
31819
- storageType = "LocalStorage";
31820
- } else if (isSessionStorageAvailable()) {
31821
- storageType = "SessionStorage";
31822
- } else if (isCookiesAvailable()) {
31823
- storageType = "Cookies";
31824
- } else {
31825
- throw new Error("No storage is available");
31826
- }
31827
- }
31828
- switch (storageType) {
31829
- case "CustomStorage":
31830
- if (!isCustomStorageAvailable()) {
31831
- throw new Error("CustomStorage is not available");
31832
- }
31833
- const set2 = (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.set;
31834
- if (ttl) {
31835
- set2(dataExpireTimeKey, expireDateStr);
31836
- }
31837
- return set2(key, value);
31838
- case "SessionStorage":
31839
- if (!isSessionStorageAvailable()) {
31840
- throw new Error("SessionStorage is not available");
31841
- }
31842
- if (ttl) {
31843
- sessionStorage.setItem(dataExpireTimeKey, expireDateStr);
31844
- }
31845
- return sessionStorage.setItem(key, value);
31846
- case "Cookies":
31847
- if (!isCookiesAvailable()) {
31848
- throw new Error("Cookies are not available");
31849
- }
31850
- return createCookie(key, value, !ttl ? void 0 : expireDateStr);
31851
- case "LocalStorage":
31852
- default:
31853
- if (!isLocalStorageAvailable()) {
31854
- throw new Error("LocalStorage is not available");
31855
- }
31856
- if (ttl) {
31857
- localStorage.setItem(dataExpireTimeKey, expireDateStr);
31858
- }
31859
- return localStorage.setItem(key, value);
31860
- }
31861
- };
31862
- const deleteData = (key) => {
31863
- var _a2;
31864
- let hasAvailableStorage = false;
31865
- if (isSessionStorageAvailable()) {
31866
- sessionStorage.removeItem(key);
31867
- hasAvailableStorage = true;
31868
- }
31869
- if (isLocalStorageAvailable()) {
31870
- localStorage.removeItem(key);
31871
- hasAvailableStorage = true;
31872
- }
31873
- if (isCookiesAvailable()) {
31874
- document.cookie = key + "=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
31875
- hasAvailableStorage = true;
31876
- }
31877
- if (isCustomStorageAvailable()) {
31878
- (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.delete(key);
31879
- hasAvailableStorage = true;
31880
- }
31881
- if (!hasAvailableStorage) {
31882
- throw new Error("No storage is available");
31883
- }
31884
- };
31885
33753
  const E_CANCELED = new Error("request for lock canceled");
31886
33754
  var __awaiter$2 = function(thisArg, _arguments, P2, generator) {
31887
33755
  function adopt(value) {
@@ -32569,6 +34437,9 @@ var GridView = /* @__PURE__ */ ((GridView2) => {
32569
34437
  function isPromise(value) {
32570
34438
  return typeof value === "object" && value !== null && typeof value.then === "function";
32571
34439
  }
34440
+ function isSupportedView(view) {
34441
+ return view === TABLE_VIEW || Object.values(GridView).includes(view);
34442
+ }
32572
34443
  function parseSelectedFacets(selectedFilter) {
32573
34444
  var _a2;
32574
34445
  if (!selectedFilter) {
@@ -32631,7 +34502,10 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32631
34502
  pluginInfo,
32632
34503
  showCollections,
32633
34504
  showFavoriteFolder,
32634
- showVersions
34505
+ showVersions,
34506
+ tableColumns,
34507
+ tableRowActionPosition,
34508
+ autoSelectFormat
32635
34509
  } = reactExports.useContext(GlobalConfigContext);
32636
34510
  const {
32637
34511
  extraFields,
@@ -32648,7 +34522,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32648
34522
  const [defaultSettings, setDefaultSettings] = reactExports.useState({
32649
34523
  sortOrder: "",
32650
34524
  sortDirection: "",
32651
- view: Object.values(GridView).includes(defaultGridView) ? defaultGridView : GridView.Medium,
34525
+ view: isSupportedView(defaultGridView) ? defaultGridView : GridView.Medium,
32652
34526
  facets: [],
32653
34527
  selectedFacets: {},
32654
34528
  isSeeThrough: true,
@@ -32802,6 +34676,7 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32802
34676
  appDispatch(logout());
32803
34677
  }, [appDispatch]);
32804
34678
  reactExports.useEffect(() => {
34679
+ let cancelled = false;
32805
34680
  Promise.all([
32806
34681
  getData("selectedSortOrder"),
32807
34682
  getData("selectedSortDirection"),
@@ -32825,10 +34700,13 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32825
34700
  lastLocationFolderId,
32826
34701
  lastLocationFolderTitle
32827
34702
  ]) => {
34703
+ if (cancelled) {
34704
+ return;
34705
+ }
32828
34706
  const newDefaultSettings = {
32829
34707
  sortOrder: sortOrder || "",
32830
34708
  sortDirection: ["ascending", "descending"].includes(sortDirection) ? sortDirection : void 0,
32831
- view: view || defaultSettings.view,
34709
+ view: isSupportedView(defaultGridView) ? defaultGridView : view && isSupportedView(view) ? view : GridView.Medium,
32832
34710
  selectedFacets: parseSelectedFacets(selectedFilter),
32833
34711
  isSeeThrough: selectedIsSeeThrough === null ? true : selectedIsSeeThrough === "true",
32834
34712
  searchText: searchText || ""
@@ -32847,7 +34725,10 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32847
34725
  loadedFromStorage.current = true;
32848
34726
  setIsInitialLoadComplete(true);
32849
34727
  });
32850
- }, [lastLocationMode, defaultGridView, defaultSettings.view]);
34728
+ return () => {
34729
+ cancelled = true;
34730
+ };
34731
+ }, [lastLocationMode, defaultGridView]);
32851
34732
  if (!isInitialLoadComplete) {
32852
34733
  return /* @__PURE__ */ jsxRuntimeExports.jsx("cx-content-browser-loader", {});
32853
34734
  }
@@ -32861,6 +34742,9 @@ const AssetsPicker = reactExports.forwardRef(function AssetsPicker2({ accessToke
32861
34742
  "available-doc-types": availableDocTypes,
32862
34743
  "available-representative-subtypes": availableRepresentativeSubtypes,
32863
34744
  "default-grid-view": defaultSettings.view,
34745
+ "table-columns": tableColumns != null ? tableColumns : [],
34746
+ "table-row-action-position": tableRowActionPosition != null ? tableRowActionPosition : "host-edge",
34747
+ "auto-select-format": autoSelectFormat != null ? autoSelectFormat : false,
32864
34748
  "default-sort-order-name": defaultSettings.sortOrder,
32865
34749
  "default-sort-direction": defaultSettings.sortDirection,
32866
34750
  "default-facets": defaultSettings.facets,
@@ -33550,6 +35434,12 @@ const ContentBrowser = {
33550
35434
  lastLocationMode: true, // Whether to open the last selected folder on load
33551
35435
  allowTracking: true, // Whether to enable tracking parameters for asset URLs
33552
35436
  allowFormatDialogPin: true, // Whether to show pin/unpin actions in format dialog
35437
+ tableColumns: [ // Columns of the table view; omit to offer grid views only
35438
+ { title: "Identifier", field: "CoreField.Identifier" },
35439
+ { title: "Title", field: "CoreField.TitleWithFallback" },
35440
+ { title: "Description", field: "Document.CaptionLong" },
35441
+ ],
35442
+ tableRowActionPosition: "host-edge", // Where the table row action shows: host-edge or row-end
33553
35443
  });`);
33554
35444
  },
33555
35445
  open: (_0) => __async(null, [_0], function* ({
@@ -33600,7 +35490,10 @@ const ContentBrowser = {
33600
35490
  showVersions,
33601
35491
  useSession,
33602
35492
  useSiteSession = false,
33603
- defaultGridView
35493
+ defaultGridView,
35494
+ tableColumns,
35495
+ tableRowActionPosition,
35496
+ autoSelectFormat
33604
35497
  }) {
33605
35498
  var _a2;
33606
35499
  const siteSessionUrl = useSiteSession ? resolveSiteSessionUrl(baseUrl) : void 0;
@@ -33708,7 +35601,10 @@ const ContentBrowser = {
33708
35601
  allowProxy: simplePick ? false : allowProxy !== void 0 ? !!allowProxy : true,
33709
35602
  simplePick: !!simplePick,
33710
35603
  allowFavorites: !!allowFavorites,
33711
- defaultGridView: defaultGridView != null ? defaultGridView : ""
35604
+ defaultGridView: defaultGridView != null ? defaultGridView : "",
35605
+ autoSelectFormat: autoSelectFormat != null ? autoSelectFormat : false,
35606
+ tableColumns: tableColumns != null ? tableColumns : [],
35607
+ tableRowActionPosition: tableRowActionPosition != null ? tableRowActionPosition : "host-edge"
33712
35608
  },
33713
35609
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
33714
35610
  App,