@orangelogic/orange-dam-content-browser-sdk 2.2.3-41YQXP-beta-10 → 2.2.3-41YQXP-beta-11

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.
@@ -1701,7 +1701,7 @@
1701
1701
  .content-browser-format__footer__button cx-button-group {
1702
1702
  width: 100%;
1703
1703
  }
1704
- `;var D2=Object.defineProperty,L2=Object.getOwnPropertyDescriptor,N2=(e,t,n,i)=>{for(var r,o=i>1?void 0:i?L2(t,n):t,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i?r(t,n,o):r(o))||o);return i&&o&&D2(t,n,o),o};const z2=[{key:"UTM_source",value:""},{key:"UTM_campaign",value:""},{key:"UTM_description",value:""}],F2=[{label:"Free",value:"free"},{label:"Widescreen (16:9)",value:"16:9"},{label:"Phone (9:16)",value:"9:16"},{label:"Presentation (4:3)",value:"4:3"},{label:"Square (1:1)",value:"1:1"},{label:"Landscape (3:2)",value:"3:2"},{label:"Portrait (2:3)",value:"2:3"}];let j2=class extends Nn{constructor(){super(...arguments),this.localize=new sc(this),this.boundary=document.body,this.availableExtensions=null,this.supportedExtensions=[],this.supportedRepresentativeSubtypes=[],this.autoExtension="",this.ctaText="",this.ctaTextTransform="capitalize",this.canCustomFormat=!1,this.canFavorite=!1,this.canPinAsset=!1,this.canTrack=!1,this.canUseProxies=!1,this.canViewVersions=!1,this.variant=mS.Dialog,this.loadingFavorites=!1,this.loadingPinAsset=!1,this.loadingProxies=!1,this.disabledConfirm=!1,this.token="",this.baseUrl="",this.asset=void 0,this.isOpen=!1,this.isFavorite=!1,this.isAssetPinned=!1,this.proxies=[],this.showVersionHistory=!1,this.showCustomFormat=!1,this.loadingVersionHistory=!1,this.versions=[],this.filteredProxies=[],this.selectedProxy="",this.lastProxyBeforeCustomFormat="",this.confirmedTransformations=[],this.confirmedFormat=void 0,this.loadingConfirm=!1,this.enabledTracking=!1,this.trackingParameters=z2}get shouldAppendAutoExtension(){return!!this.autoExtension&&this.supportedExtensions.includes(this.autoExtension)}get canUseATS(){if(!this.asset)return!1;const e=(this.availableExtensions&&this.asset.docType?yk([...this.availableExtensions[this.asset.docType],{displayName:this.localize.term("automatic"),value:this.autoExtension}],"value"):[{displayName:this.localize.term("automatic"),value:this.autoExtension}]).filter(e=>this.shouldAppendAutoExtension||e.value!==this.autoExtension);return this.canCustomFormat&&e.some(e=>e.value===this.asset.extension)}handleSupportedExtensionsChange(){var e,t;this.filteredProxies=this.proxies.filter(e=>!(!e.extension&&this.asset)||this.supportedExtensions.includes(this.asset.extension.replace(/^\./,""))),this.selectedProxy=null!=(t=null==(e=this.filteredProxies[0])?void 0:e.id)?t:""}open({asset:e,isFavorite:t,isAssetPinned:n=!1,proxies:i}){this.asset=e,this.isFavorite=t,this.isAssetPinned=n,this.proxies=i,this.isOpen=!0}hide(){this.handleClose()}setVersionHistory(e){this.versions=e,this.loadingVersionHistory=!1}setIsFavorite(e){this.isFavorite=e,this.loadingFavorites=!1}setIsAssetPinned(e){this.isAssetPinned=e,this.loadingPinAsset=!1}setLoadingConfirm(e){this.loadingConfirm=e}mapFormatConfirmPayload(e,t){var n,i,r,o,a,s,l,c,u,d,h,p,f,m,g,v,y,b;return{asset:e,extension:null!=(i=null==(n=this.confirmedFormat)?void 0:n.extension)?i:"",parameters:this.enabledTracking?this.trackingParameters:void 0,proxyPreference:null!=(r=null==t?void 0:t.proxyName)?r:"",sourceProxyMetadata:{cdnName:null!=(o=null==t?void 0:t.cdnName)?o:null,extension:"TRX"===(null==t?void 0:t.proxyName)?e.extension:null!=(a=null==t?void 0:t.extension)?a:null,height:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(s=e.height)?s:"0",10):null!=(l=null==t?void 0:t.formatHeight)?l:null,isCustomFormat:null,permanentLink:null!=(c=null==t?void 0:t.permanentLink)?c:null,proxyLabel:null!=(u=null==t?void 0:t.proxyLabel)?u:null,proxyName:null!=(d=null==t?void 0:t.proxyName)?d:null,width:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(h=e.width)?h:"0",10):null!=(p=null==t?void 0:t.formatWidth)?p:null},transformations:this.confirmedTransformations,transformedAssetMetadata:{extension:null!=(m=null==(f=this.confirmedFormat)?void 0:f.extension)?m:null,height:null!=(v=null==(g=this.confirmedFormat)?void 0:g.height)?v:null,isCustomFormat:!0,permanentLink:null,width:null!=(b=null==(y=this.confirmedFormat)?void 0:y.width)?b:null}}}mapProxyConfirmPayload(e,t){var n,i,r,o,a,s,l,c,u,d,h,p;return{asset:e,extension:null!=(n=null==t?void 0:t.extension)?n:e.extension,parameters:this.enabledTracking?this.trackingParameters:void 0,permanentLink:null!=(i=null==t?void 0:t.permanentLink)?i:void 0,proxyPreference:null!=(r=null==t?void 0:t.proxyName)?r:"",selectedProxyMetadata:{cdnName:null!=(o=null==t?void 0:t.cdnName)?o:null,extension:"TRX"===(null==t?void 0:t.proxyName)?e.extension:null!=(a=null==t?void 0:t.extension)?a:null,height:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(s=e.height)?s:"0",10):null!=(l=null==t?void 0:t.formatHeight)?l:null,isCustomFormat:!1,permanentLink:null!=(c=null==t?void 0:t.permanentLink)?c:null,proxyLabel:null!=(u=null==t?void 0:t.proxyLabel)?u:null,proxyName:null!=(d=null==t?void 0:t.proxyName)?d:null,width:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(h=e.width)?h:"0",10):null!=(p=null==t?void 0:t.formatWidth)?p:null},useRepresentative:this.selectedProxy===m2}}handleCancelCustomFormat(){this.assetLinkFormat.setActiveSetting(""),this.showCustomFormat=!1,this.selectedProxy=this.confirmedFormat||0!==this.confirmedTransformations.length?this.selectedProxy:this.lastProxyBeforeCustomFormat}handleDoneCustomFormat(){this.confirmedTransformations=this.assetLinkFormat.transformations,this.confirmedFormat=this.assetLinkFormat.selectedFormat,this.assetLinkFormat.setActiveSetting(""),this.showCustomFormat=!1}handleFavorite(){var e;!this.loadingFavorites&&(null==(e=this.asset)?void 0:e.id)&&(this.loadingFavorites=!0,this.emit("cx-content-browser-format-dialog-favorite-change",{detail:{assetId:this.asset.id,isFavorite:this.isFavorite}}))}handlePinAsset(){var e;!this.loadingPinAsset&&(null==(e=this.asset)?void 0:e.id)&&(this.loadingPinAsset=!0,this.emit("cx-content-browser-format-dialog-pin-asset-change",{detail:{assetId:this.asset.id,isPinned:this.isAssetPinned}}))}handleProxyConfirm(){var e,t;if(!this.asset)return;if(!this.canUseProxies)return this.loadingConfirm=!0,void this.emit("cx-content-browser-format-dialog-proxy-confirm",{detail:this.mapProxyConfirmPayload(this.asset)});const n=null==(e=this.filteredProxies)?void 0:e.find(e=>e.id===this.selectedProxy);if(this.selectedProxy===g2){const e=null==(t=this.filteredProxies)?void 0:t.find(e=>e.id===this.lastProxyBeforeCustomFormat),n=this.mapFormatConfirmPayload(this.asset,e);this.loadingConfirm=!0,this.emit("cx-content-browser-format-dialog-format-confirm",{detail:n})}else{if(!n&&this.selectedProxy!==m2)return;const e=this.mapProxyConfirmPayload(this.asset,n);this.loadingConfirm=!0,this.emit("cx-content-browser-format-dialog-proxy-confirm",{detail:e})}}handleVersionHistory(){this.asset&&(this.loadingVersionHistory=!0,this.showVersionHistory=!0,this.emit("cx-content-browser-format-dialog-version-history-open",{detail:{assetId:this.asset.id}}))}handleProxySelect(e){const t=e.detail.item.value;if(t===g2)return this.lastProxyBeforeCustomFormat=this.selectedProxy,this.showCustomFormat=!0,void(this.selectedProxy=g2);if("tracking"!==t)if(t!==m2){if(t&&this.proxies){if(!this.proxies.map(e=>e.id).includes(t))return;this.selectedProxy=t,this.confirmedFormat=void 0,this.confirmedTransformations.length>0&&(this.confirmedTransformations=[])}}else this.selectedProxy=m2;else this.enabledTracking=!this.enabledTracking}handleTrackingParametersChange(e){this.trackingParameters=e.detail.values}renderHeader(){var e,t;return this.showVersionHistory?He`
1704
+ `;var D2=Object.defineProperty,L2=Object.getOwnPropertyDescriptor,N2=(e,t,n,i)=>{for(var r,o=i>1?void 0:i?L2(t,n):t,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i?r(t,n,o):r(o))||o);return i&&o&&D2(t,n,o),o};const z2=[{key:"UTM_source",value:""},{key:"UTM_campaign",value:""},{key:"UTM_description",value:""}],F2=[{label:"Free",value:"free"},{label:"Widescreen (16:9)",value:"16:9"},{label:"Phone (9:16)",value:"9:16"},{label:"Presentation (4:3)",value:"4:3"},{label:"Square (1:1)",value:"1:1"},{label:"Landscape (3:2)",value:"3:2"},{label:"Portrait (2:3)",value:"2:3"}];let j2=class extends Nn{constructor(){super(...arguments),this.localize=new sc(this),this.boundary=document.body,this.availableExtensions=null,this.supportedExtensions=[],this.supportedRepresentativeSubtypes=[],this.autoExtension="",this.ctaText="",this.ctaTextTransform="capitalize",this.canCustomFormat=!1,this.canFavorite=!1,this.canPinAsset=!1,this.canTrack=!1,this.canUseProxies=!1,this.canViewVersions=!1,this.variant=mS.Dialog,this.loadingFavorites=!1,this.loadingPinAsset=!1,this.loadingProxies=!1,this.disabledConfirm=!1,this.token="",this.baseUrl="",this.asset=void 0,this.isOpen=!1,this.isFavorite=!1,this.isAssetPinned=!1,this.proxies=[],this.showVersionHistory=!1,this.showCustomFormat=!1,this.loadingVersionHistory=!1,this.versions=[],this.filteredProxies=[],this.selectedProxy="",this.lastProxyBeforeCustomFormat="",this.confirmedTransformations=[],this.confirmedFormat=void 0,this.loadingConfirm=!1,this.enabledTracking=!1,this.trackingParameters=z2}get shouldAppendAutoExtension(){return!!this.autoExtension&&this.supportedExtensions.includes(this.autoExtension)}get canUseATS(){if(!this.asset)return!1;const e=(this.availableExtensions&&this.asset.docType?yk([...this.availableExtensions[this.asset.docType],{displayName:this.localize.term("automatic"),value:this.autoExtension}],"value"):[{displayName:this.localize.term("automatic"),value:this.autoExtension}]).filter(e=>this.shouldAppendAutoExtension||e.value!==this.autoExtension);return this.canCustomFormat&&e.some(e=>e.value===this.asset.extension)}handleSupportedExtensionsChange(){var e,t;this.filteredProxies=this.proxies.filter(e=>!(!e.extension&&this.asset)||this.supportedExtensions.includes(this.asset.extension.replace(/^\./,""))),this.selectedProxy=null!=(t=null==(e=this.filteredProxies[0])?void 0:e.id)?t:""}open({asset:e,isFavorite:t,isAssetPinned:n=!1,proxies:i}){this.asset=e,this.isFavorite=t,this.isAssetPinned=n,this.proxies=i,this.isOpen=!0}hide(){this.handleClose()}setVersionHistory(e){this.versions=e,this.loadingVersionHistory=!1}setIsFavorite(e){this.isFavorite=e,this.loadingFavorites=!1}setIsAssetPinned(e){this.isAssetPinned=e,this.loadingPinAsset=!1}setLoadingConfirm(e){this.loadingConfirm=e}mapFormatConfirmPayload(e,t){var n,i,r,o,a,s,l,c,u,d,h,p,f,m,g,v,y,b;return{asset:e,extension:null!=(i=null==(n=this.confirmedFormat)?void 0:n.extension)?i:"",parameters:this.enabledTracking?this.trackingParameters:void 0,proxyPreference:null!=(r=null==t?void 0:t.proxyName)?r:"",sourceProxyMetadata:{cdnName:null!=(o=null==t?void 0:t.cdnName)?o:null,extension:"TRX"===(null==t?void 0:t.proxyName)?e.extension:null!=(a=null==t?void 0:t.extension)?a:null,height:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(s=e.height)?s:"0",10):null!=(l=null==t?void 0:t.formatHeight)?l:null,isCustomFormat:null,permanentLink:null!=(c=null==t?void 0:t.permanentLink)?c:null,proxyLabel:null!=(u=null==t?void 0:t.proxyLabel)?u:null,proxyName:null!=(d=null==t?void 0:t.proxyName)?d:null,width:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(h=e.width)?h:"0",10):null!=(p=null==t?void 0:t.formatWidth)?p:null},transformations:this.confirmedTransformations,transformedAssetMetadata:{extension:null!=(m=null==(f=this.confirmedFormat)?void 0:f.extension)?m:null,height:null!=(v=null==(g=this.confirmedFormat)?void 0:g.height)?v:null,isCustomFormat:!0,permanentLink:null,width:null!=(b=null==(y=this.confirmedFormat)?void 0:y.width)?b:null}}}mapProxyConfirmPayload(e,t){var n,i,r,o,a,s,l,c,u,d,h,p;return{asset:e,extension:null!=(n=null==t?void 0:t.extension)?n:e.extension,parameters:this.enabledTracking?this.trackingParameters:void 0,permanentLink:null!=(i=null==t?void 0:t.permanentLink)?i:void 0,proxyPreference:null!=(r=null==t?void 0:t.proxyName)?r:"",selectedProxyMetadata:{cdnName:null!=(o=null==t?void 0:t.cdnName)?o:null,extension:"TRX"===(null==t?void 0:t.proxyName)?e.extension:null!=(a=null==t?void 0:t.extension)?a:null,height:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(s=e.height)?s:"0",10):null!=(l=null==t?void 0:t.formatHeight)?l:null,isCustomFormat:!1,permanentLink:null!=(c=null==t?void 0:t.permanentLink)?c:null,proxyLabel:null!=(u=null==t?void 0:t.proxyLabel)?u:null,proxyName:null!=(d=null==t?void 0:t.proxyName)?d:null,width:"TRX"===(null==t?void 0:t.proxyName)?Number.parseInt(null!=(h=e.width)?h:"0",10):null!=(p=null==t?void 0:t.formatWidth)?p:null},useRepresentative:this.selectedProxy===m2}}handleCancelCustomFormat(){this.assetLinkFormat.setActiveSetting(""),this.showCustomFormat=!1,this.selectedProxy=this.confirmedFormat||0!==this.confirmedTransformations.length?this.selectedProxy:this.lastProxyBeforeCustomFormat}handleDoneCustomFormat(){this.confirmedTransformations=this.assetLinkFormat.transformations,this.confirmedFormat=this.assetLinkFormat.selectedFormat,this.assetLinkFormat.setActiveSetting(""),this.assetLinkFormat.selectedProxy&&(this.lastProxyBeforeCustomFormat=this.assetLinkFormat.selectedProxy),this.showCustomFormat=!1}handleFavorite(){var e;!this.loadingFavorites&&(null==(e=this.asset)?void 0:e.id)&&(this.loadingFavorites=!0,this.emit("cx-content-browser-format-dialog-favorite-change",{detail:{assetId:this.asset.id,isFavorite:this.isFavorite}}))}handlePinAsset(){var e;!this.loadingPinAsset&&(null==(e=this.asset)?void 0:e.id)&&(this.loadingPinAsset=!0,this.emit("cx-content-browser-format-dialog-pin-asset-change",{detail:{assetId:this.asset.id,isPinned:this.isAssetPinned}}))}handleProxyConfirm(){var e,t;if(!this.asset)return;if(!this.canUseProxies)return this.loadingConfirm=!0,void this.emit("cx-content-browser-format-dialog-proxy-confirm",{detail:this.mapProxyConfirmPayload(this.asset)});const n=null==(e=this.filteredProxies)?void 0:e.find(e=>e.id===this.selectedProxy);if(this.selectedProxy===g2){const e=null==(t=this.filteredProxies)?void 0:t.find(e=>e.id===this.lastProxyBeforeCustomFormat),n=this.mapFormatConfirmPayload(this.asset,e);this.loadingConfirm=!0,this.emit("cx-content-browser-format-dialog-format-confirm",{detail:n})}else{if(!n&&this.selectedProxy!==m2)return;const e=this.mapProxyConfirmPayload(this.asset,n);this.loadingConfirm=!0,this.emit("cx-content-browser-format-dialog-proxy-confirm",{detail:e})}}handleVersionHistory(){this.asset&&(this.loadingVersionHistory=!0,this.showVersionHistory=!0,this.emit("cx-content-browser-format-dialog-version-history-open",{detail:{assetId:this.asset.id}}))}handleProxySelect(e){const t=e.detail.item.value;if(t===g2)return this.lastProxyBeforeCustomFormat=this.selectedProxy,this.showCustomFormat=!0,void(this.selectedProxy=g2);if("tracking"!==t)if(t!==m2){if(t&&this.proxies){if(!this.proxies.map(e=>e.id).includes(t))return;this.selectedProxy=t,this.confirmedFormat=void 0,this.confirmedTransformations.length>0&&(this.confirmedTransformations=[])}}else this.selectedProxy=m2;else this.enabledTracking=!this.enabledTracking}handleTrackingParametersChange(e){this.trackingParameters=e.detail.values}renderHeader(){var e,t;return this.showVersionHistory?He`
1705
1705
  <cx-space slot="label" justify-content="space-between" align-items="center">
