@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
@@ -147,6 +147,7 @@ import CxResizeObserver from "@orangelogic/design-system/components/resize-obser
147
147
  import CxArrayLineClamp from "@orangelogic/design-system/components/array-line-clamp";
148
148
  import CxCard from "@orangelogic/design-system/components/card";
149
149
  import CxCheckbox from "@orangelogic/design-system/components/checkbox";
150
+ import CxColorSwatchGroup from "@orangelogic/design-system/components/color-swatch-group";
150
151
  /**
151
152
  * @license
152
153
  * Copyright 2019 Google LLC
@@ -1165,13 +1166,13 @@ var camelCase = createCompounder(function(result, word, index) {
1165
1166
  word = word.toLowerCase();
1166
1167
  return result + (index ? capitalize(word) : word);
1167
1168
  });
1168
- var __defProp$h = Object.defineProperty;
1169
- var __decorateClass$h = (decorators, target, key, kind) => {
1169
+ var __defProp$i = Object.defineProperty;
1170
+ var __decorateClass$i = (decorators, target, key, kind) => {
1170
1171
  var result = void 0;
1171
1172
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
1172
1173
  if (decorator = decorators[i4])
1173
1174
  result = decorator(target, key, result) || result;
1174
- if (result) __defProp$h(target, key, result);
1175
+ if (result) __defProp$i(target, key, result);
1175
1176
  return result;
1176
1177
  };
1177
1178
  const _CortexElement = class _CortexElement extends i$4 {
@@ -1298,16 +1299,16 @@ const _CortexElement = class _CortexElement extends i$4 {
1298
1299
  _CortexElement.version = "1";
1299
1300
  _CortexElement.dependencies = {};
1300
1301
  let CortexElement = _CortexElement;
1301
- __decorateClass$h([
1302
+ __decorateClass$i([
1302
1303
  n$6()
1303
1304
  ], CortexElement.prototype, "dir");
1304
- __decorateClass$h([
1305
+ __decorateClass$i([
1305
1306
  n$6()
1306
1307
  ], CortexElement.prototype, "lang");
1307
- __decorateClass$h([
1308
+ __decorateClass$i([
1308
1309
  n$6()
1309
1310
  ], CortexElement.prototype, "theme");
1310
- __decorateClass$h([
1311
+ __decorateClass$i([
1311
1312
  n$6({ attribute: "pre-render", type: Boolean })
1312
1313
  ], CortexElement.prototype, "preRender");
1313
1314
  function rescueElementPrototype(element) {
@@ -5750,7 +5751,7 @@ function watch(propertyName, options) {
5750
5751
  };
5751
5752
  };
5752
5753
  }
5753
- const styles$e = i$7`
5754
+ const styles$f = i$7`
5754
5755
  :host {
5755
5756
  display: contents;
5756
5757
  }
@@ -5839,14 +5840,14 @@ const styles$e = i$7`
5839
5840
  display: block;
5840
5841
  }
5841
5842
  `;
5842
- var __defProp$g = Object.defineProperty;
5843
- var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
5844
- var __decorateClass$g = (decorators, target, key, kind) => {
5845
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
5843
+ var __defProp$h = Object.defineProperty;
5844
+ var __getOwnPropDesc$h = Object.getOwnPropertyDescriptor;
5845
+ var __decorateClass$h = (decorators, target, key, kind) => {
5846
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$h(target, key) : target;
5846
5847
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
5847
5848
  if (decorator = decorators[i4])
5848
5849
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
5849
- if (kind && result) __defProp$g(target, key, result);
5850
+ if (kind && result) __defProp$h(target, key, result);
5850
5851
  return result;
5851
5852
  };
5852
5853
  const LIBRARY_FOLDER_TITLE = "Library";
@@ -6115,7 +6116,7 @@ let CxContentBrowserBrowser = class extends CortexElement {
6115
6116
  `;
6116
6117
  }
6117
6118
  };
6118
- CxContentBrowserBrowser.styles = [componentStyles, styles$e];
6119
+ CxContentBrowserBrowser.styles = [componentStyles, styles$f];
6119
6120
  CxContentBrowserBrowser.dependencies = {
6120
6121
  "cx-drawer": CxDrawer,
6121
6122
  "cx-folder-select": CxFolderSelect,
@@ -6125,70 +6126,70 @@ CxContentBrowserBrowser.dependencies = {
6125
6126
  "cx-tooltip": CxTooltip,
6126
6127
  "cx-typography": CxTypography
6127
6128
  };
6128
- __decorateClass$g([
6129
+ __decorateClass$h([
6129
6130
  e$7(".drawer-trigger")
6130
6131
  ], CxContentBrowserBrowser.prototype, "trigger", 2);
6131
- __decorateClass$g([
6132
+ __decorateClass$h([
6132
6133
  e$7(".content-browser-browser")
6133
6134
  ], CxContentBrowserBrowser.prototype, "drawer", 2);
6134
- __decorateClass$g([
6135
+ __decorateClass$h([
6135
6136
  n$6({ attribute: "folder-id", type: String })
6136
6137
  ], CxContentBrowserBrowser.prototype, "folderId", 2);
6137
- __decorateClass$g([
6138
+ __decorateClass$h([
6138
6139
  n$6({ attribute: "folder-title", type: String })
6139
6140
  ], CxContentBrowserBrowser.prototype, "folderTitle", 2);
6140
- __decorateClass$g([
6141
+ __decorateClass$h([
6141
6142
  n$6({ attribute: "allowed-folders", type: Array })
6142
6143
  ], CxContentBrowserBrowser.prototype, "allowedFolders", 2);
6143
- __decorateClass$g([
6144
+ __decorateClass$h([
6144
6145
  n$6({ attribute: "can-pin", type: Boolean })
6145
6146
  ], CxContentBrowserBrowser.prototype, "canPin", 2);
6146
- __decorateClass$g([
6147
+ __decorateClass$h([
6147
6148
  n$6({ attribute: "collection-path", type: String })
6148
6149
  ], CxContentBrowserBrowser.prototype, "collectionPath", 2);
6149
- __decorateClass$g([
6150
+ __decorateClass$h([
6150
6151
  n$6({ attribute: "favorite-folder-id", type: String })
6151
6152
  ], CxContentBrowserBrowser.prototype, "favoriteFolderId", 2);
6152
- __decorateClass$g([
6153
+ __decorateClass$h([
6153
6154
  n$6({ attribute: "show-collections", type: Boolean })
6154
6155
  ], CxContentBrowserBrowser.prototype, "showCollections", 2);
6155
- __decorateClass$g([
6156
+ __decorateClass$h([
6156
6157
  n$6({ attribute: "show-favorite-folder", type: Boolean })
6157
6158
  ], CxContentBrowserBrowser.prototype, "showFavoriteFolder", 2);
6158
- __decorateClass$g([
6159
+ __decorateClass$h([
6159
6160
  n$6({ attribute: "force-overlay", type: Boolean })
6160
6161
  ], CxContentBrowserBrowser.prototype, "forceOverlay", 2);
6161
- __decorateClass$g([
6162
+ __decorateClass$h([
6162
6163
  n$6({ attribute: "see-thru", type: Boolean })
6163
6164
  ], CxContentBrowserBrowser.prototype, "seeThru", 2);
6164
- __decorateClass$g([
6165
+ __decorateClass$h([
6165
6166
  n$6({ attribute: "min-query-length", type: Number })
6166
6167
  ], CxContentBrowserBrowser.prototype, "minQueryLength", 2);
6167
- __decorateClass$g([
6168
+ __decorateClass$h([
6168
6169
  n$6({ attribute: "token", type: String })
6169
6170
  ], CxContentBrowserBrowser.prototype, "token", 2);
6170
- __decorateClass$g([
6171
+ __decorateClass$h([
6171
6172
  n$6({ attribute: "bearer-token", type: String })
6172
6173
  ], CxContentBrowserBrowser.prototype, "bearerToken", 2);
6173
- __decorateClass$g([
6174
+ __decorateClass$h([
6174
6175
  n$6({ attribute: "base-url", type: String })
6175
6176
  ], CxContentBrowserBrowser.prototype, "baseUrl", 2);
6176
- __decorateClass$g([
6177
+ __decorateClass$h([
6177
6178
  n$6({ attribute: "use-site-session", type: Boolean })
6178
6179
  ], CxContentBrowserBrowser.prototype, "useSiteSession", 2);
6179
- __decorateClass$g([
6180
+ __decorateClass$h([
6180
6181
  r$6()
6181
6182
  ], CxContentBrowserBrowser.prototype, "searchTerm", 2);
6182
- __decorateClass$g([
6183
+ __decorateClass$h([
6183
6184
  r$6()
6184
6185
  ], CxContentBrowserBrowser.prototype, "isPersistent", 2);
6185
- __decorateClass$g([
6186
+ __decorateClass$h([
6186
6187
  r$6()
6187
6188
  ], CxContentBrowserBrowser.prototype, "collectionsOpen", 2);
6188
- __decorateClass$g([
6189
+ __decorateClass$h([
6189
6190
  watch("forceOverlay", { waitUntilFirstUpdate: true })
6190
6191
  ], CxContentBrowserBrowser.prototype, "handleForceOverlayChange", 1);
6191
- CxContentBrowserBrowser = __decorateClass$g([
6192
+ CxContentBrowserBrowser = __decorateClass$h([
6192
6193
  customElement("cx-content-browser-browser")
6193
6194
  ], CxContentBrowserBrowser);
6194
6195
  /**
@@ -6319,6 +6320,7 @@ var GridView = /* @__PURE__ */ ((GridView2) => {
6319
6320
  GridView2["Small"] = "small";
6320
6321
  return GridView2;
6321
6322
  })(GridView || {});
