@orangelogic/orange-dam-content-browser-sdk 2.3.3 → 2.3.4

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 L2=Object.defineProperty,N2=Object.getOwnPropertyDescriptor,z2=(e,t,n,i)=>{for(var r,o=i>1?void 0:i?N2(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&&L2(t,n,o),o};const F2=[{key:"UTM_source",value:""},{key:"UTM_campaign",value:""},{key:"UTM_description",value:""}],j2=[{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"}],U2=[{label:"Manual focus",value:"manual"},{label:"Center focus",value:"center"}];let H2=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=gS.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=F2}get shouldAppendAutoExtension(){return!!this.autoExtension&&this.supportedExtensions.includes(this.autoExtension)}get canUseATS(){if(!this.asset)return!1;const e=(this.availableExtensions&&this.asset.docType?bk([...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===g2}}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===v2){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!==g2)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===v2)return this.lastProxyBeforeCustomFormat=this.selectedProxy,this.showCustomFormat=!0,void(this.selectedProxy=v2);if("tracking"!==t)if(t!==g2){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=g2;else this.enabledTracking=!this.enabledTracking}handleTrackingParametersChange(e){this.trackingParameters=e.detail.values}renderHeader(){var e,t;return this.showVersionHistory?He`
1704
+ `;var L2=Object.defineProperty,N2=Object.getOwnPropertyDescriptor,z2=(e,t,n,i)=>{for(var r,o=i>1?void 0:i?N2(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&&L2(t,n,o),o};const F2=[{key:"UTM_source",value:""},{key:"UTM_campaign",value:""},{key:"UTM_description",value:""}],j2=[{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"}],U2=[{label:"Manual focus",value:"manual"},{label:"Center focus",value:"center"}];let H2=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=gS.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=F2}get shouldAppendAutoExtension(){return!!this.autoExtension&&this.supportedExtensions.includes(this.autoExtension)}get canUseATS(){if(!this.asset)return!1;const e=(this.availableExtensions&&this.asset.docType?bk([...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=>{var t,n,i;const r=null!=(i=null==(n=null==(t=this.asset)?void 0:t.extension)?void 0:n.replace(/^\./,""))?i:"";return!(!e.extension&&this.asset&&r)||this.supportedExtensions.includes(r)}),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===g2}}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===v2){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!==g2)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===v2)return this.lastProxyBeforeCustomFormat=this.selectedProxy,this.showCustomFormat=!0,void(this.selectedProxy=v2);if("tracking"!==t)if(t!==g2){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=g2;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"
@@ -2281,7 +2281,7 @@
2281
2281
  </cx-space>
2282
2282
  <slot></slot>
2283
2283
  </cx-space>
2284
- `}};b4.styles=[ga,f4],b4.dependencies={"cx-avatar":JC,"cx-divider":PS,"cx-dropdown":hT,"cx-icon":vh,"cx-icon-button":Sh,"cx-line-clamp":rv,"cx-menu":tT,"cx-menu-item":$S,"cx-skeleton":NO,"cx-space":vv,"cx-typography":uv},v4([dt({type:Boolean})],b4.prototype,"bordered",2),v4([dt({attribute:"application-name",type:String})],b4.prototype,"applicationName",2),v4([dt({type:Boolean})],b4.prototype,"loading",2),v4([dt({attribute:"is-fetching",type:Boolean})],b4.prototype,"isFetching",2),v4([dt({attribute:"avatar",type:String})],b4.prototype,"avatar",2),v4([dt({attribute:"full-name",type:String})],b4.prototype,"fullName",2),v4([dt({attribute:"folder-title",type:String})],b4.prototype,"folderTitle",2),v4([dt({attribute:"show-close-button",type:Boolean})],b4.prototype,"showCloseButton",2),v4([dt({attribute:"can-logout",type:Boolean})],b4.prototype,"canLogout",2),b4=v4([Us("cx-content-browser-header")],b4);const A4="CoreField.LargeSizePreview",w4="AllowATSLink",x4="CoreField.DocType",_4="Document.FileExtension",E4="CoreField.FileSize",C4="CoreField.Identifier",S4="CoreField.Keywords",T4="CoreField.MaxHeight",k4="CoreField.MaxWidth",I4="CoreField.OriginalFileName",M4="Document.RecordID",P4="ScrubURL",R4="CoreField.S6_StorageGroup",B4="CoreField.DocSubType",O4="CoreField.TitleWithFallback",D4="CoreField.UpdatedFileName",L4="CoreField.OriginalPreview";function N4(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,{}):{}}const z4=new Set([405,501]),F4=new Set;function j4(){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 U4({asset:e,extension:t,parameters:n,permanentLink:i,rawResponse:r,transformations:o,useSession:a}){let s=i||r.imageUrl,l="";o&&o.length>0&&(l+="/t/"),null==o||o.forEach(({key:e,value:t})=>{if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}e===mS.Metadata&&!0===t.keepMetadata&&(l+="fl_keep_metadata/")});const c=Boolean(o&&o.length>0);if(c&&(l+=`${e.identifier}`),!i){const n=null!=t?t:e.extension,i=n.startsWith(".")?n:`.${n}`;if(c)l+=i;else{const[e,t]=s.split(/([?#].*)$/,2);s=e.replace(/\.[^./]+$/,"")+i+(null!=t?t:"")}}const u=[];return null==n||n.forEach(({key:e,value:t})=>{u.push(`${encodeURIComponent(e.trim())}=${encodeURIComponent(t.trim())}`)}),a&&u.push(`UseSession=${encodeURIComponent(a)}`),((e,t,n=[])=>{const i=[e.indexOf("?"),e.indexOf("#")].filter(e=>-1!==e).reduce((e,t)=>-1===e?t:Math.min(e,t),-1),r=-1===i?e:e.slice(0,i),o=-1===i?"":e.slice(i),a=o.indexOf("#"),s=-1===a?"":o.slice(a),l=(-1===a?o:o.slice(0,a)).replace(/^\?/,""),c=e=>e.split("=")[0].toLowerCase(),u=new Set(n.map(c)),d=[...l.split("&").filter(e=>e&&!u.has(c(e))),...n];return`${r}${t}${d.length>0?`?${d.join("&")}`:""}${s}`})(s,l,u)}function H4(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,L4,D4,I4,"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[D4])?t:"";return""===o&&(o=null!=(n=e.fields[I4])?n:""),R({name:o,originalUrl:null!=(r=e.fields[L4])?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 Q4(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:[A4,x4,_4,E4,C4,S4,T4,k4,I4,M4,B4,O4,D4,R4,L4],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},N4(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[_4])?t:"";const f=e.fields[O4];return p&&!p.startsWith(".")&&(p="."+p),{allowATSLink:"True"===e.fields[w4],docSubType:null!=(n=e.fields[B4])?n:"",docType:null!=(i=e.fields[x4])?i:"",extension:p,height:null!=(r=e.fields[T4])?r:"0",id:e.recordID,identifier:null!=(o=e.fields[C4])?o:"",imageUrl:null!=(a=e.fields[A4])?a:"",inColdStorage:"Cold Storage"===e.fields[R4],name:null!=f?f:"",originalUrl:null!=(s=e.fields[L4])?s:"",recordId:null!=(l=e.fields[M4])?l:"",scrubUrl:null!=(c=e.fields[P4])?c:"",size:null!=(u=e.fields[E4])?u:"0 MB",tags:null!=(d=e.fields[S4])?d:"",width:null!=(h=e.fields[k4])?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 V4(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:j4(),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 G4=(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))(G4||{});var W4=Math.min;var q4=Math.max;var $4=function(){try{var e=bE(Object,"defineProperty");return e({},"",{}),e}catch(Pg){}}(),X4=$4?function(e,t){return $4(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:hk,Y4=Date.now;var K4=function(e){var t=0,n=0;return function(){var i=Y4(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(X4);function Z4(e){return function(e){return Mt(e)&&gC(e)}(e)?e:[]}var J4=function(e,t){return K4(function(e,t,n){return t=q4(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=q4(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,hk),e+"")}(function(e){var t=wt(e,Z4);return t.length&&t[0]===e[0]?function(e,t,n){for(var i=n?vk:gk,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,nC(t))),l=W4(u.length,l),s[a]=!n&&(t||r>=120&&u.length>=120)?new kE(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?ME(h,f):i(c,f,n))){for(a=o;--a;){var m=s[a];if(!(m?ME(m,f):i(e[a],f,n)))continue e}h&&h.push(f),c.push(p)}}return c}(t):[]});class e5{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.split("?")[0])||(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[G4.EnableATSInGetLink].toLowerCase(),autoExtension:null!=(n=null==(t=e[G4.ExtensionAuto])?void 0:t.toLowerCase())?n:".auto",collectionPath:null!=(r=null==(i=e[G4.CollectionSubtypeCriteria])?void 0:i.toLowerCase())?r:"",supportedExtensions:null!=(a=null==(o=e[G4.ExtensionsThatSupportTransformationUsingATS])?void 0:o.split("\n"))?a:[],supportedRepresentativeSubtypes:null!=(l=null==(s=e[G4.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 Q4(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 Q4(B(R({},e),{sortOrder:s}));e.start&&e.start>0&&!a?this.items=bk([...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=[H4({extraFields:[A4,x4,_4,E4,C4,S4,T4,k4,I4,M4,B4,O4,L4],recordIds:[e]}),V4({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[_4];return _&&!_.startsWith(".")&&(_="."+_),{asset:{allowATSLink:"True"===x[w4],docSubType:null!=(n=x[B4])?n:"",docType:null!=(i=x[x4])?i:"",extension:_,height:null!=(r=x[T4])?r:"0",id:x.recordId,identifier:null!=(o=x[C4])?o:"",imageUrl:null!=(a=x[A4])?a:"",inColdStorage:Boolean(x.inColdStorage),name:null!=(s=x[O4])?s:"",originalUrl:null!=(l=x[L4])?l:"",previewUrl:null!=(c=null==A?void 0:A.previewUrl)?c:"",recordId:null!=(u=x[M4])?u:"",scrubUrl:null!=(d=x[P4])?d:"",size:null!=(h=x[E4])?h:"0 MB",tags:null!=(p=x[S4])?p:"",width:null!=(f=x[k4])?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}){var l;const c={},u=1===e.length;let d=!1;const h=null!=(l=ca.defaults.baseURL)?l:window.location.origin;try{const l=(yield Promise.allSettled(e.map(e=>U(null,null,function*(){const l={GenerateAssetUrl:!r,Parameters:i,Proxy:o,RecordId:e.recordId};(null==n?void 0:n.length)&&(l.ExtraFields=n);const p=s?{UseSession:s}:void 0;let f;if(!F4.has(h))try{const e=yield ca.request({data:l,method:"POST",params:p,url:da.GET_ASSET_LINK,validateStatus:()=>!0});z4.has(e.status)?F4.add(h):f=e.data}catch(Pg){}if(void 0===f&&(f=(yield ca.request({method:"GET",params:B(R({},l),{UseSession:s||void 0}),paramsSerializer:{indexes:null},url:da.GET_ASSET_LINK})).data),(m=f)&&"object"==typeof m&&"ErrorCode"in m)return d=!0,u&&(c[f.ErrorCode]?c[f.ErrorCode].push(e):c[f.ErrorCode]=[e]),{imageUrl:e.imageUrl};var m;const g=U4({asset:e,extension:t,parameters:i,permanentLink:r,rawResponse:f,transformations:a,useSession:s});return B(R({},f),{imageUrl:g})})))).flatMap(e=>"fulfilled"===e.status?[e.value]:(d=!0,[]));return{data:l,isError:d}}catch(Pg){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 HC(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)?J4(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 t5(e){return Number.isNaN(e)||!Number.isInteger(e)?0:e}v=new WeakMap,y=new WeakMap,b=new WeakMap,A=new WeakMap;const n5=ie`
2284
+ `}};b4.styles=[ga,f4],b4.dependencies={"cx-avatar":JC,"cx-divider":PS,"cx-dropdown":hT,"cx-icon":vh,"cx-icon-button":Sh,"cx-line-clamp":rv,"cx-menu":tT,"cx-menu-item":$S,"cx-skeleton":NO,"cx-space":vv,"cx-typography":uv},v4([dt({type:Boolean})],b4.prototype,"bordered",2),v4([dt({attribute:"application-name",type:String})],b4.prototype,"applicationName",2),v4([dt({type:Boolean})],b4.prototype,"loading",2),v4([dt({attribute:"is-fetching",type:Boolean})],b4.prototype,"isFetching",2),v4([dt({attribute:"avatar",type:String})],b4.prototype,"avatar",2),v4([dt({attribute:"full-name",type:String})],b4.prototype,"fullName",2),v4([dt({attribute:"folder-title",type:String})],b4.prototype,"folderTitle",2),v4([dt({attribute:"show-close-button",type:Boolean})],b4.prototype,"showCloseButton",2),v4([dt({attribute:"can-logout",type:Boolean})],b4.prototype,"canLogout",2),b4=v4([Us("cx-content-browser-header")],b4);const A4="CoreField.LargeSizePreview",w4="AllowATSLink",x4="CoreField.DocType",_4="Document.FileExtension",E4="CoreField.FileSize",C4="CoreField.Identifier",S4="CoreField.Keywords",T4="CoreField.MaxHeight",k4="CoreField.MaxWidth",I4="CoreField.OriginalFileName",M4="Document.RecordID",P4="ScrubURL",R4="CoreField.S6_StorageGroup",B4="CoreField.DocSubType",O4="CoreField.TitleWithFallback",D4="CoreField.UpdatedFileName",L4="CoreField.OriginalPreview";function N4(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,{}):{}}const z4=new Set([405,501]),F4=new Set;function j4(){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 U4({asset:e,extension:t,parameters:n,permanentLink:i,rawResponse:r,transformations:o,useSession:a}){let s=i||r.imageUrl,l="";o&&o.length>0&&(l+="/t/"),null==o||o.forEach(({key:e,value:t})=>{if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}if(e===mS.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)=>{l+=`${t}${n}${i<e.length-1?",":""}`}),l+="/"}e===mS.Metadata&&!0===t.keepMetadata&&(l+="fl_keep_metadata/")});const c=Boolean(o&&o.length>0);c&&(l+=`${e.identifier}`);const u=null!=t?t:e.extension;if(!i&&u){const e=u.startsWith(".")?u:`.${u}`;if(c)l+=e;else{const[t,n]=s.split(/([?#].*)$/,2);s=t.replace(/\.[^./]+$/,"")+e+(null!=n?n:"")}}const d=[];return null==n||n.forEach(({key:e,value:t})=>{d.push(`${encodeURIComponent(e.trim())}=${encodeURIComponent(t.trim())}`)}),a&&d.push(`UseSession=${encodeURIComponent(a)}`),((e,t,n=[])=>{const i=[e.indexOf("?"),e.indexOf("#")].filter(e=>-1!==e).reduce((e,t)=>-1===e?t:Math.min(e,t),-1),r=-1===i?e:e.slice(0,i),o=-1===i?"":e.slice(i),a=o.indexOf("#"),s=-1===a?"":o.slice(a),l=(-1===a?o:o.slice(0,a)).replace(/^\?/,""),c=e=>e.split("=")[0].toLowerCase(),u=new Set(n.map(c)),d=[...l.split("&").filter(e=>e&&!u.has(c(e))),...n];return`${r}${t}${d.length>0?`?${d.join("&")}`:""}${s}`})(s,l,d)}function H4(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,L4,D4,I4,"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[D4])?t:"";return""===o&&(o=null!=(n=e.fields[I4])?n:""),R({name:o,originalUrl:null!=(r=e.fields[L4])?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 Q4(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:[A4,x4,_4,E4,C4,S4,T4,k4,I4,M4,B4,O4,D4,R4,L4],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},N4(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[_4])?t:"";const f=e.fields[O4];return p&&!p.startsWith(".")&&(p="."+p),{allowATSLink:"True"===e.fields[w4],docSubType:null!=(n=e.fields[B4])?n:"",docType:null!=(i=e.fields[x4])?i:"",extension:p,height:null!=(r=e.fields[T4])?r:"0",id:e.recordID,identifier:null!=(o=e.fields[C4])?o:"",imageUrl:null!=(a=e.fields[A4])?a:"",inColdStorage:"Cold Storage"===e.fields[R4],name:null!=f?f:"",originalUrl:null!=(s=e.fields[L4])?s:"",recordId:null!=(l=e.fields[M4])?l:"",scrubUrl:null!=(c=e.fields[P4])?c:"",size:null!=(u=e.fields[E4])?u:"0 MB",tags:null!=(d=e.fields[S4])?d:"",width:null!=(h=e.fields[k4])?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 V4(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:j4(),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 G4=(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))(G4||{});var W4=Math.min;var q4=Math.max;var $4=function(){try{var e=bE(Object,"defineProperty");return e({},"",{}),e}catch(Pg){}}(),X4=$4?function(e,t){return $4(e,"toString",{configurable:!0,enumerable:!1,value:(n=t,function(){return n}),writable:!0});var n}:hk,Y4=Date.now;var K4=function(e){var t=0,n=0;return function(){var i=Y4(),r=16-(i-n);if(n=i,r>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}(X4);function Z4(e){return function(e){return Mt(e)&&gC(e)}(e)?e:[]}var J4=function(e,t){return K4(function(e,t,n){return t=q4(void 0===t?e.length-1:t,0),function(){for(var i=arguments,r=-1,o=q4(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,hk),e+"")}(function(e){var t=wt(e,Z4);return t.length&&t[0]===e[0]?function(e,t,n){for(var i=n?vk:gk,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,nC(t))),l=W4(u.length,l),s[a]=!n&&(t||r>=120&&u.length>=120)?new kE(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?ME(h,f):i(c,f,n))){for(a=o;--a;){var m=s[a];if(!(m?ME(m,f):i(e[a],f,n)))continue e}h&&h.push(f),c.push(p)}}return c}(t):[]});class e5{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.split("?")[0])||(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[G4.EnableATSInGetLink].toLowerCase(),autoExtension:null!=(n=null==(t=e[G4.ExtensionAuto])?void 0:t.toLowerCase())?n:".auto",collectionPath:null!=(r=null==(i=e[G4.CollectionSubtypeCriteria])?void 0:i.toLowerCase())?r:"",supportedExtensions:null!=(a=null==(o=e[G4.ExtensionsThatSupportTransformationUsingATS])?void 0:o.split("\n"))?a:[],supportedRepresentativeSubtypes:null!=(l=null==(s=e[G4.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 Q4(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 Q4(B(R({},e),{sortOrder:s}));e.start&&e.start>0&&!a?this.items=bk([...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=[H4({extraFields:[A4,x4,_4,E4,C4,S4,T4,k4,I4,M4,B4,O4,L4],recordIds:[e]}),V4({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[_4];return _&&!_.startsWith(".")&&(_="."+_),{asset:{allowATSLink:"True"===x[w4],docSubType:null!=(n=x[B4])?n:"",docType:null!=(i=x[x4])?i:"",extension:_,height:null!=(r=x[T4])?r:"0",id:x.recordId,identifier:null!=(o=x[C4])?o:"",imageUrl:null!=(a=x[A4])?a:"",inColdStorage:Boolean(x.inColdStorage),name:null!=(s=x[O4])?s:"",originalUrl:null!=(l=x[L4])?l:"",previewUrl:null!=(c=null==A?void 0:A.previewUrl)?c:"",recordId:null!=(u=x[M4])?u:"",scrubUrl:null!=(d=x[P4])?d:"",size:null!=(h=x[E4])?h:"0 MB",tags:null!=(p=x[S4])?p:"",width:null!=(f=x[k4])?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}){var l;const c={},u=1===e.length;let d=!1;const h=null!=(l=ca.defaults.baseURL)?l:window.location.origin;try{const l=(yield Promise.allSettled(e.map(e=>U(null,null,function*(){const l={GenerateAssetUrl:!r,Parameters:i,Proxy:o,RecordId:e.recordId};(null==n?void 0:n.length)&&(l.ExtraFields=n);const p=s?{UseSession:s}:void 0;let f;if(!F4.has(h))try{const e=yield ca.request({data:l,method:"POST",params:p,url:da.GET_ASSET_LINK,validateStatus:()=>!0});z4.has(e.status)?F4.add(h):f=e.data}catch(Pg){}if(void 0===f&&(f=(yield ca.request({method:"GET",params:B(R({},l),{UseSession:s||void 0}),paramsSerializer:{indexes:null},url:da.GET_ASSET_LINK})).data),(m=f)&&"object"==typeof m&&"ErrorCode"in m)return d=!0,u&&(c[f.ErrorCode]?c[f.ErrorCode].push(e):c[f.ErrorCode]=[e]),{imageUrl:e.imageUrl};var m;const g=U4({asset:e,extension:t,parameters:i,permanentLink:r,rawResponse:f,transformations:a,useSession:s});return B(R({},f),{imageUrl:g})})))).flatMap(e=>"fulfilled"===e.status?[e.value]:(d=!0,[]));return{data:l,isError:d}}catch(Pg){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 HC(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)?J4(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 t5(e){return Number.isNaN(e)||!Number.isInteger(e)?0:e}v=new WeakMap,y=new WeakMap,b=new WeakMap,A=new WeakMap;const n5=ie`
2285
2285
  :host {
2286
2286
  --cx-button-text-transform: none;
2287
2287
  --default-representative-background-color: #6cdaf3;
@@ -2320,7 +2320,7 @@
2320
2320
  width: 100%;
2321
2321
  height: 100%;
2322
2322
  }
2323
- `;var i5=Object.defineProperty,r5=Object.getOwnPropertyDescriptor,o5=(e,t,n,i)=>{for(var r,o=i>1?void 0:i?r5(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&&i5(t,n,o),o};const a5=["ScrubUrl","AllowATSLink"];let s5=class extends Nn{constructor(){super(...arguments),this.localize=new sc(this),this.baseUrl="",this.applicationName="",this.availableDocTypes=["DO_DOCUMENTS.Image_DbBO.*","DO_DOCUMENTS.Audio_DbBO.*","DO_DOCUMENTS.Multimedia_DbBO.*","DO_DOCUMENTS.Video_DbBO.*"],this.allowedExtensions=[],this.allowedFolders=[],this.availableRepresentativeSubtypes=[],this.token="",this.showCollections=!1,this.showFavoriteFolder=!1,this.showCloseButton=!1,this.useSession="",this.canPin=!1,this.canFavorite=!1,this.canPinAsset=!1,this.canUseProxies=!1,this.canViewVersions=!1,this.canTrack=!1,this.canLogout=!1,this.ctaText="",this.ctaTextTransform="capitalize",this.extraFields=[],this.defaultGridView=pS.Medium,this.defaultSortOrderName="",this.defaultSortDirection="ascending",this.defaultSelectedFacets={},this.defaultIsSeeThrough=!1,this.defaultSearchText="",this.defaultFolderId="",this.showTitle=!0,this.showSize=!0,this.showDimensions=!0,this.showTags=!1,this.views=[{label:this.localize.term("smallLabeled"),value:"small"},{label:this.localize.term("mediumLabeled"),value:"medium"},{label:this.localize.term("largeLabeled"),value:"large"}],this.errorMessage="",this.forceOverlay=!1,this.canPinLayout=!0,this.view=this.defaultGridView,this.folderTitle=void 0,this.assets=[],this.lastRequest={isSeeThrough:!0,start:0},this.selectedAssetId=void 0,this.isMobile=!1,this.defaultPageSize=10}willUpdate(e){super.willUpdate(e),this.hasUpdated||(this.view=this.defaultGridView)}runFirstUpdated(){switch(this.view){case pS.Large:this.defaultPageSize=15;break;case pS.Medium:this.defaultPageSize=20;break;case pS.Small:this.defaultPageSize=30}this.lastRequest=B(R({},this.lastRequest),{folderId:this.defaultFolderId,isSeeThrough:this.defaultIsSeeThrough,searchText:this.defaultSearchText,selectedFacets:this.defaultSelectedFacets,sortDirection:this.defaultSortDirection,sortOrderName:this.defaultSortOrderName}),this.updateComplete.then(()=>{this.fetchAndMergeAssetsController=new e5(this,{availableDocTypes:this.availableDocTypes,baseUrl:this.baseUrl,defaultFolderId:this.defaultFolderId,defaultIsSeeThrough:this.defaultIsSeeThrough,defaultSearchText:this.defaultSearchText,defaultSelectedFacets:this.defaultSelectedFacets,defaultSortDirection:this.defaultSortDirection,defaultSortOrderName:this.defaultSortOrderName,token:this.token,useSession:this.useSession}),this.requestUpdate()})}fetchAssets(e){return U(this,null,function*(){return yield this.fetchAndMergeAssetsController.fetchAssets(e)})}fetchFolders(e){return U(this,null,function*(){return yield this.fetchAndMergeAssetsController.fetchFolders(e)})}selectAsset(e){return U(this,null,function*(){yield this.openFormatDialog(e)})}setIsAssetPinned(e){this.formatDialog.setIsAssetPinned(e)}openFormatDialog(e){return U(this,null,function*(){this.selectedAssetId=e;try{const t=yield this.fetchAndMergeAssetsController.fetchAssetByID(e,{canFavorite:this.canFavorite});if(!t)return void(this.selectedAssetId=void 0);let n=!1;if(this.canPinAsset){n=this.emit("cx-content-browser-pin-asset-lookup",{detail:{assetId:e,isAssetPinned:!1}}).detail.isAssetPinned}this.formatDialog.open(B(R({},t),{isAssetPinned:n}))}catch(Pg){this.selectedAssetId=void 0}})}handleLastRequestChange(){return U(this,null,function*(){this.emit("cx-content-browser-request-change",{detail:{request:this.lastRequest,view:this.view}})})}handleAuthChange(){var e;null==(e=this.fetchAndMergeAssetsController)||e.updateAuth(this.token,this.useSession)}handleSortOrderChange(e){return U(this,null,function*(){const{sortDirection:t,sortOrderName:n}=e.detail;t!==this.lastRequest.sortDirection&&(this.newlyChangedOption={type:hS.SORT_DIRECTION,value:t}),n!==this.lastRequest.sortOrderName&&(this.newlyChangedOption={type:hS.SORT_ORDER,value:n}),this.lastRequest=B(R({},this.lastRequest),{sortDirection:t,sortOrderName:n,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleFilterChange(e){return U(this,null,function*(){this.lastRequest=B(R({},this.lastRequest),{selectedFacets:e.detail.selection,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleViewChange(e){return U(this,null,function*(){switch(e.detail.isSeeThrough!==this.lastRequest.isSeeThrough&&(this.lastRequest=B(R({},this.lastRequest),{isSeeThrough:e.detail.isSeeThrough,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)),e.detail.view){case pS.Large:this.defaultPageSize=15;break;case pS.Medium:this.defaultPageSize=20;break;case pS.Small:this.defaultPageSize=30}this.view=e.detail.view})}handleScrollEnd(){return U(this,null,function*(){const e=t5(this.lastRequest.start)+t5(this.lastRequest.pageSize);this.lastRequest=B(R({},this.lastRequest),{pageSize:this.defaultPageSize,start:e}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleFolderSelectionChange(e){return U(this,null,function*(){var t,n;if(!(null==(t=e.detail.selection)?void 0:t.length)||!(null==(n=e.detail.selection[0].dataset)?void 0:n.id))return;const{id:i,name:r}=e.detail.selection[0].dataset;this.folderTitle=r,i&&i!==this.lastRequest.folderId&&(this.lastRequest=B(R({},this.lastRequest),{folderId:i,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest))})}handleSearchChange(e){return U(this,null,function*(){this.lastRequest=B(R({},this.lastRequest),{searchText:e.detail.searchText,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleGridResize(e){return U(this,null,function*(){const{columnCount:t,rowCount:n}=e.detail,i=Math.ceil(n*t/this.defaultPageSize+1)*this.defaultPageSize,r=this.fetchAndMergeAssetsController.getData().totalCount,o=t5(this.lastRequest.start)+t5(this.lastRequest.pageSize);i<=t5(this.lastRequest.pageSize)||0===i||o>r||(this.lastRequest=B(R({},this.lastRequest),{pageSize:i-t5(this.lastRequest.pageSize),start:o}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest))})}handleGridClick(e){return U(this,null,function*(){const{id:t}=e.detail;yield this.openFormatDialog(t)})}handleVersionHistoryOpen(e){return U(this,null,function*(){const{assetId:t}=e.detail,n=yield this.fetchAndMergeAssetsController.fetchAssetVersionHistory(t);this.formatDialog.setVersionHistory(n.versions)})}handleFavoriteChange(e){return U(this,null,function*(){const{assetId:t,isFavorite:n}=e.detail;let i=!1;this.emit("cx-content-browser-favorite-change",{detail:{assetId:t,isFavorite:n}}),i=n?yield this.fetchAndMergeAssetsController.removeAssetFromFavorite(t):yield this.fetchAndMergeAssetsController.addAssetToFavorite(t),i&&(this.formatDialog.setIsFavorite(!n),this.emit("cx-content-browser-favorite-changed-status",{detail:{assetId:t,isFavorite:!n}}))})}handlePinAssetChange(e){const{assetId:t,isPinned:n}=e.detail;this.emit("cx-content-browser-pin-asset-change",{detail:{assetId:t,isPinned:n}})}handleProxyConfirm(e){return U(this,null,function*(){var t;try{const n=yield this.fetchAndMergeAssetsController.getAssetLink(B(R({},e.detail),{assets:[e.detail.asset],extraFields:this.extraFields}));if(n.isError||!(null==(t=n.data[0])?void 0:t.imageUrl))return void this.formatDialog.setLoadingConfirm(!1);this.handleSelectedAsset({asset:e.detail.asset,images:n.data,selectedProxyMetadata:e.detail.selectedProxyMetadata}),this.formatDialog.hide()}catch(Pg){this.formatDialog.setLoadingConfirm(!1)}})}handleFormatConfirm(e){return U(this,null,function*(){var t;try{const n=yield this.fetchAndMergeAssetsController.getAssetLink(B(R({},e.detail),{assets:[e.detail.asset],extraFields:this.extraFields}));if(n.isError||!(null==(t=n.data[0])?void 0:t.imageUrl))return void this.formatDialog.setLoadingConfirm(!1);this.handleSelectedAsset({asset:e.detail.asset,images:n.data,selectedProxyMetadata:e.detail.sourceProxyMetadata,transformedAssetMetadata:e.detail.transformedAssetMetadata}),this.formatDialog.hide()}catch(Pg){this.formatDialog.setLoadingConfirm(!1)}})}handleFormatDialogClose(){return U(this,null,function*(){this.selectedAssetId=void 0})}handleSelectedAsset(e){var t,n;const{asset:i,images:r,selectedProxyMetadata:o,transformedAssetMetadata:a}=e,s=[...r];for(const l of a5){const e=Rn(l);i&&(null==(t=this.extraFields)?void 0:t.includes(l))&&(s[0]=B(R({},s[0]),{extraFields:B(R({},(null==(n=s[0])?void 0:n.extraFields)||{}),{[l]:i[e]})})),s[0]=B(R({},s[0]),a?{assetLinkInfo:{extension:a.extension,height:a.height,isCustomFormat:a.isCustomFormat,permanentLink:s[0].imageUrl,width:a.width},assetTransformationSource:o}:{assetLinkInfo:{cdnName:null==o?void 0:o.cdnName,extension:null==o?void 0:o.extension,height:null==o?void 0:o.height,isCustomFormat:null==o?void 0:o.isCustomFormat,permanentLink:s[0].imageUrl,proxyLabel:null==o?void 0:o.proxyLabel,proxyName:null==o?void 0:o.proxyName,width:null==o?void 0:o.width}})}this.emit("cx-content-browser-selected-asset",{detail:s})}handleResize(e){const t=e.detail.entries;if(t[0].target!==this.content)return;const n=t[0].contentRect.width;this.isMobile=n<480,this.forceOverlay=n<650,this.canPinLayout=n>=1050}render(){var e;if(!this.fetchAndMergeAssetsController)return Ve;const{availableExtensions:t,availableFacets:n,facets:i,isLoggedIn:r,items:o,loading:a,parameters:s,request:l,sortOrders:c,totalCount:u,userInfo:d}=this.fetchAndMergeAssetsController.getData({allowedExtensions:this.allowedExtensions,availableRepresentativeSubtypes:this.availableRepresentativeSubtypes});return r?He`
2323
+ `;var i5=Object.defineProperty,r5=Object.getOwnPropertyDescriptor,o5=(e,t,n,i)=>{for(var r,o=i>1?void 0:i?r5(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&&i5(t,n,o),o};const a5=["ScrubUrl","AllowATSLink"];let s5=class extends Nn{constructor(){super(...arguments),this.localize=new sc(this),this.baseUrl="",this.applicationName="",this.availableDocTypes=["DO_DOCUMENTS.Image_DbBO.*","DO_DOCUMENTS.Audio_DbBO.*","DO_DOCUMENTS.Multimedia_DbBO.*","DO_DOCUMENTS.Video_DbBO.*"],this.allowedExtensions=[],this.allowedFolders=[],this.availableRepresentativeSubtypes=[],this.token="",this.showCollections=!1,this.showFavoriteFolder=!1,this.showCloseButton=!1,this.useSession="",this.canPin=!1,this.canFavorite=!1,this.canPinAsset=!1,this.canUseProxies=!1,this.canViewVersions=!1,this.canTrack=!1,this.canLogout=!1,this.ctaText="",this.ctaTextTransform="capitalize",this.extraFields=[],this.defaultGridView=pS.Medium,this.defaultSortOrderName="",this.defaultSortDirection="ascending",this.defaultSelectedFacets={},this.defaultIsSeeThrough=!1,this.defaultSearchText="",this.defaultFolderId="",this.showTitle=!0,this.showSize=!0,this.showDimensions=!0,this.showTags=!1,this.views=[{label:this.localize.term("smallLabeled"),value:"small"},{label:this.localize.term("mediumLabeled"),value:"medium"},{label:this.localize.term("largeLabeled"),value:"large"}],this.errorMessage="",this.forceOverlay=!1,this.canPinLayout=!0,this.view=this.defaultGridView,this.folderTitle=void 0,this.assets=[],this.lastRequest={isSeeThrough:!0,start:0},this.selectedAssetId=void 0,this.isMobile=!1,this.defaultPageSize=10}willUpdate(e){super.willUpdate(e),this.hasUpdated||(this.view=this.defaultGridView)}runFirstUpdated(){switch(this.view){case pS.Large:this.defaultPageSize=15;break;case pS.Medium:this.defaultPageSize=20;break;case pS.Small:this.defaultPageSize=30}this.lastRequest=B(R({},this.lastRequest),{folderId:this.defaultFolderId,isSeeThrough:this.defaultIsSeeThrough,searchText:this.defaultSearchText,selectedFacets:this.defaultSelectedFacets,sortDirection:this.defaultSortDirection,sortOrderName:this.defaultSortOrderName}),this.updateComplete.then(()=>{this.fetchAndMergeAssetsController=new e5(this,{availableDocTypes:this.availableDocTypes,baseUrl:this.baseUrl,defaultFolderId:this.defaultFolderId,defaultIsSeeThrough:this.defaultIsSeeThrough,defaultSearchText:this.defaultSearchText,defaultSelectedFacets:this.defaultSelectedFacets,defaultSortDirection:this.defaultSortDirection,defaultSortOrderName:this.defaultSortOrderName,token:this.token,useSession:this.useSession}),this.requestUpdate()})}fetchAssets(e){return U(this,null,function*(){return yield this.fetchAndMergeAssetsController.fetchAssets(e)})}fetchFolders(e){return U(this,null,function*(){return yield this.fetchAndMergeAssetsController.fetchFolders(e)})}selectAsset(e){return U(this,null,function*(){yield this.openFormatDialog(e)})}setIsAssetPinned(e){this.formatDialog.setIsAssetPinned(e)}openFormatDialog(e){return U(this,null,function*(){this.selectedAssetId=e;try{const t=yield this.fetchAndMergeAssetsController.fetchAssetByID(e,{canFavorite:this.canFavorite});if(!t)return void(this.selectedAssetId=void 0);let n=!1;if(this.canPinAsset){n=this.emit("cx-content-browser-pin-asset-lookup",{detail:{assetId:e,isAssetPinned:!1}}).detail.isAssetPinned}this.formatDialog.open(B(R({},t),{isAssetPinned:n}))}catch(Pg){this.selectedAssetId=void 0}})}handleLastRequestChange(){return U(this,null,function*(){this.emit("cx-content-browser-request-change",{detail:{request:this.lastRequest,view:this.view}})})}handleAuthChange(){var e;null==(e=this.fetchAndMergeAssetsController)||e.updateAuth(this.token,this.useSession)}handleSortOrderChange(e){return U(this,null,function*(){const{sortDirection:t,sortOrderName:n}=e.detail;t!==this.lastRequest.sortDirection&&(this.newlyChangedOption={type:hS.SORT_DIRECTION,value:t}),n!==this.lastRequest.sortOrderName&&(this.newlyChangedOption={type:hS.SORT_ORDER,value:n}),this.lastRequest=B(R({},this.lastRequest),{sortDirection:t,sortOrderName:n,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleFilterChange(e){return U(this,null,function*(){this.lastRequest=B(R({},this.lastRequest),{selectedFacets:e.detail.selection,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleViewChange(e){return U(this,null,function*(){switch(e.detail.isSeeThrough!==this.lastRequest.isSeeThrough&&(this.lastRequest=B(R({},this.lastRequest),{isSeeThrough:e.detail.isSeeThrough,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)),e.detail.view){case pS.Large:this.defaultPageSize=15;break;case pS.Medium:this.defaultPageSize=20;break;case pS.Small:this.defaultPageSize=30}this.view=e.detail.view})}handleScrollEnd(){return U(this,null,function*(){const e=t5(this.lastRequest.start)+t5(this.lastRequest.pageSize);this.lastRequest=B(R({},this.lastRequest),{pageSize:this.defaultPageSize,start:e}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleFolderSelectionChange(e){return U(this,null,function*(){var t,n;if(!(null==(t=e.detail.selection)?void 0:t.length)||!(null==(n=e.detail.selection[0].dataset)?void 0:n.id))return;const{id:i,name:r}=e.detail.selection[0].dataset;this.folderTitle=r,i&&i!==this.lastRequest.folderId&&(this.lastRequest=B(R({},this.lastRequest),{folderId:i,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest))})}handleSearchChange(e){return U(this,null,function*(){this.lastRequest=B(R({},this.lastRequest),{searchText:e.detail.searchText,start:0}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest)})}handleGridResize(e){return U(this,null,function*(){const{columnCount:t,rowCount:n}=e.detail,i=Math.ceil(n*t/this.defaultPageSize+1)*this.defaultPageSize,r=this.fetchAndMergeAssetsController.getData().totalCount,o=t5(this.lastRequest.start)+t5(this.lastRequest.pageSize);i<=t5(this.lastRequest.pageSize)||0===i||o>r||(this.lastRequest=B(R({},this.lastRequest),{pageSize:i-t5(this.lastRequest.pageSize),start:o}),yield this.fetchAndMergeAssetsController.fetchAndMergeAssets(this.lastRequest))})}handleGridClick(e){return U(this,null,function*(){const{id:t}=e.detail;yield this.openFormatDialog(t)})}handleVersionHistoryOpen(e){return U(this,null,function*(){const{assetId:t}=e.detail,n=yield this.fetchAndMergeAssetsController.fetchAssetVersionHistory(t);this.formatDialog.setVersionHistory(n.versions)})}handleFavoriteChange(e){return U(this,null,function*(){const{assetId:t,isFavorite:n}=e.detail;let i=!1;this.emit("cx-content-browser-favorite-change",{detail:{assetId:t,isFavorite:n}}),i=n?yield this.fetchAndMergeAssetsController.removeAssetFromFavorite(t):yield this.fetchAndMergeAssetsController.addAssetToFavorite(t),i&&(this.formatDialog.setIsFavorite(!n),this.emit("cx-content-browser-favorite-changed-status",{detail:{assetId:t,isFavorite:!n}}))})}handlePinAssetChange(e){const{assetId:t,isPinned:n}=e.detail;this.emit("cx-content-browser-pin-asset-change",{detail:{assetId:t,isPinned:n}})}handleProxyConfirm(e){return U(this,null,function*(){try{const t=yield this.fetchAndMergeAssetsController.getAssetLink(B(R({},e.detail),{assets:[e.detail.asset],extraFields:this.extraFields}));if(t.isError)return void this.formatDialog.setLoadingConfirm(!1);this.handleSelectedAsset({asset:e.detail.asset,images:t.data,selectedProxyMetadata:e.detail.selectedProxyMetadata}),this.formatDialog.hide()}catch(Pg){this.formatDialog.setLoadingConfirm(!1)}})}handleFormatConfirm(e){return U(this,null,function*(){try{const t=yield this.fetchAndMergeAssetsController.getAssetLink(B(R({},e.detail),{assets:[e.detail.asset],extraFields:this.extraFields}));if(t.isError)return void this.formatDialog.setLoadingConfirm(!1);this.handleSelectedAsset({asset:e.detail.asset,images:t.data,selectedProxyMetadata:e.detail.sourceProxyMetadata,transformedAssetMetadata:e.detail.transformedAssetMetadata}),this.formatDialog.hide()}catch(Pg){this.formatDialog.setLoadingConfirm(!1)}})}handleFormatDialogClose(){return U(this,null,function*(){this.selectedAssetId=void 0})}handleSelectedAsset(e){var t,n;const{asset:i,images:r,selectedProxyMetadata:o,transformedAssetMetadata:a}=e,s=[...r];for(const l of a5){const e=Rn(l);i&&(null==(t=this.extraFields)?void 0:t.includes(l))&&(s[0]=B(R({},s[0]),{extraFields:B(R({},(null==(n=s[0])?void 0:n.extraFields)||{}),{[l]:i[e]})})),s[0]=B(R({},s[0]),a?{assetLinkInfo:{extension:a.extension,height:a.height,isCustomFormat:a.isCustomFormat,permanentLink:s[0].imageUrl,width:a.width},assetTransformationSource:o}:{assetLinkInfo:{cdnName:null==o?void 0:o.cdnName,extension:null==o?void 0:o.extension,height:null==o?void 0:o.height,isCustomFormat:null==o?void 0:o.isCustomFormat,permanentLink:s[0].imageUrl,proxyLabel:null==o?void 0:o.proxyLabel,proxyName:null==o?void 0:o.proxyName,width:null==o?void 0:o.width}})}this.emit("cx-content-browser-selected-asset",{detail:s})}handleResize(e){const t=e.detail.entries;if(t[0].target!==this.content)return;const n=t[0].contentRect.width;this.isMobile=n<480,this.forceOverlay=n<650,this.canPinLayout=n>=1050}render(){var e;if(!this.fetchAndMergeAssetsController)return Ve;const{availableExtensions:t,availableFacets:n,facets:i,isLoggedIn:r,items:o,loading:a,parameters:s,request:l,sortOrders:c,totalCount:u,userInfo:d}=this.fetchAndMergeAssetsController.getData({allowedExtensions:this.allowedExtensions,availableRepresentativeSubtypes:this.availableRepresentativeSubtypes});return r?He`
2324
2324
  ${gt(s,()=>He`
2325
2325
  <cx-content-browser-browser
2326
2326
  collection-path=${mt(null==s?void 0:s.collectionPath)}
@@ -9131,8 +9131,10 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9131
9131
  handleSupportedExtensionsChange() {
9132
9132
  var _a2, _b2;
9133
9133
  this.filteredProxies = this.proxies.filter((item) => {
9134
- if (!item.extension && this.asset) {
9135
- return this.supportedExtensions.includes(this.asset.extension.replace(/^\./, ""));
9134
+ var _a3, _b3, _c2;
9135
+ const assetExtension = (_c2 = (_b3 = (_a3 = this.asset) == null ? void 0 : _a3.extension) == null ? void 0 : _b3.replace(/^\./, "")) != null ? _c2 : "";
9136
+ if (!item.extension && this.asset && assetExtension) {
9137
+ return this.supportedExtensions.includes(assetExtension);
9136
9138
  }
9137
9139
  return true;
9138
9140
  });
@@ -12945,8 +12947,8 @@ function buildAssetLinkImageUrl({
12945
12947
  if (hasTransformations) {
12946
12948
  transformationPath += `${asset.identifier}`;
12947
12949
  }
12948
- if (!permanentLink) {
12949
- const assetExtension = extension != null ? extension : asset.extension;
12950
+ const assetExtension = extension != null ? extension : asset.extension;
12951
+ if (!permanentLink && assetExtension) {
12950
12952
  const normalizedExtension = assetExtension.startsWith(".") ? assetExtension : `.${assetExtension}`;
12951
12953
  if (hasTransformations) {
12952
12954
  transformationPath += normalizedExtension;
@@ -14538,13 +14540,12 @@ let CxContentBrowser = class extends CortexElement {
14538
14540
  }
14539
14541
  handleProxyConfirm(event) {
14540
14542
  return __async(this, null, function* () {
14541
- var _a2;
14542
14543
  try {
14543
14544
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14544
14545
  assets: [event.detail.asset],
14545
14546
  extraFields: this.extraFields
14546
14547
  }));
14547
- if (response.isError || !((_a2 = response.data[0]) == null ? void 0 : _a2.imageUrl)) {
14548
+ if (response.isError) {
14548
14549
  this.formatDialog.setLoadingConfirm(false);
14549
14550
  return;
14550
14551
  }
@@ -14561,13 +14562,12 @@ let CxContentBrowser = class extends CortexElement {
14561
14562
  }
14562
14563
  handleFormatConfirm(event) {
14563
14564
  return __async(this, null, function* () {
14564
- var _a2;
14565
14565
  try {
14566
14566
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14567
14567
  assets: [event.detail.asset],
14568
14568
  extraFields: this.extraFields
14569
14569
  }));
14570
- if (response.isError || !((_a2 = response.data[0]) == null ? void 0 : _a2.imageUrl)) {
14570
+ if (response.isError) {
14571
14571
  this.formatDialog.setLoadingConfirm(false);
14572
14572
  return;
14573
14573
  }
package/build/index.mjs CHANGED
@@ -9197,8 +9197,10 @@ let CxContentBrowserFormatDialog = class extends CortexElement {
9197
9197
  handleSupportedExtensionsChange() {
9198
9198
  var _a2, _b2;
9199
9199
  this.filteredProxies = this.proxies.filter((item) => {
9200
- if (!item.extension && this.asset) {
9201
- return this.supportedExtensions.includes(this.asset.extension.replace(/^\./, ""));
9200
+ var _a3, _b3, _c2;
9201
+ const assetExtension = (_c2 = (_b3 = (_a3 = this.asset) == null ? void 0 : _a3.extension) == null ? void 0 : _b3.replace(/^\./, "")) != null ? _c2 : "";
9202
+ if (!item.extension && this.asset && assetExtension) {
9203
+ return this.supportedExtensions.includes(assetExtension);
9202
9204
  }
9203
9205
  return true;
9204
9206
  });
@@ -13011,8 +13013,8 @@ function buildAssetLinkImageUrl({
13011
13013
  if (hasTransformations) {
13012
13014
  transformationPath += `${asset.identifier}`;
13013
13015
  }
13014
- if (!permanentLink) {
13015
- const assetExtension = extension != null ? extension : asset.extension;
13016
+ const assetExtension = extension != null ? extension : asset.extension;
13017
+ if (!permanentLink && assetExtension) {
13016
13018
  const normalizedExtension = assetExtension.startsWith(".") ? assetExtension : `.${assetExtension}`;
13017
13019
  if (hasTransformations) {
13018
13020
  transformationPath += normalizedExtension;
@@ -14604,13 +14606,12 @@ let CxContentBrowser = class extends CortexElement {
14604
14606
  }
14605
14607
  handleProxyConfirm(event) {
14606
14608
  return __async(this, null, function* () {
14607
- var _a2;
14608
14609
  try {
14609
14610
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14610
14611
  assets: [event.detail.asset],
14611
14612
  extraFields: this.extraFields
14612
14613
  }));
14613
- if (response.isError || !((_a2 = response.data[0]) == null ? void 0 : _a2.imageUrl)) {
14614
+ if (response.isError) {
14614
14615
  this.formatDialog.setLoadingConfirm(false);
14615
14616
  return;
14616
14617
  }
@@ -14627,13 +14628,12 @@ let CxContentBrowser = class extends CortexElement {
14627
14628
  }
14628
14629
  handleFormatConfirm(event) {
14629
14630
  return __async(this, null, function* () {
14630
- var _a2;
14631
14631
  try {
14632
14632
  const response = yield this.fetchAndMergeAssetsController.getAssetLink(__spreadProps(__spreadValues({}, event.detail), {
14633
14633
  assets: [event.detail.asset],
14634
14634
  extraFields: this.extraFields
14635
14635
  }));
14636
- if (response.isError || !((_a2 = response.data[0]) == null ? void 0 : _a2.imageUrl)) {
14636
+ if (response.isError) {
14637
14637
  this.formatDialog.setLoadingConfirm(false);
14638
14638
  return;
14639
14639
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orangelogic/orange-dam-content-browser-sdk",
3
- "version": "2.3.3",
3
+ "version": "2.3.4",
4
4
  "description": "OrangeDAM Content Browser SDK source code",
5
5
  "main": "./build/OrangeDAMContentBrowserSDK.min.js",
6
6
  "module": "./build/index.mjs",