@orangelogic/orange-dam-content-browser-sdk 2.2.0-beta-64 → 2.2.0-beta-65

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.
@@ -109,7 +109,7 @@
109
109
  margin-bottom: var(--cx-spacing-3x-small);
110
110
  }
111
111
  }
112
- `;var Ut=n(4413),Vt=n(579);const qt=e=>{let{loadMore:t,isLoading:n,disabled:r=!1,slot:o,disabledIndentation:i}=e;return(0,Vt.jsxs)("cx-space",{direction:"horizontal",slot:o,children:[!i&&(0,Vt.jsx)("div",{className:"browser__load-more__indentation"}),(0,Vt.jsxs)("cx-button",{variant:"text",size:"small",onClick:t,disabled:r,loading:n,className:"browser__load-more",children:[(0,Vt.jsx)("cx-icon",{name:"add",slot:"prefix"}),"More"]})]})},Ht=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Wt=(e,t)=>{if(!t)return e;const n=t.toLowerCase().split(" ").filter(Boolean),r=n.map(Ht),o=new RegExp(`(${r.join("|")})`,"gi");return e.split(o).map(((e,t)=>n.includes(e.toLowerCase())?(0,Vt.jsx)("strong",{children:e},t):e))},Kt=e=>{var t;let{allowedFolders:n,folder:r,currentFolderID:o,icon:i,searchText:a,useSession:s,damViewSeeThru:l}=e;const[c,u]=(0,wt.useState)(!1),[d,h]=(0,wt.useState)(!1),[p,f]=(0,wt.useState)({start:0,pageSize:Ut.VH}),m=(0,wt.useRef)(null),g=o===r.id,{data:v,isFetching:b,isLoading:y}=(0,Rt.Jz)({allowedFolders:n,folder:r,searchText:"",useSession:s,start:p.start,pageSize:p.pageSize,damViewSeeThru:l},{skip:!d}),x=(0,wt.useMemo)((()=>{var e;return null!==(e=null===v||void 0===v?void 0:v.items)&&void 0!==e?e:void 0}),[v]),w=null!==(t=null===v||void 0===v?void 0:v.totalCount)&&void 0!==t?t:0,S=(0,wt.useCallback)((()=>{const e=(null===x||void 0===x?void 0:x.length)||0;e>=w||f((t=>({...t,start:e})))}),[null===x||void 0===x?void 0:x.length,w]);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-tree-item")]).then((()=>{u(!0)}))}),[c]),(0,wt.useEffect)((()=>{const e=m.current;if(!e)return;const t=()=>{h(!0)},n=e=>{e.detail.target===m.current&&h(!1)};return e.addEventListener("cx-lazy-load",t),e.addEventListener("cx-expand",t),e.addEventListener("cx-collapse",n),()=>{e.removeEventListener("cx-lazy-load",t),e.removeEventListener("cx-expand",t),e.removeEventListener("cx-collapse",n)}}),[c]);const k=(0,wt.useMemo)((()=>{let e;return e=i||("Album"===r.docType?"share":"folder"),e}),[r.docType,i]),_=r.hasChildren&&(void 0===x||b);return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsxs)("cx-tree-item",{ref:m,"data-value":JSON.stringify(r),expanded:d,selected:g,lazy:_,children:[(0,Vt.jsx)("cx-icon",{name:k}),(0,Vt.jsx)("cx-line-clamp",{lines:1,children:Wt(r.title,a)}),null===x||void 0===x?void 0:x.map((e=>(0,Vt.jsx)(Kt,{folder:e,searchText:a,currentFolderID:o,damViewSeeThru:l},e.id)))]}),x&&x.length<w&&!y&&(0,Vt.jsx)(qt,{loadMore:S,isLoading:b,disabled:b})]})},$t=Kt;var Qt=n(1158);const Xt=e=>{switch(e){case Qt.zu.Audio:return"audio_file";case Qt.zu.Album:return"album";case Qt.zu.Widget:return"widgets";case Qt.zu.Multimedia:return"perm_media";case Qt.zu.Story:return"article";case Qt.zu.Video:return"video_file";case Qt.zu.Image:return"photo";default:return"file"}},Gt=e=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e).replace(/'/g,"%27").replace(/"/g,"%22")}`,Zt={id:"",title:"My Favorites",docType:"Story",path:[],parents:[],fullPath:"My Favorites",hasChildren:!1},Yt=e=>{var t,n;let{allowedFolders:r,allowPin:o,collectionPath:i,currentFolder:a,favoriteFolderId:s,focusInput:l,lastLocationMode:c,open:u,showCollections:d,showFavoriteFolder:h,useSession:p,onFolderSelect:f,onClose:m,isPersistent:g,onChangePersistent:v,forceOverlay:b,damViewSeeThru:y}=e;const[x,w]=(0,wt.useState)(""),[S,k]=(0,wt.useState)(!1),[_,C]=(0,wt.useState)(!1),[E,A]=(0,wt.useState)(!1),[T,O]=(0,wt.useState)({start:0,pageSize:Ut.VH}),[P,z]=(0,wt.useState)({start:0,pageSize:Ut.VH}),D=(0,wt.useRef)(null),R=(0,wt.useRef)(null),j=(0,wt.useRef)(null),N=(0,wt.useRef)(null),I=(0,wt.useRef)(!0);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-drawer"),customElements.whenDefined("cx-input"),customElements.whenDefined("cx-tree")]).then((()=>{k(!0)}))}),[]),(0,wt.useEffect)((()=>{const e=j.current;if(!e)return;const t=ke((e=>{const t=e.target.value;x!==t&&(t.length>2||0===t.length)&&w(t)}),500);return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[S,x]),(0,wt.useEffect)((()=>{const e=R.current;if(!e)return;const t=()=>{m(),v(!1)};return e.addEventListener("cx-request-close",t),()=>{e.removeEventListener("cx-request-close",t)}}),[S,m,v]);const{data:M,isLoading:F,isFetching:L,isError:B}=(0,Rt.Jz)({allowedFolders:r,folder:Nt,searchText:x,useSession:p,start:T.start,pageSize:T.pageSize}),{data:U}=(0,Rt.Jz)({allowedFolders:r,folder:{...Zt,id:null!==s&&void 0!==s?s:""},searchText:"",useSession:p,self:!0,includeDirectChild:!1,damViewSeeThru:y},{skip:!s}),V=(0,wt.useMemo)((()=>{var e;return null!==(e=null===M||void 0===M?void 0:M.items)&&void 0!==e?e:void 0}),[M]),q=null!==(t=null===M||void 0===M?void 0:M.totalCount)&&void 0!==t?t:0,H=(0,wt.useCallback)((()=>{if(!V)return;const e=V.length;e>=q||(C(!0),O((t=>({...t,start:e}))))}),[V,q]);(0,wt.useEffect)((()=>{const e=()=>{if(!V)return;if(r&&r.length>0){const e=V.find((e=>r.includes(e.id)));if(e)return void f(e)}const e=V.find((e=>e.title===Dt.mT));f(e||Nt)};I.current&&V&&(I.current=!1,c?(0,Mt.bQ)("lastLocation").then((t=>{if("string"===typeof t)try{const n=JSON.parse(t);if(n.id===s&&!h||r&&r.length>0)return void e();f(n)}catch(n){e()}else e()})).catch((()=>{e()})):e())}),[r,s,V,c,f,h]);const{data:W,isLoading:K,isFetching:$,isError:Q}=(0,Rt.$Y)(i?{folder:i,searchText:x,useSession:p,start:P.start,pageSize:P.pageSize}:Ft.hT),X=(0,wt.useMemo)((()=>{var e;return null!==(e=null===W||void 0===W?void 0:W.items)&&void 0!==e?e:void 0}),[W]),G=null!==(n=null===W||void 0===W?void 0:W.totalCount)&&void 0!==n?n:0,Z=(0,wt.useCallback)((()=>{if(!X)return;A(!0);const e=X.length;e>=G||z((t=>({...t,start:e})))}),[X,G]);(0,wt.useEffect)((()=>{const e=N.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.selection[0].dataset.value)&&void 0!==t?t:"{}");null===f||void 0===f||f(n)};return e.addEventListener("cx-selection-change",t),()=>{e.removeEventListener("cx-selection-change",t)}}),[S,f]),(0,wt.useEffect)((()=>{const e=D.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.item.value)&&void 0!==t?t:"{}");null===f||void 0===f||f(n)};return e.addEventListener("cx-select",t),()=>{e.removeEventListener("cx-select",t)}}),[S,X,f]),(0,wt.useEffect)((()=>{L||C(!1)}),[L]),(0,wt.useEffect)((()=>{$||A(!1)}),[$]);const Y=(0,wt.useCallback)((()=>{if(F||L&&!_)return Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t)));if(V&&V.length>0){const o=[];var e,t,n;if(s)o.push((0,Vt.jsx)($t,{folder:{...Zt,id:s,hasChildren:null!==(e=null===U||void 0===U||null===(t=U.items)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.hasChildren)&&void 0!==e&&e},currentFolderID:a.id,icon:"star",useSession:p,damViewSeeThru:y},s));return[...o,...(null!==V&&void 0!==V?V:[]).map((e=>(0,Vt.jsx)($t,{allowedFolders:r,folder:e,currentFolderID:a.id,searchText:x,useSession:p,damViewSeeThru:y},e.id)))]}return B?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load folders"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No folders found"})}),[r,a.id,s,V,B,L,F,x,p,_,U,y]),J=(0,wt.useCallback)((()=>K||$&&!E?Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t))):X&&X.length>0?null===X||void 0===X?void 0:X.map((e=>{const t=a.id===e.id;return(0,Vt.jsxs)("cx-menu-item",{value:JSON.stringify(e),className:""+(t?"selected":""),children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"collections"}),Wt(e.title,x)]},e.id)})):Q?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load collections"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No collections found"})),[K,$,X,Q,a.id,x,E]),ee={persistent:{src:Gt('<svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="#52525B"\n >\n <path d="M660-320v-320L500-480l160 160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Zm-80 0H200h120Z" />\n </svg>'),onclick:()=>{m(),v(!1)}},overlay:{src:Gt('<svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="#52525B"\n >\n <path d="M500-640v320l160-160-160-160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Zm-80 0H200h120Z" />\n </svg>'),onclick:()=>v(!0)}},te=g?ee.persistent:ee.overlay,ne=b||!g?"overlay":"persistent",re=!b&&g;return(0,Vt.jsxs)(Bt,{ref:R,label:"Browser",placement:"start",contained:!0,open:u,variant:ne,noCloseButton:re,children:[!b&&o?(0,Vt.jsx)("cx-icon-button",{slot:"header-actions",...te}):null,(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",wrap:"nowrap",children:[(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",style:{padding:"var(--body-spacing) var(--body-spacing) 0"},children:[(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Folders"}),(0,Vt.jsx)("cx-input",{ref:j,value:x,placeholder:"Search...",clearable:!0,autoFocus:l,className:"search-input",children:(0,Vt.jsx)("cx-icon",{name:"search",slot:"prefix",className:"icon--large"})}),(0,Vt.jsx)("div",{className:"browser__folders",children:(0,Vt.jsxs)("cx-tree",{ref:N,"force-on-change":!0,children:[Y(),V&&V.length<q&&!F&&(0,Vt.jsx)(qt,{loadMore:H,isLoading:L,disabled:L})]})})]}),d&&(0,Vt.jsx)("div",{className:"browser__collections",children:(0,Vt.jsxs)("cx-details",{children:[(0,Vt.jsx)("cx-typography",{slot:"summary",variant:"body3",children:"Collections"}),(0,Vt.jsxs)("cx-menu",{ref:D,className:"browser__collections__menu",children:[J(),X&&X.length<G&&!K&&(0,Vt.jsx)(qt,{loadMore:Z,isLoading:$,disabled:$,disabledIndentation:!0})]})]})})]})]})},Jt=[{label:"Ascending",value:"ascending",icon:()=>(0,Vt.jsxs)("svg",{slot:"prefix",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Vt.jsx)("path",{d:"M3.33333 4.7619L4.25984 5.68841L6.60714 3.33929V11.3095H7.61905V3.33929L9.96627 5.68841L10.8929 4.7619L6.96429 0.833333L3.33333 4.7619Z",fill:"currentColor"}),(0,Vt.jsx)("path",{opacity:"0.3",d:"M17.0833 15.2381L16.1568 14.3116L13.8095 16.6607V8.69048H12.7976V16.6607L10.4504 14.3116L9.52381 15.2381L13.4524 19.1667L17.0833 15.2381Z",fill:"currentColor"})]})},{label:"Descending",value:"descending",icon:()=>(0,Vt.jsxs)("svg",{slot:"prefix",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Vt.jsx)("path",{opacity:"0.3",d:"M3.33333 4.7619L4.25984 5.68841L6.60714 3.33929V11.3095H7.61905V3.33929L9.96627 5.68841L10.8929 4.7619L6.96429 0.833333L3.33333 4.7619Z",fill:"currentColor"}),(0,Vt.jsx)("path",{d:"M17.0833 15.2381L16.1568 14.3116L13.8095 16.6607V8.69048H12.7976V16.6607L10.4504 14.3116L9.52381 15.2381L13.4524 19.1667L17.0833 15.2381Z",fill:"currentColor"})]})}],en=[{value:Qt.gf.Small,label:"Small labeled"},{value:Qt.gf.Medium,label:"Medium labeled"},{value:Qt.gf.Large,label:"Large labeled"}],tn=Lt.Ay.div`
112
+ `;var Ut=n(4413),Vt=n(579);const qt=e=>{let{loadMore:t,isLoading:n,disabled:r=!1,slot:o,disabledIndentation:i}=e;return(0,Vt.jsxs)("cx-space",{direction:"horizontal",slot:o,children:[!i&&(0,Vt.jsx)("div",{className:"browser__load-more__indentation"}),(0,Vt.jsxs)("cx-button",{variant:"text",size:"small",onClick:t,disabled:r,loading:n,className:"browser__load-more",children:[(0,Vt.jsx)("cx-icon",{name:"add",slot:"prefix"}),"More"]})]})},Ht=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Wt=(e,t)=>{if(!t)return e;const n=t.toLowerCase().split(" ").filter(Boolean),r=n.map(Ht),o=new RegExp(`(${r.join("|")})`,"gi");return e.split(o).map(((e,t)=>n.includes(e.toLowerCase())?(0,Vt.jsx)("strong",{children:e},t):e))},Kt=e=>{var t;let{allowedFolders:n,folder:r,currentFolderID:o,icon:i,searchText:a,useSession:s,damViewSeeThru:l,isBrowserOpen:c}=e;const[u,d]=(0,wt.useState)(!1),[h,p]=(0,wt.useState)(!1),[f,m]=(0,wt.useState)({start:0,pageSize:Ut.VH}),g=(0,wt.useRef)(null),v=o===r.id,{data:b,isFetching:y,isLoading:x}=(0,Rt.Jz)({allowedFolders:n,folder:r,searchText:"",useSession:s,start:f.start,pageSize:f.pageSize,damViewSeeThru:l},{skip:!h||!c}),w=(0,wt.useMemo)((()=>{var e;return null!==(e=null===b||void 0===b?void 0:b.items)&&void 0!==e?e:void 0}),[b]),S=null!==(t=null===b||void 0===b?void 0:b.totalCount)&&void 0!==t?t:0,k=(0,wt.useCallback)((()=>{const e=(null===w||void 0===w?void 0:w.length)||0;e>=S||m((t=>({...t,start:e})))}),[null===w||void 0===w?void 0:w.length,S]);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-tree-item")]).then((()=>{d(!0)}))}),[u]),(0,wt.useEffect)((()=>{const e=g.current;if(!e)return;const t=()=>{p(!0)},n=e=>{e.detail.target===g.current&&p(!1)};return e.addEventListener("cx-lazy-load",t),e.addEventListener("cx-expand",t),e.addEventListener("cx-collapse",n),()=>{e.removeEventListener("cx-lazy-load",t),e.removeEventListener("cx-expand",t),e.removeEventListener("cx-collapse",n)}}),[u]);const _=(0,wt.useMemo)((()=>{let e;return e=i||("Album"===r.docType?"share":"folder"),e}),[r.docType,i]),C=r.hasChildren&&(void 0===w||y);return(0,Vt.jsxs)(Vt.Fragment,{children:[(0,Vt.jsxs)("cx-tree-item",{ref:g,"data-value":JSON.stringify(r),expanded:h,selected:v,lazy:C,children:[(0,Vt.jsx)("cx-icon",{name:_}),(0,Vt.jsx)("cx-line-clamp",{lines:1,children:Wt(r.title,a)}),null===w||void 0===w?void 0:w.map((e=>(0,Vt.jsx)(Kt,{folder:e,searchText:a,currentFolderID:o,damViewSeeThru:l,isBrowserOpen:c},e.id)))]}),w&&w.length<S&&!x&&(0,Vt.jsx)(qt,{loadMore:k,isLoading:y,disabled:y})]})},$t=Kt;var Qt=n(1158);const Xt=e=>{switch(e){case Qt.zu.Audio:return"audio_file";case Qt.zu.Album:return"album";case Qt.zu.Widget:return"widgets";case Qt.zu.Multimedia:return"perm_media";case Qt.zu.Story:return"article";case Qt.zu.Video:return"video_file";case Qt.zu.Image:return"photo";default:return"file"}},Gt=e=>`data:image/svg+xml;charset=utf-8,${encodeURIComponent(e).replace(/'/g,"%27").replace(/"/g,"%22")}`,Zt={id:"",title:"My Favorites",docType:"Story",path:[],parents:[],fullPath:"My Favorites",hasChildren:!1},Yt=e=>{var t,n;let{allowedFolders:r,allowPin:o,collectionPath:i,currentFolder:a,favoriteFolderId:s,focusInput:l,lastLocationMode:c,open:u,showCollections:d,showFavoriteFolder:h,useSession:p,onFolderSelect:f,onClose:m,isPersistent:g,onChangePersistent:v,forceOverlay:b,damViewSeeThru:y}=e;const[x,w]=(0,wt.useState)(""),[S,k]=(0,wt.useState)(!1),[_,C]=(0,wt.useState)(!1),[E,A]=(0,wt.useState)(!1),[T,O]=(0,wt.useState)({start:0,pageSize:Ut.VH}),[P,z]=(0,wt.useState)({start:0,pageSize:Ut.VH}),D=(0,wt.useRef)(null),R=(0,wt.useRef)(null),j=(0,wt.useRef)(null),N=(0,wt.useRef)(null),I=(0,wt.useRef)(!0);(0,wt.useEffect)((()=>{Promise.all([customElements.whenDefined("cx-drawer"),customElements.whenDefined("cx-input"),customElements.whenDefined("cx-tree")]).then((()=>{k(!0)}))}),[]),(0,wt.useEffect)((()=>{const e=j.current;if(!e)return;const t=ke((e=>{const t=e.target.value;x!==t&&(t.length>2||0===t.length)&&w(t)}),500);return e.addEventListener("cx-input",t),()=>{e.removeEventListener("cx-input",t)}}),[S,x]),(0,wt.useEffect)((()=>{const e=R.current;if(!e)return;const t=()=>{m(),v(!1)};return e.addEventListener("cx-request-close",t),()=>{e.removeEventListener("cx-request-close",t)}}),[S,m,v]);const{data:M,isLoading:F,isFetching:L,isError:B}=(0,Rt.Jz)({allowedFolders:r,folder:Nt,searchText:x,useSession:p,start:T.start,pageSize:T.pageSize,damViewSeeThru:y},{skip:!u}),{data:U}=(0,Rt.Jz)({allowedFolders:r,folder:{...Zt,id:null!==s&&void 0!==s?s:""},searchText:"",useSession:p,self:!0,includeDirectChild:!1,damViewSeeThru:y},{skip:!s||!u}),V=(0,wt.useMemo)((()=>{var e;return null!==(e=null===M||void 0===M?void 0:M.items)&&void 0!==e?e:void 0}),[M]),q=null!==(t=null===M||void 0===M?void 0:M.totalCount)&&void 0!==t?t:0,H=(0,wt.useCallback)((()=>{if(!V)return;const e=V.length;e>=q||(C(!0),O((t=>({...t,start:e}))))}),[V,q]);(0,wt.useEffect)((()=>{const e=()=>{if(!V)return;if(r&&r.length>0){const e=V.find((e=>r.includes(e.id)));if(e)return void f(e)}const e=V.find((e=>e.title===Dt.mT));f(e||Nt)};I.current&&V&&(I.current=!1,c?(0,Mt.bQ)("lastLocation").then((t=>{if("string"===typeof t)try{const n=JSON.parse(t);if(n.id===s&&!h||r&&r.length>0)return void e();f(n)}catch(n){e()}else e()})).catch((()=>{e()})):e())}),[r,s,V,c,f,h]);const{data:W,isLoading:K,isFetching:$,isError:Q}=(0,Rt.$Y)(i?{folder:i,searchText:x,useSession:p,start:P.start,pageSize:P.pageSize}:Ft.hT),X=(0,wt.useMemo)((()=>{var e;return null!==(e=null===W||void 0===W?void 0:W.items)&&void 0!==e?e:void 0}),[W]),G=null!==(n=null===W||void 0===W?void 0:W.totalCount)&&void 0!==n?n:0,Z=(0,wt.useCallback)((()=>{if(!X)return;A(!0);const e=X.length;e>=G||z((t=>({...t,start:e})))}),[X,G]);(0,wt.useEffect)((()=>{const e=N.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.selection[0].dataset.value)&&void 0!==t?t:"{}");null===f||void 0===f||f(n)};return e.addEventListener("cx-selection-change",t),()=>{e.removeEventListener("cx-selection-change",t)}}),[S,f]),(0,wt.useEffect)((()=>{const e=D.current;if(!e)return;const t=e=>{var t;const n=JSON.parse(null!==(t=e.detail.item.value)&&void 0!==t?t:"{}");null===f||void 0===f||f(n)};return e.addEventListener("cx-select",t),()=>{e.removeEventListener("cx-select",t)}}),[S,X,f]),(0,wt.useEffect)((()=>{L||C(!1)}),[L]),(0,wt.useEffect)((()=>{$||A(!1)}),[$]);const Y=(0,wt.useCallback)((()=>{if(F||L&&!_)return Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t)));if(V&&V.length>0){const o=[];var e,t,n;if(s)o.push((0,Vt.jsx)($t,{folder:{...Zt,id:s,hasChildren:null!==(e=null===U||void 0===U||null===(t=U.items)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.hasChildren)&&void 0!==e&&e},currentFolderID:a.id,icon:"star",useSession:p,damViewSeeThru:y,isBrowserOpen:u},s));return[...o,...(null!==V&&void 0!==V?V:[]).map((e=>(0,Vt.jsx)($t,{allowedFolders:r,folder:e,currentFolderID:a.id,searchText:x,useSession:p,damViewSeeThru:y,isBrowserOpen:u},e.id)))]}return B?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load folders"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No folders found"})}),[r,a.id,s,V,B,L,F,x,p,_,U,y,u]),J=(0,wt.useCallback)((()=>K||$&&!E?Array.from({length:5}).map(((e,t)=>(0,Vt.jsx)("cx-skeleton",{},t))):X&&X.length>0?null===X||void 0===X?void 0:X.map((e=>{const t=a.id===e.id;return(0,Vt.jsxs)("cx-menu-item",{value:JSON.stringify(e),className:""+(t?"selected":""),children:[(0,Vt.jsx)("cx-icon",{slot:"prefix",name:"collections"}),Wt(e.title,x)]},e.id)})):Q?(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Failed to load collections"}):(0,Vt.jsx)("cx-typography",{variant:"body3",children:"No collections found"})),[K,$,X,Q,a.id,x,E]),ee={persistent:{src:Gt('<svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="#52525B"\n >\n <path d="M660-320v-320L500-480l160 160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Zm-80 0H200h120Z" />\n </svg>'),onclick:()=>{m(),v(!1)}},overlay:{src:Gt('<svg\n xmlns="http://www.w3.org/2000/svg"\n height="24px"\n viewBox="0 -960 960 960"\n width="24px"\n fill="#52525B"\n >\n <path d="M500-640v320l160-160-160-160ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm120-80v-560H200v560h120Zm80 0h360v-560H400v560Zm-80 0H200h120Z" />\n </svg>'),onclick:()=>v(!0)}},te=g?ee.persistent:ee.overlay,ne=b||!g?"overlay":"persistent",re=!b&&g;return(0,Vt.jsxs)(Bt,{ref:R,label:"Browser",placement:"start",contained:!0,open:u,variant:ne,noCloseButton:re,children:[!b&&o?(0,Vt.jsx)("cx-icon-button",{slot:"header-actions",...te}):null,(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",wrap:"nowrap",children:[(0,Vt.jsxs)("cx-space",{direction:"vertical",spacing:"small",style:{padding:"var(--body-spacing) var(--body-spacing) 0"},children:[(0,Vt.jsx)("cx-typography",{variant:"body3",children:"Folders"}),(0,Vt.jsx)("cx-input",{ref:j,value:x,placeholder:"Search...",clearable:!0,autoFocus:l,className:"search-input",children:(0,Vt.jsx)("cx-icon",{name:"search",slot:"prefix",className:"icon--large"})}),(0,Vt.jsx)("div",{className:"browser__folders",children:(0,Vt.jsxs)("cx-tree",{ref:N,"force-on-change":!0,children:[Y(),V&&V.length<q&&!F&&(0,Vt.jsx)(qt,{loadMore:H,isLoading:L,disabled:L})]})})]}),d&&(0,Vt.jsx)("div",{className:"browser__collections",children:(0,Vt.jsxs)("cx-details",{children:[(0,Vt.jsx)("cx-typography",{slot:"summary",variant:"body3",children:"Collections"}),(0,Vt.jsxs)("cx-menu",{ref:D,className:"browser__collections__menu",children:[J(),X&&X.length<G&&!K&&(0,Vt.jsx)(qt,{loadMore:Z,isLoading:$,disabled:$,disabledIndentation:!0})]})]})})]})]})},Jt=[{label:"Ascending",value:"ascending",icon:()=>(0,Vt.jsxs)("svg",{slot:"prefix",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Vt.jsx)("path",{d:"M3.33333 4.7619L4.25984 5.68841L6.60714 3.33929V11.3095H7.61905V3.33929L9.96627 5.68841L10.8929 4.7619L6.96429 0.833333L3.33333 4.7619Z",fill:"currentColor"}),(0,Vt.jsx)("path",{opacity:"0.3",d:"M17.0833 15.2381L16.1568 14.3116L13.8095 16.6607V8.69048H12.7976V16.6607L10.4504 14.3116L9.52381 15.2381L13.4524 19.1667L17.0833 15.2381Z",fill:"currentColor"})]})},{label:"Descending",value:"descending",icon:()=>(0,Vt.jsxs)("svg",{slot:"prefix",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,Vt.jsx)("path",{opacity:"0.3",d:"M3.33333 4.7619L4.25984 5.68841L6.60714 3.33929V11.3095H7.61905V3.33929L9.96627 5.68841L10.8929 4.7619L6.96429 0.833333L3.33333 4.7619Z",fill:"currentColor"}),(0,Vt.jsx)("path",{d:"M17.0833 15.2381L16.1568 14.3116L13.8095 16.6607V8.69048H12.7976V16.6607L10.4504 14.3116L9.52381 15.2381L13.4524 19.1667L17.0833 15.2381Z",fill:"currentColor"})]})}],en=[{value:Qt.gf.Small,label:"Small labeled"},{value:Qt.gf.Medium,label:"Medium labeled"},{value:Qt.gf.Large,label:"Large labeled"}],tn=Lt.Ay.div`
113
113
  display: flex;
114
114
  justify-content: space-between;
115
115
  flex-wrap: wrap;