6323
+ const TABLE_VIEW = "table";
6322
6324
  const ASSET_SIZE = {
6323
6325
  [
6324
6326
  "small"
@@ -6351,19 +6353,46 @@ var TransformationAction = /* @__PURE__ */ ((TransformationAction2) => {
6351
6353
  TransformationAction2["Rotate"] = "Rotate";
6352
6354
  return TransformationAction2;
6353
6355
  })(TransformationAction || {});
6356
+ const autoSelectFormatConverter = {
6357
+ fromAttribute: (value) => {
6358
+ if (value === null) {
6359
+ return false;
6360
+ }
6361
+ const normalized = value.trim();
6362
+ if (normalized === "" || normalized.toLowerCase() === "true") {
6363
+ return true;
6364
+ }
6365
+ if (normalized.toLowerCase() === "false") {
6366
+ return false;
6367
+ }
6368
+ return normalized;
6369
+ },
6370
+ toAttribute: (value) => {
6371
+ return value === false ? null : String(value);
6372
+ }
6373
+ };
6374
+ function isAutoSelectFormatActive(value) {
6375
+ return value === true || typeof value === "string" && value.trim() !== "";
6376
+ }
6377
+ function toTableRowActionPosition(value) {
6378
+ return value === "row-end" ? "row-end" : "host-edge";
6379
+ }
6354
6380
  var ContentBrowserFormatDialogVariant = /* @__PURE__ */ ((ContentBrowserFormatDialogVariant2) => {
6355
6381
  ContentBrowserFormatDialogVariant2["Dialog"] = "dialog";
6356
6382
  ContentBrowserFormatDialogVariant2["Drawer"] = "drawer";
6357
6383
  return ContentBrowserFormatDialogVariant2;
6358
6384
  })(ContentBrowserFormatDialogVariant || {});
6359
- var __defProp$f = Object.defineProperty;
6360
- var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
6361
- var __decorateClass$f = (decorators, target, key, kind) => {
6362
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
6385
+ function toFieldKey(field) {
6386
+ return field.trim().toLowerCase();
6387
+ }
6388
+ var __defProp$g = Object.defineProperty;
6389
+ var __getOwnPropDesc$g = Object.getOwnPropertyDescriptor;
6390
+ var __decorateClass$g = (decorators, target, key, kind) => {
6391
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$g(target, key) : target;
6363
6392
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6364
6393
  if (decorator = decorators[i4])
6365
6394
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6366
- if (kind && result) __defProp$f(target, key, result);
6395
+ if (kind && result) __defProp$g(target, key, result);
6367
6396
  return result;
6368
6397
  };
6369
6398
  let CxContentBrowserControlFilterFacet = class extends CortexElement {
@@ -6499,37 +6528,37 @@ CxContentBrowserControlFilterFacet.dependencies = {
6499
6528
  "cx-typography": CxTypography
6500
6529
  };
6501
6530
  CxContentBrowserControlFilterFacet.itemsPerPage = 10;
6502
- __decorateClass$f([
6531
+ __decorateClass$g([
6503
6532
  n$6({ attribute: "loading", reflect: false, type: Boolean })
6504
6533
  ], CxContentBrowserControlFilterFacet.prototype, "loading", 2);
6505
- __decorateClass$f([
6534
+ __decorateClass$g([
6506
6535
  n$6({ attribute: "display-name", reflect: false, type: String })
6507
6536
  ], CxContentBrowserControlFilterFacet.prototype, "displayName", 2);
6508
- __decorateClass$f([
6537
+ __decorateClass$g([
6509
6538
  n$6({ attribute: "type", reflect: true, type: String })
6510
6539
  ], CxContentBrowserControlFilterFacet.prototype, "type", 2);
6511
- __decorateClass$f([
6540
+ __decorateClass$g([
6512
6541
  n$6({ attribute: "values", reflect: false, type: Array })
6513
6542
  ], CxContentBrowserControlFilterFacet.prototype, "values", 2);
6514
- __decorateClass$f([
6543
+ __decorateClass$g([
6515
6544
  n$6({ attribute: "collections", reflect: false, type: Array })
6516
6545
  ], CxContentBrowserControlFilterFacet.prototype, "collections", 2);
6517
- __decorateClass$f([
6546
+ __decorateClass$g([
6518
6547
  r$6()
6519
6548
  ], CxContentBrowserControlFilterFacet.prototype, "mappedSubtypes", 2);
6520
- __decorateClass$f([
6549
+ __decorateClass$g([
6521
6550
  r$6()
6522
6551
  ], CxContentBrowserControlFilterFacet.prototype, "mappedDisplayNames", 2);
6523
- __decorateClass$f([
6552
+ __decorateClass$g([
6524
6553
  r$6()
6525
6554
  ], CxContentBrowserControlFilterFacet.prototype, "page", 2);
6526
- __decorateClass$f([
6555
+ __decorateClass$g([
6527
6556
  watch("values")
6528
6557
  ], CxContentBrowserControlFilterFacet.prototype, "handleValuesChange", 1);
6529
- CxContentBrowserControlFilterFacet = __decorateClass$f([
6558
+ CxContentBrowserControlFilterFacet = __decorateClass$g([
6530
6559
  customElement("cx-content-browser-control-filter-facet")
6531
6560
  ], CxContentBrowserControlFilterFacet);
6532
- const styles$d = i$7`
6561
+ const styles$e = i$7`
6533
6562
  :host {
6534
6563
  --details-width: min(240px, 90dvw);
6535
6564
 
@@ -6554,14 +6583,14 @@ const styles$d = i$7`
6554
6583
  border-left-width: 0px;
6555
6584
  }
6556
6585
  `;
6557
- var __defProp$e = Object.defineProperty;
6558
- var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
6559
- var __decorateClass$e = (decorators, target, key, kind) => {
6560
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
6586
+ var __defProp$f = Object.defineProperty;
6587
+ var __getOwnPropDesc$f = Object.getOwnPropertyDescriptor;
6588
+ var __decorateClass$f = (decorators, target, key, kind) => {
6589
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$f(target, key) : target;
6561
6590
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6562
6591
  if (decorator = decorators[i4])
6563
6592
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6564
- if (kind && result) __defProp$e(target, key, result);
6593
+ if (kind && result) __defProp$f(target, key, result);
6565
6594
  return result;
6566
6595
  };
6567
6596
  let CxContentBrowserControlFilter = class extends CortexElement {
@@ -6786,7 +6815,7 @@ let CxContentBrowserControlFilter = class extends CortexElement {
6786
6815
  `;
6787
6816
  }
6788
6817
  };
6789
- CxContentBrowserControlFilter.styles = [componentStyles, styles$d];
6818
+ CxContentBrowserControlFilter.styles = [componentStyles, styles$e];
6790
6819
  CxContentBrowserControlFilter.dependencies = {
6791
6820
  "cx-badge": CxBadge,
6792
6821
  "cx-button": CxButton,
@@ -6807,52 +6836,52 @@ CxContentBrowserControlFilter.dependencies = {
6807
6836
  "cx-tooltip": CxTooltip,
6808
6837
  "cx-typography": CxTypography
6809
6838
  };
6810
- __decorateClass$e([
6839
+ __decorateClass$f([
6811
6840
  n$6({ attribute: "facets", reflect: false, type: Array })
6812
6841
  ], CxContentBrowserControlFilter.prototype, "facets", 2);
6813
- __decorateClass$e([
6842
+ __decorateClass$f([
6814
6843
  n$6({ attribute: "available-facets", reflect: false, type: Array })
6815
6844
  ], CxContentBrowserControlFilter.prototype, "availableFacets", 2);
6816
- __decorateClass$e([
6845
+ __decorateClass$f([
6817
6846
  n$6({ attribute: "selected-facets", reflect: false, type: Object })
6818
6847
  ], CxContentBrowserControlFilter.prototype, "selectedFacets", 2);
6819
- __decorateClass$e([
6848
+ __decorateClass$f([
6820
6849
  n$6({ attribute: "loading", reflect: false, type: Boolean })
6821
6850
  ], CxContentBrowserControlFilter.prototype, "loading", 2);
6822
- __decorateClass$e([
6851
+ __decorateClass$f([
6823
6852
  n$6({ attribute: "newly-changed-option", reflect: false, type: Object })
6824
6853
  ], CxContentBrowserControlFilter.prototype, "newlyChangedOption", 2);
6825
- __decorateClass$e([
6854
+ __decorateClass$f([
6826
6855
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
6827
6856
  ], CxContentBrowserControlFilter.prototype, "isMobile", 2);
6828
- __decorateClass$e([
6857
+ __decorateClass$f([
6829
6858
  r$6()
6830
6859
  ], CxContentBrowserControlFilter.prototype, "appliedFiltersCount", 2);
6831
- __decorateClass$e([
6860
+ __decorateClass$f([
6832
6861
  r$6()
6833
6862
  ], CxContentBrowserControlFilter.prototype, "mappedDisplayNames", 2);
6834
- __decorateClass$e([
6863
+ __decorateClass$f([
6835
6864
  watch("facets")
6836
6865
  ], CxContentBrowserControlFilter.prototype, "handleFacetsChange", 1);
6837
- __decorateClass$e([
6866
+ __decorateClass$f([
6838
6867
  watch("selectedFacets")
6839
6868
  ], CxContentBrowserControlFilter.prototype, "handleSelectedFacetsChange", 1);
6840
- CxContentBrowserControlFilter = __decorateClass$e([
6869
+ CxContentBrowserControlFilter = __decorateClass$f([
6841
6870
  customElement("cx-content-browser-control-filter")
6842
6871
  ], CxContentBrowserControlFilter);
6843
- const styles$c = i$7`
6872
+ const styles$d = i$7`
6844
6873
  :host {
6845
6874
  display: contents;
6846
6875
  }
6847
6876
  `;
6848
- var __defProp$d = Object.defineProperty;
6849
- var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
6850
- var __decorateClass$d = (decorators, target, key, kind) => {
6851
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
6877
+ var __defProp$e = Object.defineProperty;
6878
+ var __getOwnPropDesc$e = Object.getOwnPropertyDescriptor;
6879
+ var __decorateClass$e = (decorators, target, key, kind) => {
6880
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$e(target, key) : target;
6852
6881
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
6853
6882
  if (decorator = decorators[i4])
6854
6883
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
6855
- if (kind && result) __defProp$d(target, key, result);
6884
+ if (kind && result) __defProp$e(target, key, result);
6856
6885
  return result;
6857
6886
  };
6858
6887
  let CxContentBrowserControlSort = class extends CortexElement {
@@ -6991,7 +7020,7 @@ let CxContentBrowserControlSort = class extends CortexElement {
6991
7020
  `;
6992
7021
  }
6993
7022
  };
6994
- CxContentBrowserControlSort.styles = [componentStyles, styles$c];
7023
+ CxContentBrowserControlSort.styles = [componentStyles, styles$d];
6995
7024
  CxContentBrowserControlSort.dependencies = {
6996
7025
  "cx-divider": CxDivider,
6997
7026
  "cx-dropdown": CxDropdown,
@@ -7002,57 +7031,62 @@ CxContentBrowserControlSort.dependencies = {
7002
7031
  "cx-spinner": CxSpinner,
7003
7032
  "cx-tooltip": CxTooltip
7004
7033
  };
7005
- __decorateClass$d([
7034
+ __decorateClass$e([
7006
7035
  n$6({ attribute: "sort-order-name", reflect: true, type: String })
7007
7036
  ], CxContentBrowserControlSort.prototype, "sortOrderName", 2);
7008
- __decorateClass$d([
7037
+ __decorateClass$e([
7009
7038
  n$6({ attribute: "sort-direction", reflect: true, type: String })
7010
7039
  ], CxContentBrowserControlSort.prototype, "sortDirection", 2);
7011
- __decorateClass$d([
7040
+ __decorateClass$e([
7012
7041
  n$6({ attribute: "sort-orders", reflect: false, type: Array })
7013
7042
  ], CxContentBrowserControlSort.prototype, "sortOrders", 2);
7014
- __decorateClass$d([
7043
+ __decorateClass$e([
7015
7044
  n$6({ attribute: "loading", reflect: true, type: Boolean })
7016
7045
  ], CxContentBrowserControlSort.prototype, "loading", 2);
7017
- __decorateClass$d([
7046
+ __decorateClass$e([
7018
7047
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7019
7048
  ], CxContentBrowserControlSort.prototype, "isMobile", 2);
7020
- __decorateClass$d([
7049
+ __decorateClass$e([
7021
7050
  n$6({ attribute: "newly-changed-option", reflect: false, type: Object })
7022
7051
  ], CxContentBrowserControlSort.prototype, "newlyChangedOption", 2);
7023
- __decorateClass$d([
7052
+ __decorateClass$e([
7024
7053
  r$6()
7025
7054
  ], CxContentBrowserControlSort.prototype, "mappedSortDirections", 2);
7026
- __decorateClass$d([
7055
+ __decorateClass$e([
7027
7056
  r$6()
7028
7057
  ], CxContentBrowserControlSort.prototype, "sortDirections", 2);
7029
- __decorateClass$d([
7058
+ __decorateClass$e([
7030
7059
  watch("sortOrderName"),
7031
7060
  watch("sortDirection"),
7032
7061
  watch("sortOrders", { waitUntilFirstUpdate: true }),
7033
7062
  watch("sortDirections", { waitUntilFirstUpdate: true })
7034
7063
  ], CxContentBrowserControlSort.prototype, "handleSortDirectionsChange", 1);
7035
- CxContentBrowserControlSort = __decorateClass$d([
7064
+ CxContentBrowserControlSort = __decorateClass$e([
7036
7065
  customElement("cx-content-browser-control-sort")
7037
7066
  ], CxContentBrowserControlSort);
7038
- const styles$b = i$7`
7067
+ const styles$c = i$7`
7039
7068
  :host {
7040
7069
  display: contents;
7041
7070
  }
7042
7071
 
7072
+ cx-menu[key='default-menu'] > cx-menu-item::part(checked-icon),
7073
+ cx-menu[name='main'] > cx-menu-item::part(checked-icon) {
7074
+ display: none;
7075
+ }
7076
+
7043
7077
  .menu-item--switch {
7044
7078
  --submenu-icon-display: none;
7045
7079
  --checked-icon-display: none;
7046
7080
  }
7047
7081
  `;
7048
- var __defProp$c = Object.defineProperty;
7049
- var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
7050
- var __decorateClass$c = (decorators, target, key, kind) => {
7051
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
7082
+ var __defProp$d = Object.defineProperty;
7083
+ var __getOwnPropDesc$d = Object.getOwnPropertyDescriptor;
7084
+ var __decorateClass$d = (decorators, target, key, kind) => {
7085
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$d(target, key) : target;
7052
7086
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7053
7087
  if (decorator = decorators[i4])
7054
7088
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7055
- if (kind && result) __defProp$c(target, key, result);
7089
+ if (kind && result) __defProp$d(target, key, result);
7056
7090
  return result;
7057
7091
  };
7058
7092
  let CxContentBrowserControlView = class extends CortexElement {
@@ -7063,6 +7097,10 @@ let CxContentBrowserControlView = class extends CortexElement {
7063
7097
  this.views = [];
7064
7098
  this.isSeeThrough = false;
7065
7099
  this.isMobile = false;
7100
+ this.canUseTable = false;
7101
+ }
7102
+ get isTable() {
7103
+ return this.view === TABLE_VIEW;
7066
7104
  }
7067
7105
  runConnectedCallback() {
7068
7106
  this.handleViewChange();
@@ -7082,6 +7120,21 @@ let CxContentBrowserControlView = class extends CortexElement {
7082
7120
  }
7083
7121
  });
7084
7122
  }
7123
+ renderTableOption() {
7124
+ if (!this.canUseTable) {
7125
+ return A;
7126
+ }
7127
+ return b`
7128
+ <cx-menu-item
7129
+ value=${TABLE_VIEW}
7130
+ type="checkbox"
7131
+ ?checked=${this.isTable}
7132
+ >
7133
+ <cx-line-clamp lines="1">${this.localize.term("table")}</cx-line-clamp>
7134
+ <cx-icon slot="prefix" name="table_rows"></cx-icon>
7135
+ </cx-menu-item>
7136
+ `;
7137
+ }
7085
7138
  handleViewChange() {
7086
7139
  this.selectedView = this.views.find((item) => item.value === this.view);
7087
7140
  }
@@ -7099,7 +7152,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7099
7152
  <div slot="trigger">
7100
7153
  <cx-tooltip content=${this.localize.term("view")}>
7101
7154
  <cx-icon-button
7102
- name="dashboard"
7155
+ name=${this.isTable ? "table_rows" : "dashboard"}
7103
7156
  label=${this.localize.term("view")}
7104
7157
  outline
7105
7158
  ></cx-icon-button>
@@ -7113,7 +7166,8 @@ let CxContentBrowserControlView = class extends CortexElement {
7113
7166
  <cx-menu-label>${this.localize.term("view")}</cx-menu-label>
7114
7167
  <cx-menu-item
7115
7168
  menu="submenu"
7116
- always-show-checked-icon
7169
+ type="checkbox"
7170
+ ?checked=${!this.isTable}
7117
7171
  >
7118
7172
  ${this.localize.term("grid")}
7119
7173
  ${n$5(
@@ -7126,6 +7180,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7126
7180
  )}
7127
7181
  <cx-icon slot="prefix" name="grid_view"></cx-icon>
7128
7182
  </cx-menu-item>
7183
+ ${this.renderTableOption()}
7129
7184
  <cx-divider></cx-divider>
7130
7185
  <cx-menu-item value="see-thru" class="menu-item--switch">
7131
7186
  <cx-space direction="horizontal" justify-content="space-between">
@@ -7159,7 +7214,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7159
7214
  () => b`
7160
7215
  <cx-menu key="default-menu" no-uncheck>
7161
7216
  <cx-menu-label>${this.localize.term("view")}</cx-menu-label>
7162
- <cx-menu-item type="checkbox">
7217
+ <cx-menu-item type="checkbox" ?checked=${!this.isTable}>
7163
7218
  ${this.localize.term("grid")}
7164
7219
  ${n$5(
7165
7220
  this.selectedView,
@@ -7188,6 +7243,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7188
7243
  </cx-menu>
7189
7244
  <cx-icon slot="prefix" name="grid_view"></cx-icon>
7190
7245
  </cx-menu-item>
7246
+ ${this.renderTableOption()}
7191
7247
  <cx-divider></cx-divider>
7192
7248
  <cx-menu-item value="see-thru" class="menu-item--switch">
7193
7249
  <cx-space direction="horizontal" justify-content="space-between">
@@ -7205,7 +7261,7 @@ let CxContentBrowserControlView = class extends CortexElement {
7205
7261
  `;
7206
7262
  }
7207
7263
  };
7208
- CxContentBrowserControlView.styles = [componentStyles, styles$b];
7264
+ CxContentBrowserControlView.styles = [componentStyles, styles$c];
7209
7265
  CxContentBrowserControlView.dependencies = {
7210
7266
  "cx-divider": CxDivider,
7211
7267
  "cx-dropdown": CxDropdown,
@@ -7219,28 +7275,31 @@ CxContentBrowserControlView.dependencies = {
7219
7275
  "cx-switch": CxSwitch,
7220
7276
  "cx-tooltip": CxTooltip
7221
7277
  };
7222
- __decorateClass$c([
7278
+ __decorateClass$d([
7223
7279
  n$6({ attribute: "view", reflect: true, type: String })
7224
7280
  ], CxContentBrowserControlView.prototype, "view", 2);
7225
- __decorateClass$c([
7281
+ __decorateClass$d([
7226
7282
  n$6({ attribute: "views", reflect: false, type: Array })
7227
7283
  ], CxContentBrowserControlView.prototype, "views", 2);
7228
- __decorateClass$c([
7284
+ __decorateClass$d([
7229
7285
  n$6({ attribute: "is-see-through", reflect: true, type: Boolean })
7230
7286
  ], CxContentBrowserControlView.prototype, "isSeeThrough", 2);
7231
- __decorateClass$c([
7287
+ __decorateClass$d([
7232
7288
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7233
7289
  ], CxContentBrowserControlView.prototype, "isMobile", 2);
7234
- __decorateClass$c([
7290
+ __decorateClass$d([
7291
+ n$6({ attribute: "can-use-table", reflect: true, type: Boolean })
7292
+ ], CxContentBrowserControlView.prototype, "canUseTable", 2);
7293
+ __decorateClass$d([
7235
7294
  r$6()
7236
7295
  ], CxContentBrowserControlView.prototype, "selectedView", 2);
7237
- __decorateClass$c([
7296
+ __decorateClass$d([
7238
7297
  watch("view", { waitUntilFirstUpdate: true })
7239
7298
  ], CxContentBrowserControlView.prototype, "handleViewChange", 1);
7240
- CxContentBrowserControlView = __decorateClass$c([
7299
+ CxContentBrowserControlView = __decorateClass$d([
7241
7300
  customElement("cx-content-browser-control-view")
7242
7301
  ], CxContentBrowserControlView);
7243
- const styles$a = i$7`
7302
+ const styles$b = i$7`
7244
7303
  :host {
7245
7304
  display: block;
7246
7305
  }
@@ -7263,14 +7322,14 @@ const styles$a = i$7`
7263
7322
  margin-left: auto;
7264
7323
  }
7265
7324
  `;
7266
- var __defProp$b = Object.defineProperty;
7267
- var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
7268
- var __decorateClass$b = (decorators, target, key, kind) => {
7269
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
7325
+ var __defProp$c = Object.defineProperty;
7326
+ var __getOwnPropDesc$c = Object.getOwnPropertyDescriptor;
7327
+ var __decorateClass$c = (decorators, target, key, kind) => {
7328
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$c(target, key) : target;
7270
7329
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7271
7330
  if (decorator = decorators[i4])
7272
7331
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7273
- if (kind && result) __defProp$b(target, key, result);
7332
+ if (kind && result) __defProp$c(target, key, result);
7274
7333
  return result;
7275
7334
  };
7276
7335
  let CxContentBrowserControlBar = class extends CortexElement {
@@ -7291,6 +7350,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7291
7350
  this.loading = false;
7292
7351
  this.searchText = "";
7293
7352
  this.isMobile = false;
7353
+ this.canUseTable = false;
7294
7354
  }
7295
7355
  handleSearchChange(event) {
7296
7356
  this.searchText = event.target.value;
@@ -7338,6 +7398,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7338
7398
  <cx-content-browser-control-view
7339
7399
  view=${this.view}
7340
7400
  .views=${this.views}
7401
+ ?can-use-table=${this.canUseTable}
7341
7402
  ?is-see-through=${this.isSeeThrough}
7342
7403
  ?is-mobile=${this.isMobile}
7343
7404
  ></cx-content-browser-control-view>
@@ -7354,7 +7415,7 @@ let CxContentBrowserControlBar = class extends CortexElement {
7354
7415
  `;
7355
7416
  }
7356
7417
  };
7357
- CxContentBrowserControlBar.styles = [componentStyles, styles$a];
7418
+ CxContentBrowserControlBar.styles = [componentStyles, styles$b];
7358
7419
  CxContentBrowserControlBar.dependencies = {
7359
7420
  "cx-avatar": CxAvatar,
7360
7421
  "cx-content-browser-control-filter": CxContentBrowserControlFilter,
@@ -7366,52 +7427,55 @@ CxContentBrowserControlBar.dependencies = {
7366
7427
  "cx-space": CxSpace,
7367
7428
  "cx-typography": CxTypography
7368
7429
  };
7369
- __decorateClass$b([
7430
+ __decorateClass$c([
7370
7431
  n$6({ attribute: "current-count", type: Number })
7371
7432
  ], CxContentBrowserControlBar.prototype, "currentCount", 2);
7372
- __decorateClass$b([
7433
+ __decorateClass$c([
7373
7434
  n$6({ attribute: "total-count", type: Number })
7374
7435
  ], CxContentBrowserControlBar.prototype, "totalCount", 2);
7375
- __decorateClass$b([
7436
+ __decorateClass$c([
7376
7437
  n$6({ attribute: "sort-order-name", reflect: true, type: String })
7377
7438
  ], CxContentBrowserControlBar.prototype, "sortOrderName", 2);
7378
- __decorateClass$b([
7439
+ __decorateClass$c([
7379
7440
  n$6({ attribute: "sort-direction", reflect: true, type: String })
7380
7441
  ], CxContentBrowserControlBar.prototype, "sortDirection", 2);
7381
- __decorateClass$b([
7442
+ __decorateClass$c([
7382
7443
  n$6({ attribute: "sort-orders", reflect: false, type: Array })
7383
7444
  ], CxContentBrowserControlBar.prototype, "sortOrders", 2);
7384
- __decorateClass$b([
7445
+ __decorateClass$c([
7385
7446
  n$6({ attribute: "view", reflect: true, type: String })
7386
7447
  ], CxContentBrowserControlBar.prototype, "view", 2);
7387
- __decorateClass$b([
7448
+ __decorateClass$c([
7388
7449
  n$6({ attribute: "views", reflect: false, type: Array })
7389
7450
  ], CxContentBrowserControlBar.prototype, "views", 2);
7390
- __decorateClass$b([
7451
+ __decorateClass$c([
7391
7452
  n$6({ attribute: "facets", reflect: false, type: Array })
7392
7453
  ], CxContentBrowserControlBar.prototype, "facets", 2);
7393
- __decorateClass$b([
7454
+ __decorateClass$c([
7394
7455
  n$6({ attribute: "available-facets", reflect: false, type: Array })
7395
7456
  ], CxContentBrowserControlBar.prototype, "availableFacets", 2);
7396
- __decorateClass$b([
7457
+ __decorateClass$c([
7397
7458
  n$6({ attribute: "selected-facets", reflect: false, type: Object })
7398
7459
  ], CxContentBrowserControlBar.prototype, "selectedFacets", 2);
7399
- __decorateClass$b([
7460
+ __decorateClass$c([
7400
7461
  n$6({ attribute: "is-see-through", reflect: true, type: Boolean })
7401
7462
  ], CxContentBrowserControlBar.prototype, "isSeeThrough", 2);
7402
- __decorateClass$b([
7463
+ __decorateClass$c([
7403
7464
  n$6({ attribute: "loading", reflect: true, type: Boolean })
7404
7465
  ], CxContentBrowserControlBar.prototype, "loading", 2);
7405
- __decorateClass$b([
7466
+ __decorateClass$c([
7406
7467
  n$6({ attribute: false, reflect: false, type: Object })
7407
7468
  ], CxContentBrowserControlBar.prototype, "newlyChangedOption", 2);
7408
- __decorateClass$b([
7469
+ __decorateClass$c([
7409
7470
  n$6({ attribute: "search-text", reflect: false, type: String })
7410
7471
  ], CxContentBrowserControlBar.prototype, "searchText", 2);
7411
- __decorateClass$b([
7472
+ __decorateClass$c([
7412
7473
  n$6({ attribute: "is-mobile", reflect: false, type: Boolean })
7413
7474
  ], CxContentBrowserControlBar.prototype, "isMobile", 2);
7414
- CxContentBrowserControlBar = __decorateClass$b([
7475
+ __decorateClass$c([
7476
+ n$6({ attribute: "can-use-table", reflect: true, type: Boolean })
7477
+ ], CxContentBrowserControlBar.prototype, "canUseTable", 2);
7478
+ CxContentBrowserControlBar = __decorateClass$c([
7415
7479
  customElement("cx-content-browser-control-bar")
7416
7480
  ], CxContentBrowserControlBar);
7417
7481
  /**
@@ -7718,14 +7782,14 @@ var Orientation = /* @__PURE__ */ ((Orientation2) => {
7718
7782
  Orientation2["Vertical"] = "vertical";
7719
7783
  return Orientation2;
7720
7784
  })(Orientation || {});
7721
- var __defProp$a = Object.defineProperty;
7722
- var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
7723
- var __decorateClass$a = (decorators, target, key, kind) => {
7724
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
7785
+ var __defProp$b = Object.defineProperty;
7786
+ var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
7787
+ var __decorateClass$b = (decorators, target, key, kind) => {
7788
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
7725
7789
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
7726
7790
  if (decorator = decorators[i4])
7727
7791
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
7728
- if (kind && result) __defProp$a(target, key, result);
7792
+ if (kind && result) __defProp$b(target, key, result);
7729
7793
  return result;
7730
7794
  };
7731
7795
  let CxContentBrowserAssetPreviewVideo = class extends CortexElement {
@@ -7841,40 +7905,40 @@ CxContentBrowserAssetPreviewVideo.dependencies = {
7841
7905
  "cx-typography": CxTypography,
7842
7906
  "cx-video": CxVideo
7843
7907
  };
7844
- __decorateClass$a([
7908
+ __decorateClass$b([
7845
7909
  e$7("cx-video")
7846
7910
  ], CxContentBrowserAssetPreviewVideo.prototype, "videoElement", 2);
7847
- __decorateClass$a([
7911
+ __decorateClass$b([
7848
7912
  e$7("img")
7849
7913
  ], CxContentBrowserAssetPreviewVideo.prototype, "imageElement", 2);
7850
- __decorateClass$a([
7914
+ __decorateClass$b([
7851
7915
  n$6({ attribute: "src", reflect: true, type: String })
7852
7916
  ], CxContentBrowserAssetPreviewVideo.prototype, "src", 2);
7853
- __decorateClass$a([
7917
+ __decorateClass$b([
7854
7918
  n$6({ attribute: "alt", reflect: true, type: String })
7855
7919
  ], CxContentBrowserAssetPreviewVideo.prototype, "alt", 2);
7856
- __decorateClass$a([
7920
+ __decorateClass$b([
7857
7921
  n$6({ attribute: "thumbnail-only", reflect: true, type: Boolean })
7858
7922
  ], CxContentBrowserAssetPreviewVideo.prototype, "thumbnailOnly", 2);
7859
- __decorateClass$a([
7923
+ __decorateClass$b([
7860
7924
  n$6({ attribute: "thumbnail-src", reflect: true, type: String })
7861
7925
  ], CxContentBrowserAssetPreviewVideo.prototype, "thumbnailSrc", 2);
7862
- __decorateClass$a([
7926
+ __decorateClass$b([
7863
7927
  n$6({ reflect: true, type: Boolean })
7864
7928
  ], CxContentBrowserAssetPreviewVideo.prototype, "controls", 2);
7865
- __decorateClass$a([
7929
+ __decorateClass$b([
7866
7930
  n$6({ attribute: "loaded", reflect: true, type: Boolean })
7867
7931
  ], CxContentBrowserAssetPreviewVideo.prototype, "loaded", 2);
7868
- __decorateClass$a([
7932
+ __decorateClass$b([
7869
7933
  r$6()
7870
7934
  ], CxContentBrowserAssetPreviewVideo.prototype, "assetDirection", 2);
7871
- __decorateClass$a([
7935
+ __decorateClass$b([
7872
7936
  r$6()
7873
7937
  ], CxContentBrowserAssetPreviewVideo.prototype, "progress", 2);
7874
- CxContentBrowserAssetPreviewVideo = __decorateClass$a([
7938
+ CxContentBrowserAssetPreviewVideo = __decorateClass$b([
7875
7939
  customElement("cx-content-browser-asset-preview-video")
7876
7940
  ], CxContentBrowserAssetPreviewVideo);
7877
- const styles$9 = i$7`
7941
+ const styles$a = i$7`
7878
7942
  :host {
7879
7943
  display: block;
7880
7944
  position: relative;
@@ -8021,14 +8085,14 @@ const styles$9 = i$7`
8021
8085
  transition: none;
8022
8086
  }
8023
8087
  `;
8024
- var __defProp$9 = Object.defineProperty;
8025
- var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
8026
- var __decorateClass$9 = (decorators, target, key, kind) => {
8027
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
8088
+ var __defProp$a = Object.defineProperty;
8089
+ var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
8090
+ var __decorateClass$a = (decorators, target, key, kind) => {
8091
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
8028
8092
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8029
8093
  if (decorator = decorators[i4])
8030
8094
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8031
- if (kind && result) __defProp$9(target, key, result);
8095
+ if (kind && result) __defProp$a(target, key, result);
8032
8096
  return result;
8033
8097
  };
8034
8098
  const GIF_EXTENSION = ".gif";
@@ -8193,53 +8257,53 @@ let CxContentBrowserAssetPreview = class extends CortexElement {
8193
8257
  `;
8194
8258
  }
8195
8259
  };
8196
- CxContentBrowserAssetPreview.styles = [componentStyles, styles$9];
8260
+ CxContentBrowserAssetPreview.styles = [componentStyles, styles$a];
8197
8261
  CxContentBrowserAssetPreview.dependencies = {
8198
8262
  "cx-content-browser-asset-preview-video": CxContentBrowserAssetPreviewVideo,
8199
8263
  "cx-icon": CxIcon,
8200
8264
  "cx-skeleton": CxSkeleton,
8201
8265
  "cx-typography": CxTypography
8202
8266
  };
8203
- __decorateClass$9([
8267
+ __decorateClass$a([
8204
8268
  e$7("cx-content-browser-asset-preview-video")
8205
8269
  ], CxContentBrowserAssetPreview.prototype, "previewVideo", 2);
8206
- __decorateClass$9([
8270
+ __decorateClass$a([
8207
8271
  n$6({ attribute: "image-url", reflect: true, type: String })
8208
8272
  ], CxContentBrowserAssetPreview.prototype, "imageUrl", 2);
8209
- __decorateClass$9([
8273
+ __decorateClass$a([
8210
8274
  n$6({ attribute: "original-url", reflect: true, type: String })
8211
8275
  ], CxContentBrowserAssetPreview.prototype, "originalUrl", 2);
8212
- __decorateClass$9([
8276
+ __decorateClass$a([
8213
8277
  n$6({ attribute: "preview-url", reflect: true, type: String })
8214
8278
  ], CxContentBrowserAssetPreview.prototype, "previewUrl", 2);
8215
- __decorateClass$9([
8279
+ __decorateClass$a([
8216
8280
  n$6({ attribute: "alt", reflect: true, type: String })
8217
8281
  ], CxContentBrowserAssetPreview.prototype, "alt", 2);
8218
- __decorateClass$9([
8282
+ __decorateClass$a([
8219
8283
  n$6({ attribute: "doc-type", reflect: true, type: String })
8220
8284
  ], CxContentBrowserAssetPreview.prototype, "docType", 2);
8221
- __decorateClass$9([
8285
+ __decorateClass$a([
8222
8286
  n$6({ attribute: "extension", reflect: true, type: String })
8223
8287
  ], CxContentBrowserAssetPreview.prototype, "extension", 2);
8224
- __decorateClass$9([
8288
+ __decorateClass$a([
8225
8289
  n$6({ attribute: "in-cold-storage", reflect: true, type: Boolean })
8226
8290
  ], CxContentBrowserAssetPreview.prototype, "inColdStorage", 2);
8227
- __decorateClass$9([
8291
+ __decorateClass$a([
8228
8292
  n$6({ attribute: "thumbnail-only", reflect: true, type: Boolean })
8229
8293
  ], CxContentBrowserAssetPreview.prototype, "thumbnailOnly", 2);
8230
- __decorateClass$9([
8294
+ __decorateClass$a([
8231
8295
  n$6({ attribute: "controls", reflect: true, type: Boolean })
8232
8296
  ], CxContentBrowserAssetPreview.prototype, "controls", 2);
8233
- __decorateClass$9([
8297
+ __decorateClass$a([
8234
8298
  r$6()
8235
8299
  ], CxContentBrowserAssetPreview.prototype, "isError", 2);
8236
- __decorateClass$9([
8300
+ __decorateClass$a([
8237
8301
  r$6()
8238
8302
  ], CxContentBrowserAssetPreview.prototype, "loaded", 2);
8239
- CxContentBrowserAssetPreview = __decorateClass$9([
8303
+ CxContentBrowserAssetPreview = __decorateClass$a([
8240
8304
  customElement("cx-content-browser-asset-preview")
8241
8305
  ], CxContentBrowserAssetPreview);
8242
- const styles$8 = i$7`
8306
+ const styles$9 = i$7`
8243
8307
  :host {
8244
8308
  display: block;
8245
8309
  padding: var(--cx-spacing-small);
@@ -8249,14 +8313,14 @@ const styles$8 = i$7`
8249
8313
  width: 100%;
8250
8314
  }
8251
8315
  `;
8252
- var __defProp$8 = Object.defineProperty;
8253
- var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
8254
- var __decorateClass$8 = (decorators, target, key, kind) => {
8255
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
8316
+ var __defProp$9 = Object.defineProperty;
8317
+ var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
8318
+ var __decorateClass$9 = (decorators, target, key, kind) => {
8319
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
8256
8320
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8257
8321
  if (decorator = decorators[i4])
8258
8322
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8259
- if (kind && result) __defProp$8(target, key, result);
8323
+ if (kind && result) __defProp$9(target, key, result);
8260
8324
  return result;
8261
8325
  };
8262
8326
  let CxContentBrowserAssetTrackingParameters = class extends CortexElement {
@@ -8365,7 +8429,7 @@ let CxContentBrowserAssetTrackingParameters = class extends CortexElement {
8365
8429
  `;
8366
8430
  }
8367
8431
  };
8368
- CxContentBrowserAssetTrackingParameters.styles = [componentStyles, styles$8];
8432
+ CxContentBrowserAssetTrackingParameters.styles = [componentStyles, styles$9];
8369
8433
  CxContentBrowserAssetTrackingParameters.dependencies = {
8370
8434
  "cx-button": CxButton,
8371
8435
  "cx-icon": CxIcon,
@@ -8374,13 +8438,13 @@ CxContentBrowserAssetTrackingParameters.dependencies = {
8374
8438
  "cx-input-group": CxInputGroup,
8375
8439
  "cx-space": CxSpace
8376
8440
  };
8377
- __decorateClass$8([
8441
+ __decorateClass$9([
8378
8442
  n$6({ attribute: false, type: Array })
8379
8443
  ], CxContentBrowserAssetTrackingParameters.prototype, "values", 2);
8380
- CxContentBrowserAssetTrackingParameters = __decorateClass$8([
8444
+ CxContentBrowserAssetTrackingParameters = __decorateClass$9([
8381
8445
  customElement("cx-content-browser-asset-tracking-parameters")
8382
8446
  ], CxContentBrowserAssetTrackingParameters);
8383
- const styles$7 = i$7`
8447
+ const styles$8 = i$7`
8384
8448
  :host {
8385
8449
  display: block;
8386
8450
  }
@@ -8489,14 +8553,14 @@ const styles$7 = i$7`
8489
8553
  color: var(--cx-color-primary);
8490
8554
  }
8491
8555
  `;
8492
- var __defProp$7 = Object.defineProperty;
8493
- var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
8494
- var __decorateClass$7 = (decorators, target, key, kind) => {
8495
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
8556
+ var __defProp$8 = Object.defineProperty;
8557
+ var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
8558
+ var __decorateClass$8 = (decorators, target, key, kind) => {
8559
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
8496
8560
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8497
8561
  if (decorator = decorators[i4])
8498
8562
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8499
- if (kind && result) __defProp$7(target, key, result);
8563
+ if (kind && result) __defProp$8(target, key, result);
8500
8564
  return result;
8501
8565
  };
8502
8566
  const USE_REPRESENTATIVE_VALUE = "use-representative";
@@ -8750,7 +8814,7 @@ let CxContentBrowserAssetProxySelector = class extends CortexElement {
8750
8814
  `;
8751
8815
  }
8752
8816
  };
8753
- CxContentBrowserAssetProxySelector.styles = [componentStyles, styles$7];
8817
+ CxContentBrowserAssetProxySelector.styles = [componentStyles, styles$8];
8754
8818
  CxContentBrowserAssetProxySelector.dependencies = {
8755
8819
  "cx-content-browser-asset-tracking-parameters": CxContentBrowserAssetTrackingParameters,
8756
8820
  "cx-icon": CxIcon,
@@ -8760,49 +8824,49 @@ CxContentBrowserAssetProxySelector.dependencies = {
8760
8824
  "cx-switch": CxSwitch,
8761
8825
  "cx-typography": CxTypography
8762
8826
  };
8763
- __decorateClass$7([
8827
+ __decorateClass$8([
8764
8828
  n$6({ reflect: false, type: Array })
8765
8829
  ], CxContentBrowserAssetProxySelector.prototype, "items", 2);
8766
- __decorateClass$7([
8830
+ __decorateClass$8([
8767
8831
  n$6({ attribute: "can-custom-format", reflect: true, type: Boolean })
8768
8832
  ], CxContentBrowserAssetProxySelector.prototype, "canCustomFormat", 2);
8769
- __decorateClass$7([
8833
+ __decorateClass$8([
8770
8834
  n$6({ attribute: "can-use-representative", reflect: true, type: Boolean })
8771
8835
  ], CxContentBrowserAssetProxySelector.prototype, "canUseRepresentative", 2);
8772
- __decorateClass$7([
8836
+ __decorateClass$8([
8773
8837
  n$6({ attribute: "can-use-ats", reflect: true, type: Boolean })
8774
8838
  ], CxContentBrowserAssetProxySelector.prototype, "canUseATS", 2);
8775
- __decorateClass$7([
8839
+ __decorateClass$8([
8776
8840
  n$6({ attribute: "can-use-tracking", reflect: true, type: Boolean })
8777
8841
  ], CxContentBrowserAssetProxySelector.prototype, "canUseTracking", 2);
8778
- __decorateClass$7([
8842
+ __decorateClass$8([
8779
8843
  n$6({ attribute: "proxies-failed", reflect: true, type: Boolean })
8780
8844
  ], CxContentBrowserAssetProxySelector.prototype, "proxiesFailed", 2);
8781
- __decorateClass$7([
8845
+ __decorateClass$8([
8782
8846
  n$6({ attribute: "selected", reflect: true, type: String })
8783
8847
  ], CxContentBrowserAssetProxySelector.prototype, "selected", 2);
8784
- __decorateClass$7([
8848
+ __decorateClass$8([
8785
8849
  n$6({ attribute: "disabled-selected", reflect: true, type: Boolean })
8786
8850
  ], CxContentBrowserAssetProxySelector.prototype, "disabledSelected", 2);
8787
- __decorateClass$7([
8851
+ __decorateClass$8([
8788
8852
  n$6({ attribute: "custom-width", reflect: true, type: String })
8789
8853
  ], CxContentBrowserAssetProxySelector.prototype, "customWidth", 2);
8790
- __decorateClass$7([
8854
+ __decorateClass$8([
8791
8855
  n$6({ attribute: "custom-height", reflect: true, type: String })
8792
8856
  ], CxContentBrowserAssetProxySelector.prototype, "customHeight", 2);
8793
- __decorateClass$7([
8857
+ __decorateClass$8([
8794
8858
  n$6({ attribute: "custom-extension", reflect: true, type: String })
8795
8859
  ], CxContentBrowserAssetProxySelector.prototype, "customExtension", 2);
8796
- __decorateClass$7([
8860
+ __decorateClass$8([
8797
8861
  n$6({ attribute: "enabled-tracking", reflect: true, type: Boolean })
8798
8862
  ], CxContentBrowserAssetProxySelector.prototype, "enabledTracking", 2);
8799
- __decorateClass$7([
8863
+ __decorateClass$8([
8800
8864
  n$6({ attribute: "tracking-parameters", reflect: false, type: Array })
8801
8865
  ], CxContentBrowserAssetProxySelector.prototype, "trackingParameters", 2);
8802
- CxContentBrowserAssetProxySelector = __decorateClass$7([
8866
+ CxContentBrowserAssetProxySelector = __decorateClass$8([
8803
8867
  customElement("cx-content-browser-asset-proxy-selector")
8804
8868
  ], CxContentBrowserAssetProxySelector);
8805
- const styles$6 = i$7`
8869
+ const styles$7 = i$7`
8806
8870
  :host {
8807
8871
  display: block;
8808
8872
  width: 100%;
@@ -8875,14 +8939,14 @@ const styles$6 = i$7`
8875
8939
  font-size: var(--cx-font-size-3x-large);
8876
8940
  }
8877
8941
  `;
8878
- var __defProp$6 = Object.defineProperty;
8879
- var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
8880
- var __decorateClass$6 = (decorators, target, key, kind) => {
8881
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
8942
+ var __defProp$7 = Object.defineProperty;
8943
+ var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
8944
+ var __decorateClass$7 = (decorators, target, key, kind) => {
8945
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
8882
8946
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
8883
8947
  if (decorator = decorators[i4])
8884
8948
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
8885
- if (kind && result) __defProp$6(target, key, result);
8949
+ if (kind && result) __defProp$7(target, key, result);
8886
8950
  return result;
8887
8951
  };
8888
8952
  let CxContentBrowserAssetVersionHistory = class extends CortexElement {
@@ -8954,7 +9018,7 @@ let CxContentBrowserAssetVersionHistory = class extends CortexElement {
8954
9018
  `;
8955
9019
  }
8956
9020
  };
8957
- CxContentBrowserAssetVersionHistory.styles = [componentStyles, styles$6];
9021
+ CxContentBrowserAssetVersionHistory.styles = [componentStyles, styles$7];
8958
9022
  CxContentBrowserAssetVersionHistory.dependencies = {
8959
9023
  "cx-grid": CxGrid,
8960
9024
  "cx-grid-item": CxGridItem,
@@ -8966,13 +9030,13 @@ CxContentBrowserAssetVersionHistory.dependencies = {
8966
9030
  "cx-typography": CxTypography,
8967
9031
  "cx-content-browser-asset-preview": CxContentBrowserAssetPreview
8968
9032
  };
8969
- __decorateClass$6([
9033
+ __decorateClass$7([
8970
9034
  n$6({ reflect: false, type: Array })
8971
9035
  ], CxContentBrowserAssetVersionHistory.prototype, "versions", 2);
8972
- __decorateClass$6([
9036
+ __decorateClass$7([
8973
9037
  n$6({ reflect: true, type: Boolean })
8974
9038
  ], CxContentBrowserAssetVersionHistory.prototype, "loading", 2);
8975
- CxContentBrowserAssetVersionHistory = __decorateClass$6([
9039
+ CxContentBrowserAssetVersionHistory = __decorateClass$7([
8976
9040
  customElement("cx-content-browser-asset-version-history")
8977
9041
  ], CxContentBrowserAssetVersionHistory);
8978
9042
  const dialogStyles = i$7`
@@ -9023,7 +9087,7 @@ const drawerStyles = i$7`
9023
9087
  padding: var(--cx-spacing-medium);
9024
9088
  }
9025
9089
  `;
9026
- const styles$5 = i$7`
9090
+ const styles$6 = i$7`
9027
9091
  :host {
9028
9092
  display: block;
9029
9093
  }
@@ -9063,14 +9127,14 @@ const styles$5 = i$7`
9063
9127
  width: 100%;
9064
9128
  }
9065
9129
  `;
9066
- var __defProp$5 = Object.defineProperty;
9067
- var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
9068
- var __decorateClass$5 = (decorators, target, key, kind) => {
9069
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
9130
+ var __defProp$6 = Object.defineProperty;
9131
+ var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
9132
+ var __decorateClass$6 = (decorators, target, key, kind) => {
9133
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
9070
9134
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
9071
9135
  if (decorator = decorators[i4])
9072
9136
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
9073
- if (kind && result) __defProp$5(target, key, result);
9137
+ if (kind && result) __defProp$6(target, key, result);
9074
9138
  return result;
9075
9139
  };
9076
9140
  const DEFAULT_TRACKING_PARAMETERS = [{
@@ -9112,6 +9176,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9112
9176
  this.canPinAsset = false;
9113
9177
  this.canTrack = false;
9114
9178
  this.canUseProxies = false;
9179
+ this.autoSelectFormat = false;
9115
9180
  this.simplePick = false;
9116
9181
  this.canViewVersions = false;
9117
9182
  this.variant = ContentBrowserFormatDialogVariant.Dialog;
@@ -9165,18 +9230,50 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9165
9230
  }
9166
9231
  return this.filteredProxies.some((proxy) => proxy.id === this.selectedProxy);
9167
9232
  }
9168
- handleSupportedExtensionsChange() {
9169
- var _a2, _b2;
9170
- this.filteredProxies = this.proxies.filter((item) => {
9171
- var _a3, _b3, _c2;
9172
- const assetExtension = (_c2 = (_b3 = (_a3 = this.asset) == null ? void 0 : _a3.extension) == null ? void 0 : _b3.replace(/^\./, "")) != null ? _c2 : "";
9233
+ filterProxies(proxies) {
9234
+ return proxies.filter((item) => {
9235
+ var _a2, _b2, _c2;
9236
+ const assetExtension = (_c2 = (_b2 = (_a2 = this.asset) == null ? void 0 : _a2.extension) == null ? void 0 : _b2.replace(/^\./, "")) != null ? _c2 : "";
9173
9237
  if (!item.extension && this.asset && assetExtension) {
9174
9238
  return this.supportedExtensions.includes(assetExtension);
9175
9239
  }
9176
9240
  return true;
9177
9241
  });
9242
+ }
9243
+ handleSupportedExtensionsChange() {
9244
+ var _a2, _b2;
9245
+ this.filteredProxies = this.filterProxies(this.proxies);
9178
9246
  this.selectedProxy = (_b2 = (_a2 = this.filteredProxies[0]) == null ? void 0 : _a2.id) != null ? _b2 : "";
9179
9247
  }
9248
+ /**
9249
+ * What `autoSelectFormat` resolves to for this asset: the proxy to insert with, or `undefined`
9250
+ * when the dialog should open as usual.
9251
+ *
9252
+ * `{ proxy: undefined }` is deliberate rather than a miss — with the picker switched off there is
9253
+ * no format to name and the original file is the only outcome, which is `handleProxyConfirm`'s
9254
+ * no-proxy branch. With the picker on a proxy must actually resolve: confirming none emits
9255
+ * nothing and would turn the click into a silent no-op, so both an empty proxy list and a format
9256
+ * name that matches nothing fall back to the dialog.
9257
+ */
9258
+ resolveAutoSelection() {
9259
+ const requested = this.autoSelectFormat;
9260
+ if (!isAutoSelectFormatActive(requested)) {
9261
+ return void 0;
9262
+ }
9263
+ if (!this.canUseProxies) {
9264
+ return { proxy: void 0 };
9265
+ }
9266
+ if (requested === true) {
9267
+ const [first] = this.filteredProxies;
9268
+ return first ? { proxy: first } : void 0;
9269
+ }
9270
+ const wanted = String(requested).trim().toLowerCase();
9271
+ const match = this.filteredProxies.find((proxy) => {
9272
+ var _a2, _b2;
9273
+ return ((_a2 = proxy.proxyName) == null ? void 0 : _a2.toLowerCase()) === wanted || ((_b2 = proxy.proxyLabel) == null ? void 0 : _b2.toLowerCase()) === wanted;
9274
+ });
9275
+ return match ? { proxy: match } : void 0;
9276
+ }
9180
9277
  open({
9181
9278
  asset,
9182
9279
  isFavorite,
@@ -9184,16 +9281,51 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9184
9281
  proxies,
9185
9282
  proxiesFailed = false
9186
9283
  }) {
9284
+ var _a2, _b2;
9187
9285
  this.asset = asset;
9188
9286
  this.isFavorite = isFavorite;
9189
9287
  this.isAssetPinned = isAssetPinned;
9190
9288
  this.proxies = proxies;
9191
9289
  this.proxiesFailed = proxiesFailed;
9290
+ this.filteredProxies = this.filterProxies(this.proxies);
9291
+ this.selectedProxy = (_b2 = (_a2 = this.filteredProxies[0]) == null ? void 0 : _a2.id) != null ? _b2 : "";
9292
+ const autoSelection = this.disabledConfirm ? void 0 : this.resolveAutoSelection();
9293
+ if (autoSelection) {
9294
+ if (autoSelection.proxy) {
9295
+ this.selectedProxy = autoSelection.proxy.id;
9296
+ }
9297
+ if (!this.loadingConfirm) {
9298
+ this.handleProxyConfirm();
9299
+ }
9300
+ return;
9301
+ }
9302
+ this.loadingConfirm = false;
9192
9303
  this.isOpen = true;
9193
9304
  }
9194
9305
  hide() {
9195
9306
  this.handleClose();
9196
9307
  }
9308
+ /**
9309
+ * Show a dialog that `open()` skipped through the auto-confirm shortcut. The asset, proxies and
9310
+ * resolved selection are still in place, so this lands the user on exactly the dialog the
9311
+ * shortcut spared them, with its confirm button live again to retry.
9312
+ */
9313
+ revealAfterAutoConfirm() {
9314
+ if (!this.asset) {
9315
+ this.handleClose();
9316
+ return;
9317
+ }
9318
+ const autoSelection = this.resolveAutoSelection();
9319
+ if (autoSelection == null ? void 0 : autoSelection.proxy) {
9320
+ this.selectedProxy = autoSelection.proxy.id;
9321
+ }
9322
+ this.loadingConfirm = false;
9323
+ this.isOpen = true;
9324
+ }
9325
+ /** Whether the dialog is actually on screen — false when `open()` took the auto-confirm path. */
9326
+ get isDialogOpen() {
9327
+ return this.isOpen;
9328
+ }
9197
9329
  setVersionHistory(versions) {
9198
9330
  this.versions = versions;
9199
9331
  this.loadingVersionHistory = false;
@@ -9675,7 +9807,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9675
9807
  <cx-button
9676
9808
  class="content-browser-format__footer__button"
9677
9809
  variant="primary"
9678
- ?loading=${this.loadingProxies}
9810
+ ?loading=${this.loadingConfirm || this.loadingProxies}
9679
9811
  @click=${this.handleProxyConfirm}
9680
9812
  >
9681
9813
  <cx-icon slot="prefix" name="folder"></cx-icon>
@@ -9740,7 +9872,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9740
9872
  `;
9741
9873
  }
9742
9874
  handleRequestClose(event) {
9743
- if (this.loadingFavorites || this.loadingPinAsset) {
9875
+ if (this.loadingConfirm || this.loadingFavorites || this.loadingPinAsset) {
9744
9876
  event.preventDefault();
9745
9877
  return;
9746
9878
  }
@@ -9802,7 +9934,7 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9802
9934
  `;
9803
9935
  }
9804
9936
  };
9805
- CxContentBrowserFormatDialog.styles = [componentStyles, styles$5];
9937
+ CxContentBrowserFormatDialog.styles = [componentStyles, styles$6];
9806
9938
  CxContentBrowserFormatDialog.dependencies = {
9807
9939
  "cx-asset-link-format": CxAssetLinkFormat,
9808
9940
  "cx-cropper": CxCropper,
@@ -9818,16 +9950,16 @@ CxContentBrowserFormatDialog.dependencies = {
9818
9950
  "cx-tooltip": CxTooltip,
9819
9951
  "cx-typography": CxTypography
9820
9952
  };
9821
- __decorateClass$5([
9953
+ __decorateClass$6([
9822
9954
  e$7("cx-asset-link-format")
9823
9955
  ], CxContentBrowserFormatDialog.prototype, "assetLinkFormat", 2);
9824
- __decorateClass$5([
9956
+ __decorateClass$6([
9825
9957
  n$6({ reflect: false, type: Object })
9826
9958
  ], CxContentBrowserFormatDialog.prototype, "boundary", 2);
9827
- __decorateClass$5([
9959
+ __decorateClass$6([
9828
9960
  n$6({ attribute: false, reflect: false, type: Object })
9829
9961
  ], CxContentBrowserFormatDialog.prototype, "availableExtensions", 2);
9830
- __decorateClass$5([
9962
+ __decorateClass$6([
9831
9963
  n$6({
9832
9964
  attribute: "supported-extensions",
9833
9965
  converter: {
@@ -9838,7 +9970,7 @@ __decorateClass$5([
9838
9970
  type: Array
9839
9971
  })
9840
9972
  ], CxContentBrowserFormatDialog.prototype, "supportedExtensions", 2);
9841
- __decorateClass$5([
9973
+ __decorateClass$6([
9842
9974
  n$6({
9843
9975
  attribute: "supported-representative-subtypes",
9844
9976
  converter: {
@@ -9849,116 +9981,119 @@ __decorateClass$5([
9849
9981
  type: Array
9850
9982
  })
9851
9983
  ], CxContentBrowserFormatDialog.prototype, "supportedRepresentativeSubtypes", 2);
9852
- __decorateClass$5([
9984
+ __decorateClass$6([
9853
9985
  n$6({ attribute: "auto-extension", reflect: false, type: String })
9854
9986
  ], CxContentBrowserFormatDialog.prototype, "autoExtension", 2);
9855
- __decorateClass$5([
9987
+ __decorateClass$6([
9856
9988
  n$6({ attribute: "cta-text", reflect: false, type: String })
9857
9989
  ], CxContentBrowserFormatDialog.prototype, "ctaText", 2);
9858
- __decorateClass$5([
9990
+ __decorateClass$6([
9859
9991
  n$6({ attribute: "cta-text-transform", reflect: false, type: String })
9860
9992
  ], CxContentBrowserFormatDialog.prototype, "ctaTextTransform", 2);
9861
- __decorateClass$5([
9993
+ __decorateClass$6([
9862
9994
  n$6({ attribute: "can-custom-format", reflect: false, type: Boolean })
9863
9995
  ], CxContentBrowserFormatDialog.prototype, "canCustomFormat", 2);
9864
- __decorateClass$5([
9996
+ __decorateClass$6([
9865
9997
  n$6({ attribute: "can-favorite", reflect: false, type: Boolean })
9866
9998
  ], CxContentBrowserFormatDialog.prototype, "canFavorite", 2);
9867
- __decorateClass$5([
9999
+ __decorateClass$6([
9868
10000
  n$6({ attribute: "can-pin-asset", reflect: false, type: Boolean })
9869
10001
  ], CxContentBrowserFormatDialog.prototype, "canPinAsset", 2);
9870
- __decorateClass$5([
10002
+ __decorateClass$6([
9871
10003
  n$6({ attribute: "can-track", reflect: false, type: Boolean })
9872
10004
  ], CxContentBrowserFormatDialog.prototype, "canTrack", 2);
9873
- __decorateClass$5([
10005
+ __decorateClass$6([
9874
10006
  n$6({ attribute: "can-use-proxies", reflect: false, type: Boolean })
9875
10007
  ], CxContentBrowserFormatDialog.prototype, "canUseProxies", 2);
9876
- __decorateClass$5([
10008
+ __decorateClass$6([
10009
+ n$6({ attribute: "auto-select-format", converter: autoSelectFormatConverter, reflect: false })
10010
+ ], CxContentBrowserFormatDialog.prototype, "autoSelectFormat", 2);
10011
+ __decorateClass$6([
9877
10012
  n$6({ attribute: "simple-pick", reflect: false, type: Boolean })
9878
10013
  ], CxContentBrowserFormatDialog.prototype, "simplePick", 2);
9879
- __decorateClass$5([
10014
+ __decorateClass$6([
9880
10015
  n$6({ attribute: "can-view-versions", reflect: false, type: Boolean })
9881
10016
  ], CxContentBrowserFormatDialog.prototype, "canViewVersions", 2);
9882
- __decorateClass$5([
10017
+ __decorateClass$6([
9883
10018
  n$6({ reflect: true, type: String })
9884
10019
  ], CxContentBrowserFormatDialog.prototype, "variant", 2);
9885
- __decorateClass$5([
10020
+ __decorateClass$6([
9886
10021
  n$6({ attribute: "loading-favorites", reflect: true, type: Boolean })
9887
10022
  ], CxContentBrowserFormatDialog.prototype, "loadingFavorites", 2);
9888
- __decorateClass$5([
10023
+ __decorateClass$6([
9889
10024
  n$6({ attribute: "loading-pin-asset", reflect: true, type: Boolean })
9890
10025
  ], CxContentBrowserFormatDialog.prototype, "loadingPinAsset", 2);
9891
- __decorateClass$5([
10026
+ __decorateClass$6([
9892
10027
  n$6({ attribute: "loading-proxies", reflect: true, type: Boolean })
9893
10028
  ], CxContentBrowserFormatDialog.prototype, "loadingProxies", 2);
9894
- __decorateClass$5([
10029
+ __decorateClass$6([
9895
10030
  n$6({ attribute: "disabled-confirm", reflect: true, type: Boolean })
9896
10031
  ], CxContentBrowserFormatDialog.prototype, "disabledConfirm", 2);
9897
- __decorateClass$5([
10032
+ __decorateClass$6([
9898
10033
  n$6({ attribute: "token", type: String })
9899
10034
  ], CxContentBrowserFormatDialog.prototype, "token", 2);
9900
- __decorateClass$5([
10035
+ __decorateClass$6([
9901
10036
  n$6({ attribute: "base-url", type: String })
9902
10037
  ], CxContentBrowserFormatDialog.prototype, "baseUrl", 2);
9903
- __decorateClass$5([
10038
+ __decorateClass$6([
9904
10039
  r$6()
9905
10040
  ], CxContentBrowserFormatDialog.prototype, "asset", 2);
9906
- __decorateClass$5([
10041
+ __decorateClass$6([
9907
10042
  r$6()
9908
10043
  ], CxContentBrowserFormatDialog.prototype, "isOpen", 2);
9909
- __decorateClass$5([
10044
+ __decorateClass$6([
9910
10045
  r$6()
9911
10046
  ], CxContentBrowserFormatDialog.prototype, "isFavorite", 2);
9912
- __decorateClass$5([
10047
+ __decorateClass$6([
9913
10048
  r$6()
9914
10049
  ], CxContentBrowserFormatDialog.prototype, "isAssetPinned", 2);
9915
- __decorateClass$5([
10050
+ __decorateClass$6([
9916
10051
  r$6()
9917
10052
  ], CxContentBrowserFormatDialog.prototype, "proxies", 2);
9918
- __decorateClass$5([
10053
+ __decorateClass$6([
9919
10054
  r$6()
9920
10055
  ], CxContentBrowserFormatDialog.prototype, "proxiesFailed", 2);
9921
- __decorateClass$5([
10056
+ __decorateClass$6([
9922
10057
  r$6()
9923
10058
  ], CxContentBrowserFormatDialog.prototype, "showVersionHistory", 2);
9924
- __decorateClass$5([
10059
+ __decorateClass$6([
9925
10060
  r$6()
9926
10061
  ], CxContentBrowserFormatDialog.prototype, "showCustomFormat", 2);
9927
- __decorateClass$5([
10062
+ __decorateClass$6([
9928
10063
  r$6()
9929
10064
  ], CxContentBrowserFormatDialog.prototype, "loadingVersionHistory", 2);
9930
- __decorateClass$5([
10065
+ __decorateClass$6([
9931
10066
  r$6()
9932
10067
  ], CxContentBrowserFormatDialog.prototype, "versions", 2);
9933
- __decorateClass$5([
10068
+ __decorateClass$6([
9934
10069
  r$6()
9935
10070
  ], CxContentBrowserFormatDialog.prototype, "filteredProxies", 2);
9936
- __decorateClass$5([
10071
+ __decorateClass$6([
9937
10072
  r$6()
9938
10073
  ], CxContentBrowserFormatDialog.prototype, "selectedProxy", 2);
9939
- __decorateClass$5([
10074
+ __decorateClass$6([
9940
10075
  r$6()
9941
10076
  ], CxContentBrowserFormatDialog.prototype, "lastProxyBeforeCustomFormat", 2);
9942
- __decorateClass$5([
10077
+ __decorateClass$6([
9943
10078
  r$6()
9944
10079
  ], CxContentBrowserFormatDialog.prototype, "confirmedTransformations", 2);
9945
- __decorateClass$5([
10080
+ __decorateClass$6([
9946
10081
  r$6()
9947
10082
  ], CxContentBrowserFormatDialog.prototype, "confirmedFormat", 2);
9948
- __decorateClass$5([
10083
+ __decorateClass$6([
9949
10084
  r$6()
9950
10085
  ], CxContentBrowserFormatDialog.prototype, "loadingConfirm", 2);
9951
- __decorateClass$5([
10086
+ __decorateClass$6([
9952
10087
  r$6()
9953
10088
  ], CxContentBrowserFormatDialog.prototype, "enabledTracking", 2);
9954
- __decorateClass$5([
10089
+ __decorateClass$6([
9955
10090
  r$6()
9956
10091
  ], CxContentBrowserFormatDialog.prototype, "trackingParameters", 2);
9957
- __decorateClass$5([
10092
+ __decorateClass$6([
9958
10093
  watch("proxies", { waitUntilFirstUpdate: true }),
9959
10094
  watch("supportedExtensions")
9960
10095
  ], CxContentBrowserFormatDialog.prototype, "handleSupportedExtensionsChange", 1);
9961
- CxContentBrowserFormatDialog = __decorateClass$5([
10096
+ CxContentBrowserFormatDialog = __decorateClass$6([
9962
10097
  customElement("cx-content-browser-format-dialog")
9963
10098
  ], CxContentBrowserFormatDialog);
9964
10099
  function __decorate(decorators, target, key, desc) {
@@ -11757,7 +11892,7 @@ class GridLayout extends GridBaseLayout {
11757
11892
  this._scrollSize = size;
11758
11893
  }
11759
11894
  }
11760
- const styles$4 = i$7`
11895
+ const styles$5 = i$7`
11761
11896
  :host {
11762
11897
  display: block;
11763
11898
  }
@@ -11796,31 +11931,80 @@ const styles$4 = i$7`
11796
11931
  line-height: var(--cx-line-height-small);
11797
11932
  }
11798
11933
 
11799
- .content-browser-asset-card__checkbox {
11934
+ /*
11935
+ * Affordance only, never a second control: pointer-events stay off so the click lands on the card
11936
+ * beneath and takes the one path a card click already takes, and the button is aria-hidden and
11937
+ * untabbable so the card is still the single thing announced and focused.
11938
+ */
11939
+ .content-browser-asset-card__cta {
11940
+ /*
11941
+ * Positioned against the card's base, not the image slot, so the image box has to be described
11942
+ * here: inset by the card's own padding and given the same aspect-ratio ::part(image) carries,
11943
+ * which lands it exactly on the thumbnail. Without this it covers the title row too and centres
11944
+ * the button on the card rather than on the image. Keep the ratio in step with ::part(image).
11945
+ */
11800
11946
  position: absolute;
11801
- top: 2px;
11802
- right: 2px;
11947
+ inset: var(--cx-spacing-x-small);
11948
+ bottom: auto;
11949
+ aspect-ratio: 246 / 180;
11950
+ /*
11951
+ * The image slot's overflow clip does not reach an overlay positioned against the base, so the
11952
+ * rounding is restated. Inherited, not a token: the overlay is slotted into that image slot, so
11953
+ * it takes whatever radius the thumbnail is clipped to, overrides of ::part(image) included.
11954
+ */
11955
+ border-radius: inherit;
11803
11956
  z-index: 1;
11804
- }
11805
-
11806
- .content-browser-asset-card--disabled {
11957
+ display: flex;
11958
+ align-items: center;
11959
+ justify-content: center;
11960
+ background-color: rgb(0 0 0 / 35%);
11961
+ opacity: 0;
11962
+ pointer-events: none;
11963
+ transition: opacity 150ms ease;
11964
+ }
11965
+
11966
+ .content-browser-asset-card:hover .content-browser-asset-card__cta,
11967
+ .content-browser-asset-card:focus-within .content-browser-asset-card__cta,
11968
+ .content-browser-asset-card__cta--busy {
11969
+ opacity: 1;
11970
+ }
11971
+
11972
+ @media (prefers-reduced-motion: reduce) {
11973
+ .content-browser-asset-card__cta {
11974
+ transition: none;
11975
+ }
11976
+ }
11977
+
11978
+ .content-browser-asset-card__checkbox {
11979
+ position: absolute;
11980
+ top: 2px;
11981
+ right: 2px;
11982
+ z-index: 1;
11983
+ }
11984
+
11985
+ .content-browser-asset-card--disabled {
11807
11986
  cursor: default;
11808
11987
  pointer-events: none;
11809
11988
  }
11810
11989
  `;
11811
- var __defProp$4 = Object.defineProperty;
11812
- var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
11813
- var __decorateClass$4 = (decorators, target, key, kind) => {
11814
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
11990
+ var __defProp$5 = Object.defineProperty;
11991
+ var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
11992
+ var __decorateClass$5 = (decorators, target, key, kind) => {
11993
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
11815
11994
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
11816
11995
  if (decorator = decorators[i4])
11817
11996
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
11818
- if (kind && result) __defProp$4(target, key, result);
11997
+ if (kind && result) __defProp$5(target, key, result);
11819
11998
  return result;
11820
11999
  };
11821
12000
  let CxContentBrowserAssetCard = class extends CortexElement {
11822
12001
  constructor() {
11823
12002
  super(...arguments);
12003
+ this.localize = new LocalizeController(this);
12004
+ this.showCta = false;
12005
+ this.ctaText = "";
12006
+ this.ctaTextTransform = "capitalize";
12007
+ this.busy = false;
11824
12008
  this.imageUrl = "";
11825
12009
  this.originalUrl = "";
11826
12010
  this.scrubUrl = "";
@@ -11887,6 +12071,26 @@ let CxContentBrowserAssetCard = class extends CortexElement {
11887
12071
  ?thumbnail-only=${this.view === "small"}
11888
12072
  ?in-cold-storage=${this.inColdStorage}
11889
12073
  ></cx-content-browser-asset-preview>
12074
+ ${n$5(
12075
+ this.showCta && !this.inColdStorage,
12076
+ () => b`
12077
+ <div
12078
+ slot="image"
12079
+ class=${e$5({
12080
+ "content-browser-asset-card__cta": true,
12081
+ "content-browser-asset-card__cta--busy": this.busy
12082
+ })}
12083
+ aria-hidden="true"
12084
+ >
12085
+ <cx-button size="small" variant="primary" tabindex="-1" ?loading=${this.busy}>
12086
+ <span style=${o$1({ textTransform: this.ctaTextTransform })}>
12087
+ ${this.ctaText || this.localize.term("insert")}
12088
+ </span>
12089
+ </cx-button>
12090
+ </div>
12091
+ `,
12092
+ () => A
12093
+ )}
11890
12094
  <cx-space spacing="small" align-items="center" wrap="nowrap" class="content-browser-asset-card__info">
11891
12095
  ${n$5(
11892
12096
  this.showTitle && this.assetName,
@@ -11997,9 +12201,10 @@ let CxContentBrowserAssetCard = class extends CortexElement {
11997
12201
  `;
11998
12202
  }
11999
12203
  };
12000
- CxContentBrowserAssetCard.styles = [componentStyles, styles$4];
12204
+ CxContentBrowserAssetCard.styles = [componentStyles, styles$5];
12001
12205
  CxContentBrowserAssetCard.dependencies = {
12002
12206
  "cx-array-line-clamp": CxArrayLineClamp,
12207
+ "cx-button": CxButton,
12003
12208
  "cx-card": CxCard,
12004
12209
  "cx-checkbox": CxCheckbox,
12005
12210
  "cx-content-browser-asset-preview": CxContentBrowserAssetPreview,
@@ -12008,46 +12213,58 @@ CxContentBrowserAssetCard.dependencies = {
12008
12213
  "cx-tag": CxTag,
12009
12214
  "cx-typography": CxTypography
12010
12215
  };
12011
- __decorateClass$4([
12216
+ __decorateClass$5([
12217
+ n$6({ attribute: "show-cta", reflect: true, type: Boolean })
12218
+ ], CxContentBrowserAssetCard.prototype, "showCta", 2);
12219
+ __decorateClass$5([
12220
+ n$6({ attribute: "cta-text", reflect: false, type: String })
12221
+ ], CxContentBrowserAssetCard.prototype, "ctaText", 2);
12222
+ __decorateClass$5([
12223
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
12224
+ ], CxContentBrowserAssetCard.prototype, "ctaTextTransform", 2);
12225
+ __decorateClass$5([
12226
+ n$6({ attribute: "busy", reflect: true, type: Boolean })
12227
+ ], CxContentBrowserAssetCard.prototype, "busy", 2);
12228
+ __decorateClass$5([
12012
12229
  n$6({ attribute: "image-url", reflect: true, type: String })
12013
12230
  ], CxContentBrowserAssetCard.prototype, "imageUrl", 2);
12014
- __decorateClass$4([
12231
+ __decorateClass$5([
12015
12232
  n$6({ attribute: "original-url", reflect: true, type: String })
12016
12233
  ], CxContentBrowserAssetCard.prototype, "originalUrl", 2);
12017
- __decorateClass$4([
12234
+ __decorateClass$5([
12018
12235
  n$6({ attribute: "scrub-url", reflect: true, type: String })
12019
12236
  ], CxContentBrowserAssetCard.prototype, "scrubUrl", 2);
12020
- __decorateClass$4([
12237
+ __decorateClass$5([
12021
12238
  n$6({ attribute: "asset-id", reflect: true, type: String })
12022
12239
  ], CxContentBrowserAssetCard.prototype, "assetId", 2);
12023
- __decorateClass$4([
12240
+ __decorateClass$5([
12024
12241
  n$6({ attribute: "asset-name", reflect: true, type: String })
12025
12242
  ], CxContentBrowserAssetCard.prototype, "assetName", 2);
12026
- __decorateClass$4([
12243
+ __decorateClass$5([
12027
12244
  n$6({ attribute: "asset-width", reflect: true, type: String })
12028
12245
  ], CxContentBrowserAssetCard.prototype, "assetWidth", 2);
12029
- __decorateClass$4([
12246
+ __decorateClass$5([
12030
12247
  n$6({ attribute: "asset-height", reflect: true, type: String })
12031
12248
  ], CxContentBrowserAssetCard.prototype, "assetHeight", 2);
12032
- __decorateClass$4([
12249
+ __decorateClass$5([
12033
12250
  n$6({ attribute: "asset-size", reflect: true, type: String })
12034
12251
  ], CxContentBrowserAssetCard.prototype, "assetSize", 2);
12035
- __decorateClass$4([
12252
+ __decorateClass$5([
12036
12253
  n$6({ attribute: "extension", reflect: true, type: String })
12037
12254
  ], CxContentBrowserAssetCard.prototype, "extension", 2);
12038
- __decorateClass$4([
12255
+ __decorateClass$5([
12039
12256
  n$6({ attribute: "in-cold-storage", reflect: true, type: Boolean })
12040
12257
  ], CxContentBrowserAssetCard.prototype, "inColdStorage", 2);
12041
- __decorateClass$4([
12258
+ __decorateClass$5([
12042
12259
  n$6({ attribute: "doc-type", reflect: true, type: String })
12043
12260
  ], CxContentBrowserAssetCard.prototype, "docType", 2);
12044
- __decorateClass$4([
12261
+ __decorateClass$5([
12045
12262
  n$6({ attribute: "view", reflect: true, type: String })
12046
12263
  ], CxContentBrowserAssetCard.prototype, "view", 2);
12047
- __decorateClass$4([
12264
+ __decorateClass$5([
12048
12265
  n$6({ attribute: "selected", reflect: true, type: Boolean })
12049
12266
  ], CxContentBrowserAssetCard.prototype, "selected", 2);
12050
- __decorateClass$4([
12267
+ __decorateClass$5([
12051
12268
  n$6({
12052
12269
  converter: {
12053
12270
  fromAttribute: (value) => value ? value.split(",").map((tag) => tag.trim()).filter(Boolean) : [],
@@ -12062,25 +12279,25 @@ __decorateClass$4([
12062
12279
  type: String
12063
12280
  })
12064
12281
  ], CxContentBrowserAssetCard.prototype, "tags", 2);
12065
- __decorateClass$4([
12282
+ __decorateClass$5([
12066
12283
  n$6({ attribute: "show-tags", reflect: true, type: Boolean })
12067
12284
  ], CxContentBrowserAssetCard.prototype, "showTags", 2);
12068
- __decorateClass$4([
12285
+ __decorateClass$5([
12069
12286
  n$6({ attribute: "show-title", reflect: true, type: Boolean })
12070
12287
  ], CxContentBrowserAssetCard.prototype, "showTitle", 2);
12071
- __decorateClass$4([
12288
+ __decorateClass$5([
12072
12289
  n$6({ attribute: "show-size", reflect: true, type: Boolean })
12073
12290
  ], CxContentBrowserAssetCard.prototype, "showSize", 2);
12074
- __decorateClass$4([
12291
+ __decorateClass$5([
12075
12292
  n$6({ attribute: "show-dimensions", reflect: true, type: Boolean })
12076
12293
  ], CxContentBrowserAssetCard.prototype, "showDimensions", 2);
12077
- __decorateClass$4([
12294
+ __decorateClass$5([
12078
12295
  e$7("cx-content-browser-asset-preview")
12079
12296
  ], CxContentBrowserAssetCard.prototype, "preview", 2);
12080
- CxContentBrowserAssetCard = __decorateClass$4([
12297
+ CxContentBrowserAssetCard = __decorateClass$5([
12081
12298
  customElement("cx-content-browser-asset-card")
12082
12299
  ], CxContentBrowserAssetCard);
12083
- const styles$3 = i$7`
12300
+ const styles$4 = i$7`
12084
12301
  :host {
12085
12302
  display: flex;
12086
12303
  align-items: center;
@@ -12105,14 +12322,14 @@ const styles$3 = i$7`
12105
12322
  font-size: 96px;
12106
12323
  }
12107
12324
  `;
12108
- var __defProp$3 = Object.defineProperty;
12109
- var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
12110
- var __decorateClass$3 = (decorators, target, key, kind) => {
12111
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
12325
+ var __defProp$4 = Object.defineProperty;
12326
+ var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
12327
+ var __decorateClass$4 = (decorators, target, key, kind) => {
12328
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
12112
12329
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12113
12330
  if (decorator = decorators[i4])
12114
12331
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12115
- if (kind && result) __defProp$3(target, key, result);
12332
+ if (kind && result) __defProp$4(target, key, result);
12116
12333
  return result;
12117
12334
  };
12118
12335
  let CxContentBrowserNoResult = class extends CortexElement {
@@ -12131,17 +12348,17 @@ let CxContentBrowserNoResult = class extends CortexElement {
12131
12348
  `;
12132
12349
  }
12133
12350
  };
12134
- CxContentBrowserNoResult.styles = [componentStyles, styles$3];
12351
+ CxContentBrowserNoResult.styles = [componentStyles, styles$4];
12135
12352
  CxContentBrowserNoResult.dependencies = {
12136
12353
  "cx-icon": CxIcon
12137
12354
  };
12138
- __decorateClass$3([
12355
+ __decorateClass$4([
12139
12356
  n$6({ attribute: "icon", type: String })
12140
12357
  ], CxContentBrowserNoResult.prototype, "icon", 2);
12141
- __decorateClass$3([
12358
+ __decorateClass$4([
12142
12359
  n$6({ attribute: "message", type: String })
12143
12360
  ], CxContentBrowserNoResult.prototype, "message", 2);
12144
- CxContentBrowserNoResult = __decorateClass$3([
12361
+ CxContentBrowserNoResult = __decorateClass$4([
12145
12362
  customElement("cx-content-browser-no-result")
12146
12363
  ], CxContentBrowserNoResult);
12147
12364
  class ScrollAnchorController {
@@ -12193,8 +12410,8 @@ class ScrollAnchorController {
12193
12410
  this.cancelPendingRestore();
12194
12411
  const sequence = ++__privateWrapper(this, _restoreSequence)._;
12195
12412
  void __privateGet(this, _host).updateComplete.then(() => __async(this, null, function* () {
12196
- var _a2;
12197
- yield (_a2 = __privateGet(this, _getContainer).call(this)) == null ? void 0 : _a2.layoutComplete;
12413
+ var _a2, _b2;
12414
+ yield (_b2 = (_a2 = __privateGet(this, _getContainer).call(this)) == null ? void 0 : _a2.layoutComplete) == null ? void 0 : _b2.catch(() => void 0);
12198
12415
  if (sequence !== __privateGet(this, _restoreSequence)) {
12199
12416
  return;
12200
12417
  }
@@ -12271,7 +12488,7 @@ _columnCount = new WeakMap();
12271
12488
  _itemHeight = new WeakMap();
12272
12489
  _pendingRestoreFrames = new WeakMap();
12273
12490
  _restoreSequence = new WeakMap();
12274
- const styles$2 = i$7`
12491
+ const styles$3 = i$7`
12275
12492
  :host {
12276
12493
  display: block;
12277
12494
  flex: 1;
@@ -12313,24 +12530,24 @@ const styles$2 = i$7`
12313
12530
  --height: 4px;
12314
12531
  }
12315
12532
  `;
12316
- var __defProp$2 = Object.defineProperty;
12317
- var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
12318
- var __typeError2 = (msg) => {
12533
+ var __defProp$3 = Object.defineProperty;
12534
+ var __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor;
12535
+ var __typeError$2 = (msg) => {
12319
12536
  throw TypeError(msg);
12320
12537
  };
12321
- var __decorateClass$2 = (decorators, target, key, kind) => {
12322
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
12538
+ var __decorateClass$3 = (decorators, target, key, kind) => {
12539
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target;
12323
12540
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12324
12541
  if (decorator = decorators[i4])
12325
12542
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12326
- if (kind && result) __defProp$2(target, key, result);
12543
+ if (kind && result) __defProp$3(target, key, result);
12327
12544
  return result;
12328
12545
  };
12329
- var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
12330
- var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
12331
- 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);
12332
- var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
12333
- var _gutter, _lastHeight, _lastWidth;
12546
+ var __accessCheck$2 = (obj, member, msg) => member.has(obj) || __typeError$2("Cannot " + msg);
12547
+ var __privateGet$2 = (obj, member, getter) => (__accessCheck$2(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
12548
+ 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);
12549
+ var __privateSet$2 = (obj, member, value, setter) => (__accessCheck$2(obj, member, "write to private field"), member.set(obj, value), value);
12550
+ var _gutter, _lastHeight$1, _lastWidth;
12334
12551
  let CxContentBrowserGrid = class extends CortexElement {
12335
12552
  constructor() {
12336
12553
  super();
@@ -12345,12 +12562,16 @@ let CxContentBrowserGrid = class extends CortexElement {
12345
12562
  this.showSize = true;
12346
12563
  this.showDimensions = true;
12347
12564
  this.showTags = false;
12565
+ this.showCta = false;
12566
+ this.ctaText = "";
12567
+ this.ctaTextTransform = "capitalize";
12568
+ this.busyAssetId = void 0;
12348
12569
  this.selectedAssetId = void 0;
12349
12570
  this.assetMap = /* @__PURE__ */ new Map();
12350
12571
  this.columnWidth = 0;
12351
- __privateAdd2(this, _gutter, 8);
12352
- __privateAdd2(this, _lastHeight, 0);
12353
- __privateAdd2(this, _lastWidth, 0);
12572
+ __privateAdd$2(this, _gutter, 8);
12573
+ __privateAdd$2(this, _lastHeight$1, 0);
12574
+ __privateAdd$2(this, _lastWidth, 0);
12354
12575
  this.scrollAnchorController = new ScrollAnchorController(this, {
12355
12576
  getContainer: () => this.virtualizerEl,
12356
12577
  getItemIndexById: (id) => this.assets.findIndex((asset) => asset.id === id),
@@ -12363,7 +12584,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12363
12584
  }
12364
12585
  handleViewChange() {
12365
12586
  this.scrollAnchorController.capture();
12366
- this.calculatePageSize(__privateGet2(this, _lastWidth), __privateGet2(this, _lastHeight), true);
12587
+ this.calculatePageSize(__privateGet$2(this, _lastWidth), __privateGet$2(this, _lastHeight$1), true);
12367
12588
  }
12368
12589
  handleAssetsChange() {
12369
12590
  this.assetMap.clear();
@@ -12381,17 +12602,17 @@ let CxContentBrowserGrid = class extends CortexElement {
12381
12602
  this.debouncedCalculatePageSize(width, height);
12382
12603
  }
12383
12604
  calculatePageSize(width, height, force = false) {
12384
- const lastHeight = __privateGet2(this, _lastHeight);
12385
- const lastWidth = __privateGet2(this, _lastWidth);
12605
+ const lastHeight = __privateGet$2(this, _lastHeight$1);
12606
+ const lastWidth = __privateGet$2(this, _lastWidth);
12386
12607
  if (!force && Math.abs(lastHeight - height) < 10 && Math.abs(lastWidth - width) < 10) {
12387
12608
  return;
12388
12609
  }
12389
- __privateSet2(this, _lastHeight, height);
12390
- __privateSet2(this, _lastWidth, width);
12610
+ __privateSet$2(this, _lastHeight$1, height);
12611
+ __privateSet$2(this, _lastWidth, width);
12391
12612
  const { columnCount, rowCount } = this.calculateColumnCount(width, height);
12392
12613
  this.scrollAnchorController.setLayoutMetrics({
12393
12614
  columnCount,
12394
- itemHeight: Math.max(this.columnWidth, 150) + __privateGet2(this, _gutter)
12615
+ itemHeight: Math.max(this.columnWidth, 150) + __privateGet$2(this, _gutter)
12395
12616
  });
12396
12617
  this.emit("cx-content-browser-grid-resize", {
12397
12618
  detail: {
@@ -12411,12 +12632,12 @@ let CxContentBrowserGrid = class extends CortexElement {
12411
12632
  }
12412
12633
  const effectiveWidth = ((_a2 = this.virtualizerEl) == null ? void 0 : _a2.clientWidth) || width;
12413
12634
  const breakPoint = ((_b2 = ASSET_SIZE[this.view]) == null ? void 0 : _b2.minWidth) || ASSET_SIZE[GridView.Large].minWidth;
12414
- const columnCount = Math.max(1, Math.floor((effectiveWidth + __privateGet2(this, _gutter)) / (breakPoint + __privateGet2(this, _gutter))));
12635
+ const columnCount = Math.max(1, Math.floor((effectiveWidth + __privateGet$2(this, _gutter)) / (breakPoint + __privateGet$2(this, _gutter))));
12415
12636
  let rowCount = 0;
12416
12637
  if (height) {
12417
- rowCount = Math.ceil(height / (breakPoint + __privateGet2(this, _gutter)));
12638
+ rowCount = Math.ceil(height / (breakPoint + __privateGet$2(this, _gutter)));
12418
12639
  }
12419
- const newColumnWidth = Math.floor((effectiveWidth - __privateGet2(this, _gutter) * (columnCount + 1)) / columnCount);
12640
+ const newColumnWidth = Math.floor((effectiveWidth - __privateGet$2(this, _gutter) * (columnCount + 1)) / columnCount);
12420
12641
  if (newColumnWidth !== this.columnWidth) {
12421
12642
  this.columnWidth = newColumnWidth;
12422
12643
  }
@@ -12460,6 +12681,10 @@ let CxContentBrowserGrid = class extends CortexElement {
12460
12681
  ?show-size=${this.showSize}
12461
12682
  ?show-dimensions=${this.showDimensions}
12462
12683
  ?show-tags=${this.showTags}
12684
+ ?show-cta=${this.showCta}
12685
+ ?busy=${asset.id === this.busyAssetId}
12686
+ cta-text=${this.ctaText}
12687
+ cta-text-transform=${this.ctaTextTransform}
12463
12688
  ?in-cold-storage=${asset.inColdStorage}
12464
12689
  @click=${this.handleClick}
12465
12690
  ></cx-content-browser-asset-card>
@@ -12514,7 +12739,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12514
12739
  class="content-browser-grid__list"
12515
12740
  scroller
12516
12741
  .layout=${grid({
12517
- gap: `${__privateGet2(this, _gutter)}px`,
12742
+ gap: `${__privateGet$2(this, _gutter)}px`,
12518
12743
  itemSize: {
12519
12744
  height: `${Math.max(this.columnWidth, 150)}px`,
12520
12745
  width: `${this.columnWidth}px`
@@ -12540,7 +12765,7 @@ let CxContentBrowserGrid = class extends CortexElement {
12540
12765
  class="content-browser-grid-loading"
12541
12766
  style=${o$1({
12542
12767
  opacity: this.loading ? 1 : 0,
12543
- padding: `0 ${__privateGet2(this, _gutter) * 2}px ${__privateGet2(this, _gutter)}px`
12768
+ padding: `0 ${__privateGet$2(this, _gutter) * 2}px ${__privateGet$2(this, _gutter)}px`
12544
12769
  })}
12545
12770
  >
12546
12771
  <cx-progress-bar indeterminate></cx-progress-bar>
@@ -12554,9 +12779,9 @@ let CxContentBrowserGrid = class extends CortexElement {
12554
12779
  }
12555
12780
  };
12556
12781
  _gutter = /* @__PURE__ */ new WeakMap();
12557
- _lastHeight = /* @__PURE__ */ new WeakMap();
12782
+ _lastHeight$1 = /* @__PURE__ */ new WeakMap();
12558
12783
  _lastWidth = /* @__PURE__ */ new WeakMap();
12559
- CxContentBrowserGrid.styles = [componentStyles, styles$2];
12784
+ CxContentBrowserGrid.styles = [componentStyles, styles$3];
12560
12785
  CxContentBrowserGrid.dependencies = {
12561
12786
  "cx-button": CxButton,
12562
12787
  "cx-content-browser-asset-card": CxContentBrowserAssetCard,
@@ -12565,61 +12790,73 @@ CxContentBrowserGrid.dependencies = {
12565
12790
  "cx-progress-bar": CxProgressBar,
12566
12791
  "cx-resize-observer": CxResizeObserver
12567
12792
  };
12568
- __decorateClass$2([
12793
+ __decorateClass$3([
12569
12794
  e$7(".content-browser-grid")
12570
12795
  ], CxContentBrowserGrid.prototype, "containerEl", 2);
12571
- __decorateClass$2([
12796
+ __decorateClass$3([
12572
12797
  e$7("lit-virtualizer")
12573
12798
  ], CxContentBrowserGrid.prototype, "virtualizerEl", 2);
12574
- __decorateClass$2([
12799
+ __decorateClass$3([
12575
12800
  n$6({ attribute: "assets", reflect: false, type: Array })
12576
12801
  ], CxContentBrowserGrid.prototype, "assets", 2);
12577
- __decorateClass$2([
12802
+ __decorateClass$3([
12578
12803
  n$6({ attribute: "empty", reflect: true, type: Boolean })
12579
12804
  ], CxContentBrowserGrid.prototype, "empty", 2);
12580
- __decorateClass$2([
12805
+ __decorateClass$3([
12581
12806
  n$6({ attribute: "error", reflect: true, type: Boolean })
12582
12807
  ], CxContentBrowserGrid.prototype, "error", 2);
12583
- __decorateClass$2([
12808
+ __decorateClass$3([
12584
12809
  n$6({ attribute: "view", reflect: true, type: String })
12585
12810
  ], CxContentBrowserGrid.prototype, "view", 2);
12586
- __decorateClass$2([
12811
+ __decorateClass$3([
12587
12812
  n$6({ attribute: "has-more", reflect: true, type: Boolean })
12588
12813
  ], CxContentBrowserGrid.prototype, "hasMore", 2);
12589
- __decorateClass$2([
12814
+ __decorateClass$3([
12590
12815
  n$6({ attribute: "loading", reflect: true, type: Boolean })
12591
12816
  ], CxContentBrowserGrid.prototype, "loading", 2);
12592
- __decorateClass$2([
12817
+ __decorateClass$3([
12593
12818
  n$6({ attribute: "show-title", reflect: true, type: Boolean })
12594
12819
  ], CxContentBrowserGrid.prototype, "showTitle", 2);
12595
- __decorateClass$2([
12820
+ __decorateClass$3([
12596
12821
  n$6({ attribute: "show-size", reflect: true, type: Boolean })
12597
12822
  ], CxContentBrowserGrid.prototype, "showSize", 2);
12598
- __decorateClass$2([
12823
+ __decorateClass$3([
12599
12824
  n$6({ attribute: "show-dimensions", reflect: true, type: Boolean })
12600
12825
  ], CxContentBrowserGrid.prototype, "showDimensions", 2);
12601
- __decorateClass$2([
12826
+ __decorateClass$3([
12602
12827
  n$6({ attribute: "show-tags", reflect: true, type: Boolean })
12603
12828
  ], CxContentBrowserGrid.prototype, "showTags", 2);
12604
- __decorateClass$2([
12829
+ __decorateClass$3([
12830
+ n$6({ attribute: "show-cta", reflect: true, type: Boolean })
12831
+ ], CxContentBrowserGrid.prototype, "showCta", 2);
12832
+ __decorateClass$3([
12833
+ n$6({ attribute: "cta-text", reflect: false, type: String })
12834
+ ], CxContentBrowserGrid.prototype, "ctaText", 2);
12835
+ __decorateClass$3([
12836
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
12837
+ ], CxContentBrowserGrid.prototype, "ctaTextTransform", 2);
12838
+ __decorateClass$3([
12839
+ n$6({ attribute: false })
12840
+ ], CxContentBrowserGrid.prototype, "busyAssetId", 2);
12841
+ __decorateClass$3([
12605
12842
  n$6({ attribute: "selected-asset-id", reflect: true, type: String })
12606
12843
  ], CxContentBrowserGrid.prototype, "selectedAssetId", 2);
12607
- __decorateClass$2([
12844
+ __decorateClass$3([
12608
12845
  r$6()
12609
12846
  ], CxContentBrowserGrid.prototype, "assetMap", 2);
12610
- __decorateClass$2([
12847
+ __decorateClass$3([
12611
12848
  r$6()
12612
12849
  ], CxContentBrowserGrid.prototype, "columnWidth", 2);
12613
- __decorateClass$2([
12850
+ __decorateClass$3([
12614
12851
  watch("view", { waitUntilFirstUpdate: true })
12615
12852
  ], CxContentBrowserGrid.prototype, "handleViewChange", 1);
12616
- __decorateClass$2([
12853
+ __decorateClass$3([
12617
12854
  watch("assets")
12618
12855
  ], CxContentBrowserGrid.prototype, "handleAssetsChange", 1);
12619
- CxContentBrowserGrid = __decorateClass$2([
12856
+ CxContentBrowserGrid = __decorateClass$3([
12620
12857
  customElement("cx-content-browser-grid")
12621
12858
  ], CxContentBrowserGrid);
12622
- const styles$1 = i$7`
12859
+ const styles$2 = i$7`
12623
12860
  :host {
12624
12861
  display: block;
12625
12862
  }
@@ -12678,14 +12915,14 @@ const styles$1 = i$7`
12678
12915
  cursor: default;
12679
12916
  }
12680
12917
  `;
12681
- var __defProp$1 = Object.defineProperty;
12682
- var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
12683
- var __decorateClass$1 = (decorators, target, key, kind) => {
12684
- var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
12918
+ var __defProp$2 = Object.defineProperty;
12919
+ var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
12920
+ var __decorateClass$2 = (decorators, target, key, kind) => {
12921
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target;
12685
12922
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
12686
12923
  if (decorator = decorators[i4])
12687
12924
  result = (kind ? decorator(target, key, result) : decorator(result)) || result;
12688
- if (kind && result) __defProp$1(target, key, result);
12925
+ if (kind && result) __defProp$2(target, key, result);
12689
12926
  return result;
12690
12927
  };
12691
12928
  const LOGOUT_ITEM_VALUE = "logout";
@@ -12818,50 +13055,1373 @@ let CxContentBrowserHeader = class extends CortexElement {
12818
13055
  `;
12819
13056
  }
12820
13057
  };
12821
- CxContentBrowserHeader.styles = [componentStyles, styles$1];
13058
+ CxContentBrowserHeader.styles = [componentStyles, styles$2];
12822
13059
  CxContentBrowserHeader.dependencies = {
12823
13060
  "cx-avatar": CxAvatar,
12824
13061
  "cx-divider": CxDivider,
12825
13062
  "cx-dropdown": CxDropdown,
12826
13063
  "cx-icon": CxIcon,
12827
- "cx-icon-button": CxIconButton,
13064
+ "cx-icon-button": CxIconButton,
13065
+ "cx-line-clamp": CxLineClamp,
13066
+ "cx-menu": CxMenu,
13067
+ "cx-menu-item": CxMenuItem,
13068
+ "cx-skeleton": CxSkeleton,
13069
+ "cx-space": CxSpace,
13070
+ "cx-typography": CxTypography
13071
+ };
13072
+ __decorateClass$2([
13073
+ n$6({ type: Boolean })
13074
+ ], CxContentBrowserHeader.prototype, "bordered", 2);
13075
+ __decorateClass$2([
13076
+ n$6({ attribute: "application-name", type: String })
13077
+ ], CxContentBrowserHeader.prototype, "applicationName", 2);
13078
+ __decorateClass$2([
13079
+ n$6({ type: Boolean })
13080
+ ], CxContentBrowserHeader.prototype, "loading", 2);
13081
+ __decorateClass$2([
13082
+ n$6({ attribute: "is-fetching", type: Boolean })
13083
+ ], CxContentBrowserHeader.prototype, "isFetching", 2);
13084
+ __decorateClass$2([
13085
+ n$6({ attribute: "avatar", type: String })
13086
+ ], CxContentBrowserHeader.prototype, "avatar", 2);
13087
+ __decorateClass$2([
13088
+ n$6({ attribute: "full-name", type: String })
13089
+ ], CxContentBrowserHeader.prototype, "fullName", 2);
13090
+ __decorateClass$2([
13091
+ n$6({ attribute: "folder-title", type: String })
13092
+ ], CxContentBrowserHeader.prototype, "folderTitle", 2);
13093
+ __decorateClass$2([
13094
+ n$6({ attribute: "show-close-button", type: Boolean })
13095
+ ], CxContentBrowserHeader.prototype, "showCloseButton", 2);
13096
+ __decorateClass$2([
13097
+ n$6({ attribute: "can-logout", type: Boolean })
13098
+ ], CxContentBrowserHeader.prototype, "canLogout", 2);
13099
+ CxContentBrowserHeader = __decorateClass$2([
13100
+ customElement("cx-content-browser-header")
13101
+ ], CxContentBrowserHeader);
13102
+ const MIN_COLUMN_WIDTH = 92;
13103
+ let canvasContext = null;
13104
+ function measureTextWidth(text, font) {
13105
+ canvasContext != null ? canvasContext : canvasContext = document.createElement("canvas").getContext("2d");
13106
+ if (!canvasContext) {
13107
+ return 0;
13108
+ }
13109
+ canvasContext.font = font;
13110
+ return Math.ceil(canvasContext.measureText(text).width);
13111
+ }
13112
+ function fillSpareWidth(widths, columns, available) {
13113
+ const autoFit = columns.flatMap(({ saved }, index) => saved === void 0 ? [index] : []);
13114
+ const spare = available - widths.reduce((sum, width) => sum + width, 0);
13115
+ if (autoFit.length === 0 || spare <= 0) {
13116
+ return;
13117
+ }
13118
+ const part = Math.floor(spare / autoFit.length);
13119
+ autoFit.forEach((index) => {
13120
+ widths[index] += part;
13121
+ });
13122
+ widths[autoFit[autoFit.length - 1]] += spare - part * autoFit.length;
13123
+ }
13124
+ function layoutColumnWidths(columns, available) {
13125
+ const widths = columns.map(({ saved }) => saved === void 0 ? 0 : Math.max(MIN_COLUMN_WIDTH, Math.round(saved)));
13126
+ let left = available - widths.reduce((sum, width) => sum + width, 0);
13127
+ let open = columns.flatMap(({ saved }, index) => saved === void 0 ? [index] : []);
13128
+ const natural = (index) => Math.max(MIN_COLUMN_WIDTH, Math.ceil(columns[index].natural));
13129
+ let fitCount = 1;
13130
+ while (fitCount > 0 && open.length > 0) {
13131
+ const share = left / open.length;
13132
+ const fits = open.filter((index) => natural(index) <= share);
13133
+ for (const index of fits) {
13134
+ widths[index] = natural(index);
13135
+ left -= widths[index];
13136
+ }
13137
+ open = open.filter((index) => !fits.includes(index));
13138
+ fitCount = fits.length;
13139
+ }
13140
+ open.forEach((index) => {
13141
+ widths[index] = Math.max(MIN_COLUMN_WIDTH, Math.floor(left / open.length));
13142
+ });
13143
+ fillSpareWidth(widths, columns, available);
13144
+ return widths;
13145
+ }
13146
+ const styles$1 = i$7`
13147
+ /* Containing block for the absolutely positioned loading bar, which is a direct child. */
13148
+ :host {
13149
+ position: relative;
13150
+ display: flex;
13151
+ flex-direction: column;
13152
+ flex: 1;
13153
+ box-sizing: border-box;
13154
+ /*
13155
+ * A multi-line flex parent stretches an item to its own flex line's cross size rather than to
13156
+ * the container's width, and a row parent's automatic minimum refuses to shrink below content.
13157
+ * A definite width and a zero minimum keep a wide table scrolling inside the picker instead of
13158
+ * widening it (L-429EVG).
13159
+ */
13160
+ width: 100%;
13161
+ min-width: 0;
13162
+ min-height: 0;
13163
+ /*
13164
+ * The gap under the control bar belongs to the table, not to the shared cx-space above it, which
13165
+ * spaces the grid too. Fallback because an unthemed host resolves the token to nothing.
13166
+ */
13167
+ padding-top: var(--cx-spacing-medium, 16px);
13168
+ }
13169
+
13170
+ /*
13171
+ * The table is positioned out of flow, so the rows can never size this box: its height comes from
13172
+ * the container alone, in every host shape. A host slot that takes its height from a flex line
13173
+ * cannot be shorter than the height its contents report, and a table in flow reports every row it
13174
+ * holds, which paints the picker over the page below (L-42BBKC) and makes a row count read off it
13175
+ * grow with each page (L-42BFJC). The floor is the grid's own (lit-virtualizer's scroller
13176
+ * minimum), so a host that gives the picker no height gets a short table that scrolls, never one
13177
+ * that collapses to nothing.
13178
+ */
13179
+ .content-browser-table {
13180
+ position: relative;
13181
+ flex: 1 1 auto;
13182
+ min-height: 150px;
13183
+ }
13184
+
13185
+ .content-browser-table__table {
13186
+ --table-height: 100%;
13187
+ --content-browser-action-boundary: 100%;
13188
+
13189
+ position: absolute;
13190
+ inset: 0;
13191
+ }
13192
+
13193
+ :host([row-action-position='row-end']) .content-browser-table__table {
13194
+ --content-browser-action-boundary: var(--content-browser-table-width);
13195
+ }
13196
+
13197
+ .content-browser-table__table::part(content-browser-header),
13198
+ .content-browser-table__table::part(content-browser-frame)::before {
13199
+ box-sizing: border-box;
13200
+ width: min(100%, var(--content-browser-table-width, 100%));
13201
+ }
13202
+
13203
+ .content-browser-table__table::part(content-browser-header) {
13204
+ background-color: var(--header-background-color, var(--cx-color-neutral-50));
13205
+ border-top-left-radius: var(--border-radius);
13206
+ border-top-right-radius: var(--border-radius);
13207
+ }
13208
+
13209
+ .content-browser-table__table::part(content-browser-scrollport) {
13210
+ scrollbar-width: thin;
13211
+ }
13212
+
13213
+ .content-browser-table__table::part(content-browser-row) {
13214
+ min-width: 100%;
13215
+ }
13216
+
13217
+ /* The zero-width anchor follows the viewport edge without space in the column layout. */
13218
+ .content-browser-table__table::part(content-browser-action-anchor) {
13219
+ position: sticky;
13220
+ right: 0;
13221
+ width: 0;
13222
+ min-width: 0;
13223
+ flex: 0 0 0;
13224
+ margin-left: auto;
13225
+ margin-right: max(0px, calc(100% - var(--content-browser-action-boundary)));
13226
+ align-self: stretch;
13227
+ background-color: inherit;
13228
+ /* The frame can cross the action after a small shrink. Keep its border below the button. */
13229
+ z-index: 2;
13230
+ }
13231
+
13232
+ .content-browser-table__table::part(content-browser-action) {
13233
+ position: absolute;
13234
+ inset: 0 0 0 auto;
13235
+ box-sizing: border-box;
13236
+ display: flex;
13237
+ align-items: center;
13238
+ padding: 0 var(--cell-padding-right, 8px) 0 var(--cell-padding-left, 8px);
13239
+ background-color: inherit;
13240
+ /* Leave the data-cell separator visible without a line across empty space. */
13241
+ background-clip: padding-box;
13242
+ border-bottom: var(--border-width, 1px) solid transparent;
13243
+ border-right: var(--border-width, 1px) solid transparent;
13244
+ }
13245
+
13246
+ .content-browser-table-loading {
13247
+ position: absolute;
13248
+ top: 0;
13249
+ width: 100%;
13250
+ z-index: var(--cx-z-index-drawer);
13251
+ }
13252
+
13253
+ .content-browser-table-loading cx-progress-bar {
13254
+ --height: 4px;
13255
+ }
13256
+
13257
+ .content-browser-table__empty {
13258
+ height: 100%;
13259
+ }
13260
+
13261
+ .content-browser-table__page-error {
13262
+ flex: none;
13263
+ display: flex;
13264
+ align-items: center;
13265
+ justify-content: center;
13266
+ gap: var(--cx-spacing-small, 8px);
13267
+ padding: var(--cx-spacing-small, 8px);
13268
+ border-top: 1px solid var(--cx-color-neutral-200, #e5e5e5);
13269
+ background-color: var(--cx-color-neutral-0, #fff);
13270
+ color: var(--cx-color-neutral);
13271
+ }
13272
+ `;
13273
+ var __defProp$1 = Object.defineProperty;
13274
+ var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
13275
+ var __typeError$1 = (msg) => {
13276
+ throw TypeError(msg);
13277
+ };
13278
+ var __decorateClass$1 = (decorators, target, key, kind) => {
13279
+ var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target;
13280
+ for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
13281
+ if (decorator = decorators[i4])
13282
+ result = (kind ? decorator(target, key, result) : decorator(result)) || result;
13283
+ if (kind && result) __defProp$1(target, key, result);
13284
+ return result;
13285
+ };
13286
+ var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError$1("Cannot " + msg);
13287
+ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
13288
+ 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);
13289
+ var __privateSet$1 = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
13290
+ 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;
13291
+ const CxTable = CxColorSwatchGroup.dependencies["cx-table"];
13292
+ const ROW_HEIGHT = 48;
13293
+ const FILLER_FIELD = "filler";
13294
+ const RESIZE_BUFFER_WIDTH = 6;
13295
+ const NO_HOVER_QUERIES = ["(hover: none)"];
13296
+ const COLUMN_DEFAULTS = {
13297
+ headerSort: false,
13298
+ resizable: true
13299
+ };
13300
+ function canvasFont(element) {
13301
+ const { fontFamily, fontSize, fontStyle, fontWeight } = getComputedStyle(element);
13302
+ return `${fontStyle} ${fontWeight} ${fontSize} ${fontFamily}`;
13303
+ }
13304
+ function horizontalPadding(element) {
13305
+ const style = getComputedStyle(element);
13306
+ return (Number.parseFloat(style.paddingLeft) || 0) + (Number.parseFloat(style.paddingRight) || 0) + (Number.parseFloat(style.borderLeftWidth) || 0) + (Number.parseFloat(style.borderRightWidth) || 0);
13307
+ }
13308
+ function unroundedClientWidth(element) {
13309
+ const style = getComputedStyle(element);
13310
+ const width = Number.parseFloat(style.width) || 0;
13311
+ if (style.boxSizing === "border-box") {
13312
+ return width - (Number.parseFloat(style.borderLeftWidth) || 0) - (Number.parseFloat(style.borderRightWidth) || 0);
13313
+ }
13314
+ return width + (Number.parseFloat(style.paddingLeft) || 0) + (Number.parseFloat(style.paddingRight) || 0);
13315
+ }
13316
+ function readCellValue(asset, field) {
13317
+ if (!Object.prototype.hasOwnProperty.call(asset, field)) {
13318
+ return "";
13319
+ }
13320
+ const value = asset[field];
13321
+ if (value === void 0 || value === null || typeof value === "object") {
13322
+ return "";
13323
+ }
13324
+ return String(value);
13325
+ }
13326
+ function columnsSignature(columns) {
13327
+ return JSON.stringify(columns.map(({ field, title }) => [field, title]));
13328
+ }
13329
+ function isAppendOf(previous, next) {
13330
+ return previous.length > 0 && next.length > previous.length && previous.every((asset, index) => next[index] === asset);
13331
+ }
13332
+ function renderCellContent(value, inColdStorage) {
13333
+ const content = document.createElement("cx-line-clamp");
13334
+ content.setAttribute("lines", "1");
13335
+ if (value) {
13336
+ content.title = value;
13337
+ }
13338
+ if (inColdStorage) {
13339
+ content.style.opacity = "0.5";
13340
+ }
13341
+ content.textContent = value;
13342
+ return content;
13343
+ }
13344
+ let CxContentBrowserTable = class extends CortexElement {
13345
+ constructor() {
13346
+ super(...arguments);
13347
+ this.localize = new LocalizeController(this);
13348
+ this.assets = [];
13349
+ this.columns = [];
13350
+ this.ctaText = "";
13351
+ this.ctaTextTransform = "capitalize";
13352
+ this.empty = false;
13353
+ this.error = false;
13354
+ this.hasMore = false;
13355
+ this.loading = false;
13356
+ this.selectedAssetId = void 0;
13357
+ this.busyAssetId = void 0;
13358
+ this.hiddenFields = [];
13359
+ this.savedWidths = {};
13360
+ this.widthScope = void 0;
13361
+ this.rowActionPosition = "host-edge";
13362
+ this.assetMap = /* @__PURE__ */ new Map();
13363
+ __privateAdd$1(this, _columnDefinitions, []);
13364
+ __privateAdd$1(this, _columnsSignature, "");
13365
+ __privateAdd$1(this, _columnKeys, /* @__PURE__ */ new Map());
13366
+ __privateAdd$1(this, _rowsNeedRebuild, false);
13367
+ __privateAdd$1(this, _heldRowKeys, /* @__PURE__ */ new Set());
13368
+ __privateAdd$1(this, _resizedWidths, /* @__PURE__ */ new Map());
13369
+ __privateAdd$1(this, _sessionWidths, /* @__PURE__ */ new Map());
13370
+ __privateAdd$1(this, _ctas, /* @__PURE__ */ new WeakMap());
13371
+ __privateAdd$1(this, _renderedCtas, /* @__PURE__ */ new Set());
13372
+ __privateAdd$1(this, _pointerTrackedRows, /* @__PURE__ */ new WeakSet());
13373
+ __privateAdd$1(this, _hoveredRow);
13374
+ __privateAdd$1(this, _focusedCta);
13375
+ __privateAdd$1(this, _ctaFocusedAtRender);
13376
+ __privateAdd$1(this, _noHoverQueries, []);
13377
+ __privateAdd$1(this, _hasNoHover, false);
13378
+ __privateAdd$1(this, _builtTable);
13379
+ __privateAdd$1(this, _syncedAssets, []);
13380
+ __privateAdd$1(this, _pendingReplaces, 0);
13381
+ __privateAdd$1(this, _lastHeight, 0);
13382
+ __privateAdd$1(this, _containerSize);
13383
+ __privateAdd$1(this, _lastRowCount);
13384
+ __privateAdd$1(this, _rowCountHeld, false);
13385
+ __privateAdd$1(this, _lastRowObserver);
13386
+ __privateAdd$1(this, _layoutScrollbarWidth, 0);
13387
+ __privateAdd$1(this, _naturalWidths, /* @__PURE__ */ new Map());
13388
+ __privateAdd$1(this, _layoutPending, false);
13389
+ __privateAdd$1(this, _fontsPending, false);
13390
+ __privateAdd$1(this, _frameWidthObserver);
13391
+ this.debouncedApplyColumnLayout = debounce(this.applyColumnLayout, 100);
13392
+ this.handleNoHoverChange = () => {
13393
+ this.setNoHover(__privateGet$1(this, _noHoverQueries).some((list) => list.matches));
13394
+ };
13395
+ this.debouncedRedrawTable = debounce(this.redrawTable, 100);
13396
+ this.debouncedCalculatePageSize = debounce(this.calculatePageSize, 200);
13397
+ this.debouncedHandleLastRowVisible = debounce(this.handleLastRowVisible, 200);
13398
+ this.handleResizeHandleDoubleClick = (event) => {
13399
+ var _a2, _b2, _c2, _d2;
13400
+ const handle = (_b2 = (_a2 = event.target) == null ? void 0 : _a2.closest) == null ? void 0 : _b2.call(_a2, ".tabulator-col-resize-handle");
13401
+ if (!handle) {
13402
+ return;
13403
+ }
13404
+ event.stopPropagation();
13405
+ const key = (_c2 = handle.previousElementSibling) == null ? void 0 : _c2.getAttribute("tabulator-field");
13406
+ const field = this.fieldOfKey(key);
13407
+ const column = key ? (_d2 = this.tabulator) == null ? void 0 : _d2.getColumn(key) : void 0;
13408
+ if (field === void 0 || !column) {
13409
+ return;
13410
+ }
13411
+ __privateGet$1(this, _resizedWidths).delete(field.trim());
13412
+ __privateGet$1(this, _sessionWidths).delete(field.trim());
13413
+ this.applyColumnLayout();
13414
+ this.emit("cx-content-browser-table-column-resize", {
13415
+ detail: {
13416
+ field,
13417
+ reset: true,
13418
+ width: Math.round(column.getWidth())
13419
+ }
13420
+ });
13421
+ };
13422
+ this.debouncedHandleScrollEnd = debounce(this.handleScrollEnd, 200);
13423
+ }
13424
+ get tabulator() {
13425
+ var _a2, _b2;
13426
+ const instance2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0;
13427
+ return instance2 !== void 0 && instance2 === __privateGet$1(this, _builtTable) && !instance2.destroyed ? instance2 : void 0;
13428
+ }
13429
+ /**
13430
+ * The current Tabulator instance, built or not. Tabulator shows its header and frame as it builds,
13431
+ * but fires `tableBuilt` only after its data-load debounce.
13432
+ */
13433
+ get buildingTabulator() {
13434
+ var _a2, _b2;
13435
+ const instance2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0;
13436
+ return instance2 && !instance2.destroyed ? instance2 : void 0;
13437
+ }
13438
+ /** Tabulator's row holder: the one element that scrolls the rows. */
13439
+ get scrollport() {
13440
+ var _a2, _b2, _c2;
13441
+ return (_c2 = (_b2 = (_a2 = this.tabulator) == null ? void 0 : _a2.rowManager) == null ? void 0 : _b2.element) != null ? _c2 : void 0;
13442
+ }
13443
+ /** Each host column's row key, in order: a field the host repeats takes a key per occurrence. */
13444
+ resolveColumnKeys() {
13445
+ const occurrences = /* @__PURE__ */ new Map();
13446
+ return this.columns.map(({ field }) => {
13447
+ var _a2, _b2;
13448
+ const occurrence = (_a2 = occurrences.get(field)) != null ? _a2 : 0;
13449
+ const identity2 = `${field}\0${occurrence}`;
13450
+ const key = (_b2 = __privateGet$1(this, _columnKeys).get(identity2)) != null ? _b2 : `column${__privateGet$1(this, _columnKeys).size}`;
13451
+ occurrences.set(field, occurrence + 1);
13452
+ __privateGet$1(this, _columnKeys).set(identity2, key);
13453
+ return key;
13454
+ });
13455
+ }
13456
+ buildColumnDefinitions() {
13457
+ return [...this.buildDataColumnDefinitions(), this.buildFillerColumnDefinition()];
13458
+ }
13459
+ /**
13460
+ * A pixel width for each column, so the `fitData` layout never sizes it from its content. The
13461
+ * auto-fit sets the real width once the columns are built (see `applyColumnLayout`). Until then a
13462
+ * column keeps the width it had in the previous definitions.
13463
+ */
13464
+ buildDataColumnDefinitions() {
13465
+ const hidden = new Set(this.hiddenFields);
13466
+ const keys2 = this.resolveColumnKeys();
13467
+ const previousWidths = new Map(__privateGet$1(this, _columnDefinitions).map(({ field, width }) => [String(field), width]));
13468
+ return this.columns.map((column, index) => {
13469
+ var _a2, _b2;
13470
+ const previous = previousWidths.get(keys2[index]);
13471
+ return {
13472
+ field: keys2[index],
13473
+ formatter: (cell) => {
13474
+ var _a3;
13475
+ const row = cell.getRow();
13476
+ const inColdStorage = Boolean(row.getData().inColdStorage);
13477
+ if (inColdStorage) {
13478
+ row.getElement().style.pointerEvents = "none";
13479
+ }
13480
+ return renderCellContent(String((_a3 = cell.getValue()) != null ? _a3 : ""), inColdStorage);
13481
+ },
13482
+ // Never `false`: Tabulator awaits a `show()` for it as it builds the header.
13483
+ hidden: hidden.has(column.field) || void 0,
13484
+ minWidth: MIN_COLUMN_WIDTH,
13485
+ title: column.title,
13486
+ // A node, as for a cell: `cx-table` parses a title string as HTML.
13487
+ titleFormatter: (cell) => {
13488
+ var _a3;
13489
+ return renderCellContent(String((_a3 = cell.getValue()) != null ? _a3 : ""), false);
13490
+ },
13491
+ width: (_b2 = (_a2 = __privateGet$1(this, _resizedWidths).get(column.field.trim())) != null ? _a2 : __privateGet$1(this, _sessionWidths).get(column.field.trim())) != null ? _b2 : typeof previous === "number" ? previous : MIN_COLUMN_WIDTH
13492
+ };
13493
+ });
13494
+ }
13495
+ /**
13496
+ * Tabulator replaces its rows with a placeholder when no columns remain visible. This invisible
13497
+ * column keeps the rows and their actions available when the host hides every data column.
13498
+ * Its small, fixed width gives the final resize handle a buffer without a visible empty column.
13499
+ */
13500
+ buildFillerColumnDefinition() {
13501
+ return {
13502
+ field: FILLER_FIELD,
13503
+ formatter: (cell) => {
13504
+ const element = cell.getElement();
13505
+ if (element) {
13506
+ element.style.padding = "0";
13507
+ element.style.visibility = "hidden";
13508
+ element.style.pointerEvents = "none";
13509
+ element.setAttribute("aria-hidden", "true");
13510
+ }
13511
+ return "";
13512
+ },
13513
+ headerSort: false,
13514
+ // A column laid out at 0 loses its width style, and renders as wide as its content.
13515
+ minWidth: RESIZE_BUFFER_WIDTH,
13516
+ resizable: false,
13517
+ title: "",
13518
+ titleFormatter: (cell) => {
13519
+ const header = cell.getColumn().getElement();
13520
+ header.style.opacity = "0";
13521
+ header.style.borderRight = "none";
13522
+ header.style.pointerEvents = "none";
13523
+ header.setAttribute("aria-label", this.ctaLabel);
13524
+ return "";
13525
+ },
13526
+ width: RESIZE_BUFFER_WIDTH
13527
+ };
13528
+ }
13529
+ get ctaLabel() {
13530
+ return this.ctaText || this.localize.term("insert");
13531
+ }
13532
+ /** The action overlays its row and takes no column width. */
13533
+ renderRowAction(row) {
13534
+ var _a2;
13535
+ const data = row.getData();
13536
+ const rowElement = row.getElement();
13537
+ const previous = __privateGet$1(this, _ctas).get(rowElement);
13538
+ rowElement.part.add("content-browser-row");
13539
+ previous == null ? void 0 : previous.container.remove();
13540
+ if (previous) {
13541
+ __privateGet$1(this, _renderedCtas).delete(previous);
13542
+ __privateGet$1(this, _ctas).delete(rowElement);
13543
+ }
13544
+ if (data.inColdStorage) {
13545
+ rowElement.style.pointerEvents = "none";
13546
+ return;
13547
+ }
13548
+ rowElement.style.pointerEvents = "";
13549
+ const container = document.createElement("div");
13550
+ const overlay = document.createElement("div");
13551
+ const button = document.createElement("cx-button");
13552
+ const label = document.createElement("span");
13553
+ const cta = { assetId: String((_a2 = data.id) != null ? _a2 : ""), button, container, label, rowElement };
13554
+ container.part.add("content-browser-action-anchor");
13555
+ container.setAttribute("role", "gridcell");
13556
+ overlay.part.add("content-browser-action");
13557
+ overlay.append(button);
13558
+ container.append(overlay);
13559
+ rowElement.append(container);
13560
+ rowElement.style.cursor = "default";
13561
+ button.classList.add("content-browser-table__cta");
13562
+ button.setAttribute("size", "small");
13563
+ button.setAttribute("variant", "primary");
13564
+ button.style.width = "max-content";
13565
+ button.style.maxWidth = "none";
13566
+ label.style.whiteSpace = "nowrap";
13567
+ button.append(label);
13568
+ button.addEventListener("click", (event) => {
13569
+ if (event.detail <= 1) {
13570
+ this.insertAsset(cta.assetId);
13571
+ }
13572
+ });
13573
+ button.addEventListener("focusin", () => {
13574
+ __privateSet$1(this, _focusedCta, cta);
13575
+ this.paintCta(cta);
13576
+ });
13577
+ button.addEventListener("focusout", () => {
13578
+ if (__privateGet$1(this, _focusedCta) === cta) {
13579
+ __privateSet$1(this, _focusedCta, void 0);
13580
+ }
13581
+ this.paintCta(cta);
13582
+ });
13583
+ __privateGet$1(this, _ctas).set(rowElement, cta);
13584
+ __privateGet$1(this, _renderedCtas).add(cta);
13585
+ this.trackPointer(rowElement);
13586
+ this.paintCta(cta);
13587
+ }
13588
+ isCtaShown(cta) {
13589
+ 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");
13590
+ }
13591
+ /** In place, never rebuilt: a new button would drop the keyboard focus the old one held. */
13592
+ paintCta(cta) {
13593
+ const text = this.ctaLabel;
13594
+ if (cta.label.textContent !== text) {
13595
+ cta.label.textContent = text;
13596
+ }
13597
+ cta.label.style.textTransform = this.ctaTextTransform;
13598
+ cta.button.loading = cta.assetId === this.busyAssetId;
13599
+ const shown = this.isCtaShown(cta);
13600
+ cta.container.style.opacity = shown ? "1" : "0";
13601
+ cta.container.style.pointerEvents = shown ? "" : "none";
13602
+ }
13603
+ paintRowCta(rowElement) {
13604
+ const cta = rowElement ? __privateGet$1(this, _ctas).get(rowElement) : void 0;
13605
+ if (cta) {
13606
+ this.paintCta(cta);
13607
+ }
13608
+ }
13609
+ paintAssetCta(assetId) {
13610
+ var _a2;
13611
+ this.paintRowCta((_a2 = this.findRow(assetId)) == null ? void 0 : _a2.getElement());
13612
+ }
13613
+ trackPointer(rowElement) {
13614
+ if (__privateGet$1(this, _pointerTrackedRows).has(rowElement)) {
13615
+ return;
13616
+ }
13617
+ __privateGet$1(this, _pointerTrackedRows).add(rowElement);
13618
+ rowElement.addEventListener("mouseenter", () => this.setHoveredRow(rowElement));
13619
+ rowElement.addEventListener("mouseleave", () => {
13620
+ if (__privateGet$1(this, _hoveredRow) === rowElement) {
13621
+ this.setHoveredRow(void 0);
13622
+ }
13623
+ });
13624
+ }
13625
+ setHoveredRow(rowElement) {
13626
+ const previous = __privateGet$1(this, _hoveredRow);
13627
+ __privateSet$1(this, _hoveredRow, rowElement);
13628
+ this.paintRowCta(previous);
13629
+ this.paintRowCta(rowElement);
13630
+ }
13631
+ /**
13632
+ * Tabulator takes a row that scrolls out of its render window off the page, and a row taken off
13633
+ * the page gets no `mouseleave` to hide its CTA, nor need its button get a `focusout` for the
13634
+ * focus it drops.
13635
+ */
13636
+ releaseDetachedCta() {
13637
+ var _a2;
13638
+ if (((_a2 = __privateGet$1(this, _hoveredRow)) == null ? void 0 : _a2.isConnected) === false) {
13639
+ this.setHoveredRow(void 0);
13640
+ }
13641
+ const focused = __privateGet$1(this, _focusedCta);
13642
+ if ((focused == null ? void 0 : focused.button.isConnected) === false) {
13643
+ __privateSet$1(this, _focusedCta, void 0);
13644
+ this.paintCta(focused);
13645
+ }
13646
+ }
13647
+ /** Lays the columns and the rendered rows out again. */
13648
+ redrawTable() {
13649
+ var _a2;
13650
+ (_a2 = this.tabulator) == null ? void 0 : _a2.redraw();
13651
+ this.syncTableFrame();
13652
+ }
13653
+ /** The frame ends at the data columns. The scrollport remains available to the row actions. */
13654
+ syncTableFrame() {
13655
+ var _a2, _b2, _c2;
13656
+ const columns = (_a2 = this.buildingTabulator) == null ? void 0 : _a2.getColumns();
13657
+ const widths = (_b2 = columns == null ? void 0 : columns.filter((column) => column.getField() !== FILLER_FIELD && column.isVisible()).map((column) => column.getWidth())) != null ? _b2 : [];
13658
+ const width = widths.every((value) => value > 0) ? widths.reduce((total, value) => total + value, 0) : 0;
13659
+ (_c2 = this.tableEl) == null ? void 0 : _c2.style.setProperty("--content-browser-table-width", width > 0 ? `${width + RESIZE_BUFFER_WIDTH}px` : "100%");
13660
+ }
13661
+ /**
13662
+ * Tabulator renders the rows again -- for an appended page, a redraw of its own or one of ours --
13663
+ * by taking every rendered row off the page and back, which drops the keyboard focus, so the CTA
13664
+ * that held it gets it back.
13665
+ */
13666
+ handleRenderStarted(event) {
13667
+ var _a2;
13668
+ event.stopPropagation();
13669
+ const button = (_a2 = __privateGet$1(this, _focusedCta)) == null ? void 0 : _a2.button;
13670
+ __privateSet$1(this, _ctaFocusedAtRender, (button == null ? void 0 : button.matches(":focus-within")) ? button : void 0);
13671
+ }
13672
+ handleRenderComplete(event) {
13673
+ event.stopPropagation();
13674
+ if (this.getScrollbarWidth() !== __privateGet$1(this, _layoutScrollbarWidth)) {
13675
+ this.applyColumnLayout(false);
13676
+ }
13677
+ this.syncTableFrame();
13678
+ const button = __privateGet$1(this, _ctaFocusedAtRender);
13679
+ __privateSet$1(this, _ctaFocusedAtRender, void 0);
13680
+ if ((button == null ? void 0 : button.isConnected) && !button.matches(":focus-within")) {
13681
+ button.focus({ preventScroll: true });
13682
+ }
13683
+ }
13684
+ toRow(asset, keys2) {
13685
+ const row = {
13686
+ id: asset.id,
13687
+ inColdStorage: Boolean(asset.inColdStorage)
13688
+ };
13689
+ this.columns.forEach((column, index) => {
13690
+ row[keys2[index]] = readCellValue(asset, column.field);
13691
+ });
13692
+ return row;
13693
+ }
13694
+ findRow(assetId) {
13695
+ var _a2;
13696
+ if (!assetId) {
13697
+ return void 0;
13698
+ }
13699
+ return ((_a2 = this.tabulator) == null ? void 0 : _a2.getRow(assetId)) || void 0;
13700
+ }
13701
+ /**
13702
+ * `aria-current`, not `aria-selected`: this is a `grid` with no selection model of its own. The
13703
+ * row is never selected in Tabulator, so an import does not paint `cx-table`'s selected-row highlight.
13704
+ */
13705
+ markCurrentRow(assetId, current) {
13706
+ const row = this.findRow(assetId);
13707
+ if (!row) {
13708
+ return;
13709
+ }
13710
+ row.getElement().setAttribute("aria-current", current ? "true" : "false");
13711
+ }
13712
+ /**
13713
+ * The fonts and the padding of a rendered header title and data cell. A table with no rendered
13714
+ * cell measures the values in the header font, with the header padding.
13715
+ */
13716
+ readColumnMetrics(columns) {
13717
+ var _a2, _b2, _c2, _d2, _e2;
13718
+ const header = columns.map((column) => column.getElement()).find((element) => element.isConnected);
13719
+ 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");
13720
+ if (!header || !title) {
13721
+ return void 0;
13722
+ }
13723
+ const headerFont = canvasFont(title);
13724
+ const headerContent = header.querySelector(".tabulator-col-content");
13725
+ const headerPadding = horizontalPadding(header) + (headerContent ? horizontalPadding(headerContent) : 0) + horizontalPadding((_b2 = title.closest(".tabulator-col-title")) != null ? _b2 : title);
13726
+ const key = (_c2 = header.getAttribute("tabulator-field")) != null ? _c2 : "";
13727
+ const cell = (_e2 = (_d2 = this.tableEl) == null ? void 0 : _d2.shadowRoot) == null ? void 0 : _e2.querySelector(`.tabulator-row .tabulator-cell[tabulator-field="${key}"]`);
13728
+ const text = cell == null ? void 0 : cell.querySelector("cx-line-clamp");
13729
+ if (!cell || !text) {
13730
+ return { cellFont: headerFont, headerFont, padding: headerPadding };
13731
+ }
13732
+ return { cellFont: canvasFont(text), headerFont, padding: Math.max(headerPadding, horizontalPadding(cell)) };
13733
+ }
13734
+ getScrollbarWidth() {
13735
+ var _a2, _b2, _c2;
13736
+ const scrollport = (_c2 = (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) == null ? void 0 : _b2.rowManager) == null ? void 0 : _c2.element;
13737
+ return scrollport ? scrollport.offsetWidth - scrollport.clientWidth : 0;
13738
+ }
13739
+ /** The widest of the title and the values of the loaded rows, plus the padding. */
13740
+ measureNaturalWidth(column, metrics) {
13741
+ const widest = __privateGet$1(this, _syncedAssets).reduce(
13742
+ (width, asset) => Math.max(width, measureTextWidth(readCellValue(asset, column.field), metrics.cellFont)),
13743
+ measureTextWidth(column.title, metrics.headerFont)
13744
+ );
13745
+ return Math.ceil(widest + metrics.padding);
13746
+ }
13747
+ /**
13748
+ * Sets the width of each visible host column: a saved or session width as is, and an auto-fit
13749
+ * width for the other columns, inside the width of the table (see `layoutColumnWidths`). A hidden
13750
+ * column keeps its width. A table with no width, as one in a hidden panel, keeps its widths until
13751
+ * it is shown.
13752
+ * @param measure Measure the natural widths again. Leave it false to reuse the natural widths of
13753
+ * the last full layout, for a change of the available width only.
13754
+ */
13755
+ applyColumnLayout(measure = true) {
13756
+ var _a2;
13757
+ const tabulator = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance;
13758
+ const element = tabulator && !tabulator.destroyed ? tabulator.element : void 0;
13759
+ if (!tabulator || !element) {
13760
+ return;
13761
+ }
13762
+ if (element.clientWidth === 0) {
13763
+ __privateGet$1(this, _layoutPending) || __privateSet$1(this, _layoutPending, measure);
13764
+ return;
13765
+ }
13766
+ if (measure) {
13767
+ __privateSet$1(this, _layoutPending, false);
13768
+ this.layoutAgainWhenFontsLoad();
13769
+ }
13770
+ const hidden = new Set(this.hiddenFields);
13771
+ const keys2 = this.resolveColumnKeys();
13772
+ const shown = this.columns.flatMap((column, index) => {
13773
+ const tabulatorColumn = hidden.has(column.field) ? false : tabulator.getColumn(keys2[index]);
13774
+ return tabulatorColumn ? [{ column, key: keys2[index], tabulatorColumn }] : [];
13775
+ });
13776
+ const metrics = this.readColumnMetrics(shown.map(({ tabulatorColumn }) => tabulatorColumn));
13777
+ if (!metrics) {
13778
+ return;
13779
+ }
13780
+ const scrollbar = this.getScrollbarWidth();
13781
+ __privateSet$1(this, _layoutScrollbarWidth, scrollbar);
13782
+ const widths = layoutColumnWidths(shown.map(({ column, key }) => {
13783
+ var _a3;
13784
+ let natural = measure ? void 0 : __privateGet$1(this, _naturalWidths).get(key);
13785
+ if (natural === void 0) {
13786
+ natural = this.measureNaturalWidth(column, metrics);
13787
+ __privateGet$1(this, _naturalWidths).set(key, natural);
13788
+ }
13789
+ return { natural, saved: (_a3 = __privateGet$1(this, _resizedWidths).get(column.field.trim())) != null ? _a3 : __privateGet$1(this, _sessionWidths).get(column.field.trim()) };
13790
+ }), Math.floor(unroundedClientWidth(element) - scrollbar) - RESIZE_BUFFER_WIDTH);
13791
+ shown.forEach(({ key, tabulatorColumn }, index) => {
13792
+ const width = widths[index];
13793
+ void tabulatorColumn.setWidth(width);
13794
+ tabulatorColumn.getDefinition().width = width;
13795
+ const definition = __privateGet$1(this, _columnDefinitions).find(({ field }) => field === key);
13796
+ if (definition) {
13797
+ definition.width = width;
13798
+ }
13799
+ });
13800
+ this.syncTableFrame();
13801
+ }
13802
+ /**
13803
+ * The canvas measures with a fallback font while a web font loads, so measure again once the fonts
13804
+ * are ready. Guarded by one pending wait, and by the connection of the element.
13805
+ */
13806
+ layoutAgainWhenFontsLoad() {
13807
+ var _a2;
13808
+ if (__privateGet$1(this, _fontsPending) || ((_a2 = document.fonts) == null ? void 0 : _a2.status) !== "loading") {
13809
+ return;
13810
+ }
13811
+ __privateSet$1(this, _fontsPending, true);
13812
+ void document.fonts.ready.then(() => {
13813
+ __privateSet$1(this, _fontsPending, false);
13814
+ if (this.isConnected) {
13815
+ this.applyColumnLayout();
13816
+ }
13817
+ });
13818
+ }
13819
+ /**
13820
+ * `content-browser` hands over the whole list on every page, so a list that only grows by a page
13821
+ * is appended: reassigning it would call `setData`, which scrolls the table back to the top. Any
13822
+ * other list -- a new search, sort, filter or folder, or a refetch that brings the assets the rows
13823
+ * show as new objects -- replaces the rows.
13824
+ */
13825
+ syncRows(replace = false) {
13826
+ return __async(this, null, function* () {
13827
+ const tabulator = this.tabulator;
13828
+ if (!tabulator) {
13829
+ return;
13830
+ }
13831
+ const columnKeys = this.resolveColumnKeys();
13832
+ const synced = __privateGet$1(this, _syncedAssets);
13833
+ const isNextPage = !replace && __privateGet$1(this, _pendingReplaces) === 0 && isAppendOf(synced, this.assets);
13834
+ __privateSet$1(this, _syncedAssets, [...this.assets]);
13835
+ if (isNextPage) {
13836
+ __privateSet$1(this, _heldRowKeys, new Set(columnKeys.filter((key) => __privateGet$1(this, _heldRowKeys).has(key))));
13837
+ yield tabulator.addData(this.assets.slice(synced.length).map((asset) => this.toRow(asset, columnKeys)));
13838
+ } else {
13839
+ __privateSet$1(this, _heldRowKeys, new Set(columnKeys));
13840
+ __privateSet$1(this, _pendingReplaces, __privateGet$1(this, _pendingReplaces) + 1);
13841
+ try {
13842
+ yield tabulator.setData(this.assets.map((asset) => this.toRow(asset, columnKeys)));
13843
+ } finally {
13844
+ __privateSet$1(this, _pendingReplaces, __privateGet$1(this, _pendingReplaces) - 1);
13845
+ }
13846
+ this.applyColumnLayout();
13847
+ }
13848
+ this.markCurrentRow(this.selectedAssetId, true);
13849
+ this.observeLastRow();
13850
+ this.reportRestartedRowCount();
13851
+ this.reportHeldRowCount();
13852
+ });
13853
+ }
13854
+ handleTableBuilt(event) {
13855
+ var _a2, _b2;
13856
+ event.stopPropagation();
13857
+ __privateSet$1(this, _builtTable, (_b2 = (_a2 = this.tableEl) == null ? void 0 : _a2.tabulatorInstance) != null ? _b2 : void 0);
13858
+ if (__privateGet$1(this, _builtTable)) {
13859
+ __privateGet$1(this, _builtTable).options.rowFormatter = (row) => this.renderRowAction(row);
13860
+ }
13861
+ this.prepareFrame();
13862
+ __privateSet$1(this, _syncedAssets, []);
13863
+ void this.syncRows();
13864
+ }
13865
+ /**
13866
+ * Gives the frame, the scrollport and the header their styles. Runs as soon as Tabulator lays out its
13867
+ * columns: until then the frame takes the width of its content, which is not the width of the header.
13868
+ */
13869
+ prepareFrame() {
13870
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
13871
+ const scrollport = (_b2 = (_a2 = this.buildingTabulator) == null ? void 0 : _a2.rowManager) == null ? void 0 : _b2.element;
13872
+ const frame = scrollport == null ? void 0 : scrollport.parentElement;
13873
+ frame == null ? void 0 : frame.style.setProperty("width", "100%");
13874
+ frame == null ? void 0 : frame.part.add("content-browser-frame");
13875
+ scrollport == null ? void 0 : scrollport.part.add("content-browser-scrollport");
13876
+ const header = (_d2 = (_c2 = this.tableEl) == null ? void 0 : _c2.shadowRoot) == null ? void 0 : _d2.querySelector(".tabulator-header");
13877
+ const columns = header == null ? void 0 : header.querySelector(".tabulator-headers");
13878
+ header == null ? void 0 : header.part.add("content-browser-header");
13879
+ (_f2 = (_e2 = this.tableEl) == null ? void 0 : _e2.shadowRoot) == null ? void 0 : _f2.addEventListener("dblclick", this.handleResizeHandleDoubleClick, { capture: true });
13880
+ (_g = __privateGet$1(this, _frameWidthObserver)) == null ? void 0 : _g.disconnect();
13881
+ if (columns) {
13882
+ __privateSet$1(this, _frameWidthObserver, new ResizeObserver(() => this.syncTableFrame()));
13883
+ __privateGet$1(this, _frameWidthObserver).observe(columns);
13884
+ }
13885
+ this.syncTableFrame();
13886
+ }
13887
+ /**
13888
+ * `setData` replaces the rows only once its debounce runs out, and Tabulator emits `dataLoaded` just
13889
+ * before it does. Until then, the old rows stay on the page with their hover and focus.
13890
+ */
13891
+ handleDataLoaded(event) {
13892
+ event.stopPropagation();
13893
+ __privateSet$1(this, _hoveredRow, void 0);
13894
+ __privateSet$1(this, _focusedCta, void 0);
13895
+ __privateGet$1(this, _renderedCtas).clear();
13896
+ }
13897
+ /**
13898
+ * Every `setColumns` builds the columns again from the definitions: Tabulator calls it as it builds,
13899
+ * before `tableBuilt`. `cx-table` calls it again from its own `tableBuilt` handler, after this
13900
+ * component's has run, and for every new column set.
13901
+ */
13902
+ handleColumnsLoaded(event) {
13903
+ event.stopPropagation();
13904
+ this.prepareFrame();
13905
+ this.applyColumnLayout();
13906
+ }
13907
+ willUpdate(changedProperties) {
13908
+ super.willUpdate(changedProperties);
13909
+ const signature = columnsSignature(this.columns);
13910
+ const columnsChanged = signature !== __privateGet$1(this, _columnsSignature);
13911
+ const tableRemounts = changedProperties.get("empty") === true && !this.empty;
13912
+ if (columnsChanged) {
13913
+ __privateSet$1(this, _columnsSignature, signature);
13914
+ __privateSet$1(this, _rowsNeedRebuild, this.hasUpdated && this.resolveColumnKeys().some((key) => !__privateGet$1(this, _heldRowKeys).has(key)));
13915
+ }
13916
+ const savedWidthsChanged = changedProperties.has("savedWidths");
13917
+ const widthScopeChanged = changedProperties.has("widthScope");
13918
+ if (widthScopeChanged) {
13919
+ __privateGet$1(this, _sessionWidths).clear();
13920
+ }
13921
+ if (savedWidthsChanged) {
13922
+ this.applySavedWidths();
13923
+ }
13924
+ if (columnsChanged || tableRemounts) {
13925
+ __privateSet$1(this, _columnDefinitions, this.buildColumnDefinitions());
13926
+ } else if (changedProperties.has("hiddenFields")) {
13927
+ this.applyHiddenFields();
13928
+ } else if (savedWidthsChanged || widthScopeChanged) {
13929
+ this.applyColumnLayout();
13930
+ }
13931
+ }
13932
+ /**
13933
+ * The new saved widths replace all the widths in memory: a width that the new map does not hold,
13934
+ * for example one of another site, goes away. Only a positive width counts: a bad entry has no effect.
13935
+ */
13936
+ applySavedWidths() {
13937
+ var _a2;
13938
+ __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)]] : [])));
13939
+ }
13940
+ /**
13941
+ * Through Tabulator's own column visibility: new definitions would reach it through `setColumns`,
13942
+ * and the rows would have to be rebuilt, which scrolls back to the top.
13943
+ */
13944
+ applyHiddenFields() {
13945
+ const hidden = new Set(this.hiddenFields);
13946
+ const keys2 = this.resolveColumnKeys();
13947
+ const shows = [];
13948
+ __privateGet$1(this, _columnDefinitions).forEach((definition) => {
13949
+ var _a2;
13950
+ const field = String(definition.field);
13951
+ const hostColumn = this.columns[keys2.indexOf(field)];
13952
+ if (!hostColumn) {
13953
+ return;
13954
+ }
13955
+ const isHidden = hidden.has(hostColumn.field);
13956
+ const column = (_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(field);
13957
+ definition.hidden = isHidden || void 0;
13958
+ if (column && column.isVisible() === isHidden) {
13959
+ if (isHidden) {
13960
+ column.hide();
13961
+ } else {
13962
+ shows.push(column.show());
13963
+ }
13964
+ }
13965
+ });
13966
+ void Promise.all(shows).then(() => this.applyColumnLayout());
13967
+ }
13968
+ updated(changedProperties) {
13969
+ var _a2;
13970
+ super.updated(changedProperties);
13971
+ if (this.empty) {
13972
+ (_a2 = __privateGet$1(this, _frameWidthObserver)) == null ? void 0 : _a2.disconnect();
13973
+ }
13974
+ if (__privateGet$1(this, _rowsNeedRebuild)) {
13975
+ __privateSet$1(this, _rowsNeedRebuild, false);
13976
+ void this.rebuildRows();
13977
+ }
13978
+ }
13979
+ /** Once `cx-table` has taken the new column definitions. */
13980
+ rebuildRows() {
13981
+ return __async(this, null, function* () {
13982
+ var _a2;
13983
+ yield (_a2 = this.tableEl) == null ? void 0 : _a2.updateComplete;
13984
+ yield this.syncRows(true);
13985
+ });
13986
+ }
13987
+ handleAssetsChange(previous) {
13988
+ const previousAssets = previous != null ? previous : [];
13989
+ if (this.assets.length === previousAssets.length && this.assets.every((asset, index) => asset === previousAssets[index])) {
13990
+ return;
13991
+ }
13992
+ this.assetMap.clear();
13993
+ this.assets.forEach((item) => this.assetMap.set(item.id, item));
13994
+ if (!isAppendOf(previousAssets, this.assets)) {
13995
+ __privateSet$1(this, _lastRowCount, void 0);
13996
+ }
13997
+ void this.syncRows();
13998
+ }
13999
+ handleLoadingChange() {
14000
+ return __async(this, null, function* () {
14001
+ if (this.loading) {
14002
+ return;
14003
+ }
14004
+ yield this.updateComplete;
14005
+ if (__privateGet$1(this, _pendingReplaces) === 0) {
14006
+ this.reportHeldRowCount();
14007
+ }
14008
+ });
14009
+ }
14010
+ handleSelectedAssetIdChange(previous) {
14011
+ this.markCurrentRow(previous, false);
14012
+ this.markCurrentRow(this.selectedAssetId, true);
14013
+ this.paintAssetCta(previous);
14014
+ this.paintAssetCta(this.selectedAssetId);
14015
+ }
14016
+ handleBusyAssetIdChange(previous) {
14017
+ this.paintAssetCta(previous);
14018
+ this.paintAssetCta(this.busyAssetId);
14019
+ }
14020
+ handleCtaTextChange() {
14021
+ var _a2, _b2;
14022
+ (_b2 = ((_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(FILLER_FIELD)) || void 0) == null ? void 0 : _b2.getElement().setAttribute("aria-label", this.ctaLabel);
14023
+ __privateGet$1(this, _renderedCtas).forEach((cta) => this.paintCta(cta));
14024
+ }
14025
+ /** In place, as a relabel is: a CTA built again would drop the keyboard focus the old one held. */
14026
+ setNoHover(noHover) {
14027
+ if (noHover === __privateGet$1(this, _hasNoHover)) {
14028
+ return;
14029
+ }
14030
+ __privateSet$1(this, _hasNoHover, noHover);
14031
+ __privateGet$1(this, _renderedCtas).forEach((cta) => this.paintCta(cta));
14032
+ }
14033
+ connectedCallback() {
14034
+ super.connectedCallback();
14035
+ __privateSet$1(this, _noHoverQueries, NO_HOVER_QUERIES.map((media) => window.matchMedia(media)));
14036
+ __privateGet$1(this, _noHoverQueries).forEach((list) => list.addEventListener("change", this.handleNoHoverChange));
14037
+ this.handleNoHoverChange();
14038
+ if (this.hasUpdated) {
14039
+ __privateSet$1(this, _columnDefinitions, this.buildColumnDefinitions());
14040
+ this.requestUpdate();
14041
+ }
14042
+ }
14043
+ disconnectedCallback() {
14044
+ var _a2, _b2;
14045
+ super.disconnectedCallback();
14046
+ __privateGet$1(this, _noHoverQueries).forEach((list) => list.removeEventListener("change", this.handleNoHoverChange));
14047
+ __privateSet$1(this, _noHoverQueries, []);
14048
+ (_a2 = __privateGet$1(this, _lastRowObserver)) == null ? void 0 : _a2.disconnect();
14049
+ (_b2 = __privateGet$1(this, _frameWidthObserver)) == null ? void 0 : _b2.disconnect();
14050
+ this.debouncedCalculatePageSize.cancel();
14051
+ this.debouncedHandleScrollEnd.cancel();
14052
+ this.debouncedHandleLastRowVisible.cancel();
14053
+ this.debouncedRedrawTable.cancel();
14054
+ this.debouncedApplyColumnLayout.cancel();
14055
+ }
14056
+ handleResize(event) {
14057
+ event.stopPropagation();
14058
+ const entries = event.detail.entries;
14059
+ if (entries[0].target !== this.containerEl) {
14060
+ return;
14061
+ }
14062
+ const { height, width } = entries[0].contentRect;
14063
+ this.debouncedCalculatePageSize(height);
14064
+ this.refitToContainer(width, height);
14065
+ if (__privateGet$1(this, _layoutPending)) {
14066
+ this.applyColumnLayout();
14067
+ }
14068
+ }
14069
+ /**
14070
+ * A new container width changes the space that the auto-fit shares out, so the columns are laid
14071
+ * out again. `cx-table` renders its rows again for a new container height only until the first drag
14072
+ * of a column divider, so a new height redraws the rows, which leaves no blank area under them.
14073
+ */
14074
+ refitToContainer(width, height) {
14075
+ const size = { height: Math.round(height), width: Math.round(width) };
14076
+ const previous = __privateGet$1(this, _containerSize);
14077
+ __privateSet$1(this, _containerSize, size);
14078
+ if (previous === void 0) {
14079
+ return;
14080
+ }
14081
+ if (previous.width !== size.width) {
14082
+ this.debouncedApplyColumnLayout();
14083
+ }
14084
+ if (previous.height !== size.height) {
14085
+ this.debouncedRedrawTable();
14086
+ }
14087
+ }
14088
+ calculatePageSize(height) {
14089
+ if (Math.abs(__privateGet$1(this, _lastHeight) - height) < 10) {
14090
+ return;
14091
+ }
14092
+ __privateSet$1(this, _lastHeight, height);
14093
+ this.reportRowCount();
14094
+ }
14095
+ /** Counts the rows the last measured height shows, and tells the host when the count changes. */
14096
+ reportRowCount() {
14097
+ const rowCount = Math.ceil(this.resolveVisibleHeight(__privateGet$1(this, _lastHeight)) / ROW_HEIGHT);
14098
+ __privateSet$1(this, _rowCountHeld, this.loading && this.assets.length > 0);
14099
+ if (rowCount === __privateGet$1(this, _lastRowCount) || __privateGet$1(this, _rowCountHeld)) {
14100
+ return;
14101
+ }
14102
+ __privateSet$1(this, _lastRowCount, rowCount);
14103
+ this.emit("cx-content-browser-grid-resize", {
14104
+ detail: {
14105
+ columnCount: 1,
14106
+ rowCount
14107
+ }
14108
+ });
14109
+ }
14110
+ /**
14111
+ * Only once the restarted rows are in: the host asks for the next page at once, and a page that
14112
+ * lands while `setData` waits replaces the rows again and holds them back for another half second.
14113
+ * A measurement still in its debounce reports in the same count, because a second count inside the
14114
+ * host's 200 ms fetch debounce cancels the page the first count asked for.
14115
+ */
14116
+ reportRestartedRowCount() {
14117
+ if (!this.isConnected || __privateGet$1(this, _lastRowCount) !== void 0 || __privateGet$1(this, _lastHeight) === 0) {
14118
+ return;
14119
+ }
14120
+ this.debouncedCalculatePageSize.flush();
14121
+ this.reportRowCount();
14122
+ }
14123
+ /**
14124
+ * Once the load ends and any rows it brings are in, the count measured meanwhile can ask for the
14125
+ * page after it. A table that is not built yet reports it at once.
14126
+ */
14127
+ reportHeldRowCount() {
14128
+ if (!__privateGet$1(this, _rowCountHeld) || !this.isConnected) {
14129
+ return;
14130
+ }
14131
+ this.debouncedCalculatePageSize.flush();
14132
+ this.reportRowCount();
14133
+ }
14134
+ /**
14135
+ * The rows never size the container (see the styles), so this is the height the host gives the
14136
+ * picker, and it can run past the viewport. No scrollport shows more rows than the viewport, so
14137
+ * while the rows do not overflow the scrollport the count stops there, and the page scrolls to the
14138
+ * rest, where the last row coming into view asks for more (`observeLastRow`). One that overflows,
14139
+ * or holds no rows yet, measures the space its container gives it and is used as is.
14140
+ */
14141
+ resolveVisibleHeight(height) {
14142
+ return this.isSizedByRows() ? Math.min(height, window.innerHeight) : height;
14143
+ }
14144
+ isSizedByRows() {
14145
+ var _a2, _b2;
14146
+ const scrollport = this.scrollport;
14147
+ return ((_b2 = (_a2 = this.tabulator) == null ? void 0 : _a2.getDataCount()) != null ? _b2 : 0) > 0 && scrollport !== void 0 && scrollport.scrollHeight <= scrollport.clientHeight + 1;
14148
+ }
14149
+ /**
14150
+ * A scrollport that holds its rows without overflowing never scrolls, so its own scroll never
14151
+ * reaches the end: the page scrolls instead. Once the table is taller than the viewport its count
14152
+ * is capped and stops fetching, which leaves the last row coming into view as the only sign the
14153
+ * user wants more.
14154
+ */
14155
+ observeLastRow() {
14156
+ var _a2, _b2, _c2, _d2;
14157
+ (_a2 = __privateGet$1(this, _lastRowObserver)) == null ? void 0 : _a2.disconnect();
14158
+ const rows = (_c2 = (_b2 = this.tabulator) == null ? void 0 : _b2.getRows()) != null ? _c2 : [];
14159
+ const lastRow = rows[rows.length - 1];
14160
+ if (!lastRow) {
14161
+ return;
14162
+ }
14163
+ (_d2 = __privateGet$1(this, _lastRowObserver)) != null ? _d2 : __privateSet$1(this, _lastRowObserver, new IntersectionObserver((entries) => {
14164
+ if (entries.some((entry) => entry.isIntersecting)) {
14165
+ this.debouncedHandleLastRowVisible();
14166
+ }
14167
+ }));
14168
+ __privateGet$1(this, _lastRowObserver).observe(lastRow.getElement());
14169
+ }
14170
+ handleLastRowVisible() {
14171
+ if (this.isSizedByRows() && this.containerEl.clientHeight > window.innerHeight) {
14172
+ this.handleScrollEnd();
14173
+ }
14174
+ }
14175
+ insertAsset(assetId) {
14176
+ var _a2;
14177
+ if (!assetId || ((_a2 = this.assetMap.get(assetId)) == null ? void 0 : _a2.inColdStorage)) {
14178
+ return;
14179
+ }
14180
+ this.emit("cx-content-browser-grid-click", {
14181
+ detail: {
14182
+ id: assetId
14183
+ }
14184
+ });
14185
+ }
14186
+ /** The host field of a row key, or `undefined` for the filler. */
14187
+ fieldOfKey(key) {
14188
+ var _a2;
14189
+ return key ? (_a2 = this.columns[this.resolveColumnKeys().indexOf(key)]) == null ? void 0 : _a2.field : void 0;
14190
+ }
14191
+ handleColumnResized(event) {
14192
+ event.stopPropagation();
14193
+ const [column] = event.detail.args;
14194
+ const field = this.fieldOfKey(column.getField());
14195
+ if (field === void 0) {
14196
+ return;
14197
+ }
14198
+ const width = Math.round(column.getWidth());
14199
+ column.getDefinition().width = width;
14200
+ __privateGet$1(this, _resizedWidths).set(field.trim(), width);
14201
+ this.holdOtherAutoFitWidths(field);
14202
+ this.emit("cx-content-browser-table-column-resize", {
14203
+ detail: {
14204
+ field,
14205
+ reset: false,
14206
+ width
14207
+ }
14208
+ });
14209
+ this.applyColumnLayout();
14210
+ }
14211
+ /**
14212
+ * Holds each other visible auto-fit column at its width when the drag ends, for the session. A drag
14213
+ * on one column must not change the width of another column (L-42CA9K issue 2).
14214
+ */
14215
+ holdOtherAutoFitWidths(dragged) {
14216
+ const hidden = new Set(this.hiddenFields);
14217
+ const keys2 = this.resolveColumnKeys();
14218
+ this.columns.forEach((column, index) => {
14219
+ var _a2;
14220
+ const field = column.field.trim();
14221
+ if (field === dragged.trim() || hidden.has(column.field) || __privateGet$1(this, _resizedWidths).has(field)) {
14222
+ return;
14223
+ }
14224
+ const tabulatorColumn = (_a2 = this.tabulator) == null ? void 0 : _a2.getColumn(keys2[index]);
14225
+ const width = tabulatorColumn ? Math.round(tabulatorColumn.getWidth()) : 0;
14226
+ if (width > 0) {
14227
+ __privateGet$1(this, _sessionWidths).set(field, width);
14228
+ }
14229
+ });
14230
+ }
14231
+ handleScrollVertical(event) {
14232
+ event.stopPropagation();
14233
+ this.releaseDetachedCta();
14234
+ const scrollport = this.scrollport;
14235
+ if (scrollport && scrollport.scrollTop + scrollport.clientHeight >= scrollport.scrollHeight - ROW_HEIGHT) {
14236
+ this.debouncedHandleScrollEnd();
14237
+ }
14238
+ }
14239
+ handleScrollEnd() {
14240
+ if (this.hasMore && !this.loading) {
14241
+ this.emit("cx-content-browser-grid-scroll-end");
14242
+ }
14243
+ }
14244
+ handleRetry() {
14245
+ this.emit("cx-content-browser-grid-retry");
14246
+ }
14247
+ renderRetry() {
14248
+ return b`
14249
+ <cx-button class="content-browser-table__retry" variant="primary" @click=${this.handleRetry}>
14250
+ ${this.localize.term("retry")}
14251
+ </cx-button>
14252
+ `;
14253
+ }
14254
+ renderContent() {
14255
+ if (this.error && this.assets.length === 0) {
14256
+ return b`
14257
+ <cx-content-browser-no-result
14258
+ class="content-browser-table__empty"
14259
+ icon="error_outline"
14260
+ message=${this.localize.term("oopsSomethingWentWrong")}
14261
+ role="alert"
14262
+ >
14263
+ ${this.renderRetry()}
14264
+ </cx-content-browser-no-result>
14265
+ `;
14266
+ }
14267
+ if (this.empty) {
14268
+ return b`
14269
+ <cx-content-browser-no-result
14270
+ class="content-browser-table__empty"
14271
+ icon="search_off"
14272
+ message=${this.localize.term("noResults")}
14273
+ ></cx-content-browser-no-result>
14274
+ `;
14275
+ }
14276
+ return b`
14277
+ <cx-table
14278
+ class="content-browser-table__table"
14279
+ layout="fitData"
14280
+ placeholder=""
14281
+ no-selectable
14282
+ no-clipboard
14283
+ .columns=${__privateGet$1(this, _columnDefinitions)}
14284
+ .columnDefaults=${COLUMN_DEFAULTS}
14285
+ .rowHeight=${ROW_HEIGHT}
14286
+ @cx-table.tableBuilt=${this.handleTableBuilt}
14287
+ @cx-table.dataLoaded=${this.handleDataLoaded}
14288
+ @cx-table.columnsLoaded=${this.handleColumnsLoaded}
14289
+ @cx-table.columnResized=${this.handleColumnResized}
14290
+ @cx-table.scrollVertical=${this.handleScrollVertical}
14291
+ @cx-table.renderStarted=${this.handleRenderStarted}
14292
+ @cx-table.renderComplete=${this.handleRenderComplete}
14293
+ ></cx-table>
14294
+ `;
14295
+ }
14296
+ render() {
14297
+ return b`
14298
+ <div
14299
+ class="content-browser-table-loading"
14300
+ style=${o$1({
14301
+ opacity: this.loading ? 1 : 0
14302
+ })}
14303
+ >
14304
+ <cx-progress-bar indeterminate></cx-progress-bar>
14305
+ </div>
14306
+ <cx-resize-observer @cx-resize=${this.handleResize}>
14307
+ <div class="content-browser-table">
14308
+ ${this.renderContent()}
14309
+ </div>
14310
+ </cx-resize-observer>
14311
+ ${n$5(this.error && this.assets.length > 0, () => b`
14312
+ <div class="content-browser-table__page-error" role="alert">
14313
+ <cx-icon name="error_outline"></cx-icon>
14314
+ ${this.localize.term("oopsSomethingWentWrong")}
14315
+ ${this.renderRetry()}
14316
+ </div>
14317
+ `)}
14318
+ `;
14319
+ }
14320
+ };
14321
+ _columnDefinitions = /* @__PURE__ */ new WeakMap();
14322
+ _columnsSignature = /* @__PURE__ */ new WeakMap();
14323
+ _columnKeys = /* @__PURE__ */ new WeakMap();
14324
+ _rowsNeedRebuild = /* @__PURE__ */ new WeakMap();
14325
+ _heldRowKeys = /* @__PURE__ */ new WeakMap();
14326
+ _resizedWidths = /* @__PURE__ */ new WeakMap();
14327
+ _sessionWidths = /* @__PURE__ */ new WeakMap();
14328
+ _ctas = /* @__PURE__ */ new WeakMap();
14329
+ _renderedCtas = /* @__PURE__ */ new WeakMap();
14330
+ _pointerTrackedRows = /* @__PURE__ */ new WeakMap();
14331
+ _hoveredRow = /* @__PURE__ */ new WeakMap();
14332
+ _focusedCta = /* @__PURE__ */ new WeakMap();
14333
+ _ctaFocusedAtRender = /* @__PURE__ */ new WeakMap();
14334
+ _noHoverQueries = /* @__PURE__ */ new WeakMap();
14335
+ _hasNoHover = /* @__PURE__ */ new WeakMap();
14336
+ _builtTable = /* @__PURE__ */ new WeakMap();
14337
+ _syncedAssets = /* @__PURE__ */ new WeakMap();
14338
+ _pendingReplaces = /* @__PURE__ */ new WeakMap();
14339
+ _lastHeight = /* @__PURE__ */ new WeakMap();
14340
+ _containerSize = /* @__PURE__ */ new WeakMap();
14341
+ _lastRowCount = /* @__PURE__ */ new WeakMap();
14342
+ _rowCountHeld = /* @__PURE__ */ new WeakMap();
14343
+ _lastRowObserver = /* @__PURE__ */ new WeakMap();
14344
+ _layoutScrollbarWidth = /* @__PURE__ */ new WeakMap();
14345
+ _naturalWidths = /* @__PURE__ */ new WeakMap();
14346
+ _layoutPending = /* @__PURE__ */ new WeakMap();
14347
+ _fontsPending = /* @__PURE__ */ new WeakMap();
14348
+ _frameWidthObserver = /* @__PURE__ */ new WeakMap();
14349
+ CxContentBrowserTable.styles = [componentStyles, styles$1];
14350
+ CxContentBrowserTable.dependencies = {
14351
+ "cx-button": CxButton,
14352
+ "cx-content-browser-no-result": CxContentBrowserNoResult,
14353
+ "cx-icon": CxIcon,
12828
14354
  "cx-line-clamp": CxLineClamp,
12829
- "cx-menu": CxMenu,
12830
- "cx-menu-item": CxMenuItem,
12831
- "cx-skeleton": CxSkeleton,
12832
- "cx-space": CxSpace,
12833
- "cx-typography": CxTypography
14355
+ "cx-progress-bar": CxProgressBar,
14356
+ "cx-resize-observer": CxResizeObserver,
14357
+ "cx-table": CxTable
12834
14358
  };
12835
14359
  __decorateClass$1([
12836
- n$6({ type: Boolean })
12837
- ], CxContentBrowserHeader.prototype, "bordered", 2);
14360
+ e$7(".content-browser-table")
14361
+ ], CxContentBrowserTable.prototype, "containerEl", 2);
12838
14362
  __decorateClass$1([
12839
- n$6({ attribute: "application-name", type: String })
12840
- ], CxContentBrowserHeader.prototype, "applicationName", 2);
14363
+ e$7("cx-table")
14364
+ ], CxContentBrowserTable.prototype, "tableEl", 2);
12841
14365
  __decorateClass$1([
12842
- n$6({ type: Boolean })
12843
- ], CxContentBrowserHeader.prototype, "loading", 2);
14366
+ n$6({ attribute: "assets", reflect: false, type: Array })
14367
+ ], CxContentBrowserTable.prototype, "assets", 2);
12844
14368
  __decorateClass$1([
12845
- n$6({ attribute: "is-fetching", type: Boolean })
12846
- ], CxContentBrowserHeader.prototype, "isFetching", 2);
14369
+ n$6({ attribute: "columns", reflect: false, type: Array })
14370
+ ], CxContentBrowserTable.prototype, "columns", 2);
12847
14371
  __decorateClass$1([
12848
- n$6({ attribute: "avatar", type: String })
12849
- ], CxContentBrowserHeader.prototype, "avatar", 2);
14372
+ n$6({ attribute: "cta-text", reflect: false, type: String })
14373
+ ], CxContentBrowserTable.prototype, "ctaText", 2);
12850
14374
  __decorateClass$1([
12851
- n$6({ attribute: "full-name", type: String })
12852
- ], CxContentBrowserHeader.prototype, "fullName", 2);
14375
+ n$6({ attribute: "cta-text-transform", reflect: false, type: String })
14376
+ ], CxContentBrowserTable.prototype, "ctaTextTransform", 2);
12853
14377
  __decorateClass$1([
12854
- n$6({ attribute: "folder-title", type: String })
12855
- ], CxContentBrowserHeader.prototype, "folderTitle", 2);
14378
+ n$6({ attribute: "empty", reflect: true, type: Boolean })
14379
+ ], CxContentBrowserTable.prototype, "empty", 2);
12856
14380
  __decorateClass$1([
12857
- n$6({ attribute: "show-close-button", type: Boolean })
12858
- ], CxContentBrowserHeader.prototype, "showCloseButton", 2);
14381
+ n$6({ attribute: "error", reflect: true, type: Boolean })
14382
+ ], CxContentBrowserTable.prototype, "error", 2);
12859
14383
  __decorateClass$1([
12860
- n$6({ attribute: "can-logout", type: Boolean })
12861
- ], CxContentBrowserHeader.prototype, "canLogout", 2);
12862
- CxContentBrowserHeader = __decorateClass$1([
12863
- customElement("cx-content-browser-header")
12864
- ], CxContentBrowserHeader);
14384
+ n$6({ attribute: "has-more", reflect: true, type: Boolean })
14385
+ ], CxContentBrowserTable.prototype, "hasMore", 2);
14386
+ __decorateClass$1([
14387
+ n$6({ attribute: "loading", reflect: true, type: Boolean })
14388
+ ], CxContentBrowserTable.prototype, "loading", 2);
14389
+ __decorateClass$1([
14390
+ n$6({ attribute: "selected-asset-id", reflect: true, type: String })
14391
+ ], CxContentBrowserTable.prototype, "selectedAssetId", 2);
14392
+ __decorateClass$1([
14393
+ n$6({ attribute: false })
14394
+ ], CxContentBrowserTable.prototype, "busyAssetId", 2);
14395
+ __decorateClass$1([
14396
+ n$6({ attribute: false })
14397
+ ], CxContentBrowserTable.prototype, "hiddenFields", 2);
14398
+ __decorateClass$1([
14399
+ n$6({ attribute: false })
14400
+ ], CxContentBrowserTable.prototype, "savedWidths", 2);
14401
+ __decorateClass$1([
14402
+ n$6({ attribute: false })
14403
+ ], CxContentBrowserTable.prototype, "widthScope", 2);
14404
+ __decorateClass$1([
14405
+ n$6({ attribute: "row-action-position", reflect: true })
14406
+ ], CxContentBrowserTable.prototype, "rowActionPosition", 2);
14407
+ __decorateClass$1([
14408
+ watch("assets")
14409
+ ], CxContentBrowserTable.prototype, "handleAssetsChange", 1);
14410
+ __decorateClass$1([
14411
+ watch("loading", { waitUntilFirstUpdate: true })
14412
+ ], CxContentBrowserTable.prototype, "handleLoadingChange", 1);
14413
+ __decorateClass$1([
14414
+ watch("selectedAssetId", { waitUntilFirstUpdate: true })
14415
+ ], CxContentBrowserTable.prototype, "handleSelectedAssetIdChange", 1);
14416
+ __decorateClass$1([
14417
+ watch("busyAssetId", { waitUntilFirstUpdate: true })
14418
+ ], CxContentBrowserTable.prototype, "handleBusyAssetIdChange", 1);
14419
+ __decorateClass$1([
14420
+ watch(["ctaText", "ctaTextTransform"], { waitUntilFirstUpdate: true })
14421
+ ], CxContentBrowserTable.prototype, "handleCtaTextChange", 1);
14422
+ CxContentBrowserTable = __decorateClass$1([
14423
+ customElement("cx-content-browser-table")
14424
+ ], CxContentBrowserTable);
12865
14425
  const appendPathAndQuery = (baseUrl, pathSuffix, extraQueryParams = []) => {
12866
14426
  const questionMarkIndex = baseUrl.indexOf("?");
12867
14427
  const hashIndex = baseUrl.indexOf("#");
@@ -13264,8 +14824,26 @@ function apiGetAssetsByIDs(_0) {
13264
14824
  }
13265
14825
  });
13266
14826
  }
14827
+ const ASSET_LIST_FIELDS = [
14828
+ DEFAULT_VIEW_SIZE,
14829
+ FIELD_DOC_TITLE,
14830
+ FIELD_DOC_TYPE,
14831
+ FIELD_EXTENSION,
14832
+ FIELD_FILE_SIZE,
14833
+ FIELD_IDENTIFIER,
14834
+ FIELD_KEYWORDS,
14835
+ FIELD_MAX_HEIGHT,
14836
+ FIELD_MAX_WIDTH,
14837
+ FIELD_RECORD_ID,
14838
+ FIELD_SUBTYPE,
14839
+ FIELD_TITLE_WITH_FALLBACK,
14840
+ FIELD_UPDATED_FILE_NAME,
14841
+ FIELD_STORAGE_GROUP,
14842
+ ORIGINAL_VIEW_SIZE
14843
+ ];
13267
14844
  function apiGetAssets(_0) {
13268
14845
  return __async(this, arguments, function* ({
14846
+ fields,
13269
14847
  folderId,
13270
14848
  isSeeThrough,
13271
14849
  limitedToDocTypes = [],
@@ -13276,25 +14854,17 @@ function apiGetAssets(_0) {
13276
14854
  start,
13277
14855
  useSession
13278
14856
  }) {
14857
+ var _a2;
14858
+ const validatedFields = (_a2 = fields == null ? void 0 : fields.filter((field) => field && typeof field === "string")) != null ? _a2 : [];
13279
14859
  try {
13280
14860
  const response = yield http.request({
13281
14861
  data: __spreadValues({
13282
14862
  Fields: [
13283
- DEFAULT_VIEW_SIZE,
13284
- FIELD_DOC_TITLE,
13285
- FIELD_DOC_TYPE,
13286
- FIELD_EXTENSION,
13287
- FIELD_FILE_SIZE,
13288
- FIELD_IDENTIFIER,
13289
- FIELD_KEYWORDS,
13290
- FIELD_MAX_HEIGHT,
13291
- FIELD_MAX_WIDTH,
13292
- FIELD_RECORD_ID,
13293
- FIELD_SUBTYPE,
13294
- FIELD_TITLE_WITH_FALLBACK,
13295
- FIELD_UPDATED_FILE_NAME,
13296
- FIELD_STORAGE_GROUP,
13297
- ORIGINAL_VIEW_SIZE
14863
+ ...ASSET_LIST_FIELDS,
14864
+ ...validatedFields.filter((field, index) => {
14865
+ const seen = [...ASSET_LIST_FIELDS, ...validatedFields.slice(0, index)];
14866
+ return !seen.some((item) => item.toLowerCase() === field.toLowerCase());
14867
+ })
13298
14868
  ],
13299
14869
  Limit: pageSize || void 0,
13300
14870
  LimitedToDocTypes: limitedToDocTypes,
@@ -13310,23 +14880,31 @@ function apiGetAssets(_0) {
13310
14880
  transformResponse: [
13311
14881
  ...Array.isArray(http.defaults.transformResponse) ? http.defaults.transformResponse : [],
13312
14882
  (rawResponse) => {
13313
- var _a2, _b2;
14883
+ var _a3, _b2;
13314
14884
  if (!isSearchResponse(rawResponse)) {
13315
14885
  return {
13316
14886
  facets: [],
13317
14887
  isError: true,
13318
14888
  items: [],
13319
- totalCount: 0
14889
+ totalCount: 0,
14890
+ unreadableFields: []
13320
14891
  };
13321
14892
  }
13322
- const mappedItems = (_b2 = (_a2 = rawResponse.contentItems) == null ? void 0 : _a2.map((item) => {
13323
- var _a3, _b3, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
13324
- let extension = (_a3 = item.fields[FIELD_EXTENSION]) != null ? _a3 : "";
14893
+ const mappedItems = (_b2 = (_a3 = rawResponse.contentItems) == null ? void 0 : _a3.map((item) => {
14894
+ var _a4, _b3, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k, _l;
14895
+ let extension = (_a4 = item.fields[FIELD_EXTENSION]) != null ? _a4 : "";
13325
14896
  const name = resolveAssetCaption(item.fields);
13326
14897
  if (extension && !extension.startsWith(".")) {
13327
14898
  extension = "." + extension;
13328
14899
  }
13329
- return {
14900
+ return __spreadProps(__spreadValues({}, validatedFields.reduce((acc, field) => {
14901
+ var _a5, _b4;
14902
+ const sourceField = (_a5 = ASSET_LIST_FIELDS.find(
14903
+ (defaultField) => defaultField.toLowerCase() === field.toLowerCase()
14904
+ )) != null ? _a5 : field;
14905
+ acc[field] = (_b4 = item.fields[sourceField]) != null ? _b4 : "";
14906
+ return acc;
14907
+ }, {})), {
13330
14908
  allowATSLink: item.fields[FIELD_ALLOW_ATS_LINK] === "True",
13331
14909
  docSubType: (_b3 = item.fields[FIELD_SUBTYPE]) != null ? _b3 : "",
13332
14910
  docType: (_c2 = item.fields[FIELD_DOC_TYPE]) != null ? _c2 : "",
@@ -13343,13 +14921,14 @@ function apiGetAssets(_0) {
13343
14921
  size: (_j = item.fields[FIELD_FILE_SIZE]) != null ? _j : "0 MB",
13344
14922
  tags: (_k = item.fields[FIELD_KEYWORDS]) != null ? _k : "",
13345
14923
  width: (_l = item.fields[FIELD_MAX_WIDTH]) != null ? _l : "0"
13346
- };
14924
+ });
13347
14925
  })) != null ? _b2 : [];
13348
14926
  return {
13349
14927
  facets: rawResponse.facets,
13350
14928
  isError: false,
13351
14929
  items: mappedItems,
13352
- totalCount: rawResponse.totalCount
14930
+ totalCount: rawResponse.totalCount,
14931
+ unreadableFields: Array.isArray(rawResponse.unreadableFields) ? rawResponse.unreadableFields.filter((field) => typeof field === "string") : []
13353
14932
  };
13354
14933
  }
13355
14934
  ],
@@ -13361,7 +14940,8 @@ function apiGetAssets(_0) {
13361
14940
  facets: [],
13362
14941
  isError: true,
13363
14942
  items: [],
13364
- totalCount: 0
14943
+ totalCount: 0,
14944
+ unreadableFields: []
13365
14945
  };
13366
14946
  }
13367
14947
  });
@@ -13828,8 +15408,16 @@ var intersection = baseRest(function(arrays) {
13828
15408
  var mapped = arrayMap(arrays, castArrayLikeObject);
13829
15409
  return mapped.length && mapped[0] === arrays[0] ? baseIntersection(mapped) : [];
13830
15410
  });
15411
+ function narrowUnreadableFields(unreadableFields, page) {
15412
+ if (page.items.length === 0) {
15413
+ return unreadableFields;
15414
+ }
15415
+ const flagged = new Set(page.unreadableFields.map(toFieldKey));
15416
+ return unreadableFields.filter((field) => flagged.has(toFieldKey(field)));
15417
+ }
13831
15418
  class FetchAndMergeAssetsController {
13832
15419
  constructor(host, {
15420
+ additionalFields,
13833
15421
  availableDocTypes,
13834
15422
  baseUrl,
13835
15423
  bearerToken,
@@ -13856,6 +15444,7 @@ class FetchAndMergeAssetsController {
13856
15444
  this.facets = [];
13857
15445
  this.items = [];
13858
15446
  this.totalCount = 0;
15447
+ this.unreadableFields = [];
13859
15448
  this.lastRequest = null;
13860
15449
  this.failedRequest = null;
13861
15450
  this.sortOrders = {};
@@ -13881,6 +15470,7 @@ class FetchAndMergeAssetsController {
13881
15470
  __privateSet(this, _lastPage, null);
13882
15471
  this.host = host;
13883
15472
  this.availableDocTypes = availableDocTypes;
15473
+ this.additionalFields = additionalFields != null ? additionalFields : [];
13884
15474
  this.defaultFolderId = defaultFolderId;
13885
15475
  this.defaultIsSeeThrough = defaultIsSeeThrough;
13886
15476
  this.defaultSearchText = defaultSearchText;
@@ -14017,6 +15607,14 @@ class FetchAndMergeAssetsController {
14017
15607
  }
14018
15608
  this.host.requestUpdate();
14019
15609
  }
15610
+ /**
15611
+ * Table columns are host configuration and can be reconfigured after mount, unlike the rest of
15612
+ * these options — every later fetch must ask for the current field list, not the one that
15613
+ * happened to be set when the controller was constructed.
15614
+ */
15615
+ updateAdditionalFields(additionalFields) {
15616
+ this.additionalFields = additionalFields;
15617
+ }
14020
15618
  updateAuth(token, useSession, bearerToken) {
14021
15619
  if (this.useSiteSession) {
14022
15620
  return;
@@ -14183,6 +15781,7 @@ class FetchAndMergeAssetsController {
14183
15781
  }
14184
15782
  }
14185
15783
  request = __spreadProps(__spreadValues({}, request), {
15784
+ fields: this.additionalFields,
14186
15785
  limitedToDocTypes: this.availableDocTypes
14187
15786
  });
14188
15787
  this.lastRequest = request;
@@ -14197,12 +15796,15 @@ class FetchAndMergeAssetsController {
14197
15796
  if (isRestart) {
14198
15797
  this.items = [];
14199
15798
  this.totalCount = 0;
15799
+ this.unreadableFields = [];
14200
15800
  }
14201
15801
  } else {
14202
15802
  if (isRestart) {
14203
15803
  this.items = assets.items;
15804
+ this.unreadableFields = assets.unreadableFields;
14204
15805
  } else {
14205
15806
  this.items = uniqBy([...this.items, ...assets.items], "recordId");
15807
+ this.unreadableFields = narrowUnreadableFields(this.unreadableFields, assets);
14206
15808
  }
14207
15809
  this.facets = this.mergeFacetsWithSelected(assets.facets, this.facets, request.selectedFacets);
14208
15810
  this.totalCount = assets.totalCount;
@@ -14424,6 +16026,7 @@ class FetchAndMergeAssetsController {
14424
16026
  searchError: this.failedRequest !== null,
14425
16027
  sortOrders: this.sortOrders,
14426
16028
  totalCount: this.totalCount,
16029
+ unreadableFields: this.unreadableFields,
14427
16030
  userInfo: this.userInfo
14428
16031
  });
14429
16032
  return __privateGet(this, _lastData);
@@ -14443,6 +16046,7 @@ class FetchAndMergeAssetsController {
14443
16046
  this.facets = [];
14444
16047
  this.items = [];
14445
16048
  this.totalCount = 0;
16049
+ this.unreadableFields = [];
14446
16050
  this.sortOrders = {};
14447
16051
  __privateSet(this, _lastPage, null);
14448
16052
  }
@@ -14461,6 +16065,241 @@ function safeInteger(value) {
14461
16065
  }
14462
16066
  return value;
14463
16067
  }
16068
+ const DATA_EXPIRE_TIME_POSTFIX = "_valid_until";
16069
+ const DEFAULT_EXPIRED_DURATION = 1 * 24 * 60 * 60 * 1e3;
16070
+ const isLocalStorageAvailable = () => {
16071
+ const mod = "test-storage";
16072
+ try {
16073
+ localStorage.setItem(mod, mod);
16074
+ localStorage.removeItem(mod);
16075
+ return true;
16076
+ } catch (e2) {
16077
+ return false;
16078
+ }
16079
+ };
16080
+ const isSessionStorageAvailable = () => {
16081
+ const mod = "test-storage";
16082
+ try {
16083
+ sessionStorage.setItem(mod, mod);
16084
+ sessionStorage.removeItem(mod);
16085
+ return true;
16086
+ } catch (e2) {
16087
+ return false;
16088
+ }
16089
+ };
16090
+ const isCookiesAvailable = () => {
16091
+ try {
16092
+ document.cookie = "test-cookie=test";
16093
+ const available = document.cookie.indexOf("test-cookie=test") !== -1;
16094
+ document.cookie = "test-cookie=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/";
16095
+ return available;
16096
+ } catch (e2) {
16097
+ return false;
16098
+ }
16099
+ };
16100
+ const isCustomStorageAvailable = () => {
16101
+ try {
16102
+ return !!window.OrangeDAMContentBrowser._customStorage && typeof window.OrangeDAMContentBrowser._customStorage.get === "function" && typeof window.OrangeDAMContentBrowser._customStorage.set === "function" && typeof window.OrangeDAMContentBrowser._customStorage.delete === "function";
16103
+ } catch (e2) {
16104
+ return false;
16105
+ }
16106
+ };
16107
+ const createCookie = (key, value, expireDate = null) => {
16108
+ let expires = "";
16109
+ if (expireDate) {
16110
+ expires = "; expires=" + expireDate;
16111
+ }
16112
+ document.cookie = key + "=" + value + expires + "; path=/";
16113
+ };
16114
+ const getCookie = (key) => {
16115
+ const nameEQ = key + "=";
16116
+ const ca = document.cookie.split(";");
16117
+ for (const c2 of ca) {
16118
+ const cookie = c2.trim();
16119
+ if (cookie.startsWith(nameEQ)) {
16120
+ return cookie.substring(nameEQ.length);
16121
+ }
16122
+ }
16123
+ return null;
16124
+ };
16125
+ const getData = (key, storageType) => __async(null, null, function* () {
16126
+ var _a2, _b2;
16127
+ if (!storageType) {
16128
+ let hasAvailableStorage = false;
16129
+ if (isCustomStorageAvailable()) {
16130
+ hasAvailableStorage = true;
16131
+ const result = yield getData(key, "CustomStorage");
16132
+ if (result !== null) return result;
16133
+ }
16134
+ if (isLocalStorageAvailable()) {
16135
+ hasAvailableStorage = true;
16136
+ const result = yield getData(key, "LocalStorage");
16137
+ if (result !== null) return result;
16138
+ }
16139
+ if (isSessionStorageAvailable()) {
16140
+ hasAvailableStorage = true;
16141
+ const result = yield getData(key, "SessionStorage");
16142
+ if (result !== null) return result;
16143
+ }
16144
+ if (isCookiesAvailable()) {
16145
+ hasAvailableStorage = true;
16146
+ const result = yield getData(key, "Cookies");
16147
+ if (result !== null) return result;
16148
+ }
16149
+ if (!hasAvailableStorage) {
16150
+ throw new Error("No storage is available");
16151
+ }
16152
+ return null;
16153
+ }
16154
+ switch (storageType) {
16155
+ case "CustomStorage":
16156
+ return !isCustomStorageAvailable() || (yield isValueExpired(key, "CustomStorage")) ? null : (_b2 = (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.get(key)) != null ? _b2 : null;
16157
+ case "SessionStorage":
16158
+ return !isSessionStorageAvailable() || (yield isValueExpired(key, "SessionStorage")) ? null : sessionStorage.getItem(key);
16159
+ case "Cookies":
16160
+ return !isCookiesAvailable() ? null : getCookie(key);
16161
+ case "LocalStorage":
16162
+ default:
16163
+ return !isLocalStorageAvailable() || (yield isValueExpired(key, "LocalStorage")) ? null : localStorage.getItem(key);
16164
+ }
16165
+ });
16166
+ const isValueExpired = (key, type) => __async(null, null, function* () {
16167
+ if (key.endsWith(DATA_EXPIRE_TIME_POSTFIX)) {
16168
+ return false;
16169
+ }
16170
+ const dataExpireTimeKey = key + DATA_EXPIRE_TIME_POSTFIX;
16171
+ const expireDateStr = yield getData(dataExpireTimeKey, type);
16172
+ if (expireDateStr) {
16173
+ const expireDate = new Date(expireDateStr).getTime();
16174
+ const currentTime = (/* @__PURE__ */ new Date()).getTime();
16175
+ if (expireDate < currentTime) {
16176
+ deleteData(key);
16177
+ deleteData(dataExpireTimeKey);
16178
+ return true;
16179
+ }
16180
+ }
16181
+ return false;
16182
+ });
16183
+ const storeData = (key, value, storageType, ttl = 0) => {
16184
+ var _a2;
16185
+ const dataExpireTimeKey = key + DATA_EXPIRE_TIME_POSTFIX;
16186
+ const expireDate = /* @__PURE__ */ new Date();
16187
+ expireDate.setTime(expireDate.getTime() + (ttl || DEFAULT_EXPIRED_DURATION));
16188
+ const expireDateStr = expireDate.toUTCString();
16189
+ if (!storageType) {
16190
+ if (isCustomStorageAvailable()) {
16191
+ storageType = "CustomStorage";
16192
+ } else if (isLocalStorageAvailable()) {
16193
+ storageType = "LocalStorage";
16194
+ } else if (isSessionStorageAvailable()) {
16195
+ storageType = "SessionStorage";
16196
+ } else if (isCookiesAvailable()) {
16197
+ storageType = "Cookies";
16198
+ } else {
16199
+ throw new Error("No storage is available");
16200
+ }
16201
+ }
16202
+ switch (storageType) {
16203
+ case "CustomStorage":
16204
+ if (!isCustomStorageAvailable()) {
16205
+ throw new Error("CustomStorage is not available");
16206
+ }
16207
+ const set = (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.set;
16208
+ if (ttl) {
16209
+ set(dataExpireTimeKey, expireDateStr);
16210
+ }
16211
+ return set(key, value);
16212
+ case "SessionStorage":
16213
+ if (!isSessionStorageAvailable()) {
16214
+ throw new Error("SessionStorage is not available");
16215
+ }
16216
+ if (ttl) {
16217
+ sessionStorage.setItem(dataExpireTimeKey, expireDateStr);
16218
+ }
16219
+ return sessionStorage.setItem(key, value);
16220
+ case "Cookies":
16221
+ if (!isCookiesAvailable()) {
16222
+ throw new Error("Cookies are not available");
16223
+ }
16224
+ return createCookie(key, value, !ttl ? void 0 : expireDateStr);
16225
+ case "LocalStorage":
16226
+ default:
16227
+ if (!isLocalStorageAvailable()) {
16228
+ throw new Error("LocalStorage is not available");
16229
+ }
16230
+ if (ttl) {
16231
+ localStorage.setItem(dataExpireTimeKey, expireDateStr);
16232
+ }
16233
+ return localStorage.setItem(key, value);
16234
+ }
16235
+ };
16236
+ const deleteData = (key) => {
16237
+ var _a2;
16238
+ let hasAvailableStorage = false;
16239
+ if (isSessionStorageAvailable()) {
16240
+ sessionStorage.removeItem(key);
16241
+ hasAvailableStorage = true;
16242
+ }
16243
+ if (isLocalStorageAvailable()) {
16244
+ localStorage.removeItem(key);
16245
+ hasAvailableStorage = true;
16246
+ }
16247
+ if (isCookiesAvailable()) {
16248
+ document.cookie = key + "=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;";
16249
+ hasAvailableStorage = true;
16250
+ }
16251
+ if (isCustomStorageAvailable()) {
16252
+ (_a2 = window.OrangeDAMContentBrowser._customStorage) == null ? void 0 : _a2.delete(key);
16253
+ hasAvailableStorage = true;
16254
+ }
16255
+ if (!hasAvailableStorage) {
16256
+ throw new Error("No storage is available");
16257
+ }
16258
+ };
16259
+ function tableColumnWidthsKey(siteUrl) {
16260
+ return `tableColumnWidths:${siteUrl.replace(/\/+$/, "")}`;
16261
+ }
16262
+ const parseTableColumnWidths = (raw) => {
16263
+ if (!raw) return {};
16264
+ try {
16265
+ const parsed = JSON.parse(raw);
16266
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {};
16267
+ const widths = {};
16268
+ for (const [field, width] of Object.entries(parsed)) {
16269
+ if (typeof width === "number" && Number.isFinite(width) && width > 0) {
16270
+ widths[field] = width;
16271
+ }
16272
+ }
16273
+ return widths;
16274
+ } catch (e2) {
16275
+ return {};
16276
+ }
16277
+ };
16278
+ function readTableColumnWidths(siteUrl) {
16279
+ return __async(this, null, function* () {
16280
+ try {
16281
+ return parseTableColumnWidths(yield getData(tableColumnWidthsKey(siteUrl)));
16282
+ } catch (e2) {
16283
+ return {};
16284
+ }
16285
+ });
16286
+ }
16287
+ function writeTableColumnWidth(siteUrl, field, width) {
16288
+ return __async(this, null, function* () {
16289
+ const widths = yield readTableColumnWidths(siteUrl);
16290
+ const pixels = width === void 0 ? 0 : Math.round(width);
16291
+ if (pixels > 0) {
16292
+ widths[field] = pixels;
16293
+ } else {
16294
+ delete widths[field];
16295
+ }
16296
+ try {
16297
+ storeData(tableColumnWidthsKey(siteUrl), JSON.stringify(widths));
16298
+ } catch (e2) {
16299
+ }
16300
+ return widths;
16301
+ });
16302
+ }
14464
16303
  const styles = i$7`
14465
16304
  :host {
14466
16305
  --cx-button-text-transform: none;
@@ -14503,6 +16342,9 @@ const styles = i$7`
14503
16342
  `;
14504
16343
  var __defProp2 = Object.defineProperty;
14505
16344
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
16345
+ var __typeError2 = (msg) => {
16346
+ throw TypeError(msg);
16347
+ };
14506
16348
  var __decorateClass = (decorators, target, key, kind) => {
14507
16349
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
14508
16350
  for (var i4 = decorators.length - 1, decorator; i4 >= 0; i4--)
@@ -14511,11 +16353,35 @@ var __decorateClass = (decorators, target, key, kind) => {
14511
16353
  if (kind && result) __defProp2(target, key, result);
14512
16354
  return result;
14513
16355
  };
16356
+ var __accessCheck2 = (obj, member, msg) => member.has(obj) || __typeError2("Cannot " + msg);
16357
+ var __privateGet2 = (obj, member, getter) => (__accessCheck2(obj, member, "read from private field"), member.get(obj));
16358
+ 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);
16359
+ var __privateSet2 = (obj, member, value, setter) => (__accessCheck2(obj, member, "write to private field"), member.set(obj, value), value);
16360
+ var _openingAsset, _insertInFlight;
14514
16361
  const COMPUTED_FIELDS = ["ScrubUrl", "AllowATSLink"];
14515
16362
  const MOBILE_WIDTH_THRESHOLD = 480;
14516
16363
  const FORCE_OVERLAY_THRESHOLD = 650;
14517
16364
  const PERSISTENT_DRAWER_WIDTH = 400;
14518
16365
  const INITIAL_FOLDER_TIMEOUT_MS = 3e3;
16366
+ function resolvePageSize(view) {
16367
+ switch (view) {
16368
+ case GridView.Large:
16369
+ return 15;
16370
+ case GridView.Small:
16371
+ case TABLE_VIEW:
16372
+ return 30;
16373
+ default:
16374
+ return 20;
16375
+ }
16376
+ }
16377
+ const NO_HIDDEN_FIELDS = [];
16378
+ function findUnreadableColumnFields(columns, unreadableFields) {
16379
+ if (unreadableFields.length === 0) {
16380
+ return NO_HIDDEN_FIELDS;
16381
+ }
16382
+ const unreadable = new Set(unreadableFields.map(toFieldKey));
16383
+ return columns.map((column) => column.field).filter((field) => unreadable.has(toFieldKey(field)));
16384
+ }
14519
16385
  let CxContentBrowser = class extends CortexElement {
14520
16386
  constructor() {
14521
16387
  super(...arguments);
@@ -14542,6 +16408,7 @@ let CxContentBrowser = class extends CortexElement {
14542
16408
  this.canFavorite = false;
14543
16409
  this.canPinAsset = false;
14544
16410
  this.canUseProxies = false;
16411
+ this.autoSelectFormat = false;
14545
16412
  this.simplePick = false;
14546
16413
  this.canViewVersions = false;
14547
16414
  this.canTrack = false;
@@ -14550,6 +16417,12 @@ let CxContentBrowser = class extends CortexElement {
14550
16417
  this.ctaTextTransform = "capitalize";
14551
16418
  this.extraFields = [];
14552
16419
  this.defaultGridView = GridView.Medium;
16420
+ this.tableColumns = [];
16421
+ this.tableRowActionPosition = "host-edge";
16422
+ this.tableColumnWidths = {};
16423
+ this.tableWidthQueue = Promise.resolve();
16424
+ this.tableWidthTasks = 0;
16425
+ this.tableWidthsChangedInTable = false;
14553
16426
  this.defaultSortOrderName = "";
14554
16427
  this.defaultSortDirection = "ascending";
14555
16428
  this.defaultSelectedFacets = {};
@@ -14589,28 +16462,98 @@ let CxContentBrowser = class extends CortexElement {
14589
16462
  this.isMobile = false;
14590
16463
  this.defaultPageSize = 10;
14591
16464
  this.initialFolderPending = false;
16465
+ this.busyAssetId = void 0;
16466
+ __privateAdd2(this, _openingAsset, false);
16467
+ __privateAdd2(this, _insertInFlight, false);
14592
16468
  }
14593
16469
  willUpdate(changedProperties) {
14594
16470
  super.willUpdate(changedProperties);
14595
16471
  if (!this.hasUpdated) {
14596
- this.view = this.defaultGridView;
16472
+ this.view = this.defaultGridView === TABLE_VIEW && !this.canUseTable ? GridView.Medium : this.defaultGridView;
16473
+ }
16474
+ }
16475
+ /**
16476
+ * Never trust the host's value: it also arrives by direct property assignment, past the converter.
16477
+ * Entries are checked one by one, not just the outer array — `field` is dereferenced while the
16478
+ * fetch controller is being built, where a throw leaves the controller unassigned and the picker
16479
+ * blank. `title` is only rendered, and Lit renders a nullish one as nothing, so a column is not
16480
+ * worth dropping over it.
16481
+ */
16482
+ get tableColumnList() {
16483
+ const columns = this.tableColumns;
16484
+ if (!Array.isArray(columns)) {
16485
+ return [];
16486
+ }
16487
+ const seen = /* @__PURE__ */ new Set();
16488
+ return columns.flatMap((column) => {
16489
+ if (!column || typeof column !== "object") {
16490
+ return [];
16491
+ }
16492
+ const { field } = column;
16493
+ if (typeof field !== "string") {
16494
+ return [];
16495
+ }
16496
+ const trimmed = field.trim();
16497
+ if (trimmed.length === 0 || seen.has(trimmed.toLowerCase())) {
16498
+ return [];
16499
+ }
16500
+ seen.add(trimmed.toLowerCase());
16501
+ return [trimmed === field ? column : __spreadProps(__spreadValues({}, column), { field: trimmed })];
16502
+ });
16503
+ }
16504
+ /**
16505
+ * This reads the configured columns, not the shown ones. The shown columns can change with each
16506
+ * response, and a table view that goes away with them flips the view and its page size. When
16507
+ * Cortex flags each column, the rows stay with only the filler and the CTA column.
16508
+ */
16509
+ get canUseTable() {
16510
+ return this.tableColumnList.length > 0;
16511
+ }
16512
+ /**
16513
+ * Runs a read or a write of the saved widths after the ones queued before it. The table gets the
16514
+ * map of the last task only: an earlier map does not hold the drags and resets that came after it,
16515
+ * and the table already shows them. A map for a site that is no longer the current one is dropped.
16516
+ */
16517
+ queueTableWidthTask(task) {
16518
+ const { baseUrl } = this;
16519
+ const taskNumber = this.tableWidthTasks + 1;
16520
+ this.tableWidthTasks = taskNumber;
16521
+ this.tableWidthQueue = this.tableWidthQueue.then(() => task(baseUrl)).then((widths) => {
16522
+ if (taskNumber === this.tableWidthTasks && baseUrl === this.baseUrl) {
16523
+ this.setTableColumnWidths(widths);
16524
+ }
16525
+ }).catch(() => void 0);
16526
+ }
16527
+ /**
16528
+ * A map with the same entries keeps the old one, so that the table does not lay out its columns
16529
+ * again. After a drag or a reset the table can show widths that the old map does not hold, so the
16530
+ * new map always replaces them.
16531
+ */
16532
+ setTableColumnWidths(widths) {
16533
+ const current = this.tableColumnWidths;
16534
+ const fields = Object.keys(widths);
16535
+ if (this.tableWidthsChangedInTable || fields.length !== Object.keys(current).length || fields.some((field) => current[field] !== widths[field])) {
16536
+ this.tableWidthsChangedInTable = false;
16537
+ this.tableColumnWidths = widths;
14597
16538
  }
14598
16539
  }
16540
+ loadTableColumnWidths() {
16541
+ this.queueTableWidthTask(readTableColumnWidths);
16542
+ }
16543
+ handleBaseUrlChangeForTableWidths() {
16544
+ this.loadTableColumnWidths();
16545
+ }
16546
+ handleTableColumnResize(event) {
16547
+ const { field, reset, width } = event.detail;
16548
+ this.tableWidthsChangedInTable = true;
16549
+ this.queueTableWidthTask((baseUrl) => writeTableColumnWidth(baseUrl, field, reset ? void 0 : width));
16550
+ }
14599
16551
  runFirstUpdated() {
14600
16552
  if (this.useSiteSession) {
14601
16553
  this.baseUrl = resolveSiteSessionUrl(this.baseUrl);
14602
16554
  }
14603
- switch (this.view) {
14604
- case GridView.Large:
14605
- this.defaultPageSize = 15;
14606
- break;
14607
- case GridView.Medium:
14608
- this.defaultPageSize = 20;
14609
- break;
14610
- case GridView.Small:
14611
- this.defaultPageSize = 30;
14612
- break;
14613
- }
16555
+ this.loadTableColumnWidths();
16556
+ this.defaultPageSize = resolvePageSize(this.view);
14614
16557
  this.lastRequest = __spreadProps(__spreadValues({}, this.lastRequest), {
14615
16558
  folderId: this.defaultFolderId,
14616
16559
  isSeeThrough: this.defaultIsSeeThrough,
@@ -14626,6 +16569,7 @@ let CxContentBrowser = class extends CortexElement {
14626
16569
  }
14627
16570
  this.updateComplete.then(() => {
14628
16571
  this.fetchAndMergeAssetsController = new FetchAndMergeAssetsController(this, {
16572
+ additionalFields: this.tableColumnList.map((column) => column.field),
14629
16573
  availableDocTypes: this.availableDocTypes,
14630
16574
  baseUrl: this.baseUrl,
14631
16575
  bearerToken: this.bearerToken,
@@ -14677,7 +16621,12 @@ let CxContentBrowser = class extends CortexElement {
14677
16621
  }
14678
16622
  openFormatDialog(id) {
14679
16623
  return __async(this, null, function* () {
16624
+ if (__privateGet2(this, _openingAsset) || __privateGet2(this, _insertInFlight)) {
16625
+ return;
16626
+ }
16627
+ __privateSet2(this, _openingAsset, true);
14680
16628
  this.selectedAssetId = id;
16629
+ this.busyAssetId = id;
14681
16630
  try {
14682
16631
  const asset = yield this.fetchAndMergeAssetsController.fetchAssetByID(id, {
14683
16632
  canFavorite: this.canFavorite,
@@ -14685,6 +16634,7 @@ let CxContentBrowser = class extends CortexElement {
14685
16634
  });
14686
16635
  if (!asset) {
14687
16636
  this.selectedAssetId = void 0;
16637
+ this.busyAssetId = void 0;
14688
16638
  return;
14689
16639
  }
14690
16640
  let isAssetPinned = false;
@@ -14695,8 +16645,14 @@ let CxContentBrowser = class extends CortexElement {
14695
16645
  isAssetPinned = lookupEvent.detail.isAssetPinned;
14696
16646
  }
14697
16647
  this.formatDialog.open(__spreadProps(__spreadValues({}, asset), { isAssetPinned }));
16648
+ if (this.formatDialog.isDialogOpen) {
16649
+ this.busyAssetId = void 0;
16650
+ }
14698
16651
  } catch (e2) {
14699
16652
  this.selectedAssetId = void 0;
16653
+ this.busyAssetId = void 0;
16654
+ } finally {
16655
+ __privateSet2(this, _openingAsset, false);
14700
16656
  }
14701
16657
  });
14702
16658
  }
@@ -14711,6 +16667,18 @@ let CxContentBrowser = class extends CortexElement {
14711
16667
  });
14712
16668
  });
14713
16669
  }
16670
+ handleTableColumnsChange() {
16671
+ if (!this.fetchAndMergeAssetsController) {
16672
+ return;
16673
+ }
16674
+ this.fetchAndMergeAssetsController.updateAdditionalFields(
16675
+ this.tableColumnList.map((column) => column.field)
16676
+ );
16677
+ this.lastRequest = __spreadProps(__spreadValues({}, this.lastRequest), { start: 0 });
16678
+ if (!this.initialFolderPending) {
16679
+ void this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest);
16680
+ }
16681
+ }
14714
16682
  handleAuthChange() {
14715
16683
  var _a2;
14716
16684
  (_a2 = this.fetchAndMergeAssetsController) == null ? void 0 : _a2.updateAuth(this.token, this.useSession, this.bearerToken);
@@ -14775,17 +16743,7 @@ let CxContentBrowser = class extends CortexElement {
14775
16743
  yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest);
14776
16744
  }
14777
16745
  }
14778
- switch (event.detail.view) {
14779
- case GridView.Large:
14780
- this.defaultPageSize = 15;
14781
- break;
14782
- case GridView.Medium:
14783
- this.defaultPageSize = 20;
14784
- break;
14785
- case GridView.Small:
14786
- this.defaultPageSize = 30;
14787
- break;
14788
- }
16746
+ this.defaultPageSize = resolvePageSize(event.detail.view);
14789
16747
  this.view = event.detail.view;
14790
16748
  });
14791
16749
  }
@@ -14947,15 +16905,17 @@ let CxContentBrowser = class extends CortexElement {
14947
16905
  selectedProxyMetadata: event.detail.selectedProxyMetadata
14948
16906
  });
14949
16907
  this.formatDialog.hide();
16908
+ this.busyAssetId = void 0;
14950
16909
  return;
14951
16910
  }
16911
+ __privateSet2(this, _insertInFlight, true);
14952
16912
  try {
14953
16913
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14954
16914
  assets: [event.detail.asset],
14955
16915
  extraFields: this.extraFields
14956
16916
  }));
14957
16917
  if (response.isError) {
14958
- this.formatDialog.setLoadingConfirm(false);
16918
+ this.reportProxyConfirmFailure();
14959
16919
  return;
14960
16920
  }
14961
16921
  this.handleSelectedAsset({
@@ -14965,12 +16925,23 @@ let CxContentBrowser = class extends CortexElement {
14965
16925
  });
14966
16926
  this.formatDialog.hide();
14967
16927
  } catch (e2) {
14968
- this.formatDialog.setLoadingConfirm(false);
16928
+ this.reportProxyConfirmFailure();
16929
+ } finally {
16930
+ __privateSet2(this, _insertInFlight, false);
16931
+ this.busyAssetId = void 0;
14969
16932
  }
14970
16933
  });
14971
16934
  }
16935
+ reportProxyConfirmFailure() {
16936
+ if (this.formatDialog.isDialogOpen) {
16937
+ this.formatDialog.setLoadingConfirm(false);
16938
+ return;
16939
+ }
16940
+ this.formatDialog.revealAfterAutoConfirm();
16941
+ }
14972
16942
  handleFormatConfirm(event) {
14973
16943
  return __async(this, null, function* () {
16944
+ __privateSet2(this, _insertInFlight, true);
14974
16945
  try {
14975
16946
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14976
16947
  assets: [event.detail.asset],
@@ -14989,6 +16960,9 @@ let CxContentBrowser = class extends CortexElement {
14989
16960
  this.formatDialog.hide();
14990
16961
  } catch (e2) {
14991
16962
  this.formatDialog.setLoadingConfirm(false);
16963
+ } finally {
16964
+ __privateSet2(this, _insertInFlight, false);
16965
+ this.busyAssetId = void 0;
14992
16966
  }
14993
16967
  });
14994
16968
  }
@@ -15067,6 +17041,7 @@ let CxContentBrowser = class extends CortexElement {
15067
17041
  searchError,
15068
17042
  sortOrders,
15069
17043
  totalCount,
17044
+ unreadableFields,
15070
17045
  userInfo
15071
17046
  } = this.fetchAndMergeAssetsController.getData({
15072
17047
  allowedExtensions: this.allowedExtensions,
@@ -15136,6 +17111,7 @@ let CxContentBrowser = class extends CortexElement {
15136
17111
  .newlyChangedOption=${this.newlyChangedOption}
15137
17112
  .sortOrders=${sortOrders}
15138
17113
  .views=${this.views}
17114
+ ?can-use-table=${this.canUseTable}
15139
17115
  ?is-mobile=${this.isMobile}
15140
17116
  ?is-see-through=${request == null ? void 0 : request.isSeeThrough}
15141
17117
  ?loading=${loading}
@@ -15151,23 +17127,55 @@ let CxContentBrowser = class extends CortexElement {
15151
17127
  @cx-content-browser-control-filter-change=${this.handleFilterChange}
15152
17128
  @cx-content-browser-control-bar-search-change=${this.handleSearchChange}
15153
17129
  ></cx-content-browser-control-bar>
15154
- <cx-content-browser-grid
15155
- .assets=${items}
15156
- ?empty=${!loading && !this.initialFolderPending && !searchError && items.length === 0}
15157
- ?error=${searchError}
15158
- ?has-more=${items.length < totalCount}
15159
- ?loading=${loading || this.initialFolderPending}
15160
- ?show-title=${this.showTitle}
15161
- ?show-size=${this.showSize}
15162
- ?show-dimensions=${this.showDimensions}
15163
- ?show-tags=${this.showTags}
15164
- selected-asset-id=${o$4(this.selectedAssetId || void 0)}
15165
- view=${this.view}
15166
- @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
15167
- @cx-content-browser-grid-resize=${this.handleGridResize}
15168
- @cx-content-browser-grid-retry=${this.handleRetry}
15169
- @cx-content-browser-grid-click=${this.handleGridClick}
15170
- ></cx-content-browser-grid>
17130
+ ${n$5(
17131
+ this.view === TABLE_VIEW && this.canUseTable,
17132
+ () => b`
17133
+ <cx-content-browser-table
17134
+ .busyAssetId=${this.busyAssetId}
17135
+ .assets=${items}
17136
+ .columns=${this.tableColumnList}
17137
+ .hiddenFields=${findUnreadableColumnFields(this.tableColumnList, unreadableFields)}
17138
+ .savedWidths=${this.tableColumnWidths}
17139
+ .widthScope=${this.baseUrl}
17140
+ row-action-position=${toTableRowActionPosition(this.tableRowActionPosition)}
17141
+ @cx-content-browser-table-column-resize=${this.handleTableColumnResize}
17142
+ ?empty=${!loading && !this.initialFolderPending && !searchError && items.length === 0}
17143
+ ?error=${searchError}
17144
+ cta-text=${this.ctaText}
17145
+ cta-text-transform=${this.ctaTextTransform}
17146
+ ?has-more=${items.length < totalCount}
17147
+ ?loading=${loading || this.initialFolderPending}
17148
+ selected-asset-id=${o$4(this.selectedAssetId || void 0)}
17149
+ @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
17150
+ @cx-content-browser-grid-resize=${this.handleGridResize}
17151
+ @cx-content-browser-grid-retry=${this.handleRetry}
17152
+ @cx-content-browser-grid-click=${this.handleGridClick}
17153
+ ></cx-content-browser-table>
17154
+ `,
17155
+ () => b`
17156
+ <cx-content-browser-grid
17157
+ .assets=${items}
17158
+ ?empty=${!loading && !this.initialFolderPending && !searchError && items.length === 0}
17159
+ ?error=${searchError}
17160
+ ?has-more=${items.length < totalCount}
17161
+ ?loading=${loading || this.initialFolderPending}
17162
+ ?show-title=${this.showTitle}
17163
+ ?show-size=${this.showSize}
17164
+ ?show-dimensions=${this.showDimensions}
17165
+ ?show-tags=${this.showTags}
17166
+ ?show-cta=${isAutoSelectFormatActive(this.autoSelectFormat)}
17167
+ .busyAssetId=${this.busyAssetId}
17168
+ cta-text=${this.ctaText}
17169
+ cta-text-transform=${this.ctaTextTransform}
17170
+ selected-asset-id=${o$4(this.selectedAssetId || void 0)}
17171
+ view=${this.view}
17172
+ @cx-content-browser-grid-scroll-end=${this.handleScrollEnd}
17173
+ @cx-content-browser-grid-resize=${this.handleGridResize}
17174
+ @cx-content-browser-grid-retry=${this.handleRetry}
17175
+ @cx-content-browser-grid-click=${this.handleGridClick}
17176
+ ></cx-content-browser-grid>
17177
+ `
17178
+ )}
15171
17179
  </cx-resize-observer>
15172
17180
  <cx-content-browser-format-dialog
15173
17181
  .availableExtensions=${availableExtensions}
@@ -15180,6 +17188,7 @@ let CxContentBrowser = class extends CortexElement {
15180
17188
  cta-text-transform=${this.ctaTextTransform}
15181
17189
  variant=${this.isMobile ? ContentBrowserFormatDialogVariant.Drawer : ContentBrowserFormatDialogVariant.Dialog}
15182
17190
  token=${this.useSiteSession ? "" : this.token}
17191
+ .autoSelectFormat=${this.autoSelectFormat}
15183
17192
  ?can-custom-format=${!!(parameters == null ? void 0 : parameters.ATSEnabled)}
15184
17193
  ?can-favorite=${this.canFavorite}
15185
17194
  ?can-pin-asset=${this.canPinAsset}
@@ -15199,6 +17208,8 @@ let CxContentBrowser = class extends CortexElement {
15199
17208
  `;
15200
17209
  }
15201
17210
  };
17211
+ _openingAsset = /* @__PURE__ */ new WeakMap();
17212
+ _insertInFlight = /* @__PURE__ */ new WeakMap();
15202
17213
  CxContentBrowser.styles = [componentStyles, styles];
15203
17214
  CxContentBrowser.dependencies = {
15204
17215
  "cx-content-browser-browser": CxContentBrowserBrowser,
@@ -15207,6 +17218,7 @@ CxContentBrowser.dependencies = {
15207
17218
  "cx-content-browser-grid": CxContentBrowserGrid,
15208
17219
  "cx-content-browser-header": CxContentBrowserHeader,
15209
17220
  "cx-content-browser-no-result": CxContentBrowserNoResult,
17221
+ "cx-content-browser-table": CxContentBrowserTable,
15210
17222
  "cx-icon": CxIcon,
15211
17223
  "cx-icon-button": CxIconButton,
15212
17224
  "cx-resize-observer": CxResizeObserver,
@@ -15301,6 +17313,9 @@ __decorateClass([
15301
17313
  __decorateClass([
15302
17314
  n$6({ attribute: "can-use-proxies", reflect: true, type: Boolean })
15303
17315
  ], CxContentBrowser.prototype, "canUseProxies", 2);
17316
+ __decorateClass([
17317
+ n$6({ attribute: "auto-select-format", converter: autoSelectFormatConverter, reflect: false })
17318
+ ], CxContentBrowser.prototype, "autoSelectFormat", 2);
15304
17319
  __decorateClass([
15305
17320
  n$6({ attribute: "simple-pick", reflect: true, type: Boolean })
15306
17321
  ], CxContentBrowser.prototype, "simplePick", 2);
@@ -15333,6 +17348,38 @@ __decorateClass([
15333
17348
  __decorateClass([
15334
17349
  n$6({ attribute: "default-grid-view", type: String })
15335
17350
  ], CxContentBrowser.prototype, "defaultGridView", 2);
17351
+ __decorateClass([
17352
+ n$6({
17353
+ attribute: "table-columns",
17354
+ /**
17355
+ * Lit's stock Array converter returns `null` for anything `JSON.parse` rejects, and a host that
17356
+ * stringifies an array into the attribute hands it `""` or `"[object Object]"`. `null` then
17357
+ * throws on every read below, taking the whole picker down. An unreadable value means "no
17358
+ * columns", which turns the table view off — the same outcome as not configuring one.
17359
+ */
17360
+ converter: {
17361
+ fromAttribute: (value) => {
17362
+ if (!value) {
17363
+ return [];
17364
+ }
17365
+ try {
17366
+ const parsed = JSON.parse(value);
17367
+ return Array.isArray(parsed) ? parsed : [];
17368
+ } catch (e2) {
17369
+ return [];
17370
+ }
17371
+ },
17372
+ toAttribute: (value) => JSON.stringify(value != null ? value : [])
17373
+ },
17374
+ type: Array
17375
+ })
17376
+ ], CxContentBrowser.prototype, "tableColumns", 2);
17377
+ __decorateClass([
17378
+ n$6({ attribute: "table-row-action-position", type: String })
17379
+ ], CxContentBrowser.prototype, "tableRowActionPosition", 2);
17380
+ __decorateClass([
17381
+ r$6()
17382
+ ], CxContentBrowser.prototype, "tableColumnWidths", 2);
15336
17383
  __decorateClass([
15337
17384
  n$6({ attribute: "default-sort-order-name", type: String })
15338
17385
  ], CxContentBrowser.prototype, "defaultSortOrderName", 2);
@@ -15403,8 +17450,17 @@ __decorateClass([
15403
17450
  r$6()
15404
17451
  ], CxContentBrowser.prototype, "initialFolderPending", 2);
15405
17452
  __decorateClass([
15406
- watch("lastRequest", { waitUntilFirstUpdate: true })
17453
+ watch("baseUrl", { waitUntilFirstUpdate: true })
17454
+ ], CxContentBrowser.prototype, "handleBaseUrlChangeForTableWidths", 1);
17455
+ __decorateClass([
17456
+ r$6()
17457
+ ], CxContentBrowser.prototype, "busyAssetId", 2);
17458
+ __decorateClass([
17459
+ watch(["lastRequest", "view"], { waitUntilFirstUpdate: true })
15407
17460
  ], CxContentBrowser.prototype, "handleLastRequestChange", 1);
17461
+ __decorateClass([
17462
+ watch("tableColumns", { waitUntilFirstUpdate: true })
17463
+ ], CxContentBrowser.prototype, "handleTableColumnsChange", 1);
15408
17464
  __decorateClass([
15409
17465
  watch(["token", "useSession", "bearerToken"], { waitUntilFirstUpdate: true })
15410
17466
  ], CxContentBrowser.prototype, "handleAuthChange", 1);