@scaleflex/asset-picker 1.0.3 → 1.0.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.
Files changed (31) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/README.md +2 -2
  3. package/dist/{asset-picker-BPtXtAqM.cjs → asset-picker-cnvFGhJa.cjs} +276 -251
  4. package/dist/{asset-picker-BEueJ2xy.js → asset-picker-dDQ9kiNT.js} +1581 -1529
  5. package/dist/components/filters/ap-filter-approval.d.ts.map +1 -1
  6. package/dist/components/filters/ap-filter-color.d.ts.map +1 -1
  7. package/dist/components/filters/ap-filter-labels.d.ts.map +1 -1
  8. package/dist/components/filters/ap-filter-metadata.d.ts.map +1 -1
  9. package/dist/components/filters/ap-filter-product-ref.d.ts.map +1 -1
  10. package/dist/components/header/ap-header.d.ts.map +1 -1
  11. package/dist/components/header/ap-regional-settings.d.ts.map +1 -1
  12. package/dist/components/preview/ap-preview-panel.d.ts.map +1 -1
  13. package/dist/components/selection/ap-marquee-overlay.d.ts.map +1 -1
  14. package/dist/components/shared/ap-dropdown.d.ts.map +1 -1
  15. package/dist/components/shared/ap-icon.d.ts.map +1 -1
  16. package/dist/components/shared/ap-spinner.d.ts.map +1 -1
  17. package/dist/components/toolbar/ap-content-toolbar.d.ts.map +1 -1
  18. package/dist/components/views/ap-asset-row.d.ts.map +1 -1
  19. package/dist/components/views/ap-folder-row.d.ts.map +1 -1
  20. package/dist/components/views/ap-grid-view.d.ts.map +1 -1
  21. package/dist/components/views/ap-label-card.d.ts.map +1 -1
  22. package/dist/components/views/ap-label-row.d.ts.map +1 -1
  23. package/dist/components/views/ap-list-view.d.ts.map +1 -1
  24. package/dist/components/views/ap-skeleton.d.ts.map +1 -1
  25. package/dist/define.cjs +1 -1
  26. package/dist/define.js +1 -1
  27. package/dist/index.cjs +1 -1
  28. package/dist/index.js +1 -1
  29. package/dist/utils/csp-style.d.ts +17 -0
  30. package/dist/utils/csp-style.d.ts.map +1 -0
  31. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- "use strict";var ki=Object.create;var Bs=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Ci=Object.getOwnPropertyNames;var Fi=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty;var Ai=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ci(e))!Ei.call(t,a)&&a!==s&&Bs(t,a,{get:()=>e[a],enumerable:!(i=Si(e,a))||i.enumerable});return t};var Ti=(t,e,s)=>(s=t!=null?ki(Fi(t)):{},Ai(e||!t||!t.__esModule?Bs(s,"default",{value:t,enumerable:!0}):s,t));const r=require("lit"),l=require("lit/decorators.js");class Li{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Oi(){return new Li({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",isAISearchActive:!1,sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],activeLabelUuid:null,collections:[],activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},fileTypes:[],metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Mi{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Ii(t){return"extension"in t&&!("path"in t)}class Pi{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const o=this._getCombinedList();for(let n=e;n<=s;n++){const c=o[n];c&&(Ii(c)?i.set(c.uuid,c):a.set(c.uuid,c))}}handleSelect(e,s,i){var c,d,h,u;const a=this.store.getState(),o=new Map(a.selectedAssets);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=new Map(a.selectedFolders);this._applyRangeSelection(g,p,o,f);const m=(d=a.config)==null?void 0:d.maxSelections;if(m&&o.size+f.size>m)return;this.store.setState({selectedAssets:o,selectedFolders:f})}else{const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=a.assets;for(let x=g;x<=p;x++)f[x]&&o.set(f[x].uuid,f[x]);const m=(h=a.config)==null?void 0:h.maxSelections;if(m&&o.size>m)return;this.store.setState({selectedAssets:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const g=(u=a.config)==null?void 0:u.maxSelections,p=o.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(g&&p>g)return;this.store.setState({selectedAssets:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var c,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),o=new Map(a.selectedFolders);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),g=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,g,p,o);const f=(d=a.config)==null?void 0:d.maxSelections;if(f&&p.size+o.size>f)return;this.store.setState({selectedAssets:p,selectedFolders:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,g=o.size+a.selectedAssets.size;if(u&&g>u)return;this.store.setState({selectedFolders:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var c;const s=this.store.getState(),i=(c=s.config)==null?void 0:c.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,o=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)o.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:o}),this.lastClickedIndex=-1,o.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,o=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let c=0;c<o;c++)a.set(e[c].uuid,e[c]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class Di{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const qs=5,Je=40,Vs=15;class zi{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){var a;if(e.button!==0||this.isInteractiveTarget(e)||!(((a=this.store.getState().config)==null?void 0:a.multiSelect)??!0))return;const i=this.container.getBoundingClientRect();this.startX=e.clientX-i.left+this.container.scrollLeft,this.startY=e.clientY-i.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<qs&&a<qs)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let o=Math.min(this.startX,i),n=Math.min(this.startY,a),c=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;o+c>h&&(c=h-o),n+d>u&&(d=u-n),o<0&&(c+=o,o=0),n<0&&(d+=n,n=0),this.rect={x:o,y:n,width:c,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,o=i<Je||a<Je;o&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):o||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let o=0;i<Je?o=-Vs*(1-i/Je):a<Je&&(o=Vs*(1-a/Je)),o!==0&&(this.container.scrollTop+=o,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const o=i.shadowRoot.querySelectorAll("[data-folder-uuid]");o.length>0&&s.push(...Array.from(o))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),o=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.assetUuid;if(this.intersectsMarquee(p)){const m=e.assets.find(x=>x.uuid===f);m&&o.set(f,m)}}),s&&a.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.folderUuid;if(this.intersectsMarquee(p)){const m=e.folders.find(x=>x.uuid===f);m&&n.set(f,m)}});const c=(u=e.config)==null?void 0:u.maxSelections,d=o.size+(s?n.size:0);if(c&&d>c){const g=Array.from(o.entries()).slice(0,Math.max(0,c-n.size));this.store.setState({selectedAssets:new Map(g),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:o,...s?{selectedFolders:n}:{}})}}class Ri{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function ji(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const o=[];return t.search&&!t.with_ai&&o.push(t.search),t.q&&o.push(t.q),o.length>0&&(e.q=o.join(" ")),t.with_ai&&(e.with_ai=!0,t.ai_query&&(e.ai_query=t.ai_query),t.ai_lang&&(e.ai_lang=t.ai_lang)),t.collection_uuid&&(e.collection_uuid=t.collection_uuid),t.f64&&(e.f64=t.f64),e}async function De(t,e){const s=ji(e);return t.request("/files",s)}async function At(t,e){const s={recursive:e.recursive??1};e.folder&&(s.folder=e.folder);const i=[];return e.search&&!e.with_ai&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),e.with_ai&&(s.with_ai=!0,e.ai_query&&(s.ai_query=e.ai_query),e.ai_lang&&(s.ai_lang=e.ai_lang)),e.collection_uuid&&(s.collection_uuid=e.collection_uuid),e.f64&&(s.f64=e.f64),t.request("/files/stats",s)}async function Ni(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",o={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${o[i]||i}:${a}`,await t.request("/folders",s)}async function Ui(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Bi(t){return await t.request("/labels")}async function qi(t){return t.request("/collections")}async function Vi(t,e){return t.request(`/collections/${e}/folders`)}function ei(t){return t.filter(e=>!!e.name).map(e=>({...e,children:ei(e.children??[])})).filter(e=>{var s;return!((((s=e.children)==null?void 0:s.length)??0)<1&&!e.filters)})}async function Hi(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function Gi(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}function Vt(t){var a,o;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(o=e[0])==null?void 0:o.playlists;return s!=null&&s.length&&s[0]||null}function je(t){return(t.type??"").startsWith("image")}function Ki(t){return(t.type??"").startsWith("video")}function Qi(t){return(t.type??"").startsWith("audio")}function ti(t){var e,s;return((e=t.url)==null?void 0:e.cdn)??((s=t.url)==null?void 0:s.public)??""}function Yi(t,e){const{meta:s,name:i}=t;if(s!=null&&s.alt)return s.alt;const a=s==null?void 0:s.title;if(typeof a=="string"&&a)return a;if(a&&typeof a=="object"){if(e){const n=a[e];if(n)return n}const o=Object.keys(a)[0];if(o){const n=a[o];if(n)return n}}return i.split(".")[0]}function Pt(t){var e,s;return((e=t.info)==null?void 0:e.img_w)??((s=t.info)==null?void 0:s.video_w)??0}function Dt(t){var e,s;return((e=t.info)==null?void 0:e.img_h)??((s=t.info)==null?void 0:s.video_h)??0}function Wi(t){return{width:Pt(t),height:Dt(t)}}function Xi(t){return Vt(t)!==null}function Zi(t){return Vt(t)}function Ji(t){return Vt(t)??ti(t)}const ea={excellent:90,good:75,fair:60},ta=[{label:"WEBP",value:"webp"},{label:"JPEG",value:"jpeg"},{label:"PNG",value:"png"},{label:"GIF",value:"gif"}],sa=[{label:"Excellent",value:"excellent"},{label:"Good",value:"good"},{label:"Fair",value:"fair"}],ia=[{label:"Original",value:"original"},{label:"Full HD",value:"full_hd",width:1920},{label:"Large",value:"large",width:1200},{label:"Medium",value:"medium",width:600},{label:"Small",value:"small",width:300}],aa={webp:"awebp,webp",jpeg:"jpeg",png:"png",gif:"agif,gif"},oa=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),ra=new Set([...oa,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function tt(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function si(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return ra.has(e)}const v="https://scaleflex.cloudimg.io/v7/assets/file-types/v3/",cs={_default:v+"GENERIC.svg?vh=9a518a",png:v+"PNG.svg?vh=96cd9a",jpg:v+"JPG.svg?vh=06e819",jpg2:v+"JPG2.svg?vh=f0eb7f",jpeg:v+"JPEG.svg?vh=6a65e9",gif:v+"GIF.svg?vh=c3c2c3",bmp:v+"BMP.svg?vh=d2243a",webp:v+"WEBP.svg?vh=fedd74",svg:v+"SVG.svg?vh=a15e46",tiff:v+"TIFF.svg?vh=1f30c3",tif:v+"TIF.svg?vh=b383c9",heic:v+"HEIC.svg?vh=84adfe",avif:v+"AVIF.svg?vh=536b30",ico:v+"ICO.svg?vh=79063d",psd:v+"PSD.svg?vh=be6140",psb:v+"PSB.svg?vh=678646",ai:v+"AI.svg?vh=84b254",dwg:v+"DWG.svg?vh=971fb3",mp4:v+"MP4.svg?vh=42f175",webm:v+"WEBM.svg?vh=26a84a",avi:v+"AVI.svg?vh=d22ba8",mpeg:v+"MPEG.svg?vh=ba93bb",ogv:v+"OGV.svg?vh=74d453","3gp":v+"3GP.svg?vh=f0d388","3g2":v+"3G2.svg?vh=04c652",swf:v+"SWF.svg?vh=3955e2",fla:v+"FLA.svg?vh=daf585",m3u8:v+"M3U8.svg?vh=7d5e62",mp3:v+"MP3.svg?vh=66bbef",wav:v+"WAV.svg?vh=d7a7d5",aac:v+"AAC.svg?vh=07f3f9",oga:v+"OGA.svg?vh=a5c622",opus:v+"OPUS.svg?vh=9548b1",weba:v+"WEBA.svg?vh=4dcf70",mid:v+"MID.svg?vh=3f0e29",midi:v+"MIDI.svg?vh=9fedec",cda:v+"CDA.svg?vh=85b83b",pdf:v+"PDF.svg?vh=18c5f7",doc:v+"DOC.svg?vh=d1b47c",docx:v+"DOCX.svg?vh=1eb6b0",txt:v+"TXT.svg?vh=307979",rtf:v+"RTF.svg?vh=978c5f",xls:v+"XLS.svg?vh=13b5f7",xlsx:v+"XLSX.svg?vh=79d64a",ppt:v+"PPT.svg?vh=4ee29b",pptx:v+"PPTX.svg?vh=8b1568",csv:v+"CSV.svg?vh=4add78",odt:v+"ODT.svg?vh=940781",ods:v+"ODS.svg?vh=9fbe9a",odp:v+"ODP.svg?vh=bf892d",dbf:v+"DBF.svg?vh=457bd4",vsd:v+"VSD.svg?vh=8a9ccb",abw:v+"ABW.svg?vh=313dc7",epub:v+"EPUB.svg?vh=15263d",azw:v+"AZW.svg?vh=a018b1",ics:v+"ICS.svg?vh=909f63",ogx:v+"OGX.svg?vh=f694d2",zip:v+"ZIP.svg?vh=84f98b",rar:v+"RAR.svg?vh=1d6423","7z":v+"7Z.svg?vh=e007e5",tar:v+"TAR.svg?vh=603aed",gz:v+"GZ.svg?vh=de13f7",bz:v+"BZ.svg?vh=0374ff",bz2:v+"BZ2.svg?vh=e14294",arc:v+"ARC.svg?vh=942fad",jar:v+"JAR.svg?vh=149796",mpkg:v+"MPKG.svg?vh=dea655",ttf:v+"TTF.svg?vh=d2e2c1",otf:v+"OTF.svg?vh=c904fd",woff:v+"WOFF.svg?vh=4b8177",woff2:v+"WOFF2.svg?vh=b532d3",eot:v+"EOT.svg?vh=a54980",js:v+"JS.svg?vh=524691",mjs:v+"MJS.svg?vh=d57921",ts:v+"TS.svg?vh=9af3ae",css:v+"CSS.svg?vh=287863",html:v+"HTML.svg?vh=fa7a87",htm:v+"HTM.svg?vh=21323d",xhtml:v+"XHTML.svg?vh=e6d6a9",xul:v+"XUL.svg?vh=6c9c71",json:v+"JSON.svg?vh=104c9e",jsonld:v+"JSONLD.svg?vh=f30c0f",xml:v+"XML.svg?vh=7f7194",php:v+"PHP.svg?vh=503e36",sh:v+"SH.svg?vh=3b820e",csh:v+"CSH.svg?vh=08c0cc",exe:v+"EXE.svg?vh=ccca53",iso:v+"ISO.svg?vh=064b8f",bin:v+"BIN.svg?vh=1e9618"};function $t(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return cs[e]||cs._default}function st(){return cs._default}function Ht(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const na=new Set(["png","svg","webp","gif","avif"]);function us(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return na.has(e)}const la=new Set(["svg","svg+xml","png","pdf"]);function ii(t){return la.has(Ht(t).toLowerCase())}function zt(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return Be(s)}function ai(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?Be(s):""}function gs(t){var s,i;let e=Be(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),xe(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function xe(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const Hs=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Be(t,e){if(!t)return"";const s=a=>a.replace(/(\.filerobot\.com\/[a-z0-9_-]+)\/v\d+\//i,"$1/");if(t.includes("assets.filerobot.com"))return s(t);const i=t.match(Hs);if(i){const a=i[2],o=t.replace(Hs,`$1assets.filerobot.com/${a}/`);return s(o)}if(e)try{const a=new URL(t);return s(`https://assets.filerobot.com/${e}${a.pathname}${a.search}`)}catch{}return t}function oi(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=Be(s);const a=tt(t.file_type),o=String(window.devicePixelRatio||1);return a==="video"?xe(i,{w:e,dpr:o,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||Ht(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),xe(i,{w:e,dpr:o,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):xe(i,{w:e,dpr:o})}function fs(t,e){const s={};return t.format&&(s.force_format=aa[t.format]),t.quality&&t.format!=="png"&&(s.q=String(ea[t.quality])),t.width&&(s.w=String(t.width)),t.height&&(s.h=String(t.height)),(t.width||t.height)&&(s.org_if_sml="1",e!=null&&e.isMultiSelect?s.func="bound":(e==null?void 0:e.isAspectLocked)===!1&&(s.func="cover")),s}function ca(t,e,s){const i=Be(t);if(!i)return t;const a=fs(e,s);return Object.keys(a).length>0?xe(i,a):i}const b={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},G={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},C={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},da={AND:"AND"},$={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},Gt={[$.DATE]:"date_",[$.BOOLEAN]:"bool_",[$.NUMERIC]:"num_",[$.DECIMAL2]:"dec_",[$.ATTACHMENTS_ASSETS]:"attach_",[$.ATTACHMENT_URI]:"uri_",[$.SELECT_ONE]:"one_",[$.MULTI_SELECT]:"multi_",[$.SUPERTAGS]:"tags_",[$.TEXT]:"text_",[$.TEXT_AREA]:"area_",[$.GEO_POINT]:"geo_",[$.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(Gt).map(([t,e])=>[e,t]));const ri=Object.values(Gt),pt={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Gs={EMPTY:"empty",NOT_EMPTY:"non-empty"},re="empty",ne="non-empty",ze="specific",Jt=10,es=10,Tt=10,ni="filters:pinned:",li="metadata:pinned:",Ks=[b.DATE,b.TYPE,b.SIZE],ci=C.IS,Ot="20",Mt="1",pa=0,ha=[{key:b.DATE,label:"Date",icon:"calendar",type:"date"},{key:b.TYPE,label:"Format",icon:"file-type",type:"string"},{key:b.SIZE,label:"Size",icon:"scaling",type:"string"},{key:b.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:b.TAGS,label:"Tags",icon:"hash",type:"string"},{key:b.LABELS,label:"Labels",icon:"tag",type:"string"},{key:b.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:b.IMAGE,label:"Image",icon:"image",type:"string"},{key:b.COLOR,label:"Color",icon:"swatch-book",type:"string"}],ua={key:b.METADATA,label:"Metadata",icon:"file-text",type:"string"},ga={key:b.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},ds=[ua,...ha,ga],et={[b.TYPE]:"Format",[b.DATE]:"Date",[b.SIZE]:"Size",[b.LICENSE_EXPIRY]:"License expiry",[b.TAGS]:"Tags",[b.LABELS]:"Labels",[b.PRODUCT_REF]:"Products",[b.IMAGE]:"Image",[b.COLOR]:"Color",[b.METADATA]:"Metadata",[b.APPROVAL]:"Approval"},K={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},Rt=[{value:K.IMAGE,label:"Image",icon:"image"},{value:K.VIDEO,label:"Video",icon:"clapperboard"},{value:K.AUDIO,label:"Audio",icon:"music"},{value:K.DOCUMENT,label:"Document",icon:"document"},{value:K.ARCHIVE,label:"Archive",icon:"archive"},{value:K.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:K.FONTS,label:"Fonts",icon:"text"},{value:K.OTHER,label:"Other",icon:"layout-grid"}],fa={[K.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[K.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[K.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[K.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[K.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[K.FONTS]:["ttf","otf","woff","woff2","eot"]},ts={RESOLUTION:0,ORIENTATION:1,FACES:2},va=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ma=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],ba=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],di=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],vs=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],pi=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],_a=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],ya=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],xa=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],ss=[{label:"Is",value:C.IS},{label:"Contains",value:C.CONTAINS_IN_TEXT}],ye=[{label:"Is",value:C.IS},{label:"Is not",value:C.IS_NOT}],is=[{label:"Is",value:C.IS_EXACT},{label:"Contains",value:C.IS},{label:"Does not contain",value:C.IS_NOT}],as=[{label:"Is",value:C.IS},{label:"Greater than",value:C.GREATER_THAN_OR_EQUAL},{label:"Is not",value:C.IS_NOT},{label:"Less than",value:C.LESS_THAN_OR_EQUAL},{label:"Between",value:C.RANGE}],wa=[{label:"Is",value:C.IS_EXACT},{label:"Is not",value:C.IS_NOT}],Qs=[{label:"Contains",value:C.CONTAINS},{label:"Does not contain",value:C.IS_NOT}],$a=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],Ne=[{label:"Empty",value:re},{label:"Not empty",value:ne}],os=[...Ne,{label:"Specific",value:ze}],ka=[{label:"Empty",value:re},{label:"Not empty",value:ne},{label:"True",value:"true"},{label:"False",value:"false"}],It={[$.DATE]:"calendar",[$.BOOLEAN]:"toggle-left",[$.NUMERIC]:"file-digit",[$.DECIMAL2]:"decimals-arrow-right",[$.ATTACHMENTS_ASSETS]:"paperclip",[$.ATTACHMENT_URI]:"link-2",[$.SELECT_ONE]:"circle-dot",[$.MULTI_SELECT]:"square-check",[$.SUPERTAGS]:"hash",[$.TEXT]:"text-initial",[$.TEXT_AREA]:"text-align-justify",[$.GEO_POINT]:"locate",[$.INTEGER_LIST]:"list-ordered"},Sa={[$.TEXT]:"text",[$.TEXT_AREA]:"text",[$.NUMERIC]:"number",[$.DECIMAL2]:"number",[$.BOOLEAN]:"boolean",[$.SELECT_ONE]:"select-one",[$.MULTI_SELECT]:"multi-select",[$.SUPERTAGS]:"tags",[$.DATE]:"date",[$.GEO_POINT]:"geo",[$.ATTACHMENTS_ASSETS]:"attachment",[$.ATTACHMENT_URI]:"attachment",[$.INTEGER_LIST]:"attachment"};async function Ca(t){var i;return(((i=(await t.request("/filters",{filter_by:"filetype",format:"list",limit:200})).filters)==null?void 0:i.file_types)??[]).map(a=>({name:a.name,value:a.value,count:a.count,category:a.category??a.value.split("_")[0],label:Fa(a.name)}))}function Fa(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function Ea(t){var m,x;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,o=((i==null?void 0:i.model)??[])[pa],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(_=>({uuid:_.uuid,label:_.label??_.name??"",variants:(_.variants??[]).map(w=>({api_value:w.api_value??w.value??"",internal_unique_value:w.internal_unique_value??w.api_value??"",label:w.label??w.name??""}))})).filter(_=>_.variants.length>1),h={};for(const _ of d)h[_.uuid]=((m=_.variants[0])==null?void 0:m.api_value)??"";const u=(s==null?void 0:s.project_branding)??((x=e.settings)==null?void 0:x.project_branding),g=u==null?void 0:u.brandColor;if(!o)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:g};const p=o.groups??[],f=[];for(const _ of p){const w=_.name||"Root fields";for(const y of _.fields??[]){const T=y.possible_values,k=T==null?void 0:T.map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.name??S.api_value??""}));f.push({key:y.key??y.ckey,label:y.title??y.label??y.key??"",type:y.type??"text",slug:y.slug,ckey:y.ckey,possible_values:k,group:w,regionalVariantsGroupUuid:y.regional_variants_group_uuid})}}return{fields:f,regionalVariantGroups:d,regionalFilters:h,brandColor:g}}function Re(t){return t.toLocaleDateString("en-CA")}function Lt(){return Re(new Date)}function hi(t){const e=new Date;switch(t){case"today":return{from:Lt(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:Re(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:Lt(),to:Re(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:Re(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:Lt(),to:Re(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:Re(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:Lt(),to:Re(s)}}default:return null}}function Ys(t,e){return e?e.type==="date"?Aa(e):e.type==="string"?Ta(e):!0:!1}function Aa(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function Ta(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function La(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Ys(i,a))continue;const o=Ma(i,a);s.push(...o)}for(const[i,a]of Object.entries(e)){if(!a||!Ys(i,a))continue;const o=Na(i,a);s.push(...o)}return Oa(s)}function Oa(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function Ma(t,e){if(e.type==="date")return ui(t,e);if(t===b.IMAGE)return ja(e);const s=e,{operator:i=ci,values:a=[],logic:o}=s;if(a.length===0)return[];switch(t){case b.SIZE:return Ia(t,a,"..");case b.FACES:return Pa(t,i,a);case b.TAGS:return Ue(t,i,Ws(a),",",o);case b.LABELS:return Ue(t,i,Ws(a),",",o);case b.COLOR:return Da(i,a,o);case b.TYPE:return za(a,i);case b.MIME_TYPE:return Ra(t,a,i);case b.PRODUCT_REF:return Ue(t,"=%",a,",",o);default:return Ue(t,i,a,",",o)}}function ui(t,e){const s=e.field||"created";if(e.kind===pt.PRESET&&e.preset){if(e.preset===Gs.EMPTY)return[`${s}:"empty"`];if(e.preset===Gs.NOT_EMPTY)return[`${s}:"non-empty"`];const i=hi(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===pt.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===pt.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===pt.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===pt.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function Ia(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function Pa(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function Ue(t,e,s,i,a){if(s.length===0)return[];if(a===da.AND)return s.map(n=>`${t}${e}"${n}"`);const o=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${o}`]}function Da(t,e,s){const i=[],a=Ue("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function za(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const o of t){const n=fa[o];if(n)for(const c of n){const d=`${o}_${c}`;s.has(d)||(s.add(d),i.push(d))}else s.has(o)||(s.add(o),i.push(o))}const a=i.map(o=>`"${o}"`).join(",");return[`type${e}${a}`]}function Ra(t,e,s,i){if(e.length===0)return[];const a=e.map(o=>`"${o}"`).join(",");return[`${t}${s}${a}`]}function ja(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[ts.RESOLUTION],a=s[ts.ORIENTATION],o=s[ts.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),o&&e.push(`faces:"${o}"`),e}function Na(t,e){const s=qa(t),i=Ba(t);if(e.type==="date")return Ua(s,e,i);const a=e,{operator:o=ci,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===re||n[0]===ne)){const h=d===$.GEO_POINT?C.IS+"~":C.IS;return[`${s}${h}"${n[0]}"`]}if((d===$.NUMERIC||d===$.DECIMAL2)&&o===C.RANGE)return[`${s}${C.IS}"${n.join('","')}"`];if(d===$.GEO_POINT){const h=n.map(u=>{const g=u.indexOf("..");if(g===-1)return`(${u})`;const p=u.slice(0,g),f=u.slice(g);return`(${p})${f}`});return Ue(s,o+"~",h,",",c)}return Ue(s,o,n,",",c)}function Ua(t,e,s){const i=ui(t,e);return!s||i.length===0?i:i.map(a=>{const o=a.search(/[^a-zA-Z0-9_]/);if(o===-1)return`"${a}"`;const n=a.slice(0,o),d=a.slice(o).replace(/"/g,"");return`"${n}${d}"`})}function Ba(t){return t.startsWith("date_")}function qa(t){for(const e of ri)if(t.startsWith(e))return t.slice(e.length);return t}function Ws(t){return t.map(e=>e.replace(/#/g,""))}const Va=new Set([b.DATE,b.LICENSE_EXPIRY,G.DUE_DATE]);function ps(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Ha(s,i));return e}function Ha(t,e){return e.type==="string"||e.type==="date"?e:Va.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function Ga(t){const e=localStorage.getItem(ni+t),s=localStorage.getItem(li+t);let i;try{i=e?JSON.parse(e):[...Ks]}catch{i=[...Ks]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Ka(t,e){localStorage.setItem(ni+t,JSON.stringify(e))}function Qa(t,e){localStorage.setItem(li+t,JSON.stringify(e))}const gi="sort-by",fi="sort-order";function Xs(t,e){try{localStorage.setItem(gi,t),localStorage.setItem(fi,e)}catch{}}function Ya(){try{const t=localStorage.getItem(gi),e=localStorage.getItem(fi);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const vi="ap-last-folder",mi="ap-last-view",bi="ap-last-tab";function nt(t,e){return e?`${t}:${e}`:t}function Zs(t,e){try{localStorage.setItem(nt(vi,e),t)}catch{}}function Wa(t){try{return localStorage.getItem(nt(vi,t))}catch{return null}}function Xa(t,e){try{localStorage.setItem(nt(mi,e),t)}catch{}}function Za(t){try{return localStorage.getItem(nt(mi,t))}catch{return null}}function Ja(t,e){try{localStorage.setItem(nt(bi,e),t)}catch{}}function eo(t){try{const e=localStorage.getItem(nt(bi,t));return e==="assets"||e==="folders"||e==="labels"||e==="collections"?e:null}catch{return null}}function to(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,o=parseInt(s.slice(4,6),16)/255;return[i,a,o]}function rs(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function so(t,e,s){const i=rs(t),a=rs(e),o=rs(s),n=.4122214708*i+.5363325363*a+.0514459929*o,c=.2119034982*i+.6806995451*a+.1073969566*o,d=.0883024619*i+.2817188376*a+.6299787005*o,h=Math.cbrt(n),u=Math.cbrt(c),g=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*g,f=1.9779984951*h-2.428592205*u+.4505937099*g,m=.0259040371*h+.7827717662*u-.808675766*g,x=Math.sqrt(f*f+m*m);let _=Math.atan2(m,f)*(180/Math.PI);return _<0&&(_+=360),[p,x,_]}function io(t){return t>.7}function ao(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const g of s)t.style.removeProperty(g);return}const[i,a,o]=to(e),[n,c,d]=so(i,a,o),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=io(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const ms=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],oo=[{value:"relevance",label:"Relevance"},...ms],ro=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}],no=[{value:"name",label:"Name"}],lo=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"updated_at",label:"Modified"}],co=[{value:"name",label:"Name"}];var po=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,bs=(t,e,s,i)=>{for(var a=i>1?void 0:i?ho(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&po(e,s,a),a};let ht=class extends r.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return r.html`
1
+ "use strict";var Fi=Object.create;var Hs=Object.defineProperty;var Ei=Object.getOwnPropertyDescriptor;var Ai=Object.getOwnPropertyNames;var Ti=Object.getPrototypeOf,Li=Object.prototype.hasOwnProperty;var Oi=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ai(e))!Li.call(t,a)&&a!==s&&Hs(t,a,{get:()=>e[a],enumerable:!(i=Ei(e,a))||i.enumerable});return t};var Mi=(t,e,s)=>(s=t!=null?Fi(Ti(t)):{},Oi(e||!t||!t.__esModule?Hs(s,"default",{value:t,enumerable:!0}):s,t));const r=require("lit"),l=require("lit/decorators.js"),ps=require("lit/directive.js");class Pi{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Ii(){return new Pi({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",isAISearchActive:!1,sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],activeLabelUuid:null,collections:[],activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},fileTypes:[],metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Di{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function zi(t){return"extension"in t&&!("path"in t)}class Ri{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const o=this._getCombinedList();for(let n=e;n<=s;n++){const c=o[n];c&&(zi(c)?i.set(c.uuid,c):a.set(c.uuid,c))}}handleSelect(e,s,i){var c,d,h,u;const a=this.store.getState(),o=new Map(a.selectedAssets);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=new Map(a.selectedFolders);this._applyRangeSelection(g,p,o,f);const m=(d=a.config)==null?void 0:d.maxSelections;if(m&&o.size+f.size>m)return;this.store.setState({selectedAssets:o,selectedFolders:f})}else{const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=a.assets;for(let x=g;x<=p;x++)f[x]&&o.set(f[x].uuid,f[x]);const m=(h=a.config)==null?void 0:h.maxSelections;if(m&&o.size>m)return;this.store.setState({selectedAssets:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const g=(u=a.config)==null?void 0:u.maxSelections,p=o.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(g&&p>g)return;this.store.setState({selectedAssets:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var c,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),o=new Map(a.selectedFolders);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),g=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,g,p,o);const f=(d=a.config)==null?void 0:d.maxSelections;if(f&&p.size+o.size>f)return;this.store.setState({selectedAssets:p,selectedFolders:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,g=o.size+a.selectedAssets.size;if(u&&g>u)return;this.store.setState({selectedFolders:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var c;const s=this.store.getState(),i=(c=s.config)==null?void 0:c.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,o=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)o.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:o}),this.lastClickedIndex=-1,o.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,o=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let c=0;c<o;c++)a.set(e[c].uuid,e[c]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class ji{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const Gs=5,et=40,Ks=15;class Ni{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){var a;if(e.button!==0||this.isInteractiveTarget(e)||!(((a=this.store.getState().config)==null?void 0:a.multiSelect)??!0))return;const i=this.container.getBoundingClientRect();this.startX=e.clientX-i.left+this.container.scrollLeft,this.startY=e.clientY-i.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<Gs&&a<Gs)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let o=Math.min(this.startX,i),n=Math.min(this.startY,a),c=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;o+c>h&&(c=h-o),n+d>u&&(d=u-n),o<0&&(c+=o,o=0),n<0&&(d+=n,n=0),this.rect={x:o,y:n,width:c,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,o=i<et||a<et;o&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):o||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let o=0;i<et?o=-Ks*(1-i/et):a<et&&(o=Ks*(1-a/et)),o!==0&&(this.container.scrollTop+=o,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const o=i.shadowRoot.querySelectorAll("[data-folder-uuid]");o.length>0&&s.push(...Array.from(o))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),o=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.assetUuid;if(this.intersectsMarquee(p)){const m=e.assets.find(x=>x.uuid===f);m&&o.set(f,m)}}),s&&a.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.folderUuid;if(this.intersectsMarquee(p)){const m=e.folders.find(x=>x.uuid===f);m&&n.set(f,m)}});const c=(u=e.config)==null?void 0:u.maxSelections,d=o.size+(s?n.size:0);if(c&&d>c){const g=Array.from(o.entries()).slice(0,Math.max(0,c-n.size));this.store.setState({selectedAssets:new Map(g),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:o,...s?{selectedFolders:n}:{}})}}class Ui{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function Bi(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const o=[];return t.search&&!t.with_ai&&o.push(t.search),t.q&&o.push(t.q),o.length>0&&(e.q=o.join(" ")),t.with_ai&&(e.with_ai=!0,t.ai_query&&(e.ai_query=t.ai_query),t.ai_lang&&(e.ai_lang=t.ai_lang)),t.collection_uuid&&(e.collection_uuid=t.collection_uuid),t.f64&&(e.f64=t.f64),e}async function ze(t,e){const s=Bi(e);return t.request("/files",s)}async function Tt(t,e){const s={recursive:e.recursive??1};e.folder&&(s.folder=e.folder);const i=[];return e.search&&!e.with_ai&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),e.with_ai&&(s.with_ai=!0,e.ai_query&&(s.ai_query=e.ai_query),e.ai_lang&&(s.ai_lang=e.ai_lang)),e.collection_uuid&&(s.collection_uuid=e.collection_uuid),e.f64&&(s.f64=e.f64),t.request("/files/stats",s)}async function qi(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",o={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${o[i]||i}:${a}`,await t.request("/folders",s)}async function Vi(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Hi(t){return await t.request("/labels")}async function Gi(t){return t.request("/collections")}async function Ki(t,e){return t.request(`/collections/${e}/folders`)}function ii(t){return t.filter(e=>!!e.name).map(e=>({...e,children:ii(e.children??[])})).filter(e=>{var s;return!((((s=e.children)==null?void 0:s.length)??0)<1&&!e.filters)})}async function Qi(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function Yi(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}function Ht(t){var a,o;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(o=e[0])==null?void 0:o.playlists;return s!=null&&s.length&&s[0]||null}function Ne(t){return(t.type??"").startsWith("image")}function Wi(t){return(t.type??"").startsWith("video")}function Xi(t){return(t.type??"").startsWith("audio")}function ai(t){var e,s;return((e=t.url)==null?void 0:e.cdn)??((s=t.url)==null?void 0:s.public)??""}function Zi(t,e){const{meta:s,name:i}=t;if(s!=null&&s.alt)return s.alt;const a=s==null?void 0:s.title;if(typeof a=="string"&&a)return a;if(a&&typeof a=="object"){if(e){const n=a[e];if(n)return n}const o=Object.keys(a)[0];if(o){const n=a[o];if(n)return n}}return i.split(".")[0]}function Dt(t){var e,s;return((e=t.info)==null?void 0:e.img_w)??((s=t.info)==null?void 0:s.video_w)??0}function zt(t){var e,s;return((e=t.info)==null?void 0:e.img_h)??((s=t.info)==null?void 0:s.video_h)??0}function Ji(t){return{width:Dt(t),height:zt(t)}}function ea(t){return Ht(t)!==null}function ta(t){return Ht(t)}function sa(t){return Ht(t)??ai(t)}const ia={excellent:90,good:75,fair:60},aa=[{label:"WEBP",value:"webp"},{label:"JPEG",value:"jpeg"},{label:"PNG",value:"png"},{label:"GIF",value:"gif"}],oa=[{label:"Excellent",value:"excellent"},{label:"Good",value:"good"},{label:"Fair",value:"fair"}],ra=[{label:"Original",value:"original"},{label:"Full HD",value:"full_hd",width:1920},{label:"Large",value:"large",width:1200},{label:"Medium",value:"medium",width:600},{label:"Small",value:"small",width:300}],na={webp:"awebp,webp",jpeg:"jpeg",png:"png",gif:"agif,gif"},la=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),ca=new Set([...la,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function st(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function oi(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return ca.has(e)}const v="https://scaleflex.cloudimg.io/v7/assets/file-types/v3/",hs={_default:v+"GENERIC.svg?vh=9a518a",png:v+"PNG.svg?vh=96cd9a",jpg:v+"JPG.svg?vh=06e819",jpg2:v+"JPG2.svg?vh=f0eb7f",jpeg:v+"JPEG.svg?vh=6a65e9",gif:v+"GIF.svg?vh=c3c2c3",bmp:v+"BMP.svg?vh=d2243a",webp:v+"WEBP.svg?vh=fedd74",svg:v+"SVG.svg?vh=a15e46",tiff:v+"TIFF.svg?vh=1f30c3",tif:v+"TIF.svg?vh=b383c9",heic:v+"HEIC.svg?vh=84adfe",avif:v+"AVIF.svg?vh=536b30",ico:v+"ICO.svg?vh=79063d",psd:v+"PSD.svg?vh=be6140",psb:v+"PSB.svg?vh=678646",ai:v+"AI.svg?vh=84b254",dwg:v+"DWG.svg?vh=971fb3",mp4:v+"MP4.svg?vh=42f175",webm:v+"WEBM.svg?vh=26a84a",avi:v+"AVI.svg?vh=d22ba8",mpeg:v+"MPEG.svg?vh=ba93bb",ogv:v+"OGV.svg?vh=74d453","3gp":v+"3GP.svg?vh=f0d388","3g2":v+"3G2.svg?vh=04c652",swf:v+"SWF.svg?vh=3955e2",fla:v+"FLA.svg?vh=daf585",m3u8:v+"M3U8.svg?vh=7d5e62",mp3:v+"MP3.svg?vh=66bbef",wav:v+"WAV.svg?vh=d7a7d5",aac:v+"AAC.svg?vh=07f3f9",oga:v+"OGA.svg?vh=a5c622",opus:v+"OPUS.svg?vh=9548b1",weba:v+"WEBA.svg?vh=4dcf70",mid:v+"MID.svg?vh=3f0e29",midi:v+"MIDI.svg?vh=9fedec",cda:v+"CDA.svg?vh=85b83b",pdf:v+"PDF.svg?vh=18c5f7",doc:v+"DOC.svg?vh=d1b47c",docx:v+"DOCX.svg?vh=1eb6b0",txt:v+"TXT.svg?vh=307979",rtf:v+"RTF.svg?vh=978c5f",xls:v+"XLS.svg?vh=13b5f7",xlsx:v+"XLSX.svg?vh=79d64a",ppt:v+"PPT.svg?vh=4ee29b",pptx:v+"PPTX.svg?vh=8b1568",csv:v+"CSV.svg?vh=4add78",odt:v+"ODT.svg?vh=940781",ods:v+"ODS.svg?vh=9fbe9a",odp:v+"ODP.svg?vh=bf892d",dbf:v+"DBF.svg?vh=457bd4",vsd:v+"VSD.svg?vh=8a9ccb",abw:v+"ABW.svg?vh=313dc7",epub:v+"EPUB.svg?vh=15263d",azw:v+"AZW.svg?vh=a018b1",ics:v+"ICS.svg?vh=909f63",ogx:v+"OGX.svg?vh=f694d2",zip:v+"ZIP.svg?vh=84f98b",rar:v+"RAR.svg?vh=1d6423","7z":v+"7Z.svg?vh=e007e5",tar:v+"TAR.svg?vh=603aed",gz:v+"GZ.svg?vh=de13f7",bz:v+"BZ.svg?vh=0374ff",bz2:v+"BZ2.svg?vh=e14294",arc:v+"ARC.svg?vh=942fad",jar:v+"JAR.svg?vh=149796",mpkg:v+"MPKG.svg?vh=dea655",ttf:v+"TTF.svg?vh=d2e2c1",otf:v+"OTF.svg?vh=c904fd",woff:v+"WOFF.svg?vh=4b8177",woff2:v+"WOFF2.svg?vh=b532d3",eot:v+"EOT.svg?vh=a54980",js:v+"JS.svg?vh=524691",mjs:v+"MJS.svg?vh=d57921",ts:v+"TS.svg?vh=9af3ae",css:v+"CSS.svg?vh=287863",html:v+"HTML.svg?vh=fa7a87",htm:v+"HTM.svg?vh=21323d",xhtml:v+"XHTML.svg?vh=e6d6a9",xul:v+"XUL.svg?vh=6c9c71",json:v+"JSON.svg?vh=104c9e",jsonld:v+"JSONLD.svg?vh=f30c0f",xml:v+"XML.svg?vh=7f7194",php:v+"PHP.svg?vh=503e36",sh:v+"SH.svg?vh=3b820e",csh:v+"CSH.svg?vh=08c0cc",exe:v+"EXE.svg?vh=ccca53",iso:v+"ISO.svg?vh=064b8f",bin:v+"BIN.svg?vh=1e9618"};function kt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return hs[e]||hs._default}function it(){return hs._default}function Gt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const da=new Set(["png","svg","webp","gif","avif"]);function vs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return da.has(e)}const pa=new Set(["svg","svg+xml","png","pdf"]);function ri(t){return pa.has(Gt(t).toLowerCase())}function Rt(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return qe(s)}function ni(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?qe(s):""}function ms(t){var s,i;let e=qe(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),we(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function we(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const Qs=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function qe(t,e){if(!t)return"";const s=a=>a.replace(/(\.filerobot\.com\/[a-z0-9_-]+)\/v\d+\//i,"$1/");if(t.includes("assets.filerobot.com"))return s(t);const i=t.match(Qs);if(i){const a=i[2],o=t.replace(Qs,`$1assets.filerobot.com/${a}/`);return s(o)}if(e)try{const a=new URL(t);return s(`https://assets.filerobot.com/${e}${a.pathname}${a.search}`)}catch{}return t}function li(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=qe(s);const a=st(t.file_type),o=String(window.devicePixelRatio||1);return a==="video"?we(i,{w:e,dpr:o,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||Gt(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),we(i,{w:e,dpr:o,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):we(i,{w:e,dpr:o})}function bs(t,e){const s={};return t.format&&(s.force_format=na[t.format]),t.quality&&t.format!=="png"&&(s.q=String(ia[t.quality])),t.width&&(s.w=String(t.width)),t.height&&(s.h=String(t.height)),(t.width||t.height)&&(s.org_if_sml="1",e!=null&&e.isMultiSelect?s.func="bound":(e==null?void 0:e.isAspectLocked)===!1&&(s.func="cover")),s}function ha(t,e,s){const i=qe(t);if(!i)return t;const a=bs(e,s);return Object.keys(a).length>0?we(i,a):i}const b={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},K={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},C={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},ua={AND:"AND"},$={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},Kt={[$.DATE]:"date_",[$.BOOLEAN]:"bool_",[$.NUMERIC]:"num_",[$.DECIMAL2]:"dec_",[$.ATTACHMENTS_ASSETS]:"attach_",[$.ATTACHMENT_URI]:"uri_",[$.SELECT_ONE]:"one_",[$.MULTI_SELECT]:"multi_",[$.SUPERTAGS]:"tags_",[$.TEXT]:"text_",[$.TEXT_AREA]:"area_",[$.GEO_POINT]:"geo_",[$.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(Kt).map(([t,e])=>[e,t]));const ci=Object.values(Kt),ht={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Ys={EMPTY:"empty",NOT_EMPTY:"non-empty"},ne="empty",le="non-empty",Re="specific",es=10,ts=10,Lt=10,di="filters:pinned:",pi="metadata:pinned:",Ws=[b.DATE,b.TYPE,b.SIZE],hi=C.IS,Mt="20",Pt="1",ga=0,fa=[{key:b.DATE,label:"Date",icon:"calendar",type:"date"},{key:b.TYPE,label:"Format",icon:"file-type",type:"string"},{key:b.SIZE,label:"Size",icon:"scaling",type:"string"},{key:b.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:b.TAGS,label:"Tags",icon:"hash",type:"string"},{key:b.LABELS,label:"Labels",icon:"tag",type:"string"},{key:b.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:b.IMAGE,label:"Image",icon:"image",type:"string"},{key:b.COLOR,label:"Color",icon:"swatch-book",type:"string"}],va={key:b.METADATA,label:"Metadata",icon:"file-text",type:"string"},ma={key:b.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},us=[va,...fa,ma],tt={[b.TYPE]:"Format",[b.DATE]:"Date",[b.SIZE]:"Size",[b.LICENSE_EXPIRY]:"License expiry",[b.TAGS]:"Tags",[b.LABELS]:"Labels",[b.PRODUCT_REF]:"Products",[b.IMAGE]:"Image",[b.COLOR]:"Color",[b.METADATA]:"Metadata",[b.APPROVAL]:"Approval"},Q={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},jt=[{value:Q.IMAGE,label:"Image",icon:"image"},{value:Q.VIDEO,label:"Video",icon:"clapperboard"},{value:Q.AUDIO,label:"Audio",icon:"music"},{value:Q.DOCUMENT,label:"Document",icon:"document"},{value:Q.ARCHIVE,label:"Archive",icon:"archive"},{value:Q.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:Q.FONTS,label:"Fonts",icon:"text"},{value:Q.OTHER,label:"Other",icon:"layout-grid"}],ba={[Q.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[Q.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[Q.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[Q.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[Q.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[Q.FONTS]:["ttf","otf","woff","woff2","eot"]},ss={RESOLUTION:0,ORIENTATION:1,FACES:2},_a=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ya=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],xa=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],ui=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],_s=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],gi=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],wa=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],$a=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ka=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],is=[{label:"Is",value:C.IS},{label:"Contains",value:C.CONTAINS_IN_TEXT}],xe=[{label:"Is",value:C.IS},{label:"Is not",value:C.IS_NOT}],as=[{label:"Is",value:C.IS_EXACT},{label:"Contains",value:C.IS},{label:"Does not contain",value:C.IS_NOT}],os=[{label:"Is",value:C.IS},{label:"Greater than",value:C.GREATER_THAN_OR_EQUAL},{label:"Is not",value:C.IS_NOT},{label:"Less than",value:C.LESS_THAN_OR_EQUAL},{label:"Between",value:C.RANGE}],Sa=[{label:"Is",value:C.IS_EXACT},{label:"Is not",value:C.IS_NOT}],Xs=[{label:"Contains",value:C.CONTAINS},{label:"Does not contain",value:C.IS_NOT}],Ca=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],Ue=[{label:"Empty",value:ne},{label:"Not empty",value:le}],rs=[...Ue,{label:"Specific",value:Re}],Fa=[{label:"Empty",value:ne},{label:"Not empty",value:le},{label:"True",value:"true"},{label:"False",value:"false"}],It={[$.DATE]:"calendar",[$.BOOLEAN]:"toggle-left",[$.NUMERIC]:"file-digit",[$.DECIMAL2]:"decimals-arrow-right",[$.ATTACHMENTS_ASSETS]:"paperclip",[$.ATTACHMENT_URI]:"link-2",[$.SELECT_ONE]:"circle-dot",[$.MULTI_SELECT]:"square-check",[$.SUPERTAGS]:"hash",[$.TEXT]:"text-initial",[$.TEXT_AREA]:"text-align-justify",[$.GEO_POINT]:"locate",[$.INTEGER_LIST]:"list-ordered"},Ea={[$.TEXT]:"text",[$.TEXT_AREA]:"text",[$.NUMERIC]:"number",[$.DECIMAL2]:"number",[$.BOOLEAN]:"boolean",[$.SELECT_ONE]:"select-one",[$.MULTI_SELECT]:"multi-select",[$.SUPERTAGS]:"tags",[$.DATE]:"date",[$.GEO_POINT]:"geo",[$.ATTACHMENTS_ASSETS]:"attachment",[$.ATTACHMENT_URI]:"attachment",[$.INTEGER_LIST]:"attachment"};async function Aa(t){var i;return(((i=(await t.request("/filters",{filter_by:"filetype",format:"list",limit:200})).filters)==null?void 0:i.file_types)??[]).map(a=>({name:a.name,value:a.value,count:a.count,category:a.category??a.value.split("_")[0],label:Ta(a.name)}))}function Ta(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function La(t){var m,x;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,o=((i==null?void 0:i.model)??[])[ga],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(_=>({uuid:_.uuid,label:_.label??_.name??"",variants:(_.variants??[]).map(w=>({api_value:w.api_value??w.value??"",internal_unique_value:w.internal_unique_value??w.api_value??"",label:w.label??w.name??""}))})).filter(_=>_.variants.length>1),h={};for(const _ of d)h[_.uuid]=((m=_.variants[0])==null?void 0:m.api_value)??"";const u=(s==null?void 0:s.project_branding)??((x=e.settings)==null?void 0:x.project_branding),g=u==null?void 0:u.brandColor;if(!o)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:g};const p=o.groups??[],f=[];for(const _ of p){const w=_.name||"Root fields";for(const y of _.fields??[]){const L=y.possible_values,k=L==null?void 0:L.map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.name??S.api_value??""}));f.push({key:y.key??y.ckey,label:y.title??y.label??y.key??"",type:y.type??"text",slug:y.slug,ckey:y.ckey,possible_values:k,group:w,regionalVariantsGroupUuid:y.regional_variants_group_uuid})}}return{fields:f,regionalVariantGroups:d,regionalFilters:h,brandColor:g}}function je(t){return t.toLocaleDateString("en-CA")}function Ot(){return je(new Date)}function fi(t){const e=new Date;switch(t){case"today":return{from:Ot(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:je(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:Ot(),to:je(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:je(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:Ot(),to:je(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:je(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:Ot(),to:je(s)}}default:return null}}function Zs(t,e){return e?e.type==="date"?Oa(e):e.type==="string"?Ma(e):!0:!1}function Oa(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function Ma(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function Pa(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Zs(i,a))continue;const o=Da(i,a);s.push(...o)}for(const[i,a]of Object.entries(e)){if(!a||!Zs(i,a))continue;const o=qa(i,a);s.push(...o)}return Ia(s)}function Ia(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function Da(t,e){if(e.type==="date")return vi(t,e);if(t===b.IMAGE)return Ba(e);const s=e,{operator:i=hi,values:a=[],logic:o}=s;if(a.length===0)return[];switch(t){case b.SIZE:return za(t,a,"..");case b.FACES:return Ra(t,i,a);case b.TAGS:return Be(t,i,Js(a),",",o);case b.LABELS:return Be(t,i,Js(a),",",o);case b.COLOR:return ja(i,a,o);case b.TYPE:return Na(a,i);case b.MIME_TYPE:return Ua(t,a,i);case b.PRODUCT_REF:return Be(t,"=%",a,",",o);default:return Be(t,i,a,",",o)}}function vi(t,e){const s=e.field||"created";if(e.kind===ht.PRESET&&e.preset){if(e.preset===Ys.EMPTY)return[`${s}:"empty"`];if(e.preset===Ys.NOT_EMPTY)return[`${s}:"non-empty"`];const i=fi(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===ht.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===ht.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===ht.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===ht.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function za(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function Ra(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function Be(t,e,s,i,a){if(s.length===0)return[];if(a===ua.AND)return s.map(n=>`${t}${e}"${n}"`);const o=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${o}`]}function ja(t,e,s){const i=[],a=Be("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Na(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const o of t){const n=ba[o];if(n)for(const c of n){const d=`${o}_${c}`;s.has(d)||(s.add(d),i.push(d))}else s.has(o)||(s.add(o),i.push(o))}const a=i.map(o=>`"${o}"`).join(",");return[`type${e}${a}`]}function Ua(t,e,s,i){if(e.length===0)return[];const a=e.map(o=>`"${o}"`).join(",");return[`${t}${s}${a}`]}function Ba(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[ss.RESOLUTION],a=s[ss.ORIENTATION],o=s[ss.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),o&&e.push(`faces:"${o}"`),e}function qa(t,e){const s=Ga(t),i=Ha(t);if(e.type==="date")return Va(s,e,i);const a=e,{operator:o=hi,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===ne||n[0]===le)){const h=d===$.GEO_POINT?C.IS+"~":C.IS;return[`${s}${h}"${n[0]}"`]}if((d===$.NUMERIC||d===$.DECIMAL2)&&o===C.RANGE)return[`${s}${C.IS}"${n.join('","')}"`];if(d===$.GEO_POINT){const h=n.map(u=>{const g=u.indexOf("..");if(g===-1)return`(${u})`;const p=u.slice(0,g),f=u.slice(g);return`(${p})${f}`});return Be(s,o+"~",h,",",c)}return Be(s,o,n,",",c)}function Va(t,e,s){const i=vi(t,e);return!s||i.length===0?i:i.map(a=>{const o=a.search(/[^a-zA-Z0-9_]/);if(o===-1)return`"${a}"`;const n=a.slice(0,o),d=a.slice(o).replace(/"/g,"");return`"${n}${d}"`})}function Ha(t){return t.startsWith("date_")}function Ga(t){for(const e of ci)if(t.startsWith(e))return t.slice(e.length);return t}function Js(t){return t.map(e=>e.replace(/#/g,""))}const Ka=new Set([b.DATE,b.LICENSE_EXPIRY,K.DUE_DATE]);function gs(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Qa(s,i));return e}function Qa(t,e){return e.type==="string"||e.type==="date"?e:Ka.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function Ya(t){const e=localStorage.getItem(di+t),s=localStorage.getItem(pi+t);let i;try{i=e?JSON.parse(e):[...Ws]}catch{i=[...Ws]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Wa(t,e){localStorage.setItem(di+t,JSON.stringify(e))}function Xa(t,e){localStorage.setItem(pi+t,JSON.stringify(e))}const mi="sort-by",bi="sort-order";function ei(t,e){try{localStorage.setItem(mi,t),localStorage.setItem(bi,e)}catch{}}function Za(){try{const t=localStorage.getItem(mi),e=localStorage.getItem(bi);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const _i="ap-last-folder",yi="ap-last-view",xi="ap-last-tab";function lt(t,e){return e?`${t}:${e}`:t}function ti(t,e){try{localStorage.setItem(lt(_i,e),t)}catch{}}function Ja(t){try{return localStorage.getItem(lt(_i,t))}catch{return null}}function eo(t,e){try{localStorage.setItem(lt(yi,e),t)}catch{}}function to(t){try{return localStorage.getItem(lt(yi,t))}catch{return null}}function so(t,e){try{localStorage.setItem(lt(xi,e),t)}catch{}}function io(t){try{const e=localStorage.getItem(lt(xi,t));return e==="assets"||e==="folders"||e==="labels"||e==="collections"?e:null}catch{return null}}function ao(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,o=parseInt(s.slice(4,6),16)/255;return[i,a,o]}function ns(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function oo(t,e,s){const i=ns(t),a=ns(e),o=ns(s),n=.4122214708*i+.5363325363*a+.0514459929*o,c=.2119034982*i+.6806995451*a+.1073969566*o,d=.0883024619*i+.2817188376*a+.6299787005*o,h=Math.cbrt(n),u=Math.cbrt(c),g=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*g,f=1.9779984951*h-2.428592205*u+.4505937099*g,m=.0259040371*h+.7827717662*u-.808675766*g,x=Math.sqrt(f*f+m*m);let _=Math.atan2(m,f)*(180/Math.PI);return _<0&&(_+=360),[p,x,_]}function ro(t){return t>.7}function no(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const g of s)t.style.removeProperty(g);return}const[i,a,o]=ao(e),[n,c,d]=oo(i,a,o),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=ro(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const ys=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],lo=[{value:"relevance",label:"Relevance"},...ys],co=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}],po=[{value:"name",label:"Name"}],ho=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"updated_at",label:"Modified"}],uo=[{value:"name",label:"Name"}];var go=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?fo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&go(e,s,a),a};let ut=class extends r.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return r.html`
2
2
  <dialog
3
3
  @click=${this._handleBackdropClick}
4
4
  @cancel=${this._handleCancel}
@@ -15,7 +15,7 @@
15
15
  </div>
16
16
  </div>
17
17
  </dialog>
18
- `}};ht.styles=r.css`
18
+ `}};ut.styles=r.css`
19
19
  :host {
20
20
  display: contents;
21
21
  }
@@ -88,11 +88,11 @@
88
88
  animation: none;
89
89
  }
90
90
  }
91
- `;bs([l.property({type:Boolean})],ht.prototype,"open",2);bs([l.query("dialog")],ht.prototype,"dialog",2);ht=bs([l.customElement("ap-modal")],ht);function uo(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const Y=r.css`
91
+ `;xs([l.property({type:Boolean})],ut.prototype,"open",2);xs([l.query("dialog")],ut.prototype,"dialog",2);ut=xs([l.customElement("ap-modal")],ut);function vo(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const W=r.css`
92
92
  *, *::before, *::after {
93
93
  box-sizing: border-box;
94
94
  }
95
- `;var go=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,Kt=(t,e,s,i)=>{for(var a=i>1?void 0:i?fo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&go(e,s,a),a};let it=class extends r.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return r.html`
95
+ `;var mo=Object.defineProperty,bo=Object.getOwnPropertyDescriptor,Qt=(t,e,s,i)=>{for(var a=i>1?void 0:i?bo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&mo(e,s,a),a};let at=class extends r.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return r.html`
96
96
  <button
97
97
  class="trigger ${this._open?"active":""}"
98
98
  @click=${()=>this._open=!this._open}
@@ -103,7 +103,7 @@
103
103
  </button>
104
104
  <div class="popover ${this._open?"open":""}">
105
105
  ${t?r.nothing:r.html`
106
- <div style="padding: 12px 12px; font-size: 0.8125rem; color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));">
106
+ <div class="empty-msg">
107
107
  No regional settings configured
108
108
  </div>
109
109
  `}
@@ -123,7 +123,7 @@
123
123
  </div>
124
124
  `)}
125
125
  </div>
126
- `}};it.styles=r.css`
126
+ `}};at.styles=r.css`
127
127
  :host {
128
128
  position: relative;
129
129
  display: inline-block;
@@ -208,7 +208,12 @@
208
208
  width: 16px;
209
209
  flex-shrink: 0;
210
210
  }
211
- `;Kt([l.property({type:Array})],it.prototype,"groups",2);Kt([l.property({type:Object})],it.prototype,"selectedFilters",2);Kt([l.state()],it.prototype,"_open",2);it=Kt([l.customElement("ap-regional-settings")],it);var vo=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,W=(t,e,s,i)=>{for(var a=i>1?void 0:i?mo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vo(e,s,a),a};const bo=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"},{value:"labels",label:"Labels",icon:"tag"},{value:"collections",label:"Collections",icon:"layout-grid"}];let N=class extends r.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.isInsideLabel=!1,this.isInsideCollection=!1,this.isInsideCollectionLeaf=!1,this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this.enableAISearch=!1,this.isAISearchActive=!1,this._localSearch="",this._debouncedSearch=uo(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleAISearch(){this.dispatchEvent(new CustomEvent("ai-search-toggle",{detail:{active:!this.isAISearchActive},bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=bo.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),r.html`
211
+ .empty-msg {
212
+ padding: 12px;
213
+ font-size: 0.8125rem;
214
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
215
+ }
216
+ `;Qt([l.property({type:Array})],at.prototype,"groups",2);Qt([l.property({type:Object})],at.prototype,"selectedFilters",2);Qt([l.state()],at.prototype,"_open",2);at=Qt([l.customElement("ap-regional-settings")],at);var _o=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,X=(t,e,s,i)=>{for(var a=i>1?void 0:i?yo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_o(e,s,a),a};const xo=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"},{value:"labels",label:"Labels",icon:"tag"},{value:"collections",label:"Collections",icon:"layout-grid"}];let U=class extends r.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.isInsideLabel=!1,this.isInsideCollection=!1,this.isInsideCollectionLeaf=!1,this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this.enableAISearch=!1,this.isAISearchActive=!1,this._localSearch="",this._debouncedSearch=vo(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleAISearch(){this.dispatchEvent(new CustomEvent("ai-search-toggle",{detail:{active:!this.isAISearchActive},bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=xo.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),r.html`
212
217
  <div class="header-row">
213
218
  ${t.length>1?r.html`<ap-dropdown
214
219
  .value=${this.activeTab}
@@ -258,13 +263,13 @@
258
263
  </button>
259
264
  ${this.hideClose?r.nothing:r.html`
260
265
  <div class="divider"></div>
261
- <button class="icon-btn" style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))" @click=${this._handleClose} aria-label="Close">
266
+ <button class="icon-btn icon-btn--muted" @click=${this._handleClose} aria-label="Close">
262
267
  <ap-icon name="close" .size=${18}></ap-icon>
263
268
  </button>
264
269
  `}
265
270
  </div>
266
271
  </div>
267
- `}};N.styles=[Y,r.css`
272
+ `}};U.styles=[W,r.css`
268
273
  :host {
269
274
  display: block;
270
275
  padding: 16px 20px;
@@ -415,7 +420,10 @@
415
420
  height: 24px;
416
421
  background: var(--ap-border, oklch(92.86% 0.009 247.92));
417
422
  }
418
- `];W([l.property()],N.prototype,"activeTab",2);W([l.property({type:Array})],N.prototype,"tabs",2);W([l.property({type:Boolean})],N.prototype,"isInsideLabel",2);W([l.property({type:Boolean})],N.prototype,"isInsideCollection",2);W([l.property({type:Boolean})],N.prototype,"isInsideCollectionLeaf",2);W([l.property()],N.prototype,"viewMode",2);W([l.property()],N.prototype,"searchQuery",2);W([l.property({type:Array})],N.prototype,"regionalGroups",2);W([l.property({type:Object})],N.prototype,"regionalFilters",2);W([l.property({type:Boolean})],N.prototype,"hideClose",2);W([l.property({type:Boolean,reflect:!0,attribute:"ai-search"})],N.prototype,"enableAISearch",2);W([l.property({type:Boolean})],N.prototype,"isAISearchActive",2);W([l.state()],N.prototype,"_localSearch",2);N=W([l.customElement("ap-header")],N);var _o=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?yo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_o(e,s,a),a};let ut=class extends r.LitElement{constructor(){super(...arguments),this.items=[],this.rootLabel="Root"}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?r.html``:r.html`
423
+ .icon-btn--muted {
424
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
425
+ }
426
+ `];X([l.property()],U.prototype,"activeTab",2);X([l.property({type:Array})],U.prototype,"tabs",2);X([l.property({type:Boolean})],U.prototype,"isInsideLabel",2);X([l.property({type:Boolean})],U.prototype,"isInsideCollection",2);X([l.property({type:Boolean})],U.prototype,"isInsideCollectionLeaf",2);X([l.property()],U.prototype,"viewMode",2);X([l.property()],U.prototype,"searchQuery",2);X([l.property({type:Array})],U.prototype,"regionalGroups",2);X([l.property({type:Object})],U.prototype,"regionalFilters",2);X([l.property({type:Boolean})],U.prototype,"hideClose",2);X([l.property({type:Boolean,reflect:!0,attribute:"ai-search"})],U.prototype,"enableAISearch",2);X([l.property({type:Boolean})],U.prototype,"isAISearchActive",2);X([l.state()],U.prototype,"_localSearch",2);U=X([l.customElement("ap-header")],U);var wo=Object.defineProperty,$o=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?$o(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&wo(e,s,a),a};let gt=class extends r.LitElement{constructor(){super(...arguments),this.items=[],this.rootLabel="Root"}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?r.html``:r.html`
419
427
  <nav class="breadcrumb" aria-label="Breadcrumb">
420
428
  <button @click=${()=>this._navigate("")}>${this.rootLabel}</button>
421
429
  ${this.items.map((t,e)=>r.html`
@@ -423,7 +431,7 @@
423
431
  ${e<this.items.length-1?r.html`<button @click=${()=>this._navigate(t.uuid)}>${t.name}</button>`:r.html`<span class="current">${t.name}</span>`}
424
432
  `)}
425
433
  </nav>
426
- `}};ut.styles=r.css`
434
+ `}};gt.styles=r.css`
427
435
  :host {
428
436
  display: block;
429
437
  padding: 4px 20px 12px;
@@ -459,12 +467,12 @@
459
467
  ap-icon {
460
468
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
461
469
  }
462
- `;_s([l.property({type:Array})],ut.prototype,"items",2);_s([l.property()],ut.prototype,"rootLabel",2);ut=_s([l.customElement("ap-breadcrumb")],ut);var xo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,ys=(t,e,s,i)=>{for(var a=i>1?void 0:i?wo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xo(e,s,a),a};let gt=class extends r.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?r.html`
470
+ `;ws([l.property({type:Array})],gt.prototype,"items",2);ws([l.property()],gt.prototype,"rootLabel",2);gt=ws([l.customElement("ap-breadcrumb")],gt);const ls=t=>t.includes("-")?t:t.replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`);class ko extends ps.Directive{constructor(e){if(super(e),this._appliedProps=new Set,e.type!==ps.PartType.ELEMENT)throw new Error("cspStyle must be used as an element directive: <el ${cspStyle({...})}>")}render(e){return r.noChange}update(e,[s]){if(s===this._lastStyles)return r.noChange;this._lastStyles=s;const{style:i}=e.element,a=s??{};for(const o of this._appliedProps)(!(o in a)||a[o]==null||a[o]==="")&&(i.removeProperty(ls(o)),this._appliedProps.delete(o));for(const[o,n]of Object.entries(a))n!=null&&n!==""?(i.setProperty(ls(o),n),this._appliedProps.add(o)):this._appliedProps.has(o)&&(i.removeProperty(ls(o)),this._appliedProps.delete(o));return r.noChange}}const F=ps.directive(ko);var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,$s=(t,e,s,i)=>{for(var a=i>1?void 0:i?Co(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&So(e,s,a),a};let ft=class extends r.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?r.html`
463
471
  <div class="popover">
464
472
  ${this.title?r.html`<div class="title">${this.title}</div>`:""}
465
473
  <slot></slot>
466
474
  </div>
467
- `:r.html``}};gt.styles=r.css`
475
+ `:r.html``}};ft.styles=r.css`
468
476
  :host {
469
477
  display: block;
470
478
  }
@@ -489,7 +497,7 @@
489
497
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
490
498
  margin-bottom: 12px;
491
499
  }
