@scaleflex/asset-picker 0.2.4 → 0.2.6

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 (32) hide show
  1. package/.claude/settings.local.json +38 -22
  2. package/dist/{asset-picker-Z_6-Ac0_.js → asset-picker-Cc1NFvo6.js} +696 -589
  3. package/dist/{asset-picker-D4Tqus2q.cjs → asset-picker-D62afrSd.cjs} +290 -197
  4. package/dist/components/filters/ap-filter-color.d.ts.map +1 -1
  5. package/dist/components/filters/ap-filter-image.d.ts.map +1 -1
  6. package/dist/components/filters/ap-filter-labels.d.ts.map +1 -1
  7. package/dist/components/filters/ap-filter-metadata.d.ts.map +1 -1
  8. package/dist/components/filters/ap-filter-product-ref.d.ts.map +1 -1
  9. package/dist/components/filters/ap-filter-tags.d.ts.map +1 -1
  10. package/dist/components/filters/shared/filter-styles.d.ts.map +1 -1
  11. package/dist/components/header/ap-header.d.ts.map +1 -1
  12. package/dist/components/navigation/ap-breadcrumb.d.ts.map +1 -1
  13. package/dist/components/preview/ap-preview-panel.d.ts.map +1 -1
  14. package/dist/components/selection/ap-selection-bar.d.ts.map +1 -1
  15. package/dist/components/shared/ap-badge.d.ts.map +1 -1
  16. package/dist/components/shared/ap-checkbox.d.ts.map +1 -1
  17. package/dist/components/shared/ap-dropdown.d.ts.map +1 -1
  18. package/dist/components/shared/ap-icon.d.ts.map +1 -1
  19. package/dist/components/shared/ap-radio-group.d.ts.map +1 -1
  20. package/dist/components/views/ap-asset-card.d.ts.map +1 -1
  21. package/dist/components/views/ap-asset-row.d.ts.map +1 -1
  22. package/dist/components/views/ap-folder-card.d.ts.map +1 -1
  23. package/dist/components/views/ap-folder-row.d.ts.map +1 -1
  24. package/dist/controllers/marquee.controller.d.ts +1 -0
  25. package/dist/controllers/marquee.controller.d.ts.map +1 -1
  26. package/dist/define.cjs +1 -1
  27. package/dist/define.js +1 -1
  28. package/dist/index.cjs +1 -1
  29. package/dist/index.js +1 -1
  30. package/dist/types/asset.types.d.ts +1 -0
  31. package/dist/types/asset.types.d.ts.map +1 -1
  32. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- "use strict";var Ss=Object.create;var jt=Object.defineProperty;var Cs=Object.getOwnPropertyDescriptor;var Es=Object.getOwnPropertyNames;var Fs=Object.getPrototypeOf,As=Object.prototype.hasOwnProperty;var Ts=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Es(e))!As.call(t,a)&&a!==s&&jt(t,a,{get:()=>e[a],enumerable:!(i=Cs(e,a))||i.enumerable});return t};var Ms=(t,e,s)=>(s=t!=null?Ss(Fs(t)):{},Ts(e||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),l=require("lit/decorators.js");class Os{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 Ls(){return new Os({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map})}class Ps{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)}}class Is{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}handleSelect(e,s,i){var d,h;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((d=a.config)==null?void 0:d.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=a.assets;for(let g=u;g<=f;g++)p[g]&&r.set(p[g].uuid,p[g])}else i.metaKey||i.ctrlKey?r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e):(r.clear(),r.set(e.uuid,e));const c=(h=a.config)==null?void 0:h.maxSelections;c&&r.size>c||(this.lastClickedIndex=s,this.store.setState({selectedAssets:r}))}isSelected(e){return this.store.getState().selectedAssets.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var n;const i=(n=this.store.getState().config)==null?void 0:n.maxSelections,a=new Map,r=i?Math.min(e.length,i):e.length;for(let c=0;c<r;c++)a.set(e[c].uuid,e[c]);return this.store.setState({selectedAssets:a}),this.lastClickedIndex=-1,a.size}clearSelection(){this.store.setState({selectedAssets:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}}class Ds{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 Bt=5,$e=40,Ut=15;class zs{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=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.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),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){if(e.button!==0||this.isInteractiveTarget(e))return;const s=this.container.getBoundingClientRect();this.startX=e.clientX-s.left+this.container.scrollLeft,this.startY=e.clientY-s.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){if(this.container){if(!this._dragging){const s=Math.abs(e.clientX-this.startClientX),i=Math.abs(e.clientY-this.startClientY);if(s<Bt&&i<Bt)return;this._dragging=!0,this.isActive=!0,this.preMarqueeSelection=new Map(this.store.getState().selectedAssets)}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;this.rect={x:Math.min(this.startX,i),y:Math.min(this.startY,a),width:Math.abs(i-this.startX),height:Math.abs(a-this.startY)},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,r=i<$e||a<$e;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let r=0;i<$e?r=-Ut*(1-i/$e):a<$e&&(r=Ut*(1-a/$e)),r!==0&&(this.container.scrollTop+=r,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),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())}queryCards(){for(const e of Array.from(this.container.children))if(e.shadowRoot){const s=e.shadowRoot.querySelectorAll("[data-asset-uuid]");if(s.length>0)return s}return this.container.querySelectorAll("[data-asset-uuid]")}selectIntersecting(){var a;if(!this.container)return;const e=this.queryCards(),s=new Map(this.preMarqueeSelection);e.forEach(r=>{const n=r.getBoundingClientRect(),c=this.container.getBoundingClientRect(),d={x:n.left-c.left+this.container.scrollLeft,y:n.top-c.top+this.container.scrollTop,width:n.width,height:n.height},h=this.rect.x<d.x+d.width&&this.rect.x+this.rect.width>d.x&&this.rect.y<d.y+d.height&&this.rect.y+this.rect.height>d.y,u=r.dataset.assetUuid;if(h){const f=this.store.getState().assets.find(p=>p.uuid===u);f&&s.set(u,f)}});const i=(a=this.store.getState().config)==null?void 0:a.maxSelections;if(i&&s.size>i){const r=Array.from(s.entries()).slice(0,i);this.store.setState({selectedAssets:new Map(r)})}else this.store.setState({selectedAssets:s})}}class Rs{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 r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:r.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 r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.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 Ns(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 r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function Ye(t,e){const s=Ns(e);return t.request("/files",s)}async function Vt(t,e){const s={folder:e.folder,recursive:e.recursive??1},i=[];return e.search&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),t.request("/files/stats",s)}async function js(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",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[i]||i}:${a}`,await t.request("/folders",s)}async function Bs(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Us(t){return await t.request("/labels")}async function Vs(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 qs(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}const m={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"},z={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},y={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Hs={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"},dt={[_.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(dt).map(([t,e])=>[e,t]));const Jt=Object.values(dt),Ie={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},qt={EMPTY:"empty",NOT_EMPTY:"non-empty"},B="empty",U="non-empty",he="specific",ft=10,mt=10,Xe=10,es="filters:pinned:",ts="metadata:pinned:",Ht=[m.DATE,m.TYPE],ss=y.IS,Qe="20",Ze="1",Ks=0,Gs=[{key:m.DATE,label:"Date",icon:"calendar",type:"date"},{key:m.TYPE,label:"Format",icon:"file-type",type:"string"},{key:m.SIZE,label:"Size",icon:"scaling",type:"string"},{key:m.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:m.TAGS,label:"Tags",icon:"hash",type:"string"},{key:m.LABELS,label:"Labels",icon:"tag",type:"string"},{key:m.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:m.IMAGE,label:"Image",icon:"image",type:"string"},{key:m.COLOR,label:"Color",icon:"swatch-book",type:"string"}],Ys={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Xs={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Ct=[Ys,...Gs,Xs],ke={[m.TYPE]:"Format",[m.DATE]:"Date",[m.SIZE]:"Size",[m.LICENSE_EXPIRY]:"License expiry",[m.TAGS]:"Tags",[m.LABELS]:"Labels",[m.PRODUCT_REF]:"Products",[m.IMAGE]:"Image",[m.COLOR]:"Color",[m.METADATA]:"Metadata",[m.APPROVAL]:"Approval"},ae={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},as=[{value:ae.IMAGE,label:"Image",icon:"image"},{value:ae.VIDEO,label:"Video",icon:"clapperboard"},{value:ae.AUDIO,label:"Audio",icon:"music"},{value:ae.DOCUMENT,label:"Document",icon:"document"},{value:ae.ARCHIVE,label:"Archive",icon:"archive"},{value:ae.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ae.FONTS,label:"Fonts",icon:"text"},{value:ae.OTHER,label:"Other",icon:"layout-grid"}],vt={RESOLUTION:0,ORIENTATION:1,FACES:2},Ws=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Qs=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Zs=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],is=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Ft=[{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"}],rs=[{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"}],Js=[{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"}],ea=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ta=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],bt=[{label:"Is",value:y.IS},{label:"Contains",value:y.CONTAINS_IN_TEXT}],X=[{label:"Is",value:y.IS},{label:"Is not",value:y.IS_NOT}],_t=[{label:"Is",value:y.IS_EXACT},{label:"Contains",value:y.IS},{label:"Does not contain",value:y.IS_NOT}],yt=[{label:"Is",value:y.IS},{label:"Greater than",value:y.GREATER_THAN_OR_EQUAL},{label:"Is not",value:y.IS_NOT},{label:"Less than",value:y.LESS_THAN_OR_EQUAL},{label:"Between",value:y.RANGE}],sa=[{label:"Is",value:y.IS_EXACT},{label:"Is not",value:y.IS_NOT}],Kt=[{label:"Contains",value:y.CONTAINS},{label:"Does not contain",value:y.IS_NOT}],aa=[{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))"}],ge=[{label:"Empty",value:B},{label:"Not empty",value:U}],xt=[...ge,{label:"Specific",value:he}],ia=[{label:"Empty",value:B},{label:"Not empty",value:U},{label:"True",value:"true"},{label:"False",value:"false"}],Je={[_.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"},ra={[_.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 oa(t){var v,$;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,r=((i==null?void 0:i.model)??[])[Ks],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(b=>({uuid:b.uuid,label:b.label??b.name??"",variants:(b.variants??[]).map(k=>({api_value:k.api_value??k.value??"",internal_unique_value:k.internal_unique_value??k.api_value??"",label:k.label??k.name??""}))})).filter(b=>b.variants.length>1),h={};for(const b of d)h[b.uuid]=((v=b.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??(($=e.settings)==null?void 0:$.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const b of p){const k=b.name||"Root fields";for(const w of b.fields??[]){const T=w.possible_values,j=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??""}));g.push({key:w.key??w.ckey,label:w.title??w.label??w.key??"",type:w.type??"text",slug:w.slug,ckey:w.ckey,possible_values:j,group:k,regionalVariantsGroupUuid:w.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ue(t){return t.toLocaleDateString("en-CA")}function We(){return ue(new Date)}function os(t){const e=new Date;switch(t){case"today":return{from:We(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ue(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:We(),to:ue(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ue(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:We(),to:ue(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ue(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:We(),to:ue(s)}}default:return null}}function Gt(t,e){return e?e.type==="date"?na(e):e.type==="string"?la(e):!0:!1}function na(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 la(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ca(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Gt(i,a))continue;const r=pa(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!Gt(i,a))continue;const r=ma(i,a);s.push(...r)}return da(s)}function da(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 pa(t,e){if(e.type==="date")return ns(t,e);if(t===m.IMAGE)return fa(e);const s=e,{operator:i=ss,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case m.SIZE:return ha(t,a,"..");case m.FACES:return ua(t,i,a);case m.TAGS:return fe(t,i,Xt(a),",",r);case m.LABELS:return fe(t,i,Xt(a),",",r);case m.COLOR:return ga(i,a,r);case m.TYPE:return Yt(t,a,i);case m.MIME_TYPE:return Yt(t,a,i);case m.PRODUCT_REF:return fe(t,"=%",a,",",r);default:return fe(t,i,a,",",r)}}function ns(t,e){const s=e.field||"created";if(e.kind===Ie.PRESET&&e.preset){if(e.preset===qt.EMPTY)return[`${s}:"empty"`];if(e.preset===qt.NOT_EMPTY)return[`${s}:"non-empty"`];const i=os(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===Ie.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ie.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ie.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===Ie.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function ha(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function ua(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function fe(t,e,s,i,a){if(s.length===0)return[];if(a===Hs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function ga(t,e,s){const i=[],a=fe("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Yt(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function fa(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[vt.RESOLUTION],a=s[vt.ORIENTATION],r=s[vt.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function ma(t,e){const s=_a(t),i=ba(t);if(e.type==="date")return va(s,e,i);const a=e,{operator:r=ss,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===B||n[0]===U)){const h=d===_.GEO_POINT?y.IS+"~":y.IS;return[`${s}${h}"${n[0]}"`]}if((d===_.NUMERIC||d===_.DECIMAL2)&&r===y.RANGE)return[`${s}${y.IS}"${n.join('","')}"`];if(d===_.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return fe(s,r+"~",h,",",c)}return fe(s,r,n,",",c)}function va(t,e,s){const i=ns(t,e);return!s||i.length===0?i:i.map(a=>{const r=a.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${a}"`;const n=a.slice(0,r),d=a.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function ba(t){return t.startsWith("date_")}function _a(t){for(const e of Jt)if(t.startsWith(e))return t.slice(e.length);return t}function Xt(t){return t.map(e=>e.replace(/#/g,""))}const ya=new Set([m.DATE,m.LICENSE_EXPIRY,z.DUE_DATE]);function De(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=xa(s,i));return e}function xa(t,e){return e.type==="string"||e.type==="date"?e:ya.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 wa(t){const e=localStorage.getItem(es+t),s=localStorage.getItem(ts+t);let i;try{i=e?JSON.parse(e):[...Ht]}catch{i=[...Ht]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function $a(t,e){localStorage.setItem(es+t,JSON.stringify(e))}function ka(t,e){localStorage.setItem(ts+t,JSON.stringify(e))}const ls="sort-by",cs="sort-order";function Wt(t,e){try{localStorage.setItem(ls,t),localStorage.setItem(cs,e)}catch{}}function Sa(){try{const t=localStorage.getItem(ls),e=localStorage.getItem(cs);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const ds="ap-last-folder",ps="ap-last-view",hs="ap-last-tab";function Qt(t){try{localStorage.setItem(ds,t)}catch{}}function Ca(){try{return localStorage.getItem(ds)}catch{return null}}function Ea(t){try{localStorage.setItem(ps,t)}catch{}}function Fa(){try{return localStorage.getItem(ps)}catch{return null}}function Aa(t){try{localStorage.setItem(hs,t)}catch{}}function Ta(){try{const t=localStorage.getItem(hs);return t==="assets"||t==="folders"?t:null}catch{return null}}function Ma(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,r=parseInt(s.slice(4,6),16)/255;return[i,a,r]}function wt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Oa(t,e,s){const i=wt(t),a=wt(e),r=wt(s),n=.4122214708*i+.5363325363*a+.0514459929*r,c=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(c),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,v=.0259040371*h+.7827717662*u-.808675766*f,$=Math.sqrt(g*g+v*v);let b=Math.atan2(v,g)*(180/Math.PI);return b<0&&(b+=360),[p,$,b]}function La(t){return t>.7}function Pa(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 f of s)t.style.removeProperty(f);return}const[i,a,r]=Ma(e),[n,c,d]=Oa(i,a,r),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=La(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 At=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Ia=[{value:"relevance",label:"Relevance"},...At],Da=[{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"}];var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Tt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&za(e,s,a),a};let Re=class extends o.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 o.html`
1
+ "use strict";var Ss=Object.create;var jt=Object.defineProperty;var Cs=Object.getOwnPropertyDescriptor;var Es=Object.getOwnPropertyNames;var Fs=Object.getPrototypeOf,As=Object.prototype.hasOwnProperty;var Ts=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Es(e))!As.call(t,a)&&a!==s&&jt(t,a,{get:()=>e[a],enumerable:!(i=Cs(e,a))||i.enumerable});return t};var Ms=(t,e,s)=>(s=t!=null?Ss(Fs(t)):{},Ts(e||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),l=require("lit/decorators.js");class Os{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 Ls(){return new Os({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map})}class Ps{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)}}class Is{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}handleSelect(e,s,i){var d,h;const a=this.store.getState(),r=new Map(a.selectedAssets);if(!(((d=a.config)==null?void 0:d.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=a.assets;for(let g=u;g<=f;g++)p[g]&&r.set(p[g].uuid,p[g])}else i.metaKey||i.ctrlKey?r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e):(r.clear(),r.set(e.uuid,e));const c=(h=a.config)==null?void 0:h.maxSelections;c&&r.size>c||(this.lastClickedIndex=s,this.store.setState({selectedAssets:r}))}isSelected(e){return this.store.getState().selectedAssets.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var n;const i=(n=this.store.getState().config)==null?void 0:n.maxSelections,a=new Map,r=i?Math.min(e.length,i):e.length;for(let c=0;c<r;c++)a.set(e[c].uuid,e[c]);return this.store.setState({selectedAssets:a}),this.lastClickedIndex=-1,a.size}clearSelection(){this.store.setState({selectedAssets:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}}class Ds{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 Ut=5,$e=40,Bt=15;class zs{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=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){if(e.button!==0||this.isInteractiveTarget(e))return;const s=this.container.getBoundingClientRect();this.startX=e.clientX-s.left+this.container.scrollLeft,this.startY=e.clientY-s.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<Ut&&a<Ut)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._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;this.rect={x:Math.min(this.startX,i),y:Math.min(this.startY,a),width:Math.abs(i-this.startX),height:Math.abs(a-this.startY)},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,r=i<$e||a<$e;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let r=0;i<$e?r=-Bt*(1-i/$e):a<$e&&(r=Bt*(1-a/$e)),r!==0&&(this.container.scrollTop+=r,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())}queryCards(){for(const e of Array.from(this.container.children))if(e.shadowRoot){const s=e.shadowRoot.querySelectorAll("[data-asset-uuid]");if(s.length>0)return s}return this.container.querySelectorAll("[data-asset-uuid]")}selectIntersecting(){var a;if(!this.container)return;const e=this.queryCards(),s=new Map(this.preMarqueeSelection);e.forEach(r=>{const n=r.getBoundingClientRect(),c=this.container.getBoundingClientRect(),d={x:n.left-c.left+this.container.scrollLeft,y:n.top-c.top+this.container.scrollTop,width:n.width,height:n.height},h=this.rect.x<d.x+d.width&&this.rect.x+this.rect.width>d.x&&this.rect.y<d.y+d.height&&this.rect.y+this.rect.height>d.y,u=r.dataset.assetUuid;if(h){const f=this.store.getState().assets.find(p=>p.uuid===u);f&&s.set(u,f)}});const i=(a=this.store.getState().config)==null?void 0:a.maxSelections;if(i&&s.size>i){const r=Array.from(s.entries()).slice(0,i);this.store.setState({selectedAssets:new Map(r)})}else this.store.setState({selectedAssets:s})}}class Rs{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 r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:r.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 r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.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 Ns(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 r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function Ye(t,e){const s=Ns(e);return t.request("/files",s)}async function Vt(t,e){const s={folder:e.folder,recursive:e.recursive??1},i=[];return e.search&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),t.request("/files/stats",s)}async function js(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",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[i]||i}:${a}`,await t.request("/folders",s)}async function Us(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Bs(t){return await t.request("/labels")}async function Vs(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 qs(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}const m={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"},z={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},y={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Hs={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"},dt={[_.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(dt).map(([t,e])=>[e,t]));const Jt=Object.values(dt),Ie={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},qt={EMPTY:"empty",NOT_EMPTY:"non-empty"},U="empty",B="non-empty",he="specific",ft=10,mt=10,Xe=10,es="filters:pinned:",ts="metadata:pinned:",Ht=[m.DATE,m.TYPE],ss=y.IS,Qe="20",Ze="1",Ks=0,Gs=[{key:m.DATE,label:"Date",icon:"calendar",type:"date"},{key:m.TYPE,label:"Format",icon:"file-type",type:"string"},{key:m.SIZE,label:"Size",icon:"scaling",type:"string"},{key:m.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:m.TAGS,label:"Tags",icon:"hash",type:"string"},{key:m.LABELS,label:"Labels",icon:"tag",type:"string"},{key:m.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:m.IMAGE,label:"Image",icon:"image",type:"string"},{key:m.COLOR,label:"Color",icon:"swatch-book",type:"string"}],Ys={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Xs={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Ct=[Ys,...Gs,Xs],ke={[m.TYPE]:"Format",[m.DATE]:"Date",[m.SIZE]:"Size",[m.LICENSE_EXPIRY]:"License expiry",[m.TAGS]:"Tags",[m.LABELS]:"Labels",[m.PRODUCT_REF]:"Products",[m.IMAGE]:"Image",[m.COLOR]:"Color",[m.METADATA]:"Metadata",[m.APPROVAL]:"Approval"},ae={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},as=[{value:ae.IMAGE,label:"Image",icon:"image"},{value:ae.VIDEO,label:"Video",icon:"clapperboard"},{value:ae.AUDIO,label:"Audio",icon:"music"},{value:ae.DOCUMENT,label:"Document",icon:"document"},{value:ae.ARCHIVE,label:"Archive",icon:"archive"},{value:ae.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ae.FONTS,label:"Fonts",icon:"text"},{value:ae.OTHER,label:"Other",icon:"layout-grid"}],vt={RESOLUTION:0,ORIENTATION:1,FACES:2},Ws=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Qs=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Zs=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],is=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Ft=[{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"}],rs=[{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"}],Js=[{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"}],ea=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ta=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],bt=[{label:"Is",value:y.IS},{label:"Contains",value:y.CONTAINS_IN_TEXT}],X=[{label:"Is",value:y.IS},{label:"Is not",value:y.IS_NOT}],_t=[{label:"Is",value:y.IS_EXACT},{label:"Contains",value:y.IS},{label:"Does not contain",value:y.IS_NOT}],yt=[{label:"Is",value:y.IS},{label:"Greater than",value:y.GREATER_THAN_OR_EQUAL},{label:"Is not",value:y.IS_NOT},{label:"Less than",value:y.LESS_THAN_OR_EQUAL},{label:"Between",value:y.RANGE}],sa=[{label:"Is",value:y.IS_EXACT},{label:"Is not",value:y.IS_NOT}],Kt=[{label:"Contains",value:y.CONTAINS},{label:"Does not contain",value:y.IS_NOT}],aa=[{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))"}],ge=[{label:"Empty",value:U},{label:"Not empty",value:B}],xt=[...ge,{label:"Specific",value:he}],ia=[{label:"Empty",value:U},{label:"Not empty",value:B},{label:"True",value:"true"},{label:"False",value:"false"}],Je={[_.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"},ra={[_.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 oa(t){var v,x;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,r=((i==null?void 0:i.model)??[])[Ks],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(b=>({uuid:b.uuid,label:b.label??b.name??"",variants:(b.variants??[]).map(k=>({api_value:k.api_value??k.value??"",internal_unique_value:k.internal_unique_value??k.api_value??"",label:k.label??k.name??""}))})).filter(b=>b.variants.length>1),h={};for(const b of d)h[b.uuid]=((v=b.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??((x=e.settings)==null?void 0:x.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const b of p){const k=b.name||"Root fields";for(const $ of b.fields??[]){const F=$.possible_values,j=F==null?void 0:F.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??""}));g.push({key:$.key??$.ckey,label:$.title??$.label??$.key??"",type:$.type??"text",slug:$.slug,ckey:$.ckey,possible_values:j,group:k,regionalVariantsGroupUuid:$.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ue(t){return t.toLocaleDateString("en-CA")}function We(){return ue(new Date)}function os(t){const e=new Date;switch(t){case"today":return{from:We(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ue(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:We(),to:ue(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ue(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:We(),to:ue(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ue(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:We(),to:ue(s)}}default:return null}}function Gt(t,e){return e?e.type==="date"?na(e):e.type==="string"?la(e):!0:!1}function na(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 la(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ca(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Gt(i,a))continue;const r=pa(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!Gt(i,a))continue;const r=ma(i,a);s.push(...r)}return da(s)}function da(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 pa(t,e){if(e.type==="date")return ns(t,e);if(t===m.IMAGE)return fa(e);const s=e,{operator:i=ss,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case m.SIZE:return ha(t,a,"..");case m.FACES:return ua(t,i,a);case m.TAGS:return fe(t,i,Xt(a),",",r);case m.LABELS:return fe(t,i,Xt(a),",",r);case m.COLOR:return ga(i,a,r);case m.TYPE:return Yt(t,a,i);case m.MIME_TYPE:return Yt(t,a,i);case m.PRODUCT_REF:return fe(t,"=%",a,",",r);default:return fe(t,i,a,",",r)}}function ns(t,e){const s=e.field||"created";if(e.kind===Ie.PRESET&&e.preset){if(e.preset===qt.EMPTY)return[`${s}:"empty"`];if(e.preset===qt.NOT_EMPTY)return[`${s}:"non-empty"`];const i=os(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===Ie.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ie.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ie.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===Ie.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function ha(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function ua(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function fe(t,e,s,i,a){if(s.length===0)return[];if(a===Hs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function ga(t,e,s){const i=[],a=fe("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function Yt(t,e,s,i){if(e.length===0)return[];const a=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${a}`]}function fa(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[vt.RESOLUTION],a=s[vt.ORIENTATION],r=s[vt.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function ma(t,e){const s=_a(t),i=ba(t);if(e.type==="date")return va(s,e,i);const a=e,{operator:r=ss,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===U||n[0]===B)){const h=d===_.GEO_POINT?y.IS+"~":y.IS;return[`${s}${h}"${n[0]}"`]}if((d===_.NUMERIC||d===_.DECIMAL2)&&r===y.RANGE)return[`${s}${y.IS}"${n.join('","')}"`];if(d===_.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return fe(s,r+"~",h,",",c)}return fe(s,r,n,",",c)}function va(t,e,s){const i=ns(t,e);return!s||i.length===0?i:i.map(a=>{const r=a.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${a}"`;const n=a.slice(0,r),d=a.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function ba(t){return t.startsWith("date_")}function _a(t){for(const e of Jt)if(t.startsWith(e))return t.slice(e.length);return t}function Xt(t){return t.map(e=>e.replace(/#/g,""))}const ya=new Set([m.DATE,m.LICENSE_EXPIRY,z.DUE_DATE]);function De(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=xa(s,i));return e}function xa(t,e){return e.type==="string"||e.type==="date"?e:ya.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 wa(t){const e=localStorage.getItem(es+t),s=localStorage.getItem(ts+t);let i;try{i=e?JSON.parse(e):[...Ht]}catch{i=[...Ht]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function $a(t,e){localStorage.setItem(es+t,JSON.stringify(e))}function ka(t,e){localStorage.setItem(ts+t,JSON.stringify(e))}const ls="sort-by",cs="sort-order";function Wt(t,e){try{localStorage.setItem(ls,t),localStorage.setItem(cs,e)}catch{}}function Sa(){try{const t=localStorage.getItem(ls),e=localStorage.getItem(cs);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const ds="ap-last-folder",ps="ap-last-view",hs="ap-last-tab";function Qt(t){try{localStorage.setItem(ds,t)}catch{}}function Ca(){try{return localStorage.getItem(ds)}catch{return null}}function Ea(t){try{localStorage.setItem(ps,t)}catch{}}function Fa(){try{return localStorage.getItem(ps)}catch{return null}}function Aa(t){try{localStorage.setItem(hs,t)}catch{}}function Ta(){try{const t=localStorage.getItem(hs);return t==="assets"||t==="folders"?t:null}catch{return null}}function Ma(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,r=parseInt(s.slice(4,6),16)/255;return[i,a,r]}function wt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Oa(t,e,s){const i=wt(t),a=wt(e),r=wt(s),n=.4122214708*i+.5363325363*a+.0514459929*r,c=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(c),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,v=.0259040371*h+.7827717662*u-.808675766*f,x=Math.sqrt(g*g+v*v);let b=Math.atan2(v,g)*(180/Math.PI);return b<0&&(b+=360),[p,x,b]}function La(t){return t>.7}function Pa(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 f of s)t.style.removeProperty(f);return}const[i,a,r]=Ma(e),[n,c,d]=Oa(i,a,r),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=La(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 At=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Ia=[{value:"relevance",label:"Relevance"},...At],Da=[{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"}];var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Tt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&za(e,s,a),a};let Re=class extends o.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 o.html`
2
2
  <dialog
3
3
  @click=${this._handleBackdropClick}
4
4
  @cancel=${this._handleCancel}
@@ -92,7 +92,7 @@
92
92
  *, *::before, *::after {
93
93
  box-sizing: border-box;
94
94
  }
95
- `;var ja=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,pt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ba(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ja(e,s,a),a};let Ce=class extends o.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 o.html`
95
+ `;var ja=Object.defineProperty,Ua=Object.getOwnPropertyDescriptor,pt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ua(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ja(e,s,a),a};let Ce=class extends o.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 o.html`
96
96
  <button
97
97
  class="trigger ${this._open?"active":""}"
98
98
  @click=${()=>this._open=!this._open}
@@ -208,7 +208,7 @@
208
208
  width: 16px;
209
209
  flex-shrink: 0;
210
210
  }
211
- `;pt([l.property({type:Array})],Ce.prototype,"groups",2);pt([l.property({type:Object})],Ce.prototype,"selectedFilters",2);pt([l.state()],Ce.prototype,"_open",2);Ce=pt([l.customElement("ap-regional-settings")],Ce);var Ua=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Va(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ua(e,s,a),a};const qa=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let H=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this._localSearch="",this._debouncedSearch=Na(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}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=qa.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),o.html`
211
+ `;pt([l.property({type:Array})],Ce.prototype,"groups",2);pt([l.property({type:Object})],Ce.prototype,"selectedFilters",2);pt([l.state()],Ce.prototype,"_open",2);Ce=pt([l.customElement("ap-regional-settings")],Ce);var Ba=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Va(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ba(e,s,a),a};const qa=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let H=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this._localSearch="",this._debouncedSearch=Na(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}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=qa.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),o.html`
212
212
  <div class="header-row">
213
213
  ${t.length>1?o.html`<ap-dropdown
214
214
  .value=${this.activeTab}
@@ -219,7 +219,7 @@
219
219
  <ap-icon class="search-icon" name="search" .size=${16}></ap-icon>
220
220
  <input
221
221
  type="text"
222
- placeholder="Search assets..."
222
+ placeholder="Search assets"
223
223
  .value=${this.searchQuery}
224
224
  @input=${this._handleInput}
225
225
  />
@@ -288,6 +288,9 @@
288
288
  background: var(--ap-background, oklch(1 0 0));
289
289
  outline: none;
290
290
  }
291
+ input:hover {
292
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
293
+ }
291
294
  input:focus {
292
295
  border-color: var(--ap-ring, oklch(0.578 0.198 268.129 / 0.7));
293
296
  box-shadow: 0 0 0 2px var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
@@ -297,6 +300,7 @@
297
300
  }
298
301
  input::placeholder {
299
302
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
303
+ font-weight: 400;
300
304
  }
301
305
  .clear-btn {
302
306
  position: absolute;
@@ -368,7 +372,7 @@
368
372
  `}};et.styles=o.css`
369
373
  :host {
370
374
  display: block;
371
- padding: 8px 20px;
375
+ padding: 4px 20px 12px;
372
376
  }
373
377
  .breadcrumb {
374
378
  display: flex;
@@ -386,6 +390,9 @@
386
390
  font-family: var(--ap-font-family, system-ui, sans-serif);
387
391
  font-size: var(--ap-font-size-sm, 0.875rem);
388
392
  }
393
+ button:first-child {
394
+ margin-left: -6px;
395
+ }
389
396
  button:hover {
390
397
  background: var(--ap-muted, oklch(0.974 0.006 239.819));
391
398
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
@@ -608,6 +615,7 @@
608
615
  }
609
616
  .filter-input::placeholder {
610
617
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
618
+ font-weight: 400;
611
619
  }
612
620
 
613
621
  /* ── Date input: Lucide calendar icon ── */
@@ -628,10 +636,6 @@
628
636
  background-size: 16px 16px;
629
637
  padding-right: 32px;
630
638
  }
631
- .input-label:has(+ .filter-input[type="date"]) {
632
- font-weight: 400;
633
- color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
634
- }
635
639
 
636
640
  textarea.filter-input {
637
641
  min-height: 60px;
@@ -641,9 +645,9 @@
641
645
  /* ── Input label ── */
642
646
  .input-label {
643
647
  display: block;
644
- font-size: var(--ap-font-size-sm, 0.875rem);
645
- font-weight: 500;
646
- color: var(--ap-foreground, oklch(0.37 0.022 248.413));
648
+ font-size: 0.75rem;
649
+ font-weight: 400;
650
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
647
651
  margin-bottom: 4px;
648
652
  }
649
653
  .input-label[aria-disabled="true"] {
@@ -717,9 +721,17 @@
717
721
  background: var(--ap-card, oklch(1 0 0));
718
722
  margin: -10px -8px 10px;
719
723
  }
724
+ .search-wrapper .search-icon {
725
+ position: absolute;
726
+ left: 10px;
727
+ top: 50%;
728
+ transform: translateY(-50%);
729
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
730
+ pointer-events: none;
731
+ }
720
732
  .search-input {
721
733
  width: 100%;
722
- padding: 8px 32px 8px 10px;
734
+ padding: 8px 32px 8px 32px;
723
735
  border: none;
724
736
  border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
725
737
  border-radius: 0;
@@ -731,6 +743,7 @@
731
743
  }
732
744
  .search-input::placeholder {
733
745
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
746
+ font-weight: 400;
734
747
  }
735
748
  .search-clear {
736
749
  position: absolute;
@@ -879,10 +892,11 @@
879
892
  `}render(){const t=this._search.toLowerCase().trim();return o.html`
880
893
  <div class="filter-content">
881
894
  <div class="filter-header">
895
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
882
896
  <input
883
897
  class="tag-search"
884
898
  type="text"
885
- placeholder="Search tags..."
899
+ placeholder="Search tags"
886
900
  .value=${this._search}
887
901
  @input=${this._onSearchInput}
888
902
  />
@@ -1020,9 +1034,18 @@
1020
1034
  margin: -10px -8px 10px;
1021
1035
  }
1022
1036
 
1037
+ .filter-header .search-icon {
1038
+ position: absolute;
1039
+ left: 10px;
1040
+ top: 50%;
1041
+ transform: translateY(-50%);
1042
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
1043
+ pointer-events: none;
1044
+ }
1045
+
1023
1046
  .tag-search {
1024
1047
  width: 100%;
1025
- padding: 8px 10px;
1048
+ padding: 8px 32px 8px 32px;
1026
1049
  border: none;
1027
1050
  border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
1028
1051
  font-size: var(--ap-font-size-sm, 0.875rem);
@@ -1034,6 +1057,7 @@
1034
1057
 
1035
1058
  .tag-search::placeholder {
1036
1059
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
1060
+ font-weight: 400;
1037
1061
  }
1038
1062
 
1039
1063
  .search-clear {
@@ -1062,10 +1086,11 @@
1062
1086
  <div class="filter-content">
1063
1087
  <!-- Search input -->
1064
1088
  <div class="search-wrapper">
1089
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
1065
1090
  <input
1066
1091
  class="search-input"
1067
1092
  type="text"
1068
- placeholder="Search labels..."
1093
+ placeholder="Search labels"
1069
1094
  .value=${this._search}
1070
1095
  @input=${this._onSearchInput}
1071
1096
  />
@@ -1283,8 +1308,8 @@
1283
1308
  /* ── Palette ── */
1284
1309
  .palette {
1285
1310
  display: grid;
1286
- grid-template-columns: repeat(7, 1fr);
1287
- gap: 8px;
1311
+ grid-template-columns: repeat(8, 1fr);
1312
+ gap: 12px;
1288
1313
  justify-items: center;
1289
1314
  }
1290
1315
 
@@ -1432,16 +1457,21 @@
1432
1457
  display: grid;
1433
1458
  grid-template-columns: 1.4fr 1fr 1fr auto;
1434
1459
  align-items: end;
1435
- gap: 6px;
1460
+ gap: 8px;
1436
1461
  }
1437
1462
 
1438
1463
  .adv-field {
1439
1464
  display: flex;
1440
1465
  flex-direction: column;
1441
- gap: 2px;
1466
+ gap: 6px;
1442
1467
  min-width: 0;
1443
1468
  }
1444
1469
 
1470
+ .adv-field ap-dropdown {
1471
+ display: block;
1472
+ width: 100%;
1473
+ }
1474
+
1445
1475
  .adv-field-label {
1446
1476
  font-size: 0.6875rem;
1447
1477
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
@@ -1498,20 +1528,18 @@
1498
1528
  display: inline-flex;
1499
1529
  align-items: center;
1500
1530
  gap: 4px;
1501
- padding: 6px 12px;
1502
- border: 1px dashed var(--ap-border, oklch(92.86% 0.009 247.92));
1503
- border-radius: var(--ap-radius-sm, 6px);
1531
+ padding: 6px 0;
1532
+ border: none;
1504
1533
  background: none;
1505
1534
  font-size: var(--ap-font-size-sm, 0.875rem);
1506
1535
  font-family: inherit;
1507
- color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
1536
+ color: var(--ap-primary, oklch(0.578 0.198 268.129));
1508
1537
  cursor: pointer;
1509
- transition: border-color 150ms, color 150ms;
1538
+ transition: opacity 150ms;
1510
1539
  }
1511
1540
 
1512
1541
  .add-color-btn:hover {
1513
- border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
1514
- color: var(--ap-primary, oklch(0.578 0.198 268.129));
1542
+ opacity: 0.8;
1515
1543
  }
1516
1544
  `];Oe([l.property({type:Array})],re.prototype,"values",2);Oe([l.state()],re.prototype,"_colors",2);Oe([l.state()],re.prototype,"_advanced",2);Oe([l.state()],re.prototype,"_showPalette",2);Oe([l.state()],re.prototype,"_initialized",2);re=Oe([l.customElement("ap-filter-color")],re);var oi=Object.defineProperty,ni=Object.getOwnPropertyDescriptor,ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?ni(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&oi(e,s,a),a};const li={KB:1/1e3,MB:1,GB:1e3},ci=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let Q=class extends o.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=li[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:m.SIZE,values:[],operator:y.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[i],operator:y.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 o.html`
1517
1545
  <div class="filter-content">
@@ -1661,6 +1689,9 @@
1661
1689
  flex-direction: column;
1662
1690
  gap: 12px;
1663
1691
  }
1692
+ .options-vertical ap-checkbox {
1693
+ --ap-checkbox-gap: 12px;
1694
+ }
1664
1695
  .orientation-label {
1665
1696
  display: inline-flex;
1666
1697
  align-items: center;
@@ -1669,9 +1700,9 @@
1669
1700
  .orientation-label svg {
1670
1701
  flex-shrink: 0;
1671
1702
  }
1672
- `];ht([l.property({type:Array})],Ee.prototype,"selectedResolution",2);ht([l.property({type:Array})],Ee.prototype,"selectedOrientation",2);ht([l.property({type:Array})],Ee.prototype,"selectedFaces",2);Ee=ht([l.customElement("ap-filter-image")],Ee);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,A=(t,e,s,i)=>{for(var a=i>1?void 0:i?bi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vi(e,s,a),a};function x(t){return`${dt[t.type]||""}${t.key}`}let F=class extends o.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>=Xe}_getField(t){return this.fields.find(e=>x(e)===t)}_getUIType(t){return ra[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===B||t[0]===U}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===B?B:((i=e.values)==null?void 0:i[0])===U?U:this._specificModeFields.has(t)||e.values&&e.values.length>0?he:""}_emitFilterChange(t,e,s){const i=x(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=x(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=x(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=x(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(x(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=x(t);if(e===he){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}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=x(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,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(x(t)).operator||bt[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=x(t),r=this._getApplied(a),n=r.operator||yt[0].value,c=[...r.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(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(x(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=x(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=x(t),i=this._getApplied(s),a=i.operator||_t[0].value,r=i.values||[],n=r.includes(e)?r.filter(c=>c!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=x(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=x(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];r.includes(e)||this._emitFilterChange(t,a,[...r,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(r=>r.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||X[0].value,r=i.values||[];r.includes(s)||this._emitFilterChange(t,a,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=x(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=x(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=x(t);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="",r="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),r=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(),r=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(),r=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(),r=n.toISOString();break}}a&&r&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[a,r]))}_onDateInput(t,e,s){const i=s.target.value,a=x(t),r=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]||"";r==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=x(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),r=(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}..${r||"0"}`;this._emitFilterChange(t,y.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=x(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,y.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(x(t));((a=s.values)==null?void 0:a[0])===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,r)=>r.length===0?o.nothing:o.html`
1703
+ `];ht([l.property({type:Array})],Ee.prototype,"selectedResolution",2);ht([l.property({type:Array})],Ee.prototype,"selectedOrientation",2);ht([l.property({type:Array})],Ee.prototype,"selectedFaces",2);Ee=ht([l.customElement("ap-filter-image")],Ee);var vi=Object.defineProperty,bi=Object.getOwnPropertyDescriptor,T=(t,e,s,i)=>{for(var a=i>1?void 0:i?bi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vi(e,s,a),a};function w(t){return`${dt[t.type]||""}${t.key}`}let A=class extends o.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>=Xe}_getField(t){return this.fields.find(e=>w(e)===t)}_getUIType(t){return ra[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===U||t[0]===B}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===U?U:((i=e.values)==null?void 0:i[0])===B?B:this._specificModeFields.has(t)||e.values&&e.values.length>0?he:""}_emitFilterChange(t,e,s){const i=w(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=w(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=w(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=w(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(w(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=w(t);if(e===he){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}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=w(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,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(w(t)).operator||bt[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=w(t),r=this._getApplied(a),n=r.operator||yt[0].value,c=[...r.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(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||_t[0].value,r=i.values||[],n=r.includes(e)?r.filter(c=>c!==e):[...r,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=w(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=w(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];r.includes(e)||this._emitFilterChange(t,a,[...r,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(r=>r.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||X[0].value,r=i.values||[];r.includes(s)||this._emitFilterChange(t,a,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=w(t),i=this._getApplied(s),a=i.operator||X[0].value,r=i.values||[];this._emitFilterChange(t,a,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=w(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=w(t);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="",r="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),r=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(),r=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(),r=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(),r=n.toISOString();break}}a&&r&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[a,r]))}_onDateInput(t,e,s){const i=s.target.value,a=w(t),r=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]||"";r==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=w(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),r=(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}..${r||"0"}`;this._emitFilterChange(t,y.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=w(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const r=a.values[0],[n]=r.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,y.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(w(t));((a=s.values)==null?void 0:a[0])===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,r)=>r.length===0?o.nothing:o.html`
1673
1704
  <div class="field-group-label">${a}</div>
1674
- ${r.map(n=>{const c=x(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return o.html`
1705
+ ${r.map(n=>{const c=w(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return o.html`
1675
1706
  <div
1676
1707
  class="field-item ${d?"selected":""} ${h?"disabled":""}"
1677
1708
  @click=${()=>!h&&!d&&this._addField(n)}
@@ -1691,18 +1722,21 @@
1691
1722
  <ap-icon name="close" .size=${16}></ap-icon>
1692
1723
  </button>
1693
1724
  </div>
1694
- <input
1695
- class="field-search"
1696
- type="text"
1697
- placeholder="Search fields..."
1698
- .value=${this._fieldSearch}
1699
- @input=${a=>{this._fieldSearch=a.target.value}}
1700
- />
1725
+ <div class="field-search-wrapper">
1726
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
1727
+ <input
1728
+ class="field-search"
1729
+ type="text"
1730
+ placeholder="Search fields"
1731
+ .value=${this._fieldSearch}
1732
+ @input=${a=>{this._fieldSearch=a.target.value}}
1733
+ />
1734
+ </div>
1701
1735
  <div class="field-list">
1702
1736
  ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
1703
1737
  </div>
1704
1738
  </div>
1705
- `}_renderTextFilter(t){var h,u;const e=x(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===B||r===U,c=s.operator||bt[0].value,d=t.type===_.TEXT_AREA;return o.html`
1739
+ `}_renderTextFilter(t){var h,u;const e=w(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===U||r===B,c=s.operator||bt[0].value,d=t.type===_.TEXT_AREA;return o.html`
1706
1740
  <div class="filter-content" style="position: relative;">
1707
1741
  <button
1708
1742
  class="clear-btn"
@@ -1736,7 +1770,7 @@
1736
1770
  ${d?o.html`
1737
1771
  <textarea
1738
1772
  class="filter-input"
1739
- placeholder="Enter value..."
1773
+ placeholder="Enter value"
1740
1774
  .value=${a}
1741
1775
  @change=${f=>this._onTextInput(t,f)}
1742
1776
  ></textarea>
@@ -1744,7 +1778,7 @@
1744
1778
  <input
1745
1779
  class="filter-input"
1746
1780
  type="text"
1747
- placeholder="Enter value..."
1781
+ placeholder="Enter value"
1748
1782
  .value=${a}
1749
1783
  @change=${f=>this._onTextInput(t,f)}
1750
1784
  @keydown=${f=>{f.key==="Enter"&&f.preventDefault()}}
@@ -1753,7 +1787,7 @@
1753
1787
  </div>
1754
1788
  `:o.nothing}
1755
1789
  </div>
1756
- `}_renderNumberFilter(t){var w,T,j;const e=x(t),s=this._getApplied(e),i=s.operator||yt[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===B||r===U,c=i===y.RANGE,d=i===y.GREATER_THAN_OR_EQUAL,h=i===y.LESS_THAN_OR_EQUAL,u=t.type===_.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":((w=s.values)==null?void 0:w[0])||"",v=a?"":((T=s.values)==null?void 0:T[1])||"",$=c||d||h,b=c||d||h?"Min":"Value";return o.html`
1790
+ `}_renderNumberFilter(t){var $,F,j;const e=w(t),s=this._getApplied(e),i=s.operator||yt[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===U||r===B,c=i===y.RANGE,d=i===y.GREATER_THAN_OR_EQUAL,h=i===y.LESS_THAN_OR_EQUAL,u=t.type===_.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":(($=s.values)==null?void 0:$[0])||"",v=a?"":((F=s.values)==null?void 0:F[1])||"",x=c||d||h,b=c||d||h?"Min":"Value";return o.html`
1757
1791
  <div class="filter-content" style="position: relative;">
1758
1792
  <button
1759
1793
  class="clear-btn"
@@ -1796,7 +1830,7 @@
1796
1830
  @change=${S=>this._onNumberInput(t,S,0)}
1797
1831
  />
1798
1832
  </div>
1799
- ${$?o.html`
1833
+ ${x?o.html`
1800
1834
  <div>
1801
1835
  <span class="input-label" aria-disabled=${d?"true":o.nothing}>${"Max"}</span>
1802
1836
  <input
@@ -1814,7 +1848,7 @@
1814
1848
  </div>
1815
1849
  `:o.nothing}
1816
1850
  </div>
1817
- `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(x(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
1851
+ `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(w(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
1818
1852
  <div class="filter-content" style="position: relative;">
1819
1853
  <button
1820
1854
  class="clear-btn"
@@ -1831,14 +1865,15 @@
1831
1865
  ></ap-radio-group>
1832
1866
  </div>
1833
1867
  </div>
1834
- `}_renderSelectOneFilter(t){const e=x(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||X[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=Xe;return o.html`
1868
+ `}_renderSelectOneFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||X[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=Xe;return o.html`
1835
1869
  <div class="filter-content">
1836
1870
  <!-- Search input -->
1837
1871
  <div class="search-wrapper">
1872
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
1838
1873
  <input
1839
1874
  class="search-input"
1840
1875
  type="text"
1841
- placeholder="Search options..."
1876
+ placeholder="Search options"
1842
1877
  .value=${this._selectSearches[e]||""}
1843
1878
  @input=${p=>{this._selectSearches={...this._selectSearches,[e]:p.target.value}}}
1844
1879
  />
@@ -1927,14 +1962,15 @@
1927
1962
  </div>
1928
1963
  </div>
1929
1964
  </div>
1930
- `}_renderMultiSelectFilter(t){const e=x(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||_t[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=Xe;return o.html`
1965
+ `}_renderMultiSelectFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=t.possible_values||[],n=s.operator||_t[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=a.length>=Xe;return o.html`
1931
1966
  <div class="filter-content">
1932
1967
  <!-- Search input -->
1933
1968
  <div class="search-wrapper">
1969
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
1934
1970
  <input
1935
1971
  class="search-input"
1936
1972
  type="text"
1937
- placeholder="Search options..."
1973
+ placeholder="Search options"
1938
1974
  .value=${this._selectSearches[e]||""}
1939
1975
  @input=${p=>{this._selectSearches={...this._selectSearches,[e]:p.target.value}}}
1940
1976
  />
@@ -2023,14 +2059,15 @@
2023
2059
  </div>
2024
2060
  </div>
2025
2061
  </div>
2026
- `}_renderTagsFilter(t){const e=x(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||X[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=Xe;return o.html`
2062
+ `}_renderTagsFilter(t){const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||X[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=a.length>=Xe;return o.html`
2027
2063
  <div class="filter-content">
2028
2064
  <!-- Search input -->
2029
2065
  <div class="search-wrapper">
2066
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
2030
2067
  <input
2031
2068
  class="search-input"
2032
2069
  type="text"
2033
- placeholder="Search tags..."
2070
+ placeholder="Search tags"
2034
2071
  .value=${r}
2035
2072
  @input=${p=>this._onTagInput(t,e,p)}
2036
2073
  @keydown=${p=>this._onTagKeydown(t,p)}
@@ -2121,7 +2158,7 @@
2121
2158
  </div>
2122
2159
  `:o.nothing}
2123
2160
  </div>
2124
- `}_renderDateFilter(t){var u,f;const e=x(t),s=this._datePresets[e]||"",i=this._getApplied(e),r=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(r);return o.html`
2161
+ `}_renderDateFilter(t){var u,f;const e=w(t),s=this._datePresets[e]||"",i=this._getApplied(e),r=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(r);return o.html`
2125
2162
  <div class="filter-content" style="position: relative;">
2126
2163
  <button
2127
2164
  class="clear-btn"
@@ -2193,7 +2230,7 @@
2193
2230
  </div>
2194
2231
  `:o.nothing}
2195
2232
  </div>
2196
- `}_renderGeoFilter(t){var u,f;const e=x(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let r="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const c=r.length>0,d=r.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2233
+ `}_renderGeoFilter(t){var u,f;const e=w(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let r="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const c=r.length>0,d=r.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2197
2234
  <div class="filter-content" style="position: relative;">
2198
2235
  <button
2199
2236
  class="clear-btn"
@@ -2239,7 +2276,7 @@
2239
2276
  </div>
2240
2277
  `:o.nothing}
2241
2278
  </div>
2242
- `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(x(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2279
+ `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(w(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2243
2280
  <div class="filter-content" style="position: relative;">
2244
2281
  <button
2245
2282
  class="clear-btn"
@@ -2255,7 +2292,7 @@
2255
2292
  ></ap-radio-group>
2256
2293
  </div>
2257
2294
  </div>
2258
- `}_renderFaceMatcherFilter(t){const e=x(t),s=this._getApplied(e),i=s.values||[],a=s.operator||y.IS;return o.html`
2295
+ `}_renderFaceMatcherFilter(t){const e=w(t),s=this._getApplied(e),i=s.values||[],a=s.operator||y.IS;return o.html`
2259
2296
  <div class="filter-content" style="position: relative;">
2260
2297
  <button
2261
2298
  class="clear-btn"
@@ -2274,7 +2311,7 @@
2274
2311
  <input
2275
2312
  class="filter-input"
2276
2313
  type="text"
2277
- placeholder="Search faces..."
2314
+ placeholder="Search faces"
2278
2315
  .value=${i.join(", ")}
2279
2316
  @change=${r=>{const c=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,a,c)}}
2280
2317
  />
@@ -2311,7 +2348,7 @@
2311
2348
  </div>
2312
2349
  `}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,r)=>r.length===0?o.nothing:o.html`
2313
2350
  <div class="field-group-label">${a}</div>
2314
- ${r.map(n=>{const c=x(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),f=!d&&this._atFieldLimit;return o.html`
2351
+ ${r.map(n=>{const c=w(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),f=!d&&this._atFieldLimit;return o.html`
2315
2352
  <div
2316
2353
  class="field-item ${h?"has-filter":""} ${f?"disabled":""}"
2317
2354
  @click=${()=>!f&&this._emitFieldSelect(n)}
@@ -2330,13 +2367,16 @@
2330
2367
  `})}
2331
2368
  `;return o.html`
2332
2369
  <div class="selector-wrap">
2333
- <input
2334
- class="field-search"
2335
- type="text"
2336
- placeholder="Search fields..."
2337
- .value=${this._fieldSearch}
2338
- @input=${a=>{this._fieldSearch=a.target.value}}
2339
- />
2370
+ <div class="field-search-wrapper">
2371
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
2372
+ <input
2373
+ class="field-search"
2374
+ type="text"
2375
+ placeholder="Search fields"
2376
+ .value=${this._fieldSearch}
2377
+ @input=${a=>{this._fieldSearch=a.target.value}}
2378
+ />
2379
+ </div>
2340
2380
  <div class="field-list">
2341
2381
  ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
2342
2382
  </div>
@@ -2360,7 +2400,7 @@
2360
2400
  </button>
2361
2401
  `:o.nothing}
2362
2402
  `:o.nothing}
2363
- `}};F.styles=[J,te,o.css`
2403
+ `}};A.styles=[J,te,o.css`
2364
2404
  /* ── Field selection panel ─────────────────────────────── */
2365
2405
 
2366
2406
  .add-field-btn {
@@ -2423,13 +2463,25 @@
2423
2463
  margin: 0;
2424
2464
  }
2425
2465
 
2426
- .field-search {
2466
+ .field-search-wrapper {
2427
2467
  position: sticky;
2428
2468
  top: 0;
2429
2469
  z-index: 2;
2470
+ }
2471
+
2472
+ .field-search-wrapper .search-icon {
2473
+ position: absolute;
2474
+ left: 10px;
2475
+ top: 50%;
2476
+ transform: translateY(-50%);
2477
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
2478
+ pointer-events: none;
2479
+ }
2480
+
2481
+ .field-search {
2430
2482
  width: 100%;
2431
2483
  height: 34px;
2432
- padding: 0 20px;
2484
+ padding: 0 20px 0 32px;
2433
2485
  box-sizing: border-box;
2434
2486
  border: none;
2435
2487
  border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
@@ -2442,6 +2494,7 @@
2442
2494
 
2443
2495
  .field-search::placeholder {
2444
2496
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
2497
+ font-weight: 400;
2445
2498
  }
2446
2499
 
2447
2500
  .field-list {
@@ -2724,7 +2777,7 @@
2724
2777
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
2725
2778
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
2726
2779
  }
2727
- `];A([l.property({type:Array})],F.prototype,"fields",2);A([l.property({type:Object})],F.prototype,"appliedFilters",2);A([l.property({type:Array})],F.prototype,"visibleFields",2);A([l.property()],F.prototype,"mode",2);A([l.property()],F.prototype,"activeFieldKey",2);A([l.property({type:Array})],F.prototype,"pinnedFields",2);A([l.property({type:Object})],F.prototype,"appliedMetadata",2);A([l.property({attribute:!1})],F.prototype,"apiClient",2);A([l.state()],F.prototype,"_showFieldSelection",2);A([l.state()],F.prototype,"_fieldSearch",2);A([l.state()],F.prototype,"_collapsedFields",2);A([l.state()],F.prototype,"_tagInputs",2);A([l.state()],F.prototype,"_tagSuggestions",2);A([l.state()],F.prototype,"_tagLoading",2);A([l.state()],F.prototype,"_datePresets",2);A([l.state()],F.prototype,"_dateFroms",2);A([l.state()],F.prototype,"_dateTos",2);A([l.state()],F.prototype,"_specificModeFields",2);A([l.state()],F.prototype,"_selectSearches",2);F=A([l.customElement("ap-filter-metadata")],F);var _i=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_i(e,s,a),a};let V=class extends o.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(B)||this.selectedStatus.includes(U)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===B||t===U)}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(z.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(z.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(z.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(z.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(z.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(z.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(z.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(z.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(z.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(z.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:z.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:z.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 o.html`
2780
+ `];T([l.property({type:Array})],A.prototype,"fields",2);T([l.property({type:Object})],A.prototype,"appliedFilters",2);T([l.property({type:Array})],A.prototype,"visibleFields",2);T([l.property()],A.prototype,"mode",2);T([l.property()],A.prototype,"activeFieldKey",2);T([l.property({type:Array})],A.prototype,"pinnedFields",2);T([l.property({type:Object})],A.prototype,"appliedMetadata",2);T([l.property({attribute:!1})],A.prototype,"apiClient",2);T([l.state()],A.prototype,"_showFieldSelection",2);T([l.state()],A.prototype,"_fieldSearch",2);T([l.state()],A.prototype,"_collapsedFields",2);T([l.state()],A.prototype,"_tagInputs",2);T([l.state()],A.prototype,"_tagSuggestions",2);T([l.state()],A.prototype,"_tagLoading",2);T([l.state()],A.prototype,"_datePresets",2);T([l.state()],A.prototype,"_dateFroms",2);T([l.state()],A.prototype,"_dateTos",2);T([l.state()],A.prototype,"_specificModeFields",2);T([l.state()],A.prototype,"_selectSearches",2);A=T([l.customElement("ap-filter-metadata")],A);var _i=Object.defineProperty,yi=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_i(e,s,a),a};let V=class extends o.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(U)||this.selectedStatus.includes(B)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===U||t===B)}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(z.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(z.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(z.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(z.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(z.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(z.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(z.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(z.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(z.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(z.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:z.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:z.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 o.html`
2728
2781
  <div class="filter-section">
2729
2782
  <button
2730
2783
  class="clear-btn"
@@ -2793,7 +2846,7 @@
2793
2846
  <input
2794
2847
  class="filter-input mt-12"
2795
2848
  type="text"
2796
- placeholder="Enter approver name..."
2849
+ placeholder="Enter approver name"
2797
2850
  .value=${this.approverValue}
2798
2851
  @input=${this._handleApproverInput}
2799
2852
  />
@@ -2820,7 +2873,7 @@
2820
2873
  <input
2821
2874
  class="filter-input mt-12"
2822
2875
  type="text"
2823
- placeholder="Enter requester name..."
2876
+ placeholder="Enter requester name"
2824
2877
  .value=${this.requesterValue}
2825
2878
  @input=${this._handleRequesterInput}
2826
2879
  />
@@ -2838,7 +2891,7 @@
2838
2891
  <!-- Empty / Not empty radio buttons -->
2839
2892
  <ap-radio-group
2840
2893
  .options=${ge}
2841
- .value=${this.dueDatePreset===B||this.dueDatePreset===U?this.dueDatePreset:""}
2894
+ .value=${this.dueDatePreset===U||this.dueDatePreset===B?this.dueDatePreset:""}
2842
2895
  @ap-change=${this._handleDueDatePreset}
2843
2896
  ></ap-radio-group>
2844
2897
 
@@ -2848,7 +2901,7 @@
2848
2901
  <ap-radio-group
2849
2902
  columns="2"
2850
2903
  .options=${Js}
2851
- .value=${this.dueDatePreset!==B&&this.dueDatePreset!==U?this.dueDatePreset:""}
2904
+ .value=${this.dueDatePreset!==U&&this.dueDatePreset!==B?this.dueDatePreset:""}
2852
2905
  @ap-change=${this._handleDueDatePreset}
2853
2906
  ></ap-radio-group>
2854
2907
 
@@ -2904,7 +2957,7 @@
2904
2957
  }
2905
2958
  .condition-label {
2906
2959
  font-weight: 500;
2907
- margin-bottom: 6px;
2960
+ margin-bottom: 8px;
2908
2961
  }
2909
2962
  .mt-12 {
2910
2963
  margin-top: 12px;
@@ -2921,6 +2974,7 @@
2921
2974
  `}render(){const t=this.selected.length===0;return o.html`
2922
2975
  <div class="filter-content">
2923
2976
  <div class="filter-header">
2977
+ <ap-icon class="search-icon" name="search" .size=${14}></ap-icon>
2924
2978
  <input
2925
2979
  class="product-search"
2926
2980
  type="text"
@@ -3062,9 +3116,18 @@
3062
3116
  margin: -10px -8px 10px;
3063
3117
  }
3064
3118
 
3119
+ .filter-header .search-icon {
3120
+ position: absolute;
3121
+ left: 10px;
3122
+ top: 50%;
3123
+ transform: translateY(-50%);
3124
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3125
+ pointer-events: none;
3126
+ }
3127
+
3065
3128
  .product-search {
3066
3129
  width: 100%;
3067
- padding: 8px 10px;
3130
+ padding: 8px 32px 8px 32px;
3068
3131
  border: none;
3069
3132
  border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
3070
3133
  font-size: var(--ap-font-size-sm, 0.875rem);
@@ -3076,6 +3139,7 @@
3076
3139
 
3077
3140
  .product-search::placeholder {
3078
3141
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3142
+ font-weight: 400;
3079
3143
  }
3080
3144
 
3081
3145
  .search-clear {
@@ -3472,7 +3536,7 @@
3472
3536
  .controls {
3473
3537
  display: flex;
3474
3538
  align-items: center;
3475
- gap: 4px;
3539
+ gap: 0;
3476
3540
  }
3477
3541
 
3478
3542
  /* Filter dropdown trigger */
@@ -3855,7 +3919,7 @@
3855
3919
  .chips {
3856
3920
  display: flex;
3857
3921
  align-items: center;
3858
- gap: 8px;
3922
+ gap: 12px;
3859
3923
  overflow-x: auto;
3860
3924
  scrollbar-width: none;
3861
3925
  min-width: 0;
@@ -4018,7 +4082,7 @@
4018
4082
  .grid {
4019
4083
  display: grid;
4020
4084
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
4021
- gap: 20px 24px;
4085
+ gap: 24px;
4022
4086
  }
4023
4087
  .ghost-card {
4024
4088
  aspect-ratio: 6/4;
@@ -4090,7 +4154,7 @@
4090
4154
  padding: 8px 12px;
4091
4155
  font-size: 14px;
4092
4156
  font-weight: 400;
4093
- color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
4157
+ color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4094
4158
  border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
4095
4159
  }
4096
4160
  .list-header:not(.has-checkbox) {
@@ -4153,7 +4217,7 @@
4153
4217
  @media (prefers-reduced-motion: reduce) {
4154
4218
  .ghost-row { animation: none; }
4155
4219
  }
4156
- `;le([l.property({type:Array})],K.prototype,"assets",2);le([l.property({type:Array})],K.prototype,"folders",2);le([l.property({type:Array})],K.prototype,"selectedIds",2);le([l.property({type:Boolean})],K.prototype,"isLoading",2);le([l.property({type:Boolean})],K.prototype,"multiSelect",2);le([l.property({type:Number})],K.prototype,"totalCount",2);le([l.property({type:Boolean})],K.prototype,"isSelectingAll",2);K=le([l.customElement("ap-list-view")],K);function st(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 Fe(s)}function fs(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?Fe(s):""}function Ot(t){var s,i;let e=Fe(((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(/[?&]$/,""),ze(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function ze(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 Zt=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Fe(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(Zt);if(s){const i=s[2];return t.replace(Zt,`$1assets.filerobot.com/${i}/`)}if(e)try{const i=new URL(t);return`https://assets.filerobot.com/${e}${i.pathname}${i.search}`}catch{}return t}function Lt(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 at(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ms(t,e){return!t||!e?"":`${t} x ${e}`}const Ii=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Di=new Set([...Ii,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Se(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 vs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Di.has(e)}const bs="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",zi={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function ut(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=zi[e];return`${bs}${s||"DEFAULT"}.png`}function je(){return`${bs}DEFAULT.png`}function St(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Ri=new Set(["png","svg","webp","gif","avif"]);function Pt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ri.has(e)}var Ni=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,He=(t,e,s,i)=>{for(var a=i>1?void 0:i?ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ni(e,s,a),a};let ve=class extends o.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=r=>String(r).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${s}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=vs(t.extension||"");let r="";s?r=fs(t):i?r=Ot(t):a&&(r=st(t));const n=ut(t.extension||""),c=Pt(t.extension||"");return o.html`
4220
+ `;le([l.property({type:Array})],K.prototype,"assets",2);le([l.property({type:Array})],K.prototype,"folders",2);le([l.property({type:Array})],K.prototype,"selectedIds",2);le([l.property({type:Boolean})],K.prototype,"isLoading",2);le([l.property({type:Boolean})],K.prototype,"multiSelect",2);le([l.property({type:Number})],K.prototype,"totalCount",2);le([l.property({type:Boolean})],K.prototype,"isSelectingAll",2);K=le([l.customElement("ap-list-view")],K);function st(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 Fe(s)}function fs(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?Fe(s):""}function Ot(t){var s,i;let e=Fe(((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(/[?&]$/,""),ze(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function ze(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 Zt=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Fe(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(Zt);if(s){const i=s[2];return t.replace(Zt,`$1assets.filerobot.com/${i}/`)}if(e)try{const i=new URL(t);return`https://assets.filerobot.com/${e}${i.pathname}${i.search}`}catch{}return t}function Lt(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 at(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function ms(t,e){return!t||!e?"":`${t} x ${e}`}const Ii=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Di=new Set([...Ii,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Se(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 vs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Di.has(e)}const bs="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",zi={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function ut(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=zi[e];return`${bs}${s||"DEFAULT"}.png`}function je(){return`${bs}DEFAULT.png`}function St(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Ri=new Set(["png","svg","webp","gif","avif"]);function Pt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ri.has(e)}var Ni=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,He=(t,e,s,i)=>{for(var a=i>1?void 0:i?ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ni(e,s,a),a};let ve=class extends o.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=r=>String(r).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 d,h,u,f,p;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=vs(t.extension||"");let r="";s?r=fs(t):i?r=Ot(t):a&&(r=st(t));const n=ut(t.extension||""),c=Pt(t.extension||"");return o.html`
4157
4221
  <div class="card" @click=${this._handleSelect}>
4158
4222
  <div class="thumbnail ${c&&r?"chess":""}">
4159
4223
  ${r?o.html`<img
@@ -4161,14 +4225,14 @@
4161
4225
  alt=${t.name}
4162
4226
  loading="lazy"
4163
4227
  class="thumb-img ${c?"transparent-asset":""}"
4164
- @error=${p=>{const g=p.target,v=je();g.src!==n&&g.src!==v?(g.src=n,g.classList.add("icon-fallback")):g.src!==v&&(g.src=v)}}
4228
+ @error=${g=>{const v=g.target,x=je();v.src!==n&&v.src!==x?(v.src=n,v.classList.add("icon-fallback")):v.src!==x&&(v.src=x)}}
4165
4229
  />`:o.html`<img
4166
4230
  src=${n}
4167
4231
  alt=${t.name}
4168
4232
  class="thumb-img icon-fallback"
4169
- @error=${p=>{const g=p.target,v=je();g.src!==v&&(g.src=v)}}
4233
+ @error=${g=>{const v=g.target,x=je();v.src!==x&&(v.src=x)}}
4170
4234
  />`}
4171
- ${s&&((h=t.info)!=null&&h.duration)?o.html`<span class="duration">${this._formatDuration(t.info.duration)}</span>`:o.nothing}
4235
+ ${s&&(((h=t.info)==null?void 0:h.video_duration)??((u=t.info)==null?void 0:u.duration))!=null?o.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:o.nothing}
4172
4236
  <div class="overlay">
4173
4237
  <button class="overlay-btn" @click=${this._handlePreview} aria-label="Preview">
4174
4238
  <ap-icon name="preview" .size=${16}></ap-icon>
@@ -4191,7 +4255,7 @@
4191
4255
  </div>
4192
4256
  <div class="info">
4193
4257
  <div class="name" title=${t.name}>${t.name}</div>
4194
- <div class="meta">${(u=t.extension)==null?void 0:u.toUpperCase()}${(()=>{var $,b,k,w;const p=(($=t.info)==null?void 0:$.img_w)||((b=t.info)==null?void 0:b.video_w),g=((k=t.info)==null?void 0:k.img_h)||((w=t.info)==null?void 0:w.video_h),v=ms(p,g);return v?` · ${v}`:""})()} · ${Lt(((f=t.size)==null?void 0:f.bytes)||0)}</div>
4258
+ <div class="meta">${(f=t.extension)==null?void 0:f.toUpperCase()}${(()=>{var b,k,$,F;const g=((b=t.info)==null?void 0:b.img_w)||((k=t.info)==null?void 0:k.video_w),v=(($=t.info)==null?void 0:$.img_h)||((F=t.info)==null?void 0:F.video_h),x=ms(g,v);return x?` · ${x}`:""})()} · ${Lt(((p=t.size)==null?void 0:p.bytes)||0)}</div>
4195
4259
  </div>
4196
4260
  </div>
4197
4261
  `}};ve.styles=o.css`
@@ -4300,7 +4364,7 @@
4300
4364
  }
4301
4365
  .name {
4302
4366
  font-size: var(--ap-font-size-sm, 0.875rem);
4303
- font-weight: 500;
4367
+ font-weight: 400;
4304
4368
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
4305
4369
  white-space: nowrap;
4306
4370
  overflow: hidden;
@@ -4329,6 +4393,9 @@
4329
4393
  transition: all 150ms;
4330
4394
  background: var(--ap-background, oklch(1 0 0));
4331
4395
  }
4396
+ .check:hover .check-box {
4397
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
4398
+ }
4332
4399
  :host([selected]) .check-box {
4333
4400
  background: var(--ap-primary, oklch(0.578 0.198 268.129));
4334
4401
  border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
@@ -4354,8 +4421,8 @@
4354
4421
  }
4355
4422
  .duration {
4356
4423
  position: absolute;
4357
- bottom: 6px;
4358
- left: 6px;
4424
+ bottom: 8px;
4425
+ right: 12px;
4359
4426
  z-index: 1;
4360
4427
  padding: 2px 6px;
4361
4428
  border-radius: 4px;
@@ -4370,7 +4437,7 @@
4370
4437
  :host { animation: none; }
4371
4438
  .overlay { transition: none; }
4372
4439
  }
4373
- `;He([l.property({type:Object})],ve.prototype,"asset",2);He([l.property({type:Number})],ve.prototype,"index",2);He([l.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);He([l.property({type:Boolean})],ve.prototype,"multiSelect",2);ve=He([l.customElement("ap-asset-card")],ve);var Bi=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,Ke=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ui(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Bi(e,s,a),a};let be=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_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}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=vs(t.extension||"");let r="";s?r=fs(t):i?r=Ot(t):a&&(r=st(t));const n=ut(t.extension||""),c=Pt(t.extension||"");return o.html`
4440
+ `;He([l.property({type:Object})],ve.prototype,"asset",2);He([l.property({type:Number})],ve.prototype,"index",2);He([l.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);He([l.property({type:Boolean})],ve.prototype,"multiSelect",2);ve=He([l.customElement("ap-asset-card")],ve);var Ui=Object.defineProperty,Bi=Object.getOwnPropertyDescriptor,Ke=(t,e,s,i)=>{for(var a=i>1?void 0:i?Bi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ui(e,s,a),a};let be=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_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}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=vs(t.extension||"");let r="";s?r=fs(t):i?r=Ot(t):a&&(r=st(t));const n=ut(t.extension||""),c=Pt(t.extension||"");return o.html`
4374
4441
  <div class="row" @click=${this._handleSelect}>
4375
4442
  ${this.multiSelect?o.html`
4376
4443
  <div class="check">
@@ -4452,7 +4519,7 @@
4452
4519
  }
4453
4520
  .name {
4454
4521
  font-size: var(--ap-font-size-sm, 0.875rem);
4455
- font-weight: 500;
4522
+ font-weight: 400;
4456
4523
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
4457
4524
  white-space: nowrap;
4458
4525
  overflow: hidden;
@@ -4460,14 +4527,14 @@
4460
4527
  }
4461
4528
  .type {
4462
4529
  font-size: 0.8125rem;
4463
- color: var(--ap-foreground, oklch(0.37 0.022 248.413));
4530
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
4464
4531
  white-space: nowrap;
4465
4532
  overflow: hidden;
4466
4533
  text-overflow: ellipsis;
4467
4534
  }
4468
4535
  .desc, .date {
4469
4536
  font-size: 0.8125rem;
4470
- color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4537
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
4471
4538
  white-space: nowrap;
4472
4539
  overflow: hidden;
4473
4540
  text-overflow: ellipsis;
@@ -4519,6 +4586,9 @@
4519
4586
  transition: all 150ms;
4520
4587
  background: var(--ap-background, oklch(1 0 0));
4521
4588
  }
4589
+ .check:hover .check-box {
4590
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
4591
+ }
4522
4592
  :host([selected]) .check-box {
4523
4593
  background: var(--ap-primary, oklch(0.578 0.198 268.129));
4524
4594
  border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
@@ -4530,7 +4600,7 @@
4530
4600
  :host([selected]) .check-icon {
4531
4601
  display: block;
4532
4602
  }
4533
- `;Ke([l.property({type:Object})],be.prototype,"asset",2);Ke([l.property({type:Number})],be.prototype,"index",2);Ke([l.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);Ke([l.property({type:Boolean})],be.prototype,"multiSelect",2);be=Ke([l.customElement("ap-asset-row")],be);var Vi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,It=(t,e,s,i)=>{for(var a=i>1?void 0:i?qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vi(e,s,a),a};let Be=class extends o.LitElement{constructor(){super(...arguments),this.previews=[]}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_isAlternativeDisplay(t){const e=St(t).toLowerCase();return["svg","svg+xml","png","pdf"].includes(e)}_getPreviewUrl(t){const e=t.file_uri_cdn;if(!e)return"";let s=Fe(e);const i=Se(t.file_type),a=String(window.devicePixelRatio||1);return i==="video"?ze(s,{w:"200",dpr:a,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||St(t.file_type).toLowerCase()==="pdf"?(s=s.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(s,{w:"200",dpr:a,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):ze(s,{w:"200",dpr:a})}_renderPreviewImg(t){const e=this._isAlternativeDisplay(t.file_type),s=this._getPreviewUrl(t),i=ut(St(t.file_type)),a=je();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4603
+ `;Ke([l.property({type:Object})],be.prototype,"asset",2);Ke([l.property({type:Number})],be.prototype,"index",2);Ke([l.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);Ke([l.property({type:Boolean})],be.prototype,"multiSelect",2);be=Ke([l.customElement("ap-asset-row")],be);var Vi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,It=(t,e,s,i)=>{for(var a=i>1?void 0:i?qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vi(e,s,a),a};let Ue=class extends o.LitElement{constructor(){super(...arguments),this.previews=[]}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_isAlternativeDisplay(t){const e=St(t).toLowerCase();return["svg","svg+xml","png","pdf"].includes(e)}_getPreviewUrl(t){const e=t.file_uri_cdn;if(!e)return"";let s=Fe(e);const i=Se(t.file_type),a=String(window.devicePixelRatio||1);return i==="video"?ze(s,{w:"200",dpr:a,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||St(t.file_type).toLowerCase()==="pdf"?(s=s.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(s,{w:"200",dpr:a,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):ze(s,{w:"200",dpr:a})}_renderPreviewImg(t){const e=this._isAlternativeDisplay(t.file_type),s=this._getPreviewUrl(t),i=ut(St(t.file_type)),a=je();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4534
4604
  <img
4535
4605
  class="preview-img ${e?"icon-mode":""}"
4536
4606
  src="${s||i}"
@@ -4539,7 +4609,7 @@
4539
4609
  @error=${r=>{const n=r.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4540
4610
  @load=${r=>{const n=r.target,c=n.parentElement;n.src.includes("scaleflex/assets/file-types")&&(n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
4541
4611
  />
4542
- </div>`}_renderPreviews(){if(this.previews.length===0)return o.html`<div class="empty-preview"><ap-icon name="folder" .size=${48}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?o.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:o.html`
4612
+ </div>`}_renderPreviews(){if(this.previews.length===0)return o.html`<div class="empty-preview"><ap-icon name="inbox" .size=${64}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?o.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:o.html`
4543
4613
  <div class="preview-grid">
4544
4614
  <div class="preview-left">${this._renderPreviewImg(t[0])}</div>
4545
4615
  <div class="preview-right">
@@ -4554,14 +4624,10 @@
4554
4624
  <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"
4555
4625
  fill="#E3E8ED" rx="3" ry="3" />
4556
4626
  </svg>
4557
- <!-- Hover overlay with same folder shape -->
4558
- <svg class="hover-overlay" viewBox="0 0 100 100" preserveAspectRatio="none">
4559
- <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"
4560
- fill="#F3F7FA" />
4561
- </svg>
4562
4627
  <div class="card-content">
4563
4628
  <!-- Preview images -->
4564
4629
  <div class="preview-container">
4630
+ <div class="preview-overlay"></div>
4565
4631
  ${this._renderPreviews()}
4566
4632
  </div>
4567
4633
  <!-- Info section inside the card shape -->
@@ -4574,7 +4640,7 @@
4574
4640
  </div>
4575
4641
  </div>
4576
4642
  </div>
4577
- `}};Be.styles=[J,o.css`
4643
+ `}};Ue.styles=[J,o.css`
4578
4644
  :host {
4579
4645
  display: block;
4580
4646
  }
@@ -4583,9 +4649,6 @@
4583
4649
  aspect-ratio: 4/3;
4584
4650
  cursor: pointer;
4585
4651
  }
4586
- .card:hover .hover-overlay {
4587
- opacity: 0.9;
4588
- }
4589
4652
  /* Folder shape SVG fills card */
4590
4653
  .folder-svg {
4591
4654
  position: absolute;
@@ -4593,27 +4656,32 @@
4593
4656
  width: 100%;
4594
4657
  height: 100%;
4595
4658
  }
4596
- .hover-overlay {
4659
+ .preview-overlay {
4597
4660
  position: absolute;
4598
4661
  inset: 0;
4599
- width: 100%;
4600
- height: 100%;
4601
4662
  z-index: 2;
4663
+ background: rgba(0, 0, 0, 0.4);
4664
+ border-radius: 4px;
4602
4665
  opacity: 0;
4603
- transition: opacity 200ms;
4666
+ transition: opacity 150ms;
4604
4667
  pointer-events: none;
4605
4668
  }
4669
+ .card:hover .preview-overlay {
4670
+ opacity: 1;
4671
+ }
4606
4672
  .card-content {
4607
4673
  position: absolute;
4608
4674
  top: 16%;
4609
4675
  left: 3.5%;
4610
4676
  width: 93%;
4611
- bottom: 3%;
4677
+ bottom: 0;
4612
4678
  z-index: 1;
4613
4679
  display: flex;
4614
4680
  flex-direction: column;
4681
+ padding-bottom: 12px;
4615
4682
  }
4616
4683
  .preview-container {
4684
+ position: relative;
4617
4685
  flex: 1;
4618
4686
  min-height: 0;
4619
4687
  display: flex;
@@ -4679,7 +4747,9 @@
4679
4747
  justify-content: center;
4680
4748
  width: 100%;
4681
4749
  height: 100%;
4682
- color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4750
+ background: var(--ap-muted, oklch(0.974 0.006 239.819));
4751
+ border-radius: 4px;
4752
+ color: var(--ap-input, oklch(0.871 0.016 241.798));
4683
4753
  }
4684
4754
  .info {
4685
4755
  flex-shrink: 0;
@@ -4697,11 +4767,12 @@
4697
4767
  display: flex;
4698
4768
  justify-content: space-between;
4699
4769
  font-size: 0.75rem;
4700
- color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4701
- margin-top: 2px;
4770
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
4771
+ margin-top: 6px;
4702
4772
  }
4703
- `];It([l.property({type:Object})],Be.prototype,"folder",2);It([l.property({type:Array})],Be.prototype,"previews",2);Be=It([l.customElement("ap-folder-card")],Be);var Hi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ki(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Hi(e,s,a),a};let it=class extends o.LitElement{_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?o.html`
4773
+ `];It([l.property({type:Object})],Ue.prototype,"folder",2);It([l.property({type:Array})],Ue.prototype,"previews",2);Ue=It([l.customElement("ap-folder-card")],Ue);var Hi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ki(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Hi(e,s,a),a};let it=class extends o.LitElement{_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?o.html`
4704
4774
  <div class="row" @click=${this._handleOpen}>
4775
+ <div></div>
4705
4776
  <div class="icon"><ap-icon name="folder" .size=${22}></ap-icon></div>
4706
4777
  <div class="name">${t.name}</div>
4707
4778
  <div class="meta">Folder</div>
@@ -4715,7 +4786,7 @@
4715
4786
  }
4716
4787
  .row {
4717
4788
  display: grid;
4718
- grid-template-columns: 48px 1fr 100px 200px 120px 60px;
4789
+ grid-template-columns: 32px 48px 1fr 100px 200px 120px 60px;
4719
4790
  gap: 12px;
4720
4791
  padding: 8px 12px;
4721
4792
  align-items: center;
@@ -4727,19 +4798,19 @@
4727
4798
  background: var(--ap-muted, oklch(0.974 0.006 239.819));
4728
4799
  }
4729
4800
  .icon {
4730
- color: var(--ap-primary, oklch(0.578 0.198 268.129));
4801
+ color: var(--ap-input, oklch(0.871 0.016 241.798));
4731
4802
  display: flex;
4732
4803
  align-items: center;
4733
4804
  justify-content: center;
4734
4805
  }
4735
4806
  .name {
4736
4807
  font-size: var(--ap-font-size-sm, 0.875rem);
4737
- font-weight: 500;
4808
+ font-weight: 400;
4738
4809
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
4739
4810
  }
4740
4811
  .meta {
4741
4812
  font-size: 0.8125rem;
4742
- color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4813
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
4743
4814
  }
4744
4815
  `;_s([l.property({type:Object})],it.prototype,"folder",2);it=_s([l.customElement("ap-folder-row")],it);var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,ys=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gi(e,s,a),a};let rt=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid"}render(){return this.variant==="grid"?o.html`
4745
4816
  <div class="grid-skeleton">
@@ -4765,7 +4836,7 @@
4765
4836
  .grid-skeleton {
4766
4837
  display: grid;
4767
4838
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
4768
- gap: 20px 24px;
4839
+ gap: 24px;
4769
4840
  }
4770
4841
  .card-skel {
4771
4842
  aspect-ratio: 6/4;
@@ -4823,7 +4894,7 @@
4823
4894
  `)}
4824
4895
  </div>
4825
4896
  </div>
4826
- `}_getFileInfoRows(t){var s,i,a,r,n;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:Lt(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:ms(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}`}),(r=t.info)!=null&&r.duration&&e.push({label:"Duration",value:`${Math.round(t.info.duration)}s`}),(n=t.info)!=null&&n.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:at(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:at(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 r,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 f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}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 f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}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?o.nothing:o.html`
4897
+ `}_getFileInfoRows(t){var s,i,a,r,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:Lt(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:ms(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}`}),(((r=t.info)==null?void 0:r.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:at(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:at(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 r,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 f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;i.add(u.key),u.slug&&i.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(i.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}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 f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;i.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;i.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}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?o.nothing:o.html`
4827
4898
  <div class="meta-row" style="flex-direction:column;gap:6px">
4828
4899
  <span class="meta-label">Labels</span>
4829
4900
  <div class="tags-list">
@@ -4838,7 +4909,7 @@
4838
4909
  </div>
4839
4910
  </div>
4840
4911
  `}_renderTagsRow(t){const e=this._getTagEntries(t.tags);return e.length===0?o.nothing:o.html`
4841
- <div class="meta-row" style="flex-direction:column;gap:6px">
4912
+ <div class="meta-row">
4842
4913
  <span class="meta-label">Tags</span>
4843
4914
  <div class="tags-list">
4844
4915
  ${e.map(s=>o.html`
@@ -4846,17 +4917,18 @@
4846
4917
  `)}
4847
4918
  </div>
4848
4919
  </div>
4849
- `}render(){var j,S,L,D,se,ce,we,Ge;const t=this.asset;if(!t)return o.nothing;const e=Se(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((j=t.extension)==null?void 0:j.toLowerCase())==="pdf",n=ut(t.extension||""),c=Pt(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=st(t),u=s?d?((L=t.url)==null?void 0:L.cdn)||"":h||Fe(((D=t.url)==null?void 0:D.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((se=t.url)==null?void 0:se.cdn)||"",v=i&&(((ce=t.info)==null?void 0:ce.video_thumbnail)||((we=t.info)==null?void 0:we.preview))||"",$=r&&!s?Ot(t):"",b=this._getCurrentIndex(),k=b>0&&this._findNavTarget(b,-1)>=0,w=b>=0&&this._findNavTarget(b,1)>=0,T=this.assets.length>1;return o.html`
4920
+ `}render(){var j,S,L,D,se,ce,we,Ge;const t=this.asset;if(!t)return o.nothing;const e=Se(t.type),s=e==="image",i=e==="video",a=e==="audio",r=((j=t.extension)==null?void 0:j.toLowerCase())==="pdf",n=ut(t.extension||""),c=Pt(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=st(t),u=s?d?((L=t.url)==null?void 0:L.cdn)||"":h||Fe(((D=t.url)==null?void 0:D.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((se=t.url)==null?void 0:se.cdn)||"",v=i&&(((ce=t.info)==null?void 0:ce.video_thumbnail)||((we=t.info)==null?void 0:we.preview))||"",x=r&&!s?Ot(t):"",b=this._getCurrentIndex(),k=b>0&&this._findNavTarget(b,-1)>=0,$=b>=0&&this._findNavTarget(b,1)>=0,F=this.assets.length>1;return o.html`
4850
4921
  <div class="panel">
4851
4922
  <div class="panel-header">
4852
4923
  <span class="panel-title" title=${t.name}>${t.name}</span>
4853
4924
  <div class="header-actions">
4854
- <button class="icon-btn" @click=${this._fullscreen} ?disabled=${!s&&!i&&!a&&!r} aria-label="Fullscreen">
4925
+ <button class="icon-btn" @click=${this._fullscreen} ?disabled=${!s&&!i&&!a&&!r} aria-label="Fullscreen" title="Full screen">
4855
4926
  <ap-icon name="fullscreen" .size=${16}></ap-icon>
4856
4927
  </button>
4857
- <button class="icon-btn ${this.asset&&this.selectedIds.includes(this.asset.uuid)?"selected":""}" @click=${this._select} aria-label="Select">
4928
+ <button class="icon-btn ${this.asset&&this.selectedIds.includes(this.asset.uuid)?"selected":""}" @click=${this._select} aria-label="Select" title="Select the asset">
4858
4929
  <ap-icon name="select" .size=${16}></ap-icon>
4859
4930
  </button>
4931
+ <div class="header-divider"></div>
4860
4932
  <button class="icon-btn" @click=${this._close} aria-label="Close">
4861
4933
  <ap-icon name="close" .size=${16}></ap-icon>
4862
4934
  </button>
@@ -4864,11 +4936,11 @@
4864
4936
  </div>
4865
4937
 
4866
4938
  <div class="preview-area ${s&&c?"chess":""}">
4867
- ${T?o.html`
4939
+ ${F?o.html`
4868
4940
  <button class="nav-btn prev" @click=${this._prev} ?disabled=${!k} aria-label="Previous">
4869
4941
  <ap-icon name="chevron-left" .size=${16}></ap-icon>
4870
4942
  </button>
4871
- <button class="nav-btn next" @click=${this._next} ?disabled=${!w} aria-label="Next">
4943
+ <button class="nav-btn next" @click=${this._next} ?disabled=${!$} aria-label="Next">
4872
4944
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
4873
4945
  </button>
4874
4946
  `:o.nothing}
@@ -4903,13 +4975,13 @@
4903
4975
  />
4904
4976
  </div>
4905
4977
  `:o.nothing}
4906
- ${i?o.html`<video src=${g} poster=${v||o.nothing} controls @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
4978
+ ${i?o.html`<video src=${g} poster=${v||o.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
4907
4979
  ${a?o.html`<audio src=${((Ge=t.url)==null?void 0:Ge.cdn)||""} controls></audio>`:o.nothing}
4908
4980
  ${r&&!s?o.html`
4909
4981
  <img
4910
- src=${$||n}
4982
+ src=${x||n}
4911
4983
  alt=${t.name}
4912
- class=${$?"":"icon-fallback"}
4984
+ class=${x?"":"icon-fallback"}
4913
4985
  @error=${de=>{const pe=de.target;pe.src!==n&&(pe.src=n,pe.classList.add("icon-fallback"))}}
4914
4986
  />
4915
4987
  `:o.nothing}
@@ -4946,11 +5018,13 @@
4946
5018
  display: flex;
4947
5019
  align-items: center;
4948
5020
  justify-content: space-between;
4949
- padding: 16px;
4950
- border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
5021
+ gap: 12px;
5022
+ height: 50px;
5023
+ min-height: 50px;
5024
+ padding: 0 16px;
4951
5025
  }
4952
5026
  .panel-title {
4953
- font-size: var(--ap-font-size-base, 1rem);
5027
+ font-size: 14px;
4954
5028
  font-weight: 600;
4955
5029
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
4956
5030
  white-space: nowrap;
@@ -4960,8 +5034,15 @@
4960
5034
  }
4961
5035
  .header-actions {
4962
5036
  display: flex;
5037
+ align-items: center;
4963
5038
  gap: 4px;
4964
5039
  }
5040
+ .header-divider {
5041
+ width: 1px;
5042
+ height: 16px;
5043
+ background: var(--ap-border, oklch(92.86% 0.009 247.92));
5044
+ margin: 0 2px;
5045
+ }
4965
5046
  .icon-btn {
4966
5047
  display: flex;
4967
5048
  align-items: center;
@@ -5156,7 +5237,7 @@
5156
5237
  .tags-list {
5157
5238
  display: flex;
5158
5239
  flex-wrap: wrap;
5159
- gap: 4px;
5240
+ gap: 8px;
5160
5241
  }
5161
5242
  .tag-link {
5162
5243
  cursor: pointer;
@@ -5166,9 +5247,6 @@
5166
5247
  opacity: 0.75;
5167
5248
  }
5168
5249
  /* Accordion styles */
5169
- .accordion {
5170
- border-top: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
5171
- }
5172
5250
  .accordion-trigger {
5173
5251
  display: flex;
5174
5252
  align-items: center;
@@ -5205,10 +5283,6 @@
5205
5283
  display: flex;
5206
5284
  gap: 12px;
5207
5285
  padding: 6px 0;
5208
- border-bottom: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
5209
- }
5210
- .meta-row:last-child {
5211
- border-bottom: none;
5212
5286
  }
5213
5287
  .meta-label {
5214
5288
  font-size: 0.8125rem;
@@ -5230,31 +5304,54 @@
5230
5304
  .panel { animation: none; }
5231
5305
  .accordion-chevron { transition: none; }
5232
5306
  }
5233
- `;O([l.property({type:Object})],M.prototype,"asset",2);O([l.property({type:Array})],M.prototype,"assets",2);O([l.property({type:Array})],M.prototype,"selectedIds",2);O([l.property()],M.prototype,"containerToken",2);O([l.property({type:Boolean})],M.prototype,"showMetadata",2);O([l.property({type:Array})],M.prototype,"metadataFields",2);O([l.property({type:Array})],M.prototype,"labels",2);O([l.property({type:Object})],M.prototype,"regionalFilters",2);O([l.property({type:Boolean})],M.prototype,"multiSelect",2);O([l.query(".preview-area")],M.prototype,"previewArea",2);O([l.query("video")],M.prototype,"_videoEl",2);O([l.state()],M.prototype,"_isFullscreen",2);O([l.state()],M.prototype,"_fsImageLoaded",2);O([l.state()],M.prototype,"_previewLoading",2);O([l.state()],M.prototype,"_openSections",2);M=O([l.customElement("ap-preview-panel")],M);var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,Le=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zi(e,s,a),a};let oe=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.totalCount=0,this.isSelectingAll=!1,this.multiSelect=!0}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0}))}render(){return this.selectedAssets.length===0?o.nothing:o.html`
5307
+ `;O([l.property({type:Object})],M.prototype,"asset",2);O([l.property({type:Array})],M.prototype,"assets",2);O([l.property({type:Array})],M.prototype,"selectedIds",2);O([l.property()],M.prototype,"containerToken",2);O([l.property({type:Boolean})],M.prototype,"showMetadata",2);O([l.property({type:Array})],M.prototype,"metadataFields",2);O([l.property({type:Array})],M.prototype,"labels",2);O([l.property({type:Object})],M.prototype,"regionalFilters",2);O([l.property({type:Boolean})],M.prototype,"multiSelect",2);O([l.query(".preview-area")],M.prototype,"previewArea",2);O([l.query("video")],M.prototype,"_videoEl",2);O([l.state()],M.prototype,"_isFullscreen",2);O([l.state()],M.prototype,"_fsImageLoaded",2);O([l.state()],M.prototype,"_previewLoading",2);O([l.state()],M.prototype,"_openSections",2);M=O([l.customElement("ap-preview-panel")],M);var Zi=Object.defineProperty,Ji=Object.getOwnPropertyDescriptor,Dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zi(e,s,a),a};const er={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 Be=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=er[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?o.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?o.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:o.svg`<path d=${a.d}></path>`});return o.html`
5308
+ <svg
5309
+ style="--icon-size: ${this.size}px"
5310
+ viewBox="0 0 24 24"
5311
+ fill="none"
5312
+ stroke="currentColor"
5313
+ stroke-width="2"
5314
+ stroke-linecap="round"
5315
+ stroke-linejoin="round"
5316
+ >
5317
+ ${e}
5318
+ </svg>
5319
+ `}};Be.styles=[o.css`
5320
+ :host {
5321
+ display: inline-flex;
5322
+ align-items: center;
5323
+ justify-content: center;
5324
+ }
5325
+ svg {
5326
+ width: var(--icon-size, 20px);
5327
+ height: var(--icon-size, 20px);
5328
+ }
5329
+ `];Dt([l.property()],Be.prototype,"name",2);Dt([l.property({type:Number})],Be.prototype,"size",2);Be=Dt([l.customElement("ap-icon")],Be);var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,Le=(t,e,s,i)=>{for(var a=i>1?void 0:i?sr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&tr(e,s,a),a};let oe=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.totalCount=0,this.isSelectingAll=!1,this.multiSelect=!0}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0}))}render(){return this.selectedAssets.length===0?o.nothing:o.html`
5234
5330
  <div class="bar">
5235
5331
  <span class="count">${this.selectedAssets.length} selected</span>
5332
+ <span class="divider"></span>
5236
5333
  <span class="select-label">Select:</span>
5237
5334
  ${this.multiSelect&&this.selectedAssets.length<this.totalCount&&(!this.maxSelections||this.selectedAssets.length<this.maxSelections)?o.html`<button
5238
- class="bar-link"
5335
+ class="bar-btn"
5239
5336
  ?disabled=${this.isSelectingAll}
5240
5337
  @click=${this._selectAll}
5241
- >${this.isSelectingAll?"Selecting...":this.maxSelections&&this.maxSelections<this.totalCount?`First ${this.maxSelections}`:"All assets"}</button>`:o.nothing}
5242
- <button class="bar-link" @click=${this._clear}>None</button>
5338
+ ><ap-icon name="check-check" .size=${14}></ap-icon>${this.isSelectingAll?"Selecting...":this.maxSelections&&this.maxSelections<this.totalCount?`First ${this.maxSelections}`:"Select all"}</button>`:o.nothing}
5339
+ <button class="bar-btn" @click=${this._clear}><ap-icon name="close" .size=${14}></ap-icon>Deselect all</button>
5243
5340
  ${this.maxSelections&&this.selectedAssets.length>=this.maxSelections?o.html`<span class="limit-notice">Max ${this.maxSelections} allowed</span>`:o.nothing}
5244
5341
  <div class="spacer"></div>
5245
- <div class="actions">
5246
- <button class="btn btn-primary" @click=${this._confirm}>Confirm</button>
5247
- </div>
5342
+ <button class="btn-confirm" @click=${this._confirm}>Confirm</button>
5248
5343
  </div>
5249
5344
  `}};oe.styles=o.css`
5250
5345
  :host {
5251
5346
  display: block;
5347
+ padding: 0 8px 8px;
5252
5348
  }
5253
5349
  .bar {
5254
5350
  display: flex;
5255
5351
  align-items: center;
5256
5352
  padding: 12px 20px;
5257
5353
  background: var(--ap-primary, oklch(0.578 0.198 268.129));
5354
+ border-radius: var(--ap-radius-lg, 12px);
5258
5355
  animation: ap-bar-in 250ms ease-out;
5259
5356
  }
5260
5357
  @keyframes ap-bar-in {
@@ -5267,31 +5364,42 @@
5267
5364
  color: var(--ap-primary-foreground, oklch(1 0 0));
5268
5365
  white-space: nowrap;
5269
5366
  }
5367
+ .divider {
5368
+ width: 1px;
5369
+ height: 20px;
5370
+ background: oklch(1 0 0 / 0.3);
5371
+ margin: 0 16px;
5372
+ flex-shrink: 0;
5373
+ }
5270
5374
  .select-label {
5271
5375
  font-size: var(--ap-font-size-sm, 0.875rem);
5272
5376
  color: oklch(1 0 0 / 0.7);
5273
- margin-left: 24px;
5274
5377
  white-space: nowrap;
5275
5378
  }
5276
- .bar-link {
5379
+ .bar-btn {
5380
+ display: inline-flex;
5381
+ align-items: center;
5382
+ gap: 6px;
5383
+ height: 32px;
5277
5384
  font-size: var(--ap-font-size-sm, 0.875rem);
5278
5385
  color: var(--ap-primary-foreground, oklch(1 0 0));
5279
5386
  background: none;
5280
5387
  border: none;
5281
5388
  cursor: pointer;
5282
- padding: 0;
5389
+ padding: 0 14px;
5283
5390
  margin-left: 8px;
5284
- font-weight: 600;
5391
+ font-weight: 500;
5285
5392
  font-family: var(--ap-font-family, system-ui, sans-serif);
5286
5393
  white-space: nowrap;
5394
+ border-radius: var(--ap-radius-sm, 6px);
5395
+ transition: background 100ms;
5287
5396
  }
5288
- .bar-link:hover {
5289
- text-decoration: underline;
5397
+ .bar-btn:hover {
5398
+ background: oklch(1 0 0 / 0.1);
5290
5399
  }
5291
- .bar-link:disabled {
5400
+ .bar-btn:disabled {
5292
5401
  opacity: 0.5;
5293
5402
  cursor: default;
5294
- text-decoration: none;
5295
5403
  }
5296
5404
  .limit-notice {
5297
5405
  font-size: var(--ap-font-size-xs, 0.75rem);
@@ -5302,37 +5410,30 @@
5302
5410
  .spacer {
5303
5411
  flex: 1;
5304
5412
  }
5305
- .actions {
5306
- display: flex;
5307
- gap: 8px;
5308
- }
5309
- .btn {
5310
- padding: 8px 20px;
5311
- border: none;
5413
+ .btn-confirm {
5414
+ padding: 8px 24px;
5415
+ border: 1.5px solid var(--ap-primary-foreground, oklch(1 0 0));
5312
5416
  border-radius: var(--ap-radius-sm, 6px);
5313
5417
  font-size: var(--ap-font-size-sm, 0.875rem);
5314
5418
  font-weight: 500;
5315
5419
  cursor: pointer;
5316
- transition: opacity 100ms;
5420
+ transition: background 100ms;
5317
5421
  font-family: var(--ap-font-family, system-ui, sans-serif);
5318
- }
5319
- .btn:hover {
5320
- opacity: 0.9;
5321
- }
5322
- .btn-primary {
5323
5422
  background: transparent;
5324
5423
  color: var(--ap-primary-foreground, oklch(1 0 0));
5325
- border: 1px solid var(--ap-primary-foreground, oklch(1 0 0));
5424
+ }
5425
+ .btn-confirm:hover {
5426
+ background: oklch(1 0 0 / 0.1);
5326
5427
  }
5327
5428
  @media (prefers-reduced-motion: reduce) {
5328
5429
  .bar { animation: none; }
5329
5430
  }
5330
- `;Le([l.property({type:Array})],oe.prototype,"selectedAssets",2);Le([l.property({type:Number})],oe.prototype,"totalCount",2);Le([l.property({type:Boolean})],oe.prototype,"isSelectingAll",2);Le([l.property({type:Boolean})],oe.prototype,"multiSelect",2);Le([l.property({type:Number})],oe.prototype,"maxSelections",2);oe=Le([l.customElement("ap-selection-bar")],oe);var er=Object.defineProperty,tr=Object.getOwnPropertyDescriptor,Dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?tr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&er(e,s,a),a};let Ue=class extends o.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?o.nothing:o.html`
5431
+ `;Le([l.property({type:Array})],oe.prototype,"selectedAssets",2);Le([l.property({type:Number})],oe.prototype,"totalCount",2);Le([l.property({type:Boolean})],oe.prototype,"isSelectingAll",2);Le([l.property({type:Boolean})],oe.prototype,"multiSelect",2);Le([l.property({type:Number})],oe.prototype,"maxSelections",2);oe=Le([l.customElement("ap-selection-bar")],oe);var ar=Object.defineProperty,ir=Object.getOwnPropertyDescriptor,zt=(t,e,s,i)=>{for(var a=i>1?void 0:i?ir(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ar(e,s,a),a};let Ve=class extends o.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?o.nothing:o.html`
5331
5432
  <div
5332
5433
  class="marquee"
5333
5434
  style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
5334
5435
  ></div>
5335
- `}};Ue.styles=o.css`
5436
+ `}};Ve.styles=o.css`
5336
5437
  :host {
5337
5438
  display: block;
5338
5439
  position: absolute;
@@ -5349,29 +5450,7 @@
5349
5450
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
5350
5451
  border-radius: 2px;
5351
5452
  }
5352
- `;Dt([l.property({type:Boolean})],Ue.prototype,"active",2);Dt([l.property({type:Object})],Ue.prototype,"rect",2);Ue=Dt([l.customElement("ap-marquee-overlay")],Ue);var sr=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,zt=(t,e,s,i)=>{for(var a=i>1?void 0:i?ar(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sr(e,s,a),a};const ir={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",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",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"}}],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 Ve=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=ir[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?o.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?o.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:o.svg`<path d=${a.d}></path>`});return o.html`
5353
- <svg
5354
- style="--icon-size: ${this.size}px"
5355
- viewBox="0 0 24 24"
5356
- fill="none"
5357
- stroke="currentColor"
5358
- stroke-width="2"
5359
- stroke-linecap="round"
5360
- stroke-linejoin="round"
5361
- >
5362
- ${e}
5363
- </svg>
5364
- `}};Ve.styles=[o.css`
5365
- :host {
5366
- display: inline-flex;
5367
- align-items: center;
5368
- justify-content: center;
5369
- }
5370
- svg {
5371
- width: var(--icon-size, 20px);
5372
- height: var(--icon-size, 20px);
5373
- }
5374
- `];zt([l.property()],Ve.prototype,"name",2);zt([l.property({type:Number})],Ve.prototype,"size",2);Ve=zt([l.customElement("ap-icon")],Ve);var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&rr(e,s,a),a};let ot=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};ot.styles=[o.css`
5453
+ `;zt([l.property({type:Boolean})],Ve.prototype,"active",2);zt([l.property({type:Object})],Ve.prototype,"rect",2);Ve=zt([l.customElement("ap-marquee-overlay")],Ve);var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&rr(e,s,a),a};let ot=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};ot.styles=[o.css`
5375
5454
  :host {
5376
5455
  display: inline-flex;
5377
5456
  }
@@ -5411,6 +5490,9 @@
5411
5490
  transition: all 150ms;
5412
5491
  background: var(--ap-background, oklch(1 0 0));
5413
5492
  }
5493
+ :host(:hover) .box {
5494
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
5495
+ }
5414
5496
  :host([checked]) .box {
5415
5497
  background: var(--ap-primary, oklch(0.578 0.198 268.129));
5416
5498
  border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
@@ -5441,9 +5523,14 @@
5441
5523
  pointer-events: none;
5442
5524
  }
5443
5525
  .label {
5444
- margin-left: 8px;
5526
+ margin-left: var(--ap-checkbox-gap, 8px);
5445
5527
  font-size: var(--ap-font-size-sm, 0.875rem);
5446
5528
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5529
+ display: inline-flex;
5530
+ align-items: center;
5531
+ }
5532
+ .label[hidden] {
5533
+ display: none;
5447
5534
  }
5448
5535
  `];gt([l.property({type:Boolean,reflect:!0})],Ae.prototype,"checked",2);gt([l.property({type:Boolean,reflect:!0})],Ae.prototype,"indeterminate",2);gt([l.property({type:Boolean,reflect:!0})],Ae.prototype,"disabled",2);Ae=gt([l.customElement("ap-checkbox")],Ae);var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?dr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cr(e,s,a),a};let nt=class extends o.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return o.html`
5449
5536
  <slot name="trigger" @click=${()=>this.open=!this.open}></slot>
@@ -5519,8 +5606,10 @@
5519
5606
  display: flex;
5520
5607
  align-items: center;
5521
5608
  gap: 8px;
5609
+ width: 100%;
5522
5610
  height: 36px;
5523
5611
  padding: 0 12px;
5612
+ box-sizing: border-box;
5524
5613
  border: 1px solid var(--ap-input, oklch(0.871 0.016 241.798));
5525
5614
  border-radius: var(--ap-radius-sm, 6px);
5526
5615
  background: var(--ap-background, oklch(1 0 0));
@@ -5595,12 +5684,13 @@
5595
5684
  .badge {
5596
5685
  display: inline-flex;
5597
5686
  align-items: center;
5598
- padding: 2px 8px;
5687
+ height: 24px;
5688
+ padding: 0 8px;
5599
5689
  font-size: 0.75rem;
5600
5690
  font-weight: 500;
5601
5691
  border-radius: 9999px;
5602
5692
  background: var(--ap-muted, oklch(0.974 0.006 239.819));
5603
- color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
5693
+ color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
5604
5694
  }
5605
5695
  :host([variant="primary"]) .badge {
5606
5696
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
@@ -5692,6 +5782,9 @@
5692
5782
  background: transparent;
5693
5783
  transition: background 150ms;
5694
5784
  }
5785
+ .option:hover .radio {
5786
+ border-color: var(--ap-secondary-foreground-50, oklch(53.03% 0.039 249.89 / 0.5));
5787
+ }
5695
5788
  .option[aria-checked="true"] .radio {
5696
5789
  border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
5697
5790
  }
@@ -5704,7 +5797,7 @@
5704
5797
  font-family: inherit;
5705
5798
  user-select: none;
5706
5799
  }
5707
- `];Pe([l.property()],ne.prototype,"value",2);Pe([l.property({type:Array})],ne.prototype,"options",2);Pe([l.property({type:Boolean})],ne.prototype,"disabled",2);Pe([l.property({reflect:!0})],ne.prototype,"direction",2);Pe([l.property({reflect:!0})],ne.prototype,"columns",2);ne=Pe([l.customElement("ap-radio-group")],ne);var _r=Object.defineProperty,Rt=(t,e,s,i)=>{for(var a=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=n(e,s,a)||a);return a&&_r(e,s,a),a};const Nt=class Nt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!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=Ls(),this.storeCtrl=new Ps(this,this.store),this.selectionCtrl=new Is(this,this.store),this.infiniteScrollCtrl=new Ds(this,()=>this._loadMore()),this.marqueeCtrl=new zs(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}connectedCallback(){super.connectedCallback()}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){this._initFailed=!1,this._initPromise=this._doInit(e).catch(()=>{this._initFailed=!0}),e.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Sa(),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&&Fa()||e.defaultViewMode||"grid",sortBy:i,sortDirection:a,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new Rs(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await qs(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,c]=await Promise.allSettled([oa(this.apiClient),Us(this.apiClient),Vs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:v,brandColor:$}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:v,...$?{brandColor:$}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),c.status==="fulfilled"&&this.store.setState({tags:c.value});const{pinnedFilters:d,pinnedMetadata:h}=wa(e.auth.projectToken??null),u=this.store.getState().filters;this.store.setState({filters:{...u,pinned:d,visible:[...d],metadata:{...u.metadata,pinned:h,visible:[...h]}}});const f=e.brandColor||this.store.getState().brandColor;f&&(this.store.setState({brandColor:f}),Pa(this,f))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return 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,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}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=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 u,f,p,g,v,$,b;const e=this.store.getState(),s=De((u=this.config)==null?void 0:u.forcedFilters),i=new Set(Object.keys(s)),a={},r=De((f=this.config)==null?void 0:f.defaultFilters);for(const[k,w]of Object.entries(r))i.has(k)||(a[k]=w);const n=Object.keys(a),c=((p=this.config)==null?void 0:p.tabs)??["assets","folders"],d=(g=this.config)!=null&&g.rememberLastTab?Ta():null,h=(d&&c.includes(d)?d:null)??((v=this.config)!=null&&v.defaultTab&&c.includes(this.config.defaultTab)?this.config.defaultTab:null)??c[0]??"assets";this.store.setState({isOpen:!0,activeTab:h,searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...n])],applied:a},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:(($=this.config)==null?void 0:$.rememberLastFolder)&&Ca()||((b=this.config)==null?void 0:b.rootFolderPath)||"/",breadcrumb:[],selectedAssets:new Map,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}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,c,d,h,u,f,p,g,v,$,b;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const k=s.activeTab;if(k==="assets"){const w=this._buildSearchNotation(),T=s.currentFolderPath||"/",j=Ye(this.apiClient,{folder:T,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:w||void 0,recursive:1}),S=Vt(this.apiClient,{folder:T,q:w||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[L,D]=await Promise.all([j,S]);if(e!==this._loadId)return;const se=((i=L.files)==null?void 0:i.length)??0,ce=se>=s.limit,we=((a=D==null?void 0:D.stats)==null?void 0:a.approx_files_count)??((r=D==null?void 0:D.info)==null?void 0:r.total_files_count)??((n=L.info)==null?void 0:n.total_files_count)??((d=(c=L.base)==null?void 0:c.count)==null?void 0:d.files_recursive)??((u=(h=L.base)==null?void 0:h.count)==null?void 0:u.files_direct)??se;this.store.setState({assets:L.files||[],folders:[],totalCount:we,totalFolderCount:0,offset:0,hasMore:ce,isLoading:!1})}else if(k==="folders"){const w=this._buildSearchNotation(),T=s.currentFolderPath||"/",[j,S,L]=await Promise.all([js(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ye(this.apiClient,{folder:T,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:w||void 0,recursive:0}),Vt(this.apiClient,{folder:T,q:w||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const D=j.folders||[];let se={};if(D.length>0)try{se=await Bs(this.apiClient,D.map(de=>de.uuid))}catch{}if(e!==this._loadId)return;const ce=((f=S.files)==null?void 0:f.length)??0,we=ce>=s.limit,Ge=((p=L==null?void 0:L.stats)==null?void 0:p.approx_files_count)??((g=L==null?void 0:L.info)==null?void 0:g.total_files_count)??((v=S.info)==null?void 0:v.total_files_count)??((b=($=S.base)==null?void 0:$.count)==null?void 0:b.files_direct)??ce;this.store.setState({assets:S.files||[],folders:D,folderPreviews:se,totalCount:Ge,totalFolderCount:j.total??D.length,offset:0,hasMore:we,isLoading:!1})}}catch(k){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:k,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const a=this._buildSearchNotation(),r=await Ye(this.apiClient,{folder:e.currentFolderPath||"/",offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,c=r.files||[],d=c.length>=e.limit,h=[...n,...c];this.store.setState({assets:h,offset:i,hasMore:d,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){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Ea(s),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:[]}),Wt(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:[]}),Wt(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Aa(s),this.store.setState({activeTab:s,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)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i,a;const s=e.detail.asset;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&Qt(a),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(),a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?i.breadcrumb.slice(0,a+1):[],n=r.length>0?r[r.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Qt(n),this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var i,a;const s=e.detail.assets;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleSelectAll(){var i;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((i=e.config)==null?void 0:i.multiSelect)??!0))){if(e.assets.length>=e.totalCount){this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const a=this._buildSearchNotation(),r=e.currentFolderPath||"/",n=e.limit,c=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=c.length;b<d;b+=n)u.push(b);const f=4,p=[];for(let b=0;b<u.length;b+=f){const k=u.slice(b,b+f),w=await Promise.all(k.map(T=>Ye(this.apiClient,{folder:r,offset:T,limit:n,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:h})));for(const T of w)T.files&&p.push(...T.files)}const g=new Set(c.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),$=[...c,...v];this.store.setState({assets:$,offset:Math.max(0,$.length-n),hasMore:!1,isSelectingAll:!1}),this.selectionCtrl.selectAll($)}catch(a){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a,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===m.DATE||e===m.LICENSE_EXPIRY||e===z.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:f}=i;c=!d&&!h&&!u&&!f}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===m.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 r,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,r,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,r,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,g,v;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!r)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 $=a.renderRoot.querySelectorAll(".chip.pinned-empty"),b=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const k of $){const w=(v=(g=k.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:v.trim();if(i&&w===b){n=k;break}if(s&&w===(ke[s]||s)){n=k;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,f=h?c.bottom-h.top:void 0;i?r.openMetadataFieldPanel(i,!0,u,f):s&&r.openFilterPanel(s,!0,u,f)}_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},r={...a.applied};delete r[s],a.applied=r,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:r}=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(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:r},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 f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(c=>c!==s)),a.metadata=r,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,r={...this.store.getState().filters};i?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;$a(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,r={...this.store.getState().filters},n={...r.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))),r.metadata=n,this.store.setState({filters:r});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;ka(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(r=>r!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata};r.visible=r.visible.filter(n=>n!==s),a.metadata=r,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,r={...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];r.applied=c;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],i){const u={...r.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Ia:e.activeTab==="folders"?Da:At}_buildSearchNotation(){var a;const e=this.store.getState(),s={...De((a=this.config)==null?void 0:a.forcedFilters),...e.filters.applied};return ca(s,e.filters.metadata.applied).join(" ")}render(){var h,u,f,p,g,v,$,b;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=this.selectionCtrl.getSelectedAssets(),a=o.html`
5800
+ `];Pe([l.property()],ne.prototype,"value",2);Pe([l.property({type:Array})],ne.prototype,"options",2);Pe([l.property({type:Boolean})],ne.prototype,"disabled",2);Pe([l.property({reflect:!0})],ne.prototype,"direction",2);Pe([l.property({reflect:!0})],ne.prototype,"columns",2);ne=Pe([l.customElement("ap-radio-group")],ne);var _r=Object.defineProperty,Rt=(t,e,s,i)=>{for(var a=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=n(e,s,a)||a);return a&&_r(e,s,a),a};const Nt=class Nt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!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=Ls(),this.storeCtrl=new Ps(this,this.store),this.selectionCtrl=new Is(this,this.store),this.infiniteScrollCtrl=new Ds(this,()=>this._loadMore()),this.marqueeCtrl=new zs(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}connectedCallback(){super.connectedCallback()}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){this._initFailed=!1,this._initPromise=this._doInit(e).catch(()=>{this._initFailed=!0}),e.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Sa(),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&&Fa()||e.defaultViewMode||"grid",sortBy:i,sortDirection:a,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new Rs(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await qs(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,c]=await Promise.allSettled([oa(this.apiClient),Bs(this.apiClient),Vs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:v,brandColor:x}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:v,...x?{brandColor:x}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),c.status==="fulfilled"&&this.store.setState({tags:c.value});const{pinnedFilters:d,pinnedMetadata:h}=wa(e.auth.projectToken??null),u=this.store.getState().filters;this.store.setState({filters:{...u,pinned:d,visible:[...d],metadata:{...u.metadata,pinned:h,visible:[...h]}}});const f=e.brandColor||this.store.getState().brandColor;f&&(this.store.setState({brandColor:f}),Pa(this,f))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return 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,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}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=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 u,f,p,g,v,x,b;const e=this.store.getState(),s=De((u=this.config)==null?void 0:u.forcedFilters),i=new Set(Object.keys(s)),a={},r=De((f=this.config)==null?void 0:f.defaultFilters);for(const[k,$]of Object.entries(r))i.has(k)||(a[k]=$);const n=Object.keys(a),c=((p=this.config)==null?void 0:p.tabs)??["assets","folders"],d=(g=this.config)!=null&&g.rememberLastTab?Ta():null,h=(d&&c.includes(d)?d:null)??((v=this.config)!=null&&v.defaultTab&&c.includes(this.config.defaultTab)?this.config.defaultTab:null)??c[0]??"assets";this.store.setState({isOpen:!0,activeTab:h,searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...n])],applied:a},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:((x=this.config)==null?void 0:x.rememberLastFolder)&&Ca()||((b=this.config)==null?void 0:b.rootFolderPath)||"/",breadcrumb:[],selectedAssets:new Map,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}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,r,n,c,d,h,u,f,p,g,v,x,b;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const k=s.activeTab;if(k==="assets"){const $=this._buildSearchNotation(),F=s.currentFolderPath||"/",j=Ye(this.apiClient,{folder:F,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:1}),S=Vt(this.apiClient,{folder:F,q:$||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[L,D]=await Promise.all([j,S]);if(e!==this._loadId)return;const se=((i=L.files)==null?void 0:i.length)??0,ce=se>=s.limit,we=((a=D==null?void 0:D.stats)==null?void 0:a.approx_files_count)??((r=D==null?void 0:D.info)==null?void 0:r.total_files_count)??((n=L.info)==null?void 0:n.total_files_count)??((d=(c=L.base)==null?void 0:c.count)==null?void 0:d.files_recursive)??((u=(h=L.base)==null?void 0:h.count)==null?void 0:u.files_direct)??se;this.store.setState({assets:L.files||[],folders:[],totalCount:we,totalFolderCount:0,offset:0,hasMore:ce,isLoading:!1})}else if(k==="folders"){const $=this._buildSearchNotation(),F=s.currentFolderPath||"/",[j,S,L]=await Promise.all([js(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ye(this.apiClient,{folder:F,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:0}),Vt(this.apiClient,{folder:F,q:$||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const D=j.folders||[];let se={};if(D.length>0)try{se=await Us(this.apiClient,D.map(de=>de.uuid))}catch{}if(e!==this._loadId)return;const ce=((f=S.files)==null?void 0:f.length)??0,we=ce>=s.limit,Ge=((p=L==null?void 0:L.stats)==null?void 0:p.approx_files_count)??((g=L==null?void 0:L.info)==null?void 0:g.total_files_count)??((v=S.info)==null?void 0:v.total_files_count)??((b=(x=S.base)==null?void 0:x.count)==null?void 0:b.files_direct)??ce;this.store.setState({assets:S.files||[],folders:D,folderPreviews:se,totalCount:Ge,totalFolderCount:j.total??D.length,offset:0,hasMore:we,isLoading:!1})}}catch(k){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:k,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const a=this._buildSearchNotation(),r=await Ye(this.apiClient,{folder:e.currentFolderPath||"/",offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,c=r.files||[],d=c.length>=e.limit,h=[...n,...c];this.store.setState({assets:h,offset:i,hasMore:d,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){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Ea(s),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:[]}),Wt(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:[]}),Wt(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Aa(s),this.store.setState({activeTab:s,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)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i,a;const s=e.detail.asset;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&Qt(a),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(),a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?i.breadcrumb.slice(0,a+1):[],n=r.length>0?r[r.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Qt(n),this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var i,a;const s=e.detail.assets;(a=(i=this.config)==null?void 0:i.onSelect)==null||a.call(i,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleSelectAll(){var i;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((i=e.config)==null?void 0:i.multiSelect)??!0))){if(e.assets.length>=e.totalCount){this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const a=this._buildSearchNotation(),r=e.currentFolderPath||"/",n=e.limit,c=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=c.length;b<d;b+=n)u.push(b);const f=4,p=[];for(let b=0;b<u.length;b+=f){const k=u.slice(b,b+f),$=await Promise.all(k.map(F=>Ye(this.apiClient,{folder:r,offset:F,limit:n,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:a||void 0,recursive:h})));for(const F of $)F.files&&p.push(...F.files)}const g=new Set(c.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),x=[...c,...v];this.store.setState({assets:x,offset:Math.max(0,x.length-n),hasMore:!1,isSelectingAll:!1}),this.selectionCtrl.selectAll(x)}catch(a){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:a,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===m.DATE||e===m.LICENSE_EXPIRY||e===z.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:f}=i;c=!d&&!h&&!u&&!f}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===m.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 r,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,r,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let r,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();r=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,r,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,g,v;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!r)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"),b=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const k of x){const $=(v=(g=k.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:v.trim();if(i&&$===b){n=k;break}if(s&&$===(ke[s]||s)){n=k;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,f=h?c.bottom-h.top:void 0;i?r.openMetadataFieldPanel(i,!0,u,f):s&&r.openFilterPanel(s,!0,u,f)}_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},r={...a.applied};delete r[s],a.applied=r,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:r}=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(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:r},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 f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,r={...this.store.getState().filters},n={...r.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(c=>c!==s)),a.metadata=r,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,r={...this.store.getState().filters};i?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;$a(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,r={...this.store.getState().filters},n={...r.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))),r.metadata=n,this.store.setState({filters:r});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;ka(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(r=>r!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},r={...a.metadata};r.visible=r.visible.filter(n=>n!==s),a.metadata=r,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,r={...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];r.applied=c;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],i){const u={...r.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Ia:e.activeTab==="folders"?Da:At}_buildSearchNotation(){var a;const e=this.store.getState(),s={...De((a=this.config)==null?void 0:a.forcedFilters),...e.filters.applied};return ca(s,e.filters.metadata.applied).join(" ")}render(){var h,u,f,p,g,v,x,b;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=this.selectionCtrl.getSelectedAssets(),a=o.html`
5708
5801
  <ap-header
5709
5802
  .activeTab=${e.activeTab}
5710
5803
  .tabs=${((h=this.config)==null?void 0:h.tabs)??["assets","folders"]}
@@ -5735,11 +5828,6 @@
5735
5828
  </div>
5736
5829
  `:o.nothing}
5737
5830
  <div class="main-content">
5738
- ${e.breadcrumb.length>0?o.html`<ap-breadcrumb
5739
- .items=${e.breadcrumb}
5740
- @breadcrumb-navigate=${this._handleBreadcrumbNavigate}
5741
- ></ap-breadcrumb>`:o.nothing}
5742
-
5743
5831
  <div class="toolbar-filters-wrapper">
5744
5832
  <ap-content-toolbar
5745
5833
  .isLoading=${e.isLoading}
@@ -5787,6 +5875,11 @@
5787
5875
  @filters-clear-all=${this._handleFiltersClearAll}
5788
5876
  @filters-set=${this._handleFiltersSet}
5789
5877
  ></ap-filters-bar>
5878
+
5879
+ ${e.breadcrumb.length>0?o.html`<ap-breadcrumb
5880
+ .items=${e.breadcrumb}
5881
+ @breadcrumb-navigate=${this._handleBreadcrumbNavigate}
5882
+ ></ap-breadcrumb>`:o.nothing}
5790
5883
  </div>
5791
5884
 
5792
5885
  ${e.isLoading&&e.assets.length===0&&e.folders.length===0?o.html`<ap-skeleton .variant=${e.viewMode}></ap-skeleton>`:this._renderContent(e,s)}
@@ -5816,7 +5909,7 @@
5816
5909
  .selectedAssets=${i}
5817
5910
  .totalCount=${e.totalCount}
5818
5911
  .isSelectingAll=${e.isSelectingAll}
5819
- .multiSelect=${(($=this.config)==null?void 0:$.multiSelect)??!0}
5912
+ .multiSelect=${((x=this.config)==null?void 0:x.multiSelect)??!0}
5820
5913
  .maxSelections=${(b=this.config)==null?void 0:b.maxSelections}
5821
5914
  @selection-confirm=${this._handleSelectionConfirm}
5822
5915
  @selection-clear=${this._handleSelectionClear}