1706
1706
  <cx-space
1707
1707
  direction="vertical"
@@ -2280,7 +2280,7 @@
2280
2280
  </cx-space>
2281
2281
  <slot></slot>
2282
2282
  </cx-space>
2283
- `}};v4.styles=[ga,h4],v4.dependencies={"cx-avatar":ZC,"cx-divider":MS,"cx-dropdown":dT,"cx-icon":gh,"cx-icon-button":Ch,"cx-line-clamp":iv,"cx-menu":eT,"cx-menu-item":qS,"cx-skeleton":LO,"cx-space":gv,"cx-typography":cv},m4([dt({type:Boolean})],v4.prototype,"bordered",2),m4([dt({attribute:"application-name",type:String})],v4.prototype,"applicationName",2),m4([dt({type:Boolean})],v4.prototype,"loading",2),m4([dt({attribute:"is-fetching",type:Boolean})],v4.prototype,"isFetching",2),m4([dt({attribute:"avatar",type:String})],v4.prototype,"avatar",2),m4([dt({attribute:"full-name",type:String})],v4.prototype,"fullName",2),m4([dt({attribute:"folder-title",type:String})],v4.prototype,"folderTitle",2),m4([dt({attribute:"show-close-button",type:Boolean})],v4.prototype,"showCloseButton",2),m4([dt({attribute:"can-logout",type:Boolean})],v4.prototype,"canLogout",2),v4=m4([Us("cx-content-browser-header")],v4);const y4="CoreField.LargeSizePreview",b4="AllowATSLink",A4="CoreField.DocType",w4="Document.FileExtension",x4="CoreField.FileSize",_4="CoreField.Identifier",E4="CoreField.Keywords",C4="CoreField.MaxHeight",S4="CoreField.MaxWidth",T4="CoreField.OriginalFileName",k4="Document.RecordID",I4="ScrubURL",M4="CoreField.S6_StorageGroup",P4="CoreField.DocSubType",R4="CoreField.TitleWithFallback",B4="CoreField.UpdatedFileName",O4="CoreField.OriginalPreview";function D4(e){return e&&0!==Object.keys(e).length?Object.entries(e).reduce((e,[t,n])=>n&&0!==n.length?B(R({},e),"Types"===t?{SubtypeCriteria:n}:{FacetFilters:B(R({},e.FacetFilters),{[t]:n})}):e,{}):{}}function L4(){const e=globalThis.crypto;if(null==e?void 0:e.randomUUID)return e.randomUUID();if(null==e?void 0:e.getRandomValues){const t=e.getRandomValues(new Uint8Array(16));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,"0"));return[n.slice(0,4).join(""),n.slice(4,6).join(""),n.slice(6,8).join(""),n.slice(8,10).join(""),n.slice(10).join("")].join("-")}return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function N4(e){return U(this,arguments,function*({extraFields:e,recordIds:t}){var n;if(!Array.isArray(t)||0===t.length)return{facets:[],items:[],totalCount:0};const i=null!=(n=null==e?void 0:e.filter(e=>e&&"string"==typeof e))?n:[];try{return(yield ca.request({method:"GET",params:{ExtraFilters:`RecordID:${t.join(" OR ")}`,Fields:[...i,O4,B4,T4,"Document.Title","Document.CaptionLong"],SeeThru:!0},paramsSerializer:{indexes:null},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var n,r;const o=null!=(r=null==(n=e.contentItems)?void 0:n.map(e=>{var t,n,r;let o=null!=(t=e.fields[B4])?t:"";return""===o&&(o=null!=(n=e.fields[T4])?n:""),R({name:o,originalUrl:null!=(r=e.fields[O4])?r:"",recordId:e.recordID},i.reduce((t,n)=>{var i;return t[n]=null!=(i=e.fields[n])?i:"",t},{}))}))?r:[];return o.sort((e,n)=>t.indexOf(e.recordId)-t.indexOf(n.recordId)),{facets:e.facets,items:o,totalCount:e.totalCount}}],url:da.GET_CONTENT_V1})).data}catch(r){return{facets:[],items:[],totalCount:0}}})}function z4(e){return U(this,arguments,function*({folderId:e,isSeeThrough:t,limitedToDocTypes:n=[],pageSize:i,searchText:r,selectedFacets:o,sortOrder:a,start:s,useSession:l}){try{return(yield ca.request({data:R({Fields:[y4,A4,w4,x4,_4,E4,C4,S4,T4,k4,P4,R4,B4,M4,O4],Limit:i||void 0,LimitedToDocTypes:n,ObjectRecordID:e||void 0,OrderBy:a,SeeThru:t||void 0,SelectedFacets:o,Start:s,Text:r||void 0,UseSession:l||void 0},D4(o)),method:"POST",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n;const i=null!=(n=null==(t=e.contentItems)?void 0:t.map(e=>{var t,n,i,r,o,a,s,l,c,u,d,h;let p=null!=(t=e.fields[w4])?t:"";const f=e.fields[R4];return p&&!p.startsWith(".")&&(p="."+p),{allowATSLink:"True"===e.fields[b4],docSubType:null!=(n=e.fields[P4])?n:"",docType:null!=(i=e.fields[A4])?i:"",extension:p,height:null!=(r=e.fields[C4])?r:"0",id:e.recordID,identifier:null!=(o=e.fields[_4])?o:"",imageUrl:null!=(a=e.fields[y4])?a:"",inColdStorage:"Cold Storage"===e.fields[M4],name:null!=f?f:"",originalUrl:null!=(s=e.fields[O4])?s:"",recordId:null!=(l=e.fields[k4])?l:"",scrubUrl:null!=(c=e.fields[I4])?c:"",size:null!=(u=e.fields[x4])?u:"0 MB",tags:null!=(d=e.fields[E4])?d:"",width:null!=(h=e.fields[S4])?h:"0"}}))?n:[];return{facets:e.facets,items:i,totalCount:e.totalCount}}],url:da.GET_CONTENT_V3})).data}catch(c){return{facets:[],items:[],totalCount:0}}})}function F4(e){return U(this,arguments,function*({assetRecordId:e,siteUrl:t}){try{return(yield ca.request({baseURL:t,method:"GET",params:{RecordId:e},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n,i;return e&&"object"==typeof e?{previewUrl:null!=(t=e.previewUrl)?t:"",proxies:null!=(i=null==(n=e.proxies)?void 0:n.map(e=>({cdnName:e.cdnName,extension:e.extension,formatHeight:e.formatHeight,formatWidth:e.formatWidth,height:e.height,id:L4(),permanentLink:e.permanentLink,proxyLabel:e.proxyLabel,proxyName:e.proxyName,width:e.width})))?i:[]}:{previewUrl:"",proxies:[]}}],url:da.GET_AVAILABLE_PROXIES})).data}catch(n){return{previewUrl:"",proxies:[]}}})}var j4=(e=>(e.CollectionSubtypeCriteria="CollectionSubtypeCriteria",e.EnableATSInGetLink="EnableATSInGetLink",e.ExtensionAuto="ExtensionAuto",e.ExtensionsEmbeddableInWeb="ExtensionsEmbeddableInWeb",e.ExtensionsThatSupportTransformationUsingATS="ExtensionsThatSupportTransformationUsingATS",e.RepresentativeSupportedDocSubType="RepresentativeSupportedDocSubType",e.SupportDocTypes="SupportDocTypes",e.SupportedDocSubTypesV2="SupportedDocSubTypesV2",e))(j4||{});var U4=Math.min;var H4=Math.max;var Q4=function(){try{var e=yE(Object,"defineProperty");return e({},"",{}),e}catch(Mg){}}(),V4=Q4?function(e,t){return Q4(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:dk,G4=Date.now;var W4=function(e){var t=0,n=0;return function(){var i=G4(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(V4);function q4(e){return function(e){return Mt(e)&&mC(e)}(e)?e:[]}var $4=function(e,t){return W4(function(e,t,n){return t=H4(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=H4(i.length-t,0),a=Array(o);++r<o;)a[r]=i[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=i[r];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,dk),e+"")}(function(e){var t=wt(e,q4);return t.length&&t[0]===e[0]?function(e,t,n){for(var i=n?gk:mk,r=e[0].length,o=e.length,a=o,s=Array(o),l=1/0,c=[];a--;){var u=e[a];a&&t&&(u=wt(u,tC(t))),l=U4(u.length,l),s[a]=!n&&(t||r>=120&&u.length>=120)?new TE(a&&u):void 0}u=e[0];var d=-1,h=s[0];e:for(;++d<r&&c.length<l;){var p=u[d],f=t?t(p):p;if(p=n||0!==p?p:0,!(h?IE(h,f):i(c,f,n))){for(a=o;--a;){var m=s[a];if(!(m?IE(m,f):i(e[a],f,n)))continue e}h&&h.push(f),c.push(p)}}return c}(t):[]});class X4{constructor(e,{availableDocTypes:t,baseUrl:n,defaultFolderId:i,defaultIsSeeThrough:r,defaultSearchText:o,defaultSelectedFacets:a,defaultSortDirection:s,defaultSortOrderName:l,token:c,useSession:u}){var d,h;z(this,v),z(this,y),z(this,b),z(this,A),this.availableFacets=[],this.facets=[],this.items=[],this.totalCount=0,this.lastRequest=null,this.sortOrders={},this.parameters=null,this.availableExtensions=null,this.userInfo=null,this.loading=!1,this.isLoggedIn=!0,this.pendingTokenRefresh=null,this.resolvePendingTokenRefresh=null,this.tokenRefreshTimeoutMs=15e3,F(this,v,null),F(this,y,null),F(this,b,null),F(this,A,!1),this.requestInterceptorId=null,this.responseInterceptorId=null,this._debouncePromise=null,this._debounceResolve=null,this.host=e,this.availableDocTypes=t,this.defaultFolderId=i,this.defaultIsSeeThrough=r,this.defaultSearchText=o,this.defaultSelectedFacets=a,this.defaultSortOrderName=l,this.defaultSortDirection=s,this.token=c,this.useSession=u,ca.defaults.baseURL=n,this.requestInterceptorId=ca.interceptors.request.use(e=>(e.url&&![da.GET_AVAILABLE_EXTENSIONS,da.GET_ASSET_VERSION_HISTORY,da.GET_CONTENT_V1,da.ADD_ASSET_TO_FAVORITE,da.REMOVE_ASSET_FROM_FAVORITE,da.GET_FAVORITE_ASSETS,da.GET_CONTENT_V3,da.GET_AVAILABLE_PROXIES,da.GET_ASSET_LINK,pa.GET_AVAILABLE_FACETS,pa.GET_CONTENT_BROWSER_PARAMETERS,pa.GET_SORT_ORDERS,ha.GET_USER_INFO,ua].includes(e.url)||(n&&(e.baseURL=n),e.params=B(R({},e.params),{Token:this.token||void 0,UseSession:this.useSession||void 0})),e)),this.responseInterceptorId=ca.interceptors.response.use(e=>(e.status>=200&&e.status<300&&!this.isLoggedIn&&(this.isLoggedIn=!0,this.host.requestUpdate()),e),e=>U(this,null,function*(){var t;const n=null==e?void 0:e.config;if(401===(null==(t=null==e?void 0:e.response)?void 0:t.status)&&n&&!n._retry){n._retry=!0;return(yield this.waitForNewToken())?ca.request(n):(this.isLoggedIn=!1,this.host.requestUpdate(),Promise.reject(e))}return Promise.reject(e)})),null==(h=(d=this.host).addController)||h.call(d,this)}waitForNewToken(){return this.pendingTokenRefresh||(this.pendingTokenRefresh=new Promise(e=>{this.resolvePendingTokenRefresh=e}),globalThis.dispatchEvent(new CustomEvent("cx-unauthorized")),setTimeout(()=>{this.resolvePendingTokenRefresh&&(this.resolvePendingTokenRefresh(null),this.pendingTokenRefresh=null,this.resolvePendingTokenRefresh=null)},this.tokenRefreshTimeoutMs)),this.pendingTokenRefresh}updateAuth(e,t){const n=this.token!==e,i=!this.isLoggedIn;this.token=e,this.useSession=t,n&&this.resolvePendingTokenRefresh&&(this.resolvePendingTokenRefresh(e||null),this.pendingTokenRefresh=null,this.resolvePendingTokenRefresh=null),n&&i&&e&&(this.isLoggedIn=!0,this.fetchInitialData(),this.lastRequest&&this.fetchAndMergeAssets(this.lastRequest),this.host.requestUpdate())}fetchInitialData(){(function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n,i,r;if(!e||"object"!=typeof e)throw new Error("Invalid response format");return(null==(t=e.avatar)?void 0:t.includes("://"))?e:B(R({},e),{avatar:`${null!=(i=null==(n=ca.defaults.baseURL)?void 0:n.replace(/\/$/,""))?i:""}/${null==(r=e.avatar)?void 0:r.replace(/^\//,"")}`})}],url:ha.GET_USER_INFO})).data}catch(e){return null}})})().then(e=>{this.userInfo=e,this.host.requestUpdate()}),function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>Array.isArray(null==e?void 0:e.facets)?e.facets:[]],url:pa.GET_AVAILABLE_FACETS})).data}catch(e){return[]}})}().then(e=>{this.availableFacets=e,this.host.requestUpdate()}),function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n,i,r,o,a,s,l;return{ATSEnabled:"true"===e[j4.EnableATSInGetLink].toLowerCase(),autoExtension:null!=(n=null==(t=e[j4.ExtensionAuto])?void 0:t.toLowerCase())?n:".auto",collectionPath:null!=(r=null==(i=e[j4.CollectionSubtypeCriteria])?void 0:i.toLowerCase())?r:"",supportedExtensions:null!=(a=null==(o=e[j4.ExtensionsThatSupportTransformationUsingATS])?void 0:o.split("\n"))?a:[],supportedRepresentativeSubtypes:null!=(l=null==(s=e[j4.RepresentativeSupportedDocSubType])?void 0:s.split("\r\n"))?l:[]}}],url:pa.GET_CONTENT_BROWSER_PARAMETERS})).data}catch(e){return{ATSEnabled:!1,autoExtension:".auto",collectionPath:"",supportedExtensions:[],supportedRepresentativeSubtypes:[]}}})}().then(e=>{this.parameters=e,this.host.requestUpdate()}),function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>e.extensions],url:da.GET_AVAILABLE_EXTENSIONS})).data}catch(e){return{}}})}().then(e=>{this.availableExtensions=e,this.host.requestUpdate()})}mapAvailableExtensions(e){return this.availableExtensions&&e&&0!==e.length?Object.entries(this.availableExtensions).reduce((t,[n,i])=>B(R({},t),{[n]:i.filter(t=>!e||0===e.length||e.some(e=>t.value.toLowerCase()===`.${e.toLowerCase()}`))}),this.availableExtensions):this.availableExtensions}fetchAssets(e){return U(this,null,function*(){return yield z4(e)})}fetchFolders(e){return U(this,null,function*(){return yield function(e){return U(this,arguments,function*({allowedFolders:e,baseUrl:t,bearerToken:n,excludeVirtualFolders:i,folderId:r,includeDirectChild:o,limit:a=50,searchTerm:s,self:l,start:c=0,token:u}){let d=[],h=null==o||o;e&&e.length>0&&!r?(d=e,l=!0,h=!1):r&&(d=[r]);try{return(yield ca.request({baseURL:t,headers:{Authorization:`Bearer ${n}`},method:"GET",params:{IncludeDirectChild:h,IncludeVirtualFolders:!i,Limit:a,ObjectRecordIDs:d,SeeThru:!!s,Self:l,Start:c,Text:s||void 0,Token:u||void 0},paramsSerializer:{indexes:null},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],(e,t,n)=>{var i,r,o,a;if(void 0!==n&&(n<200||n>=300))return{data:[],hasMore:!1,totalCount:0};if(!e||"object"!=typeof e)throw new Error("Invalid response format");const s=null!=(r=null==(i=e.contentItems)?void 0:i.length)?r:0;return{data:null!=(a=null==(o=e.contentItems)?void 0:o.map(e=>{var t,n,i,r;return{docType:null!=(t=e.fields[fa.DocType])?t:"",fullPath:null!=(n=e.fields[fa.CortexPath])?n:"",hasChildren:"1"===e.fields[fa.HasBrowserChildren],id:e.recordID,isShared:"DO_OR1ND000001913488"===e.fields[fa.rawDocSubtype],representativeAssetId:null!=(i=e.fields[fa.RepresentativeAssetId])?i:"",title:null!=(r=e.fields[fa.TitleWithFallback])?r:""}}))?a:[],hasMore:c+s<e.totalCount,totalCount:e.totalCount}}],url:ua})).data}catch(p){return{data:[],hasMore:!1,totalCount:0}}})}(e)})}mergeFacetsWithSelected(e,t,n={}){const i=e=>`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,r=new Map(t.map(e=>[i(e),B(R({},e),{values:e.values.filter(t=>{var i;return null==(i=n[e.facetDetails.facetFieldName])?void 0:i.includes(t.value)}).map(e=>B(R({},e),{count:0}))})]));return e.filter(e=>e.values.length>0).forEach(e=>{var t,n;const o=null!=(n=null==(t=r.get(i(e)))?void 0:t.values)?n:[],a=[...e.values,...o.filter(t=>!e.values.some(e=>e.value===t.value&&e.displayValue===t.displayValue))];r.set(i(e),B(R({},e),{values:a}))}),Array.from(r.values())}fetchAndMergeAssets(e){return U(this,null,function*(){this.loading=!0,this.host.requestUpdate(),null!==e.start&&(this._debounceTimeout&&(clearTimeout(this._debounceTimeout),this._debounceTimeout=void 0),null!=this._debouncePromise||(this._debouncePromise=new Promise(e=>{this._debounceResolve=e})),this._debounceTimeout=setTimeout(()=>U(this,null,function*(){var t,n,i,r,o;if(0===Object.keys(this.sortOrders).length){const e=yield function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>(Array.isArray(null==e?void 0:e.sortOrders)?e.sortOrders:[]).reduce((e,t)=>{var n,i,r;const o=(null==(n=null==t?void 0:t.sortDirectionGroupKey)?void 0:n.trim())||(null==(i=null==t?void 0:t.name)?void 0:i.trim());if(!o)return e;const a=o.toLowerCase();return e[a]=[...null!=(r=e[a])?r:[],t],e},{})],url:pa.GET_SORT_ORDERS})).data}catch(e){return{}}})}();this.sortOrders=e}const a=e.start===(null==(t=this.lastRequest)?void 0:t.start)&&!!e.pageSize&&!!(null==(n=this.lastRequest)?void 0:n.pageSize)&&e.pageSize>(null==(i=this.lastRequest)?void 0:i.pageSize);let s;N(this,A)||(e=B(R({},e),{folderId:this.defaultFolderId,isSeeThrough:this.defaultIsSeeThrough,searchText:this.defaultSearchText,selectedFacets:this.defaultSelectedFacets,sortDirection:this.defaultSortDirection,sortOrderName:this.defaultSortOrderName})),e.sortOrderName&&e.sortDirection&&(s=null==(o=null==(r=this.sortOrders[e.sortOrderName])?void 0:r.find(t=>{var n;return t.sortDirection.toLowerCase()===(null==(n=e.sortDirection)?void 0:n.toLowerCase())}))?void 0:o.id,!s&&this.sortOrders[e.sortOrderName][0]&&(s=this.sortOrders[e.sortOrderName][0].id,e.sortDirection=this.sortOrders[e.sortOrderName][0].sortDirection)),e=B(R({},e),{limitedToDocTypes:this.availableDocTypes}),this.lastRequest=e;const l=yield z4(B(R({},e),{sortOrder:s}));e.start&&e.start>0&&!a?this.items=yk([...this.items,...l.items],"recordId"):this.items=l.items,this.facets=this.mergeFacetsWithSelected(l.facets,this.facets,e.selectedFacets),this.totalCount=l.totalCount,this.loading=!1,F(this,A,!0),this.host.requestUpdate(),this._debounceResolve&&this._debounceResolve(this.lastRequest),this._debouncePromise=null,this._debounceResolve=null}),200))})}fetchAssetFavoriteStatus(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e}){try{return(yield ca.request({method:"GET",params:{RecordId:e},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],t=>!!t.favoriteRecordIds&&t.favoriteRecordIds.includes(e)],url:da.GET_FAVORITE_ASSETS})).data}catch(t){return!1}})}({assetRecordId:e})})}fetchAssetByID(e,t){return U(this,null,function*(){var n,i,r,o,a,s,l,c,u,d,h,p,f,m;const{allowedExtensions:g=[],canFavorite:v=!1}=null!=t?t:{},y=[N4({extraFields:[y4,A4,w4,x4,_4,E4,C4,S4,T4,k4,P4,R4,O4],recordIds:[e]}),F4({assetRecordId:e})];v?y.push(this.fetchAssetFavoriteStatus(e)):y.push(Promise.resolve(!1));const[b,A,w=!1]=yield Promise.all(y),x=null==b?void 0:b.items[0];if(!x)return;let _=x[w4];return _&&!_.startsWith(".")&&(_="."+_),{asset:{allowATSLink:"True"===x[b4],docSubType:null!=(n=x[P4])?n:"",docType:null!=(i=x[A4])?i:"",extension:_,height:null!=(r=x[C4])?r:"0",id:x.recordId,identifier:null!=(o=x[_4])?o:"",imageUrl:null!=(a=x[y4])?a:"",inColdStorage:Boolean(x.inColdStorage),name:null!=(s=x[R4])?s:"",originalUrl:null!=(l=x[O4])?l:"",previewUrl:null!=(c=null==A?void 0:A.previewUrl)?c:"",recordId:null!=(u=x[k4])?u:"",scrubUrl:null!=(d=x[I4])?d:"",size:null!=(h=x[x4])?h:"0 MB",tags:null!=(p=x[E4])?p:"",width:null!=(f=x[S4])?f:"0"},isFavorite:w,proxies:(null!=(m=null==A?void 0:A.proxies)?m:[]).filter(e=>{var t;if(!g||0===g.length)return!0;let n="";if(e.extension)n=e.extension.replace(".","");else{const i=null==(t=e.permanentLink)?void 0:t.split(".").at(-1);n=null!=i?i:""}return g.some(e=>!!n&&n.toLowerCase()===e.toLowerCase())})}})}fetchAssetVersionHistory(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e}){try{return(yield ca.request({method:"GET",params:{RecordId:e},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>({count:e.count,versions:e.versions.map(e=>({createByEmail:e.CreateByEmail,fileImportDate:e.FileImportDate,scrubUrl:e.ScrubUrl,versionCreateDate:e.VersionCreateDate,versionFileName:e.UpdatedFileName||e.VersionFileName,versionFileUrl:e.PreviewUrl,versionId:e.VersionID,versionNumber:Number(e.VersionNumber),versionNumberDisplay:e.VersionNumberDisplay}))})],url:da.GET_ASSET_VERSION_HISTORY})).data}catch(t){return{count:0,versions:[]}}})}({assetRecordId:e})})}addAssetToFavorite(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e,siteUrl:t}){try{return(yield ca.request({baseURL:t,data:{RecordId:e},method:"POST",responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>!!e.success],url:da.ADD_ASSET_TO_FAVORITE})).data}catch(n){return!1}})}({assetRecordId:e})})}removeAssetFromFavorite(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e,siteUrl:t}){try{return(yield ca.request({baseURL:t,data:{RecordId:e},method:"POST",responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>!!e.success],url:da.REMOVE_ASSET_FROM_FAVORITE})).data}catch(n){return!1}})}({assetRecordId:e})})}getAssetLink(e){return U(this,null,function*(){var t;const n=yield function(e){return U(this,arguments,function*({assets:e,extension:t,extraFields:n,parameters:i,permanentLink:r,proxyPreference:o,transformations:a,useSession:s}){const l={},c=1===e.length;let u=!1;try{const d=(yield Promise.allSettled(e.map(e=>ca.request({method:"GET",params:{ExtraFields:n,GenerateAssetUrl:!r,Parameters:i,Proxy:o,RecordId:e.recordId,UseSession:s||void 0},paramsSerializer:{indexes:null},transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],n=>{if((o=n)&&"object"==typeof o&&"ErrorCode"in o)return u=!0,c&&(l[n.ErrorCode]?l[n.ErrorCode].push(e):l[n.ErrorCode]=[e]),{imageUrl:e.imageUrl};var o;const d=r||n.imageUrl,[h,p]=d.split("?",2),f=new URLSearchParams(null!=p?p:"");let m=h;if(a&&a.length>0&&(m+="/t/"),null==a||a.forEach(({key:e,value:t})=>{if(e===fS.Resize){const e=[...[{key:"re_w_",value:t.width},{key:"re_h_",value:t.height}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))})),{key:"re_rm_",value:"stretch"}];e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}if(e===fS.Crop){const e=[...[{key:"c_w_",value:t.width},{key:"c_h_",value:t.height},{key:"c_x_",value:t.x},{key:"c_y_",value:t.y}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))})),{key:"c_whu_",value:"pixel"}];e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}if(e===fS.Rotate){const e=[{key:"r_a_",value:t.rotation}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))}));e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}if(e===fS.Quality){const e=[{key:"q_level_",value:t.quality}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))}));e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}e===fS.Metadata&&!0===t.keepMetadata&&(m+="fl_keep_metadata/")}),a&&a.length>0&&(m+=`${e.identifier}`),!r){const n=null!=t?t:e.extension,i=n.startsWith(".")?n:`.${n}`;m=m.replace(/\.[^./]+$/,"")+i}null==i||i.forEach(({key:e,value:t})=>{f.set(e.trim(),t.trim())}),s&&!f.has("UseSession")&&f.set("UseSession",s);const g=f.toString();return g&&(m+=`?${g}`),B(R({},n),{imageUrl:m})}],url:da.GET_ASSET_LINK})))).flatMap(e=>"fulfilled"===e.status?[e.value.data]:(u=!0,[]));return{data:d,isError:u}}catch(Mg){return{data:[],isError:!0}}})}(B(R({},e),{useSession:null!=(t=e.useSession)?t:this.useSession}));return e.useRepresentative?B(R({},n),{data:n.data.map((t,n)=>{var i,r;return B(R({},t),{imageUrl:null!=(r=null==(i=e.assets[n])?void 0:i.imageUrl)?r:t.imageUrl})})}):n})}getData(e){var t,n,i,r;const{allowedExtensions:o=[],availableRepresentativeSubtypes:a=[]}=null!=e?e:{};return UC(N(this,v),e)||(F(this,v,{allowedExtensions:o,availableRepresentativeSubtypes:a}),F(this,y,this.mapAvailableExtensions(o))),F(this,b,{availableExtensions:N(this,y),availableFacets:this.availableFacets,facets:this.facets,isLoggedIn:this.isLoggedIn,items:this.items,loading:this.loading,parameters:B(R({},this.parameters),{supportedRepresentativeSubtypes:(null==a?void 0:a.length)?$4(a,null!=(n=null==(t=this.parameters)?void 0:t.supportedRepresentativeSubtypes)?n:[]):null!=(r=null==(i=this.parameters)?void 0:i.supportedRepresentativeSubtypes)?r:[]}),request:this.lastRequest,sortOrders:this.sortOrders,totalCount:this.totalCount,userInfo:this.userInfo}),N(this,b)}hostConnected(){this.fetchInitialData()}hostDisconnected(){null!==this.requestInterceptorId&&(ca.interceptors.request.eject(this.requestInterceptorId),this.requestInterceptorId=null),null!==this.responseInterceptorId&&(ca.interceptors.response.eject(this.responseInterceptorId),this.responseInterceptorId=null),this.facets=[],this.items=[],this.totalCount=0,this.sortOrders={}}}function Y4(e){return Number.isNaN(e)||!Number.isInteger(e)?0:e}v=new WeakMap,y=new WeakMap,b=new WeakMap,A=new WeakMap;const K4=ie`
2283
+ `}};v4.styles=[ga,h4],v4.dependencies={"cx-avatar":ZC,"cx-divider":MS,"cx-dropdown":dT,"cx-icon":gh,"cx-icon-button":Ch,"cx-line-clamp":iv,"cx-menu":eT,"cx-menu-item":qS,"cx-skeleton":LO,"cx-space":gv,"cx-typography":cv},m4([dt({type:Boolean})],v4.prototype,"bordered",2),m4([dt({attribute:"application-name",type:String})],v4.prototype,"applicationName",2),m4([dt({type:Boolean})],v4.prototype,"loading",2),m4([dt({attribute:"is-fetching",type:Boolean})],v4.prototype,"isFetching",2),m4([dt({attribute:"avatar",type:String})],v4.prototype,"avatar",2),m4([dt({attribute:"full-name",type:String})],v4.prototype,"fullName",2),m4([dt({attribute:"folder-title",type:String})],v4.prototype,"folderTitle",2),m4([dt({attribute:"show-close-button",type:Boolean})],v4.prototype,"showCloseButton",2),m4([dt({attribute:"can-logout",type:Boolean})],v4.prototype,"canLogout",2),v4=m4([Us("cx-content-browser-header")],v4);const y4="CoreField.LargeSizePreview",b4="AllowATSLink",A4="CoreField.DocType",w4="Document.FileExtension",x4="CoreField.FileSize",_4="CoreField.Identifier",E4="CoreField.Keywords",C4="CoreField.MaxHeight",S4="CoreField.MaxWidth",T4="CoreField.OriginalFileName",k4="Document.RecordID",I4="ScrubURL",M4="CoreField.S6_StorageGroup",P4="CoreField.DocSubType",R4="CoreField.TitleWithFallback",B4="CoreField.UpdatedFileName",O4="CoreField.OriginalPreview";function D4(e){return e&&0!==Object.keys(e).length?Object.entries(e).reduce((e,[t,n])=>n&&0!==n.length?B(R({},e),"Types"===t?{SubtypeCriteria:n}:{FacetFilters:B(R({},e.FacetFilters),{[t]:n})}):e,{}):{}}function L4(){const e=globalThis.crypto;if(null==e?void 0:e.randomUUID)return e.randomUUID();if(null==e?void 0:e.getRandomValues){const t=e.getRandomValues(new Uint8Array(16));t[6]=15&t[6]|64,t[8]=63&t[8]|128;const n=Array.from(t,e=>e.toString(16).padStart(2,"0"));return[n.slice(0,4).join(""),n.slice(4,6).join(""),n.slice(6,8).join(""),n.slice(8,10).join(""),n.slice(10).join("")].join("-")}return`${Date.now()}-${Math.random().toString(36).slice(2)}`}function N4(e){return U(this,arguments,function*({extraFields:e,recordIds:t}){var n;if(!Array.isArray(t)||0===t.length)return{facets:[],items:[],totalCount:0};const i=null!=(n=null==e?void 0:e.filter(e=>e&&"string"==typeof e))?n:[];try{return(yield ca.request({method:"GET",params:{ExtraFilters:`RecordID:${t.join(" OR ")}`,Fields:[...i,O4,B4,T4,"Document.Title","Document.CaptionLong"],SeeThru:!0},paramsSerializer:{indexes:null},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var n,r;const o=null!=(r=null==(n=e.contentItems)?void 0:n.map(e=>{var t,n,r;let o=null!=(t=e.fields[B4])?t:"";return""===o&&(o=null!=(n=e.fields[T4])?n:""),R({name:o,originalUrl:null!=(r=e.fields[O4])?r:"",recordId:e.recordID},i.reduce((t,n)=>{var i;return t[n]=null!=(i=e.fields[n])?i:"",t},{}))}))?r:[];return o.sort((e,n)=>t.indexOf(e.recordId)-t.indexOf(n.recordId)),{facets:e.facets,items:o,totalCount:e.totalCount}}],url:da.GET_CONTENT_V1})).data}catch(r){return{facets:[],items:[],totalCount:0}}})}function z4(e){return U(this,arguments,function*({folderId:e,isSeeThrough:t,limitedToDocTypes:n=[],pageSize:i,searchText:r,selectedFacets:o,sortOrder:a,start:s,useSession:l}){try{return(yield ca.request({data:R({Fields:[y4,A4,w4,x4,_4,E4,C4,S4,T4,k4,P4,R4,B4,M4,O4],Limit:i||void 0,LimitedToDocTypes:n,ObjectRecordID:e||void 0,OrderBy:a,SeeThru:t||void 0,SelectedFacets:o,Start:s,Text:r||void 0,UseSession:l||void 0},D4(o)),method:"POST",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n;const i=null!=(n=null==(t=e.contentItems)?void 0:t.map(e=>{var t,n,i,r,o,a,s,l,c,u,d,h;let p=null!=(t=e.fields[w4])?t:"";const f=e.fields[R4];return p&&!p.startsWith(".")&&(p="."+p),{allowATSLink:"True"===e.fields[b4],docSubType:null!=(n=e.fields[P4])?n:"",docType:null!=(i=e.fields[A4])?i:"",extension:p,height:null!=(r=e.fields[C4])?r:"0",id:e.recordID,identifier:null!=(o=e.fields[_4])?o:"",imageUrl:null!=(a=e.fields[y4])?a:"",inColdStorage:"Cold Storage"===e.fields[M4],name:null!=f?f:"",originalUrl:null!=(s=e.fields[O4])?s:"",recordId:null!=(l=e.fields[k4])?l:"",scrubUrl:null!=(c=e.fields[I4])?c:"",size:null!=(u=e.fields[x4])?u:"0 MB",tags:null!=(d=e.fields[E4])?d:"",width:null!=(h=e.fields[S4])?h:"0"}}))?n:[];return{facets:e.facets,items:i,totalCount:e.totalCount}}],url:da.GET_CONTENT_V3})).data}catch(c){return{facets:[],items:[],totalCount:0}}})}function F4(e){return U(this,arguments,function*({assetRecordId:e,siteUrl:t}){try{return(yield ca.request({baseURL:t,method:"GET",params:{RecordId:e},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n,i;return e&&"object"==typeof e?{previewUrl:null!=(t=e.previewUrl)?t:"",proxies:null!=(i=null==(n=e.proxies)?void 0:n.map(e=>({cdnName:e.cdnName,extension:e.extension,formatHeight:e.formatHeight,formatWidth:e.formatWidth,height:e.height,id:L4(),permanentLink:e.permanentLink,proxyLabel:e.proxyLabel,proxyName:e.proxyName,width:e.width})))?i:[]}:{previewUrl:"",proxies:[]}}],url:da.GET_AVAILABLE_PROXIES})).data}catch(n){return{previewUrl:"",proxies:[]}}})}var j4=(e=>(e.CollectionSubtypeCriteria="CollectionSubtypeCriteria",e.EnableATSInGetLink="EnableATSInGetLink",e.ExtensionAuto="ExtensionAuto",e.ExtensionsEmbeddableInWeb="ExtensionsEmbeddableInWeb",e.ExtensionsThatSupportTransformationUsingATS="ExtensionsThatSupportTransformationUsingATS",e.RepresentativeSupportedDocSubType="RepresentativeSupportedDocSubType",e.SupportDocTypes="SupportDocTypes",e.SupportedDocSubTypesV2="SupportedDocSubTypesV2",e))(j4||{});var U4=Math.min;var H4=Math.max;var Q4=function(){try{var e=yE(Object,"defineProperty");return e({},"",{}),e}catch(Mg){}}(),V4=Q4?function(e,t){return Q4(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:dk,G4=Date.now;var W4=function(e){var t=0,n=0;return function(){var i=G4(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(V4);function q4(e){return function(e){return Mt(e)&&mC(e)}(e)?e:[]}var $4=function(e,t){return W4(function(e,t,n){return t=H4(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=H4(i.length-t,0),a=Array(o);++r<o;)a[r]=i[t+r];r=-1;for(var s=Array(t+1);++r<t;)s[r]=i[r];return s[t]=n(a),function(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}(e,this,s)}}(e,t,dk),e+"")}(function(e){var t=wt(e,q4);return t.length&&t[0]===e[0]?function(e,t,n){for(var i=n?gk:mk,r=e[0].length,o=e.length,a=o,s=Array(o),l=1/0,c=[];a--;){var u=e[a];a&&t&&(u=wt(u,tC(t))),l=U4(u.length,l),s[a]=!n&&(t||r>=120&&u.length>=120)?new TE(a&&u):void 0}u=e[0];var d=-1,h=s[0];e:for(;++d<r&&c.length<l;){var p=u[d],f=t?t(p):p;if(p=n||0!==p?p:0,!(h?IE(h,f):i(c,f,n))){for(a=o;--a;){var m=s[a];if(!(m?IE(m,f):i(e[a],f,n)))continue e}h&&h.push(f),c.push(p)}}return c}(t):[]});class X4{constructor(e,{availableDocTypes:t,baseUrl:n,defaultFolderId:i,defaultIsSeeThrough:r,defaultSearchText:o,defaultSelectedFacets:a,defaultSortDirection:s,defaultSortOrderName:l,token:c,useSession:u}){var d,h;z(this,v),z(this,y),z(this,b),z(this,A),this.availableFacets=[],this.facets=[],this.items=[],this.totalCount=0,this.lastRequest=null,this.sortOrders={},this.parameters=null,this.availableExtensions=null,this.userInfo=null,this.loading=!1,this.isLoggedIn=!0,this.pendingTokenRefresh=null,this.resolvePendingTokenRefresh=null,this.tokenRefreshTimeoutMs=15e3,F(this,v,null),F(this,y,null),F(this,b,null),F(this,A,!1),this.requestInterceptorId=null,this.responseInterceptorId=null,this._debouncePromise=null,this._debounceResolve=null,this.host=e,this.availableDocTypes=t,this.defaultFolderId=i,this.defaultIsSeeThrough=r,this.defaultSearchText=o,this.defaultSelectedFacets=a,this.defaultSortOrderName=l,this.defaultSortDirection=s,this.token=c,this.useSession=u,ca.defaults.baseURL=n,this.requestInterceptorId=ca.interceptors.request.use(e=>(e.url&&![da.GET_AVAILABLE_EXTENSIONS,da.GET_ASSET_VERSION_HISTORY,da.GET_CONTENT_V1,da.ADD_ASSET_TO_FAVORITE,da.REMOVE_ASSET_FROM_FAVORITE,da.GET_FAVORITE_ASSETS,da.GET_CONTENT_V3,da.GET_AVAILABLE_PROXIES,da.GET_ASSET_LINK,pa.GET_AVAILABLE_FACETS,pa.GET_CONTENT_BROWSER_PARAMETERS,pa.GET_SORT_ORDERS,ha.GET_USER_INFO,ua].includes(e.url)||(n&&(e.baseURL=n),e.params=B(R({},e.params),{Token:this.token||void 0,UseSession:this.useSession||void 0})),e)),this.responseInterceptorId=ca.interceptors.response.use(e=>(e.status>=200&&e.status<300&&!this.isLoggedIn&&(this.isLoggedIn=!0,this.host.requestUpdate()),e),e=>U(this,null,function*(){var t;const n=null==e?void 0:e.config;if(401===(null==(t=null==e?void 0:e.response)?void 0:t.status)&&n&&!n._retry){n._retry=!0;return(yield this.waitForNewToken())?ca.request(n):(this.isLoggedIn=!1,this.host.requestUpdate(),Promise.reject(e))}return Promise.reject(e)})),null==(h=(d=this.host).addController)||h.call(d,this)}waitForNewToken(){return this.pendingTokenRefresh||(this.pendingTokenRefresh=new Promise(e=>{this.resolvePendingTokenRefresh=e}),globalThis.dispatchEvent(new CustomEvent("cx-unauthorized")),setTimeout(()=>{this.resolvePendingTokenRefresh&&(this.resolvePendingTokenRefresh(null),this.pendingTokenRefresh=null,this.resolvePendingTokenRefresh=null)},this.tokenRefreshTimeoutMs)),this.pendingTokenRefresh}updateAuth(e,t){const n=this.token!==e,i=!this.isLoggedIn;this.token=e,this.useSession=t,n&&this.resolvePendingTokenRefresh&&(this.resolvePendingTokenRefresh(e||null),this.pendingTokenRefresh=null,this.resolvePendingTokenRefresh=null),n&&i&&e&&(this.isLoggedIn=!0,this.fetchInitialData(),this.lastRequest&&this.fetchAndMergeAssets(this.lastRequest),this.host.requestUpdate())}fetchInitialData(){(function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n,i,r;if(!e||"object"!=typeof e)throw new Error("Invalid response format");return(null==(t=e.avatar)?void 0:t.includes("://"))?e:B(R({},e),{avatar:`${null!=(i=null==(n=ca.defaults.baseURL)?void 0:n.replace(/\/$/,""))?i:""}/${null==(r=e.avatar)?void 0:r.replace(/^\//,"")}`})}],url:ha.GET_USER_INFO})).data}catch(e){return null}})})().then(e=>{this.userInfo=e,this.host.requestUpdate()}),function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>Array.isArray(null==e?void 0:e.facets)?e.facets:[]],url:pa.GET_AVAILABLE_FACETS})).data}catch(e){return[]}})}().then(e=>{this.availableFacets=e,this.host.requestUpdate()}),function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>{var t,n,i,r,o,a,s,l;return{ATSEnabled:"true"===e[j4.EnableATSInGetLink].toLowerCase(),autoExtension:null!=(n=null==(t=e[j4.ExtensionAuto])?void 0:t.toLowerCase())?n:".auto",collectionPath:null!=(r=null==(i=e[j4.CollectionSubtypeCriteria])?void 0:i.toLowerCase())?r:"",supportedExtensions:null!=(a=null==(o=e[j4.ExtensionsThatSupportTransformationUsingATS])?void 0:o.split("\n"))?a:[],supportedRepresentativeSubtypes:null!=(l=null==(s=e[j4.RepresentativeSupportedDocSubType])?void 0:s.split("\r\n"))?l:[]}}],url:pa.GET_CONTENT_BROWSER_PARAMETERS})).data}catch(e){return{ATSEnabled:!1,autoExtension:".auto",collectionPath:"",supportedExtensions:[],supportedRepresentativeSubtypes:[]}}})}().then(e=>{this.parameters=e,this.host.requestUpdate()}),function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>e.extensions],url:da.GET_AVAILABLE_EXTENSIONS})).data}catch(e){return{}}})}().then(e=>{this.availableExtensions=e,this.host.requestUpdate()})}mapAvailableExtensions(e){return this.availableExtensions&&e&&0!==e.length?Object.entries(this.availableExtensions).reduce((t,[n,i])=>B(R({},t),{[n]:i.filter(t=>!e||0===e.length||e.some(e=>t.value.toLowerCase()===`.${e.toLowerCase()}`))}),this.availableExtensions):this.availableExtensions}fetchAssets(e){return U(this,null,function*(){return yield z4(e)})}fetchFolders(e){return U(this,null,function*(){return yield function(e){return U(this,arguments,function*({allowedFolders:e,baseUrl:t,bearerToken:n,excludeVirtualFolders:i,folderId:r,includeDirectChild:o,limit:a=50,searchTerm:s,self:l,start:c=0,token:u}){let d=[],h=null==o||o;e&&e.length>0&&!r?(d=e,l=!0,h=!1):r&&(d=[r]);try{return(yield ca.request({baseURL:t,headers:{Authorization:`Bearer ${n}`},method:"GET",params:{IncludeDirectChild:h,IncludeVirtualFolders:!i,Limit:a,ObjectRecordIDs:d,SeeThru:!!s,Self:l,Start:c,Text:s||void 0,Token:u||void 0},paramsSerializer:{indexes:null},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],(e,t,n)=>{var i,r,o,a;if(void 0!==n&&(n<200||n>=300))return{data:[],hasMore:!1,totalCount:0};if(!e||"object"!=typeof e)throw new Error("Invalid response format");const s=null!=(r=null==(i=e.contentItems)?void 0:i.length)?r:0;return{data:null!=(a=null==(o=e.contentItems)?void 0:o.map(e=>{var t,n,i,r;return{docType:null!=(t=e.fields[fa.DocType])?t:"",fullPath:null!=(n=e.fields[fa.CortexPath])?n:"",hasChildren:"1"===e.fields[fa.HasBrowserChildren],id:e.recordID,isShared:"DO_OR1ND000001913488"===e.fields[fa.rawDocSubtype],representativeAssetId:null!=(i=e.fields[fa.RepresentativeAssetId])?i:"",title:null!=(r=e.fields[fa.TitleWithFallback])?r:""}}))?a:[],hasMore:c+s<e.totalCount,totalCount:e.totalCount}}],url:ua})).data}catch(p){return{data:[],hasMore:!1,totalCount:0}}})}(e)})}mergeFacetsWithSelected(e,t,n={}){const i=e=>`${e.facetDetails.facetFieldName}|${e.facetDetails.displayName}`,r=new Map(t.map(e=>[i(e),B(R({},e),{values:e.values.filter(t=>{var i;return null==(i=n[e.facetDetails.facetFieldName])?void 0:i.includes(t.value)}).map(e=>B(R({},e),{count:0}))})]));return e.filter(e=>e.values.length>0).forEach(e=>{var t,n;const o=null!=(n=null==(t=r.get(i(e)))?void 0:t.values)?n:[],a=[...e.values,...o.filter(t=>!e.values.some(e=>e.value===t.value&&e.displayValue===t.displayValue))];r.set(i(e),B(R({},e),{values:a}))}),Array.from(r.values())}fetchAndMergeAssets(e){return U(this,null,function*(){this.loading=!0,this.host.requestUpdate(),null!==e.start&&(this._debounceTimeout&&(clearTimeout(this._debounceTimeout),this._debounceTimeout=void 0),null!=this._debouncePromise||(this._debouncePromise=new Promise(e=>{this._debounceResolve=e})),this._debounceTimeout=setTimeout(()=>U(this,null,function*(){var t,n,i,r,o;if(0===Object.keys(this.sortOrders).length){const e=yield function(){return U(this,null,function*(){try{return(yield ca.request({method:"GET",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>(Array.isArray(null==e?void 0:e.sortOrders)?e.sortOrders:[]).reduce((e,t)=>{var n,i,r;const o=(null==(n=null==t?void 0:t.sortDirectionGroupKey)?void 0:n.trim())||(null==(i=null==t?void 0:t.name)?void 0:i.trim());if(!o)return e;const a=o.toLowerCase();return e[a]=[...null!=(r=e[a])?r:[],t],e},{})],url:pa.GET_SORT_ORDERS})).data}catch(e){return{}}})}();this.sortOrders=e}const a=e.start===(null==(t=this.lastRequest)?void 0:t.start)&&!!e.pageSize&&!!(null==(n=this.lastRequest)?void 0:n.pageSize)&&e.pageSize>(null==(i=this.lastRequest)?void 0:i.pageSize);let s;N(this,A)||(e=B(R({},e),{folderId:this.defaultFolderId,isSeeThrough:this.defaultIsSeeThrough,searchText:this.defaultSearchText,selectedFacets:this.defaultSelectedFacets,sortDirection:this.defaultSortDirection,sortOrderName:this.defaultSortOrderName})),e.sortOrderName&&e.sortDirection&&(s=null==(o=null==(r=this.sortOrders[e.sortOrderName])?void 0:r.find(t=>{var n;return t.sortDirection.toLowerCase()===(null==(n=e.sortDirection)?void 0:n.toLowerCase())}))?void 0:o.id,!s&&this.sortOrders[e.sortOrderName][0]&&(s=this.sortOrders[e.sortOrderName][0].id,e.sortDirection=this.sortOrders[e.sortOrderName][0].sortDirection)),e=B(R({},e),{limitedToDocTypes:this.availableDocTypes}),this.lastRequest=e;const l=yield z4(B(R({},e),{sortOrder:s}));e.start&&e.start>0&&!a?this.items=yk([...this.items,...l.items],"recordId"):this.items=l.items,this.facets=this.mergeFacetsWithSelected(l.facets,this.facets,e.selectedFacets),this.totalCount=l.totalCount,this.loading=!1,F(this,A,!0),this.host.requestUpdate(),this._debounceResolve&&this._debounceResolve(this.lastRequest),this._debouncePromise=null,this._debounceResolve=null}),200))})}fetchAssetFavoriteStatus(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e}){try{return(yield ca.request({method:"GET",params:{RecordId:e},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],t=>!!t.favoriteRecordIds&&t.favoriteRecordIds.includes(e)],url:da.GET_FAVORITE_ASSETS})).data}catch(t){return!1}})}({assetRecordId:e})})}fetchAssetByID(e,t){return U(this,null,function*(){var n,i,r,o,a,s,l,c,u,d,h,p,f,m;const{allowedExtensions:g=[],canFavorite:v=!1}=null!=t?t:{},y=[N4({extraFields:[y4,A4,w4,x4,_4,E4,C4,S4,T4,k4,P4,R4,O4],recordIds:[e]}),F4({assetRecordId:e})];v?y.push(this.fetchAssetFavoriteStatus(e)):y.push(Promise.resolve(!1));const[b,A,w=!1]=yield Promise.all(y),x=null==b?void 0:b.items[0];if(!x)return;let _=x[w4];return _&&!_.startsWith(".")&&(_="."+_),{asset:{allowATSLink:"True"===x[b4],docSubType:null!=(n=x[P4])?n:"",docType:null!=(i=x[A4])?i:"",extension:_,height:null!=(r=x[C4])?r:"0",id:x.recordId,identifier:null!=(o=x[_4])?o:"",imageUrl:null!=(a=x[y4])?a:"",inColdStorage:Boolean(x.inColdStorage),name:null!=(s=x[R4])?s:"",originalUrl:null!=(l=x[O4])?l:"",previewUrl:null!=(c=null==A?void 0:A.previewUrl)?c:"",recordId:null!=(u=x[k4])?u:"",scrubUrl:null!=(d=x[I4])?d:"",size:null!=(h=x[x4])?h:"0 MB",tags:null!=(p=x[E4])?p:"",width:null!=(f=x[S4])?f:"0"},isFavorite:w,proxies:(null!=(m=null==A?void 0:A.proxies)?m:[]).filter(e=>{var t;if(!g||0===g.length)return!0;let n="";if(e.extension)n=e.extension.replace(".","");else{const i=null==(t=e.permanentLink)?void 0:t.split(".").at(-1);n=null!=i?i:""}return g.some(e=>!!n&&n.toLowerCase()===e.toLowerCase())})}})}fetchAssetVersionHistory(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e}){try{return(yield ca.request({method:"GET",params:{RecordId:e},responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>({count:e.count,versions:e.versions.map(e=>({createByEmail:e.CreateByEmail,fileImportDate:e.FileImportDate,scrubUrl:e.ScrubUrl,versionCreateDate:e.VersionCreateDate,versionFileName:e.UpdatedFileName||e.VersionFileName,versionFileUrl:e.PreviewUrl,versionId:e.VersionID,versionNumber:Number(e.VersionNumber),versionNumberDisplay:e.VersionNumberDisplay}))})],url:da.GET_ASSET_VERSION_HISTORY})).data}catch(t){return{count:0,versions:[]}}})}({assetRecordId:e})})}addAssetToFavorite(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e,siteUrl:t}){try{return(yield ca.request({baseURL:t,data:{RecordId:e},method:"POST",responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>!!e.success],url:da.ADD_ASSET_TO_FAVORITE})).data}catch(n){return!1}})}({assetRecordId:e})})}removeAssetFromFavorite(e){return U(this,null,function*(){return function(e){return U(this,arguments,function*({assetRecordId:e,siteUrl:t}){try{return(yield ca.request({baseURL:t,data:{RecordId:e},method:"POST",responseType:"json",transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],e=>!!e.success],url:da.REMOVE_ASSET_FROM_FAVORITE})).data}catch(n){return!1}})}({assetRecordId:e})})}getAssetLink(e){return U(this,null,function*(){var t;const n=yield function(e){return U(this,arguments,function*({assets:e,extension:t,extraFields:n,parameters:i,permanentLink:r,proxyPreference:o,transformations:a,useSession:s}){const l={},c=1===e.length;let u=!1;try{const d=(yield Promise.allSettled(e.map(e=>ca.request({method:"GET",params:{ExtraFields:n,GenerateAssetUrl:!r,Parameters:i,Proxy:o,RecordId:e.recordId,UseSession:s||void 0},paramsSerializer:{indexes:null},transformResponse:[...Array.isArray(ca.defaults.transformResponse)?ca.defaults.transformResponse:[],n=>{if((o=n)&&"object"==typeof o&&"ErrorCode"in o)return u=!0,c&&(l[n.ErrorCode]?l[n.ErrorCode].push(e):l[n.ErrorCode]=[e]),{imageUrl:e.imageUrl};var o;const d=r||n.imageUrl,[h,p]=d.split("?",2),f=new URLSearchParams(null!=p?p:"");let m=h;if(a&&a.length>0&&(m+="/t/"),null==a||a.forEach(({key:e,value:t})=>{if(e===fS.Resize){const e=[...[{key:"re_w_",value:t.width},{key:"re_h_",value:t.height}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))})),{key:"re_rm_",value:"stretch"}];e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}if(e===fS.Crop){const e=[...[{key:"c_w_",value:t.width},{key:"c_h_",value:t.height},{key:"c_x_",value:t.x},{key:"c_y_",value:t.y}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))})),{key:"c_whu_",value:"pixel"}];e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}if(e===fS.Rotate){const e=[{key:"r_a_",value:t.rotation}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))}));e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}if(e===fS.Quality){const e=[{key:"q_level_",value:t.quality}].filter(e=>void 0!==e.value).map(e=>({key:e.key,value:Math.round(Number(e.value))}));e.forEach(({key:t,value:n},i)=>{m+=`${t}${n}${i<e.length-1?",":""}`}),m+="/"}e===fS.Metadata&&!0===t.keepMetadata&&(m+="fl_keep_metadata/")}),a&&a.length>0&&(m+=`${e.identifier}`),!r){const n=null!=t?t:e.extension,i=n.startsWith(".")?n:`.${n}`;m=m.replace(/\.[^./]+$/,"")+i}null==i||i.forEach(({key:e,value:t})=>{f.set(e.trim(),t.trim())}),s&&!f.has("UseSession")&&f.set("UseSession",s);const g=f.toString();return g&&(m+=`?${g}`),B(R({},n),{imageUrl:m})}],url:da.GET_ASSET_LINK})))).flatMap(e=>"fulfilled"===e.status?[e.value.data]:(u=!0,[]));return{data:d,isError:u}}catch(Mg){return{data:[],isError:!0}}})}(B(R({},e),{useSession:null!=(t=e.useSession)?t:this.useSession}));return e.useRepresentative?B(R({},n),{data:n.data.map((t,n)=>{var i,r;return B(R({},t),{imageUrl:null!=(r=null==(i=e.assets[n])?void 0:i.imageUrl)?r:t.imageUrl})})}):n})}getData(e){var t,n;const{allowedExtensions:i=[],availableRepresentativeSubtypes:r=[]}=null!=e?e:{};return UC(N(this,v),e)||(F(this,v,{allowedExtensions:i,availableRepresentativeSubtypes:r}),F(this,y,this.mapAvailableExtensions(i))),F(this,b,{availableExtensions:N(this,y),availableFacets:this.availableFacets,facets:this.facets,isLoggedIn:this.isLoggedIn,items:this.items,loading:this.loading,parameters:this.parameters?B(R({},this.parameters),{supportedRepresentativeSubtypes:(null==r?void 0:r.length)?$4(r,null!=(t=this.parameters.supportedRepresentativeSubtypes)?t:[]):null!=(n=this.parameters.supportedRepresentativeSubtypes)?n:[]}):null,request:this.lastRequest,sortOrders:this.sortOrders,totalCount:this.totalCount,userInfo:this.userInfo}),N(this,b)}hostConnected(){this.fetchInitialData()}hostDisconnected(){null!==this.requestInterceptorId&&(ca.interceptors.request.eject(this.requestInterceptorId),this.requestInterceptorId=null),null!==this.responseInterceptorId&&(ca.interceptors.response.eject(this.responseInterceptorId),this.responseInterceptorId=null),this.facets=[],this.items=[],this.totalCount=0,this.sortOrders={}}}function Y4(e){return Number.isNaN(e)||!Number.isInteger(e)?0:e}v=new WeakMap,y=new WeakMap,b=new WeakMap,A=new WeakMap;const K4=ie`
2284
2284
  :host {
2285
2285
  --cx-button-text-transform: none;
2286
2286
  --default-representative-background-color: #6cdaf3;
@@ -9221,6 +9221,9 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9221
9221
  this.confirmedTransformations = this.assetLinkFormat.transformations;
9222
9222
  this.confirmedFormat = this.assetLinkFormat.selectedFormat;
9223
9223
  this.assetLinkFormat.setActiveSetting("");
9224
+ if (this.assetLinkFormat.selectedProxy) {
9225
+ this.lastProxyBeforeCustomFormat = this.assetLinkFormat.selectedProxy;
9226
+ }
9224
9227
  this.showCustomFormat = false;
9225
9228
  }
9226
9229
  handleFavorite() {
@@ -14010,7 +14013,7 @@ class FetchAndMergeAssetsController {
14010
14013
  });
14011
14014
  }
14012
14015
  getData(options) {
14013
- var _a2, _b2, _c2, _d2;
14016
+ var _a2, _b2;
14014
14017
  const {
14015
14018
  allowedExtensions = [],
14016
14019
  availableRepresentativeSubtypes = []
@@ -14029,12 +14032,19 @@ class FetchAndMergeAssetsController {
14029
14032
  isLoggedIn: this.isLoggedIn,
14030
14033
  items: this.items,
14031
14034
  loading: this.loading,
14032
- parameters: __spreadProps(__spreadValues({}, this.parameters), {
14035
+ /**
14036
+ * Keep `null` when apiGetContentBrowserParameters() hasn't resolved yet instead of
14037
+ * spreading `{...null}` into an empty-but-truthy object — consumers (e.g.
14038
+ * content-browser-format-dialog's can-custom-format) need to tell "not loaded yet" apart
14039
+ * from "loaded, ATSEnabled is false". The fetch already calls host.requestUpdate() once it
14040
+ * resolves, so this naturally re-renders with the real value once it's ready.
14041
+ */
14042
+ parameters: this.parameters ? __spreadProps(__spreadValues({}, this.parameters), {
14033
14043
  supportedRepresentativeSubtypes: (availableRepresentativeSubtypes == null ? void 0 : availableRepresentativeSubtypes.length) ? intersection(
14034
14044
  availableRepresentativeSubtypes,
14035
- (_b2 = (_a2 = this.parameters) == null ? void 0 : _a2.supportedRepresentativeSubtypes) != null ? _b2 : []
14036
- ) : (_d2 = (_c2 = this.parameters) == null ? void 0 : _c2.supportedRepresentativeSubtypes) != null ? _d2 : []
14037
- }),
14045
+ (_a2 = this.parameters.supportedRepresentativeSubtypes) != null ? _a2 : []
14046
+ ) : (_b2 = this.parameters.supportedRepresentativeSubtypes) != null ? _b2 : []
14047
+ }) : null,
14038
14048
  request: this.lastRequest,
14039
14049
  sortOrders: this.sortOrders,
14040
14050
  totalCount: this.totalCount,
package/build/index.mjs CHANGED
@@ -9287,6 +9287,9 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9287
9287
  this.confirmedTransformations = this.assetLinkFormat.transformations;
9288
9288
  this.confirmedFormat = this.assetLinkFormat.selectedFormat;
9289
9289
  this.assetLinkFormat.setActiveSetting("");
9290
+ if (this.assetLinkFormat.selectedProxy) {
9291
+ this.lastProxyBeforeCustomFormat = this.assetLinkFormat.selectedProxy;
9292
+ }
9290
9293
  this.showCustomFormat = false;
9291
9294
  }
9292
9295
  handleFavorite() {
@@ -14076,7 +14079,7 @@ class FetchAndMergeAssetsController {
14076
14079
  });
14077
14080
  }
14078
14081
  getData(options) {
14079
- var _a2, _b2, _c2, _d2;
14082
+ var _a2, _b2;
14080
14083
  const {
14081
14084
  allowedExtensions = [],
14082
14085
  availableRepresentativeSubtypes = []
@@ -14095,12 +14098,19 @@ class FetchAndMergeAssetsController {
14095
14098
  isLoggedIn: this.isLoggedIn,
14096
14099
  items: this.items,
14097
14100
  loading: this.loading,
14098
- parameters: __spreadProps(__spreadValues({}, this.parameters), {
14101
+ /**
14102
+ * Keep `null` when apiGetContentBrowserParameters() hasn't resolved yet instead of
14103
+ * spreading `{...null}` into an empty-but-truthy object — consumers (e.g.
14104
+ * content-browser-format-dialog's can-custom-format) need to tell "not loaded yet" apart
14105
+ * from "loaded, ATSEnabled is false". The fetch already calls host.requestUpdate() once it
14106
+ * resolves, so this naturally re-renders with the real value once it's ready.
14107
+ */
14108
+ parameters: this.parameters ? __spreadProps(__spreadValues({}, this.parameters), {
14099
14109
  supportedRepresentativeSubtypes: (availableRepresentativeSubtypes == null ? void 0 : availableRepresentativeSubtypes.length) ? intersection(
14100
14110
  availableRepresentativeSubtypes,
14101
- (_b2 = (_a2 = this.parameters) == null ? void 0 : _a2.supportedRepresentativeSubtypes) != null ? _b2 : []
14102
- ) : (_d2 = (_c2 = this.parameters) == null ? void 0 : _c2.supportedRepresentativeSubtypes) != null ? _d2 : []
14103
- }),
14111
+ (_a2 = this.parameters.supportedRepresentativeSubtypes) != null ? _a2 : []
14112
+ ) : (_b2 = this.parameters.supportedRepresentativeSubtypes) != null ? _b2 : []
14113
+ }) : null,
14104
14114
  request: this.lastRequest,
14105
14115
  sortOrders: this.sortOrders,
14106
14116
  totalCount: this.totalCount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangelogic/orange-dam-content-browser-sdk",
3
- "version": "2.2.3-41YQXP-beta-10",
3
+ "version": "2.2.3-41YQXP-beta-11",
4
4
  "description": "OrangeDAM Content Browser SDK source code",
5
5
  "main": "./build/OrangeDAMContentBrowserSDK.min.js",
6
6
  "module": "./build/index.mjs",