492
- `;ys([l.property()],gt.prototype,"title",2);ys([l.property({type:Boolean})],gt.prototype,"open",2);gt=ys([l.customElement("ap-filter-popover")],gt);var $o=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,kt=(t,e,s,i)=>{for(var a=i>1?void 0:i?ko(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$o(e,s,a),a};function Js(t){var i;const e=new Map;for(const a of t){const o=a.category||a.value.split("_")[0];if(!e.has(o)){const c=Rt.find(d=>d.value===o);e.set(o,{key:o,label:(c==null?void 0:c.label)||o.charAt(0).toUpperCase()+o.slice(1),icon:(c==null?void 0:c.icon)||"file",extensions:[],totalCount:0})}const n=e.get(o);n.extensions.push({value:a.value,label:a.label||((i=a.value.split("_").pop())==null?void 0:i.toUpperCase())||a.value,count:a.count}),n.totalCount+=a.count}const s=Rt.map(a=>a.value);return[...e.values()].sort((a,o)=>{const n=s.indexOf(a.key),c=s.indexOf(o.key);return(n===-1?999:n)-(c===-1?999:c)})}let qe=class extends r.LitElement{constructor(){super(...arguments),this.selected=[],this.fileTypes=[],this._search="",this._expanded=new Set}_extValues(t){return t.extensions.map(e=>e.value)}_isGroupFullySelected(t){if(this.selected.includes(t.key))return!0;const e=this._extValues(t);return e.length>0&&e.every(s=>this.selected.includes(s))}_isGroupPartial(t){if(this.selected.includes(t.key))return!1;const e=this._extValues(t),s=e.filter(i=>this.selected.includes(i)).length;return s>0&&s<e.length}_isExtSelected(t,e){return this.selected.includes(e)||this.selected.includes(t)}_toggleGroup(t){const e=this._extValues(t),s=this._isGroupFullySelected(t);let i;if(s){const a=new Set([t.key,...e]);i=this.selected.filter(o=>!a.has(o))}else{const a=new Set(e);i=this.selected.filter(o=>!a.has(o)),i.push(t.key)}this._emit(i)}_toggleExt(t,e){const s=this._extValues(e);let i=[...this.selected];i.includes(e.key)&&(i=i.filter(a=>a!==e.key),i.push(...s)),i.includes(t)?i=i.filter(a=>a!==t):(i.push(t),s.every(a=>i.includes(a))&&(i=i.filter(a=>!s.includes(a)),i.push(e.key))),this._emit(i)}_clearAll(){this._emit([])}_emit(t){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.TYPE,values:t,operator:C.IS},bubbles:!0,composed:!0}))}_toggleExpand(t){const e=new Set(this._expanded);e.has(t)?e.delete(t):e.add(t),this._expanded=e}_filteredGroups(t){const e=this._search.toLowerCase().trim();return e?t.map(s=>{if(s.label.toLowerCase().includes(e)||s.key.toLowerCase().includes(e))return s;const a=s.extensions.filter(o=>o.label.toLowerCase().includes(e)||o.value.toLowerCase().includes(e));return a.length===0?null:{...s,extensions:a}}).filter(s=>s!==null):t}_toggleCategory(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this._emit(e)}updated(t){if(t.has("fileTypes")&&this.fileTypes.length>0){const e=Js(this.fileTypes),s=new Set(this._expanded);for(const i of e)(this._isGroupFullySelected(i)||this._isGroupPartial(i))&&s.add(i.key);this._expanded=s}}render(){if(this.fileTypes.length===0)return this._renderFallback();const t=Js(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return r.html`
500
+ `;$s([l.property()],ft.prototype,"title",2);$s([l.property({type:Boolean})],ft.prototype,"open",2);ft=$s([l.customElement("ap-filter-popover")],ft);var Fo=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,St=(t,e,s,i)=>{for(var a=i>1?void 0:i?Eo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fo(e,s,a),a};function si(t){var i;const e=new Map;for(const a of t){const o=a.category||a.value.split("_")[0];if(!e.has(o)){const c=jt.find(d=>d.value===o);e.set(o,{key:o,label:(c==null?void 0:c.label)||o.charAt(0).toUpperCase()+o.slice(1),icon:(c==null?void 0:c.icon)||"file",extensions:[],totalCount:0})}const n=e.get(o);n.extensions.push({value:a.value,label:a.label||((i=a.value.split("_").pop())==null?void 0:i.toUpperCase())||a.value,count:a.count}),n.totalCount+=a.count}const s=jt.map(a=>a.value);return[...e.values()].sort((a,o)=>{const n=s.indexOf(a.key),c=s.indexOf(o.key);return(n===-1?999:n)-(c===-1?999:c)})}let Ve=class extends r.LitElement{constructor(){super(...arguments),this.selected=[],this.fileTypes=[],this._search="",this._expanded=new Set}_extValues(t){return t.extensions.map(e=>e.value)}_isGroupFullySelected(t){if(this.selected.includes(t.key))return!0;const e=this._extValues(t);return e.length>0&&e.every(s=>this.selected.includes(s))}_isGroupPartial(t){if(this.selected.includes(t.key))return!1;const e=this._extValues(t),s=e.filter(i=>this.selected.includes(i)).length;return s>0&&s<e.length}_isExtSelected(t,e){return this.selected.includes(e)||this.selected.includes(t)}_toggleGroup(t){const e=this._extValues(t),s=this._isGroupFullySelected(t);let i;if(s){const a=new Set([t.key,...e]);i=this.selected.filter(o=>!a.has(o))}else{const a=new Set(e);i=this.selected.filter(o=>!a.has(o)),i.push(t.key)}this._emit(i)}_toggleExt(t,e){const s=this._extValues(e);let i=[...this.selected];i.includes(e.key)&&(i=i.filter(a=>a!==e.key),i.push(...s)),i.includes(t)?i=i.filter(a=>a!==t):(i.push(t),s.every(a=>i.includes(a))&&(i=i.filter(a=>!s.includes(a)),i.push(e.key))),this._emit(i)}_clearAll(){this._emit([])}_emit(t){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.TYPE,values:t,operator:C.IS},bubbles:!0,composed:!0}))}_toggleExpand(t){const e=new Set(this._expanded);e.has(t)?e.delete(t):e.add(t),this._expanded=e}_filteredGroups(t){const e=this._search.toLowerCase().trim();return e?t.map(s=>{if(s.label.toLowerCase().includes(e)||s.key.toLowerCase().includes(e))return s;const a=s.extensions.filter(o=>o.label.toLowerCase().includes(e)||o.value.toLowerCase().includes(e));return a.length===0?null:{...s,extensions:a}}).filter(s=>s!==null):t}_toggleCategory(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this._emit(e)}updated(t){if(t.has("fileTypes")&&this.fileTypes.length>0){const e=si(this.fileTypes),s=new Set(this._expanded);for(const i of e)(this._isGroupFullySelected(i)||this._isGroupPartial(i))&&s.add(i.key);this._expanded=s}}render(){if(this.fileTypes.length===0)return this._renderFallback();const t=si(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return r.html`
493
501
  <input
494
502
  class="search-input"
495
503
  type="text"
@@ -541,7 +549,7 @@
541
549
  `}_renderFallback(){return r.html`
542
550
  <div class="options">
543
551
  <span class="section-label">Formats</span>
544
- ${Rt.map(t=>r.html`
552
+ ${jt.map(t=>r.html`
545
553
  <div
546
554
  class="option ${this.selected.includes(t.value)?"selected":""}"
547
555
  @click=${()=>this._toggleCategory(t.value)}
@@ -552,7 +560,7 @@
552
560
  </div>
553
561
  `)}
554
562
  </div>
555
- `}};qe.styles=r.css`
563
+ `}};Ve.styles=r.css`
556
564
  :host {
557
565
  display: block;
558
566
  }
@@ -706,7 +714,7 @@
706
714
  font-size: var(--ap-font-size-sm, 0.875rem);
707
715
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
708
716
  }
709
- `;kt([l.property({type:Array})],qe.prototype,"selected",2);kt([l.property({type:Array})],qe.prototype,"fileTypes",2);kt([l.state()],qe.prototype,"_search",2);kt([l.state()],qe.prototype,"_expanded",2);qe=kt([l.customElement("ap-filter-type")],qe);const Ce=r.css`
717
+ `;St([l.property({type:Array})],Ve.prototype,"selected",2);St([l.property({type:Array})],Ve.prototype,"fileTypes",2);St([l.state()],Ve.prototype,"_search",2);St([l.state()],Ve.prototype,"_expanded",2);Ve=St([l.customElement("ap-filter-type")],Ve);const Fe=r.css`
710
718
  :host {
711
719
  display: block;
712
720
  }
@@ -989,11 +997,11 @@
989
997
  font-size: var(--ap-font-size-sm, 0.875rem);
990
998
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
991
999
  }
992
- `;var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,Ke=(t,e,s,i)=>{for(var a=i>1?void 0:i?Co(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&So(e,s,a),a};function ns(t){return t.toISOString().split("T")[0]}let we=class extends r.LitElement{constructor(){super(...arguments),this.filterKey=b.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===b.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?pi:vs}get _todayStr(){return ns(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){if(!t){this._clearAll();return}const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=hi(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?r.nothing:r.html`
1000
+ `;var Ao=Object.defineProperty,To=Object.getOwnPropertyDescriptor,Qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?To(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ao(e,s,a),a};function cs(t){return t.toISOString().split("T")[0]}let $e=class extends r.LitElement{constructor(){super(...arguments),this.filterKey=b.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===b.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?gi:_s}get _todayStr(){return cs(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){if(!t){this._clearAll();return}const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=fi(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?r.nothing:r.html`
993
1001
  <div class="filter-section">
994
1002
  <span class="section-label">Date type</span>
995
1003
  <ap-radio-group
996
- .options=${di}
1004
+ .options=${ui}
997
1005
  .value=${this.field}
998
1006
  @ap-change=${t=>this._selectField(t.detail.value)}
999
1007
  ></ap-radio-group>
@@ -1009,7 +1017,7 @@
1009
1017
  @ap-change=${t=>this._selectPreset(t.detail.value)}
1010
1018
  ></ap-radio-group>
1011
1019
  </div>
1012
- `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return r.nothing;const e=this.from?ns(new Date(this.from)):"",s=this.to?ns(new Date(this.to)):"",i=this._todayStr;return t==="specific"?r.html`
1020
+ `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return r.nothing;const e=this.from?cs(new Date(this.from)):"",s=this.to?cs(new Date(this.to)):"",i=this._todayStr;return t==="specific"?r.html`
1013
1021
  <div class="filter-section date-inputs">
1014
1022
  <div>
1015
1023
  <span class="input-label">Date</span>
@@ -1085,14 +1093,14 @@
1085
1093
  ${this._renderRangeSection()}
1086
1094
  ${this._renderDateInputs()}
1087
1095
  </div>
1088
- `}};we.styles=[Ce,r.css`
1096
+ `}};$e.styles=[Fe,r.css`
1089
1097
  .date-inputs {
1090
1098
  margin-top: 4px;
1091
1099
  }
1092
- `];Ke([l.property()],we.prototype,"filterKey",2);Ke([l.property()],we.prototype,"field",2);Ke([l.property()],we.prototype,"kind",2);Ke([l.property()],we.prototype,"preset",2);Ke([l.property()],we.prototype,"from",2);Ke([l.property()],we.prototype,"to",2);we=Ke([l.customElement("ap-filter-date")],we);var Fo=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,lt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Eo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fo(e,s,a),a};let Te=class extends r.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=b.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=Jt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:C.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:C.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return r.html`
1100
+ `];Qe([l.property()],$e.prototype,"filterKey",2);Qe([l.property()],$e.prototype,"field",2);Qe([l.property()],$e.prototype,"kind",2);Qe([l.property()],$e.prototype,"preset",2);Qe([l.property()],$e.prototype,"from",2);Qe([l.property()],$e.prototype,"to",2);$e=Qe([l.customElement("ap-filter-date")],$e);var Lo=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?Oo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lo(e,s,a),a};let Le=class extends r.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=b.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=es}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:C.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:C.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return r.html`
1093
1101
  <div
1094
1102
  class="tag-item ${s?"disabled":""}"
1095
- title=${s?`You can select up to ${Jt} tags`:r.nothing}
1103
+ title=${s?`You can select up to ${es} tags`:r.nothing}
1096
1104
  @click=${()=>!s&&this._toggle(t.sid)}
1097
1105
  >
1098
1106
  <ap-checkbox ?checked=${e}></ap-checkbox>
@@ -1145,7 +1153,7 @@
1145
1153
  ${this._atLimit?r.html`
1146
1154
  <div class="info-alert">
1147
1155
  <ap-icon name="info" .size=${14}></ap-icon>
1148
- <span>You can select up to ${Jt} tags.</span>
1156
+ <span>You can select up to ${es} tags.</span>
1149
1157
  </div>
1150
1158
  `:r.nothing}
1151
1159
  </div>
@@ -1194,7 +1202,7 @@
1194
1202
  ${t.length>0?r.html`<div class="separator"></div>`:r.nothing}
1195
1203
 
1196
1204
  <div class="hint-message">Find more tags by using search</div>
1197
- `}};Te.styles=[Y,Ce,r.css`
1205
+ `}};Le.styles=[W,Fe,r.css`
1198
1206
  .tag-item {
1199
1207
  display: flex;
1200
1208
  align-items: center;
@@ -1279,14 +1287,14 @@
1279
1287
  max-height: none;
1280
1288
  overflow-y: visible;
1281
1289
  }
1282
- `];lt([l.property({type:Array})],Te.prototype,"tags",2);lt([l.property({type:Array})],Te.prototype,"selected",2);lt([l.property()],Te.prototype,"filterKey",2);lt([l.query(".tag-search")],Te.prototype,"_searchInput",2);lt([l.state()],Te.prototype,"_search",2);Te=lt([l.customElement("ap-filter-tags")],Te);var Ao=Object.defineProperty,To=Object.getOwnPropertyDescriptor,St=(t,e,s,i)=>{for(var a=i>1?void 0:i?To(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ao(e,s,a),a};let Ve=class extends r.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=es}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:s,operator:C.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:[],operator:C.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return r.html`
1290
+ `];ct([l.property({type:Array})],Le.prototype,"tags",2);ct([l.property({type:Array})],Le.prototype,"selected",2);ct([l.property()],Le.prototype,"filterKey",2);ct([l.query(".tag-search")],Le.prototype,"_searchInput",2);ct([l.state()],Le.prototype,"_search",2);Le=ct([l.customElement("ap-filter-tags")],Le);var Mo=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?Po(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mo(e,s,a),a};let He=class extends r.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=ts}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:s,operator:C.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:[],operator:C.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return r.html`
1283
1291
  <div
1284
1292
  class="label-item ${s?"disabled":""}"
1285
- title=${s?`You can select up to ${es} labels`:r.nothing}
1293
+ title=${s?`You can select up to ${ts} labels`:r.nothing}
1286
1294
  @click=${()=>!s&&this._toggle(t.sid)}
1287
1295
  >
1288
1296
  <ap-checkbox ?checked=${e}></ap-checkbox>
1289
- <span class="label-icon" style="color: ${t.color}">
1297
+ <span class="label-icon" ${F({color:t.color})}>
1290
1298
  <ap-icon name="tag" .size=${16}></ap-icon>
1291
1299
  </span>
1292
1300
  <span class="label-name">${t.name}</span>
@@ -1324,7 +1332,7 @@
1324
1332
  <div class="chips-wrap">
1325
1333
  ${this.selected.map(s=>{const i=this._getLabelBySid(s);return i?r.html`
1326
1334
  <div class="chip">
1327
- <span class="chip-icon" style="color: ${i.color}">
1335
+ <span class="chip-icon" ${F({color:i.color})}>
1328
1336
  <ap-icon name="tag" .size=${12}></ap-icon>
1329
1337
  </span>
1330
1338
  <span class="chip-label">${i.name}</span>
@@ -1356,11 +1364,11 @@
1356
1364
  ${this._atLimit?r.html`
1357
1365
  <div class="info-alert">
1358
1366
  <ap-icon name="info" .size=${14}></ap-icon>
1359
- <span>You can select up to ${es} labels.</span>
1367
+ <span>You can select up to ${ts} labels.</span>
1360
1368
  </div>
1361
1369
  `:r.nothing}
1362
1370
  </div>
1363
- `}};Ve.styles=[Ce,r.css`
1371
+ `}};He.styles=[Fe,r.css`
1364
1372
  .label-item {
1365
1373
  display: flex;
1366
1374
  align-items: center;
@@ -1409,12 +1417,12 @@
1409
1417
  flex-shrink: 0;
1410
1418
  line-height: 0;
1411
1419
  }
1412
- `];St([l.property({type:Array})],Ve.prototype,"labels",2);St([l.property({type:Array})],Ve.prototype,"selected",2);St([l.query(".search-input")],Ve.prototype,"_searchInput",2);St([l.state()],Ve.prototype,"_search",2);Ve=St([l.customElement("ap-filter-labels")],Ve);var Lo=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?Oo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lo(e,s,a),a};const ls=3,hs=/^#[0-9A-Fa-f]{6}$/;function Mo(t){const e=t.trim().split(/\s+/);return e.length<1||!hs.test(e[0])?null:{hex:e[0],tolerance:e[1]||Mt,coverage:e[3]||Ot}}let Le=class extends r.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=Mo(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Mt||s.coverage!==Ot)),this._initialized=!0)}}_selectColor(t){if(!hs.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=ls||(this._colors=[...this._colors,{hex:t,tolerance:Mt,coverage:Ot}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!hs.test(i)||this._colors.some((n,c)=>c!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const o=[...this._colors];o[t]={...o[t],hex:i},this._colors=o,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Mt,i=this._advanced?e.coverage:Ot;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=ls;return r.html`
1420
+ `];Ct([l.property({type:Array})],He.prototype,"labels",2);Ct([l.property({type:Array})],He.prototype,"selected",2);Ct([l.query(".search-input")],He.prototype,"_searchInput",2);Ct([l.state()],He.prototype,"_search",2);He=Ct([l.customElement("ap-filter-labels")],He);var Io=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Do(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Io(e,s,a),a};const ds=3,fs=/^#[0-9A-Fa-f]{6}$/;function zo(t){const e=t.trim().split(/\s+/);return e.length<1||!fs.test(e[0])?null:{hex:e[0],tolerance:e[1]||Pt,coverage:e[3]||Mt}}let Oe=class extends r.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=zo(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Pt||s.coverage!==Mt)),this._initialized=!0)}}_selectColor(t){if(!fs.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=ds||(this._colors=[...this._colors,{hex:t,tolerance:Pt,coverage:Mt}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!fs.test(i)||this._colors.some((n,c)=>c!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const o=[...this._colors];o[t]={...o[t],hex:i},this._colors=o,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Pt,i=this._advanced?e.coverage:Mt;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=ds;return r.html`
1413
1421
  <div class="palette">
1414
- ${ya.map(s=>{const i=t.has(s),a=e&&!i;return r.html`
1422
+ ${$a.map(s=>{const i=t.has(s),a=e&&!i;return r.html`
1415
1423
  <button
1416
1424
  class="swatch ${i?"selected":""} ${a?"disabled":""}"
1417
- style="background:${s};${s==="#ffffff"?" border: 1px solid #e4e4e7;":""}"
1425
+ ${F({background:s,...s==="#ffffff"?{border:"1px solid #e4e4e7"}:{}})}
1418
1426
  @click=${()=>!a&&this._selectColor(s)}
1419
1427
  title=${s}
1420
1428
  ?disabled=${a}
@@ -1425,8 +1433,8 @@
1425
1433
  <div class="color-row advanced">
1426
1434
  <div class="adv-field">
1427
1435
  <span class="adv-field-label">Color</span>
1428
- <div class="color-row" style="gap: 6px;">
1429
- <div class="color-swatch-small" style="background:${t.hex}"></div>
1436
+ <div class="color-row">
1437
+ <div class="color-swatch-small" ${F({background:t.hex})}></div>
1430
1438
  <input
1431
1439
  class="color-hex-input"
1432
1440
  type="text"
@@ -1440,7 +1448,7 @@
1440
1448
  <span class="adv-field-label">Difference</span>
1441
1449
  <ap-dropdown
1442
1450
  .value=${t.tolerance}
1443
- .options=${xa}
1451
+ .options=${ka}
1444
1452
  @ap-change=${s=>this._handleToleranceChange(e,s)}
1445
1453
  ></ap-dropdown>
1446
1454
  </div>
@@ -1458,13 +1466,13 @@
1458
1466
  />
1459
1467
  </div>
1460
1468
  </div>
1461
- <button class="remove-btn" style="align-self: end; margin-bottom: 8px;" title="Remove color" @click=${()=>this._removeColor(e)}>
1469
+ <button class="remove-btn" title="Remove color" @click=${()=>this._removeColor(e)}>
1462
1470
  <ap-icon name="close" .size=${14}></ap-icon>
1463
1471
  </button>
1464
1472
  </div>
1465
1473
  `:r.html`
1466
1474
  <div class="color-row">
1467
- <div class="color-swatch-small" style="background:${t.hex}"></div>
1475
+ <div class="color-swatch-small" ${F({background:t.hex})}></div>
1468
1476
  <input
1469
1477
  class="color-hex-input"
1470
1478
  type="text"
@@ -1476,7 +1484,7 @@
1476
1484
  <ap-icon name="close" .size=${14}></ap-icon>
1477
1485
  </button>
1478
1486
  </div>
1479
- `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<ls&&!this._showPalette;return r.html`
1487
+ `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<ds&&!this._showPalette;return r.html`
1480
1488
  <div class="filter-content">
1481
1489
  <button
1482
1490
  class="clear-btn"
@@ -1521,7 +1529,7 @@
1521
1529
  <span>Requires image processing to be enabled.</span>
1522
1530
  </div>
1523
1531
  </div>
1524
- `}};Le.styles=[Y,Ce,r.css`
1532
+ `}};Oe.styles=[W,Fe,r.css`
1525
1533
  /* ── Palette ── */
1526
1534
  .palette {
1527
1535
  display: grid;
@@ -1677,6 +1685,11 @@
1677
1685
  gap: 8px;
1678
1686
  }
1679
1687
 
1688
+ .color-row.advanced .remove-btn {
1689
+ align-self: end;
1690
+ margin-bottom: 8px;
1691
+ }
1692
+
1680
1693
  .adv-field {
1681
1694
  display: flex;
1682
1695
  flex-direction: column;
@@ -1758,7 +1771,7 @@
1758
1771
  .add-color-btn:hover {
1759
1772
  opacity: 0.8;
1760
1773
  }
1761
- `];ct([l.property({type:Array})],Le.prototype,"values",2);ct([l.state()],Le.prototype,"_colors",2);ct([l.state()],Le.prototype,"_advanced",2);ct([l.state()],Le.prototype,"_showPalette",2);ct([l.state()],Le.prototype,"_initialized",2);Le=ct([l.customElement("ap-filter-color")],Le);var Io=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Po(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Io(e,s,a),a};const Do={KB:1/1e3,MB:1,GB:1e3},zo=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let $e=class extends r.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=Do[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[],operator:C.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[i],operator:C.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return r.html`
1774
+ `];dt([l.property({type:Array})],Oe.prototype,"values",2);dt([l.state()],Oe.prototype,"_colors",2);dt([l.state()],Oe.prototype,"_advanced",2);dt([l.state()],Oe.prototype,"_showPalette",2);dt([l.state()],Oe.prototype,"_initialized",2);Oe=dt([l.customElement("ap-filter-color")],Oe);var Ro=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?jo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ro(e,s,a),a};const No={KB:1/1e3,MB:1,GB:1e3},Uo=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let ke=class extends r.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=No[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[],operator:C.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[i],operator:C.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return r.html`
1762
1775
  <div class="filter-content">
1763
1776
  <span class="section-label">Size</span>
1764
1777
  <button
@@ -1795,14 +1808,14 @@
1795
1808
  <div>
1796
1809
  <span class="input-label">Unit</span>
1797
1810
  <ap-dropdown
1798
- .options=${zo}
1811
+ .options=${Uo}
1799
1812
  .value=${this._unit}
1800
1813
  @ap-change=${this._setUnit}
1801
1814
  ></ap-dropdown>
1802
1815
  </div>
1803
1816
  </div>
1804
1817
  </div>
1805
- `}};$e.styles=[Ce,r.css`
1818
+ `}};ke.styles=[Fe,r.css`
1806
1819
  /* Hide number input spinners */
1807
1820
  .filter-input[type='number']::-webkit-inner-spin-button,
1808
1821
  .filter-input[type='number']::-webkit-outer-spin-button {
@@ -1821,19 +1834,19 @@
1821
1834
  display: block;
1822
1835
  width: 100%;
1823
1836
  }
1824
- `];Qe([l.property({type:Number})],$e.prototype,"min",2);Qe([l.property({type:Number})],$e.prototype,"max",2);Qe([l.state()],$e.prototype,"_minVal",2);Qe([l.state()],$e.prototype,"_maxVal",2);Qe([l.state()],$e.prototype,"_unit",2);Qe([l.state()],$e.prototype,"_initialized",2);$e=Qe([l.customElement("ap-filter-size")],$e);var Ro=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Qt=(t,e,s,i)=>{for(var a=i>1?void 0:i?jo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ro(e,s,a),a};const No=r.svg`
1837
+ `];Ye([l.property({type:Number})],ke.prototype,"min",2);Ye([l.property({type:Number})],ke.prototype,"max",2);Ye([l.state()],ke.prototype,"_minVal",2);Ye([l.state()],ke.prototype,"_maxVal",2);Ye([l.state()],ke.prototype,"_unit",2);Ye([l.state()],ke.prototype,"_initialized",2);ke=Ye([l.customElement("ap-filter-size")],ke);var Bo=Object.defineProperty,qo=Object.getOwnPropertyDescriptor,Yt=(t,e,s,i)=>{for(var a=i>1?void 0:i?qo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Bo(e,s,a),a};const Vo=r.svg`
1825
1838
  <svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1826
1839
  <path d="M2.66666 1.9987C2.29847 1.9987 1.99999 2.29717 1.99999 2.66536L1.99999 13.332C1.99999 13.7002 2.29847 13.9987 2.66666 13.9987L9.33332 13.9987C9.70151 13.9987 9.99999 13.7002 9.99999 13.332L9.99999 2.66536C9.99999 2.29717 9.70151 1.9987 9.33332 1.9987L2.66666 1.9987ZM9.33332 0.665364C10.4379 0.665364 11.3333 1.56079 11.3333 2.66536L11.3333 13.332C11.3333 14.4366 10.4379 15.332 9.33332 15.332L2.66666 15.332C1.56209 15.332 0.666656 14.4366 0.666656 13.332L0.666656 2.66536C0.666656 1.56079 1.56209 0.665364 2.66666 0.665364L9.33332 0.665364Z" fill="#9747FF"/>
1827
1840
  <path d="M5.33332 4.65885C5.33332 4.29066 5.6318 3.99219 5.99999 3.99219C6.36818 3.99219 6.66666 4.29066 6.66666 4.65885L6.66666 4.66536C6.66666 5.03355 6.36818 5.33203 5.99999 5.33203C5.6318 5.33203 5.33332 5.03355 5.33332 4.66536L5.33332 4.65885Z" fill="#9747FF"/>
1828
1841
  <path d="M5.33332 11.3255C5.33332 10.9573 5.6318 10.6589 5.99999 10.6589C6.36818 10.6589 6.66666 10.9573 6.66666 11.3255L6.66666 11.332C6.66666 11.7002 6.36818 11.9987 5.99999 11.9987C5.6318 11.9987 5.33332 11.7002 5.33332 11.332L5.33332 11.3255Z" fill="#9747FF"/>
1829
1842
  </svg>
1830
- `,Uo=r.svg`
1843
+ `,Ho=r.svg`
1831
1844
  <svg width="20" height="20" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1832
1845
  <path d="M14 2.66797C14 2.29978 13.7015 2.0013 13.3333 2.0013H2.66666C2.29847 2.0013 1.99999 2.29978 1.99999 2.66797V9.33463C1.99999 9.70282 2.29847 10.0013 2.66666 10.0013H13.3333C13.7015 10.0013 14 9.70282 14 9.33463V2.66797ZM15.3333 9.33463C15.3333 10.4392 14.4379 11.3346 13.3333 11.3346H2.66666C1.56209 11.3346 0.666656 10.4392 0.666656 9.33463V2.66797C0.666656 1.5634 1.56209 0.667969 2.66666 0.667969H13.3333C14.4379 0.667969 15.3333 1.5634 15.3333 2.66797V9.33463Z" fill="#65A30D"/>
1833
1846
  <path d="M11.3398 5.33464C11.708 5.33464 12.0065 5.63311 12.0065 6.0013C12.0065 6.36949 11.708 6.66797 11.3398 6.66797H11.3333C10.9651 6.66797 10.6667 6.36949 10.6667 6.0013C10.6667 5.63311 10.9651 5.33464 11.3333 5.33464H11.3398Z" fill="#65A30D"/>
1834
1847
  <path d="M4.67317 5.33464C5.04136 5.33464 5.33983 5.63311 5.33983 6.0013C5.33983 6.36949 5.04136 6.66797 4.67317 6.66797H4.66666C4.29847 6.66797 3.99999 6.36949 3.99999 6.0013C3.99999 5.63311 4.29847 5.33464 4.66666 5.33464H4.67317Z" fill="#65A30D"/>
1835
1848
  </svg>
1836
- `,Bo=r.svg`
1849
+ `,Go=r.svg`
1837
1850
  <svg width="20" height="20" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1838
1851
  <path d="M12.3333 2.33203C12.3333 1.96384 12.0349 1.66536 11.6667 1.66536H2.33334C1.96515 1.66536 1.66668 1.96384 1.66668 2.33203V11.6654C1.66668 12.0336 1.96515 12.332 2.33334 12.332H11.6667C12.0349 12.332 12.3333 12.0336 12.3333 11.6654V2.33203ZM13.6667 11.6654C13.6667 12.7699 12.7712 13.6654 11.6667 13.6654H2.33334C1.22877 13.6654 0.333344 12.7699 0.333344 11.6654V2.33203C0.333344 1.22746 1.22877 0.332031 2.33334 0.332031H11.6667C12.7712 0.332031 13.6667 1.22746 13.6667 2.33203V11.6654Z" fill="#6366F1"/>
1839
1852
  <path d="M9.67319 3.66536C10.0414 3.66536 10.3399 3.96384 10.3399 4.33203C10.3399 4.70022 10.0414 4.9987 9.67319 4.9987H9.66668C9.29849 4.9987 9.00001 4.70022 9.00001 4.33203C9.00001 3.96384 9.29849 3.66536 9.66668 3.66536H9.67319Z" fill="#6366F1"/>
@@ -1841,13 +1854,13 @@
1841
1854
  <path d="M4.33985 8.9987C4.70804 8.9987 5.00652 9.29718 5.00652 9.66537C5.00652 10.0336 4.70804 10.332 4.33985 10.332H4.33334C3.96515 10.332 3.66668 10.0336 3.66668 9.66537C3.66668 9.29718 3.96515 8.9987 4.33334 8.9987H4.33985Z" fill="#6366F1"/>
1842
1855
  <path d="M9.67319 8.9987C10.0414 8.9987 10.3399 9.29718 10.3399 9.66537C10.3399 10.0336 10.0414 10.332 9.67319 10.332H9.66668C9.29849 10.332 9.00001 10.0336 9.00001 9.66537C9.00001 9.29718 9.29849 8.9987 9.66668 8.9987H9.67319Z" fill="#6366F1"/>
1843
1856
  </svg>
1844
- `,qo=r.svg`
1857
+ `,Ko=r.svg`
1845
1858
  <svg width="20" height="20" viewBox="0 0 16 8" fill="none" xmlns="http://www.w3.org/2000/svg">
1846
1859
  <path d="M14 2.33203C14 1.96384 13.7015 1.66536 13.3333 1.66536H2.66666C2.29847 1.66536 1.99999 1.96384 1.99999 2.33203V5.66536C1.99999 6.03355 2.29847 6.33203 2.66666 6.33203H13.3333C13.7015 6.33203 14 6.03355 14 5.66536V2.33203ZM15.3333 5.66536C15.3333 6.76993 14.4379 7.66536 13.3333 7.66536H2.66666C1.56209 7.66536 0.666656 6.76993 0.666656 5.66536V2.33203C0.666656 1.22746 1.56209 0.332031 2.66666 0.332031H13.3333C14.4379 0.332031 15.3333 1.22746 15.3333 2.33203V5.66536Z" fill="#4BA3AD"/>
1847
1860
  <path d="M11.3398 3.33203C11.708 3.33203 12.0065 3.63051 12.0065 3.9987C12.0065 4.36689 11.708 4.66536 11.3398 4.66536H11.3333C10.9651 4.66536 10.6667 4.36689 10.6667 3.9987C10.6667 3.63051 10.9651 3.33203 11.3333 3.33203H11.3398Z" fill="#4BA3AD"/>
1848
1861
  <path d="M4.67317 3.33203C5.04136 3.33203 5.33983 3.63051 5.33983 3.9987C5.33983 4.36689 5.04136 4.66536 4.67317 4.66536H4.66666C4.29847 4.66536 3.99999 4.36689 3.99999 3.9987C3.99999 3.63051 4.29847 3.33203 4.66666 3.33203H4.67317Z" fill="#4BA3AD"/>
1849
1862
  </svg>
1850
- `,Vo={portrait:No,landscape:Uo,square:Bo,panorama:qo};let at=class extends r.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return r.html`
1863
+ `,Qo={portrait:Vo,landscape:Ho,square:Go,panorama:Ko};let ot=class extends r.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return r.html`
1851
1864
  <div class="filter-content">
1852
1865
  <button
1853
1866
  class="clear-btn"
@@ -1858,7 +1871,7 @@
1858
1871
  <div class="filter-section">
1859
1872
  <span class="section-label">Resolution</span>
1860
1873
  <div class="options-horizontal">
1861
- ${va.map(t=>r.html`
1874
+ ${_a.map(t=>r.html`
1862
1875
  <ap-checkbox
1863
1876
  ?checked=${this.selectedResolution.includes(t.value)}
1864
1877
  @ap-toggle=${()=>{this._toggleResolution(t.value)}}
@@ -1870,11 +1883,11 @@
1870
1883
  <div class="filter-section">
1871
1884
  <span class="section-label">Orientation</span>
1872
1885
  <div class="options-vertical">
1873
- ${ma.map(t=>r.html`
1886
+ ${ya.map(t=>r.html`
1874
1887
  <ap-checkbox
1875
1888
  ?checked=${this.selectedOrientation.includes(t.value)}
1876
1889
  @ap-toggle=${()=>{this._toggleOrientation(t.value)}}
1877
- ><span class="orientation-label">${Vo[t.value]}${t.label}</span></ap-checkbox>
1890
+ ><span class="orientation-label">${Qo[t.value]}${t.label}</span></ap-checkbox>
1878
1891
  `)}
1879
1892
  </div>
1880
1893
  </div>
@@ -1882,7 +1895,7 @@
1882
1895
  <div class="filter-section">
1883
1896
  <span class="section-label">Faces</span>
1884
1897
  <div class="options-horizontal">
1885
- ${ba.map(t=>r.html`
1898
+ ${xa.map(t=>r.html`
1886
1899
  <ap-checkbox
1887
1900
  ?checked=${this.selectedFaces.includes(t.value)}
1888
1901
  @ap-toggle=${()=>{this._toggleFaces(t.value)}}
@@ -1896,7 +1909,7 @@
1896
1909
  <span>Some images might not have been processed, so they won't be displayed.</span>
1897
1910
  </div>
1898
1911
  </div>
1899
- `}};at.styles=[Ce,r.css`
1912
+ `}};ot.styles=[Fe,r.css`
1900
1913
  .options-horizontal {
1901
1914
  display: flex;
1902
1915
  gap: 28px;
@@ -1917,14 +1930,14 @@
1917
1930
  .orientation-label svg {
1918
1931
  flex-shrink: 0;
1919
1932
  }
1920
- `];Qt([l.property({type:Array})],at.prototype,"selectedResolution",2);Qt([l.property({type:Array})],at.prototype,"selectedOrientation",2);Qt([l.property({type:Array})],at.prototype,"selectedFaces",2);at=Qt([l.customElement("ap-filter-image")],at);var Ho=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,P=(t,e,s,i)=>{for(var a=i>1?void 0:i?Go(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ho(e,s,a),a};function A(t){return`${Gt[t.type]||""}${t.key}`}let I=class extends r.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=Tt}_getField(t){return this.fields.find(e=>A(e)===t)}_getUIType(t){return Sa[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===re||t[0]===ne}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===re?re:((i=e.values)==null?void 0:i[0])===ne?ne:this._specificModeFields.has(t)||e.values&&e.values.length>0?ze:""}_emitFilterChange(t,e,s){const i=A(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:i,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=A(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=A(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=A(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const i=this._getApplied(A(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=A(t);if(e===ze){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}if(e)this._onEmptyOption(t,e);else{const i=this._getApplied(s);this._emitFilterChange(t,i.operator,[])}}}_clearFieldFilter(t){const e=A(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...o}=this._dateFroms;this._dateFroms=o;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...g}=this._tagInputs;this._tagInputs=g,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(A(t)).operator||ss[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=A(t),o=this._getApplied(a),n=o.operator||as[0].value,c=[...o.values||[]];s===0?c[0]=i:c[1]=i;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===$.DECIMAL2;if(!d.every(g=>h?!isNaN(parseFloat(g)):/^-?\d+$/.test(g)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(A(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=A(t),i=this._getApplied(s),a=i.operator||ye[0].value,o=i.values||[];o.length===1&&o[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=A(t),i=this._getApplied(s),a=i.operator||is[0].value,o=i.values||[],n=o.includes(e)?o.filter(c=>c!==e):[...o,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=A(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const i=s.target.value;if(i.includes(",")){const a=i.replace(/,/g,"").trim();a&&(this._tagInputs={...this._tagInputs,[e]:a},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:i},this._fetchTagSuggestions(t,e,i.trim())}_selectTagSuggestion(t,e){const s=A(t),i=this._getApplied(s),a=i.operator||ye[0].value,o=i.values||[];o.includes(e)||this._emitFilterChange(t,a,[...o,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(o=>o.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||ye[0].value,o=i.values||[];o.includes(s)||this._emitFilterChange(t,a,[...o,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=A(t),i=this._getApplied(s),a=i.operator||ye[0].value,o=i.values||[];this._emitFilterChange(t,a,o.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=A(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=A(t);if(!e){this._clearFieldFilter(t);return}if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",o="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),o=i.toISOString();break}case"last_week":{const n=new Date(i),c=n.getDay();n.setDate(n.getDate()-(c===0?6:c-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),o=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),c=new Date(n);c.setMonth(c.getMonth()-1),a=c.toISOString(),o=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),a=c.toISOString(),o=n.toISOString();break}}a&&o&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:o},this._emitFilterChange(t,"..",[a,o]))}_onDateInput(t,e,s){const i=s.target.value,a=A(t),o=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let c=this._dateFroms[a]||"",d=this._dateTos[a]||"";o==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),o==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var g;const s=e.target.value.trim(),i=A(t),a=(g=this.shadowRoot)==null?void 0:g.querySelector(`[data-geo-radius="${i}"]`),o=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[c,d]=n;let u=`${c},${d}..${o||"0"}`;this._emitFilterChange(t,C.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=A(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const o=a.values[0],[n]=o.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,C.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(A(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,o)=>o.length===0?r.nothing:r.html`
1933
+ `];Yt([l.property({type:Array})],ot.prototype,"selectedResolution",2);Yt([l.property({type:Array})],ot.prototype,"selectedOrientation",2);Yt([l.property({type:Array})],ot.prototype,"selectedFaces",2);ot=Yt([l.customElement("ap-filter-image")],ot);var Yo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,D=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Yo(e,s,a),a};function T(t){return`${Kt[t.type]||""}${t.key}`}let I=class extends r.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=Lt}_getField(t){return this.fields.find(e=>T(e)===t)}_getUIType(t){return Ea[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===ne||t[0]===le}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===ne?ne:((i=e.values)==null?void 0:i[0])===le?le:this._specificModeFields.has(t)||e.values&&e.values.length>0?Re:""}_emitFilterChange(t,e,s){const i=T(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:i,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=T(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=T(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=T(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const i=this._getApplied(T(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=T(t);if(e===Re){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}if(e)this._onEmptyOption(t,e);else{const i=this._getApplied(s);this._emitFilterChange(t,i.operator,[])}}}_clearFieldFilter(t){const e=T(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...o}=this._dateFroms;this._dateFroms=o;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...g}=this._tagInputs;this._tagInputs=g,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(T(t)).operator||is[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=T(t),o=this._getApplied(a),n=o.operator||os[0].value,c=[...o.values||[]];s===0?c[0]=i:c[1]=i;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===$.DECIMAL2;if(!d.every(g=>h?!isNaN(parseFloat(g)):/^-?\d+$/.test(g)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(T(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||xe[0].value,o=i.values||[];o.length===1&&o[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||as[0].value,o=i.values||[],n=o.includes(e)?o.filter(c=>c!==e):[...o,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=T(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const i=s.target.value;if(i.includes(",")){const a=i.replace(/,/g,"").trim();a&&(this._tagInputs={...this._tagInputs,[e]:a},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:i},this._fetchTagSuggestions(t,e,i.trim())}_selectTagSuggestion(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||xe[0].value,o=i.values||[];o.includes(e)||this._emitFilterChange(t,a,[...o,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(o=>o.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||xe[0].value,o=i.values||[];o.includes(s)||this._emitFilterChange(t,a,[...o,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=T(t),i=this._getApplied(s),a=i.operator||xe[0].value,o=i.values||[];this._emitFilterChange(t,a,o.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=T(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=T(t);if(!e){this._clearFieldFilter(t);return}if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",o="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),o=i.toISOString();break}case"last_week":{const n=new Date(i),c=n.getDay();n.setDate(n.getDate()-(c===0?6:c-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),o=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),c=new Date(n);c.setMonth(c.getMonth()-1),a=c.toISOString(),o=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),a=c.toISOString(),o=n.toISOString();break}}a&&o&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:o},this._emitFilterChange(t,"..",[a,o]))}_onDateInput(t,e,s){const i=s.target.value,a=T(t),o=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let c=this._dateFroms[a]||"",d=this._dateTos[a]||"";o==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),o==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var g;const s=e.target.value.trim(),i=T(t),a=(g=this.shadowRoot)==null?void 0:g.querySelector(`[data-geo-radius="${i}"]`),o=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[c,d]=n;let u=`${c},${d}..${o||"0"}`;this._emitFilterChange(t,C.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=T(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const o=a.values[0],[n]=o.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,C.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(T(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,o)=>o.length===0?r.nothing:r.html`
1921
1934
  <div class="field-group-label">${a}</div>
1922
- ${o.map(n=>{const c=A(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return r.html`
1935
+ ${o.map(n=>{const c=T(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return r.html`
1923
1936
  <div
1924
1937
  class="field-item ${d?"selected":""} ${h?"disabled":""}"
1925
1938
  @click=${()=>!h&&!d&&this._addField(n)}
1926
1939
  >
1927
- ${d?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.html`<ap-icon name=${It[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>`}
1940
+ ${d?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.html`<ap-icon name=${It[n.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>`}
1928
1941
  <span>${n.label}</span>
1929
1942
  </div>
1930
1943
  `})}
@@ -1953,8 +1966,8 @@
1953
1966
  ${e.length===0?r.html`<div class="empty-msg">No fields found</div>`:r.html`${[...s.entries()].map(([a,o])=>i(a,o))}`}
1954
1967
  </div>
1955
1968
  </div>
1956
- `}_renderTextFilter(t){var h,u;const e=A(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",o=this._getContentMode(e),n=o===re||o===ne,c=s.operator||ss[0].value,d=t.type===$.TEXT_AREA;return r.html`
1957
- <div class="filter-content" style="position: relative;">
1969
+ `}_renderTextFilter(t){var h,u;const e=T(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",o=this._getContentMode(e),n=o===ne||o===le,c=s.operator||is[0].value,d=t.type===$.TEXT_AREA;return r.html`
1970
+ <div class="filter-content">
1958
1971
  <button
1959
1972
  class="clear-btn"
1960
1973
  ?disabled=${!((u=s.values)!=null&&u.length)&&!s.operator}
@@ -1965,7 +1978,7 @@
1965
1978
  <span class="section-label">Operator</span>
1966
1979
  <ap-radio-group
1967
1980
  direction="horizontal"
1968
- .options=${ss}
1981
+ .options=${is}
1969
1982
  .value=${c}
1970
1983
  ?disabled=${n}
1971
1984
  @ap-change=${g=>this._onOperatorChange(t,g.detail.value)}
@@ -1976,13 +1989,13 @@
1976
1989
  <span class="section-label">Content</span>
1977
1990
  <ap-radio-group
1978
1991
  clearable
1979
- .options=${os}
1992
+ .options=${rs}
1980
1993
  .value=${o}
1981
1994
  @ap-change=${g=>this._onContentModeChange(t,g.detail.value)}
1982
1995
  ></ap-radio-group>
1983
1996
  </div>
1984
1997
 
1985
- ${o===ze?r.html`
1998
+ ${o===Re?r.html`
1986
1999
  <div class="filter-section">
1987
2000
  <span class="section-label">Value</span>
1988
2001
  ${d?r.html`
@@ -2005,8 +2018,8 @@
2005
2018
  </div>
2006
2019
  `:r.nothing}
2007
2020
  </div>
2008
- `}_renderNumberFilter(t){var y,T,k;const e=A(t),s=this._getApplied(e),i=s.operator||as[0].value,a=this._isSpecialValue(s.values),o=this._getContentMode(e),n=o===re||o===ne,c=i===C.RANGE,d=i===C.GREATER_THAN_OR_EQUAL,h=i===C.LESS_THAN_OR_EQUAL,u=t.type===$.DECIMAL2,g=u?"0.01":"1",p=u?"0.00":"0",f=a?"":((y=s.values)==null?void 0:y[0])||"",m=a?"":((T=s.values)==null?void 0:T[1])||"",x=c||d||h,_=c||d||h?"Min":"Value";return r.html`
2009
- <div class="filter-content" style="position: relative;">
2021
+ `}_renderNumberFilter(t){var y,L,k;const e=T(t),s=this._getApplied(e),i=s.operator||os[0].value,a=this._isSpecialValue(s.values),o=this._getContentMode(e),n=o===ne||o===le,c=i===C.RANGE,d=i===C.GREATER_THAN_OR_EQUAL,h=i===C.LESS_THAN_OR_EQUAL,u=t.type===$.DECIMAL2,g=u?"0.01":"1",p=u?"0.00":"0",f=a?"":((y=s.values)==null?void 0:y[0])||"",m=a?"":((L=s.values)==null?void 0:L[1])||"",x=c||d||h,_=c||d||h?"Min":"Value";return r.html`
2022
+ <div class="filter-content">
2010
2023
  <button
2011
2024
  class="clear-btn"
2012
2025
  ?disabled=${!((k=s.values)!=null&&k.length)&&!s.operator}
@@ -2017,7 +2030,7 @@
2017
2030
  <span class="section-label">Condition</span>
2018
2031
  <ap-radio-group
2019
2032
  columns="2"
2020
- .options=${as}
2033
+ .options=${os}
2021
2034
  .value=${i}
2022
2035
  ?disabled=${n}
2023
2036
  @ap-change=${S=>this._onOperatorChange(t,S.detail.value)}
@@ -2028,13 +2041,13 @@
2028
2041
  <span class="section-label">Content</span>
2029
2042
  <ap-radio-group
2030
2043
  clearable
2031
- .options=${os}
2044
+ .options=${rs}
2032
2045
  .value=${o}
2033
2046
  @ap-change=${S=>this._onContentModeChange(t,S.detail.value)}
2034
2047
  ></ap-radio-group>
2035
2048
  </div>
2036
2049
 
2037
- ${o===ze?r.html`
2050
+ ${o===Re?r.html`
2038
2051
  <div class="filter-section">
2039
2052
  <div class="grid-2">
2040
2053
  <div>
@@ -2067,8 +2080,8 @@
2067
2080
  </div>
2068
2081
  `:r.nothing}
2069
2082
  </div>
2070
- `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(A(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
2071
- <div class="filter-content" style="position: relative;">
2083
+ `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(T(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
2084
+ <div class="filter-content">
2072
2085
  <button
2073
2086
  class="clear-btn"
2074
2087
  ?disabled=${!((a=e.values)!=null&&a.length)}
@@ -2079,13 +2092,13 @@
2079
2092
  <span class="section-label">Value</span>
2080
2093
  <ap-radio-group
2081
2094
  clearable
2082
- .options=${ka}
2095
+ .options=${Fa}
2083
2096
  .value=${s}
2084
2097
  @ap-change=${o=>this._onBooleanSelect(t,o.detail.value)}
2085
2098
  ></ap-radio-group>
2086
2099
  </div>
2087
2100
  </div>
2088
- `}_renderSelectOneFilter(t){const e=A(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||ye[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,g=a.length>=Tt;return r.html`
2101
+ `}_renderSelectOneFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||xe[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,g=a.length>=Lt;return r.html`
2089
2102
  <div class="filter-content">
2090
2103
  <!-- Search input -->
2091
2104
  <div class="search-wrapper">
@@ -2126,7 +2139,7 @@
2126
2139
  </div>
2127
2140
  <ap-radio-group
2128
2141
  direction="horizontal"
2129
- .options=${ye}
2142
+ .options=${xe}
2130
2143
  .value=${n}
2131
2144
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2132
2145
  ></ap-radio-group>
@@ -2162,7 +2175,7 @@
2162
2175
 
2163
2176
  <!-- Empty/Not empty checkboxes -->
2164
2177
  <div class="options-list short">
2165
- ${Ne.map(p=>{var f;return r.html`
2178
+ ${Ue.map(p=>{var f;return r.html`
2166
2179
  <div
2167
2180
  class="option-item"
2168
2181
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2189,7 +2202,7 @@
2189
2202
  </div>
2190
2203
  </div>
2191
2204
  </div>
2192
- `}_renderMultiSelectFilter(t){const e=A(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||is[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,g=a.length>=Tt;return r.html`
2205
+ `}_renderMultiSelectFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||as[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,g=a.length>=Lt;return r.html`
2193
2206
  <div class="filter-content">
2194
2207
  <!-- Search input -->
2195
2208
  <div class="search-wrapper">
@@ -2230,7 +2243,7 @@
2230
2243
  </div>
2231
2244
  <ap-radio-group
2232
2245
  direction="horizontal"
2233
- .options=${is}
2246
+ .options=${as}
2234
2247
  .value=${n}
2235
2248
  @ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
2236
2249
  ></ap-radio-group>
@@ -2266,7 +2279,7 @@
2266
2279
 
2267
2280
  <!-- Empty/Not empty checkboxes -->
2268
2281
  <div class="options-list short">
2269
- ${Ne.map(p=>{var f;return r.html`
2282
+ ${Ue.map(p=>{var f;return r.html`
2270
2283
  <div
2271
2284
  class="option-item"
2272
2285
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2293,7 +2306,7 @@
2293
2306
  </div>
2294
2307
  </div>
2295
2308
  </div>
2296
- `}_renderTagsFilter(t){const e=A(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=this._tagInputs[e]||"",n=s.operator||ye[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=o.trim().length>0,g=a.length>=Tt;return r.html`
2309
+ `}_renderTagsFilter(t){const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=this._tagInputs[e]||"",n=s.operator||xe[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=o.trim().length>0,g=a.length>=Lt;return r.html`
2297
2310
  <div class="filter-content">
2298
2311
  <!-- Search input -->
2299
2312
  <div class="search-wrapper">
@@ -2335,7 +2348,7 @@
2335
2348
  </div>
2336
2349
  <ap-radio-group
2337
2350
  direction="horizontal"
2338
- .options=${ye}
2351
+ .options=${xe}
2339
2352
  .value=${n}
2340
2353
  ?disabled=${i}
2341
2354
  @ap-change=${p=>this._onTagOperatorChange(t,p.detail.value)}
@@ -2369,7 +2382,7 @@
2369
2382
  <div class="filter-section">
2370
2383
  <span class="section-label">All options</span>
2371
2384
  <div class="options-list short">
2372
- ${Ne.map(p=>{var f;return r.html`
2385
+ ${Ue.map(p=>{var f;return r.html`
2373
2386
  <div
2374
2387
  class="option-item"
2375
2388
  @click=${()=>this._onEmptyOption(t,p.value)}
@@ -2399,8 +2412,8 @@
2399
2412
  </div>
2400
2413
  `:r.nothing}
2401
2414
  </div>
2402
- `}_renderDateFilter(t){var u,g;const e=A(t),s=this._datePresets[e]||"",i=this._getApplied(e),o=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(o);return r.html`
2403
- <div class="filter-content" style="position: relative;">
2415
+ `}_renderDateFilter(t){var u,g;const e=T(t),s=this._datePresets[e]||"",i=this._getApplied(e),o=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(o);return r.html`
2416
+ <div class="filter-content">
2404
2417
  <button
2405
2418
  class="clear-btn"
2406
2419
  ?disabled=${!o&&!((g=i.values)!=null&&g.length)}
@@ -2420,7 +2433,7 @@
2420
2433
  <ap-radio-group
2421
2434
  clearable
2422
2435
  columns="2"
2423
- .options=${vs}
2436
+ .options=${_s}
2424
2437
  .value=${o!=="empty"&&o!=="non-empty"?o:""}
2425
2438
  @ap-change=${p=>this._onDatePreset(t,p.detail.value)}
2426
2439
  ></ap-radio-group>
@@ -2473,8 +2486,8 @@
2473
2486
  </div>
2474
2487
  `:r.nothing}
2475
2488
  </div>
2476
- `}_renderGeoFilter(t){var u,g;const e=A(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let o="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[f,m]=p.split("..");o=f||"",n=m||""}const c=o.length>0,d=o.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return r.html`
2477
- <div class="filter-content" style="position: relative;">
2489
+ `}_renderGeoFilter(t){var u,g;const e=T(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let o="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[f,m]=p.split("..");o=f||"",n=m||""}const c=o.length>0,d=o.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return r.html`
2490
+ <div class="filter-content">
2478
2491
  <button
2479
2492
  class="clear-btn"
2480
2493
  ?disabled=${!((g=s.values)!=null&&g.length)}
@@ -2485,13 +2498,13 @@
2485
2498
  <span class="section-label">Content</span>
2486
2499
  <ap-radio-group
2487
2500
  clearable
2488
- .options=${os}
2501
+ .options=${rs}
2489
2502
  .value=${a}
2490
2503
  @ap-change=${p=>this._onContentModeChange(t,p.detail.value)}
2491
2504
  ></ap-radio-group>
2492
2505
  </div>
2493
2506
 
2494
- ${a===ze?r.html`
2507
+ ${a===Re?r.html`
2495
2508
  <div class="filter-section">
2496
2509
  <div class="geo-row">
2497
2510
  <div class="geo-location">
@@ -2520,8 +2533,8 @@
2520
2533
  </div>
2521
2534
  `:r.nothing}
2522
2535
  </div>
2523
- `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(A(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
2524
- <div class="filter-content" style="position: relative;">
2536
+ `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(T(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
2537
+ <div class="filter-content">
2525
2538
  <button
2526
2539
  class="clear-btn"
2527
2540
  ?disabled=${!((a=e.values)!=null&&a.length)}
@@ -2531,14 +2544,14 @@
2531
2544
  <div class="filter-section">
2532
2545
  <ap-radio-group
2533
2546
  clearable
2534
- .options=${Ne}
2547
+ .options=${Ue}
2535
2548
  .value=${s}
2536
2549
  @ap-change=${o=>this._onEmptyOption(t,o.detail.value)}
2537
2550
  ></ap-radio-group>
2538
2551
  </div>
2539
2552
  </div>
2540
- `}_renderFaceMatcherFilter(t){const e=A(t),s=this._getApplied(e),i=s.values||[],a=s.operator||C.IS;return r.html`
2541
- <div class="filter-content" style="position: relative;">
2553
+ `}_renderFaceMatcherFilter(t){const e=T(t),s=this._getApplied(e),i=s.values||[],a=s.operator||C.IS;return r.html`
2554
+ <div class="filter-content">
2542
2555
  <button
2543
2556
  class="clear-btn"
2544
2557
  ?disabled=${i.length===0}
@@ -2549,7 +2562,7 @@
2549
2562
  <span class="section-label">Condition</span>
2550
2563
  <ap-radio-group
2551
2564
  direction="horizontal"
2552
- .options=${ye}
2565
+ .options=${xe}
2553
2566
  .value=${a}
2554
2567
  @ap-change=${o=>this._emitFilterChange(t,o.detail.value,i)}
2555
2568
  ></ap-radio-group>
@@ -2574,7 +2587,7 @@
2574
2587
  name="chevron-right"
2575
2588
  .size=${14}
2576
2589
  ></ap-icon>
2577
- <ap-icon name=${It[e.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2590
+ <ap-icon name=${It[e.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>
2578
2591
  <span>${e.label}</span>
2579
2592
  </div>
2580
2593
  <div class="field-header-actions">
@@ -2593,12 +2606,12 @@
2593
2606
  </div>
2594
2607
  `}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,o)=>o.length===0?r.nothing:r.html`
2595
2608
  <div class="field-group-label">${a}</div>
2596
- ${o.map(n=>{const c=A(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),g=!d&&this._atFieldLimit;return r.html`
2609
+ ${o.map(n=>{const c=T(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),g=!d&&this._atFieldLimit;return r.html`
2597
2610
  <div
2598
2611
  class="field-item ${h?"has-filter":""} ${g?"disabled":""}"
2599
2612
  @click=${()=>!g&&this._emitFieldSelect(n)}
2600
2613
  >
2601
- <ap-icon name=${It[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2614
+ <ap-icon name=${It[n.type]||"file-text"} .size=${14} ${F({color:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"})}></ap-icon>
2602
2615
  <span class="field-item-label">${n.label}</span>
2603
2616
  <button
2604
2617
  class="field-item-pin ${u?"pinned":""}"
@@ -2637,7 +2650,6 @@
2637
2650
  ${!this._showFieldSelection&&!this._atFieldLimit?r.html`
2638
2651
  <button
2639
2652
  class="add-field-btn"
2640
- style="margin-top: 8px"
2641
2653
  @click=${this._openFieldSelection}
2642
2654
  >
2643
2655
  <ap-icon name="filter" .size=${14}></ap-icon>
@@ -2645,7 +2657,7 @@
2645
2657
  </button>
2646
2658
  `:r.nothing}
2647
2659
  `:r.nothing}
2648
- `}};I.styles=[Y,Ce,r.css`
2660
+ `}};I.styles=[W,Fe,r.css`
2649
2661
  /* ── Field selection panel ─────────────────────────────── */
2650
2662
 
2651
2663
  .add-field-btn {
@@ -2662,6 +2674,7 @@
2662
2674
  width: 100%;
2663
2675
  font-family: var(--ap-font-family, system-ui, sans-serif);
2664
2676
  transition: all 150ms;
2677
+ margin-top: 8px;
2665
2678
  }
2666
2679
 
2667
2680
  .add-field-btn:hover {
@@ -3022,7 +3035,7 @@
3022
3035
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
3023
3036
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
3024
3037
  }
3025
- `];P([l.property({type:Array})],I.prototype,"fields",2);P([l.property({type:Object})],I.prototype,"appliedFilters",2);P([l.property({type:Array})],I.prototype,"visibleFields",2);P([l.property()],I.prototype,"mode",2);P([l.property()],I.prototype,"activeFieldKey",2);P([l.property({type:Array})],I.prototype,"pinnedFields",2);P([l.property({type:Object})],I.prototype,"appliedMetadata",2);P([l.property({attribute:!1})],I.prototype,"apiClient",2);P([l.state()],I.prototype,"_showFieldSelection",2);P([l.state()],I.prototype,"_fieldSearch",2);P([l.state()],I.prototype,"_collapsedFields",2);P([l.state()],I.prototype,"_tagInputs",2);P([l.state()],I.prototype,"_tagSuggestions",2);P([l.state()],I.prototype,"_tagLoading",2);P([l.state()],I.prototype,"_datePresets",2);P([l.state()],I.prototype,"_dateFroms",2);P([l.state()],I.prototype,"_dateTos",2);P([l.state()],I.prototype,"_specificModeFields",2);P([l.state()],I.prototype,"_selectSearches",2);I=P([l.customElement("ap-filter-metadata")],I);var Ko=Object.defineProperty,Qo=Object.getOwnPropertyDescriptor,me=(t,e,s,i)=>{for(var a=i>1?void 0:i?Qo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ko(e,s,a),a};let le=class extends r.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(re)||this.selectedStatus.includes(ne)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===re||t===ne)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(G.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(G.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(G.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(G.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(G.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(G.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(G.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(G.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(G.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(G.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:G.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:G.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return r.html`
3038
+ `];D([l.property({type:Array})],I.prototype,"fields",2);D([l.property({type:Object})],I.prototype,"appliedFilters",2);D([l.property({type:Array})],I.prototype,"visibleFields",2);D([l.property()],I.prototype,"mode",2);D([l.property()],I.prototype,"activeFieldKey",2);D([l.property({type:Array})],I.prototype,"pinnedFields",2);D([l.property({type:Object})],I.prototype,"appliedMetadata",2);D([l.property({attribute:!1})],I.prototype,"apiClient",2);D([l.state()],I.prototype,"_showFieldSelection",2);D([l.state()],I.prototype,"_fieldSearch",2);D([l.state()],I.prototype,"_collapsedFields",2);D([l.state()],I.prototype,"_tagInputs",2);D([l.state()],I.prototype,"_tagSuggestions",2);D([l.state()],I.prototype,"_tagLoading",2);D([l.state()],I.prototype,"_datePresets",2);D([l.state()],I.prototype,"_dateFroms",2);D([l.state()],I.prototype,"_dateTos",2);D([l.state()],I.prototype,"_specificModeFields",2);D([l.state()],I.prototype,"_selectSearches",2);I=D([l.customElement("ap-filter-metadata")],I);var Xo=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,be=(t,e,s,i)=>{for(var a=i>1?void 0:i?Zo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Xo(e,s,a),a};let ce=class extends r.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(ne)||this.selectedStatus.includes(le)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===ne||t===le)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(K.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(K.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(K.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(K.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(K.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(K.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(K.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(K.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(K.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(K.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:K.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:K.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return r.html`
3026
3039
  <div class="filter-section">
3027
3040
  <button
3028
3041
  class="clear-btn"
@@ -3036,7 +3049,7 @@
3036
3049
  <span class="section-label condition-label">Condition</span>
3037
3050
  <ap-radio-group
3038
3051
  direction="horizontal"
3039
- .options=${wa}
3052
+ .options=${Sa}
3040
3053
  .value=${this.statusOperator}
3041
3054
  ?disabled=${this._statusHasOnlyEmptyValues}
3042
3055
  @ap-change=${this._handleStatusOperator}
@@ -3044,7 +3057,7 @@
3044
3057
 
3045
3058
  <!-- Empty / Not empty checkboxes -->
3046
3059
  <div class="options-list short mt-12">
3047
- ${Ne.map(e=>r.html`
3060
+ ${Ue.map(e=>r.html`
3048
3061
  <ap-checkbox
3049
3062
  ?checked=${this.selectedStatus.includes(e.value)}
3050
3063
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -3056,13 +3069,13 @@
3056
3069
 
3057
3070
  <!-- Status options -->
3058
3071
  <div class="options-list short">
3059
- ${$a.map(e=>r.html`
3072
+ ${Ca.map(e=>r.html`
3060
3073
  <ap-checkbox
3061
3074
  ?checked=${this.selectedStatus.includes(e.value)}
3062
3075
  @ap-toggle=${()=>this._toggleStatus(e.value)}
3063
3076
  >
3064
- <span style="display:inline-flex;align-items:center;gap:6px">
3065
- <ap-icon name=${e.icon} .size=${16} style="color:${e.iconColor}"></ap-icon>
3077
+ <span class="status-icon-label">
3078
+ <ap-icon name=${e.icon} .size=${16} ${F({color:e.iconColor})}></ap-icon>
3066
3079
  ${e.label}
3067
3080
  </span>
3068
3081
  </ap-checkbox>
@@ -3083,7 +3096,7 @@
3083
3096
  <span class="section-label condition-label">Condition</span>
3084
3097
  <ap-radio-group
3085
3098
  direction="horizontal"
3086
- .options=${Qs}
3099
+ .options=${Xs}
3087
3100
  .value=${this.approverOperator}
3088
3101
  @ap-change=${this._handleApproverOperator}
3089
3102
  ></ap-radio-group>
@@ -3110,7 +3123,7 @@
3110
3123
  <span class="section-label condition-label">Condition</span>
3111
3124
  <ap-radio-group
3112
3125
  direction="horizontal"
3113
- .options=${Qs}
3126
+ .options=${Xs}
3114
3127
  .value=${this.requesterOperator}
3115
3128
  @ap-change=${this._handleRequesterOperator}
3116
3129
  ></ap-radio-group>
@@ -3136,8 +3149,8 @@
3136
3149
  <!-- Empty / Not empty radio buttons -->
3137
3150
  <ap-radio-group
3138
3151
  clearable
3139
- .options=${Ne}
3140
- .value=${this.dueDatePreset===re||this.dueDatePreset===ne?this.dueDatePreset:""}
3152
+ .options=${Ue}
3153
+ .value=${this.dueDatePreset===ne||this.dueDatePreset===le?this.dueDatePreset:""}
3141
3154
  @ap-change=${this._handleDueDatePreset}
3142
3155
  ></ap-radio-group>
3143
3156
 
@@ -3147,8 +3160,8 @@
3147
3160
  <ap-radio-group
3148
3161
  clearable
3149
3162
  columns="2"
3150
- .options=${_a}
3151
- .value=${this.dueDatePreset!==re&&this.dueDatePreset!==ne?this.dueDatePreset:""}
3163
+ .options=${wa}
3164
+ .value=${this.dueDatePreset!==ne&&this.dueDatePreset!==le?this.dueDatePreset:""}
3152
3165
  @ap-change=${this._handleDueDatePreset}
3153
3166
  ></ap-radio-group>
3154
3167
 
@@ -3190,7 +3203,7 @@
3190
3203
  <div class="separator"></div>
3191
3204
  ${this._renderDueDateSection()}
3192
3205
  </div>
3193
- `}};le.styles=[Y,Ce,r.css`
3206
+ `}};ce.styles=[W,Fe,r.css`
3194
3207
  .options-list.short {
3195
3208
  max-height: none;
3196
3209
  }
@@ -3209,7 +3222,12 @@
3209
3222
  .mt-12 {
3210
3223
  margin-top: 12px;
3211
3224
  }
3212
- `];me([l.property({type:Array})],le.prototype,"selectedStatus",2);me([l.property()],le.prototype,"statusOperator",2);me([l.property()],le.prototype,"approverValue",2);me([l.property()],le.prototype,"approverOperator",2);me([l.property()],le.prototype,"requesterValue",2);me([l.property()],le.prototype,"requesterOperator",2);me([l.property()],le.prototype,"dueDatePreset",2);me([l.property()],le.prototype,"dueDateFrom",2);me([l.property()],le.prototype,"dueDateTo",2);le=me([l.customElement("ap-filter-approval")],le);var Yo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,be=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Yo(e,s,a),a};const Xo=300;function Zo(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let ce=class extends r.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=Zo(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.PRODUCT_REF,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},Xo)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
3225
+ .status-icon-label {
3226
+ display: inline-flex;
3227
+ align-items: center;
3228
+ gap: 6px;
3229
+ }
3230
+ `];be([l.property({type:Array})],ce.prototype,"selectedStatus",2);be([l.property()],ce.prototype,"statusOperator",2);be([l.property()],ce.prototype,"approverValue",2);be([l.property()],ce.prototype,"approverOperator",2);be([l.property()],ce.prototype,"requesterValue",2);be([l.property()],ce.prototype,"requesterOperator",2);be([l.property()],ce.prototype,"dueDatePreset",2);be([l.property()],ce.prototype,"dueDateFrom",2);be([l.property()],ce.prototype,"dueDateTo",2);ce=be([l.customElement("ap-filter-approval")],ce);var Jo=Object.defineProperty,er=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Jo(e,s,a),a};const tr=300;function sr(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let de=class extends r.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=sr(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.PRODUCT_REF,values:e,operator:C.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},tr)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
3213
3231
  `).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(i=>!e.has(i))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return r.html`
3214
3232
  <div
3215
3233
  class="product-item"
@@ -3242,7 +3260,6 @@
3242
3260
  <span class="section-label"></span>
3243
3261
  <button
3244
3262
  class="clear-btn"
3245
- style="position: static"
3246
3263
  @click=${this._clearAll}
3247
3264
  >Clear all</button>
3248
3265
  </div>
@@ -3286,7 +3303,7 @@
3286
3303
  <!-- Placeholder (when not searching) -->
3287
3304
  ${this._isSearching?r.nothing:r.html`
3288
3305
  <div class="placeholder">
3289
- ${t?r.html`<ap-icon name="box" .size=${40} style="color: var(--ap-border, oklch(92.86% 0.009 247.92)); margin-bottom: 4px;"></ap-icon>`:r.nothing}
3306
+ ${t?r.html`<ap-icon name="box" .size=${40} ${F({color:"var(--ap-border, oklch(92.86% 0.009 247.92))","margin-bottom":"4px"})}></ap-icon>`:r.nothing}
3290
3307
  <div class="placeholder-title">Find product reference</div>
3291
3308
  <div class="placeholder-text">By using the search or pressing the button below to import the product references list.</div>
3292
3309
  <button class="add-list-btn" @click=${this._openAddList}>
@@ -3315,11 +3332,11 @@
3315
3332
  <div class="dialog">
3316
3333
  <div class="dialog-header">Add products references list</div>
3317
3334
  <div class="dialog-body">
3318
- <div class="info-alert" style="margin-top: 0;">
3335
+ <div class="info-alert" ${F({"margin-top":"0"})}>
3319
3336
  <ap-icon name="info" .size=${14}></ap-icon>
3320
3337
  <span>Use "*" to select all references starting with your text.</span>
3321
3338
  </div>
3322
- <label class="input-label" style="margin-bottom: 0; font-weight: 400; color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));">Product references</label>
3339
+ <label class="input-label" ${F({"margin-bottom":"0","font-weight":"400",color:"var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89))"})}>Product references</label>
3323
3340
  <textarea
3324
3341
  class="dialog-textarea"
3325
3342
  placeholder="Enter product references separated by new lines"
@@ -3335,7 +3352,7 @@
3335
3352
  </div>
3336
3353
  </div>
3337
3354
  `:r.nothing}
3338
- `}};ce.styles=[Y,Ce,r.css`
3355
+ `}};de.styles=[W,Fe,r.css`
3339
3356
  .product-item {
3340
3357
  display: flex;
3341
3358
  align-items: center;
@@ -3575,7 +3592,7 @@
3575
3592
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3576
3593
  margin-left: 4px;
3577
3594
  }
3578
- `];be([l.property({type:Array})],ce.prototype,"selected",2);be([l.property({attribute:!1})],ce.prototype,"apiClient",2);be([l.query(".product-search")],ce.prototype,"_searchInput",2);be([l.state()],ce.prototype,"_search",2);be([l.state()],ce.prototype,"_debouncedSearch",2);be([l.state()],ce.prototype,"_products",2);be([l.state()],ce.prototype,"_isLoading",2);be([l.state()],ce.prototype,"_showAddList",2);be([l.state()],ce.prototype,"_addListText",2);ce=be([l.customElement("ap-filter-product-ref")],ce);var Jo=Object.defineProperty,er=Object.getOwnPropertyDescriptor,O=(t,e,s,i)=>{for(var a=i>1?void 0:i?er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Jo(e,s,a),a};let L=class extends r.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.showFilters=!0,this.countLabel="",this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=ms,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.fileTypes=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(o=>{var n;return o instanceof HTMLElement&&o.classList.contains("chip")&&((n=o.closest)==null?void 0:n.call(o,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${Gt[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=ds.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const o=e.type;return r.html`<ap-filter-type
3595
+ `];_e([l.property({type:Array})],de.prototype,"selected",2);_e([l.property({attribute:!1})],de.prototype,"apiClient",2);_e([l.query(".product-search")],de.prototype,"_searchInput",2);_e([l.state()],de.prototype,"_search",2);_e([l.state()],de.prototype,"_debouncedSearch",2);_e([l.state()],de.prototype,"_products",2);_e([l.state()],de.prototype,"_isLoading",2);_e([l.state()],de.prototype,"_showAddList",2);_e([l.state()],de.prototype,"_addListText",2);de=_e([l.customElement("ap-filter-product-ref")],de);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,M=(t,e,s,i)=>{for(var a=i>1?void 0:i?ar(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ir(e,s,a),a};let O=class extends r.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.showFilters=!0,this.countLabel="",this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=ys,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.fileTypes=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(o=>{var n;return o instanceof HTMLElement&&o.classList.contains("chip")&&((n=o.closest)==null?void 0:n.call(o,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${Kt[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=us.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const o=e.type;return r.html`<ap-filter-type
3579
3596
  .selected=${(o==null?void 0:o.values)||[]}
3580
3597
  .fileTypes=${this.fileTypes}
3581
3598
  @filter-change=${this._handleFilterChange}
@@ -3704,7 +3721,7 @@
3704
3721
  </button>
3705
3722
  ${this._showDropdown?r.html`
3706
3723
  <div class="dropdown-menu">
3707
- ${ds.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3724
+ ${us.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3708
3725
  </div>
3709
3726
  `:r.nothing}
3710
3727
  </div>
@@ -3734,7 +3751,7 @@
3734
3751
  </div>
3735
3752
  </div>
3736
3753
  ${this._openFilter?r.html`
3737
- <div class="popover-anchor ${this._externalTrigger?"external":""}" style=${this._externalTrigger&&this._externalTop!=null?`top: ${this._externalTop+4}px`:""}>
3754
+ <div class="popover-anchor ${this._externalTrigger?"external":""}" ${F(this._externalTrigger&&this._externalTop!=null?{top:`${this._externalTop+4}px`}:null)}>
3738
3755
  ${this._externalTrigger?r.nothing:r.html`
3739
3756
  <div class="anchor-tab">
3740
3757
  ${this._openFilter==="metadata"&&this._openMetadataField?r.html`
@@ -3744,19 +3761,19 @@
3744
3761
  ${this._getMetadataFieldLabel(this._openMetadataField)}
3745
3762
  `:r.html`
3746
3763
  <ap-icon name=${this._getFilterIcon(this._openFilter)} .size=${16}></ap-icon>
3747
- ${et[this._openFilter]||this._openFilter}
3764
+ ${tt[this._openFilter]||this._openFilter}
3748
3765
  `}
3749
3766
  <button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}} title="Close">
3750
3767
  <ap-icon name="close" .size=${14}></ap-icon>
3751
3768
  </button>
3752
3769
  </div>
3753
3770
  `}
3754
- <div class="popover-panel" style=${this._externalTrigger&&this._externalLeft!=null?`left: ${this._externalLeft}px`:""}>
3771
+ <div class="popover-panel" ${F(this._externalTrigger&&this._externalLeft!=null?{left:`${this._externalLeft}px`}:null)}>
3755
3772
  ${this._renderFilterContent(this._openFilter)}
3756
3773
  </div>
3757
3774
  </div>
3758
3775
  `:r.nothing}
3759
- `}};L.styles=r.css`
3776
+ `}};O.styles=r.css`
3760
3777
  :host {
3761
3778
  display: block;
3762
3779
  padding: 8px 20px 6px;
@@ -4094,10 +4111,10 @@
4094
4111
  border-radius: 8px;
4095
4112
  top: 0;
4096
4113
  }
4097
- `;O([l.property({type:Number})],L.prototype,"totalCount",2);O([l.property({type:Number})],L.prototype,"totalFolderCount",2);O([l.property({type:Boolean})],L.prototype,"isLoading",2);O([l.property({type:Boolean})],L.prototype,"showUpload",2);O([l.property({type:Boolean})],L.prototype,"showFilters",2);O([l.property()],L.prototype,"countLabel",2);O([l.property()],L.prototype,"sortBy",2);O([l.property()],L.prototype,"sortDirection",2);O([l.property({type:Array})],L.prototype,"sortOptions",2);O([l.property({type:Object})],L.prototype,"filters",2);O([l.property({type:Array})],L.prototype,"labels",2);O([l.property({type:Array})],L.prototype,"tags",2);O([l.property({type:Array})],L.prototype,"fileTypes",2);O([l.property({type:Array})],L.prototype,"metadataFields",2);O([l.property({type:Array})],L.prototype,"pinnedFilters",2);O([l.property({type:Array})],L.prototype,"forcedFilterKeys",2);O([l.property({attribute:!1})],L.prototype,"apiClient",2);O([l.query("ap-dropdown")],L.prototype,"_sortDropdown",2);O([l.state()],L.prototype,"_showDropdown",2);O([l.state()],L.prototype,"_showMetadataSelector",2);O([l.state()],L.prototype,"_openFilter",2);O([l.state()],L.prototype,"_openMetadataField",2);O([l.state()],L.prototype,"_externalTrigger",2);O([l.state()],L.prototype,"_externalLeft",2);O([l.state()],L.prototype,"_externalTop",2);L=O([l.customElement("ap-content-toolbar")],L);var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,se=(t,e,s,i)=>{for(var a=i>1?void 0:i?sr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&tr(e,s,a),a};let q=class extends r.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var i;const e=(i=Rt.find(a=>a.value===t))==null?void 0:i.label;if(e)return e;const s=t.indexOf("_");return s!==-1?t.slice(s+1).toUpperCase():t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,o=i?parseFloat(i):null,n=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} MB`;return a!==null&&o!==null?`${n(a)} – ${n(o)}`:a!==null?`> ${n(a)}`:o!==null?`< ${n(o)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===b.SIZE)return this._getSizeSummary(s);if(e===b.COLOR){const a=s.values.map(o=>o.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===b.TYPE?a=>this._mapTypeLabel(a):e===b.TAGS?a=>{var o;return((o=this.tags.find(n=>n.sid===a))==null?void 0:o.label)||a}:e===b.LABELS?a=>{var o;return((o=this.labels.find(n=>n.sid===a))==null?void 0:o.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,c;const e=((n=di.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...vs,...pi],i=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let o="";switch(t.kind){case"preset":o=i;break;case"before":o=t.to?`Before ${a(t.to)}`:i;break;case"after":o=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?o=`${a(t.from)} – ${a(t.to)}`:t.from?o=`After ${a(t.from)}`:t.to&&(o=`Before ${a(t.to)}`);break;case"specific":o=t.from?a(t.from):"";break;default:o=i}return o?`${e}: ${o}`:""}_getFilterIcon(t){var e;return((e=ds.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&It[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of ri)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return r.html`
4114
+ `;M([l.property({type:Number})],O.prototype,"totalCount",2);M([l.property({type:Number})],O.prototype,"totalFolderCount",2);M([l.property({type:Boolean})],O.prototype,"isLoading",2);M([l.property({type:Boolean})],O.prototype,"showUpload",2);M([l.property({type:Boolean})],O.prototype,"showFilters",2);M([l.property()],O.prototype,"countLabel",2);M([l.property()],O.prototype,"sortBy",2);M([l.property()],O.prototype,"sortDirection",2);M([l.property({type:Array})],O.prototype,"sortOptions",2);M([l.property({type:Object})],O.prototype,"filters",2);M([l.property({type:Array})],O.prototype,"labels",2);M([l.property({type:Array})],O.prototype,"tags",2);M([l.property({type:Array})],O.prototype,"fileTypes",2);M([l.property({type:Array})],O.prototype,"metadataFields",2);M([l.property({type:Array})],O.prototype,"pinnedFilters",2);M([l.property({type:Array})],O.prototype,"forcedFilterKeys",2);M([l.property({attribute:!1})],O.prototype,"apiClient",2);M([l.query("ap-dropdown")],O.prototype,"_sortDropdown",2);M([l.state()],O.prototype,"_showDropdown",2);M([l.state()],O.prototype,"_showMetadataSelector",2);M([l.state()],O.prototype,"_openFilter",2);M([l.state()],O.prototype,"_openMetadataField",2);M([l.state()],O.prototype,"_externalTrigger",2);M([l.state()],O.prototype,"_externalLeft",2);M([l.state()],O.prototype,"_externalTop",2);O=M([l.customElement("ap-content-toolbar")],O);var or=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?rr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&or(e,s,a),a};let V=class extends r.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var i;const e=(i=jt.find(a=>a.value===t))==null?void 0:i.label;if(e)return e;const s=t.indexOf("_");return s!==-1?t.slice(s+1).toUpperCase():t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,o=i?parseFloat(i):null,n=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} MB`;return a!==null&&o!==null?`${n(a)} – ${n(o)}`:a!==null?`> ${n(a)}`:o!==null?`< ${n(o)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===b.SIZE)return this._getSizeSummary(s);if(e===b.COLOR){const a=s.values.map(o=>o.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===b.TYPE?a=>this._mapTypeLabel(a):e===b.TAGS?a=>{var o;return((o=this.tags.find(n=>n.sid===a))==null?void 0:o.label)||a}:e===b.LABELS?a=>{var o;return((o=this.labels.find(n=>n.sid===a))==null?void 0:o.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,c;const e=((n=ui.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[..._s,...gi],i=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let o="";switch(t.kind){case"preset":o=i;break;case"before":o=t.to?`Before ${a(t.to)}`:i;break;case"after":o=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?o=`${a(t.from)} – ${a(t.to)}`:t.from?o=`After ${a(t.from)}`:t.to&&(o=`Before ${a(t.to)}`);break;case"specific":o=t.from?a(t.from):"";break;default:o=i}return o?`${e}: ${o}`:""}_getFilterIcon(t){var e;return((e=us.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&It[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of ci)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return r.html`
4098
4115
  <span class="chip forced">
4099
4116
  ${(i||t===b.TYPE||t===b.SIZE)&&s?r.html`<span class="chip-label">${s}</span>`:r.html`
4100
- <span class="chip-label">${et[t]||t}</span>
4117
+ <span class="chip-label">${tt[t]||t}</span>
4101
4118
  ${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
4102
4119
  `}
4103
4120
  <span class="chip-lock">
@@ -4107,7 +4124,7 @@
4107
4124
  `}_renderFilterChip(t,e){if(!e)return r.html`
4108
4125
  <span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
4109
4126
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
4110
- <span class="chip-label">${et[t]||t}</span>
4127
+ <span class="chip-label">${tt[t]||t}</span>
4111
4128
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4112
4129
  </span>
4113
4130
  `;const s=this._getFilterSummary(e,t),i=e.type==="date";return r.html`
@@ -4115,7 +4132,7 @@
4115
4132
  ${(i||t===b.TYPE||t===b.SIZE)&&s?r.html`
4116
4133
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
4117
4134
  <span class="chip-label">${s}</span>`:r.html`
4118
- <span class="chip-label">${et[t]||t}</span>
4135
+ <span class="chip-label">${tt[t]||t}</span>
4119
4136
  ${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
4120
4137
  `}
4121
4138
  <button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
@@ -4137,7 +4154,7 @@
4137
4154
  <ap-icon name="close" .size=${12}></ap-icon>
4138
4155
  </button>
4139
4156
  </span>
4140
- `}render(){const t=ps(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(f=>!e.has(f)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),o=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(f=>!e.has(f)),c=s.filter(f=>!a.has(f)),d=i.filter(f=>!o.has(f)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!o.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),g=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+c.length+d.length+(h?1:0)+(u?1:0)===0?r.nothing:r.html`
4157
+ `}render(){const t=gs(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(f=>!e.has(f)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),o=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(f=>!e.has(f)),c=s.filter(f=>!a.has(f)),d=i.filter(f=>!o.has(f)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!o.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),g=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+c.length+d.length+(h?1:0)+(u?1:0)===0?r.nothing:r.html`
4141
4158
  <div class="chips-row">
4142
4159
  <div class="chips">
4143
4160
  ${[...e].map(f=>this._renderForcedChip(f,t[f]))}
@@ -4147,7 +4164,7 @@
4147
4164
  ${h?r.html`
4148
4165
  <span class="chip pinned-empty active pending" @click=${f=>this._openFilter(this.pendingFilter,f)}>
4149
4166
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(this.pendingFilter)} .size=${16}></ap-icon></span>
4150
- <span class="chip-label">${et[this.pendingFilter]||this.pendingFilter}</span>
4167
+ <span class="chip-label">${tt[this.pendingFilter]||this.pendingFilter}</span>
4151
4168
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
4152
4169
  </span>
4153
4170
  `:r.nothing}
@@ -4162,7 +4179,7 @@
4162
4179
  ${g?r.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:r.nothing}
4163
4180
  </div>
4164
4181
  </div>
4165
- `}};q.styles=r.css`
4182
+ `}};V.styles=r.css`
4166
4183
  :host {
4167
4184
  display: block;
4168
4185
  }
@@ -4309,8 +4326,8 @@
4309
4326
  align-items: center;
4310
4327
  opacity: 0.6;
4311
4328
  }
4312
- `;se([l.property({type:Object})],q.prototype,"appliedFilters",2);se([l.property({type:Object})],q.prototype,"appliedMetadata",2);se([l.property({type:Object})],q.prototype,"forcedFilters",2);se([l.property({type:Array})],q.prototype,"metadataFields",2);se([l.property({type:Array})],q.prototype,"pinnedFilters",2);se([l.property({type:Array})],q.prototype,"pinnedMetadataFields",2);se([l.property({type:Array})],q.prototype,"tags",2);se([l.property({type:Array})],q.prototype,"labels",2);se([l.property()],q.prototype,"activeFilter",2);se([l.property()],q.prototype,"activeMetadataField",2);se([l.property()],q.prototype,"pendingFilter",2);se([l.property()],q.prototype,"pendingMetadataField",2);q=se([l.customElement("ap-filters-bar")],q);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?ar(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ir(e,s,a),a};const or=6;let de=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.gridSize="normal",this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){const t=this.gridSize==="large"?"280px":"220px";return r.html`
4313
- <div class="grid" role="list" aria-label="Assets" style="--ap-grid-min-col: ${t}">
4329
+ `;ie([l.property({type:Object})],V.prototype,"appliedFilters",2);ie([l.property({type:Object})],V.prototype,"appliedMetadata",2);ie([l.property({type:Object})],V.prototype,"forcedFilters",2);ie([l.property({type:Array})],V.prototype,"metadataFields",2);ie([l.property({type:Array})],V.prototype,"pinnedFilters",2);ie([l.property({type:Array})],V.prototype,"pinnedMetadataFields",2);ie([l.property({type:Array})],V.prototype,"tags",2);ie([l.property({type:Array})],V.prototype,"labels",2);ie([l.property()],V.prototype,"activeFilter",2);ie([l.property()],V.prototype,"activeMetadataField",2);ie([l.property()],V.prototype,"pendingFilter",2);ie([l.property()],V.prototype,"pendingMetadataField",2);V=ie([l.customElement("ap-filters-bar")],V);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?lr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nr(e,s,a),a};const cr=6;let pe=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.gridSize="normal",this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){const t=this.gridSize==="large"?"280px":"220px";return r.html`
4330
+ <div class="grid" role="list" aria-label="Assets" ${F({"--ap-grid-min-col":String(t)})}>
4314
4331
  ${this.folders.map((e,s)=>r.html`
4315
4332
  <ap-folder-card
4316
4333
  .folder=${e}
@@ -4330,14 +4347,14 @@
4330
4347
  .index=${this.folderSelectable?this.folders.length+s:s}
4331
4348
  ?selected=${this.selectedIds.includes(e.uuid)}
4332
4349
  .multiSelect=${this.multiSelect}
4333
- style="--ap-stagger-index: ${i}"
4350
+ ${F({"--ap-stagger-index":String(i)})}
4334
4351
  data-asset-uuid=${e.uuid}
4335
4352
  @asset-select=${a=>this.dispatchEvent(new CustomEvent("asset-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4336
4353
  @asset-preview=${a=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:a.detail,bubbles:!0,composed:!0}))}
4337
4354
  @asset-quick-select=${a=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4338
4355
  ></ap-asset-card>
4339
4356
  `})}
4340
- ${this.isLoading?Array.from({length:or},()=>r.html`<div class="ghost-card">
4357
+ ${this.isLoading?Array.from({length:cr},()=>r.html`<div class="ghost-card">
4341
4358
  <div class="ghost-thumb"></div>
4342
4359
  <div class="ghost-info">
4343
4360
  <div class="ghost-line ghost-name"></div>
@@ -4345,7 +4362,7 @@
4345
4362
  </div>
4346
4363
  </div>`):r.nothing}
4347
4364
  </div>
4348
- `}};de.styles=r.css`
4365
+ `}};pe.styles=r.css`
4349
4366
  :host {
4350
4367
  display: block;
4351
4368
  padding: 0 20px 16px;
@@ -4400,8 +4417,8 @@
4400
4417
  @media (prefers-reduced-motion: reduce) {
4401
4418
  .ghost-thumb, .ghost-line { animation: none; }
4402
4419
  }
4403
- `;_e([l.property({type:Array})],de.prototype,"assets",2);_e([l.property({type:Array})],de.prototype,"folders",2);_e([l.property({type:Object})],de.prototype,"folderPreviews",2);_e([l.property({type:Array})],de.prototype,"selectedIds",2);_e([l.property({type:Array})],de.prototype,"selectedFolderIds",2);_e([l.property({type:Boolean})],de.prototype,"isLoading",2);_e([l.property({type:Boolean})],de.prototype,"multiSelect",2);_e([l.property({type:Boolean})],de.prototype,"folderSelectable",2);_e([l.property({type:String})],de.prototype,"gridSize",2);de=_e([l.customElement("ap-grid-view")],de);var rr=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,pe=(t,e,s,i)=>{for(var a=i>1?void 0:i?nr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&rr(e,s,a),a};const lr=5;let Q=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.totalCount=0,this.isSelectingAll=!1,this.folderPreviews={},this._compactLevel=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{var i;const e=((i=t[0])==null?void 0:i.contentRect.width)??0,s=e<550?2:e<680?1:0;s!==this._compactLevel&&(this._compactLevel=s)}),this._resizeObserver.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._resizeObserver)==null||t.disconnect()}_getGridColumns(t){const e=[];return t&&e.push("32px"),e.push("48px"),e.push("minmax(120px, 1fr)"),e.push("72px"),this._compactLevel<2&&e.push("100px"),this._compactLevel<1&&e.push("120px"),e.push("64px"),e.join(" ")}get _allVisibleSelected(){if(this.assets.length===0&&this.folders.length===0||this.selectedIds.length===0&&this.selectedFolderIds.length===0)return!1;const t=new Set(this.selectedIds),e=this.assets.length===0||this.assets.every(a=>t.has(a.uuid));if(!this.folderSelectable)return e&&this.assets.length>0;const s=new Set(this.selectedFolderIds),i=this.folders.length===0||this.folders.every(a=>s.has(a.uuid));return e&&i}_handleHeaderCheckboxClick(){if(this.isSelectingAll)return;const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length;this._allVisibleSelected&&e>=t?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:"all"},bubbles:!0,composed:!0}))}render(){const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length,s=this._allVisibleSelected&&e>=t;return r.html`
4404
- <div class="list-header" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}" role="row" aria-label="Column headers">
4420
+ `;ye([l.property({type:Array})],pe.prototype,"assets",2);ye([l.property({type:Array})],pe.prototype,"folders",2);ye([l.property({type:Object})],pe.prototype,"folderPreviews",2);ye([l.property({type:Array})],pe.prototype,"selectedIds",2);ye([l.property({type:Array})],pe.prototype,"selectedFolderIds",2);ye([l.property({type:Boolean})],pe.prototype,"isLoading",2);ye([l.property({type:Boolean})],pe.prototype,"multiSelect",2);ye([l.property({type:Boolean})],pe.prototype,"folderSelectable",2);ye([l.property({type:String})],pe.prototype,"gridSize",2);pe=ye([l.customElement("ap-grid-view")],pe);var dr=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,he=(t,e,s,i)=>{for(var a=i>1?void 0:i?pr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&dr(e,s,a),a};const hr=5;let Y=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.totalCount=0,this.isSelectingAll=!1,this.folderPreviews={},this._compactLevel=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{var i;const e=((i=t[0])==null?void 0:i.contentRect.width)??0,s=e<550?2:e<680?1:0;s!==this._compactLevel&&(this._compactLevel=s)}),this._resizeObserver.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._resizeObserver)==null||t.disconnect()}_getGridColumns(t){const e=[];return t&&e.push("32px"),e.push("48px"),e.push("minmax(120px, 1fr)"),e.push("72px"),this._compactLevel<2&&e.push("100px"),this._compactLevel<1&&e.push("120px"),e.push("64px"),e.join(" ")}get _allVisibleSelected(){if(this.assets.length===0&&this.folders.length===0||this.selectedIds.length===0&&this.selectedFolderIds.length===0)return!1;const t=new Set(this.selectedIds),e=this.assets.length===0||this.assets.every(a=>t.has(a.uuid));if(!this.folderSelectable)return e&&this.assets.length>0;const s=new Set(this.selectedFolderIds),i=this.folders.length===0||this.folders.every(a=>s.has(a.uuid));return e&&i}_handleHeaderCheckboxClick(){if(this.isSelectingAll)return;const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length;this._allVisibleSelected&&e>=t?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:"all"},bubbles:!0,composed:!0}))}render(){const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length,s=this._allVisibleSelected&&e>=t;return r.html`
4421
+ <div class="list-header" ${F({"grid-template-columns":this._getGridColumns(this.multiSelect)})} role="row" aria-label="Column headers">
4405
4422
  ${this.multiSelect?r.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
4406
4423
  <div class="header-check-box ${s?"checked":e>0?"indeterminate":""}">
4407
4424
  <svg class="header-check-icon check" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
@@ -4447,11 +4464,11 @@
4447
4464
  @asset-quick-select=${o=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:o.detail,bubbles:!0,composed:!0}))}
4448
4465
  ></ap-asset-row>
4449
4466
  `)}
4450
- ${this.isLoading?Array.from({length:lr},(i,a)=>{const o=["70%","55%","80%","45%","65%"];return r.html`
4451
- <div class="ghost-row" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}">
4467
+ ${this.isLoading?Array.from({length:hr},(i,a)=>{const o=["70%","55%","80%","45%","65%"];return r.html`
4468
+ <div class="ghost-row" ${F({"grid-template-columns":this._getGridColumns(this.multiSelect)})}>
4452
4469
  ${this.multiSelect?r.html`<div class="ghost-el ghost-check"></div>`:r.nothing}
4453
4470
  <div class="ghost-el ghost-thumb"></div>
4454
- <div class="ghost-el ghost-name" style="width: ${o[a]}"></div>
4471
+ <div class="ghost-el ghost-name" ${F({width:o[a]})}></div>
4455
4472
  <div class="ghost-el ghost-type"></div>
4456
4473
  ${this._compactLevel<2?r.html`<div class="ghost-el ghost-size"></div>`:r.nothing}
4457
4474
  ${this._compactLevel<1?r.html`<div class="ghost-el ghost-date"></div>`:r.nothing}
@@ -4459,7 +4476,7 @@
4459
4476
  </div>
4460
4477
  `}):r.nothing}
4461
4478
  </div>
4462
- `}};Q.styles=r.css`
4479
+ `}};Y.styles=r.css`
4463
4480
  :host {
4464
4481
  display: block;
4465
4482
  padding: 0 20px 16px;
@@ -4546,7 +4563,7 @@
4546
4563
  @media (prefers-reduced-motion: reduce) {
4547
4564
  .ghost-el { animation: none; }
4548
4565
  }
4549
- `;pe([l.property({type:Array})],Q.prototype,"assets",2);pe([l.property({type:Array})],Q.prototype,"folders",2);pe([l.property({type:Array})],Q.prototype,"selectedIds",2);pe([l.property({type:Array})],Q.prototype,"selectedFolderIds",2);pe([l.property({type:Boolean})],Q.prototype,"isLoading",2);pe([l.property({type:Boolean})],Q.prototype,"multiSelect",2);pe([l.property({type:Boolean})],Q.prototype,"folderSelectable",2);pe([l.property({type:Number})],Q.prototype,"totalCount",2);pe([l.property({type:Boolean})],Q.prototype,"isSelectingAll",2);pe([l.property({type:Object})],Q.prototype,"folderPreviews",2);pe([l.state()],Q.prototype,"_compactLevel",2);Q=pe([l.customElement("ap-list-view")],Q);function xs(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function jt(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function _i(t,e){return!t||!e?"":`${t} x ${e}`}var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,Ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?dr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cr(e,s,a),a};let He=class extends r.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=o=>String(o).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var h,u,g,p,f,m,x,_;const t=this.asset;if(!t)return r.html``;const s=tt(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(g=t.info)!=null&&g.image_thumbnail||(p=t.info)!=null&&p.preview),o=si(t.extension||"")||a;let n="";s?n=ai(t):i?n=gs(t):o&&(n=zt(t));const c=$t(t.extension||""),d=us(t.extension||"");return r.html`
4566
+ `;he([l.property({type:Array})],Y.prototype,"assets",2);he([l.property({type:Array})],Y.prototype,"folders",2);he([l.property({type:Array})],Y.prototype,"selectedIds",2);he([l.property({type:Array})],Y.prototype,"selectedFolderIds",2);he([l.property({type:Boolean})],Y.prototype,"isLoading",2);he([l.property({type:Boolean})],Y.prototype,"multiSelect",2);he([l.property({type:Boolean})],Y.prototype,"folderSelectable",2);he([l.property({type:Number})],Y.prototype,"totalCount",2);he([l.property({type:Boolean})],Y.prototype,"isSelectingAll",2);he([l.property({type:Object})],Y.prototype,"folderPreviews",2);he([l.state()],Y.prototype,"_compactLevel",2);Y=he([l.customElement("ap-list-view")],Y);function ks(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function Nt(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function wi(t,e){return!t||!e?"":`${t} x ${e}`}var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Ft=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let Ge=class extends r.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=o=>String(o).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var h,u,g,p,f,m,x,_;const t=this.asset;if(!t)return r.html``;const s=st(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(g=t.info)!=null&&g.image_thumbnail||(p=t.info)!=null&&p.preview),o=oi(t.extension||"")||a;let n="";s?n=ni(t):i?n=ms(t):o&&(n=Rt(t));const c=kt(t.extension||""),d=vs(t.extension||"");return r.html`
4550
4567
  <div class="card" @click=${this._handleSelect}>
4551
4568
  <div class="thumbnail ${d&&n?"chess":""}">
4552
4569
  ${n?r.html`<img
@@ -4554,12 +4571,12 @@
4554
4571
  alt=${t.name}
4555
4572
  loading="lazy"
4556
4573
  class="thumb-img ${d?"transparent-asset":""}"
4557
- @error=${w=>{const y=w.target,T=st();y.src!==c&&y.src!==T?(y.src=c,y.classList.add("icon-fallback")):y.src!==T&&(y.src=T)}}
4574
+ @error=${w=>{const y=w.target,L=it();y.src!==c&&y.src!==L?(y.src=c,y.classList.add("icon-fallback")):y.src!==L&&(y.src=L)}}
4558
4575
  />`:r.html`<img
4559
4576
  src=${c}
4560
4577
  alt=${t.name}
4561
4578
  class="thumb-img icon-fallback"
4562
- @error=${w=>{const y=w.target,T=st();y.src!==T&&(y.src=T)}}
4579
+ @error=${w=>{const y=w.target,L=it();y.src!==L&&(y.src=L)}}
4563
4580
  />`}
4564
4581
  ${s&&(((f=t.info)==null?void 0:f.video_duration)??((m=t.info)==null?void 0:m.duration))!=null?r.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:r.nothing}
4565
4582
  <div class="overlay">
@@ -4584,10 +4601,10 @@
4584
4601
  </div>
4585
4602
  <div class="info">
4586
4603
  <div class="name" title=${t.name}>${t.name}</div>
4587
- <div class="meta">${(x=t.extension)==null?void 0:x.toUpperCase()}${(()=>{var k,S,F,E;const w=((k=t.info)==null?void 0:k.img_w)||((S=t.info)==null?void 0:S.video_w),y=((F=t.info)==null?void 0:F.img_h)||((E=t.info)==null?void 0:E.video_h),T=_i(w,y);return T?` · ${T}`:""})()} · ${xs(((_=t.size)==null?void 0:_.bytes)||0)}</div>
4604
+ <div class="meta">${(x=t.extension)==null?void 0:x.toUpperCase()}${(()=>{var k,S,E,A;const w=((k=t.info)==null?void 0:k.img_w)||((S=t.info)==null?void 0:S.video_w),y=((E=t.info)==null?void 0:E.img_h)||((A=t.info)==null?void 0:A.video_h),L=wi(w,y);return L?` · ${L}`:""})()} · ${ks(((_=t.size)==null?void 0:_.bytes)||0)}</div>
4588
4605
  </div>
4589
4606
  </div>
4590
- `}};He.styles=r.css`
4607
+ `}};Ge.styles=r.css`
4591
4608
  :host {
4592
4609
  display: block;
4593
4610
  animation: ap-card-in 300ms ease-out both;
@@ -4766,8 +4783,8 @@
4766
4783
  :host { animation: none; }
4767
4784
  .overlay { transition: none; }
4768
4785
  }
4769
- `;Ct([l.property({type:Object})],He.prototype,"asset",2);Ct([l.property({type:Number})],He.prototype,"index",2);Ct([l.property({type:Boolean,reflect:!0})],He.prototype,"selected",2);Ct([l.property({type:Boolean})],He.prototype,"multiSelect",2);He=Ct([l.customElement("ap-asset-card")],He);var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?hr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pr(e,s,a),a};let Oe=class extends r.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var h,u,g,p,f,m;const t=this.asset;if(!t)return r.html``;const s=tt(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(g=t.info)!=null&&g.image_thumbnail||(p=t.info)!=null&&p.preview),o=si(t.extension||"")||a;let n="";s?n=ai(t):i?n=gs(t):o&&(n=zt(t));const c=$t(t.extension||""),d=us(t.extension||"");return r.html`
4770
- <div class="row" style="grid-template-columns: ${this._getGridColumns()}" @click=${this._handleSelect}>
4786
+ `;Ft([l.property({type:Object})],Ge.prototype,"asset",2);Ft([l.property({type:Number})],Ge.prototype,"index",2);Ft([l.property({type:Boolean,reflect:!0})],Ge.prototype,"selected",2);Ft([l.property({type:Boolean})],Ge.prototype,"multiSelect",2);Ge=Ft([l.customElement("ap-asset-card")],Ge);var fr=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,pt=(t,e,s,i)=>{for(var a=i>1?void 0:i?vr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let Me=class extends r.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var h,u,g,p,f,m;const t=this.asset;if(!t)return r.html``;const s=st(t.type)==="video",i=((h=t.extension)==null?void 0:h.toLowerCase())==="pdf",a=!!((u=t.info)!=null&&u.thumbnail||(g=t.info)!=null&&g.image_thumbnail||(p=t.info)!=null&&p.preview),o=oi(t.extension||"")||a;let n="";s?n=ni(t):i?n=ms(t):o&&(n=Rt(t));const c=kt(t.extension||""),d=vs(t.extension||"");return r.html`
4787
+ <div class="row" ${F({"grid-template-columns":this._getGridColumns()})} @click=${this._handleSelect}>
4771
4788
  ${this.multiSelect?r.html`
4772
4789
  <div class="check">
4773
4790
  <div class="check-box">
@@ -4783,18 +4800,18 @@
4783
4800
  alt=${t.name}
4784
4801
  class="${d?"transparent-asset":""}"
4785
4802
  loading="lazy"
4786
- @error=${x=>{const _=x.target,w=st();_.src!==c&&_.src!==w?(_.src=c,_.classList.add("icon-fallback")):_.src!==w&&(_.src=w)}}
4803
+ @error=${x=>{const _=x.target,w=it();_.src!==c&&_.src!==w?(_.src=c,_.classList.add("icon-fallback")):_.src!==w&&(_.src=w)}}
4787
4804
  />`:r.html`<img
4788
4805
  src=${c}
4789
4806
  alt=${t.name}
4790
4807
  class="icon-fallback"
4791
- @error=${x=>{const _=x.target,w=st();_.src!==w&&(_.src=w)}}
4808
+ @error=${x=>{const _=x.target,w=it();_.src!==w&&(_.src=w)}}
4792
4809
  />`}
4793
4810
  </div>
4794
4811
  <div class="name" title=${t.name}>${t.name}</div>
4795
4812
  <div class="type">${(f=t.extension)==null?void 0:f.toUpperCase()}</div>
4796
- ${this.compactLevel<2?r.html`<div class="desc">${xs(((m=t.size)==null?void 0:m.bytes)||0)}</div>`:r.nothing}
4797
- ${this.compactLevel<1?r.html`<div class="date">${jt(t.created_at||"")}</div>`:r.nothing}
4813
+ ${this.compactLevel<2?r.html`<div class="desc">${ks(((m=t.size)==null?void 0:m.bytes)||0)}</div>`:r.nothing}
4814
+ ${this.compactLevel<1?r.html`<div class="date">${Nt(t.created_at||"")}</div>`:r.nothing}
4798
4815
  <div class="actions">
4799
4816
  <button class="icon-btn select-btn" @click=${this._handleQuickSelect} aria-label="Select" title="Select">
4800
4817
  <ap-icon name="select" .size=${16}></ap-icon>
@@ -4804,7 +4821,7 @@
4804
4821
  </button>
4805
4822
  </div>
4806
4823
  </div>
4807
- `}};Oe.styles=r.css`
4824
+ `}};Me.styles=r.css`
4808
4825
  :host {
4809
4826
  display: block;
4810
4827
  }
@@ -4934,7 +4951,7 @@
4934
4951
  :host([selected]) .check-icon {
4935
4952
  display: block;
4936
4953
  }
4937
- `;dt([l.property({type:Object})],Oe.prototype,"asset",2);dt([l.property({type:Number})],Oe.prototype,"index",2);dt([l.property({type:Boolean,reflect:!0})],Oe.prototype,"selected",2);dt([l.property({type:Boolean})],Oe.prototype,"multiSelect",2);dt([l.property({type:Number})],Oe.prototype,"compactLevel",2);Oe=dt([l.customElement("ap-asset-row")],Oe);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let ke=class extends r.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_getPreviewUrl(t){return oi(t,"200")}_renderPreviewImg(t){const e=ii(t.file_type),s=this._getPreviewUrl(t),i=$t(Ht(t.file_type)),a=st();return r.html`<div class="preview-slot ${e?"icon-bg":""}">
4954
+ `;pt([l.property({type:Object})],Me.prototype,"asset",2);pt([l.property({type:Number})],Me.prototype,"index",2);pt([l.property({type:Boolean,reflect:!0})],Me.prototype,"selected",2);pt([l.property({type:Boolean})],Me.prototype,"multiSelect",2);pt([l.property({type:Number})],Me.prototype,"compactLevel",2);Me=pt([l.customElement("ap-asset-row")],Me);var mr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,We=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&mr(e,s,a),a};let Se=class extends r.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_getPreviewUrl(t){return li(t,"200")}_renderPreviewImg(t){const e=ri(t.file_type),s=this._getPreviewUrl(t),i=kt(Gt(t.file_type)),a=it();return r.html`<div class="preview-slot ${e?"icon-bg":""}">
4938
4955
  <img
4939
4956
  class="preview-img ${e?"icon-mode":""}"
4940
4957
  src="${s||i}"
@@ -4981,7 +4998,7 @@
4981
4998
  </div>
4982
4999
  </div>
4983
5000
  </div>
4984
- `}};ke.styles=[Y,r.css`
5001
+ `}};Se.styles=[W,r.css`
4985
5002
  :host {
4986
5003
  display: block;
4987
5004
  }
@@ -5159,7 +5176,7 @@
5159
5176
  :host([selected]) .check-icon {
5160
5177
  display: block;
5161
5178
  }
5162
- `];Ye([l.property({type:Object})],ke.prototype,"folder",2);Ye([l.property({type:Array})],ke.prototype,"previews",2);Ye([l.property({type:Boolean,reflect:!0})],ke.prototype,"selected",2);Ye([l.property({type:Boolean})],ke.prototype,"selectable",2);Ye([l.property({type:Boolean})],ke.prototype,"multiSelect",2);Ye([l.property({type:Number})],ke.prototype,"index",2);ke=Ye([l.customElement("ap-folder-card")],ke);var fr=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,Ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?vr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let ve=class extends r.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_renderPreviewImg(t){const e=ii(t.file_type),s=oi(t,"80"),i=$t(Ht(t.file_type)),a=st();return r.html`<div class="preview-slot ${e?"icon-bg":""}"><img
5179
+ `];We([l.property({type:Object})],Se.prototype,"folder",2);We([l.property({type:Array})],Se.prototype,"previews",2);We([l.property({type:Boolean,reflect:!0})],Se.prototype,"selected",2);We([l.property({type:Boolean})],Se.prototype,"selectable",2);We([l.property({type:Boolean})],Se.prototype,"multiSelect",2);We([l.property({type:Number})],Se.prototype,"index",2);Se=We([l.customElement("ap-folder-card")],Se);var _r=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,Ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_r(e,s,a),a};let me=class extends r.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_renderPreviewImg(t){const e=ri(t.file_type),s=li(t,"80"),i=kt(Gt(t.file_type)),a=it();return r.html`<div class="preview-slot ${e?"icon-bg":""}"><img
5163
5180
  class="preview-img ${e?"icon-mode":""}"
5164
5181
  src="${s||i}"
5165
5182
  alt=""
@@ -5178,7 +5195,7 @@
5178
5195
  </div>`}
5179
5196
  </div>
5180
5197
  `}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){var e,s;const t=this.folder;return t?r.html`
5181
- <div class="row" style="grid-template-columns: ${this._getGridColumns()}" @click=${this._handleClick}>
5198
+ <div class="row" ${F({"grid-template-columns":this._getGridColumns()})} @click=${this._handleClick}>
5182
5199
  ${this.multiSelect?this.selectable?r.html`
5183
5200
  <div class="check">
5184
5201
  <div class="check-box">
@@ -5191,10 +5208,10 @@
5191
5208
  <div class="name">${t.name}</div>
5192
5209
  <div class="meta">Folder</div>
5193
5210
  ${this.compactLevel<2?r.html`<div class="meta">${((e=t.count)==null?void 0:e.files_recursive)??((s=t.count)==null?void 0:s.files_direct)??0} items</div>`:r.nothing}
5194
- ${this.compactLevel<1?r.html`<div class="meta">${jt(t.modified_at||t.updated_at||"")}</div>`:r.nothing}
5211
+ ${this.compactLevel<1?r.html`<div class="meta">${Nt(t.modified_at||t.updated_at||"")}</div>`:r.nothing}
5195
5212
  <div></div>
5196
5213
  </div>
5197
- `:r.html``}};ve.styles=r.css`
5214
+ `:r.html``}};me.styles=r.css`
5198
5215
  :host {
5199
5216
  display: block;
5200
5217
  }
@@ -5313,17 +5330,17 @@
5313
5330
  :host([selected]) .check-icon {
5314
5331
  display: block;
5315
5332
  }
5316
- `;Ie([l.property({type:Object})],ve.prototype,"folder",2);Ie([l.property({type:Array})],ve.prototype,"previews",2);Ie([l.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);Ie([l.property({type:Boolean})],ve.prototype,"selectable",2);Ie([l.property({type:Boolean})],ve.prototype,"multiSelect",2);Ie([l.property({type:Number})],ve.prototype,"index",2);Ie([l.property({type:Number})],ve.prototype,"compactLevel",2);ve=Ie([l.customElement("ap-folder-row")],ve);var mr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&mr(e,s,a),a};let ft=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
5333
+ `;Ie([l.property({type:Object})],me.prototype,"folder",2);Ie([l.property({type:Array})],me.prototype,"previews",2);Ie([l.property({type:Boolean,reflect:!0})],me.prototype,"selected",2);Ie([l.property({type:Boolean})],me.prototype,"selectable",2);Ie([l.property({type:Boolean})],me.prototype,"multiSelect",2);Ie([l.property({type:Number})],me.prototype,"index",2);Ie([l.property({type:Number})],me.prototype,"compactLevel",2);me=Ie([l.customElement("ap-folder-row")],me);var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,Ss=(t,e,s,i)=>{for(var a=i>1?void 0:i?wr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xr(e,s,a),a};let vt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
5317
5334
  <div class="card" @click=${this._handleClick}>
5318
- <div class="icon-wrapper" style="background: color-mix(in srgb, ${s} 10%, transparent)">
5319
- <ap-icon name="tag" .size=${18} style="color: ${s}"></ap-icon>
5335
+ <div class="icon-wrapper" ${F({background:`color-mix(in srgb, ${s} 10%, transparent)`})}>
5336
+ <ap-icon name="tag" .size=${18} ${F({color:s})}></ap-icon>
5320
5337
  </div>
5321
5338
  <div class="info">
5322
5339
  <div class="name" title=${t.name}>${t.name}</div>
5323
5340
  <div class="count">${e} asset${e!==1?"s":""}</div>
5324
5341
  </div>
5325
5342
  </div>
5326
- `}};ft.styles=[Y,r.css`
5343
+ `}};vt.styles=[W,r.css`
5327
5344
  :host {
5328
5345
  display: block;
5329
5346
  }
@@ -5370,15 +5387,15 @@
5370
5387
  color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
5371
5388
  margin-top: 2px;
5372
5389
  }
5373
- `];ws([l.property({type:Object})],ft.prototype,"label",2);ws([l.property({type:Number})],ft.prototype,"index",2);ft=ws([l.customElement("ap-label-card")],ft);var _r=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,$s=(t,e,s,i)=>{for(var a=i>1?void 0:i?yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_r(e,s,a),a};let vt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
5390
+ `];Ss([l.property({type:Object})],vt.prototype,"label",2);Ss([l.property({type:Number})],vt.prototype,"index",2);vt=Ss([l.customElement("ap-label-card")],vt);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,Cs=(t,e,s,i)=>{for(var a=i>1?void 0:i?kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$r(e,s,a),a};let mt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
5374
5391
  <div class="row" @click=${this._handleClick}>
5375
- <div class="icon-wrapper" style="background: color-mix(in srgb, ${s} 10%, transparent)">
5376
- <ap-icon name="tag" .size=${16} style="color: ${s}"></ap-icon>
5392
+ <div class="icon-wrapper" ${F({background:`color-mix(in srgb, ${s} 10%, transparent)`})}>
5393
+ <ap-icon name="tag" .size=${16} ${F({color:s})}></ap-icon>
5377
5394
  </div>
5378
5395
  <div class="name" title=${t.name}>${t.name}</div>
5379
5396
  <div class="count">${e} asset${e!==1?"s":""}</div>
5380
5397
  </div>
5381
- `}};vt.styles=r.css`
5398
+ `}};mt.styles=r.css`
5382
5399
  :host {
5383
5400
  display: block;
5384
5401
  }
@@ -5418,7 +5435,7 @@
5418
5435
  white-space: nowrap;
5419
5436
  text-align: right;
5420
5437
  }
5421
- `;$s([l.property({type:Object})],vt.prototype,"label",2);$s([l.property({type:Number})],vt.prototype,"index",2);vt=$s([l.customElement("ap-label-row")],vt);var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,ks=(t,e,s,i)=>{for(var a=i>1?void 0:i?wr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xr(e,s,a),a};let mt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
5438
+ `;Cs([l.property({type:Object})],mt.prototype,"label",2);Cs([l.property({type:Number})],mt.prototype,"index",2);mt=Cs([l.customElement("ap-label-row")],mt);var Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Fs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Cr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sr(e,s,a),a};let bt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
5422
5439
  <div class="card" @click=${this._handleClick}>
5423
5440
  <div class="icon-wrapper">
5424
5441
  <ap-icon name="layout-grid" .size=${22}></ap-icon>
@@ -5430,7 +5447,7 @@
5430
5447
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5431
5448
  </div>
5432
5449
  </div>
5433
- `:r.html``}};mt.styles=[Y,r.css`
5450
+ `:r.html``}};bt.styles=[W,r.css`
5434
5451
  @keyframes ap-card-in {
5435
5452
  from { opacity: 0; transform: translateY(8px); }
5436
5453
  to { opacity: 1; transform: translateY(0); }
@@ -5492,7 +5509,7 @@
5492
5509
  opacity: 0.5;
5493
5510
  transition: opacity 150ms;
5494
5511
  }
5495
- `];ks([l.property({type:Object})],mt.prototype,"collection",2);ks([l.property({type:Number})],mt.prototype,"index",2);mt=ks([l.customElement("ap-collection-card")],mt);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,Ss=(t,e,s,i)=>{for(var a=i>1?void 0:i?kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$r(e,s,a),a};let bt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_formatDate(t){if(!t)return"";try{return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return""}}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
5512
+ `];Fs([l.property({type:Object})],bt.prototype,"collection",2);Fs([l.property({type:Number})],bt.prototype,"index",2);bt=Fs([l.customElement("ap-collection-card")],bt);var Fr=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Es=(t,e,s,i)=>{for(var a=i>1?void 0:i?Er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fr(e,s,a),a};let _t=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_formatDate(t){if(!t)return"";try{return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return""}}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
5496
5513
  <div class="row" @click=${this._handleClick}>
5497
5514
  <div class="icon-wrapper">
5498
5515
  <ap-icon name="layout-grid" .size=${16}></ap-icon>
@@ -5503,7 +5520,7 @@
5503
5520
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5504
5521
  </div>
5505
5522
  </div>
5506
- `:r.html``}};bt.styles=r.css`
5523
+ `:r.html``}};_t.styles=r.css`
5507
5524
  :host {
5508
5525
  display: block;
5509
5526
  }
@@ -5558,7 +5575,7 @@
5558
5575
  opacity: 0.5;
5559
5576
  transition: opacity 150ms;
5560
5577
  }
5561
- `;Ss([l.property({type:Object})],bt.prototype,"collection",2);Ss([l.property({type:Number})],bt.prototype,"index",2);bt=Ss([l.customElement("ap-collection-row")],bt);var Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Cs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Cr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sr(e,s,a),a};let _t=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
5578
+ `;Es([l.property({type:Object})],_t.prototype,"collection",2);Es([l.property({type:Number})],_t.prototype,"index",2);_t=Es([l.customElement("ap-collection-row")],_t);var Ar=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?Tr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ar(e,s,a),a};let yt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
5562
5579
  <div class="card" @click=${this._handleClick}>
5563
5580
  <div class="icon-wrapper">
5564
5581
  <ap-icon name="folder" .size=${22}></ap-icon>
@@ -5570,7 +5587,7 @@
5570
5587
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5571
5588
  </div>
5572
5589
  </div>
5573
- `:r.html``}};_t.styles=[Y,r.css`
5590
+ `:r.html``}};yt.styles=[W,r.css`
5574
5591
  @keyframes ap-card-in {
5575
5592
  from { opacity: 0; transform: translateY(8px); }
5576
5593
  to { opacity: 1; transform: translateY(0); }
@@ -5628,7 +5645,7 @@
5628
5645
  opacity: 0.5;
5629
5646
  transition: opacity 150ms;
5630
5647
  }
5631
- `];Cs([l.property({type:Object})],_t.prototype,"folder",2);Cs([l.property({type:Number})],_t.prototype,"index",2);_t=Cs([l.customElement("ap-collection-folder-card")],_t);var Fr=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Fs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fr(e,s,a),a};let yt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
5648
+ `];As([l.property({type:Object})],yt.prototype,"folder",2);As([l.property({type:Number})],yt.prototype,"index",2);yt=As([l.customElement("ap-collection-folder-card")],yt);var Lr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,Ts=(t,e,s,i)=>{for(var a=i>1?void 0:i?Or(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lr(e,s,a),a};let xt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
5632
5649
  <div class="row" @click=${this._handleClick}>
5633
5650
  <div class="icon-wrapper">
5634
5651
  <ap-icon name="folder" .size=${16}></ap-icon>
@@ -5638,7 +5655,7 @@
5638
5655
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
5639
5656
  </div>
5640
5657
  </div>
5641
- `:r.html``}};yt.styles=r.css`
5658
+ `:r.html``}};xt.styles=r.css`
5642
5659
  :host {
5643
5660
  display: block;
5644
5661
  }
@@ -5683,8 +5700,8 @@
5683
5700
  opacity: 0.5;
5684
5701
  transition: opacity 150ms;
5685
5702
  }
5686
- `;Fs([l.property({type:Object})],yt.prototype,"folder",2);Fs([l.property({type:Number})],yt.prototype,"index",2);yt=Fs([l.customElement("ap-collection-folder-row")],yt);var Ar=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,Ft=(t,e,s,i)=>{for(var a=i>1?void 0:i?Tr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ar(e,s,a),a};let Ge=class extends r.LitElement{constructor(){super(...arguments),this.variant="grid",this.gridSize="normal",this.multiSelect=!0,this.folderCount=0}render(){if(this.variant==="grid"){const n=this.gridSize==="large"?"280px":"220px";return r.html`
5687
- <div class="grid-skeleton" style="--ap-grid-min-col: ${n}">
5703
+ `;Ts([l.property({type:Object})],xt.prototype,"folder",2);Ts([l.property({type:Number})],xt.prototype,"index",2);xt=Ts([l.customElement("ap-collection-folder-row")],xt);var Mr=Object.defineProperty,Pr=Object.getOwnPropertyDescriptor,Et=(t,e,s,i)=>{for(var a=i>1?void 0:i?Pr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mr(e,s,a),a};let Ke=class extends r.LitElement{constructor(){super(...arguments),this.variant="grid",this.gridSize="normal",this.multiSelect=!0,this.folderCount=0}render(){if(this.variant==="grid"){const n=this.gridSize==="large"?"280px":"220px";return r.html`
5704
+ <div class="grid-skeleton" ${F({"--ap-grid-min-col":String(n)})}>
5688
5705
  ${Array.from({length:18},()=>r.html`<div class="card-skel">
5689
5706
  <div class="skeleton card-skel-thumb"></div>
5690
5707
  <div class="card-skel-info">
@@ -5694,31 +5711,31 @@
5694
5711
  </div>`)}
5695
5712
  </div>
5696
5713
  `}const t=[];this.multiSelect&&t.push("32px"),t.push("48px","minmax(120px, 1fr)","72px","100px","120px","36px");const e=t.join(" "),s=r.html`
5697
- <div class="row-skel" style="grid-template-columns: ${e}">
5714
+ <div class="row-skel" ${F({"grid-template-columns":e})}>
5698
5715
  ${this.multiSelect?r.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5699
5716
  <div class="row-skel-folder-thumb">
5700
5717
  <svg viewBox="0 0 100 100" preserveAspectRatio="none">
5701
5718
  <path d="M 3,0 L 30,0 L 43.5,0 Q 45,0 46.5,3 L 51,12 L 97,12 Q 100,12 100,15 L 100,97 Q 100,100 97,100 L 3,100 Q 0,100 0,97 L 0,3 Q 0,0 3,0 Z" />
5702
5719
  </svg>
5703
5720
  </div>
5704
- <div class="skeleton row-skel-name" style="width: 55%"></div>
5721
+ <div class="skeleton row-skel-name row-skel-folder-name"></div>
5705
5722
  <div class="skeleton row-skel-type"></div>
5706
5723
  <div class="skeleton row-skel-size"></div>
5707
5724
  <div class="skeleton row-skel-date"></div>
5708
5725
  <div></div>
5709
5726
  </div>
5710
5727
  `,i=n=>r.html`
5711
- <div class="row-skel" style="grid-template-columns: ${e}">
5728
+ <div class="row-skel" ${F({"grid-template-columns":e})}>
5712
5729
  ${this.multiSelect?r.html`<div class="row-skel-check-wrap"><div class="skeleton row-skel-check"></div></div>`:""}
5713
5730
  <div class="skeleton row-skel-thumb"></div>
5714
- <div class="skeleton row-skel-name" style="width: ${n}"></div>
5731
+ <div class="skeleton row-skel-name" ${F({width:n})}></div>
5715
5732
  <div class="skeleton row-skel-type"></div>
5716
5733
  <div class="skeleton row-skel-size"></div>
5717
5734
  <div class="skeleton row-skel-date"></div>
5718
5735
  <div></div>
5719
5736
  </div>
5720
5737
  `,a=["70%","55%","80%","45%","65%","50%","75%","60%","85%","40%","72%","58%"],o=12-this.folderCount;return r.html`
5721
- <div class="list-header" style="grid-template-columns: ${e}">
5738
+ <div class="list-header" ${F({"grid-template-columns":e})}>
5722
5739
  ${this.multiSelect?r.html`<div class="header-check-wrap"><div class="header-check-box"></div></div>`:""}
5723
5740
  <span></span>
5724
5741
  <span>Name</span>
@@ -5729,7 +5746,7 @@
5729
5746
  </div>
5730
5747
  ${Array.from({length:this.folderCount},()=>s)}
5731
5748
  ${Array.from({length:o},(n,c)=>i(a[c%a.length]))}
5732
- `}};Ge.styles=r.css`
5749
+ `}};Ke.styles=r.css`
5733
5750
  :host {
5734
5751
  display: block;
5735
5752
  padding: 0 20px 16px;
@@ -5797,6 +5814,9 @@
5797
5814
  width: 70%;
5798
5815
  border-radius: 4px;
5799
5816
  }
5817
+ .row-skel-folder-name {
5818
+ width: 55%;
5819
+ }
5800
5820
  .row-skel-type {
5801
5821
  height: 12px;
5802
5822
  width: 40px;
@@ -5854,7 +5874,7 @@
5854
5874
  @media (prefers-reduced-motion: reduce) {
5855
5875
  .skeleton { animation: none; }
5856
5876
  }
5857
- `;Ft([l.property({reflect:!0})],Ge.prototype,"variant",2);Ft([l.property({type:String})],Ge.prototype,"gridSize",2);Ft([l.property({type:Boolean})],Ge.prototype,"multiSelect",2);Ft([l.property({type:Number})],Ge.prototype,"folderCount",2);Ge=Ft([l.customElement("ap-skeleton")],Ge);var Lr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,U=(t,e,s,i)=>{for(var a=i>1?void 0:i?Or(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lr(e,s,a),a};let z=class extends r.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=tt(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Vt(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:o}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!o.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new o;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(o.Events.ERROR,(c,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,o,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(o=this.previewArea)==null?void 0:o.requestFullscreen)==null||n.call(o)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=tt(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return zt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Be(e,this.containerToken);return xe(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,c;const e=(n=t.info)==null?void 0:n.img_w,s=(c=t.info)==null?void 0:c.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,o=Math.min(i/e,a/s,1);return{width:`${Math.round(e*o)}px`,height:`${Math.round(s*o)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.TAGS,values:[t],operator:C.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.LABELS,values:[t],operator:C.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return r.nothing;const s=this._openSections.has("file-info");return r.html`
5877
+ `;Et([l.property({reflect:!0})],Ke.prototype,"variant",2);Et([l.property({type:String})],Ke.prototype,"gridSize",2);Et([l.property({type:Boolean})],Ke.prototype,"multiSelect",2);Et([l.property({type:Number})],Ke.prototype,"folderCount",2);Ke=Et([l.customElement("ap-skeleton")],Ke);var Ir=Object.defineProperty,Dr=Object.getOwnPropertyDescriptor,B=(t,e,s,i)=>{for(var a=i>1?void 0:i?Dr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ir(e,s,a),a};let R=class extends r.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=st(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Ht(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:o}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!o.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new o;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(o.Events.ERROR,(c,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,o,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(o=this.previewArea)==null?void 0:o.requestFullscreen)==null||n.call(o)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=st(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return Rt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=qe(e,this.containerToken);return we(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,c;const e=(n=t.info)==null?void 0:n.img_w,s=(c=t.info)==null?void 0:c.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,o=Math.min(i/e,a/s,1);return{width:`${Math.round(e*o)}px`,height:`${Math.round(s*o)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.TAGS,values:[t],operator:C.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.LABELS,values:[t],operator:C.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return r.nothing;const s=this._openSections.has("file-info");return r.html`
5858
5878
  <div class="accordion">
5859
5879
  <button
5860
5880
  class="accordion-trigger"
@@ -5898,14 +5918,14 @@
5898
5918
  `)}
5899
5919
  </div>
5900
5920
  </div>
5901
- `}_getFileInfoRows(t){var s,i,a,o,n,c;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:xs(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:_i(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((o=t.info)==null?void 0:o.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(c=t.info)!=null&&c.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:jt(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:jt(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var o,n,c,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const g=h[u.key]??((n=(o=t.info)==null?void 0:o.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(g,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const f=p.length>50;e.push({label:u.label,value:p,wrap:f})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const g=s.get(h);if(g){const p=this._resolveFieldValue(u,g);if(!p)continue;i.add(h);const f=p.length>50;e.push({label:g.label,value:p,wrap:f})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const f=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:f,value:p,wrap:m})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const g=s.get(h);if(g){const p=this._resolveFieldValue(u,g);if(!p)continue;i.add(h);const f=p.length>50;e.push({label:g.label,value:p,wrap:f})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const f=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:f,value:p,wrap:m})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?r.nothing:r.html`
5902
- <div class="meta-row" style="flex-direction:column;gap:6px">
5921
+ `}_getFileInfoRows(t){var s,i,a,o,n,c;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:ks(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:wi(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((o=t.info)==null?void 0:o.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(c=t.info)!=null&&c.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:Nt(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:Nt(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var o,n,c,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const g=h[u.key]??((n=(o=t.info)==null?void 0:o.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(g,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const f=p.length>50;e.push({label:u.label,value:p,wrap:f})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const g=s.get(h);if(g){const p=this._resolveFieldValue(u,g);if(!p)continue;i.add(h);const f=p.length>50;e.push({label:g.label,value:p,wrap:f})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const f=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:f,value:p,wrap:m})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const g=s.get(h);if(g){const p=this._resolveFieldValue(u,g);if(!p)continue;i.add(h);const f=p.length>50;e.push({label:g.label,value:p,wrap:f})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const f=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),m=p.length>50;e.push({label:f,value:p,wrap:m})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?r.nothing:r.html`
5922
+ <div class="meta-row meta-row--col">
5903
5923
  <span class="meta-label">Labels</span>
5904
5924
  <div class="tags-list">
5905
5925
  ${e.map(s=>r.html`
5906
- <ap-badge class="tag-link" style="--ap-muted: ${s.color}22; --ap-muted-foreground: ${s.color}" @click=${()=>this._applyLabelFilter(s.sid||s.uuid)}>
5907
- <span style="display:inline-flex;align-items:center;gap:4px">
5908
- <ap-icon name="tag" .size=${12} style="color:${s.color}"></ap-icon>
5926
+ <ap-badge class="tag-link" ${F({"--ap-muted":`${s.color}22`,"--ap-muted-foreground":s.color})} @click=${()=>this._applyLabelFilter(s.sid||s.uuid)}>
5927
+ <span class="label-content">
5928
+ <ap-icon name="tag" .size=${12} ${F({color:s.color})}></ap-icon>
5909
5929
  ${s.name}
5910
5930
  </span>
5911
5931
  </ap-badge>
@@ -5921,7 +5941,7 @@
5921
5941
  `)}
5922
5942
  </div>
5923
5943
  </div>
5924
- `}render(){var k,S,F,E,fe,ie,M,X;const t=this.asset;if(!t)return r.nothing;const e=tt(t.type),s=e==="image",i=e==="video",a=e==="audio",o=((k=t.extension)==null?void 0:k.toLowerCase())==="pdf",n=$t(t.extension||""),c=us(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=zt(t),u=s?d?((F=t.url)==null?void 0:F.cdn)||"":h||Be(((E=t.url)==null?void 0:E.cdn)||"",this.containerToken):"",g=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,f=i&&((fe=t.url)==null?void 0:fe.cdn)||"",m=i&&(((ie=t.info)==null?void 0:ie.video_thumbnail)||((M=t.info)==null?void 0:M.preview))||"",x=o&&!s?gs(t):"",_=this._getCurrentIndex(),w=_>0&&this._findNavTarget(_,-1)>=0,y=_>=0&&this._findNavTarget(_,1)>=0,T=this.assets.length>1;return r.html`
5944
+ `}render(){var k,S,E,A,ve,ae,P,Z;const t=this.asset;if(!t)return r.nothing;const e=st(t.type),s=e==="image",i=e==="video",a=e==="audio",o=((k=t.extension)==null?void 0:k.toLowerCase())==="pdf",n=kt(t.extension||""),c=vs(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=Rt(t),u=s?d?((E=t.url)==null?void 0:E.cdn)||"":h||qe(((A=t.url)==null?void 0:A.cdn)||"",this.containerToken):"",g=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,f=i&&((ve=t.url)==null?void 0:ve.cdn)||"",m=i&&(((ae=t.info)==null?void 0:ae.video_thumbnail)||((P=t.info)==null?void 0:P.preview))||"",x=o&&!s?ms(t):"",_=this._getCurrentIndex(),w=_>0&&this._findNavTarget(_,-1)>=0,y=_>=0&&this._findNavTarget(_,1)>=0,L=this.assets.length>1;return r.html`
5925
5945
  <div class="panel">
5926
5946
  <div class="panel-header">
5927
5947
  <span class="panel-title" title=${t.name}>${t.name}</span>
@@ -5940,7 +5960,7 @@
5940
5960
  </div>
5941
5961
 
5942
5962
  <div class="preview-area ${s&&c?"chess":""}">
5943
- ${T?r.html`
5963
+ ${L?r.html`
5944
5964
  <button class="nav-btn prev" @click=${this._prev} ?disabled=${!w} aria-label="Previous">
5945
5965
  <ap-icon name="chevron-left" .size=${16}></ap-icon>
5946
5966
  </button>
@@ -5958,8 +5978,8 @@
5958
5978
  <img
5959
5979
  src=${u}
5960
5980
  alt=${t.name}
5961
- @load=${Z=>{Z.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
5962
- @error=${Z=>{const D=Z.target;this._previewLoading=!1,D.src!==n&&(D.src=n,D.classList.add("icon-fallback"))}}
5981
+ @load=${J=>{J.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
5982
+ @error=${J=>{const z=J.target;this._previewLoading=!1,z.src!==n&&(z.src=n,z.classList.add("icon-fallback"))}}
5963
5983
  />
5964
5984
  <div class="fs-wrapper">
5965
5985
  ${d?r.nothing:r.html`
@@ -5967,26 +5987,26 @@
5967
5987
  class="fs-blur ${this._fsImageLoaded?"hidden":""}"
5968
5988
  src=${u}
5969
5989
  alt=""
5970
- style="width:${p.width};height:${p.height}"
5990
+ ${F({width:p.width,height:p.height})}
5971
5991
  />
5972
5992
  `}
5973
5993
  <img
5974
5994
  class="fs-full ${d||this._fsImageLoaded?"loaded":""}"
5975
5995
  src=${this._isFullscreen?g:""}
5976
5996
  alt=${t.name}
5977
- style=${d?"width:100vw;height:100vh":""}
5997
+ ${F(d?{width:"100vw",height:"100vh"}:null)}
5978
5998
  @load=${this._onFsImageLoad}
5979
5999
  />
5980
6000
  </div>
5981
6001
  `:r.nothing}
5982
6002
  ${i?r.html`<video src=${f} poster=${m||r.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:r.nothing}
5983
- ${a?r.html`<audio src=${((X=t.url)==null?void 0:X.cdn)||""} controls></audio>`:r.nothing}
6003
+ ${a?r.html`<audio src=${((Z=t.url)==null?void 0:Z.cdn)||""} controls></audio>`:r.nothing}
5984
6004
  ${o&&!s?r.html`
5985
6005
  <img
5986
6006
  src=${x||n}
5987
6007
  alt=${t.name}
5988
6008
  class=${x?"":"icon-fallback"}
5989
- @error=${Z=>{const D=Z.target;D.src!==n&&(D.src=n,D.classList.add("icon-fallback"))}}
6009
+ @error=${J=>{const z=J.target;z.src!==n&&(z.src=n,z.classList.add("icon-fallback"))}}
5990
6010
  />
5991
6011
  `:r.nothing}
5992
6012
  ${!s&&!i&&!a&&!o?r.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:r.nothing}
@@ -5997,7 +6017,7 @@
5997
6017
  ${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
5998
6018
  `:r.nothing}
5999
6019
  </div>
6000
- `}};z.styles=r.css`
6020
+ `}};R.styles=r.css`
6001
6021
  :host {
6002
6022
  display: block;
6003
6023
  }
@@ -6243,6 +6263,15 @@
6243
6263
  flex-wrap: wrap;
6244
6264
  gap: 8px;
6245
6265
  }
6266
+ .meta-row--col {
6267
+ flex-direction: column;
6268
+ gap: 6px;
6269
+ }
6270
+ .label-content {
6271
+ display: inline-flex;
6272
+ align-items: center;
6273
+ gap: 4px;
6274
+ }
6246
6275
  .tag-link {
6247
6276
  cursor: pointer;
6248
6277
  transition: opacity 150ms;
@@ -6308,9 +6337,9 @@
6308
6337
  .panel { animation: none; }
6309
6338
  .accordion-chevron { transition: none; }
6310
6339
  }
6311
- `;U([l.property({type:Object})],z.prototype,"asset",2);U([l.property({type:Array})],z.prototype,"assets",2);U([l.property({type:Array})],z.prototype,"selectedIds",2);U([l.property()],z.prototype,"containerToken",2);U([l.property({type:Boolean})],z.prototype,"showMetadata",2);U([l.property({type:Array})],z.prototype,"metadataFields",2);U([l.property({type:Array})],z.prototype,"labels",2);U([l.property({type:Object})],z.prototype,"regionalFilters",2);U([l.property({type:Boolean})],z.prototype,"multiSelect",2);U([l.query(".preview-area")],z.prototype,"previewArea",2);U([l.query("video")],z.prototype,"_videoEl",2);U([l.state()],z.prototype,"_isFullscreen",2);U([l.state()],z.prototype,"_fsImageLoaded",2);U([l.state()],z.prototype,"_previewLoading",2);U([l.state()],z.prototype,"_openSections",2);z=U([l.customElement("ap-preview-panel")],z);var Mr=Object.defineProperty,Ir=Object.getOwnPropertyDescriptor,Es=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ir(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mr(e,s,a),a};const Pr={sparkles:[{tag:"path",attrs:{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}},{tag:"path",attrs:{d:"M5 3v4"}},{tag:"path",attrs:{d:"M19 17v4"}},{tag:"path",attrs:{d:"M3 5h4"}},{tag:"path",attrs:{d:"M17 19h4"}}],search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let xt=class extends r.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=Pr[this.name];if(!t)return r.nothing;const e=typeof t=="string"?r.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?r.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?r.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:r.svg`<path d=${a.d}></path>`});return r.html`
6340
+ `;B([l.property({type:Object})],R.prototype,"asset",2);B([l.property({type:Array})],R.prototype,"assets",2);B([l.property({type:Array})],R.prototype,"selectedIds",2);B([l.property()],R.prototype,"containerToken",2);B([l.property({type:Boolean})],R.prototype,"showMetadata",2);B([l.property({type:Array})],R.prototype,"metadataFields",2);B([l.property({type:Array})],R.prototype,"labels",2);B([l.property({type:Object})],R.prototype,"regionalFilters",2);B([l.property({type:Boolean})],R.prototype,"multiSelect",2);B([l.query(".preview-area")],R.prototype,"previewArea",2);B([l.query("video")],R.prototype,"_videoEl",2);B([l.state()],R.prototype,"_isFullscreen",2);B([l.state()],R.prototype,"_fsImageLoaded",2);B([l.state()],R.prototype,"_previewLoading",2);B([l.state()],R.prototype,"_openSections",2);R=B([l.customElement("ap-preview-panel")],R);var zr=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,Ls=(t,e,s,i)=>{for(var a=i>1?void 0:i?Rr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&zr(e,s,a),a};const jr={sparkles:[{tag:"path",attrs:{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}},{tag:"path",attrs:{d:"M5 3v4"}},{tag:"path",attrs:{d:"M19 17v4"}},{tag:"path",attrs:{d:"M3 5h4"}},{tag:"path",attrs:{d:"M17 19h4"}}],search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let wt=class extends r.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=jr[this.name];if(!t)return r.nothing;const e=typeof t=="string"?r.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?r.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?r.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:r.svg`<path d=${a.d}></path>`});return r.html`
6312
6341
  <svg
6313
- style="--icon-size: ${this.size}px"
6342
+ ${F({"--icon-size":`${this.size}px`})}
6314
6343
  viewBox="0 0 24 24"
6315
6344
  fill="none"
6316
6345
  stroke="currentColor"
@@ -6320,7 +6349,7 @@
6320
6349
  >
6321
6350
  ${e}
6322
6351
  </svg>
6323
- `}};xt.styles=[r.css`
6352
+ `}};wt.styles=[r.css`
6324
6353
  :host {
6325
6354
  display: inline-flex;
6326
6355
  align-items: center;
@@ -6330,7 +6359,7 @@
6330
6359
  width: var(--icon-size, 20px);
6331
6360
  height: var(--icon-size, 20px);
6332
6361
  }
6333
- `];Es([l.property()],xt.prototype,"name",2);Es([l.property({type:Number})],xt.prototype,"size",2);xt=Es([l.customElement("ap-icon")],xt);var Dr=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Fe=(t,e,s,i)=>{for(var a=i>1?void 0:i?zr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Dr(e,s,a),a};let ue=class extends r.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0,this.showTransform=!1}get _totalSelected(){return this.selectedAssets.length+this.selectedFolders.length}_formatCount(){const t=this.selectedAssets.length,e=this.selectedFolders.length;if(e===0)return`${t} selected`;if(t===0)return`${e} folder${e!==1?"s":""} selected`;const s=`${e} folder${e!==1?"s":""}`,i=`${t} asset${t!==1?"s":""}`;return`${s} and ${i} selected`}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_transform(){this.dispatchEvent(new CustomEvent("selection-transform",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_canSelectMore(){if(this.maxSelections&&this._totalSelected>=this.maxSelections)return!1;const t=this._selectScope;return t==="assets"?this.selectedAssets.length<this.totalCount:t==="folders"?this.selectedFolders.length<this.totalFolderCount:this._totalSelected<this.totalCount+this.totalFolderCount}get _scopeTotal(){const t=this._selectScope;return t==="assets"?this.totalCount:t==="folders"?this.totalFolderCount:this.totalCount+this.totalFolderCount}get _selectScope(){const t=this.selectedAssets.length>0,e=this.selectedFolders.length>0;return t&&!e?"assets":e&&!t?"folders":"all"}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:this._selectScope},bubbles:!0,composed:!0}))}render(){return this._totalSelected===0?r.nothing:r.html`
6362
+ `];Ls([l.property()],wt.prototype,"name",2);Ls([l.property({type:Number})],wt.prototype,"size",2);wt=Ls([l.customElement("ap-icon")],wt);var Nr=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,Ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ur(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Nr(e,s,a),a};let ge=class extends r.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0,this.showTransform=!1}get _totalSelected(){return this.selectedAssets.length+this.selectedFolders.length}_formatCount(){const t=this.selectedAssets.length,e=this.selectedFolders.length;if(e===0)return`${t} selected`;if(t===0)return`${e} folder${e!==1?"s":""} selected`;const s=`${e} folder${e!==1?"s":""}`,i=`${t} asset${t!==1?"s":""}`;return`${s} and ${i} selected`}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_transform(){this.dispatchEvent(new CustomEvent("selection-transform",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_canSelectMore(){if(this.maxSelections&&this._totalSelected>=this.maxSelections)return!1;const t=this._selectScope;return t==="assets"?this.selectedAssets.length<this.totalCount:t==="folders"?this.selectedFolders.length<this.totalFolderCount:this._totalSelected<this.totalCount+this.totalFolderCount}get _scopeTotal(){const t=this._selectScope;return t==="assets"?this.totalCount:t==="folders"?this.totalFolderCount:this.totalCount+this.totalFolderCount}get _selectScope(){const t=this.selectedAssets.length>0,e=this.selectedFolders.length>0;return t&&!e?"assets":e&&!t?"folders":"all"}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:this._selectScope},bubbles:!0,composed:!0}))}render(){return this._totalSelected===0?r.nothing:r.html`
6334
6363
  <div class="bar">
6335
6364
  <span class="count">${this._formatCount()}</span>
6336
6365
  ${this.multiSelect?r.html`
@@ -6350,7 +6379,7 @@
6350
6379
  `:r.nothing}
6351
6380
  <button class="btn-confirm" @click=${this._confirm}>Confirm</button>
6352
6381
  </div>
6353
- `}};ue.styles=r.css`
6382
+ `}};ge.styles=r.css`
6354
6383
  :host {
6355
6384
  display: block;
6356
6385
  padding: 0 8px 8px;
@@ -6441,12 +6470,12 @@
6441
6470
  @media (prefers-reduced-motion: reduce) {
6442
6471
  .bar { animation: none; }
6443
6472
  }
6444
- `;Fe([l.property({type:Array})],ue.prototype,"selectedAssets",2);Fe([l.property({type:Array})],ue.prototype,"selectedFolders",2);Fe([l.property({type:Number})],ue.prototype,"totalCount",2);Fe([l.property({type:Number})],ue.prototype,"totalFolderCount",2);Fe([l.property({type:Boolean})],ue.prototype,"isSelectingAll",2);Fe([l.property({type:Boolean})],ue.prototype,"multiSelect",2);Fe([l.property({type:Number})],ue.prototype,"maxSelections",2);Fe([l.property({type:Boolean})],ue.prototype,"showTransform",2);ue=Fe([l.customElement("ap-selection-bar")],ue);var Rr=Object.defineProperty,jr=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?jr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Rr(e,s,a),a};let wt=class extends r.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?r.nothing:r.html`
6473
+ `;Ee([l.property({type:Array})],ge.prototype,"selectedAssets",2);Ee([l.property({type:Array})],ge.prototype,"selectedFolders",2);Ee([l.property({type:Number})],ge.prototype,"totalCount",2);Ee([l.property({type:Number})],ge.prototype,"totalFolderCount",2);Ee([l.property({type:Boolean})],ge.prototype,"isSelectingAll",2);Ee([l.property({type:Boolean})],ge.prototype,"multiSelect",2);Ee([l.property({type:Number})],ge.prototype,"maxSelections",2);Ee([l.property({type:Boolean})],ge.prototype,"showTransform",2);ge=Ee([l.customElement("ap-selection-bar")],ge);var Br=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,Os=(t,e,s,i)=>{for(var a=i>1?void 0:i?qr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Br(e,s,a),a};let $t=class extends r.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?r.nothing:r.html`
6445
6474
  <div
6446
6475
  class="marquee"
6447
- style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
6476
+ ${F({left:`${this.rect.x}px`,top:`${this.rect.y}px`,width:`${this.rect.width}px`,height:`${this.rect.height}px`})}
6448
6477
  ></div>
6449
- `}};wt.styles=r.css`
6478
+ `}};$t.styles=r.css`
6450
6479
  :host {
6451
6480
  display: block;
6452
6481
  position: absolute;
@@ -6463,7 +6492,7 @@
6463
6492
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
6464
6493
  border-radius: 2px;
6465
6494
  }
6466
- `;As([l.property({type:Boolean})],wt.prototype,"active",2);As([l.property({type:Object})],wt.prototype,"rect",2);wt=As([l.customElement("ap-marquee-overlay")],wt);var Nr=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,We=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ur(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Nr(e,s,a),a};let Se=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.clearable=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return r.html`
6495
+ `;Os([l.property({type:Boolean})],$t.prototype,"active",2);Os([l.property({type:Object})],$t.prototype,"rect",2);$t=Os([l.customElement("ap-marquee-overlay")],$t);var Vr=Object.defineProperty,Hr=Object.getOwnPropertyDescriptor,Xe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Hr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vr(e,s,a),a};let Ce=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.clearable=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return r.html`
6467
6496
  ${this.options.map(t=>r.html`
6468
6497
  <div
6469
6498
  class="option"
@@ -6477,7 +6506,7 @@
6477
6506
  <span class="label">${t.label}</span>
6478
6507
  </div>
6479
6508
  `)}
6480
- `}_select(t){if(this.disabled||t.disabled)return;const e=this.clearable&&t.value===this.value?"":t.value;this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:e},bubbles:!0,composed:!0}))}};Se.styles=[Y,r.css`
6509
+ `}_select(t){if(this.disabled||t.disabled)return;const e=this.clearable&&t.value===this.value?"":t.value;this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:e},bubbles:!0,composed:!0}))}};Ce.styles=[W,r.css`
6481
6510
  :host {
6482
6511
  display: flex;
6483
6512
  flex-direction: column;
@@ -6538,7 +6567,7 @@
6538
6567
  font-family: inherit;
6539
6568
  user-select: none;
6540
6569
  }
6541
- `];We([l.property()],Se.prototype,"value",2);We([l.property({type:Array})],Se.prototype,"options",2);We([l.property({type:Boolean})],Se.prototype,"disabled",2);We([l.property({type:Boolean})],Se.prototype,"clearable",2);We([l.property({reflect:!0})],Se.prototype,"direction",2);We([l.property({reflect:!0})],Se.prototype,"columns",2);Se=We([l.customElement("ap-radio-group")],Se);var Br=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,yi=(t,e,s,i)=>{for(var a=i>1?void 0:i?qr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Br(e,s,a),a};let Nt=class extends r.LitElement{constructor(){super(...arguments),this.size=24}render(){return r.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};Nt.styles=[r.css`
6570
+ `];Xe([l.property()],Ce.prototype,"value",2);Xe([l.property({type:Array})],Ce.prototype,"options",2);Xe([l.property({type:Boolean})],Ce.prototype,"disabled",2);Xe([l.property({type:Boolean})],Ce.prototype,"clearable",2);Xe([l.property({reflect:!0})],Ce.prototype,"direction",2);Xe([l.property({reflect:!0})],Ce.prototype,"columns",2);Ce=Xe([l.customElement("ap-radio-group")],Ce);var Gr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,$i=(t,e,s,i)=>{for(var a=i>1?void 0:i?Kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gr(e,s,a),a};let Ut=class extends r.LitElement{constructor(){super(...arguments),this.size=24}render(){return r.html`<div class="spinner" ${F({width:`${this.size}px`,height:`${this.size}px`})}></div>`}};Ut.styles=[r.css`
6542
6571
  :host {
6543
6572
  display: inline-flex;
6544
6573
  }
@@ -6551,7 +6580,7 @@
6551
6580
  @keyframes spin {
6552
6581
  to { transform: rotate(360deg); }
6553
6582
  }
6554
- `];yi([l.property({type:Number})],Nt.prototype,"size",2);Nt=yi([l.customElement("ap-spinner")],Nt);var Vr=Object.defineProperty,Hr=Object.getOwnPropertyDescriptor,Yt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Hr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vr(e,s,a),a};let ot=class extends r.LitElement{constructor(){super(...arguments),this.folders=[],this.loading=!1,this._mode="recursive"}_handleConfirm(){this.dispatchEvent(new CustomEvent("folder-resolve-confirm",{detail:{mode:this._mode},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("folder-resolve-cancel",{bubbles:!0,composed:!0}))}_handleModeChange(t){this._mode=t.detail.value}render(){const t=this.folders.length;return r.html`
6583
+ `];$i([l.property({type:Number})],Ut.prototype,"size",2);Ut=$i([l.customElement("ap-spinner")],Ut);var Qr=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Wt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Qr(e,s,a),a};let rt=class extends r.LitElement{constructor(){super(...arguments),this.folders=[],this.loading=!1,this._mode="recursive"}_handleConfirm(){this.dispatchEvent(new CustomEvent("folder-resolve-confirm",{detail:{mode:this._mode},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("folder-resolve-cancel",{bubbles:!0,composed:!0}))}_handleModeChange(t){this._mode=t.detail.value}render(){const t=this.folders.length;return r.html`
6555
6584
  <div class="backdrop" @click=${e=>{e.target===e.currentTarget&&this._handleCancel()}}>
6556
6585
  <div class="dialog">
6557
6586
  <div class="title">Add folder contents</div>
@@ -6573,7 +6602,7 @@
6573
6602
  </div>
6574
6603
  </div>
6575
6604
  </div>
6576
- `}};ot.styles=[Y,r.css`
6605
+ `}};rt.styles=[W,r.css`
6577
6606
  :host {
6578
6607
  display: block;
6579
6608
  }
@@ -6646,7 +6675,7 @@
6646
6675
  align-items: center;
6647
6676
  gap: 8px;
6648
6677
  }
6649
- `];Yt([l.property({type:Array})],ot.prototype,"folders",2);Yt([l.property({type:Boolean})],ot.prototype,"loading",2);Yt([l.state()],ot.prototype,"_mode",2);ot=Yt([l.customElement("ap-folder-resolve-dialog")],ot);var Gr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,V=(t,e,s,i)=>{for(var a=i>1?void 0:i?Kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gr(e,s,a),a};let R=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.clearable=!1,this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._menuWidth=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return r.html`
6678
+ `];Wt([l.property({type:Array})],rt.prototype,"folders",2);Wt([l.property({type:Boolean})],rt.prototype,"loading",2);Wt([l.state()],rt.prototype,"_mode",2);rt=Wt([l.customElement("ap-folder-resolve-dialog")],rt);var Wr=Object.defineProperty,Xr=Object.getOwnPropertyDescriptor,H=(t,e,s,i)=>{for(var a=i>1?void 0:i?Xr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Wr(e,s,a),a};let j=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.clearable=!1,this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._menuWidth=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return r.html`
6650
6679
  <button
6651
6680
  class="trigger"
6652
6681
  role="combobox"
@@ -6664,11 +6693,7 @@
6664
6693
  <div
6665
6694
  id=${e}
6666
6695
  class="menu ${this._menuPosition} ${this._menuAlign}"
6667
- style="
6668
- ${this._menuPosition==="below"?`top: ${this._menuTop}px`:`bottom: ${this._menuBottom}px`};
6669
- ${this._menuAlign==="align-left"?`left: ${this._menuLeft}px`:`right: ${this._menuRight}px`};
6670
- ${this._menuWidth?`min-width: ${this._menuWidth}px`:""};
6671
- "
6696
+ ${F({[this._menuPosition==="below"?"top":"bottom"]:`${this._menuPosition==="below"?this._menuTop:this._menuBottom}px`,[this._menuAlign==="align-left"?"left":"right"]:`${this._menuAlign==="align-left"?this._menuLeft:this._menuRight}px`,...this._menuWidth?{"min-width":`${this._menuWidth}px`}:{}})}
6672
6697
  role="listbox"
6673
6698
  @keydown=${this._handleMenuKeydown}
6674
6699
  >
@@ -6689,7 +6714,7 @@
6689
6714
  `)}
6690
6715
  </div>
6691
6716
  `:r.nothing}
6692
- `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_clear(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:""},bubbles:!0,composed:!0}))}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect();this._menuWidth=t.width;const e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};R.styles=[Y,r.css`
6717
+ `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_clear(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:""},bubbles:!0,composed:!0}))}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect();this._menuWidth=t.width;const e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};j.styles=[W,r.css`
6693
6718
  :host {
6694
6719
  position: relative;
6695
6720
  display: inline-block;
@@ -6798,7 +6823,7 @@
6798
6823
  .option[aria-selected="true"] ap-icon {
6799
6824
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
6800
6825
  }
6801
- `];V([l.property()],R.prototype,"value",2);V([l.property()],R.prototype,"label",2);V([l.property({reflect:!0})],R.prototype,"variant",2);V([l.property({type:Boolean})],R.prototype,"clearable",2);V([l.property({type:Array})],R.prototype,"options",2);V([l.state()],R.prototype,"_open",2);V([l.state()],R.prototype,"_focusedIndex",2);V([l.state()],R.prototype,"_menuPosition",2);V([l.state()],R.prototype,"_menuAlign",2);V([l.state()],R.prototype,"_menuTop",2);V([l.state()],R.prototype,"_menuBottom",2);V([l.state()],R.prototype,"_menuLeft",2);V([l.state()],R.prototype,"_menuRight",2);V([l.state()],R.prototype,"_menuWidth",2);R=V([l.customElement("ap-dropdown")],R);var Qr=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Qr(e,s,a),a};const Wr=["webp","jpeg","png","gif"];function Xr(t){const e=(t??"").toLowerCase();return Wr.includes(e)?e:"jpeg"}let ge=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.isMultiSelect=!1,this._format="jpeg",this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this._defaultFormat="jpeg"}get _ratio(){const t=this.assets.find(i=>je(i));if(!t)return 1.5;const e=Pt(t),s=Dt(t);return e&&s?e/s:1.5}get _isDirty(){return this._format!==this._defaultFormat||this._quality!=="excellent"||this._width!==this._defaultWidth||this._height!==this._defaultHeight}willUpdate(t){t.has("assets")&&this._initDefaults()}_initDefaults(){const t=this.assets.find(e=>je(e));if(this._defaultFormat=Xr(t==null?void 0:t.extension),this._format=this._defaultFormat,this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this.isMultiSelect)this._defaultWidth=void 0,this._defaultHeight=void 0;else if(t){const e=Pt(t),s=Dt(t);this._defaultWidth=e||void 0,this._defaultHeight=s||void 0}else this._defaultWidth=void 0,this._defaultHeight=void 0;this._width=this._defaultWidth,this._height=this._defaultHeight}_handleFormatChange(t){this._format=t.detail.value}_handleQualityChange(t){this._quality=t.detail.value}_handleWidthInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._activePreset="",this._lockAspect&&i&&(this._height=Math.round(i/this._ratio))}_handleHeightInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._height=i,this._activePreset="",this._lockAspect&&i&&(this._width=Math.round(i*this._ratio))}_handleMaxSizeInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._height=i,this._activePreset=""}_toggleLock(){this._lockAspect=!this._lockAspect}_handlePreset(t){this._activePreset=t.value,t.value==="original"?(this._width=this._defaultWidth,this._height=this._defaultHeight):t.width&&(this._width=t.width,this._height=Math.round(t.width/this._ratio))}_handleApply(){const t={format:this._format,quality:this._format!=="png"?this._quality:void 0,width:this._width,height:this._height};this.dispatchEvent(new CustomEvent("transform-confirm",{detail:{params:t,isAspectLocked:this._lockAspect},bubbles:!0,composed:!0}))}_handleSkip(){this.dispatchEvent(new CustomEvent("transform-skip",{bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("transform-cancel",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target===t.currentTarget&&this._handleClose()}render(){const t=this._format==="png";return r.html`
6826
+ `];H([l.property()],j.prototype,"value",2);H([l.property()],j.prototype,"label",2);H([l.property({reflect:!0})],j.prototype,"variant",2);H([l.property({type:Boolean})],j.prototype,"clearable",2);H([l.property({type:Array})],j.prototype,"options",2);H([l.state()],j.prototype,"_open",2);H([l.state()],j.prototype,"_focusedIndex",2);H([l.state()],j.prototype,"_menuPosition",2);H([l.state()],j.prototype,"_menuAlign",2);H([l.state()],j.prototype,"_menuTop",2);H([l.state()],j.prototype,"_menuBottom",2);H([l.state()],j.prototype,"_menuLeft",2);H([l.state()],j.prototype,"_menuRight",2);H([l.state()],j.prototype,"_menuWidth",2);j=H([l.customElement("ap-dropdown")],j);var Zr=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,Ae=(t,e,s,i)=>{for(var a=i>1?void 0:i?Jr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zr(e,s,a),a};const en=["webp","jpeg","png","gif"];function tn(t){const e=(t??"").toLowerCase();return en.includes(e)?e:"jpeg"}let fe=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.isMultiSelect=!1,this._format="jpeg",this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this._defaultFormat="jpeg"}get _ratio(){const t=this.assets.find(i=>Ne(i));if(!t)return 1.5;const e=Dt(t),s=zt(t);return e&&s?e/s:1.5}get _isDirty(){return this._format!==this._defaultFormat||this._quality!=="excellent"||this._width!==this._defaultWidth||this._height!==this._defaultHeight}willUpdate(t){t.has("assets")&&this._initDefaults()}_initDefaults(){const t=this.assets.find(e=>Ne(e));if(this._defaultFormat=tn(t==null?void 0:t.extension),this._format=this._defaultFormat,this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this.isMultiSelect)this._defaultWidth=void 0,this._defaultHeight=void 0;else if(t){const e=Dt(t),s=zt(t);this._defaultWidth=e||void 0,this._defaultHeight=s||void 0}else this._defaultWidth=void 0,this._defaultHeight=void 0;this._width=this._defaultWidth,this._height=this._defaultHeight}_handleFormatChange(t){this._format=t.detail.value}_handleQualityChange(t){this._quality=t.detail.value}_handleWidthInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._activePreset="",this._lockAspect&&i&&(this._height=Math.round(i/this._ratio))}_handleHeightInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._height=i,this._activePreset="",this._lockAspect&&i&&(this._width=Math.round(i*this._ratio))}_handleMaxSizeInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._height=i,this._activePreset=""}_toggleLock(){this._lockAspect=!this._lockAspect}_handlePreset(t){this._activePreset=t.value,t.value==="original"?(this._width=this._defaultWidth,this._height=this._defaultHeight):t.width&&(this._width=t.width,this._height=Math.round(t.width/this._ratio))}_handleApply(){const t={format:this._format,quality:this._format!=="png"?this._quality:void 0,width:this._width,height:this._height};this.dispatchEvent(new CustomEvent("transform-confirm",{detail:{params:t,isAspectLocked:this._lockAspect},bubbles:!0,composed:!0}))}_handleSkip(){this.dispatchEvent(new CustomEvent("transform-skip",{bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("transform-cancel",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target===t.currentTarget&&this._handleClose()}render(){const t=this._format==="png";return r.html`
6802
6827
  <div class="backdrop" @click=${this._handleBackdropClick}>
6803
6828
  <div class="dialog">
6804
6829
  <div class="header">
@@ -6813,7 +6838,7 @@
6813
6838
  <ap-radio-group
6814
6839
  direction="horizontal"
6815
6840
  .value=${this._format}
6816
- .options=${ta}
6841
+ .options=${aa}
6817
6842
  @ap-change=${this._handleFormatChange}
6818
6843
  ></ap-radio-group>
6819
6844
  </div>
@@ -6823,7 +6848,7 @@
6823
6848
  <span class="section-label">Quality</span>
6824
6849
  <ap-dropdown
6825
6850
  .value=${this._quality}
6826
- .options=${sa}
6851
+ .options=${oa}
6827
6852
  @ap-change=${this._handleQualityChange}
6828
6853
  ></ap-dropdown>
6829
6854
  </div>
@@ -6881,7 +6906,7 @@
6881
6906
  </div>
6882
6907
  `}
6883
6908
  <div class="presets-row">
6884
- ${ia.map(e=>r.html`
6909
+ ${ra.map(e=>r.html`
6885
6910
  <button
6886
6911
  class="preset-btn ${this._activePreset===e.value?"active":""}"
6887
6912
  @click=${()=>this._handlePreset(e)}
@@ -6896,7 +6921,7 @@
6896
6921
  </div>
6897
6922
  </div>
6898
6923
  </div>
6899
- `}};ge.styles=[Y,r.css`
6924
+ `}};fe.styles=[W,r.css`
6900
6925
  :host {
6901
6926
  display: block;
6902
6927
  }
@@ -7100,7 +7125,7 @@
7100
7125
  display: block;
7101
7126
  width: 100%;
7102
7127
  }
7103
- `];Ee([l.property({type:Array})],ge.prototype,"assets",2);Ee([l.property({type:Boolean})],ge.prototype,"isMultiSelect",2);Ee([l.state()],ge.prototype,"_format",2);Ee([l.state()],ge.prototype,"_quality",2);Ee([l.state()],ge.prototype,"_width",2);Ee([l.state()],ge.prototype,"_height",2);Ee([l.state()],ge.prototype,"_lockAspect",2);Ee([l.state()],ge.prototype,"_activePreset",2);ge=Ee([l.customElement("ap-transformation-dialog")],ge);var Zr=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,Wt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Jr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zr(e,s,a),a};let rt=class extends r.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return r.html`
7128
+ `];Ae([l.property({type:Array})],fe.prototype,"assets",2);Ae([l.property({type:Boolean})],fe.prototype,"isMultiSelect",2);Ae([l.state()],fe.prototype,"_format",2);Ae([l.state()],fe.prototype,"_quality",2);Ae([l.state()],fe.prototype,"_width",2);Ae([l.state()],fe.prototype,"_height",2);Ae([l.state()],fe.prototype,"_lockAspect",2);Ae([l.state()],fe.prototype,"_activePreset",2);fe=Ae([l.customElement("ap-transformation-dialog")],fe);var sn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,Xt=(t,e,s,i)=>{for(var a=i>1?void 0:i?an(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sn(e,s,a),a};let nt=class extends r.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return r.html`
7104
7129
  <div class="box">
7105
7130
  <svg class="check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
7106
7131
  <path d="M20 6 9 17l-5-5"></path>
@@ -7110,7 +7135,7 @@
7110
7135
  </svg>
7111
7136
  </div>
7112
7137
  <span class="label" ?hidden=${!this._hasLabel}><slot @slotchange=${this._onSlotChange}></slot></span>
7113
- `}};rt.styles=[r.css`
7138
+ `}};nt.styles=[r.css`
7114
7139
  :host {
7115
7140
  display: inline-flex;
7116
7141
  align-items: center;
@@ -7169,12 +7194,12 @@
7169
7194
  .label[hidden] {
7170
7195
  display: none;
7171
7196
  }
7172
- `];Wt([l.property({type:Boolean,reflect:!0})],rt.prototype,"checked",2);Wt([l.property({type:Boolean,reflect:!0})],rt.prototype,"indeterminate",2);Wt([l.property({type:Boolean,reflect:!0})],rt.prototype,"disabled",2);rt=Wt([l.customElement("ap-checkbox")],rt);var en=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,xi=(t,e,s,i)=>{for(var a=i>1?void 0:i?tn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&en(e,s,a),a};let Ut=class extends r.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return r.html`
7197
+ `];Xt([l.property({type:Boolean,reflect:!0})],nt.prototype,"checked",2);Xt([l.property({type:Boolean,reflect:!0})],nt.prototype,"indeterminate",2);Xt([l.property({type:Boolean,reflect:!0})],nt.prototype,"disabled",2);nt=Xt([l.customElement("ap-checkbox")],nt);var on=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,ki=(t,e,s,i)=>{for(var a=i>1?void 0:i?rn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&on(e,s,a),a};let Bt=class extends r.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return r.html`
7173
7198
  <slot name="trigger" @click=${()=>this.open=!this.open}></slot>
7174
7199
  <div class="content ${this.open?"open":""}">
7175
7200
  <slot></slot>
7176
7201
  </div>
7177
- `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};Ut.styles=[r.css`
7202
+ `}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};Bt.styles=[r.css`
7178
7203
  :host {
7179
7204
  position: relative;
7180
7205
  display: inline-block;
@@ -7195,7 +7220,7 @@
7195
7220
  .content.open {
7196
7221
  display: block;
7197
7222
  }
7198
- `];xi([l.state()],Ut.prototype,"open",2);Ut=xi([l.customElement("ap-popover")],Ut);var sn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,wi=(t,e,s,i)=>{for(var a=i>1?void 0:i?an(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sn(e,s,a),a};let Bt=class extends r.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return r.html`<span class="badge"><slot></slot></span>`}};Bt.styles=[r.css`
7223
+ `];ki([l.state()],Bt.prototype,"open",2);Bt=ki([l.customElement("ap-popover")],Bt);var nn=Object.defineProperty,ln=Object.getOwnPropertyDescriptor,Si=(t,e,s,i)=>{for(var a=i>1?void 0:i?ln(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&nn(e,s,a),a};let qt=class extends r.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return r.html`<span class="badge"><slot></slot></span>`}};qt.styles=[r.css`
7199
7224
  :host {
7200
7225
  display: inline-flex;
7201
7226
  }
@@ -7214,10 +7239,10 @@
7214
7239
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
7215
7240
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
7216
7241
  }
7217
- `];wi([l.property({reflect:!0})],Bt.prototype,"variant",2);Bt=wi([l.customElement("ap-badge")],Bt);var on=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,$i=(t,e,s,i)=>{for(var a=i>1?void 0:i?rn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&on(e,s,a),a};let qt=class extends r.LitElement{constructor(){super(...arguments),this.text=""}render(){return r.html`
7242
+ `];Si([l.property({reflect:!0})],qt.prototype,"variant",2);qt=Si([l.customElement("ap-badge")],qt);var cn=Object.defineProperty,dn=Object.getOwnPropertyDescriptor,Ci=(t,e,s,i)=>{for(var a=i>1?void 0:i?dn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cn(e,s,a),a};let Vt=class extends r.LitElement{constructor(){super(...arguments),this.text=""}render(){return r.html`
7218
7243
  <slot></slot>
7219
7244
  <div class="tip">${this.text}</div>
7220
- `}};qt.styles=[r.css`
7245
+ `}};Vt.styles=[r.css`
7221
7246
  :host {
7222
7247
  position: relative;
7223
7248
  display: inline-flex;
@@ -7240,7 +7265,7 @@
7240
7265
  :host(:hover) .tip {
7241
7266
  display: block;
7242
7267
  }
7243
- `];$i([l.property()],qt.prototype,"text",2);qt=$i([l.customElement("ap-tooltip")],qt);var nn=Object.defineProperty,Et=(t,e,s,i)=>{for(var a=void 0,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(e,s,a)||a);return a&&nn(e,s,a),a};const Ts=class Ts extends r.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._selectAllId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._normalizedForcedFilters={},this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Oi(),this.storeCtrl=new Mi(this,this.store),this.selectionCtrl=new Pi(this,this.store),this.infiniteScrollCtrl=new Di(this,()=>this._loadMore()),this.marqueeCtrl=new zi(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._normalizedForcedFilters=ps(s.forcedFilters),this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Ya(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Za(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new Ri(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const x=await Gi(this.apiClient);this.apiClient.setSassKey(x),this.store.setState({sassKey:x})}const[o,n,c,d,h]=await Promise.allSettled([Ea(this.apiClient),Bi(this.apiClient),Hi(this.apiClient),Ca(this.apiClient),qi(this.apiClient)]),u={};if(o.status==="fulfilled"){const{fields:x,regionalVariantGroups:_,regionalFilters:w,brandColor:y}=o.value;u.metadataFields=x,u.regionalVariantGroups=_,u.regionalFilters=w,y&&(u.brandColor=y)}n.status==="fulfilled"&&(u.labels=n.value.labels||[]),c.status==="fulfilled"&&(u.tags=c.value),h.status==="fulfilled"&&(u.collections=h.value.collections||[]),d.status==="fulfilled"&&(u.fileTypes=d.value);const{pinnedFilters:g,pinnedMetadata:p}=Ga(e.auth.projectToken??null),f=this.store.getState().filters;u.filters={...f,pinned:g,visible:[...g],metadata:{...f.metadata,pinned:p,visible:[...p]}},this.store.setState(u);const m=e.brandColor||u.brandColor||this.store.getState().brandColor;m&&(u.brandColor||this.store.setState({brandColor:m}),ao(this,m))}catch(o){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:o,context:"init"},bubbles:!0,composed:!0})),o}}_ensureUploaderImport(){return customElements.get("sfx-uploader")?Promise.resolve():this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,header:s.header??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,closeOnComplete:s.closeOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay,lastUploadReview:s.lastUploadReview,showLocateButton:s.showLocateButton,showCopyCdnButton:s.showCopyCdnButton,getLocateUrl:s.getLocateUrl,minimizeOnUpload:s.minimizeOnUpload,metadataConfig:s.metadataConfig,tusConfig:s.tusConfig}}async _openUploader(e){var i;if(!((i=this.config)!=null&&i.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(a){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a instanceof Error?a:new Error(String(a)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null)}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var h,u,g,p,f,m,x;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=ps((h=this.config)==null?void 0:h.defaultFilters);for(const[_,w]of Object.entries(a))s.has(_)||(i[_]=w);const o=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],c=(g=this.config)!=null&&g.rememberLastTab?eo(this.config.auth.projectToken):null,d=(c&&n.includes(c)?c:null)??((p=this.config)!=null&&p.defaultTab&&n.includes(this.config.defaultTab)?this.config.defaultTab:null)??n[0]??"assets";this.store.setState({isOpen:!0,activeTab:d,searchQuery:"",isAISearchActive:!!((f=this.config)!=null&&f.enableAISearch&&((m=this.config)!=null&&m.defaultAISearch)),filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...o])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((x=this.config)==null?void 0:x.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,o,n,c,d,h,u,g,p,f,m,x,_,w,y,T,k,S,F,E,fe,ie,M,X,Z,D,Pe,Ls,Os,Ms,Is,Ps,Ds,zs,Rs,js,Ns,Us;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const Xe=s.activeTab;if(Xe==="assets"){const ae=this._buildSearchNotation(),Ae=s.currentFolderPath||"/",he=s.isAISearchActive&&!!s.searchQuery,oe=De(this.apiClient,{folder:Ae,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ae||void 0,recursive:1,...he&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),H=At(this.apiClient,{folder:Ae,q:ae||void 0,search:s.searchQuery||void 0,recursive:1,...he&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[B,J]=await Promise.all([oe,H]);if(e!==this._loadId)return;const ee=((o=B.files)==null?void 0:o.length)??0,j=ee>=s.limit,te=((n=J==null?void 0:J.stats)==null?void 0:n.approx_files_count)??((c=J==null?void 0:J.info)==null?void 0:c.total_files_count)??((d=B.info)==null?void 0:d.total_files_count)??((u=(h=B.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(g=B.base)==null?void 0:g.count)==null?void 0:p.files_direct)??ee;this.store.setState({assets:B.files||[],folders:[],totalCount:te,totalFolderCount:0,offset:0,hasMore:j,isLoading:!1})}else if(Xe==="folders"){const ae=this._buildSearchNotation(),Ae=s.currentFolderPath||"/",[he,oe,H]=await Promise.all([Ni(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),De(this.apiClient,{folder:Ae,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ae||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((f=s.config)==null?void 0:f.locale)??"en"}}),At(this.apiClient,{folder:Ae,q:ae||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((m=s.config)==null?void 0:m.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const B=he.folders||[];let J={};if(B.length>0)try{J=await Ui(this.apiClient,B.map(Ze=>Ze.uuid))}catch{}if(e!==this._loadId)return;const ee=((x=oe.files)==null?void 0:x.length)??0,j=ee>=s.limit,te=((_=H==null?void 0:H.stats)==null?void 0:_.approx_files_count)??((w=H==null?void 0:H.info)==null?void 0:w.total_files_count)??((y=oe.info)==null?void 0:y.total_files_count)??((k=(T=oe.base)==null?void 0:T.count)==null?void 0:k.files_direct)??ee;this.store.setState({assets:oe.files||[],folders:B,folderPreviews:J,totalCount:te,totalFolderCount:he.total??B.length,offset:0,hasMore:j,isLoading:!1})}else if(Xe==="labels"){if(!s.activeLabelUuid){this.store.setState({assets:[],folders:[],totalCount:s.labels.length,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ae=s.labels.find(Zt=>Zt.uuid===s.activeLabelUuid);if(!ae){this.store.setState({isLoading:!1});return}const Ae=ae.sid.replace("#",""),he=this._buildSearchNotation(),oe=`labels:${Ae}${he?" "+he:""}`,H=s.isAISearchActive&&!!s.searchQuery,B=De(this.apiClient,{folder:"/",offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe,recursive:1,...H&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((S=s.config)==null?void 0:S.locale)??"en"}}),J=At(this.apiClient,{folder:"/",q:oe,search:s.searchQuery||void 0,recursive:1,...H&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((F=s.config)==null?void 0:F.locale)??"en"}}).catch(()=>null),[ee,j]=await Promise.all([B,J]);if(e!==this._loadId)return;const te=((E=ee.files)==null?void 0:E.length)??0,Ze=te>=s.limit,Xt=((fe=j==null?void 0:j.stats)==null?void 0:fe.approx_files_count)??((ie=j==null?void 0:j.info)==null?void 0:ie.total_files_count)??((M=ee.info)==null?void 0:M.total_files_count)??((Z=(X=ee.base)==null?void 0:X.count)==null?void 0:Z.files_recursive)??((Pe=(D=ee.base)==null?void 0:D.count)==null?void 0:Pe.files_direct)??te;this.store.setState({assets:ee.files||[],folders:[],totalCount:Xt,totalFolderCount:0,offset:0,hasMore:Ze,isLoading:!1})}else if(Xe==="collections"){if(!s.activeCollectionUuid){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ae=s.activeCollectionFolder;if(!(ae&&!((Ls=ae.children)!=null&&Ls.length))){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const he=s.activeCollectionUuid,oe=ae.filters||void 0,H=this._buildSearchNotation(),B=s.isAISearchActive&&!!s.searchQuery,J=De(this.apiClient,{offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:H||void 0,recursive:1,collection_uuid:he,f64:oe,...B&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Os=s.config)==null?void 0:Os.locale)??"en"}}),ee=At(this.apiClient,{q:H||void 0,search:s.searchQuery||void 0,recursive:1,collection_uuid:he,f64:oe,...B&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ms=s.config)==null?void 0:Ms.locale)??"en"}}).catch(()=>null),[j,te]=await Promise.all([J,ee]);if(e!==this._loadId)return;const Ze=((Is=j.files)==null?void 0:Is.length)??0,Xt=Ze>=s.limit,Zt=((Ps=te==null?void 0:te.stats)==null?void 0:Ps.approx_files_count)??((Ds=te==null?void 0:te.info)==null?void 0:Ds.total_files_count)??((zs=j.info)==null?void 0:zs.total_files_count)??((js=(Rs=j.base)==null?void 0:Rs.count)==null?void 0:js.files_recursive)??((Us=(Ns=j.base)==null?void 0:Ns.count)==null?void 0:Us.files_direct)??Ze;this.store.setState({assets:j.files||[],folders:[],totalCount:Zt,totalFolderCount:0,offset:0,hasMore:Xt,isLoading:!1})}}catch(Xe){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:Xe,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a,o;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient||e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((a=e.activeCollectionFolder.children)!=null&&a.length)))return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const n=this._buildSearchNotation();let c=n||void 0,d=e.currentFolderPath||"/",h=e.activeTab==="folders"?0:1;if(e.activeTab==="labels"&&e.activeLabelUuid){const w=e.labels.find(y=>y.uuid===e.activeLabelUuid);w&&(c=`labels:${w.sid.replace("#","")}${n?" "+n:""}`),d="/",h=1}let u,g;e.activeTab==="collections"&&e.activeCollectionFolder&&(u=e.activeCollectionUuid||void 0,g=e.activeCollectionFolder.filters||void 0,d="",h=1);const p=await De(this.apiClient,{...d?{folder:d}:{},offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:c,recursive:h,...u&&{collection_uuid:u},...g&&{f64:g},...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((o=e.config)==null?void 0:o.locale)??"en"}});if(s!==this._loadMoreId)return;const f=this.store.getState().assets,m=p.files||[],x=m.length>=e.limit,_=[...f,...m];this.store.setState({assets:_,offset:i,hasMore:x,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){var a;const s=this.store.getState();if(s.activeTab==="labels"&&!s.activeLabelUuid){this.store.setState({searchQuery:e.detail.value});return}if(s.activeTab==="collections"&&!(s.activeCollectionFolder&&!((a=s.activeCollectionFolder.children)!=null&&a.length))){this.store.setState({searchQuery:e.detail.value});return}const i={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};s.isAISearchActive&&e.detail.value&&(i.sortBy="relevance"),this.store.setState(i),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleAISearchToggle(e){var o;const s=e.detail.active,i=this.store.getState(),a={isAISearchActive:s};i.searchQuery&&(s?a.sortBy="relevance":i.sortBy==="relevance"&&(a.sortBy=((o=this.config)==null?void 0:o.defaultSortBy)??"created_at"),a.offset=0,a.assets=[],a.folders=[],a.isLoading=!0),this.store.setState(a),i.searchQuery&&this._debouncedLoadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Xa(s,this.config.auth.projectToken),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Xs(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),Xs(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Ja(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i;const s=e.detail.asset;if((i=this.config)!=null&&i.transformations&&je(s)){this._transformAssets=[s],this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect([s])}_emitSelect(e,s){var a,o;const i={assets:e};s!=null&&s.length&&(i.folders=s),(o=(a=this.config)==null?void 0:a.onSelect)==null||o.call(a,e,s!=null&&s.length?s:void 0),this.dispatchEvent(new CustomEvent("ap-select",{detail:i,bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var o;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(o=this.config)!=null&&o.rememberLastFolder&&Zs(a,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var c,d;const s=e.detail.uuid,i=this.store.getState();if(i.activeTab==="labels"){this._selectAllId++,this.store.setState({activeLabelUuid:null,breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData();return}if(i.activeTab==="collections"){if(this._selectAllId++,!s){this.store.setState({activeCollectionUuid:null,activeCollectionFolder:null,activeCollectionFolders:[],breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}if(s===i.activeCollectionUuid){this.store.setState({activeCollectionFolder:null,breadcrumb:[i.breadcrumb[0]],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}const h=this._findCollectionFolder(i.activeCollectionFolders,s);if(h){const u=i.breadcrumb.findIndex(p=>p.uuid===s),g=i.breadcrumb.slice(0,u+1);this.store.setState({activeCollectionFolder:h,breadcrumb:g,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}return}const a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,o=s?i.breadcrumb.slice(0,a+1):[],n=o.length>0?o[o.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Zs(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:o,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleLabelOpen(e){const s=e.detail.label;this._selectAllId++,this.store.setState({activeLabelUuid:s.uuid,breadcrumb:[{uuid:s.uuid,name:s.name,path:""}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}async _handleCollectionOpen(e){const s=e.detail.collection;if(this.apiClient){this._selectAllId++,this.store.setState({activeCollectionUuid:s.uuid,activeCollectionFolder:null,activeCollectionFolders:[],isLoadingCollectionFolders:!0,breadcrumb:[{uuid:s.uuid,name:s.title,path:""}],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange();try{const i=await Vi(this.apiClient,s.uuid),a=ei(i.folders||[]);this.store.setState({activeCollectionFolders:a,isLoadingCollectionFolders:!1,isLoading:!1})}catch(i){this.store.setState({isLoadingCollectionFolders:!1,isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"loadCollectionFolders"},bubbles:!0,composed:!0}))}}}_handleCollectionFolderOpen(e){var c;const s=e.detail.folder,i=this.store.getState(),a=s.path.split(" -> ").filter(Boolean),o=[{uuid:i.activeCollectionUuid,name:((c=i.breadcrumb[0])==null?void 0:c.name)||"Collection",path:""}];let n="";for(const d of a)n=n?`${n} -> ${d}`:d,o.push({uuid:n,name:d,path:n});this._selectAllId++,this.store.setState({activeCollectionFolder:s,breadcrumb:o,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_findCollectionFolder(e,s){for(const i of e){if(i.path===s)return i;if(i.children){const a=this._findCollectionFolder(i.children,s);if(a)return a}}return null}_getVisibleCollectionFolders(){const e=this.store.getState();return e.activeCollectionUuid?e.activeCollectionFolder?e.activeCollectionFolder.children??[]:e.activeCollectionFolders:[]}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Wa(this.config.auth.projectToken)||((i=this.config)==null?void 0:i.rootFolderPath)||"/"}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),o=[];let n=s.endsWith("/")?s:s+"/";for(const c of a)n+=c+"/",o.push({uuid:n,name:c,path:n});return o}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,o;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1&&((o=this.config)==null?void 0:o.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}this._emitSelect(s,i.length?i:void 0)}_handleSelectionTransform(e){var o,n;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((o=this.config)==null?void 0:o.folderSelection)!==!1&&((n=this.config)==null?void 0:n.folderSelectionMode)==="assets"){this._transformAfterResolve=!0,this._folderResolveOpen=!0;return}if(s.filter(je).length===0){this._emitSelect(s,i.length?i:void 0);return}this._transformAssets=s,this._transformFolders=i,this._transformOpen=!0}async _handleFolderResolveConfirm(e){var o;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const n=await Promise.all(i.map(p=>De(this.apiClient,{folder:p.path,recursive:s==="recursive"?1:0,limit:1e4}))),c=[];for(const p of n)c.push(...p.files);const d=[...a],h=new Set(d.map(p=>p.uuid));for(const p of c)h.has(p.uuid)||(d.push(p),h.add(p.uuid));const u=(o=this.config)==null?void 0:o.maxSelections,g=u?d.slice(0,u):d;if(this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._transformAfterResolve){this._transformAfterResolve=!1,this._transformAssets=g,this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect(g)}catch(n){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1,this._transformAfterResolve=!1}_handleTransformConfirm(e){const s=e.detail.params,i=e.detail.isAspectLocked??!0,a=this._transformAssets,o=this._transformFolders,n=a.length>1,c=fs(s,{isMultiSelect:n,isAspectLocked:i}),d=a.map(h=>{var f,m;if(!je(h))return h;const u=(f=h.url)==null?void 0:f.cdn,g=(m=h.url)==null?void 0:m.permalink,p={cdn:u?xe(u,c):""};return g&&(p.permalink_cdn=xe(g,c)),{...h,transformation:{params:s,url:p}}});this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(d,o.length?o:void 0)}_handleTransformSkip(){const e=this._transformAssets,s=this._transformFolders;this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(e,s.length?s:void 0)}_handleTransformCancel(){this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[]}async _handleSelectAll(e){var d,h,u;const s=this.store.getState();if(s.isSelectingAll||!this.apiClient||!(((d=s.config)==null?void 0:d.multiSelect)??!0))return;const a=((h=e==null?void 0:e.detail)==null?void 0:h.scope)??"all",o=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){o&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const c=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const g=this._buildSearchNotation();let p=s.currentFolderPath||"/";const f=s.limit,m=s.assets,x=s.totalCount;let _=s.activeTab==="folders"?0:1,w=g||void 0;if(s.activeTab==="labels"&&s.activeLabelUuid){const M=s.labels.find(X=>X.uuid===s.activeLabelUuid);M&&(w=`labels:${M.sid.replace("#","")}${g?" "+g:""}`),p="/",_=1}let y,T;s.activeTab==="collections"&&s.activeCollectionFolder&&(y=s.activeCollectionUuid||void 0,T=s.activeCollectionFolder.filters||void 0,p="",_=1);const k=[];for(let M=m.length;M<x;M+=f)k.push(M);const S=4,F=[];for(let M=0;M<k.length;M+=S){if(c!==this._selectAllId)return;const X=k.slice(M,M+S),Z=await Promise.all(X.map(D=>{var Pe;return De(this.apiClient,{...p?{folder:p}:{},offset:D,limit:f,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:w,recursive:_,...y&&{collection_uuid:y},...T&&{f64:T},...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Pe=s.config)==null?void 0:Pe.locale)??"en"}})}));if(c!==this._selectAllId)return;for(const D of Z)D.files&&F.push(...D.files)}if(c!==this._selectAllId)return;const E=new Set(m.map(M=>M.uuid)),fe=F.filter(M=>E.has(M.uuid)?!1:(E.add(M.uuid),!0)),ie=[...m,...fe];this.store.setState({assets:ie,offset:Math.max(0,ie.length-f),hasMore:!1,isSelectingAll:!1}),o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(ie)}catch(g){if(c!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:g,context:"selectAll"},bubbles:!0,composed:!0}))}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===b.DATE||e===b.LICENSE_EXPIRY||e===G.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:g}=i;c=!d&&!h&&!u&&!g}if(c){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===b.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,o,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,o,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,f,m;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),o=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!o)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const x=a.renderRoot.querySelectorAll(".chip.pinned-empty"),_=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const w of x){const y=(m=(f=w.querySelector(".chip-label"))==null?void 0:f.textContent)==null?void 0:m.trim();if(i&&y===_){n=w;break}if(s&&y===(et[s]||s)){n=w;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,g=h?c.bottom-h.top:void 0;i?o.openMetadataFieldPanel(i,!0,u,g):s&&o.openFilterPanel(s,!0,u,g)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},o={...a.applied};delete o[s],a.applied=o,a.pinned.includes(s)||(a.visible=a.visible.filter(c=>c!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:o}=e.detail,c={...this.store.getState().filters},d={...c.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(g=>g!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:o},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),c.metadata=d,this.store.setState({filters:c,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const g=this.renderRoot.querySelector("ap-filters-bar");g&&(g.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),o.metadata=n,this.store.setState({filters:o})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata},n={...o.applied};delete n[s],o.applied=n,o.pinned.includes(s)||(o.visible=o.visible.filter(c=>c!==s)),a.metadata=o,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:i}=e.detail,o={...this.store.getState().filters};i?o.pinned.includes(s)||(o.pinned=[...o.pinned,s]):(o.pinned=o.pinned.filter(h=>h!==s),s in o.applied||(o.visible=o.visible.filter(h=>h!==s))),this.store.setState({filters:o});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;Ka(n,o.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),o.metadata=n,this.store.setState({filters:o});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Qa(c,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(o=>o!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata};o.visible=o.visible.filter(n=>n!==s),a.metadata=o,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,o={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];o.applied=c;const d=Object.keys(s);if(o.visible=[...new Set([...o.pinned,...d])],i){const u={...o.metadata};u.applied=i.applied;const g=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...g])],o.metadata=u}this.store.setState({filters:o,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){var s;const e=this.storeCtrl.state;if(e.activeTab==="labels"&&!e.activeLabelUuid)return no;if(e.activeTab==="collections"){if(!e.activeCollectionUuid)return lo;if(!(e.activeCollectionFolder&&!((s=e.activeCollectionFolder.children)!=null&&s.length)))return co}return e.searchQuery?oo:e.activeTab==="folders"?ro:ms}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return La(s,e.filters.metadata.applied).join(" ")}render(){var p,f,m,x,_,w,y,T,k,S,F,E,fe,ie,M,X,Z,D;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),o=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,c=r.html`
7268
+ `];Ci([l.property()],Vt.prototype,"text",2);Vt=Ci([l.customElement("ap-tooltip")],Vt);var pn=Object.defineProperty,At=(t,e,s,i)=>{for(var a=void 0,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(e,s,a)||a);return a&&pn(e,s,a),a};const Ms=class Ms extends r.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._selectAllId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._normalizedForcedFilters={},this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Ii(),this.storeCtrl=new Di(this,this.store),this.selectionCtrl=new Ri(this,this.store),this.infiniteScrollCtrl=new ji(this,()=>this._loadMore()),this.marqueeCtrl=new Ni(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._normalizedForcedFilters=gs(s.forcedFilters),this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Za(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&to(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new Ui(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const x=await Yi(this.apiClient);this.apiClient.setSassKey(x),this.store.setState({sassKey:x})}const[o,n,c,d,h]=await Promise.allSettled([La(this.apiClient),Hi(this.apiClient),Qi(this.apiClient),Aa(this.apiClient),Gi(this.apiClient)]),u={};if(o.status==="fulfilled"){const{fields:x,regionalVariantGroups:_,regionalFilters:w,brandColor:y}=o.value;u.metadataFields=x,u.regionalVariantGroups=_,u.regionalFilters=w,y&&(u.brandColor=y)}n.status==="fulfilled"&&(u.labels=n.value.labels||[]),c.status==="fulfilled"&&(u.tags=c.value),h.status==="fulfilled"&&(u.collections=h.value.collections||[]),d.status==="fulfilled"&&(u.fileTypes=d.value);const{pinnedFilters:g,pinnedMetadata:p}=Ya(e.auth.projectToken??null),f=this.store.getState().filters;u.filters={...f,pinned:g,visible:[...g],metadata:{...f.metadata,pinned:p,visible:[...p]}},this.store.setState(u);const m=e.brandColor||u.brandColor||this.store.getState().brandColor;m&&(u.brandColor||this.store.setState({brandColor:m}),no(this,m))}catch(o){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:o,context:"init"},bubbles:!0,composed:!0})),o}}_ensureUploaderImport(){return customElements.get("sfx-uploader")?Promise.resolve():this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,header:s.header??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,closeOnComplete:s.closeOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay,lastUploadReview:s.lastUploadReview,showLocateButton:s.showLocateButton,showCopyCdnButton:s.showCopyCdnButton,getLocateUrl:s.getLocateUrl,minimizeOnUpload:s.minimizeOnUpload,metadataConfig:s.metadataConfig,tusConfig:s.tusConfig}}async _openUploader(e){var i;if(!((i=this.config)!=null&&i.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(a){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a instanceof Error?a:new Error(String(a)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null)}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var h,u,g,p,f,m,x;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=gs((h=this.config)==null?void 0:h.defaultFilters);for(const[_,w]of Object.entries(a))s.has(_)||(i[_]=w);const o=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],c=(g=this.config)!=null&&g.rememberLastTab?io(this.config.auth.projectToken):null,d=(c&&n.includes(c)?c:null)??((p=this.config)!=null&&p.defaultTab&&n.includes(this.config.defaultTab)?this.config.defaultTab:null)??n[0]??"assets";this.store.setState({isOpen:!0,activeTab:d,searchQuery:"",isAISearchActive:!!((f=this.config)!=null&&f.enableAISearch&&((m=this.config)!=null&&m.defaultAISearch)),filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...o])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((x=this.config)==null?void 0:x.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,o,n,c,d,h,u,g,p,f,m,x,_,w,y,L,k,S,E,A,ve,ae,P,Z,J,z,De,Ps,Is,Ds,zs,Rs,js,Ns,Us,Bs,qs,Vs;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const Ze=s.activeTab;if(Ze==="assets"){const oe=this._buildSearchNotation(),Te=s.currentFolderPath||"/",ue=s.isAISearchActive&&!!s.searchQuery,re=ze(this.apiClient,{folder:Te,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe||void 0,recursive:1,...ue&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),G=Tt(this.apiClient,{folder:Te,q:oe||void 0,search:s.searchQuery||void 0,recursive:1,...ue&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[q,ee]=await Promise.all([re,G]);if(e!==this._loadId)return;const te=((o=q.files)==null?void 0:o.length)??0,N=te>=s.limit,se=((n=ee==null?void 0:ee.stats)==null?void 0:n.approx_files_count)??((c=ee==null?void 0:ee.info)==null?void 0:c.total_files_count)??((d=q.info)==null?void 0:d.total_files_count)??((u=(h=q.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(g=q.base)==null?void 0:g.count)==null?void 0:p.files_direct)??te;this.store.setState({assets:q.files||[],folders:[],totalCount:se,totalFolderCount:0,offset:0,hasMore:N,isLoading:!1})}else if(Ze==="folders"){const oe=this._buildSearchNotation(),Te=s.currentFolderPath||"/",[ue,re,G]=await Promise.all([qi(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),ze(this.apiClient,{folder:Te,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((f=s.config)==null?void 0:f.locale)??"en"}}),Tt(this.apiClient,{folder:Te,q:oe||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((m=s.config)==null?void 0:m.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const q=ue.folders||[];let ee={};if(q.length>0)try{ee=await Vi(this.apiClient,q.map(Je=>Je.uuid))}catch{}if(e!==this._loadId)return;const te=((x=re.files)==null?void 0:x.length)??0,N=te>=s.limit,se=((_=G==null?void 0:G.stats)==null?void 0:_.approx_files_count)??((w=G==null?void 0:G.info)==null?void 0:w.total_files_count)??((y=re.info)==null?void 0:y.total_files_count)??((k=(L=re.base)==null?void 0:L.count)==null?void 0:k.files_direct)??te;this.store.setState({assets:re.files||[],folders:q,folderPreviews:ee,totalCount:se,totalFolderCount:ue.total??q.length,offset:0,hasMore:N,isLoading:!1})}else if(Ze==="labels"){if(!s.activeLabelUuid){this.store.setState({assets:[],folders:[],totalCount:s.labels.length,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const oe=s.labels.find(Jt=>Jt.uuid===s.activeLabelUuid);if(!oe){this.store.setState({isLoading:!1});return}const Te=oe.sid.replace("#",""),ue=this._buildSearchNotation(),re=`labels:${Te}${ue?" "+ue:""}`,G=s.isAISearchActive&&!!s.searchQuery,q=ze(this.apiClient,{folder:"/",offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:re,recursive:1,...G&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((S=s.config)==null?void 0:S.locale)??"en"}}),ee=Tt(this.apiClient,{folder:"/",q:re,search:s.searchQuery||void 0,recursive:1,...G&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((E=s.config)==null?void 0:E.locale)??"en"}}).catch(()=>null),[te,N]=await Promise.all([q,ee]);if(e!==this._loadId)return;const se=((A=te.files)==null?void 0:A.length)??0,Je=se>=s.limit,Zt=((ve=N==null?void 0:N.stats)==null?void 0:ve.approx_files_count)??((ae=N==null?void 0:N.info)==null?void 0:ae.total_files_count)??((P=te.info)==null?void 0:P.total_files_count)??((J=(Z=te.base)==null?void 0:Z.count)==null?void 0:J.files_recursive)??((De=(z=te.base)==null?void 0:z.count)==null?void 0:De.files_direct)??se;this.store.setState({assets:te.files||[],folders:[],totalCount:Zt,totalFolderCount:0,offset:0,hasMore:Je,isLoading:!1})}else if(Ze==="collections"){if(!s.activeCollectionUuid){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const oe=s.activeCollectionFolder;if(!(oe&&!((Ps=oe.children)!=null&&Ps.length))){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ue=s.activeCollectionUuid,re=oe.filters||void 0,G=this._buildSearchNotation(),q=s.isAISearchActive&&!!s.searchQuery,ee=ze(this.apiClient,{offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:G||void 0,recursive:1,collection_uuid:ue,f64:re,...q&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Is=s.config)==null?void 0:Is.locale)??"en"}}),te=Tt(this.apiClient,{q:G||void 0,search:s.searchQuery||void 0,recursive:1,collection_uuid:ue,f64:re,...q&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ds=s.config)==null?void 0:Ds.locale)??"en"}}).catch(()=>null),[N,se]=await Promise.all([ee,te]);if(e!==this._loadId)return;const Je=((zs=N.files)==null?void 0:zs.length)??0,Zt=Je>=s.limit,Jt=((Rs=se==null?void 0:se.stats)==null?void 0:Rs.approx_files_count)??((js=se==null?void 0:se.info)==null?void 0:js.total_files_count)??((Ns=N.info)==null?void 0:Ns.total_files_count)??((Bs=(Us=N.base)==null?void 0:Us.count)==null?void 0:Bs.files_recursive)??((Vs=(qs=N.base)==null?void 0:qs.count)==null?void 0:Vs.files_direct)??Je;this.store.setState({assets:N.files||[],folders:[],totalCount:Jt,totalFolderCount:0,offset:0,hasMore:Zt,isLoading:!1})}}catch(Ze){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:Ze,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a,o;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient||e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((a=e.activeCollectionFolder.children)!=null&&a.length)))return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const n=this._buildSearchNotation();let c=n||void 0,d=e.currentFolderPath||"/",h=e.activeTab==="folders"?0:1;if(e.activeTab==="labels"&&e.activeLabelUuid){const w=e.labels.find(y=>y.uuid===e.activeLabelUuid);w&&(c=`labels:${w.sid.replace("#","")}${n?" "+n:""}`),d="/",h=1}let u,g;e.activeTab==="collections"&&e.activeCollectionFolder&&(u=e.activeCollectionUuid||void 0,g=e.activeCollectionFolder.filters||void 0,d="",h=1);const p=await ze(this.apiClient,{...d?{folder:d}:{},offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:c,recursive:h,...u&&{collection_uuid:u},...g&&{f64:g},...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((o=e.config)==null?void 0:o.locale)??"en"}});if(s!==this._loadMoreId)return;const f=this.store.getState().assets,m=p.files||[],x=m.length>=e.limit,_=[...f,...m];this.store.setState({assets:_,offset:i,hasMore:x,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){var a;const s=this.store.getState();if(s.activeTab==="labels"&&!s.activeLabelUuid){this.store.setState({searchQuery:e.detail.value});return}if(s.activeTab==="collections"&&!(s.activeCollectionFolder&&!((a=s.activeCollectionFolder.children)!=null&&a.length))){this.store.setState({searchQuery:e.detail.value});return}const i={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};s.isAISearchActive&&e.detail.value&&(i.sortBy="relevance"),this.store.setState(i),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleAISearchToggle(e){var o;const s=e.detail.active,i=this.store.getState(),a={isAISearchActive:s};i.searchQuery&&(s?a.sortBy="relevance":i.sortBy==="relevance"&&(a.sortBy=((o=this.config)==null?void 0:o.defaultSortBy)??"created_at"),a.offset=0,a.assets=[],a.folders=[],a.isLoading=!0),this.store.setState(a),i.searchQuery&&this._debouncedLoadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&eo(s,this.config.auth.projectToken),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),ei(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),ei(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&so(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i;const s=e.detail.asset;if((i=this.config)!=null&&i.transformations&&Ne(s)){this._transformAssets=[s],this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect([s])}_emitSelect(e,s){var a,o;const i={assets:e};s!=null&&s.length&&(i.folders=s),(o=(a=this.config)==null?void 0:a.onSelect)==null||o.call(a,e,s!=null&&s.length?s:void 0),this.dispatchEvent(new CustomEvent("ap-select",{detail:i,bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var o;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(o=this.config)!=null&&o.rememberLastFolder&&ti(a,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var c,d;const s=e.detail.uuid,i=this.store.getState();if(i.activeTab==="labels"){this._selectAllId++,this.store.setState({activeLabelUuid:null,breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData();return}if(i.activeTab==="collections"){if(this._selectAllId++,!s){this.store.setState({activeCollectionUuid:null,activeCollectionFolder:null,activeCollectionFolders:[],breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}if(s===i.activeCollectionUuid){this.store.setState({activeCollectionFolder:null,breadcrumb:[i.breadcrumb[0]],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}const h=this._findCollectionFolder(i.activeCollectionFolders,s);if(h){const u=i.breadcrumb.findIndex(p=>p.uuid===s),g=i.breadcrumb.slice(0,u+1);this.store.setState({activeCollectionFolder:h,breadcrumb:g,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}return}const a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,o=s?i.breadcrumb.slice(0,a+1):[],n=o.length>0?o[o.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&ti(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:o,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleLabelOpen(e){const s=e.detail.label;this._selectAllId++,this.store.setState({activeLabelUuid:s.uuid,breadcrumb:[{uuid:s.uuid,name:s.name,path:""}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}async _handleCollectionOpen(e){const s=e.detail.collection;if(this.apiClient){this._selectAllId++,this.store.setState({activeCollectionUuid:s.uuid,activeCollectionFolder:null,activeCollectionFolders:[],isLoadingCollectionFolders:!0,breadcrumb:[{uuid:s.uuid,name:s.title,path:""}],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange();try{const i=await Ki(this.apiClient,s.uuid),a=ii(i.folders||[]);this.store.setState({activeCollectionFolders:a,isLoadingCollectionFolders:!1,isLoading:!1})}catch(i){this.store.setState({isLoadingCollectionFolders:!1,isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"loadCollectionFolders"},bubbles:!0,composed:!0}))}}}_handleCollectionFolderOpen(e){var c;const s=e.detail.folder,i=this.store.getState(),a=s.path.split(" -> ").filter(Boolean),o=[{uuid:i.activeCollectionUuid,name:((c=i.breadcrumb[0])==null?void 0:c.name)||"Collection",path:""}];let n="";for(const d of a)n=n?`${n} -> ${d}`:d,o.push({uuid:n,name:d,path:n});this._selectAllId++,this.store.setState({activeCollectionFolder:s,breadcrumb:o,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_findCollectionFolder(e,s){for(const i of e){if(i.path===s)return i;if(i.children){const a=this._findCollectionFolder(i.children,s);if(a)return a}}return null}_getVisibleCollectionFolders(){const e=this.store.getState();return e.activeCollectionUuid?e.activeCollectionFolder?e.activeCollectionFolder.children??[]:e.activeCollectionFolders:[]}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Ja(this.config.auth.projectToken)||((i=this.config)==null?void 0:i.rootFolderPath)||"/"}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),o=[];let n=s.endsWith("/")?s:s+"/";for(const c of a)n+=c+"/",o.push({uuid:n,name:c,path:n});return o}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,o;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1&&((o=this.config)==null?void 0:o.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}this._emitSelect(s,i.length?i:void 0)}_handleSelectionTransform(e){var o,n;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((o=this.config)==null?void 0:o.folderSelection)!==!1&&((n=this.config)==null?void 0:n.folderSelectionMode)==="assets"){this._transformAfterResolve=!0,this._folderResolveOpen=!0;return}if(s.filter(Ne).length===0){this._emitSelect(s,i.length?i:void 0);return}this._transformAssets=s,this._transformFolders=i,this._transformOpen=!0}async _handleFolderResolveConfirm(e){var o;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const n=await Promise.all(i.map(p=>ze(this.apiClient,{folder:p.path,recursive:s==="recursive"?1:0,limit:1e4}))),c=[];for(const p of n)c.push(...p.files);const d=[...a],h=new Set(d.map(p=>p.uuid));for(const p of c)h.has(p.uuid)||(d.push(p),h.add(p.uuid));const u=(o=this.config)==null?void 0:o.maxSelections,g=u?d.slice(0,u):d;if(this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._transformAfterResolve){this._transformAfterResolve=!1,this._transformAssets=g,this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect(g)}catch(n){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1,this._transformAfterResolve=!1}_handleTransformConfirm(e){const s=e.detail.params,i=e.detail.isAspectLocked??!0,a=this._transformAssets,o=this._transformFolders,n=a.length>1,c=bs(s,{isMultiSelect:n,isAspectLocked:i}),d=a.map(h=>{var f,m;if(!Ne(h))return h;const u=(f=h.url)==null?void 0:f.cdn,g=(m=h.url)==null?void 0:m.permalink,p={cdn:u?we(u,c):""};return g&&(p.permalink_cdn=we(g,c)),{...h,transformation:{params:s,url:p}}});this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(d,o.length?o:void 0)}_handleTransformSkip(){const e=this._transformAssets,s=this._transformFolders;this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(e,s.length?s:void 0)}_handleTransformCancel(){this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[]}async _handleSelectAll(e){var d,h,u;const s=this.store.getState();if(s.isSelectingAll||!this.apiClient||!(((d=s.config)==null?void 0:d.multiSelect)??!0))return;const a=((h=e==null?void 0:e.detail)==null?void 0:h.scope)??"all",o=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){o&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const c=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const g=this._buildSearchNotation();let p=s.currentFolderPath||"/";const f=s.limit,m=s.assets,x=s.totalCount;let _=s.activeTab==="folders"?0:1,w=g||void 0;if(s.activeTab==="labels"&&s.activeLabelUuid){const P=s.labels.find(Z=>Z.uuid===s.activeLabelUuid);P&&(w=`labels:${P.sid.replace("#","")}${g?" "+g:""}`),p="/",_=1}let y,L;s.activeTab==="collections"&&s.activeCollectionFolder&&(y=s.activeCollectionUuid||void 0,L=s.activeCollectionFolder.filters||void 0,p="",_=1);const k=[];for(let P=m.length;P<x;P+=f)k.push(P);const S=4,E=[];for(let P=0;P<k.length;P+=S){if(c!==this._selectAllId)return;const Z=k.slice(P,P+S),J=await Promise.all(Z.map(z=>{var De;return ze(this.apiClient,{...p?{folder:p}:{},offset:z,limit:f,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:w,recursive:_,...y&&{collection_uuid:y},...L&&{f64:L},...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((De=s.config)==null?void 0:De.locale)??"en"}})}));if(c!==this._selectAllId)return;for(const z of J)z.files&&E.push(...z.files)}if(c!==this._selectAllId)return;const A=new Set(m.map(P=>P.uuid)),ve=E.filter(P=>A.has(P.uuid)?!1:(A.add(P.uuid),!0)),ae=[...m,...ve];this.store.setState({assets:ae,offset:Math.max(0,ae.length-f),hasMore:!1,isSelectingAll:!1}),o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(ae)}catch(g){if(c!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:g,context:"selectAll"},bubbles:!0,composed:!0}))}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===b.DATE||e===b.LICENSE_EXPIRY||e===K.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:g}=i;c=!d&&!h&&!u&&!g}if(c){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===b.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,o,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,o,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,f,m;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),o=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!o)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const x=a.renderRoot.querySelectorAll(".chip.pinned-empty"),_=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const w of x){const y=(m=(f=w.querySelector(".chip-label"))==null?void 0:f.textContent)==null?void 0:m.trim();if(i&&y===_){n=w;break}if(s&&y===(tt[s]||s)){n=w;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,g=h?c.bottom-h.top:void 0;i?o.openMetadataFieldPanel(i,!0,u,g):s&&o.openFilterPanel(s,!0,u,g)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},o={...a.applied};delete o[s],a.applied=o,a.pinned.includes(s)||(a.visible=a.visible.filter(c=>c!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:o}=e.detail,c={...this.store.getState().filters},d={...c.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(g=>g!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:o},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),c.metadata=d,this.store.setState({filters:c,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const g=this.renderRoot.querySelector("ap-filters-bar");g&&(g.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),o.metadata=n,this.store.setState({filters:o})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata},n={...o.applied};delete n[s],o.applied=n,o.pinned.includes(s)||(o.visible=o.visible.filter(c=>c!==s)),a.metadata=o,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:i}=e.detail,o={...this.store.getState().filters};i?o.pinned.includes(s)||(o.pinned=[...o.pinned,s]):(o.pinned=o.pinned.filter(h=>h!==s),s in o.applied||(o.visible=o.visible.filter(h=>h!==s))),this.store.setState({filters:o});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;Wa(n,o.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),o.metadata=n,this.store.setState({filters:o});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Xa(c,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(o=>o!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata};o.visible=o.visible.filter(n=>n!==s),a.metadata=o,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,o={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];o.applied=c;const d=Object.keys(s);if(o.visible=[...new Set([...o.pinned,...d])],i){const u={...o.metadata};u.applied=i.applied;const g=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...g])],o.metadata=u}this.store.setState({filters:o,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){var s;const e=this.storeCtrl.state;if(e.activeTab==="labels"&&!e.activeLabelUuid)return po;if(e.activeTab==="collections"){if(!e.activeCollectionUuid)return ho;if(!(e.activeCollectionFolder&&!((s=e.activeCollectionFolder.children)!=null&&s.length)))return uo}return e.searchQuery?lo:e.activeTab==="folders"?co:ys}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return Pa(s,e.filters.metadata.applied).join(" ")}render(){var p,f,m,x,_,w,y,L,k,S,E,A,ve,ae,P,Z,J,z;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),o=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,c=r.html`
7244
7269
  <ap-header
7245
7270
  .activeTab=${e.activeTab}
7246
7271
  .tabs=${((f=this.config)==null?void 0:f.tabs)??["assets","folders"]}
@@ -7284,7 +7309,7 @@
7284
7309
  .totalFolderCount=${e.totalFolderCount}
7285
7310
  .showUpload=${d}
7286
7311
  .showFilters=${!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((y=e.activeCollectionFolder.children)!=null&&y.length)))}
7287
- .countLabel=${e.activeTab==="labels"&&!e.activeLabelUuid?`${e.labels.length} label${e.labels.length!==1?"s":""}`:e.activeTab==="collections"&&!e.activeCollectionUuid?`${e.collections.length} collection${e.collections.length!==1?"s":""}`:e.activeTab==="collections"&&e.activeCollectionUuid&&!(e.activeCollectionFolder&&!((T=e.activeCollectionFolder.children)!=null&&T.length))?`${this._getVisibleCollectionFolders().length} folder${this._getVisibleCollectionFolders().length!==1?"s":""}`:""}
7312
+ .countLabel=${e.activeTab==="labels"&&!e.activeLabelUuid?`${e.labels.length} label${e.labels.length!==1?"s":""}`:e.activeTab==="collections"&&!e.activeCollectionUuid?`${e.collections.length} collection${e.collections.length!==1?"s":""}`:e.activeTab==="collections"&&e.activeCollectionUuid&&!(e.activeCollectionFolder&&!((L=e.activeCollectionFolder.children)!=null&&L.length))?`${this._getVisibleCollectionFolders().length} folder${this._getVisibleCollectionFolders().length!==1?"s":""}`:""}
7288
7313
  .sortBy=${e.sortBy}
7289
7314
  .sortDirection=${e.sortDirection}
7290
7315
  .sortOptions=${this._getSortOptions()}
@@ -7337,7 +7362,7 @@
7337
7362
  ></ap-breadcrumb>`:r.nothing}
7338
7363
  </div>
7339
7364
 
7340
- ${e.isLoading&&e.assets.length===0&&e.folders.length===0&&!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((F=e.activeCollectionFolder.children)!=null&&F.length)))?r.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((E=this.config)==null?void 0:E.gridSize)??"normal"} .multiSelect=${((fe=this.config)==null?void 0:fe.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
7365
+ ${e.isLoading&&e.assets.length===0&&e.folders.length===0&&!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((E=e.activeCollectionFolder.children)!=null&&E.length)))?r.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((A=this.config)==null?void 0:A.gridSize)??"normal"} .multiSelect=${((ve=this.config)==null?void 0:ve.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
7341
7366
 
7342
7367
  <ap-marquee-overlay .active=${this.marqueeCtrl.isActive} .rect=${this.marqueeCtrl.rect}></ap-marquee-overlay>
7343
7368
  ${this._folderResolveOpen?r.html`
@@ -7364,11 +7389,11 @@
7364
7389
  .assets=${e.assets}
7365
7390
  .selectedIds=${s}
7366
7391
  .containerToken=${e.projectToken}
7367
- .showMetadata=${((ie=this.config)==null?void 0:ie.showMetadata)!==!1}
7392
+ .showMetadata=${((ae=this.config)==null?void 0:ae.showMetadata)!==!1}
7368
7393
  .metadataFields=${e.metadataFields}
7369
7394
  .labels=${e.labels}
7370
7395
  .regionalFilters=${e.regionalFilters}
7371
- .multiSelect=${((M=this.config)==null?void 0:M.multiSelect)??!0}
7396
+ .multiSelect=${((P=this.config)==null?void 0:P.multiSelect)??!0}
7372
7397
  @preview-close=${this._handlePreviewClose}
7373
7398
  @preview-navigate=${this._handlePreviewNavigate}
7374
7399
  @asset-select=${this._handleAssetSelect}
@@ -7383,9 +7408,9 @@
7383
7408
  .totalCount=${e.totalCount}
7384
7409
  .totalFolderCount=${e.totalFolderCount}
7385
7410
  .isSelectingAll=${e.isSelectingAll}
7386
- .multiSelect=${((X=this.config)==null?void 0:X.multiSelect)??!0}
7387
- .maxSelections=${(Z=this.config)==null?void 0:Z.maxSelections}
7388
- .showTransform=${!!((D=this.config)!=null&&D.transformations)&&a.some(je)}
7411
+ .multiSelect=${((Z=this.config)==null?void 0:Z.multiSelect)??!0}
7412
+ .maxSelections=${(J=this.config)==null?void 0:J.maxSelections}
7413
+ .showTransform=${!!((z=this.config)!=null&&z.transformations)&&a.some(Ne)}
7389
7414
  @selection-confirm=${this._handleSelectionConfirm}
7390
7415
  @selection-transform=${this._handleSelectionTransform}
7391
7416
  @selection-clear=${this._handleSelectionClear}
@@ -7407,7 +7432,7 @@
7407
7432
  `:r.nothing:r.html`
7408
7433
  <ap-modal
7409
7434
  ?open=${e.isOpen}
7410
- @ap-cancel=${Pe=>this._handleCancel(Pe.detail.reason)}
7435
+ @ap-cancel=${De=>this._handleCancel(De.detail.reason)}
7411
7436
  >
7412
7437
  ${this._isUploaderOpen?g:r.html`
7413
7438
  <div slot="header">${c}</div>
@@ -7501,7 +7526,7 @@
7501
7526
  @selection-clear=${this._handleSelectionClear}
7502
7527
  ></ap-list-view>
7503
7528
  <div id="sentinel"></div>
7504
- `;if(e.activeTab==="labels"){if(!e.activeLabelUuid){let y=e.labels;if(e.searchQuery){const k=e.searchQuery.toLowerCase();y=e.labels.filter(S=>S.name.toLowerCase().includes(k))}const T=e.sortDirection==="asc"?1:-1;return y=[...y].sort((k,S)=>T*k.name.localeCompare(S.name)),y.length===0?r.html`
7529
+ `;if(e.activeTab==="labels"){if(!e.activeLabelUuid){let y=e.labels;if(e.searchQuery){const k=e.searchQuery.toLowerCase();y=e.labels.filter(S=>S.name.toLowerCase().includes(k))}const L=e.sortDirection==="asc"?1:-1;return y=[...y].sort((k,S)=>L*k.name.localeCompare(S.name)),y.length===0?r.html`
7505
7530
  <div class="empty-state">
7506
7531
  <ap-icon name="tag" .size=${48}></ap-icon>
7507
7532
  <div class="empty-title">${e.searchQuery?"No labels match your search":"No labels found"}</div>
@@ -7558,7 +7583,7 @@
7558
7583
  @selection-clear=${this._handleSelectionClear}
7559
7584
  ></ap-list-view>
7560
7585
  <div id="sentinel"></div>
7561
- `}if(e.activeTab==="collections"){if(!e.activeCollectionUuid){let k=e.collections;if(e.searchQuery){const F=e.searchQuery.toLowerCase();k=e.collections.filter(E=>E.title.toLowerCase().includes(F))}const S=e.sortDirection==="asc"?1:-1;return e.sortBy==="created_at"?k=[...k].sort((F,E)=>S*(new Date(F.created_at).getTime()-new Date(E.created_at).getTime())):e.sortBy==="updated_at"?k=[...k].sort((F,E)=>S*(new Date(F.updated_at).getTime()-new Date(E.updated_at).getTime())):k=[...k].sort((F,E)=>S*F.title.localeCompare(E.title)),k.length===0?r.html`
7586
+ `}if(e.activeTab==="collections"){if(!e.activeCollectionUuid){let k=e.collections;if(e.searchQuery){const E=e.searchQuery.toLowerCase();k=e.collections.filter(A=>A.title.toLowerCase().includes(E))}const S=e.sortDirection==="asc"?1:-1;return e.sortBy==="created_at"?k=[...k].sort((E,A)=>S*(new Date(E.created_at).getTime()-new Date(A.created_at).getTime())):e.sortBy==="updated_at"?k=[...k].sort((E,A)=>S*(new Date(E.updated_at).getTime()-new Date(A.updated_at).getTime())):k=[...k].sort((E,A)=>S*E.title.localeCompare(A.title)),k.length===0?r.html`
7562
7587
  <div class="empty-state">
7563
7588
  <ap-icon name="layout-grid" .size=${48}></ap-icon>
7564
7589
  <div class="empty-title">${e.searchQuery?"No collections match your search":"No collections found"}</div>
@@ -7566,17 +7591,17 @@
7566
7591
  </div>
7567
7592
  `:e.viewMode==="grid"?r.html`
7568
7593
  <div class="collections-grid">
7569
- ${k.map((F,E)=>r.html`
7570
- <ap-collection-card .collection=${F} .index=${E} @collection-open=${this._handleCollectionOpen}></ap-collection-card>
7594
+ ${k.map((E,A)=>r.html`
7595
+ <ap-collection-card .collection=${E} .index=${A} @collection-open=${this._handleCollectionOpen}></ap-collection-card>
7571
7596
  `)}
7572
7597
  </div>
7573
7598
  `:r.html`
7574
7599
  <div class="collections-list">
7575
- ${k.map((F,E)=>r.html`
7576
- <ap-collection-row .collection=${F} .index=${E} @collection-open=${this._handleCollectionOpen}></ap-collection-row>
7600
+ ${k.map((E,A)=>r.html`
7601
+ <ap-collection-row .collection=${E} .index=${A} @collection-open=${this._handleCollectionOpen}></ap-collection-row>
7577
7602
  `)}
7578
7603
  </div>
7579
- `}if(e.isLoadingCollectionFolders)return r.html`<div class="loading-center"><ap-spinner></ap-spinner></div>`;const y=this._getVisibleCollectionFolders();if(!e.activeCollectionFolder||(((m=e.activeCollectionFolder.children)==null?void 0:m.length)??0)>0){let k=y;if(e.searchQuery){const F=e.searchQuery.toLowerCase();k=y.filter(E=>E.name.toLowerCase().includes(F))}const S=e.sortDirection==="asc"?1:-1;return k=[...k].sort((F,E)=>S*F.name.localeCompare(E.name)),k.length===0?r.html`
7604
+ `}if(e.isLoadingCollectionFolders)return r.html`<div class="loading-center"><ap-spinner></ap-spinner></div>`;const y=this._getVisibleCollectionFolders();if(!e.activeCollectionFolder||(((m=e.activeCollectionFolder.children)==null?void 0:m.length)??0)>0){let k=y;if(e.searchQuery){const E=e.searchQuery.toLowerCase();k=y.filter(A=>A.name.toLowerCase().includes(E))}const S=e.sortDirection==="asc"?1:-1;return k=[...k].sort((E,A)=>S*E.name.localeCompare(A.name)),k.length===0?r.html`
7580
7605
  <div class="empty-state">
7581
7606
  <ap-icon name="folder" .size=${48}></ap-icon>
7582
7607
  <div class="empty-title">${e.searchQuery?"No folders match your search":"No folders in this collection"}</div>
@@ -7584,14 +7609,14 @@
7584
7609
  </div>
7585
7610
  `:e.viewMode==="grid"?r.html`
7586
7611
  <div class="collection-folders-grid">
7587
- ${k.map((F,E)=>r.html`
7588
- <ap-collection-folder-card .folder=${F} .index=${E} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-card>
7612
+ ${k.map((E,A)=>r.html`
7613
+ <ap-collection-folder-card .folder=${E} .index=${A} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-card>
7589
7614
  `)}
7590
7615
  </div>
7591
7616
  `:r.html`
7592
7617
  <div class="collection-folders-list">
7593
- ${k.map((F,E)=>r.html`
7594
- <ap-collection-folder-row .folder=${F} .index=${E} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-row>
7618
+ ${k.map((E,A)=>r.html`
7619
+ <ap-collection-folder-row .folder=${E} .index=${A} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-row>
7595
7620
  `)}
7596
7621
  </div>
7597
7622
  `}return!e.isLoading&&e.assets.length===0?r.html`
@@ -7633,7 +7658,7 @@
7633
7658
  @selection-clear=${this._handleSelectionClear}
7634
7659
  ></ap-list-view>
7635
7660
  <div id="sentinel"></div>
7636
- `}return r.nothing}};Ts.styles=[r.css`
7661
+ `}return r.nothing}};Ms.styles=[r.css`
7637
7662
  :host {
7638
7663
  display: contents;
7639
7664
  font-family: var(--ap-font-family, system-ui, -apple-system, sans-serif);
@@ -7807,4 +7832,4 @@
7807
7832
  width: 100%;
7808
7833
  height: 100%;
7809
7834
  }
7810
- `];let Me=Ts;Et([l.state()],Me.prototype,"_isDragOver");Et([l.state()],Me.prototype,"_isUploaderOpen");Et([l.state()],Me.prototype,"_folderResolveOpen");Et([l.state()],Me.prototype,"_transformOpen");Et([l.property({type:Object})],Me.prototype,"config");exports.AssetPicker=Me;exports.addCdnParams=xe;exports.buildTransformCdnParams=fs;exports.buildTransformedUrl=ca;exports.getAltText=Yi;exports.getAssetDimensions=Wi;exports.getAssetHeight=Dt;exports.getAssetWidth=Pt;exports.getBestVideoUrl=Ji;exports.getCdnUrl=ti;exports.getTranscodedUrl=Zi;exports.isAudio=Qi;exports.isImage=je;exports.isTranscoded=Xi;exports.isVideo=Ki;
7835
+ `];let Pe=Ms;At([l.state()],Pe.prototype,"_isDragOver");At([l.state()],Pe.prototype,"_isUploaderOpen");At([l.state()],Pe.prototype,"_folderResolveOpen");At([l.state()],Pe.prototype,"_transformOpen");At([l.property({type:Object})],Pe.prototype,"config");exports.AssetPicker=Pe;exports.addCdnParams=we;exports.buildTransformCdnParams=bs;exports.buildTransformedUrl=ha;exports.getAltText=Zi;exports.getAssetDimensions=Ji;exports.getAssetHeight=zt;exports.getAssetWidth=Dt;exports.getBestVideoUrl=sa;exports.getCdnUrl=ai;exports.getTranscodedUrl=ta;exports.isAudio=Xi;exports.isImage=Ne;exports.isTranscoded=ea;exports.isVideo=Wi;