@scaleflex/asset-picker 0.2.0 → 0.2.2

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.
@@ -1,4 +1,4 @@
1
- "use strict";var ws=Object.create;var jt=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,Es=Object.prototype.hasOwnProperty;var Fs=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ss(e))!Es.call(t,i)&&i!==s&&jt(t,i,{get:()=>e[i],enumerable:!(a=ks(e,i))||a.enumerable});return t};var As=(t,e,s)=>(s=t!=null?ws(Cs(t)):{},Fs(e||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),c=require("lit/decorators.js");class Ts{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(a=>a(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const a=this._pendingState;this._pendingState=null,this.setState(a)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Os(){return new Ts({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 Ms{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 Ps{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}handleSelect(e,s,a){var d,h;const i=this.store.getState(),r=new Map(i.selectedAssets);if(!(((d=i.config)==null?void 0:d.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r}),this.lastClickedIndex=s;return}if(a.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=i.assets;for(let g=u;g<=f;g++)p[g]&&r.set(p[g].uuid,p[g])}else a.metaKey||a.ctrlKey?r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e):(r.clear(),r.set(e.uuid,e));const l=(h=i.config)==null?void 0:h.maxSelections;l&&r.size>l||(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 a=(n=this.store.getState().config)==null?void 0:n.maxSelections,i=new Map,r=a?Math.min(e.length,a):e.length;for(let l=0;l<r;l++)i.set(e[l].uuid,e[l]);return this.store.setState({selectedAssets:i}),this.lastClickedIndex=-1,i.size}clearSelection(){this.store.setState({selectedAssets:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}}class Ls{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(a=>{var i;(i=a[0])!=null&&i.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 Nt=5,we=40,Bt=15;class Is{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=a=>this.onMouseDown(a),this.handleMouseMove=a=>this.onMouseMove(a),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(a=>{if(!(a instanceof HTMLElement))return!1;if(a instanceof HTMLButtonElement||a instanceof HTMLInputElement)return!0;const i=a.tagName.toLowerCase();return!!(i.startsWith("ap-asset-")||i.startsWith("ap-folder-")||a.classList.contains("check")||a.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),a=Math.abs(e.clientY-this.startClientY);if(s<Nt&&a<Nt)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(),a=e.clientX-s.left+this.container.scrollLeft,i=e.clientY-s.top+this.container.scrollTop;this.rect={x:Math.min(this.startX,a),y:Math.min(this.startY,i),width:Math.abs(a-this.startX),height:Math.abs(i-this.startY)},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),a=e.clientY-s.top,i=s.bottom-e.clientY,r=a<we||i<we;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,a=s.clientY-e.top,i=e.bottom-s.clientY;let r=0;a<we?r=-Bt*(1-a/we):i<we&&(r=Bt*(1-i/we)),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 i;if(!this.container)return;const e=this.queryCards(),s=new Map(this.preMarqueeSelection);e.forEach(r=>{const n=r.getBoundingClientRect(),l=this.container.getBoundingClientRect(),d={x:n.left-l.left+this.container.scrollLeft,y:n.top-l.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 a=(i=this.store.getState().config)==null?void 0:i.maxSelections;if(a&&s.size>a){const r=Array.from(s.entries()).slice(0,a);this.store.setState({selectedAssets:new Map(r)})}else this.store.setState({selectedAssets:s})}}class Ds{constructor(e,s){this.auth=e;const a=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${a}/v5`}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}async request(e,s){const a=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([l,d])=>{d!=null&&(Array.isArray(d)?a.searchParams.set(l,d.join(",")):a.searchParams.set(l,String(d)))});const i={};if(this.auth.mode==="session"){const l=this.auth;i["X-Session-Token"]=l.sessionToken,i["X-Company-Token"]=l.companyToken,i["X-Project-Token"]=l.projectToken}else{const l=this.auth;this.sassKey?i["X-Filerobot-Key"]=this.sassKey:i["X-Filerobot-Key"]=l.securityTemplateKey}const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(a.toString(),{headers:i,signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}async post(e,s){const a=new URL(`${this.baseUrl}${e}`),i={"Content-Type":"application/json"};if(this.auth.mode==="session"){const l=this.auth;i["X-Session-Token"]=l.sessionToken,i["X-Company-Token"]=l.companyToken,i["X-Project-Token"]=l.projectToken}else{const l=this.auth;this.sassKey?i["X-Filerobot-Key"]=this.sassKey:i["X-Filerobot-Key"]=l.securityTemplateKey}const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(a.toString(),{method:"POST",headers:i,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}}function zs(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",a=t.sort_direction??"desc",i={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${i[s]||s}:${a}`,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=zs(e);return t.request("/files",s)}async function Ut(t,e){const s={folder:e.folder,recursive:e.recursive??1},a=[];return e.search&&a.push(e.search),e.q&&a.push(e.q),a.length>0&&(s.q=a.join(" ")),t.request("/files/stats",s)}async function Rs(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 a=(e==null?void 0:e.sort_by)??"created_at",i=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[a]||a}:${i}`,await t.request("/folders",s)}async function js(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Ns(t){return await t.request("/labels")}async function Bs(t){return((await t.request("/tags")).tags||[]).map(a=>({...a,label:a.names.en||Object.values(a.names)[0]||""})).filter(a=>a.label).sort((a,i)=>a.label.localeCompare(i.label))}async function Us(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"},R={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},_={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Vs={AND:"AND"},x={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"},ct={[x.DATE]:"date_",[x.BOOLEAN]:"bool_",[x.NUMERIC]:"num_",[x.DECIMAL2]:"dec_",[x.ATTACHMENTS_ASSETS]:"attach_",[x.ATTACHMENT_URI]:"uri_",[x.SELECT_ONE]:"one_",[x.MULTI_SELECT]:"multi_",[x.SUPERTAGS]:"tags_",[x.TEXT]:"text_",[x.TEXT_AREA]:"area_",[x.GEO_POINT]:"geo_",[x.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(ct).map(([t,e])=>[e,t]));const Zt=Object.values(ct),Ie={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Vt={EMPTY:"empty",NOT_EMPTY:"non-empty"},B="empty",U="non-empty",he="specific",gt=10,ft=10,Xe=10,Jt="filters:pinned:",es="metadata:pinned:",qt=[m.DATE,m.TYPE],ts=_.IS,Qe="20",Ze="1",qs=0,Hs=[{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"}],Ks={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Gs={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},St=[Ks,...Hs,Gs],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"},ie={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},ss=[{value:ie.IMAGE,label:"Image",icon:"image"},{value:ie.VIDEO,label:"Video",icon:"clapperboard"},{value:ie.AUDIO,label:"Audio",icon:"music"},{value:ie.DOCUMENT,label:"Document",icon:"document"},{value:ie.ARCHIVE,label:"Archive",icon:"archive"},{value:ie.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ie.FONTS,label:"Fonts",icon:"text"},{value:ie.OTHER,label:"Other",icon:"layout-grid"}],mt={RESOLUTION:0,ORIENTATION:1,FACES:2},Ys=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Xs=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Ws=[{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"}],Et=[{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"}],as=[{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"}],Qs=[{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"}],Zs=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],Js=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],vt=[{label:"Is",value:_.IS},{label:"Contains",value:_.CONTAINS_IN_TEXT}],X=[{label:"Is",value:_.IS},{label:"Is not",value:_.IS_NOT}],bt=[{label:"Is",value:_.IS_EXACT},{label:"Contains",value:_.IS},{label:"Does not contain",value:_.IS_NOT}],_t=[{label:"Is",value:_.IS},{label:"Greater than",value:_.GREATER_THAN_OR_EQUAL},{label:"Is not",value:_.IS_NOT},{label:"Less than",value:_.LESS_THAN_OR_EQUAL},{label:"Between",value:_.RANGE}],ei=[{label:"Is",value:_.IS_EXACT},{label:"Is not",value:_.IS_NOT}],Ht=[{label:"Contains",value:_.CONTAINS},{label:"Does not contain",value:_.IS_NOT}],ti=[{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}],yt=[...ge,{label:"Specific",value:he}],si=[{label:"Empty",value:B},{label:"Not empty",value:U},{label:"True",value:"true"},{label:"False",value:"false"}],ii={[x.TEXT]:"text",[x.TEXT_AREA]:"text",[x.NUMERIC]:"number",[x.DECIMAL2]:"number",[x.BOOLEAN]:"boolean",[x.SELECT_ONE]:"select-one",[x.MULTI_SELECT]:"multi-select",[x.SUPERTAGS]:"tags",[x.DATE]:"date",[x.GEO_POINT]:"geo",[x.ATTACHMENTS_ASSETS]:"attachment",[x.ATTACHMENT_URI]:"attachment",[x.INTEGER_LIST]:"attachment"};async function ai(t){var v,w,b,O;const e=await t.request("/settings"),s=e.settings??e,a=(s==null?void 0:s.metadata)??e.metadata,r=((a==null?void 0:a.model)??[])[qs],n=a==null?void 0:a.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map($=>({uuid:$.uuid,label:$.label??$.name??"",variants:($.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($=>$.variants.length>1),h={};for(const $ of d)h[$.uuid]=((v=$.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??((w=e.settings)==null?void 0:w.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 $ of p){const k=((b=$.name)==null?void 0:b.toLowerCase())==="products"||((O=$.name)==null?void 0:O.toLowerCase())==="product fields";for(const A of $.fields??[]){const T=A.possible_values,L=T==null?void 0:T.map(C=>({api_value:C.api_value??C.value??"",internal_unique_value:C.internal_unique_value??C.api_value??"",label:C.label??C.name??C.api_value??""}));g.push({key:A.key??A.ckey,label:A.title??A.label??A.key??"",type:A.type??"text",slug:A.slug,ckey:A.ckey,possible_values:L,group:k?"product":"root",regionalVariantsGroupUuid:A.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 rs(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 Kt(t,e){return e?e.type==="date"?ri(e):e.type==="string"?oi(e):!0:!1}function ri(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 oi(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ni(t,e={}){const s=[];for(const[a,i]of Object.entries(t)){if(!i||!Kt(a,i))continue;const r=ci(a,i);s.push(...r)}for(const[a,i]of Object.entries(e)){if(!i||!Kt(a,i))continue;const r=gi(a,i);s.push(...r)}return li(s)}function li(t){const e=[],s=[],a=[];for(const i of t)i.startsWith("type:")||i.startsWith("type=")?e.push(i):i.startsWith("mimetype:")||i.startsWith("mimetype=")?s.push(i):a.push(i);if(e.length>0&&s.length>0){const i=[...e,...s].join(" , ");a.push(i)}else a.push(...e,...s);return a}function ci(t,e){if(e.type==="date")return os(t,e);if(t===m.IMAGE)return ui(e);const s=e,{operator:a=ts,values:i=[],logic:r}=s;if(i.length===0)return[];switch(t){case m.SIZE:return di(t,i,"..");case m.FACES:return pi(t,a,i);case m.TAGS:return fe(t,a,Yt(i),",",r);case m.LABELS:return fe(t,a,Yt(i),",",r);case m.COLOR:return hi(a,i,r);case m.TYPE:return Gt(t,i,a);case m.MIME_TYPE:return Gt(t,i,a);case m.PRODUCT_REF:return fe(t,"=%",i,",",r);default:return fe(t,a,i,",",r)}}function os(t,e){const s=e.field||"created";if(e.kind===Ie.PRESET&&e.preset){if(e.preset===Vt.EMPTY)return[`${s}:"empty"`];if(e.preset===Vt.NOT_EMPTY)return[`${s}:"non-empty"`];const a=rs(e.preset);return a?a.to===null?[`${s}>"${a.from}"`]:[`${s}:"${a.from}..${a.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 di(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function pi(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function fe(t,e,s,a,i){if(s.length===0)return[];if(i===Vs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(a);return[`${t}${e}${r}`]}function hi(t,e,s){const a=[],i=fe("color_search",t,e,",",s);return a.push(...i),a.push('color_operator:"AND"'),a}function Gt(t,e,s,a){if(e.length===0)return[];const i=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${i}`]}function ui(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,l=n.resolution,d=n.orientation,h=n.faces;return l!=null&&l.length&&e.push(`resolution:"${l.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,a=s[mt.RESOLUTION],i=s[mt.ORIENTATION],r=s[mt.FACES];return a&&e.push(`resolution:"${a}"`),i&&e.push(`orientation:"${i}"`),r&&e.push(`faces:"${r}"`),e}function gi(t,e){const s=vi(t),a=mi(t);if(e.type==="date")return fi(s,e,a);const i=e,{operator:r=ts,values:n=[],logic:l,metadataType:d}=i;if(n.length===0)return[];if(n.length===1&&(n[0]===B||n[0]===U)){const h=d===x.GEO_POINT?_.IS+"~":_.IS;return[`${s}${h}"${n[0]}"`]}if((d===x.NUMERIC||d===x.DECIMAL2)&&r===_.RANGE)return[`${s}${_.IS}"${n.join('","')}"`];if(d===x.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,",",l)}return fe(s,r,n,",",l)}function fi(t,e,s){const a=os(t,e);return!s||a.length===0?a:a.map(i=>{const r=i.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${i}"`;const n=i.slice(0,r),d=i.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function mi(t){return t.startsWith("date_")}function vi(t){for(const e of Zt)if(t.startsWith(e))return t.slice(e.length);return t}function Yt(t){return t.map(e=>e.replace(/#/g,""))}const bi=new Set([m.DATE,m.LICENSE_EXPIRY,R.DUE_DATE]);function De(t){if(!t)return{};const e={};for(const[s,a]of Object.entries(t))a&&(e[s]=_i(s,a));return e}function _i(t,e){return e.type==="string"||e.type==="date"?e:bi.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 yi(t){const e=localStorage.getItem(Jt+t),s=localStorage.getItem(es+t);let a;try{a=e?JSON.parse(e):[...qt]}catch{a=[...qt]}let i;try{i=s?JSON.parse(s):[]}catch{i=[]}return{pinnedFilters:a,pinnedMetadata:i}}function xi(t,e){localStorage.setItem(Jt+t,JSON.stringify(e))}function $i(t,e){localStorage.setItem(es+t,JSON.stringify(e))}const ns="sort-by",ls="sort-order";function Xt(t,e){try{localStorage.setItem(ns,t),localStorage.setItem(ls,e)}catch{}}function wi(){try{const t=localStorage.getItem(ns),e=localStorage.getItem(ls);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const cs="ap-last-folder",ds="ap-last-view";function Wt(t){try{localStorage.setItem(cs,t)}catch{}}function ki(){try{return localStorage.getItem(cs)}catch{return null}}function Si(t){try{localStorage.setItem(ds,t)}catch{}}function Ci(){try{return localStorage.getItem(ds)}catch{return null}}function Ei(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,a=parseInt(s.slice(0,2),16)/255,i=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[a,i,r]}function xt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Fi(t,e,s){const a=xt(t),i=xt(e),r=xt(s),n=.4122214708*a+.5363325363*i+.0514459929*r,l=.2119034982*a+.6806995451*i+.1073969566*r,d=.0883024619*a+.2817188376*i+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(l),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,w=Math.sqrt(g*g+v*v);let b=Math.atan2(v,g)*(180/Math.PI);return b<0&&(b+=360),[p,w,b]}function Ai(t){return t>.7}function Ti(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[a,i,r]=Ei(e),[n,l,d]=Fi(a,i,r),h=`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)})`,u=Ai(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)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const Ft=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Oi=[{value:"relevance",label:"Relevance"},...Ft],Mi=[{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 Pi=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,At=(t,e,s,a)=>{for(var i=a>1?void 0:a?Li(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Pi(e,s,i),i};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 ks=Object.create;var jt=Object.defineProperty;var Ss=Object.getOwnPropertyDescriptor;var Cs=Object.getOwnPropertyNames;var Es=Object.getPrototypeOf,Fs=Object.prototype.hasOwnProperty;var As=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Cs(e))!Fs.call(t,a)&&a!==s&&jt(t,a,{get:()=>e[a],enumerable:!(i=Ss(e,a))||i.enumerable});return t};var Ts=(t,e,s)=>(s=t!=null?ks(Es(t)):{},As(e||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),c=require("lit/decorators.js");class Ms{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 Os(){return new Ms({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 Ls{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 Ps{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 l=(h=a.config)==null?void 0:h.maxSelections;l&&r.size>l||(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 l=0;l<r;l++)a.set(e[l].uuid,e[l]);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 Is{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 Ds{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<Ut&&i<Ut)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=-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),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(),l=this.container.getBoundingClientRect(),d={x:n.left-l.left+this.container.scrollLeft,y:n.top-l.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 zs{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([l,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(l,d.join(",")):i.searchParams.set(l,String(d)))});const a={};if(this.auth.mode==="session"){const l=this.auth;a["X-Session-Token"]=l.sessionToken,a["X-Company-Token"]=l.companyToken,a["X-Project-Token"]=l.projectToken}else{const l=this.auth;this.sassKey?a["X-Filerobot-Key"]=this.sassKey:a["X-Filerobot-Key"]=l.securityTemplateKey}const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{headers:a,signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};if(this.auth.mode==="session"){const l=this.auth;a["X-Session-Token"]=l.sessionToken,a["X-Company-Token"]=l.companyToken,a["X-Project-Token"]=l.projectToken}else{const l=this.auth;this.sassKey?a["X-Filerobot-Key"]=this.sassKey:a["X-Filerobot-Key"]=l.securityTemplateKey}const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}}function Rs(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=Rs(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 Ns(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 js(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 Bs(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 Vs(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:"<="},qs={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"},ct={[_.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(ct).map(([t,e])=>[e,t]));const Jt=Object.values(ct),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",gt=10,ft=10,Xe=10,es="filters:pinned:",ts="metadata:pinned:",Ht=[m.DATE,m.TYPE],ss=y.IS,Qe="20",Ze="1",Hs=0,Ks=[{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"}],Gs={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Ys={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},Ct=[Gs,...Ks,Ys],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"}],mt={RESOLUTION:0,ORIENTATION:1,FACES:2},Xs=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Ws=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Qs=[{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"}],Zs=[{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=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],ea=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],vt=[{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}],bt=[{label:"Is",value:y.IS_EXACT},{label:"Contains",value:y.IS},{label:"Does not contain",value:y.IS_NOT}],_t=[{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}],ta=[{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}],sa=[{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}],yt=[...ge,{label:"Specific",value:he}],aa=[{label:"Empty",value:U},{label:"Not empty",value:B},{label:"True",value:"true"},{label:"False",value:"false"}],xt={[_.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"},ia={[_.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 ra(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)??[])[Hs],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"?oa(e):e.type==="string"?na(e):!0:!1}function oa(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function na(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function la(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Gt(i,a))continue;const r=da(i,a);s.push(...r)}for(const[i,a]of Object.entries(e)){if(!a||!Gt(i,a))continue;const r=fa(i,a);s.push(...r)}return ca(s)}function ca(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function da(t,e){if(e.type==="date")return ns(t,e);if(t===m.IMAGE)return ga(e);const s=e,{operator:i=ss,values:a=[],logic:r}=s;if(a.length===0)return[];switch(t){case m.SIZE:return pa(t,a,"..");case m.FACES:return ha(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 ua(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 pa(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function ha(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===qs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${r}`]}function ua(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 ga(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,l=n.resolution,d=n.orientation,h=n.faces;return l!=null&&l.length&&e.push(`resolution:"${l.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[mt.RESOLUTION],a=s[mt.ORIENTATION],r=s[mt.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),r&&e.push(`faces:"${r}"`),e}function fa(t,e){const s=ba(t),i=va(t);if(e.type==="date")return ma(s,e,i);const a=e,{operator:r=ss,values:n=[],logic:l,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,",",l)}return fe(s,r,n,",",l)}function ma(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 va(t){return t.startsWith("date_")}function ba(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 _a=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]=ya(s,i));return e}function ya(t,e){return e.type==="string"||e.type==="date"?e:_a.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 xa(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 wa(t,e){localStorage.setItem(es+t,JSON.stringify(e))}function $a(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 ka(){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";function Qt(t){try{localStorage.setItem(ds,t)}catch{}}function Sa(){try{return localStorage.getItem(ds)}catch{return null}}function Ca(t){try{localStorage.setItem(ps,t)}catch{}}function Ea(){try{return localStorage.getItem(ps)}catch{return null}}function Fa(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 Aa(t,e,s){const i=wt(t),a=wt(e),r=wt(s),n=.4122214708*i+.5363325363*a+.0514459929*r,l=.2119034982*i+.6806995451*a+.1073969566*r,d=.0883024619*i+.2817188376*a+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(l),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 Ta(t){return t>.7}function Ma(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]=Fa(e),[n,l,d]=Aa(i,a,r),h=`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)})`,u=Ta(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)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${l.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"}],Oa=[{value:"relevance",label:"Relevance"},...At],La=[{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 Pa=Object.defineProperty,Ia=Object.getOwnPropertyDescriptor,Tt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ia(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&&Pa(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}
@@ -88,11 +88,11 @@
88
88
  animation: none;
89
89
  }
90
90
  }
91
- `;At([c.property({type:Boolean})],Re.prototype,"open",2);At([c.query("dialog")],Re.prototype,"dialog",2);Re=At([c.customElement("ap-modal")],Re);function Ii(t,e){let s;const a=((...i)=>{clearTimeout(s),s=setTimeout(()=>t(...i),e)});return a.cancel=()=>clearTimeout(s),a}const J=o.css`
91
+ `;Tt([c.property({type:Boolean})],Re.prototype,"open",2);Tt([c.query("dialog")],Re.prototype,"dialog",2);Re=Tt([c.customElement("ap-modal")],Re);function Da(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const J=o.css`
92
92
  *, *::before, *::after {
93
93
  box-sizing: border-box;
94
94
  }
95
- `;var Di=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,dt=(t,e,s,a)=>{for(var i=a>1?void 0:a?zi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Di(e,s,i),i};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 za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,dt=(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 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}
@@ -110,14 +110,14 @@
110
110
  ${this.groups.map(e=>o.html`
111
111
  <div class="group">
112
112
  <div class="group-label">${e.label}</div>
113
- ${e.variants.map(s=>{const a=this.selectedFilters[e.uuid]===s.api_value;return o.html`
113
+ ${e.variants.map(s=>{const i=this.selectedFilters[e.uuid]===s.api_value;return o.html`
114
114
  <button
115
115
  class="variant-option"
116
- ?data-selected=${a}
116
+ ?data-selected=${i}
117
117
  @click=${()=>this._selectVariant(e.uuid,s.api_value)}
118
118
  >
119
119
  <span class="variant-label">${s.label}</span>
120
- <span class="check-mark">${a?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:""}</span>
120
+ <span class="check-mark">${i?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:""}</span>
121
121
  </button>
122
122
  `})}
123
123
  </div>
@@ -208,7 +208,7 @@
208
208
  width: 16px;
209
209
  flex-shrink: 0;
210
210
  }
211
- `;dt([c.property({type:Array})],Ce.prototype,"groups",2);dt([c.property({type:Object})],Ce.prototype,"selectedFilters",2);dt([c.state()],Ce.prototype,"_open",2);Ce=dt([c.customElement("ap-regional-settings")],Ce);var Ri=Object.defineProperty,ji=Object.getOwnPropertyDescriptor,ee=(t,e,s,a)=>{for(var i=a>1?void 0:a?ji(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ri(e,s,i),i};const Ni=[{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=Ii(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=Ni.filter(a=>this.tabs.includes(a.value));return((e=t.find(a=>a.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),o.html`
211
+ `;dt([c.property({type:Array})],Ce.prototype,"groups",2);dt([c.property({type:Object})],Ce.prototype,"selectedFilters",2);dt([c.state()],Ce.prototype,"_open",2);Ce=dt([c.customElement("ap-regional-settings")],Ce);var Na=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?ja(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&&Na(e,s,a),a};const Ua=[{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=Da(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=Ua.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}
@@ -357,7 +357,7 @@
357
357
  height: 24px;
358
358
  background: var(--ap-border, oklch(92.86% 0.009 247.92));
359
359
  }
360
- `];ee([c.property()],H.prototype,"activeTab",2);ee([c.property({type:Array})],H.prototype,"tabs",2);ee([c.property()],H.prototype,"viewMode",2);ee([c.property()],H.prototype,"searchQuery",2);ee([c.property({type:Array})],H.prototype,"regionalGroups",2);ee([c.property({type:Object})],H.prototype,"regionalFilters",2);ee([c.property({type:Boolean})],H.prototype,"hideClose",2);ee([c.state()],H.prototype,"_localSearch",2);H=ee([c.customElement("ap-header")],H);var Bi=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,ps=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ui(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Bi(e,s,i),i};let Je=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
360
+ `];ee([c.property()],H.prototype,"activeTab",2);ee([c.property({type:Array})],H.prototype,"tabs",2);ee([c.property()],H.prototype,"viewMode",2);ee([c.property()],H.prototype,"searchQuery",2);ee([c.property({type:Array})],H.prototype,"regionalGroups",2);ee([c.property({type:Object})],H.prototype,"regionalFilters",2);ee([c.property({type:Boolean})],H.prototype,"hideClose",2);ee([c.state()],H.prototype,"_localSearch",2);H=ee([c.customElement("ap-header")],H);var Ba=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,hs=(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};let Je=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
361
361
  <nav class="breadcrumb" aria-label="Breadcrumb">
362
362
  <button @click=${()=>this._navigate("")}>Root</button>
363
363
  ${this.items.map((t,e)=>o.html`
@@ -398,18 +398,18 @@
398
398
  ap-icon {
399
399
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
400
400
  }
401
- `;ps([c.property({type:Array})],Je.prototype,"items",2);Je=ps([c.customElement("ap-breadcrumb")],Je);var Vi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,Tt=(t,e,s,a)=>{for(var i=a>1?void 0:a?qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Vi(e,s,i),i};let je=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
401
+ `;hs([c.property({type:Array})],Je.prototype,"items",2);Je=hs([c.customElement("ap-breadcrumb")],Je);var qa=Object.defineProperty,Ha=Object.getOwnPropertyDescriptor,Mt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ha(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&&qa(e,s,a),a};let Ne=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
402
402
  <div class="popover">
403
403
  ${this.title?o.html`<div class="title">${this.title}</div>`:""}
404
404
  <slot></slot>
405
405
  </div>
406
- `:o.html``}};je.styles=o.css`
406
+ `:o.html``}};Ne.styles=o.css`
407
407
  :host {
408
408
  display: block;
409
409
  }
410
410
  .popover {
411
411
  position: absolute;
412
- top: calc(100% + 8px);
412
+ top: calc(100% + 4px);
413
413
  left: 20px;
414
414
  z-index: 50;
415
415
  width: 320px;
@@ -428,10 +428,10 @@
428
428
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
429
429
  margin-bottom: 12px;
430
430
  }
431
- `;Tt([c.property()],je.prototype,"title",2);Tt([c.property({type:Boolean})],je.prototype,"open",2);je=Tt([c.customElement("ap-filter-popover")],je);var Hi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,hs=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ki(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Hi(e,s,i),i};let et=class extends o.LitElement{constructor(){super(...arguments),this.selected=[]}_toggle(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.TYPE,values:e,operator:_.IS},bubbles:!0,composed:!0}))}render(){return o.html`
431
+ `;Mt([c.property()],Ne.prototype,"title",2);Mt([c.property({type:Boolean})],Ne.prototype,"open",2);Ne=Mt([c.customElement("ap-filter-popover")],Ne);var Ka=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,us=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ga(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&&Ka(e,s,a),a};let et=class extends o.LitElement{constructor(){super(...arguments),this.selected=[]}_toggle(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.TYPE,values:e,operator:y.IS},bubbles:!0,composed:!0}))}render(){return o.html`
432
432
  <div class="options">
433
433
  <span class="section-label">Formats</span>
434
- ${ss.map(t=>o.html`
434
+ ${as.map(t=>o.html`
435
435
  <div
436
436
  class="option ${this.selected.includes(t.value)?"selected":""}"
437
437
  @click=${()=>this._toggle(t.value)}
@@ -491,7 +491,7 @@
491
491
  .option.selected ap-icon {
492
492
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
493
493
  }
494
- `;hs([c.property({type:Array})],et.prototype,"selected",2);et=hs([c.customElement("ap-filter-type")],et);const te=o.css`
494
+ `;us([c.property({type:Array})],et.prototype,"selected",2);et=us([c.customElement("ap-filter-type")],et);const te=o.css`
495
495
  :host {
496
496
  display: block;
497
497
  }
@@ -608,6 +608,28 @@
608
608
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
609
609
  }
610
610
 
611
+ /* ── Date input: Lucide calendar icon ── */
612
+ .filter-input[type="date"]::-webkit-calendar-picker-indicator {
613
+ opacity: 0;
614
+ position: absolute;
615
+ right: 0;
616
+ top: 0;
617
+ width: 100%;
618
+ height: 100%;
619
+ cursor: pointer;
620
+ }
621
+ .filter-input[type="date"] {
622
+ position: relative;
623
+ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E");
624
+ background-repeat: no-repeat;
625
+ background-position: right 10px center;
626
+ background-size: 16px 16px;
627
+ padding-right: 32px;
628
+ }
629
+ .input-label:has(+ .filter-input[type="date"]) {
630
+ font-weight: 400;
631
+ }
632
+
611
633
  textarea.filter-input {
612
634
  min-height: 60px;
613
635
  resize: vertical;
@@ -743,7 +765,7 @@
743
765
  font-size: var(--ap-font-size-sm, 0.875rem);
744
766
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
745
767
  }
746
- `;var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,_e=(t,e,s,a)=>{for(var i=a>1?void 0:a?Yi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Gi(e,s,i),i};function $t(t){return t.toISOString().split("T")[0]}let W=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=m.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===m.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?as:Et}get _todayStr(){return $t(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=rs(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,a=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=a:this.to=a,this.preset==="specific"&&t==="from"&&a){const i=new Date(s+"T23:59:59");this.to=i.toISOString()}this.preset==="after"&&t==="from"&&a&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&a&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?o.nothing:o.html`
768
+ `;var Ya=Object.defineProperty,Xa=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?Xa(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&&Ya(e,s,a),a};function $t(t){return t.toISOString().split("T")[0]}let W=class extends o.LitElement{constructor(){super(...arguments),this.filterKey=m.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===m.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?rs:Ft}get _todayStr(){return $t(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=os(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?o.nothing:o.html`
747
769
  <div class="filter-section">
748
770
  <span class="section-label">Date type</span>
749
771
  <ap-radio-group
@@ -762,16 +784,16 @@
762
784
  @ap-change=${t=>this._selectPreset(t.detail.value)}
763
785
  ></ap-radio-group>
764
786
  </div>
765
- `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?$t(new Date(this.from)):"",s=this.to?$t(new Date(this.to)):"",a=this._todayStr;return t==="specific"?o.html`
787
+ `}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return o.nothing;const e=this.from?$t(new Date(this.from)):"",s=this.to?$t(new Date(this.to)):"",i=this._todayStr;return t==="specific"?o.html`
766
788
  <div class="filter-section date-inputs">
767
789
  <div>
768
790
  <span class="input-label">Date</span>
769
791
  <input
770
792
  type="date"
771
793
  class="filter-input"
772
- max=${a}
794
+ max=${i}
773
795
  .value=${e}
774
- @change=${i=>this._handleDateInput("from",i)}
796
+ @change=${a=>this._handleDateInput("from",a)}
775
797
  />
776
798
  </div>
777
799
  </div>
@@ -782,9 +804,9 @@
782
804
  <input
783
805
  type="date"
784
806
  class="filter-input"
785
- max=${a}
807
+ max=${i}
786
808
  .value=${s}
787
- @change=${i=>this._handleDateInput("to",i)}
809
+ @change=${a=>this._handleDateInput("to",a)}
788
810
  />
789
811
  </div>
790
812
  </div>
@@ -795,9 +817,9 @@
795
817
  <input
796
818
  type="date"
797
819
  class="filter-input"
798
- max=${a}
820
+ max=${i}
799
821
  .value=${e}
800
- @change=${i=>this._handleDateInput("from",i)}
822
+ @change=${a=>this._handleDateInput("from",a)}
801
823
  />
802
824
  </div>
803
825
  </div>
@@ -809,9 +831,9 @@
809
831
  <input
810
832
  type="date"
811
833
  class="filter-input"
812
- max=${s||a}
834
+ max=${s||i}
813
835
  .value=${e}
814
- @change=${i=>this._handleDateInput("from",i)}
836
+ @change=${a=>this._handleDateInput("from",a)}
815
837
  />
816
838
  </div>
817
839
  <div>
@@ -820,9 +842,9 @@
820
842
  type="date"
821
843
  class="filter-input"
822
844
  min=${e}
823
- max=${a}
845
+ max=${i}
824
846
  .value=${s}
825
- @change=${i=>this._handleDateInput("to",i)}
847
+ @change=${a=>this._handleDateInput("to",a)}
826
848
  />
827
849
  </div>
828
850
  </div>
@@ -842,7 +864,7 @@
842
864
  .date-inputs {
843
865
  margin-top: 4px;
844
866
  }
845
- `];_e([c.property()],W.prototype,"filterKey",2);_e([c.property()],W.prototype,"field",2);_e([c.property()],W.prototype,"kind",2);_e([c.property()],W.prototype,"preset",2);_e([c.property()],W.prototype,"from",2);_e([c.property()],W.prototype,"to",2);W=_e([c.customElement("ap-filter-date")],W);var Xi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,Oe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Wi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Xi(e,s,i),i};let ae=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=m.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=gt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(a=>a!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:_.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:_.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:_.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
867
+ `];_e([c.property()],W.prototype,"filterKey",2);_e([c.property()],W.prototype,"field",2);_e([c.property()],W.prototype,"kind",2);_e([c.property()],W.prototype,"preset",2);_e([c.property()],W.prototype,"from",2);_e([c.property()],W.prototype,"to",2);W=_e([c.customElement("ap-filter-date")],W);var Wa=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,Me=(t,e,s,i)=>{for(var a=i>1?void 0:i?Qa(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&&Wa(e,s,a),a};let ie=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=m.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=gt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:y.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:y.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
846
868
  <div
847
869
  class="tag-item ${s?"disabled":""}"
848
870
  title=${s?`You can select up to ${gt} tags`:o.nothing}
@@ -894,7 +916,7 @@
894
916
  </div>
895
917
  `:o.nothing}
896
918
  </div>
897
- `}_renderSearchResults(t){const e=i=>i.toLowerCase().includes(t),s=this._suggestedTags.filter(i=>e(i.label)).slice(0,50),a=this._otherTags.filter(i=>e(i.label)).slice(0,50);return s.length===0&&a.length===0?o.html`<div class="no-results">No tags found</div>`:o.html`
919
+ `}_renderSearchResults(t){const e=a=>a.toLowerCase().includes(t),s=this._suggestedTags.filter(a=>e(a.label)).slice(0,50),i=this._otherTags.filter(a=>e(a.label)).slice(0,50);return s.length===0&&i.length===0?o.html`<div class="no-results">No tags found</div>`:o.html`
898
920
  ${s.length>0?o.html`
899
921
  <div class="filter-section">
900
922
  <div class="section-header">
@@ -906,12 +928,12 @@
906
928
  >Clear all</button>
907
929
  </div>
908
930
  <div class="options-list short">
909
- ${s.map(i=>this._renderTagItem(i))}
931
+ ${s.map(a=>this._renderTagItem(a))}
910
932
  </div>
911
933
  </div>
912
934
  `:o.nothing}
913
935
 
914
- ${a.length>0?o.html`
936
+ ${i.length>0?o.html`
915
937
  <div class="filter-section">
916
938
  <div class="section-header">
917
939
  ${s.length===0?o.html`<span class="section-label">All tags</span>
@@ -922,7 +944,7 @@
922
944
  >Clear all</button>`:o.html`<span class="section-label">All tags</span>`}
923
945
  </div>
924
946
  <div class="options-list">
925
- ${a.map(i=>this._renderTagItem(i))}
947
+ ${i.map(a=>this._renderTagItem(a))}
926
948
  </div>
927
949
  </div>
928
950
  `:o.nothing}
@@ -946,7 +968,7 @@
946
968
  ${t.length>0?o.html`<div class="separator"></div>`:o.nothing}
947
969
 
948
970
  <div class="hint-message">Find more tags by using search</div>
949
- `}};ae.styles=[J,te,o.css`
971
+ `}};ie.styles=[J,te,o.css`
950
972
  .tag-item {
951
973
  display: flex;
952
974
  align-items: center;
@@ -1020,7 +1042,7 @@
1020
1042
  max-height: none;
1021
1043
  overflow-y: visible;
1022
1044
  }
1023
- `];Oe([c.property({type:Array})],ae.prototype,"tags",2);Oe([c.property({type:Array})],ae.prototype,"selected",2);Oe([c.property()],ae.prototype,"filterKey",2);Oe([c.query(".tag-search")],ae.prototype,"_searchInput",2);Oe([c.state()],ae.prototype,"_search",2);ae=Oe([c.customElement("ap-filter-tags")],ae);var Qi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,qe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Zi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Qi(e,s,i),i};let me=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=ft}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(a=>a!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:s,operator:_.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:e,operator:_.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:[],operator:_.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1045
+ `];Me([c.property({type:Array})],ie.prototype,"tags",2);Me([c.property({type:Array})],ie.prototype,"selected",2);Me([c.property()],ie.prototype,"filterKey",2);Me([c.query(".tag-search")],ie.prototype,"_searchInput",2);Me([c.state()],ie.prototype,"_search",2);ie=Me([c.customElement("ap-filter-tags")],ie);var Za=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ja(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 me=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=ft}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:s,operator:y.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:[],operator:y.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
1024
1046
  <div
1025
1047
  class="label-item ${s?"disabled":""}"
1026
1048
  title=${s?`You can select up to ${ft} labels`:o.nothing}
@@ -1055,12 +1077,12 @@
1055
1077
  ${!this._isSearching&&this.selected.length>0?o.html`
1056
1078
  <div class="filter-section">
1057
1079
  <div class="chips-wrap">
1058
- ${this.selected.map(s=>{const a=this._getLabelBySid(s);return a?o.html`
1080
+ ${this.selected.map(s=>{const i=this._getLabelBySid(s);return i?o.html`
1059
1081
  <div class="chip">
1060
- <span class="chip-icon" style="color: ${a.color}">
1082
+ <span class="chip-icon" style="color: ${i.color}">
1061
1083
  <ap-icon name="tag" .size=${12}></ap-icon>
1062
1084
  </span>
1063
- <span class="chip-label">${a.name}</span>
1085
+ <span class="chip-label">${i.name}</span>
1064
1086
  <button class="chip-remove" @click=${()=>this._remove(s)}>
1065
1087
  <ap-icon name="close" .size=${10}></ap-icon>
1066
1088
  </button>
@@ -1142,15 +1164,15 @@
1142
1164
  flex-shrink: 0;
1143
1165
  line-height: 0;
1144
1166
  }
1145
- `];qe([c.property({type:Array})],me.prototype,"labels",2);qe([c.property({type:Array})],me.prototype,"selected",2);qe([c.query(".search-input")],me.prototype,"_searchInput",2);qe([c.state()],me.prototype,"_search",2);me=qe([c.customElement("ap-filter-labels")],me);var Ji=Object.defineProperty,ea=Object.getOwnPropertyDescriptor,Me=(t,e,s,a)=>{for(var i=a>1?void 0:a?ea(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ji(e,s,i),i};const wt=3,Ct=/^#[0-9A-Fa-f]{6}$/;function ta(t){const e=t.trim().split(/\s+/);return e.length<1||!Ct.test(e[0])?null:{hex:e[0],tolerance:e[1]||Ze,coverage:e[3]||Qe}}let re=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const a=ta(s);a&&e.push(a)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Ze||s.coverage!==Qe)),this._initialized=!0)}}_selectColor(t){if(!Ct.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=wt||(this._colors=[...this._colors,{hex:t,tolerance:Ze,coverage:Qe}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let a=e.target.value.trim();if(a.startsWith("#")||(a="#"+a),!Ct.test(a)||this._colors.some((n,l)=>l!==t&&n.hex.toLowerCase()===a.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:a},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,a=parseInt(s,10);if(!isNaN(a)&&a>=1&&a<=100){const i=[...this._colors];i[t]={...i[t],coverage:String(a)},this._colors=i,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Ze,a=this._advanced?e.coverage:Qe;return`${e.hex} ${s} ${s} ${a}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=wt;return o.html`
1167
+ `];qe([c.property({type:Array})],me.prototype,"labels",2);qe([c.property({type:Array})],me.prototype,"selected",2);qe([c.query(".search-input")],me.prototype,"_searchInput",2);qe([c.state()],me.prototype,"_search",2);me=qe([c.customElement("ap-filter-labels")],me);var ei=Object.defineProperty,ti=Object.getOwnPropertyDescriptor,Oe=(t,e,s,i)=>{for(var a=i>1?void 0:i?ti(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&&ei(e,s,a),a};const kt=3,Et=/^#[0-9A-Fa-f]{6}$/;function si(t){const e=t.trim().split(/\s+/);return e.length<1||!Et.test(e[0])?null:{hex:e[0],tolerance:e[1]||Ze,coverage:e[3]||Qe}}let re=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=si(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Ze||s.coverage!==Qe)),this._initialized=!0)}}_selectColor(t){if(!Et.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=kt||(this._colors=[...this._colors,{hex:t,tolerance:Ze,coverage:Qe}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!Et.test(i)||this._colors.some((n,l)=>l!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:i},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Ze,i=this._advanced?e.coverage:Qe;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=kt;return o.html`
1146
1168
  <div class="palette">
1147
- ${Zs.map(s=>{const a=t.has(s),i=e&&!a;return o.html`
1169
+ ${Js.map(s=>{const i=t.has(s),a=e&&!i;return o.html`
1148
1170
  <button
1149
- class="swatch ${a?"selected":""} ${i?"disabled":""}"
1171
+ class="swatch ${i?"selected":""} ${a?"disabled":""}"
1150
1172
  style="background:${s};${s==="#ffffff"?" border: 1px solid #e4e4e7;":""}"
1151
- @click=${()=>!i&&this._selectColor(s)}
1173
+ @click=${()=>!a&&this._selectColor(s)}
1152
1174
  title=${s}
1153
- ?disabled=${i}
1175
+ ?disabled=${a}
1154
1176
  ></button>
1155
1177
  `})}
1156
1178
  </div>
@@ -1173,7 +1195,7 @@
1173
1195
  <span class="adv-field-label">Difference</span>
1174
1196
  <ap-dropdown
1175
1197
  .value=${t.tolerance}
1176
- .options=${Js}
1198
+ .options=${ea}
1177
1199
  @ap-change=${s=>this._handleToleranceChange(e,s)}
1178
1200
  ></ap-dropdown>
1179
1201
  </div>
@@ -1209,7 +1231,7 @@
1209
1231
  <ap-icon name="close" .size=${14}></ap-icon>
1210
1232
  </button>
1211
1233
  </div>
1212
- `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<wt&&!this._showPalette;return o.html`
1234
+ `}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<kt&&!this._showPalette;return o.html`
1213
1235
  <div class="filter-content">
1214
1236
  <button
1215
1237
  class="clear-btn"
@@ -1235,7 +1257,7 @@
1235
1257
  ${this._colors.length>0?o.html`
1236
1258
  <div class="filter-section">
1237
1259
  <div class="selected-colors">
1238
- ${this._colors.map((s,a)=>this._renderColorEntry(s,a))}
1260
+ ${this._colors.map((s,i)=>this._renderColorEntry(s,i))}
1239
1261
  </div>
1240
1262
  </div>
1241
1263
  `:o.nothing}
@@ -1488,7 +1510,7 @@
1488
1510
  border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
1489
1511
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
1490
1512
  }
1491
- `];Me([c.property({type:Array})],re.prototype,"values",2);Me([c.state()],re.prototype,"_colors",2);Me([c.state()],re.prototype,"_advanced",2);Me([c.state()],re.prototype,"_showPalette",2);Me([c.state()],re.prototype,"_initialized",2);re=Me([c.customElement("ap-filter-color")],re);var sa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,ye=(t,e,s,a)=>{for(var i=a>1?void 0:a?ia(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&sa(e,s,i),i};const aa={KB:1/1e3,MB:1,GB:1e3},ra=[{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=aa[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 a;if(e!==null&&s!==null)a=`${e}..${s}`;else if(e!==null)a=`${e}..`;else if(s!==null)a=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[],operator:_.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[a],operator:_.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`
1513
+ `];Oe([c.property({type:Array})],re.prototype,"values",2);Oe([c.state()],re.prototype,"_colors",2);Oe([c.state()],re.prototype,"_advanced",2);Oe([c.state()],re.prototype,"_showPalette",2);Oe([c.state()],re.prototype,"_initialized",2);re=Oe([c.customElement("ap-filter-color")],re);var ai=Object.defineProperty,ii=Object.getOwnPropertyDescriptor,ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?ii(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&&ai(e,s,a),a};const ri={KB:1/1e3,MB:1,GB:1e3},oi=[{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=ri[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`
1492
1514
  <div class="filter-content">
1493
1515
  <span class="section-label">Size</span>
1494
1516
  <button
@@ -1525,7 +1547,7 @@
1525
1547
  <div>
1526
1548
  <span class="input-label">Unit</span>
1527
1549
  <ap-dropdown
1528
- .options=${ra}
1550
+ .options=${oi}
1529
1551
  .value=${this._unit}
1530
1552
  @ap-change=${this._setUnit}
1531
1553
  ></ap-dropdown>
@@ -1551,19 +1573,19 @@
1551
1573
  display: block;
1552
1574
  width: 100%;
1553
1575
  }
1554
- `];ye([c.property({type:Number})],Q.prototype,"min",2);ye([c.property({type:Number})],Q.prototype,"max",2);ye([c.state()],Q.prototype,"_minVal",2);ye([c.state()],Q.prototype,"_maxVal",2);ye([c.state()],Q.prototype,"_unit",2);ye([c.state()],Q.prototype,"_initialized",2);Q=ye([c.customElement("ap-filter-size")],Q);var oa=Object.defineProperty,na=Object.getOwnPropertyDescriptor,pt=(t,e,s,a)=>{for(var i=a>1?void 0:a?na(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&oa(e,s,i),i};const la=o.svg`
1576
+ `];ye([c.property({type:Number})],Q.prototype,"min",2);ye([c.property({type:Number})],Q.prototype,"max",2);ye([c.state()],Q.prototype,"_minVal",2);ye([c.state()],Q.prototype,"_maxVal",2);ye([c.state()],Q.prototype,"_unit",2);ye([c.state()],Q.prototype,"_initialized",2);Q=ye([c.customElement("ap-filter-size")],Q);var ni=Object.defineProperty,li=Object.getOwnPropertyDescriptor,pt=(t,e,s,i)=>{for(var a=i>1?void 0:i?li(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};const ci=o.svg`
1555
1577
  <svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
1556
1578
  <path d="M2.66666 1.9987C2.29847 1.9987 1.99999 2.29717 1.99999 2.66536L1.99999 13.332C1.99999 13.7002 2.29847 13.9987 2.66666 13.9987L9.33332 13.9987C9.70151 13.9987 9.99999 13.7002 9.99999 13.332L9.99999 2.66536C9.99999 2.29717 9.70151 1.9987 9.33332 1.9987L2.66666 1.9987ZM9.33332 0.665364C10.4379 0.665364 11.3333 1.56079 11.3333 2.66536L11.3333 13.332C11.3333 14.4366 10.4379 15.332 9.33332 15.332L2.66666 15.332C1.56209 15.332 0.666656 14.4366 0.666656 13.332L0.666656 2.66536C0.666656 1.56079 1.56209 0.665364 2.66666 0.665364L9.33332 0.665364Z" fill="#9747FF"/>
1557
1579
  <path d="M5.33332 4.65885C5.33332 4.29066 5.6318 3.99219 5.99999 3.99219C6.36818 3.99219 6.66666 4.29066 6.66666 4.65885L6.66666 4.66536C6.66666 5.03355 6.36818 5.33203 5.99999 5.33203C5.6318 5.33203 5.33332 5.03355 5.33332 4.66536L5.33332 4.65885Z" fill="#9747FF"/>
1558
1580
  <path d="M5.33332 11.3255C5.33332 10.9573 5.6318 10.6589 5.99999 10.6589C6.36818 10.6589 6.66666 10.9573 6.66666 11.3255L6.66666 11.332C6.66666 11.7002 6.36818 11.9987 5.99999 11.9987C5.6318 11.9987 5.33332 11.7002 5.33332 11.332L5.33332 11.3255Z" fill="#9747FF"/>
1559
1581
  </svg>
1560
- `,ca=o.svg`
1582
+ `,di=o.svg`
1561
1583
  <svg width="20" height="20" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
1562
1584
  <path d="M14 2.66797C14 2.29978 13.7015 2.0013 13.3333 2.0013H2.66666C2.29847 2.0013 1.99999 2.29978 1.99999 2.66797V9.33463C1.99999 9.70282 2.29847 10.0013 2.66666 10.0013H13.3333C13.7015 10.0013 14 9.70282 14 9.33463V2.66797ZM15.3333 9.33463C15.3333 10.4392 14.4379 11.3346 13.3333 11.3346H2.66666C1.56209 11.3346 0.666656 10.4392 0.666656 9.33463V2.66797C0.666656 1.5634 1.56209 0.667969 2.66666 0.667969H13.3333C14.4379 0.667969 15.3333 1.5634 15.3333 2.66797V9.33463Z" fill="#65A30D"/>
1563
1585
  <path d="M11.3398 5.33464C11.708 5.33464 12.0065 5.63311 12.0065 6.0013C12.0065 6.36949 11.708 6.66797 11.3398 6.66797H11.3333C10.9651 6.66797 10.6667 6.36949 10.6667 6.0013C10.6667 5.63311 10.9651 5.33464 11.3333 5.33464H11.3398Z" fill="#65A30D"/>
1564
1586
  <path d="M4.67317 5.33464C5.04136 5.33464 5.33983 5.63311 5.33983 6.0013C5.33983 6.36949 5.04136 6.66797 4.67317 6.66797H4.66666C4.29847 6.66797 3.99999 6.36949 3.99999 6.0013C3.99999 5.63311 4.29847 5.33464 4.66666 5.33464H4.67317Z" fill="#65A30D"/>
1565
1587
  </svg>
1566
- `,da=o.svg`
1588
+ `,pi=o.svg`
1567
1589
  <svg width="20" height="20" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
1568
1590
  <path d="M12.3333 2.33203C12.3333 1.96384 12.0349 1.66536 11.6667 1.66536H2.33334C1.96515 1.66536 1.66668 1.96384 1.66668 2.33203V11.6654C1.66668 12.0336 1.96515 12.332 2.33334 12.332H11.6667C12.0349 12.332 12.3333 12.0336 12.3333 11.6654V2.33203ZM13.6667 11.6654C13.6667 12.7699 12.7712 13.6654 11.6667 13.6654H2.33334C1.22877 13.6654 0.333344 12.7699 0.333344 11.6654V2.33203C0.333344 1.22746 1.22877 0.332031 2.33334 0.332031H11.6667C12.7712 0.332031 13.6667 1.22746 13.6667 2.33203V11.6654Z" fill="#6366F1"/>
1569
1591
  <path d="M9.67319 3.66536C10.0414 3.66536 10.3399 3.96384 10.3399 4.33203C10.3399 4.70022 10.0414 4.9987 9.67319 4.9987H9.66668C9.29849 4.9987 9.00001 4.70022 9.00001 4.33203C9.00001 3.96384 9.29849 3.66536 9.66668 3.66536H9.67319Z" fill="#6366F1"/>
@@ -1571,13 +1593,13 @@
1571
1593
  <path d="M4.33985 8.9987C4.70804 8.9987 5.00652 9.29718 5.00652 9.66537C5.00652 10.0336 4.70804 10.332 4.33985 10.332H4.33334C3.96515 10.332 3.66668 10.0336 3.66668 9.66537C3.66668 9.29718 3.96515 8.9987 4.33334 8.9987H4.33985Z" fill="#6366F1"/>
1572
1594
  <path d="M9.67319 8.9987C10.0414 8.9987 10.3399 9.29718 10.3399 9.66537C10.3399 10.0336 10.0414 10.332 9.67319 10.332H9.66668C9.29849 10.332 9.00001 10.0336 9.00001 9.66537C9.00001 9.29718 9.29849 8.9987 9.66668 8.9987H9.67319Z" fill="#6366F1"/>
1573
1595
  </svg>
1574
- `,pa=o.svg`
1596
+ `,hi=o.svg`
1575
1597
  <svg width="20" height="20" viewBox="0 0 16 8" fill="none" xmlns="http://www.w3.org/2000/svg">
1576
1598
  <path d="M14 2.33203C14 1.96384 13.7015 1.66536 13.3333 1.66536H2.66666C2.29847 1.66536 1.99999 1.96384 1.99999 2.33203V5.66536C1.99999 6.03355 2.29847 6.33203 2.66666 6.33203H13.3333C13.7015 6.33203 14 6.03355 14 5.66536V2.33203ZM15.3333 5.66536C15.3333 6.76993 14.4379 7.66536 13.3333 7.66536H2.66666C1.56209 7.66536 0.666656 6.76993 0.666656 5.66536V2.33203C0.666656 1.22746 1.56209 0.332031 2.66666 0.332031H13.3333C14.4379 0.332031 15.3333 1.22746 15.3333 2.33203V5.66536Z" fill="#4BA3AD"/>
1577
1599
  <path d="M11.3398 3.33203C11.708 3.33203 12.0065 3.63051 12.0065 3.9987C12.0065 4.36689 11.708 4.66536 11.3398 4.66536H11.3333C10.9651 4.66536 10.6667 4.36689 10.6667 3.9987C10.6667 3.63051 10.9651 3.33203 11.3333 3.33203H11.3398Z" fill="#4BA3AD"/>
1578
1600
  <path d="M4.67317 3.33203C5.04136 3.33203 5.33983 3.63051 5.33983 3.9987C5.33983 4.36689 5.04136 4.66536 4.67317 4.66536H4.66666C4.29847 4.66536 3.99999 4.36689 3.99999 3.9987C3.99999 3.63051 4.29847 3.33203 4.66666 3.33203H4.67317Z" fill="#4BA3AD"/>
1579
1601
  </svg>
1580
- `,ha={portrait:la,landscape:ca,square:da,panorama:pa};let Ee=class extends o.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return o.html`
1602
+ `,ui={portrait:ci,landscape:di,square:pi,panorama:hi};let Ee=class extends o.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return o.html`
1581
1603
  <div class="filter-content">
1582
1604
  <button
1583
1605
  class="clear-btn"
@@ -1588,7 +1610,7 @@
1588
1610
  <div class="filter-section">
1589
1611
  <span class="section-label">Resolution</span>
1590
1612
  <div class="options-horizontal">
1591
- ${Ys.map(t=>o.html`
1613
+ ${Xs.map(t=>o.html`
1592
1614
  <ap-checkbox
1593
1615
  ?checked=${this.selectedResolution.includes(t.value)}
1594
1616
  @ap-toggle=${()=>{this._toggleResolution(t.value)}}
@@ -1600,11 +1622,11 @@
1600
1622
  <div class="filter-section">
1601
1623
  <span class="section-label">Orientation</span>
1602
1624
  <div class="options-vertical">
1603
- ${Xs.map(t=>o.html`
1625
+ ${Ws.map(t=>o.html`
1604
1626
  <ap-checkbox
1605
1627
  ?checked=${this.selectedOrientation.includes(t.value)}
1606
1628
  @ap-toggle=${()=>{this._toggleOrientation(t.value)}}
1607
- ><span class="orientation-label">${ha[t.value]}${t.label}</span></ap-checkbox>
1629
+ ><span class="orientation-label">${ui[t.value]}${t.label}</span></ap-checkbox>
1608
1630
  `)}
1609
1631
  </div>
1610
1632
  </div>
@@ -1612,7 +1634,7 @@
1612
1634
  <div class="filter-section">
1613
1635
  <span class="section-label">Faces</span>
1614
1636
  <div class="options-horizontal">
1615
- ${Ws.map(t=>o.html`
1637
+ ${Qs.map(t=>o.html`
1616
1638
  <ap-checkbox
1617
1639
  ?checked=${this.selectedFaces.includes(t.value)}
1618
1640
  @ap-toggle=${()=>{this._toggleFaces(t.value)}}
@@ -1644,15 +1666,15 @@
1644
1666
  .orientation-label svg {
1645
1667
  flex-shrink: 0;
1646
1668
  }
1647
- `];pt([c.property({type:Array})],Ee.prototype,"selectedResolution",2);pt([c.property({type:Array})],Ee.prototype,"selectedOrientation",2);pt([c.property({type:Array})],Ee.prototype,"selectedFaces",2);Ee=pt([c.customElement("ap-filter-image")],Ee);var ua=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,M=(t,e,s,a)=>{for(var i=a>1?void 0:a?ga(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ua(e,s,i),i};function y(t){return`${ct[t.type]||""}${t.key}`}let E=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=>y(e)===t)}_getUIType(t){return ii[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,a;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===B?B:((a=e.values)==null?void 0:a[0])===U?U:this._specificModeFields.has(t)||e.values&&e.values.length>0?he:""}_emitFilterChange(t,e,s){const a=y(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:a,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=y(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=y(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=y(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 a=this._getApplied(y(t)).values||[];this._emitFilterChange(t,e,a)}_onContentModeChange(t,e){const s=y(t);if(e===he){const a=new Set(this._specificModeFields);a.add(s),this._specificModeFields=a;const i=this._getApplied(s);this._isSpecialValue(i.values)&&this._emitFilterChange(t,i.operator,[])}else{if(this._specificModeFields.has(s)){const a=new Set(this._specificModeFields);a.delete(s),this._specificModeFields=a}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=y(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...a}=this._datePresets;this._datePresets=a;const{[e]:i,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...l}=this._dateTos;this._dateTos=l;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,i=this._getApplied(y(t)).operator||vt[0].value;this._emitFilterChange(t,i,s?[s]:[])}_onNumberInput(t,e,s){const a=e.target.value,i=y(t),r=this._getApplied(i),n=r.operator||_t[0].value,l=[...r.values||[]];s===0?l[0]=a:l[1]=a;const d=l.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===x.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,l)}_onBooleanSelect(t,e){var i;const s=this._getApplied(y(t));((i=s.values)==null?void 0:i[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||X[0].value,r=a.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,i,[]):this._emitFilterChange(t,i,[e])}_onMultiSelectToggle(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||bt[0].value,r=a.values||[],n=r.includes(e)?r.filter(l=>l!==e):[...r,e];this._emitFilterChange(t,i,n)}_onTagKeydown(t,e){const s=y(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const a=s.target.value;if(a.includes(",")){const i=a.replace(/,/g,"").trim();i&&(this._tagInputs={...this._tagInputs,[e]:i},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:a},this._fetchTagSuggestions(t,e,a.trim())}_selectTagSuggestion(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||X[0].value,r=a.values||[];r.includes(e)||this._emitFilterChange(t,i,[...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 a=`_${t.ckey||t.key}`,i=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:a});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(i.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 a=this._getApplied(e),i=a.operator||X[0].value,r=a.values||[];r.includes(s)||this._emitFilterChange(t,i,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||X[0].value,r=a.values||[];this._emitFilterChange(t,i,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=y(t),i=this._getApplied(s).values||[];this._emitFilterChange(t,e,i)}_onDatePreset(t,e){const s=y(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 a=new Date;let i="",r="";switch(e){case"today":{const n=new Date(a);n.setHours(0,0,0,0),i=n.toISOString(),r=a.toISOString();break}case"last_week":{const n=new Date(a),l=n.getDay();n.setDate(n.getDate()-(l===0?6:l-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),i=d.toISOString(),r=n.toISOString();break}case"last_month":{const n=new Date(a.getFullYear(),a.getMonth(),1),l=new Date(n);l.setMonth(l.getMonth()-1),i=l.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(a.getFullYear(),0,1),l=new Date(n);l.setFullYear(l.getFullYear()-1),i=l.toISOString(),r=n.toISOString();break}}i&&r&&(this._dateFroms={...this._dateFroms,[s]:i},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[i,r]))}_onDateInput(t,e,s){const a=s.target.value,i=y(t),r=this._datePresets[i]||"",n=a?new Date(a+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[i]:n}:this._dateTos={...this._dateTos,[i]:n};let l=this._dateFroms[i]||"",d=this._dateTos[i]||"";r==="after"&&l&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[i]:d}),r==="before"&&d&&(l=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[i]:l}),l&&d&&this._emitFilterChange(t,"..",[l,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),a=y(t),i=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${a}"]`),r=(i==null?void 0:i.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[l,d]=n;let u=`${l},${d}..${r||"0"}`;this._emitFilterChange(t,_.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,a=y(t),i=this._getApplied(a);if(!((d=i.values)!=null&&d[0]))return;const r=i.values[0],[n]=r.split("..");let l=n;s&&(l+=`..${s}`),this._emitFilterChange(t,_.IS,[l])}_onEmptyOption(t,e){var i;const s=this._getApplied(y(t));((i=s.values)==null?void 0:i[0])===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(r=>r.label.toLowerCase().includes(t)),s=e.filter(r=>!r.group||r.group==="root"),a=e.filter(r=>r.group==="product"),i=(r,n)=>n.length===0?o.nothing:o.html`
1648
- <div class="field-group-label">${r}</div>
1649
- ${n.map(l=>{const d=y(l),h=this.visibleFields.includes(d),u=!h&&this._atFieldLimit;return o.html`
1669
+ `];pt([c.property({type:Array})],Ee.prototype,"selectedResolution",2);pt([c.property({type:Array})],Ee.prototype,"selectedOrientation",2);pt([c.property({type:Array})],Ee.prototype,"selectedFaces",2);Ee=pt([c.customElement("ap-filter-image")],Ee);var gi=Object.defineProperty,fi=Object.getOwnPropertyDescriptor,A=(t,e,s,i)=>{for(var a=i>1?void 0:i?fi(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};function x(t){return`${ct[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 ia[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=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,...l}=this._dateTos;this._dateTos=l;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||vt[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||_t[0].value,l=[...r.values||[]];s===0?l[0]=i:l[1]=i;const d=l.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,l)}_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||bt[0].value,r=i.values||[],n=r.includes(e)?r.filter(l=>l!==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),l=n.getDay();n.setDate(n.getDate()-(l===0?6:l-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),l=new Date(n);l.setMonth(l.getMonth()-1),a=l.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),l=new Date(n);l.setFullYear(l.getFullYear()-1),a=l.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 l=this._dateFroms[a]||"",d=this._dateTos[a]||"";r==="after"&&l&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),r==="before"&&d&&(l=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:l}),l&&d&&this._emitFilterChange(t,"..",[l,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[l,d]=n;let u=`${l},${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 l=n;s&&(l+=`..${s}`),this._emitFilterChange(t,y.IS,[l])}_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`
1670
+ <div class="field-group-label">${a}</div>
1671
+ ${r.map(n=>{const l=x(n),d=this.visibleFields.includes(l),h=!d&&this._atFieldLimit;return o.html`
1650
1672
  <div
1651
- class="field-item ${h?"selected":""} ${u?"disabled":""}"
1652
- @click=${()=>!u&&!h&&this._addField(l)}
1673
+ class="field-item ${d?"selected":""} ${h?"disabled":""}"
1674
+ @click=${()=>!h&&!d&&this._addField(n)}
1653
1675
  >
1654
- ${h?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.nothing}
1655
- <span>${l.label}</span>
1676
+ ${d?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.html`<ap-icon name=${xt[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>`}
1677
+ <span>${n.label}</span>
1656
1678
  </div>
1657
1679
  `})}
1658
1680
  `;return o.html`
@@ -1671,16 +1693,13 @@
1671
1693
  type="text"
1672
1694
  placeholder="Search fields..."
1673
1695
  .value=${this._fieldSearch}
1674
- @input=${r=>{this._fieldSearch=r.target.value}}
1696
+ @input=${a=>{this._fieldSearch=a.target.value}}
1675
1697
  />
1676
1698
  <div class="field-list">
1677
- ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`
1678
- ${i("Root fields",s)}
1679
- ${i("Product fields",a)}
1680
- `}
1699
+ ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
1681
1700
  </div>
1682
1701
  </div>
1683
- `}_renderTextFilter(t){var h,u;const e=y(t),s=this._getApplied(e),i=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===B||r===U,l=s.operator||vt[0].value,d=t.type===x.TEXT_AREA;return o.html`
1702
+ `}_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===U||r===B,l=s.operator||vt[0].value,d=t.type===_.TEXT_AREA;return o.html`
1684
1703
  <div class="filter-content" style="position: relative;">
1685
1704
  <button
1686
1705
  class="clear-btn"
@@ -1715,7 +1734,7 @@
1715
1734
  <textarea
1716
1735
  class="filter-input"
1717
1736
  placeholder="Enter value..."
1718
- .value=${i}
1737
+ .value=${a}
1719
1738
  @change=${f=>this._onTextInput(t,f)}
1720
1739
  ></textarea>
1721
1740
  `:o.html`
@@ -1723,7 +1742,7 @@
1723
1742
  class="filter-input"
1724
1743
  type="text"
1725
1744
  placeholder="Enter value..."
1726
- .value=${i}
1745
+ .value=${a}
1727
1746
  @change=${f=>this._onTextInput(t,f)}
1728
1747
  @keydown=${f=>{f.key==="Enter"&&f.preventDefault()}}
1729
1748
  />
@@ -1731,11 +1750,11 @@
1731
1750
  </div>
1732
1751
  `:o.nothing}
1733
1752
  </div>
1734
- `}_renderNumberFilter(t){var $,k,A;const e=y(t),s=this._getApplied(e),a=s.operator||_t[0].value,i=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===B||r===U,l=a===_.RANGE,d=a===_.GREATER_THAN_OR_EQUAL,h=a===_.LESS_THAN_OR_EQUAL,u=t.type===x.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=i?"":(($=s.values)==null?void 0:$[0])||"",v=i?"":((k=s.values)==null?void 0:k[1])||"",w=l||d||h,b=l||d||h?"Min":"Value";return o.html`
1753
+ `}_renderNumberFilter(t){var w,T,j;const e=x(t),s=this._getApplied(e),i=s.operator||_t[0].value,a=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===U||r===B,l=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])||"",$=l||d||h,b=l||d||h?"Min":"Value";return o.html`
1735
1754
  <div class="filter-content" style="position: relative;">
1736
1755
  <button
1737
1756
  class="clear-btn"
1738
- ?disabled=${!((A=s.values)!=null&&A.length)&&!s.operator}
1757
+ ?disabled=${!((j=s.values)!=null&&j.length)&&!s.operator}
1739
1758
  @click=${()=>this._clearFieldFilter(t)}
1740
1759
  >Clear all</button>
1741
1760
 
@@ -1744,9 +1763,9 @@
1744
1763
  <ap-radio-group
1745
1764
  columns="2"
1746
1765
  .options=${_t}
1747
- .value=${a}
1766
+ .value=${i}
1748
1767
  ?disabled=${n}
1749
- @ap-change=${T=>this._onOperatorChange(t,T.detail.value)}
1768
+ @ap-change=${S=>this._onOperatorChange(t,S.detail.value)}
1750
1769
  ></ap-radio-group>
1751
1770
  </div>
1752
1771
 
@@ -1755,7 +1774,7 @@
1755
1774
  <ap-radio-group
1756
1775
  .options=${yt}
1757
1776
  .value=${r}
1758
- @ap-change=${T=>this._onContentModeChange(t,T.detail.value)}
1777
+ @ap-change=${S=>this._onContentModeChange(t,S.detail.value)}
1759
1778
  ></ap-radio-group>
1760
1779
  </div>
1761
1780
 
@@ -1771,10 +1790,10 @@
1771
1790
  placeholder=${p}
1772
1791
  .value=${g}
1773
1792
  ?disabled=${h}
1774
- @change=${T=>this._onNumberInput(t,T,0)}
1793
+ @change=${S=>this._onNumberInput(t,S,0)}
1775
1794
  />
1776
1795
  </div>
1777
- ${w?o.html`
1796
+ ${$?o.html`
1778
1797
  <div>
1779
1798
  <span class="input-label" aria-disabled=${d?"true":o.nothing}>${"Max"}</span>
1780
1799
  <input
@@ -1784,7 +1803,7 @@
1784
1803
  placeholder=${p}
1785
1804
  .value=${v}
1786
1805
  ?disabled=${d}
1787
- @change=${T=>this._onNumberInput(t,T,1)}
1806
+ @change=${S=>this._onNumberInput(t,S,1)}
1788
1807
  />
1789
1808
  </div>
1790
1809
  `:o.nothing}
@@ -1792,24 +1811,24 @@
1792
1811
  </div>
1793
1812
  `:o.nothing}
1794
1813
  </div>
1795
- `}_renderBooleanFilter(t){var a,i;const e=this._getApplied(y(t)),s=((a=e.values)==null?void 0:a[0])||"";return o.html`
1814
+ `}_renderBooleanFilter(t){var i,a;const e=this._getApplied(x(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
1796
1815
  <div class="filter-content" style="position: relative;">
1797
1816
  <button
1798
1817
  class="clear-btn"
1799
- ?disabled=${!((i=e.values)!=null&&i.length)}
1818
+ ?disabled=${!((a=e.values)!=null&&a.length)}
1800
1819
  @click=${()=>this._clearFieldFilter(t)}
1801
1820
  >Clear all</button>
1802
1821
 
1803
1822
  <div class="filter-section">
1804
1823
  <span class="section-label">Value</span>
1805
1824
  <ap-radio-group
1806
- .options=${si}
1825
+ .options=${aa}
1807
1826
  .value=${s}
1808
1827
  @ap-change=${r=>this._onBooleanSelect(t,r.detail.value)}
1809
1828
  ></ap-radio-group>
1810
1829
  </div>
1811
1830
  </div>
1812
- `}_renderSelectOneFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=t.possible_values||[],n=s.operator||X[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=i.length>0||a,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=i.length>=Xe;return o.html`
1831
+ `}_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,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=Xe;return o.html`
1813
1832
  <div class="filter-content">
1814
1833
  <!-- Search input -->
1815
1834
  <div class="search-wrapper">
@@ -1856,10 +1875,10 @@
1856
1875
  </div>
1857
1876
 
1858
1877
  <!-- Selected chips -->
1859
- ${i.length>0?o.html`
1878
+ ${a.length>0?o.html`
1860
1879
  <div class="filter-section">
1861
1880
  <div class="chips-wrap">
1862
- ${i.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
1881
+ ${a.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
1863
1882
  <div class="chip">
1864
1883
  <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
1865
1884
  <button class="chip-remove" @click=${()=>this._onSelectOneToggle(t,p)}>
@@ -1893,7 +1912,7 @@
1893
1912
 
1894
1913
  <!-- Regular options -->
1895
1914
  <div class="options-list">
1896
- ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=i.includes(p.api_value),v=!g&&f;return o.html`
1915
+ ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),v=!g&&f;return o.html`
1897
1916
  <div
1898
1917
  class="option-item ${v?"disabled":""}"
1899
1918
  @click=${()=>!v&&this._onSelectOneToggle(t,p.api_value)}
@@ -1905,7 +1924,7 @@
1905
1924
  </div>
1906
1925
  </div>
1907
1926
  </div>
1908
- `}_renderMultiSelectFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=t.possible_values||[],n=s.operator||bt[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=i.length>0||a,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=i.length>=Xe;return o.html`
1927
+ `}_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||bt[0].value,l=(this._selectSearches[e]||"").toLowerCase(),d=l.length>0,h=a.length>0||i,u=l?r.filter(p=>p.label.toLowerCase().includes(l)):r,f=a.length>=Xe;return o.html`
1909
1928
  <div class="filter-content">
1910
1929
  <!-- Search input -->
1911
1930
  <div class="search-wrapper">
@@ -1952,10 +1971,10 @@
1952
1971
  </div>
1953
1972
 
1954
1973
  <!-- Selected chips -->
1955
- ${i.length>0?o.html`
1974
+ ${a.length>0?o.html`
1956
1975
  <div class="filter-section">
1957
1976
  <div class="chips-wrap">
1958
- ${i.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
1977
+ ${a.map(p=>{const g=r.find(v=>v.api_value===p);return o.html`
1959
1978
  <div class="chip">
1960
1979
  <span class="chip-label">${(g==null?void 0:g.label)||p}</span>
1961
1980
  <button class="chip-remove" @click=${()=>this._onMultiSelectToggle(t,p)}>
@@ -1989,7 +2008,7 @@
1989
2008
 
1990
2009
  <!-- Regular options -->
1991
2010
  <div class="options-list">
1992
- ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=i.includes(p.api_value),v=!g&&f;return o.html`
2011
+ ${u.length===0?o.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),v=!g&&f;return o.html`
1993
2012
  <div
1994
2013
  class="option-item ${v?"disabled":""}"
1995
2014
  @click=${()=>!v&&this._onMultiSelectToggle(t,p.api_value)}
@@ -2001,7 +2020,7 @@
2001
2020
  </div>
2002
2021
  </div>
2003
2022
  </div>
2004
- `}_renderTagsFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||X[0].value,l=i.length>0||a,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=i.length>=Xe;return o.html`
2023
+ `}_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,l=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`
2005
2024
  <div class="filter-content">
2006
2025
  <!-- Search input -->
2007
2026
  <div class="search-wrapper">
@@ -2044,16 +2063,16 @@
2044
2063
  direction="horizontal"
2045
2064
  .options=${X}
2046
2065
  .value=${n}
2047
- ?disabled=${a}
2066
+ ?disabled=${i}
2048
2067
  @ap-change=${p=>this._onTagOperatorChange(t,p.detail.value)}
2049
2068
  ></ap-radio-group>
2050
2069
  </div>
2051
2070
 
2052
2071
  <!-- Selected chips -->
2053
- ${i.length>0?o.html`
2072
+ ${a.length>0?o.html`
2054
2073
  <div class="filter-section">
2055
2074
  <div class="chips-wrap">
2056
- ${i.map(p=>o.html`
2075
+ ${a.map(p=>o.html`
2057
2076
  <div class="chip">
2058
2077
  <span class="chip-label">${p}</span>
2059
2078
  <button class="chip-remove" @click=${()=>this._removeTag(t,p)}>
@@ -2086,7 +2105,7 @@
2086
2105
  ${u?o.html`
2087
2106
  <div class="filter-section">
2088
2107
  <div class="options-list">
2089
- ${h?o.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=i.includes(p),v=!g&&f;return o.html`
2108
+ ${h?o.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=a.includes(p),v=!g&&f;return o.html`
2090
2109
  <div
2091
2110
  class="option-item ${v?"disabled":""}"
2092
2111
  @click=${()=>!v&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
@@ -2099,11 +2118,11 @@
2099
2118
  </div>
2100
2119
  `:o.nothing}
2101
2120
  </div>
2102
- `}_renderDateFilter(t){var u,f;const e=y(t),s=this._datePresets[e]||"",a=this._getApplied(e),r=this._isSpecialValue(a.values)?((u=a.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],l=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`
2121
+ `}_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"}],l=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`
2103
2122
  <div class="filter-content" style="position: relative;">
2104
2123
  <button
2105
2124
  class="clear-btn"
2106
- ?disabled=${!r&&!((f=a.values)!=null&&f.length)}
2125
+ ?disabled=${!r&&!((f=i.values)!=null&&f.length)}
2107
2126
  @click=${()=>this._clearFieldFilter(t)}
2108
2127
  >Clear all</button>
2109
2128
 
@@ -2118,7 +2137,7 @@
2118
2137
 
2119
2138
  <ap-radio-group
2120
2139
  columns="2"
2121
- .options=${Et}
2140
+ .options=${Ft}
2122
2141
  .value=${r!=="empty"&&r!=="non-empty"?r:""}
2123
2142
  @ap-change=${p=>this._onDatePreset(t,p.detail.value)}
2124
2143
  ></ap-radio-group>
@@ -2171,7 +2190,7 @@
2171
2190
  </div>
2172
2191
  `:o.nothing}
2173
2192
  </div>
2174
- `}_renderGeoFilter(t){var u,f;const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=this._getContentMode(e);let r="",n="";if(!a&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const l=r.length>0,d=r.split(",").map(p=>p.trim()),h=!l||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2193
+ `}_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 l=r.length>0,d=r.split(",").map(p=>p.trim()),h=!l||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
2175
2194
  <div class="filter-content" style="position: relative;">
2176
2195
  <button
2177
2196
  class="clear-btn"
@@ -2183,12 +2202,12 @@
2183
2202
  <span class="section-label">Content</span>
2184
2203
  <ap-radio-group
2185
2204
  .options=${yt}
2186
- .value=${i}
2205
+ .value=${a}
2187
2206
  @ap-change=${p=>this._onContentModeChange(t,p.detail.value)}
2188
2207
  ></ap-radio-group>
2189
2208
  </div>
2190
2209
 
2191
- ${i===he?o.html`
2210
+ ${a===he?o.html`
2192
2211
  <div class="filter-section">
2193
2212
  <div class="geo-row">
2194
2213
  <div class="geo-location">
@@ -2217,11 +2236,11 @@
2217
2236
  </div>
2218
2237
  `:o.nothing}
2219
2238
  </div>
2220
- `}_renderAttachmentFilter(t){var a,i;const e=this._getApplied(y(t)),s=((a=e.values)==null?void 0:a[0])||"";return o.html`
2239
+ `}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(x(t)),s=((i=e.values)==null?void 0:i[0])||"";return o.html`
2221
2240
  <div class="filter-content" style="position: relative;">
2222
2241
  <button
2223
2242
  class="clear-btn"
2224
- ?disabled=${!((i=e.values)!=null&&i.length)}
2243
+ ?disabled=${!((a=e.values)!=null&&a.length)}
2225
2244
  @click=${()=>this._clearFieldFilter(t)}
2226
2245
  >Clear all</button>
2227
2246
 
@@ -2233,11 +2252,11 @@
2233
2252
  ></ap-radio-group>
2234
2253
  </div>
2235
2254
  </div>
2236
- `}_renderFaceMatcherFilter(t){const e=y(t),s=this._getApplied(e),a=s.values||[],i=s.operator||_.IS;return o.html`
2255
+ `}_renderFaceMatcherFilter(t){const e=x(t),s=this._getApplied(e),i=s.values||[],a=s.operator||y.IS;return o.html`
2237
2256
  <div class="filter-content" style="position: relative;">
2238
2257
  <button
2239
2258
  class="clear-btn"
2240
- ?disabled=${a.length===0}
2259
+ ?disabled=${i.length===0}
2241
2260
  @click=${()=>this._clearFieldFilter(t)}
2242
2261
  >Clear all</button>
2243
2262
 
@@ -2246,19 +2265,19 @@
2246
2265
  <ap-radio-group
2247
2266
  direction="horizontal"
2248
2267
  .options=${X}
2249
- .value=${i}
2250
- @ap-change=${r=>this._emitFilterChange(t,r.detail.value,a)}
2268
+ .value=${a}
2269
+ @ap-change=${r=>this._emitFilterChange(t,r.detail.value,i)}
2251
2270
  ></ap-radio-group>
2252
2271
  <input
2253
2272
  class="filter-input"
2254
2273
  type="text"
2255
2274
  placeholder="Search faces..."
2256
- .value=${a.join(", ")}
2257
- @change=${r=>{const l=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,i,l)}}
2275
+ .value=${i.join(", ")}
2276
+ @change=${r=>{const l=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,a,l)}}
2258
2277
  />
2259
2278
  </div>
2260
2279
  </div>
2261
- `}_renderFieldControl(t){switch(this._getUIType(t)){case"text":return this._renderTextFilter(t);case"number":return this._renderNumberFilter(t);case"boolean":return this._renderBooleanFilter(t);case"select-one":return this._renderSelectOneFilter(t);case"multi-select":return this._renderMultiSelectFilter(t);case"tags":return this._renderTagsFilter(t);case"date":return this._renderDateFilter(t);case"geo":return this._renderGeoFilter(t);case"attachment":return t.type===x.INTEGER_LIST&&t.slug==="face_matcher"?this._renderFaceMatcherFilter(t):this._renderAttachmentFilter(t);default:return o.nothing}}_renderFieldSection(t){const e=this._getField(t);if(!e)return o.nothing;const s=this._collapsedFields.has(t);return o.html`
2280
+ `}_renderFieldControl(t){switch(this._getUIType(t)){case"text":return this._renderTextFilter(t);case"number":return this._renderNumberFilter(t);case"boolean":return this._renderBooleanFilter(t);case"select-one":return this._renderSelectOneFilter(t);case"multi-select":return this._renderMultiSelectFilter(t);case"tags":return this._renderTagsFilter(t);case"date":return this._renderDateFilter(t);case"geo":return this._renderGeoFilter(t);case"attachment":return t.type===_.INTEGER_LIST&&t.slug==="face_matcher"?this._renderFaceMatcherFilter(t):this._renderAttachmentFilter(t);default:return o.nothing}}_renderFieldSection(t){const e=this._getField(t);if(!e)return o.nothing;const s=this._collapsedFields.has(t);return o.html`
2262
2281
  <div class="field-section">
2263
2282
  <div
2264
2283
  class="field-header"
@@ -2270,12 +2289,13 @@
2270
2289
  name="chevron-right"
2271
2290
  .size=${14}
2272
2291
  ></ap-icon>
2292
+ <ap-icon name=${xt[e.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2273
2293
  <span>${e.label}</span>
2274
2294
  </div>
2275
2295
  <div class="field-header-actions">
2276
2296
  <button
2277
2297
  class="icon-btn remove"
2278
- @click=${a=>{a.stopPropagation(),this._removeField(e)}}
2298
+ @click=${i=>{i.stopPropagation(),this._removeField(e)}}
2279
2299
  title="Remove field"
2280
2300
  >
2281
2301
  <ap-icon name="close" .size=${14}></ap-icon>
@@ -2286,22 +2306,23 @@
2286
2306
  ${this._renderFieldControl(e)}
2287
2307
  </div>
2288
2308
  </div>
2289
- `}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(r=>r.label.toLowerCase().includes(t)),s=e.filter(r=>!r.group||r.group==="root"),a=e.filter(r=>r.group==="product"),i=(r,n)=>n.length===0?o.nothing:o.html`
2290
- <div class="field-group-label">${r}</div>
2291
- ${n.map(l=>{const d=y(l),h=this.visibleFields.includes(d),u=!!this.appliedMetadata[d]||!!this.appliedFilters[d],f=this.pinnedFields.includes(d),p=!h&&this._atFieldLimit;return o.html`
2309
+ `}_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`
2310
+ <div class="field-group-label">${a}</div>
2311
+ ${r.map(n=>{const l=x(n),d=this.visibleFields.includes(l),h=!!this.appliedMetadata[l]||!!this.appliedFilters[l],u=this.pinnedFields.includes(l),f=!d&&this._atFieldLimit;return o.html`
2292
2312
  <div
2293
- class="field-item ${u?"has-filter":""} ${p?"disabled":""}"
2294
- @click=${()=>!p&&this._emitFieldSelect(l)}
2313
+ class="field-item ${h?"has-filter":""} ${f?"disabled":""}"
2314
+ @click=${()=>!f&&this._emitFieldSelect(n)}
2295
2315
  >
2296
- <span class="field-item-label">${l.label}</span>
2316
+ <ap-icon name=${xt[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
2317
+ <span class="field-item-label">${n.label}</span>
2297
2318
  <button
2298
- class="field-item-pin ${f?"pinned":""}"
2299
- @click=${g=>{g.stopPropagation(),this._emitPin(d,!f)}}
2300
- title=${f?"Unpin field":"Pin field"}
2319
+ class="field-item-pin ${u?"pinned":""}"
2320
+ @click=${p=>{p.stopPropagation(),this._emitPin(l,!u)}}
2321
+ title=${u?"Unpin field":"Pin field"}
2301
2322
  >
2302
2323
  <ap-icon name="pin" .size=${12}></ap-icon>
2303
2324
  </button>
2304
- ${u?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.nothing}
2325
+ ${h?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.nothing}
2305
2326
  </div>
2306
2327
  `})}
2307
2328
  `;return o.html`
@@ -2311,13 +2332,10 @@
2311
2332
  type="text"
2312
2333
  placeholder="Search fields..."
2313
2334
  .value=${this._fieldSearch}
2314
- @input=${r=>{this._fieldSearch=r.target.value}}
2335
+ @input=${a=>{this._fieldSearch=a.target.value}}
2315
2336
  />
2316
2337
  <div class="field-list">
2317
- ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`
2318
- ${i("Root fields",s)}
2319
- ${i("Product fields",a)}
2320
- `}
2338
+ ${e.length===0?o.html`<div class="empty-msg">No fields found</div>`:o.html`${[...s.entries()].map(([a,r])=>i(a,r))}`}
2321
2339
  </div>
2322
2340
  </div>
2323
2341
  `}_renderFieldMode(){const t=this._getField(this.activeFieldKey);return t?this._renderFieldControl(t):o.html`<div class="empty-msg">Field not found</div>`}render(){if(this.mode==="selector")return this._renderSelectorMode();if(this.mode==="field")return this._renderFieldMode();const t=this.visibleFields.length>0;return o.html`
@@ -2339,7 +2357,7 @@
2339
2357
  </button>
2340
2358
  `:o.nothing}
2341
2359
  `:o.nothing}
2342
- `}};E.styles=[J,te,o.css`
2360
+ `}};F.styles=[J,te,o.css`
2343
2361
  /* ── Field selection panel ─────────────────────────────── */
2344
2362
 
2345
2363
  .add-field-btn {
@@ -2703,7 +2721,7 @@
2703
2721
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
2704
2722
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
2705
2723
  }
2706
- `];M([c.property({type:Array})],E.prototype,"fields",2);M([c.property({type:Object})],E.prototype,"appliedFilters",2);M([c.property({type:Array})],E.prototype,"visibleFields",2);M([c.property()],E.prototype,"mode",2);M([c.property()],E.prototype,"activeFieldKey",2);M([c.property({type:Array})],E.prototype,"pinnedFields",2);M([c.property({type:Object})],E.prototype,"appliedMetadata",2);M([c.property({attribute:!1})],E.prototype,"apiClient",2);M([c.state()],E.prototype,"_showFieldSelection",2);M([c.state()],E.prototype,"_fieldSearch",2);M([c.state()],E.prototype,"_collapsedFields",2);M([c.state()],E.prototype,"_tagInputs",2);M([c.state()],E.prototype,"_tagSuggestions",2);M([c.state()],E.prototype,"_tagLoading",2);M([c.state()],E.prototype,"_datePresets",2);M([c.state()],E.prototype,"_dateFroms",2);M([c.state()],E.prototype,"_dateTos",2);M([c.state()],E.prototype,"_specificModeFields",2);M([c.state()],E.prototype,"_selectSearches",2);E=M([c.customElement("ap-filter-metadata")],E);var fa=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,G=(t,e,s,a)=>{for(var i=a>1?void 0:a?ma(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&fa(e,s,i),i};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(R.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(R.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(R.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(R.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(R.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(R.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(R.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(R.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(R.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(R.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:R.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:R.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`
2724
+ `];A([c.property({type:Array})],F.prototype,"fields",2);A([c.property({type:Object})],F.prototype,"appliedFilters",2);A([c.property({type:Array})],F.prototype,"visibleFields",2);A([c.property()],F.prototype,"mode",2);A([c.property()],F.prototype,"activeFieldKey",2);A([c.property({type:Array})],F.prototype,"pinnedFields",2);A([c.property({type:Object})],F.prototype,"appliedMetadata",2);A([c.property({attribute:!1})],F.prototype,"apiClient",2);A([c.state()],F.prototype,"_showFieldSelection",2);A([c.state()],F.prototype,"_fieldSearch",2);A([c.state()],F.prototype,"_collapsedFields",2);A([c.state()],F.prototype,"_tagInputs",2);A([c.state()],F.prototype,"_tagSuggestions",2);A([c.state()],F.prototype,"_tagLoading",2);A([c.state()],F.prototype,"_datePresets",2);A([c.state()],F.prototype,"_dateFroms",2);A([c.state()],F.prototype,"_dateTos",2);A([c.state()],F.prototype,"_specificModeFields",2);A([c.state()],F.prototype,"_selectSearches",2);F=A([c.customElement("ap-filter-metadata")],F);var mi=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,G=(t,e,s,i)=>{for(var a=i>1?void 0:i?vi(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&&mi(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`
2707
2725
  <div class="filter-section">
2708
2726
  <button
2709
2727
  class="clear-btn"
@@ -2717,7 +2735,7 @@
2717
2735
  <span class="section-label condition-label">Condition</span>
2718
2736
  <ap-radio-group
2719
2737
  direction="horizontal"
2720
- .options=${ei}
2738
+ .options=${ta}
2721
2739
  .value=${this.statusOperator}
2722
2740
  ?disabled=${this._statusHasOnlyEmptyValues}
2723
2741
  @ap-change=${this._handleStatusOperator}
@@ -2737,7 +2755,7 @@
2737
2755
 
2738
2756
  <!-- Status options -->
2739
2757
  <div class="options-list short">
2740
- ${ti.map(e=>o.html`
2758
+ ${sa.map(e=>o.html`
2741
2759
  <ap-checkbox
2742
2760
  ?checked=${this.selectedStatus.includes(e.value)}
2743
2761
  @ap-toggle=${()=>this._toggleStatus(e.value)}
@@ -2764,7 +2782,7 @@
2764
2782
  <span class="section-label condition-label">Condition</span>
2765
2783
  <ap-radio-group
2766
2784
  direction="horizontal"
2767
- .options=${Ht}
2785
+ .options=${Kt}
2768
2786
  .value=${this.approverOperator}
2769
2787
  @ap-change=${this._handleApproverOperator}
2770
2788
  ></ap-radio-group>
@@ -2791,7 +2809,7 @@
2791
2809
  <span class="section-label condition-label">Condition</span>
2792
2810
  <ap-radio-group
2793
2811
  direction="horizontal"
2794
- .options=${Ht}
2812
+ .options=${Kt}
2795
2813
  .value=${this.requesterOperator}
2796
2814
  @ap-change=${this._handleRequesterOperator}
2797
2815
  ></ap-radio-group>
@@ -2817,7 +2835,7 @@
2817
2835
  <!-- Empty / Not empty radio buttons -->
2818
2836
  <ap-radio-group
2819
2837
  .options=${ge}
2820
- .value=${this.dueDatePreset===B||this.dueDatePreset===U?this.dueDatePreset:""}
2838
+ .value=${this.dueDatePreset===U||this.dueDatePreset===B?this.dueDatePreset:""}
2821
2839
  @ap-change=${this._handleDueDatePreset}
2822
2840
  ></ap-radio-group>
2823
2841
 
@@ -2826,8 +2844,8 @@
2826
2844
  <!-- Date range options -->
2827
2845
  <ap-radio-group
2828
2846
  columns="2"
2829
- .options=${Qs}
2830
- .value=${this.dueDatePreset!==B&&this.dueDatePreset!==U?this.dueDatePreset:""}
2847
+ .options=${Zs}
2848
+ .value=${this.dueDatePreset!==U&&this.dueDatePreset!==B?this.dueDatePreset:""}
2831
2849
  @ap-change=${this._handleDueDatePreset}
2832
2850
  ></ap-radio-group>
2833
2851
 
@@ -2888,8 +2906,8 @@
2888
2906
  .mt-12 {
2889
2907
  margin-top: 12px;
2890
2908
  }
2891
- `];G([c.property({type:Array})],V.prototype,"selectedStatus",2);G([c.property()],V.prototype,"statusOperator",2);G([c.property()],V.prototype,"approverValue",2);G([c.property()],V.prototype,"approverOperator",2);G([c.property()],V.prototype,"requesterValue",2);G([c.property()],V.prototype,"requesterOperator",2);G([c.property()],V.prototype,"dueDatePreset",2);G([c.property()],V.prototype,"dueDateFrom",2);G([c.property()],V.prototype,"dueDateTo",2);V=G([c.customElement("ap-filter-approval")],V);var va=Object.defineProperty,ba=Object.getOwnPropertyDescriptor,Y=(t,e,s,a)=>{for(var i=a>1?void 0:a?ba(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&va(e,s,i),i};const _a=300;function ya(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let q=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=ya(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.PRODUCT_REF,values:e,operator:_.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(a=>a!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},_a)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
2892
- `).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(a=>!e.has(a))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return o.html`
2909
+ `];G([c.property({type:Array})],V.prototype,"selectedStatus",2);G([c.property()],V.prototype,"statusOperator",2);G([c.property()],V.prototype,"approverValue",2);G([c.property()],V.prototype,"approverOperator",2);G([c.property()],V.prototype,"requesterValue",2);G([c.property()],V.prototype,"requesterOperator",2);G([c.property()],V.prototype,"dueDatePreset",2);G([c.property()],V.prototype,"dueDateFrom",2);G([c.property()],V.prototype,"dueDateTo",2);V=G([c.customElement("ap-filter-approval")],V);var bi=Object.defineProperty,_i=Object.getOwnPropertyDescriptor,Y=(t,e,s,i)=>{for(var a=i>1?void 0:i?_i(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};const yi=300;function xi(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let q=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=xi(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.PRODUCT_REF,values:e,operator:y.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},yi)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
2910
+ `).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(i=>!e.has(i))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return o.html`
2893
2911
  <div
2894
2912
  class="product-item"
2895
2913
  @click=${()=>this._toggle(t)}
@@ -3231,7 +3249,7 @@
3231
3249
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
3232
3250
  margin-left: 4px;
3233
3251
  }
3234
- `];Y([c.property({type:Array})],q.prototype,"selected",2);Y([c.property({attribute:!1})],q.prototype,"apiClient",2);Y([c.query(".product-search")],q.prototype,"_searchInput",2);Y([c.state()],q.prototype,"_search",2);Y([c.state()],q.prototype,"_debouncedSearch",2);Y([c.state()],q.prototype,"_products",2);Y([c.state()],q.prototype,"_isLoading",2);Y([c.state()],q.prototype,"_showAddList",2);Y([c.state()],q.prototype,"_addListText",2);q=Y([c.customElement("ap-filter-product-ref")],q);var xa=Object.defineProperty,$a=Object.getOwnPropertyDescriptor,F=(t,e,s,a)=>{for(var i=a>1?void 0:a?$a(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&xa(e,s,i),i};let S=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=Ft,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(i=>i instanceof HTMLElement?i.classList.contains("popover-anchor")||i.classList.contains("popover-panel"):!1),a=(this._showDropdown||this._showMetadataSelector)&&e.some(i=>i instanceof HTMLElement&&(i.classList.contains("dropdown-menu")||i.classList.contains("filter-dropdown")));s||a||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),a=s?s.offsetWidth:this.offsetWidth,i=e.offsetWidth;this._externalLeft+i>a-8&&(e.style.left=`${Math.max(8,a-i-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector,this._showDropdown=!1}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null}openFilterPanel(t,e=!1,s){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null}_handleSortOpen(){this._showDropdown=!1,this._openFilter=null,this._openMetadataField=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:a}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:a},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${ct[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=St.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,a,i;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
3252
+ `];Y([c.property({type:Array})],q.prototype,"selected",2);Y([c.property({attribute:!1})],q.prototype,"apiClient",2);Y([c.query(".product-search")],q.prototype,"_searchInput",2);Y([c.state()],q.prototype,"_search",2);Y([c.state()],q.prototype,"_debouncedSearch",2);Y([c.state()],q.prototype,"_products",2);Y([c.state()],q.prototype,"_isLoading",2);Y([c.state()],q.prototype,"_showAddList",2);Y([c.state()],q.prototype,"_addListText",2);q=Y([c.customElement("ap-filter-product-ref")],q);var wi=Object.defineProperty,$i=Object.getOwnPropertyDescriptor,E=(t,e,s,i)=>{for(var a=i>1?void 0:i?$i(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&&wi(e,s,a),a};let C=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=At,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._openFilter=null,this._openMetadataField=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${ct[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=Ct.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
3235
3253
  .selected=${(r==null?void 0:r.values)||[]}
3236
3254
  @filter-change=${this._handleFilterChange}
3237
3255
  ></ap-filter-type>`}case"tags":{const r=e.tags;return o.html`<ap-filter-tags
@@ -3273,9 +3291,9 @@
3273
3291
  ></ap-filter-image>`}case"approval":{const r=e.approval_status,n=e.task_approver,l=e.task_requester,d=e.task_duedate;return o.html`<ap-filter-approval
3274
3292
  .selectedStatus=${(r==null?void 0:r.values)||[]}
3275
3293
  .statusOperator=${(r==null?void 0:r.operator)||":"}
3276
- .approverValue=${((a=n==null?void 0:n.values)==null?void 0:a[0])||""}
3294
+ .approverValue=${((i=n==null?void 0:n.values)==null?void 0:i[0])||""}
3277
3295
  .approverOperator=${(n==null?void 0:n.operator)||":"}
3278
- .requesterValue=${((i=l==null?void 0:l.values)==null?void 0:i[0])||""}
3296
+ .requesterValue=${((a=l==null?void 0:l.values)==null?void 0:a[0])||""}
3279
3297
  .requesterOperator=${(l==null?void 0:l.operator)||":"}
3280
3298
  .dueDatePreset=${(d==null?void 0:d.preset)||""}
3281
3299
  .dueDateFrom=${(d==null?void 0:d.from)||""}
@@ -3306,9 +3324,9 @@
3306
3324
  .selected=${(r==null?void 0:r.values)||[]}
3307
3325
  .apiClient=${this.apiClient}
3308
3326
  @filter-change=${this._handleFilterChange}
3309
- ></ap-filter-product-ref>`}default:return o.nothing}}_renderFilterButton(t){const e=t.key==="metadata",s=e?Object.keys(this.filters.metadata.applied).length>0:this._isFilterActive(t.key),a=this.pinnedFilters.includes(t.key);return o.html`
3327
+ ></ap-filter-product-ref>`}default:return o.nothing}}_renderFilterButton(t){const e=t.key==="metadata",s=e?Object.keys(this.filters.metadata.applied).length>0:this._isFilterActive(t.key),i=this.pinnedFilters.includes(t.key),a=o.html`
3310
3328
  <button
3311
- class="filter-btn ${s?"active":""} ${a?"pinned":""}"
3329
+ class="filter-btn ${s?"active":""} ${i?"pinned":""}"
3312
3330
  @click=${()=>e?this._toggleMetadataSelector():this.openFilterPanel(t.key)}
3313
3331
  >
3314
3332
  <span class="filter-btn-icon">
@@ -3319,15 +3337,33 @@
3319
3337
  </span>
3320
3338
  ${e?o.html`<span class="submenu-chevron"><ap-icon name="chevron-right" .size=${14}></ap-icon></span>`:o.html`
3321
3339
  <span
3322
- class="pin-btn ${a?"pinned":""}"
3323
- title=${a?"Unpin filter":"Pin filter"}
3324
- @click=${i=>this._togglePin(t.key,i)}
3340
+ class="pin-btn ${i?"pinned":""}"
3341
+ title=${i?"Unpin filter":"Pin filter"}
3342
+ @click=${r=>this._togglePin(t.key,r)}
3325
3343
  >
3326
3344
  <ap-icon name="pin" .size=${14}></ap-icon>
3327
3345
  </span>
3328
3346
  `}
3329
3347
  </button>
3330
- `}render(){const t=Object.keys(this.filters.applied).length+Object.keys(this.filters.metadata.applied).length;return o.html`
3348
+ `;return e?o.html`
3349
+ <div class="filter-btn-wrapper">
3350
+ ${a}
3351
+ ${this._showMetadataSelector?o.html`
3352
+ <div class="metadata-selector-overlay">
3353
+ <ap-filter-metadata
3354
+ mode="selector"
3355
+ .fields=${this.metadataFields}
3356
+ .appliedMetadata=${this.filters.metadata.applied}
3357
+ .visibleFields=${this.filters.metadata.visible}
3358
+ .pinnedFields=${this.filters.metadata.pinned}
3359
+ @metadata-field-select=${this._handleMetadataSelectorFieldSelect}
3360
+ @metadata-field-toggle=${this._handleMetadataFieldToggle}
3361
+ @metadata-pin=${this._handleMetadataPin}
3362
+ ></ap-filter-metadata>
3363
+ </div>
3364
+ `:o.nothing}
3365
+ </div>
3366
+ `:a}render(){const t=Object.keys(this.filters.applied).length+Object.keys(this.filters.metadata.applied).length;return o.html`
3331
3367
  <div class="toolbar-row">
3332
3368
  ${this.isLoading?o.html`<span class="count-skeleton"></span>`:o.html`<span class="count">${[this.totalFolderCount>0?`${this.totalFolderCount.toLocaleString()} folder${this.totalFolderCount!==1?"s":""}`:"",this.totalCount>0||this.totalFolderCount===0?`${this.totalCount.toLocaleString()} asset${this.totalCount!==1?"s":""}`:""].filter(Boolean).join(", ")}</span>`}
3333
3369
  <span class="spacer"></span>
@@ -3340,21 +3376,7 @@
3340
3376
  </button>
3341
3377
  ${this._showDropdown?o.html`
3342
3378
  <div class="dropdown-menu">
3343
- ${St.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3344
- </div>
3345
- `:o.nothing}
3346
- ${this._showMetadataSelector?o.html`
3347
- <div class="dropdown-menu metadata-selector-menu">
3348
- <ap-filter-metadata
3349
- mode="selector"
3350
- .fields=${this.metadataFields}
3351
- .appliedMetadata=${this.filters.metadata.applied}
3352
- .visibleFields=${this.filters.metadata.visible}
3353
- .pinnedFields=${this.filters.metadata.pinned}
3354
- @metadata-field-select=${this._handleMetadataSelectorFieldSelect}
3355
- @metadata-field-toggle=${this._handleMetadataFieldToggle}
3356
- @metadata-pin=${this._handleMetadataPin}
3357
- ></ap-filter-metadata>
3379
+ ${Ct.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
3358
3380
  </div>
3359
3381
  `:o.nothing}
3360
3382
  </div>
@@ -3383,7 +3405,7 @@
3383
3405
  </div>
3384
3406
  </div>
3385
3407
  ${this._openFilter?o.html`
3386
- <div class="popover-anchor ${this._externalTrigger?"external":""}">
3408
+ <div class="popover-anchor ${this._externalTrigger?"external":""}" style=${this._externalTrigger&&this._externalTop!=null?`top: ${this._externalTop+4}px`:""}>
3387
3409
  ${this._externalTrigger?o.nothing:o.html`
3388
3410
  <div class="anchor-tab">
3389
3411
  ${this._openFilter==="metadata"&&this._openMetadataField?o.html`
@@ -3395,7 +3417,7 @@
3395
3417
  <ap-icon name=${this._getFilterIcon(this._openFilter)} .size=${16}></ap-icon>
3396
3418
  ${ke[this._openFilter]||this._openFilter}
3397
3419
  `}
3398
- <button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null}} title="Close">
3420
+ <button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}} title="Close">
3399
3421
  <ap-icon name="close" .size=${14}></ap-icon>
3400
3422
  </button>
3401
3423
  </div>
@@ -3405,7 +3427,7 @@
3405
3427
  </div>
3406
3428
  </div>
3407
3429
  `:o.nothing}
3408
- `}};S.styles=o.css`
3430
+ `}};C.styles=o.css`
3409
3431
  :host {
3410
3432
  display: block;
3411
3433
  padding: 8px 20px 6px;
@@ -3505,13 +3527,25 @@
3505
3527
  gap: 12px;
3506
3528
  overscroll-behavior: contain;
3507
3529
  }
3508
- .dropdown-menu.metadata-selector-menu {
3509
- display: block;
3510
- min-width: 0;
3530
+ .filter-btn-wrapper {
3531
+ position: relative;
3532
+ display: flex;
3533
+ }
3534
+ .filter-btn-wrapper .filter-btn {
3535
+ flex: 1;
3536
+ }
3537
+ .metadata-selector-overlay {
3538
+ position: absolute;
3539
+ top: calc(100% + 4px);
3540
+ left: 0;
3541
+ z-index: 60;
3511
3542
  width: 280px;
3512
- padding: 0;
3513
3543
  max-height: 400px;
3514
3544
  overflow-y: auto;
3545
+ background: var(--ap-card, oklch(1 0 0));
3546
+ border: 1px solid var(--ap-border, oklch(92.86% 0.009 247.92));
3547
+ border-radius: var(--ap-radius, 8px);
3548
+ box-shadow: 0 10px 25px -5px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
3515
3549
  }
3516
3550
 
3517
3551
  /* Filter button in dropdown */
@@ -3723,14 +3757,15 @@
3723
3757
  }
3724
3758
  .popover-anchor.external {
3725
3759
  padding: 0;
3760
+ top: 0;
3726
3761
  }
3727
3762
  .popover-anchor.external .popover-panel {
3728
3763
  border-radius: 8px;
3729
3764
  top: 0;
3730
3765
  }
3731
- `;F([c.property({type:Number})],S.prototype,"totalCount",2);F([c.property({type:Number})],S.prototype,"totalFolderCount",2);F([c.property({type:Boolean})],S.prototype,"isLoading",2);F([c.property({type:Boolean})],S.prototype,"showUpload",2);F([c.property()],S.prototype,"sortBy",2);F([c.property()],S.prototype,"sortDirection",2);F([c.property({type:Array})],S.prototype,"sortOptions",2);F([c.property({type:Object})],S.prototype,"filters",2);F([c.property({type:Array})],S.prototype,"labels",2);F([c.property({type:Array})],S.prototype,"tags",2);F([c.property({type:Array})],S.prototype,"metadataFields",2);F([c.property({type:Array})],S.prototype,"pinnedFilters",2);F([c.property({type:Array})],S.prototype,"forcedFilterKeys",2);F([c.property({attribute:!1})],S.prototype,"apiClient",2);F([c.query("ap-dropdown")],S.prototype,"_sortDropdown",2);F([c.state()],S.prototype,"_showDropdown",2);F([c.state()],S.prototype,"_showMetadataSelector",2);F([c.state()],S.prototype,"_openFilter",2);F([c.state()],S.prototype,"_openMetadataField",2);F([c.state()],S.prototype,"_externalTrigger",2);F([c.state()],S.prototype,"_externalLeft",2);S=F([c.customElement("ap-content-toolbar")],S);var wa=Object.defineProperty,ka=Object.getOwnPropertyDescriptor,j=(t,e,s,a)=>{for(var i=a>1?void 0:a?ka(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&wa(e,s,i),i};let D=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var e;return((e=ss.find(s=>s.value===t))==null?void 0:e.label)||t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,a]=e.split(".."),i=s?parseFloat(s):null,r=a?parseFloat(a):null,n=l=>l>=1e3?`${(l/1e3).toFixed(l%1e3===0?0:1)} GB`:`${l} MB`;return i!==null&&r!==null?`${n(i)} – ${n(r)}`:i!==null?`> ${n(i)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===m.SIZE)return this._getSizeSummary(s);if(e===m.COLOR){const i=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}const a=e===m.TYPE?i=>this._mapTypeLabel(i):e===m.TAGS?i=>{var r;return((r=this.tags.find(n=>n.sid===i))==null?void 0:r.label)||i}:e===m.LABELS?i=>{var r;return((r=this.labels.find(n=>n.sid===i))==null?void 0:r.name)||i}:i=>i;return s.values.length===1?a(s.values[0]):`${a(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,a=[...s.resolution,...s.orientation,...s.faces];return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}return""}_getDateSummary(t){var n,l;const e=((n=is.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...Et,...as],a=t.preset?((l=s.find(d=>d.value===t.preset))==null?void 0:l.label)||t.preset:"",i=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=a;break;case"before":r=t.to?`Before ${i(t.to)}`:a;break;case"after":r=t.from?`After ${i(t.from)}`:a;break;case"between":t.from&&t.to?r=`${i(t.from)} – ${i(t.to)}`:t.from?r=`After ${i(t.from)}`:t.to&&(r=`Before ${i(t.to)}`);break;case"specific":r=t.from?i(t.from):"";break;default:r=a}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=St.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(a=>a.key===e);return(s==null?void 0:s.label)||e}_stripMetadataPrefix(t){for(const e of Zt)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const a=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:a.left,right:a.right,bottom:a.bottom,width:a.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const a=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:a.left,right:a.right,bottom:a.bottom,width:a.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),a=e.type==="date";return o.html`
3766
+ `;E([c.property({type:Number})],C.prototype,"totalCount",2);E([c.property({type:Number})],C.prototype,"totalFolderCount",2);E([c.property({type:Boolean})],C.prototype,"isLoading",2);E([c.property({type:Boolean})],C.prototype,"showUpload",2);E([c.property()],C.prototype,"sortBy",2);E([c.property()],C.prototype,"sortDirection",2);E([c.property({type:Array})],C.prototype,"sortOptions",2);E([c.property({type:Object})],C.prototype,"filters",2);E([c.property({type:Array})],C.prototype,"labels",2);E([c.property({type:Array})],C.prototype,"tags",2);E([c.property({type:Array})],C.prototype,"metadataFields",2);E([c.property({type:Array})],C.prototype,"pinnedFilters",2);E([c.property({type:Array})],C.prototype,"forcedFilterKeys",2);E([c.property({attribute:!1})],C.prototype,"apiClient",2);E([c.query("ap-dropdown")],C.prototype,"_sortDropdown",2);E([c.state()],C.prototype,"_showDropdown",2);E([c.state()],C.prototype,"_showMetadataSelector",2);E([c.state()],C.prototype,"_openFilter",2);E([c.state()],C.prototype,"_openMetadataField",2);E([c.state()],C.prototype,"_externalTrigger",2);E([c.state()],C.prototype,"_externalLeft",2);E([c.state()],C.prototype,"_externalTop",2);C=E([c.customElement("ap-content-toolbar")],C);var ki=Object.defineProperty,Si=Object.getOwnPropertyDescriptor,R=(t,e,s,i)=>{for(var a=i>1?void 0:i?Si(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&&ki(e,s,a),a};let P=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var e;return((e=as.find(s=>s.value===t))==null?void 0:e.label)||t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,r=i?parseFloat(i):null,n=l=>l>=1e3?`${(l/1e3).toFixed(l%1e3===0?0:1)} GB`:`${l} MB`;return a!==null&&r!==null?`${n(a)} – ${n(r)}`:a!==null?`> ${n(a)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===m.SIZE)return this._getSizeSummary(s);if(e===m.COLOR){const a=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===m.TYPE?a=>this._mapTypeLabel(a):e===m.TAGS?a=>{var r;return((r=this.tags.find(n=>n.sid===a))==null?void 0:r.label)||a}:e===m.LABELS?a=>{var r;return((r=this.labels.find(n=>n.sid===a))==null?void 0:r.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,l;const e=((n=is.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...Ft,...rs],i=t.preset?((l=s.find(d=>d.value===t.preset))==null?void 0:l.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=i;break;case"before":r=t.to?`Before ${a(t.to)}`:i;break;case"after":r=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?r=`${a(t.from)} – ${a(t.to)}`:t.from?r=`After ${a(t.from)}`:t.to&&(r=`Before ${a(t.to)}`);break;case"specific":r=t.from?a(t.from):"";break;default:r=i}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=Ct.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_stripMetadataPrefix(t){for(const e of Jt)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
3732
3767
  <span class="chip forced">
3733
- ${(a||t===m.TYPE||t===m.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
3768
+ ${(i||t===m.TYPE||t===m.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
3734
3769
  <span class="chip-label">${ke[t]||t}</span>
3735
3770
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
3736
3771
  `}
@@ -3739,38 +3774,38 @@
3739
3774
  </span>
3740
3775
  </span>
3741
3776
  `}_renderFilterChip(t,e){if(!e)return o.html`
3742
- <span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${i=>this._openFilter(t,i)}>
3777
+ <span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
3743
3778
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
3744
3779
  <span class="chip-label">${ke[t]||t}</span>
3745
3780
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
3746
3781
  </span>
3747
- `;const s=this._getFilterSummary(e,t),a=e.type==="date";return o.html`
3748
- <span class="chip ${t===this.activeFilter?"active":""}" @click=${i=>this._openFilter(t,i)}>
3749
- ${(a||t===m.TYPE||t===m.SIZE)&&s?o.html`
3782
+ `;const s=this._getFilterSummary(e,t),i=e.type==="date";return o.html`
3783
+ <span class="chip ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
3784
+ ${(i||t===m.TYPE||t===m.SIZE)&&s?o.html`
3750
3785
  <span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
3751
3786
  <span class="chip-label">${s}</span>`:o.html`
3752
3787
  <span class="chip-label">${ke[t]||t}</span>
3753
3788
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
3754
3789
  `}
3755
- <button class="chip-remove" @click=${i=>{i.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
3790
+ <button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
3756
3791
  <ap-icon name="close" .size=${12}></ap-icon>
3757
3792
  </button>
3758
3793
  </span>
3759
- `}_renderMetadataChip(t,e){if(!e){const i=this._getMetadataLabel(t);return o.html`
3794
+ `}_renderMetadataChip(t,e){if(!e){const a=this._getMetadataLabel(t);return o.html`
3760
3795
  <span class="chip pinned-empty ${t===this.activeMetadataField?"active":""}" @click=${r=>this._openMetadataFilter(t,r)}>
3761
3796
  <span class="chip-icon"><ap-icon name="file-text" .size=${16}></ap-icon></span>
3762
- <span class="chip-label">${i}</span>
3797
+ <span class="chip-label">${a}</span>
3763
3798
  <span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
3764
3799
  </span>
3765
- `}const s=this._getFilterSummary(e),a=this._getMetadataLabel(t);return o.html`
3766
- <span class="chip ${t===this.activeMetadataField?"active":""}" @click=${i=>this._openMetadataFilter(t,i)}>
3767
- <span class="chip-label">${a}</span>
3800
+ `}const s=this._getFilterSummary(e),i=this._getMetadataLabel(t);return o.html`
3801
+ <span class="chip ${t===this.activeMetadataField?"active":""}" @click=${a=>this._openMetadataFilter(t,a)}>
3802
+ <span class="chip-label">${i}</span>
3768
3803
  ${s?o.html`<span class="chip-summary">${s}</span>`:o.nothing}
3769
- <button class="chip-remove" @click=${i=>{i.stopPropagation(),this._removeMetadataFilter(t)}} title="Remove filter">
3804
+ <button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeMetadataFilter(t)}} title="Remove filter">
3770
3805
  <ap-icon name="close" .size=${12}></ap-icon>
3771
3806
  </button>
3772
3807
  </span>
3773
- `}render(){const t=De(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),a=Object.keys(this.appliedMetadata),i=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),l=s.filter(g=>!i.has(g)),d=a.filter(g=>!r.has(g)),h=this.pendingFilter&&!i.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+a.length>0;return e.size+n.length+this.pinnedMetadataFields.length+l.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
3808
+ `}render(){const t=De(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),i=Object.keys(this.appliedMetadata),a=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),l=s.filter(g=>!a.has(g)),d=i.filter(g=>!r.has(g)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+l.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
3774
3809
  <div class="chips-row">
3775
3810
  <div class="chips">
3776
3811
  ${[...e].map(g=>this._renderForcedChip(g,t[g]))}
@@ -3795,7 +3830,7 @@
3795
3830
  ${f?o.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:o.nothing}
3796
3831
  </div>
3797
3832
  </div>
3798
- `}};D.styles=o.css`
3833
+ `}};P.styles=o.css`
3799
3834
  :host {
3800
3835
  display: block;
3801
3836
  }
@@ -3942,7 +3977,7 @@
3942
3977
  align-items: center;
3943
3978
  opacity: 0.6;
3944
3979
  }
3945
- `;j([c.property({type:Object})],D.prototype,"appliedFilters",2);j([c.property({type:Object})],D.prototype,"appliedMetadata",2);j([c.property({type:Object})],D.prototype,"forcedFilters",2);j([c.property({type:Array})],D.prototype,"metadataFields",2);j([c.property({type:Array})],D.prototype,"pinnedFilters",2);j([c.property({type:Array})],D.prototype,"pinnedMetadataFields",2);j([c.property({type:Array})],D.prototype,"tags",2);j([c.property({type:Array})],D.prototype,"labels",2);j([c.property()],D.prototype,"activeFilter",2);j([c.property()],D.prototype,"activeMetadataField",2);j([c.property()],D.prototype,"pendingFilter",2);j([c.property()],D.prototype,"pendingMetadataField",2);D=j([c.customElement("ap-filters-bar")],D);var Sa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,xe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ca(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Sa(e,s,i),i};const Ea=6;let Z=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){return o.html`
3980
+ `;R([c.property({type:Object})],P.prototype,"appliedFilters",2);R([c.property({type:Object})],P.prototype,"appliedMetadata",2);R([c.property({type:Object})],P.prototype,"forcedFilters",2);R([c.property({type:Array})],P.prototype,"metadataFields",2);R([c.property({type:Array})],P.prototype,"pinnedFilters",2);R([c.property({type:Array})],P.prototype,"pinnedMetadataFields",2);R([c.property({type:Array})],P.prototype,"tags",2);R([c.property({type:Array})],P.prototype,"labels",2);R([c.property()],P.prototype,"activeFilter",2);R([c.property()],P.prototype,"activeMetadataField",2);R([c.property()],P.prototype,"pendingFilter",2);R([c.property()],P.prototype,"pendingMetadataField",2);P=R([c.customElement("ap-filters-bar")],P);var Ci=Object.defineProperty,Ei=Object.getOwnPropertyDescriptor,xe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ei(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&&Ci(e,s,a),a};const Fi=6;let Z=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){return o.html`
3946
3981
  <div class="grid" role="list" aria-label="Assets">
3947
3982
  ${this.folders.map(t=>o.html`
3948
3983
  <ap-folder-card
@@ -3959,12 +3994,12 @@
3959
3994
  .multiSelect=${this.multiSelect}
3960
3995
  style="--ap-stagger-index: ${s}"
3961
3996
  data-asset-uuid=${t.uuid}
3962
- @asset-select=${a=>this.dispatchEvent(new CustomEvent("asset-select",{detail:a.detail,bubbles:!0,composed:!0}))}
3963
- @asset-preview=${a=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:a.detail,bubbles:!0,composed:!0}))}
3964
- @asset-quick-select=${a=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:a.detail,bubbles:!0,composed:!0}))}
3997
+ @asset-select=${i=>this.dispatchEvent(new CustomEvent("asset-select",{detail:i.detail,bubbles:!0,composed:!0}))}
3998
+ @asset-preview=${i=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:i.detail,bubbles:!0,composed:!0}))}
3999
+ @asset-quick-select=${i=>this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:i.detail,bubbles:!0,composed:!0}))}
3965
4000
  ></ap-asset-card>
3966
4001
  `})}
3967
- ${this.isLoading?Array.from({length:Ea},()=>o.html`<div class="ghost-card"></div>`):o.nothing}
4002
+ ${this.isLoading?Array.from({length:Fi},()=>o.html`<div class="ghost-card"></div>`):o.nothing}
3968
4003
  </div>
3969
4004
  `}};Z.styles=o.css`
3970
4005
  :host {
@@ -3995,7 +4030,7 @@
3995
4030
  @media (prefers-reduced-motion: reduce) {
3996
4031
  .ghost-card { animation: none; }
3997
4032
  }
3998
- `;xe([c.property({type:Array})],Z.prototype,"assets",2);xe([c.property({type:Array})],Z.prototype,"folders",2);xe([c.property({type:Object})],Z.prototype,"folderPreviews",2);xe([c.property({type:Array})],Z.prototype,"selectedIds",2);xe([c.property({type:Boolean})],Z.prototype,"isLoading",2);xe([c.property({type:Boolean})],Z.prototype,"multiSelect",2);Z=xe([c.customElement("ap-grid-view")],Z);var Fa=Object.defineProperty,Aa=Object.getOwnPropertyDescriptor,le=(t,e,s,a)=>{for(var i=a>1?void 0:a?Aa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Fa(e,s,i),i};const Ta=5;let K=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this.totalCount=0,this.isSelectingAll=!1}get _allVisibleSelected(){if(this.assets.length===0||this.selectedIds.length===0)return!1;const t=new Set(this.selectedIds);return this.assets.every(e=>t.has(e.uuid))}_handleHeaderCheckboxClick(){this.isSelectingAll||(this._allVisibleSelected&&this.selectedIds.length>=this.totalCount?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0})))}render(){const t=this._allVisibleSelected&&this.selectedIds.length>=this.totalCount;return o.html`
4033
+ `;xe([c.property({type:Array})],Z.prototype,"assets",2);xe([c.property({type:Array})],Z.prototype,"folders",2);xe([c.property({type:Object})],Z.prototype,"folderPreviews",2);xe([c.property({type:Array})],Z.prototype,"selectedIds",2);xe([c.property({type:Boolean})],Z.prototype,"isLoading",2);xe([c.property({type:Boolean})],Z.prototype,"multiSelect",2);Z=xe([c.customElement("ap-grid-view")],Z);var Ai=Object.defineProperty,Ti=Object.getOwnPropertyDescriptor,le=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ti(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&&Ai(e,s,a),a};const Mi=5;let K=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this.totalCount=0,this.isSelectingAll=!1}get _allVisibleSelected(){if(this.assets.length===0||this.selectedIds.length===0)return!1;const t=new Set(this.selectedIds);return this.assets.every(e=>t.has(e.uuid))}_handleHeaderCheckboxClick(){this.isSelectingAll||(this._allVisibleSelected&&this.selectedIds.length>=this.totalCount?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0})))}render(){const t=this._allVisibleSelected&&this.selectedIds.length>=this.totalCount;return o.html`
3999
4034
  <div class="list-header ${this.multiSelect?"has-checkbox":""}" role="row" aria-label="Column headers">
4000
4035
  ${this.multiSelect?o.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
4001
4036
  <div class="header-check-box ${t?"checked":this.selectedIds.length>0?"indeterminate":""}">
@@ -4028,11 +4063,11 @@
4028
4063
  ?selected=${this.selectedIds.includes(e.uuid)}
4029
4064
  .multiSelect=${this.multiSelect}
4030
4065
  data-asset-uuid=${e.uuid}
4031
- @asset-select=${a=>this.dispatchEvent(new CustomEvent("asset-select",{detail:a.detail,bubbles:!0,composed:!0}))}
4032
- @asset-preview=${a=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:a.detail,bubbles:!0,composed:!0}))}
4066
+ @asset-select=${i=>this.dispatchEvent(new CustomEvent("asset-select",{detail:i.detail,bubbles:!0,composed:!0}))}
4067
+ @asset-preview=${i=>this.dispatchEvent(new CustomEvent("asset-preview",{detail:i.detail,bubbles:!0,composed:!0}))}
4033
4068
  ></ap-asset-row>
4034
4069
  `)}
4035
- ${this.isLoading?Array.from({length:Ta},()=>o.html`<div class="ghost-row"></div>`):o.nothing}
4070
+ ${this.isLoading?Array.from({length:Mi},()=>o.html`<div class="ghost-row"></div>`):o.nothing}
4036
4071
  </div>
4037
4072
  `}};K.styles=o.css`
4038
4073
  :host {
@@ -4109,7 +4144,7 @@
4109
4144
  @media (prefers-reduced-motion: reduce) {
4110
4145
  .ghost-row { animation: none; }
4111
4146
  }
4112
- `;le([c.property({type:Array})],K.prototype,"assets",2);le([c.property({type:Array})],K.prototype,"folders",2);le([c.property({type:Array})],K.prototype,"selectedIds",2);le([c.property({type:Boolean})],K.prototype,"isLoading",2);le([c.property({type:Boolean})],K.prototype,"multiSelect",2);le([c.property({type:Number})],K.prototype,"totalCount",2);le([c.property({type:Boolean})],K.prototype,"isSelectingAll",2);K=le([c.customElement("ap-list-view")],K);function tt(t){var a;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)||((a=t.url)==null?void 0:a.cdn)||"";return Fe(s)}function us(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,a;let e=Fe(((s=t.url)==null?void 0:s.cdn)||((a=t.url)==null?void 0:a.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[a,i]of Object.entries(e))s.searchParams.set(a,i);return s.toString()}catch{return t}}const Qt=/^(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(Qt);if(s){const a=s[2];return t.replace(Qt,`$1assets.filerobot.com/${a}/`)}if(e)try{const a=new URL(t);return`https://assets.filerobot.com/${e}${a.pathname}${a.search}`}catch{}return t}function Mt(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,a=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,a)).toFixed(a===0?0:1)} ${e[a]}`}function st(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function gs(t,e){return!t||!e?"":`${t} x ${e}`}const Oa=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Ma=new Set([...Oa,"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 fs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ma.has(e)}const ms="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",Pa={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 ht(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=Pa[e];return`${ms}${s||"DEFAULT"}.png`}function Ne(){return`${ms}DEFAULT.png`}function kt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const La=new Set(["png","svg","webp","gif","avif"]);function Pt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return La.has(e)}var Ia=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,He=(t,e,s,a)=>{for(var i=a>1?void 0:a?Da(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ia(e,s,i),i};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(a=>a instanceof HTMLElement&&(a.classList.contains("check")||a.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),a=Math.floor(t%60),i=r=>String(r).padStart(2,"0");return e>0?`${e}:${i(s)}:${i(a)}`:`${s}:${i(a)}`}_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",a=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",i=fs(t.extension||"");let r="";s?r=us(t):a?r=Ot(t):i&&(r=tt(t));const n=ht(t.extension||""),l=Pt(t.extension||"");return o.html`
4147
+ `;le([c.property({type:Array})],K.prototype,"assets",2);le([c.property({type:Array})],K.prototype,"folders",2);le([c.property({type:Array})],K.prototype,"selectedIds",2);le([c.property({type:Boolean})],K.prototype,"isLoading",2);le([c.property({type:Boolean})],K.prototype,"multiSelect",2);le([c.property({type:Number})],K.prototype,"totalCount",2);le([c.property({type:Boolean})],K.prototype,"isSelectingAll",2);K=le([c.customElement("ap-list-view")],K);function tt(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 gs(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 st(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function fs(t,e){return!t||!e?"":`${t} x ${e}`}const Oi=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Li=new Set([...Oi,"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 ms(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Li.has(e)}const vs="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",Pi={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 ht(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=Pi[e];return`${vs}${s||"DEFAULT"}.png`}function je(){return`${vs}DEFAULT.png`}function St(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Ii=new Set(["png","svg","webp","gif","avif"]);function Pt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ii.has(e)}var Di=Object.defineProperty,zi=Object.getOwnPropertyDescriptor,He=(t,e,s,i)=>{for(var a=i>1?void 0:i?zi(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&&Di(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=ms(t.extension||"");let r="";s?r=gs(t):i?r=Ot(t):a&&(r=tt(t));const n=ht(t.extension||""),l=Pt(t.extension||"");return o.html`
4113
4148
  <div class="card" @click=${this._handleSelect}>
4114
4149
  <div class="thumbnail ${l&&r?"chess":""}">
4115
4150
  ${r?o.html`<img
@@ -4117,12 +4152,12 @@
4117
4152
  alt=${t.name}
4118
4153
  loading="lazy"
4119
4154
  class="thumb-img ${l?"transparent-asset":""}"
4120
- @error=${p=>{const g=p.target,v=Ne();g.src!==n&&g.src!==v?(g.src=n,g.classList.add("icon-fallback")):g.src!==v&&(g.src=v)}}
4155
+ @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)}}
4121
4156
  />`:o.html`<img
4122
4157
  src=${n}
4123
4158
  alt=${t.name}
4124
4159
  class="thumb-img icon-fallback"
4125
- @error=${p=>{const g=p.target,v=Ne();g.src!==v&&(g.src=v)}}
4160
+ @error=${p=>{const g=p.target,v=je();g.src!==v&&(g.src=v)}}
4126
4161
  />`}
4127
4162
  ${s&&((h=t.info)!=null&&h.duration)?o.html`<span class="duration">${this._formatDuration(t.info.duration)}</span>`:o.nothing}
4128
4163
  <div class="overlay">
@@ -4147,7 +4182,7 @@
4147
4182
  </div>
4148
4183
  <div class="info">
4149
4184
  <div class="name" title=${t.name}>${t.name}</div>
4150
- <div class="meta">${(u=t.extension)==null?void 0:u.toUpperCase()}${(()=>{var w,b,O,$;const p=((w=t.info)==null?void 0:w.img_w)||((b=t.info)==null?void 0:b.video_w),g=((O=t.info)==null?void 0:O.img_h)||(($=t.info)==null?void 0:$.video_h),v=gs(p,g);return v?` · ${v}`:""})()} · ${Mt(((f=t.size)==null?void 0:f.bytes)||0)}</div>
4185
+ <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=fs(p,g);return v?` · ${v}`:""})()} · ${Lt(((f=t.size)==null?void 0:f.bytes)||0)}</div>
4151
4186
  </div>
4152
4187
  </div>
4153
4188
  `}};ve.styles=o.css`
@@ -4326,7 +4361,7 @@
4326
4361
  :host { animation: none; }
4327
4362
  .overlay { transition: none; }
4328
4363
  }
4329
- `;He([c.property({type:Object})],ve.prototype,"asset",2);He([c.property({type:Number})],ve.prototype,"index",2);He([c.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);He([c.property({type:Boolean})],ve.prototype,"multiSelect",2);ve=He([c.customElement("ap-asset-card")],ve);var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Ke=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&za(e,s,i),i};let be=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.composedPath().some(a=>a instanceof HTMLElement&&(a.classList.contains("check")||a.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",a=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",i=fs(t.extension||"");let r="";s?r=us(t):a?r=Ot(t):i&&(r=tt(t));const n=ht(t.extension||""),l=Pt(t.extension||"");return o.html`
4364
+ `;He([c.property({type:Object})],ve.prototype,"asset",2);He([c.property({type:Number})],ve.prototype,"index",2);He([c.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);He([c.property({type:Boolean})],ve.prototype,"multiSelect",2);ve=He([c.customElement("ap-asset-card")],ve);var Ri=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,Ke=(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&&Ri(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=ms(t.extension||"");let r="";s?r=gs(t):i?r=Ot(t):a&&(r=tt(t));const n=ht(t.extension||""),l=Pt(t.extension||"");return o.html`
4330
4365
  <div class="row" @click=${this._handleSelect}>
4331
4366
  ${this.multiSelect?o.html`
4332
4367
  <div class="check">
@@ -4343,17 +4378,17 @@
4343
4378
  alt=${t.name}
4344
4379
  class="${l?"transparent-asset":""}"
4345
4380
  loading="lazy"
4346
- @error=${f=>{const p=f.target,g=Ne();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
4381
+ @error=${f=>{const p=f.target,g=je();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
4347
4382
  />`:o.html`<img
4348
4383
  src=${n}
4349
4384
  alt=${t.name}
4350
4385
  class="icon-fallback"
4351
- @error=${f=>{const p=f.target,g=Ne();p.src!==g&&(p.src=g)}}
4386
+ @error=${f=>{const p=f.target,g=je();p.src!==g&&(p.src=g)}}
4352
4387
  />`}
4353
4388
  </div>
4354
4389
  <div class="name" title=${t.name}>${t.name}</div>
4355
4390
  <div class="type">${(h=t.extension)==null?void 0:h.toUpperCase()}</div>
4356
- <div class="desc">${Mt(((u=t.size)==null?void 0:u.bytes)||0)}</div>
4391
+ <div class="desc">${Lt(((u=t.size)==null?void 0:u.bytes)||0)}</div>
4357
4392
  <div class="date">${st(t.created_at||"")}</div>
4358
4393
  <div class="actions">
4359
4394
  <button class="icon-btn" @click=${this._handlePreview} aria-label="Preview">
@@ -4486,13 +4521,13 @@
4486
4521
  :host([selected]) .check-icon {
4487
4522
  display: block;
4488
4523
  }
4489
- `;Ke([c.property({type:Object})],be.prototype,"asset",2);Ke([c.property({type:Number})],be.prototype,"index",2);Ke([c.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);Ke([c.property({type:Boolean})],be.prototype,"multiSelect",2);be=Ke([c.customElement("ap-asset-row")],be);var ja=Object.defineProperty,Na=Object.getOwnPropertyDescriptor,Lt=(t,e,s,a)=>{for(var i=a>1?void 0:a?Na(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ja(e,s,i),i};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=kt(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 a=Se(t.file_type),i=String(window.devicePixelRatio||1);return a==="video"?ze(s,{w:"200",dpr:i,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||kt(t.file_type).toLowerCase()==="pdf"?(s=s.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(s,{w:"200",dpr:i,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):ze(s,{w:"200",dpr:i})}_renderPreviewImg(t){const e=this._isAlternativeDisplay(t.file_type),s=this._getPreviewUrl(t),a=ht(kt(t.file_type)),i=Ne();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4524
+ `;Ke([c.property({type:Object})],be.prototype,"asset",2);Ke([c.property({type:Number})],be.prototype,"index",2);Ke([c.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);Ke([c.property({type:Boolean})],be.prototype,"multiSelect",2);be=Ke([c.customElement("ap-asset-row")],be);var ji=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,It=(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&&ji(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=ht(St(t.file_type)),a=je();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
4490
4525
  <img
4491
4526
  class="preview-img ${e?"icon-mode":""}"
4492
- src="${s||a}"
4527
+ src="${s||i}"
4493
4528
  alt=""
4494
4529
  loading="lazy"
4495
- @error=${r=>{const n=r.target,l=n.parentElement;n.src!==a&&n.src!==i?(n.src=a,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg")):n.src!==i&&(n.src=i,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg"))}}
4530
+ @error=${r=>{const n=r.target,l=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg"))}}
4496
4531
  @load=${r=>{const n=r.target,l=n.parentElement;n.src.includes("scaleflex/assets/file-types")&&(n.classList.add("icon-mode"),l==null||l.classList.add("icon-bg"))}}
4497
4532
  />
4498
4533
  </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`
@@ -4503,7 +4538,7 @@
4503
4538
  ${t[2]?o.html`<div class="preview-right-item">${this._renderPreviewImg(t[2])}</div>`:o.nothing}
4504
4539
  </div>
4505
4540
  </div>
4506
- `}render(){var i,r;const t=this.folder;if(!t)return o.html``;const e=((i=t.count)==null?void 0:i.files_direct)??0,a=(((r=t.count)==null?void 0:r.files_recursive)??0)-e;return o.html`
4541
+ `}render(){var a,r;const t=this.folder;if(!t)return o.html``;const e=((a=t.count)==null?void 0:a.files_direct)??0,i=(((r=t.count)==null?void 0:r.files_recursive)??0)-e;return o.html`
4507
4542
  <div class="card" @click=${this._handleOpen}>
4508
4543
  <!-- Folder shape background -->
4509
4544
  <svg class="folder-svg" viewBox="0 0 100 100" preserveAspectRatio="none">
@@ -4525,12 +4560,12 @@
4525
4560
  <div class="name" title=${t.name}>${t.name}</div>
4526
4561
  <div class="counts">
4527
4562
  <span>${e} asset${e!==1?"s":""}</span>
4528
- ${a>0?o.html`<span>${a} sub-asset${a!==1?"s":""}</span>`:o.nothing}
4563
+ ${i>0?o.html`<span>${i} sub-asset${i!==1?"s":""}</span>`:o.nothing}
4529
4564
  </div>
4530
4565
  </div>
4531
4566
  </div>
4532
4567
  </div>
4533
- `}};Be.styles=[J,o.css`
4568
+ `}};Ue.styles=[J,o.css`
4534
4569
  :host {
4535
4570
  display: block;
4536
4571
  }
@@ -4656,7 +4691,7 @@
4656
4691
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4657
4692
  margin-top: 2px;
4658
4693
  }
4659
- `];Lt([c.property({type:Object})],Be.prototype,"folder",2);Lt([c.property({type:Array})],Be.prototype,"previews",2);Be=Lt([c.customElement("ap-folder-card")],Be);var Ba=Object.defineProperty,Ua=Object.getOwnPropertyDescriptor,vs=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ua(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ba(e,s,i),i};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`
4694
+ `];It([c.property({type:Object})],Ue.prototype,"folder",2);It([c.property({type:Array})],Ue.prototype,"previews",2);Ue=It([c.customElement("ap-folder-card")],Ue);var Bi=Object.defineProperty,Vi=Object.getOwnPropertyDescriptor,bs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Vi(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 at=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`
4660
4695
  <div class="row" @click=${this._handleOpen}>
4661
4696
  <div class="icon"><ap-icon name="folder" .size=${22}></ap-icon></div>
4662
4697
  <div class="name">${t.name}</div>
@@ -4665,7 +4700,7 @@
4665
4700
  <div class="meta">${st(t.modified_at||t.updated_at||"")}</div>
4666
4701
  <div></div>
4667
4702
  </div>
4668
- `:o.html``}};it.styles=o.css`
4703
+ `:o.html``}};at.styles=o.css`
4669
4704
  :host {
4670
4705
  display: block;
4671
4706
  }
@@ -4697,13 +4732,13 @@
4697
4732
  font-size: 0.8125rem;
4698
4733
  color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
4699
4734
  }
4700
- `;vs([c.property({type:Object})],it.prototype,"folder",2);it=vs([c.customElement("ap-folder-row")],it);var Va=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,bs=(t,e,s,a)=>{for(var i=a>1?void 0:a?qa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Va(e,s,i),i};let at=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid"}render(){return this.variant==="grid"?o.html`
4735
+ `;bs([c.property({type:Object})],at.prototype,"folder",2);at=bs([c.customElement("ap-folder-row")],at);var qi=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?Hi(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&&qi(e,s,a),a};let it=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid"}render(){return this.variant==="grid"?o.html`
4701
4736
  <div class="grid-skeleton">
4702
4737
  ${Array.from({length:18},()=>o.html`<div class="skeleton card-skel"></div>`)}
4703
4738
  </div>
4704
4739
  `:o.html`
4705
4740
  ${Array.from({length:7},()=>o.html`<div class="skeleton row-skel"></div>`)}
4706
- `}};at.styles=o.css`
4741
+ `}};it.styles=o.css`
4707
4742
  :host {
4708
4743
  display: block;
4709
4744
  padding: 16px 20px;
@@ -4735,7 +4770,7 @@
4735
4770
  @media (prefers-reduced-motion: reduce) {
4736
4771
  .skeleton { animation: none; }
4737
4772
  }
4738
- `;bs([c.property()],at.prototype,"variant",2);at=bs([c.customElement("ap-skeleton")],at);function Ha(t){var i,r;const e=(i=t.info)==null?void 0:i.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var Ka=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,I=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ga(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ka(e,s,i),i};let P=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Se(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var a,i;const e=Ha(t);if(!e||(await this.updateComplete,((a=this.asset)==null?void 0:a.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((i=this.asset)==null?void 0:i.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(l,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,a,i,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((i=(a=this.asset)==null?void 0:a.url)!=null&&i.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Se(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let a=t+e;a!==s;a+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[a]))return a;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var a,i;const e=(a=t.url)==null?void 0:a.cdn;if(!e)return tt(t)||"";if(((i=t.extension)==null?void 0:i.toLowerCase())==="svg")return e;const s=Fe(e,this.containerToken);return ze(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,l;const e=(n=t.info)==null?void 0:n.img_w,s=(l=t.info)==null?void 0:l.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const a=window.innerWidth,i=window.innerHeight,r=Math.min(a/e,i/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),a=new Set;return s.filter(i=>!i.label||a.has(i.sid)?!1:(a.add(i.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.TAGS,values:[t],operator:_.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.LABELS,values:[t],operator:_.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
4773
+ `;_s([c.property()],it.prototype,"variant",2);it=_s([c.customElement("ap-skeleton")],it);function Ki(t){var a,r;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var Gi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,O=(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 M=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Se(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Ki(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(l,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Se(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return tt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Fe(e,this.containerToken);return ze(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,l;const e=(n=t.info)==null?void 0:n.img_w,s=(l=t.info)==null?void 0:l.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,r=Math.min(i/e,a/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.TAGS,values:[t],operator:y.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.LABELS,values:[t],operator:y.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
4739
4774
  <div class="accordion">
4740
4775
  <button
4741
4776
  class="accordion-trigger"
@@ -4748,21 +4783,21 @@
4748
4783
  </svg>
4749
4784
  </button>
4750
4785
  <div class="accordion-content ${s?"open":""}">
4751
- ${e.map(a=>o.html`
4786
+ ${e.map(i=>o.html`
4752
4787
  <div class="meta-row">
4753
- <span class="meta-label" title=${a.label}>${a.label}</span>
4754
- <span class="meta-value" title=${a.value}>${a.value}</span>
4788
+ <span class="meta-label" title=${i.label}>${i.label}</span>
4789
+ <span class="meta-value" title=${i.value}>${i.value}</span>
4755
4790
  </div>
4756
4791
  `)}
4757
4792
  ${this._renderTagsRow(t)}
4758
4793
  ${this._renderLabelsRow(t)}
4759
4794
  </div>
4760
4795
  </div>
4761
- `}_renderAccordion(t,e,s){if(s.length===0)return o.nothing;const a=this._openSections.has(t);return o.html`
4796
+ `}_renderAccordion(t,e,s){if(s.length===0)return o.nothing;const i=this._openSections.has(t);return o.html`
4762
4797
  <div class="accordion">
4763
4798
  <button
4764
4799
  class="accordion-trigger"
4765
- aria-expanded=${a?"true":"false"}
4800
+ aria-expanded=${i?"true":"false"}
4766
4801
  @click=${()=>this._toggleSection(t)}
4767
4802
  >
4768
4803
  <span>${e}</span>
@@ -4770,16 +4805,16 @@
4770
4805
  <path d="M6 9l6 6 6-6"></path>
4771
4806
  </svg>
4772
4807
  </button>
4773
- <div class="accordion-content ${a?"open":""}">
4774
- ${s.map(i=>o.html`
4808
+ <div class="accordion-content ${i?"open":""}">
4809
+ ${s.map(a=>o.html`
4775
4810
  <div class="meta-row">
4776
- <span class="meta-label" title=${i.label}>${i.label}</span>
4777
- <span class="meta-value" title=${i.value}>${i.value}</span>
4811
+ <span class="meta-label" title=${a.label}>${a.label}</span>
4812
+ <span class="meta-value" title=${a.value}>${a.value}</span>
4778
4813
  </div>
4779
4814
  `)}
4780
4815
  </div>
4781
4816
  </div>
4782
- `}_getFileInfoRows(t){var s,a,i,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:Mt(t.size.bytes)}),(a=t.info)!=null&&a.img_w&&e.push({label:"Dimensions",value:gs(t.info.img_w,t.info.img_h)}),(i=t.info)!=null&&i.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:st(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:st(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 a;if(!((a=e.possible_values)!=null&&a.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(i=>i.internal_unique_value===t||i.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 a=this.regionalFilters[e.regionalVariantsGroupUuid];if(a){const i=t[a];if(i!=null&&i!=="")return this._resolveFieldValue(i,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(i=>this._resolveSlug(String(i),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const a=JSON.stringify(t);return a==="{}"||a==="[]"?"":a}return String(t)}_getAllMetadataRows(t){var r,n,l,d;const e=[],s=this._buildFieldMap(),a=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])??((l=t.meta)==null?void 0:l[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;a.add(u.key),u.slug&&a.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(a.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;a.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;a.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 i=(d=t.info)==null?void 0:d.metadata;if(i&&typeof i=="object")for(const[h,u]of Object.entries(i)){if(a.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;a.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;a.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`
4817
+ `}_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:fs(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:st(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:st(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,l,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])??((l=t.meta)==null?void 0:l[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`
4783
4818
  <div class="meta-row" style="flex-direction:column;gap:6px">
4784
4819
  <span class="meta-label">Labels</span>
4785
4820
  <div class="tags-list">
@@ -4802,12 +4837,12 @@
4802
4837
  `)}
4803
4838
  </div>
4804
4839
  </div>
4805
- `}render(){var A,T,L,C,se,ce,$e,Ge;const t=this.asset;if(!t)return o.nothing;const e=Se(t.type),s=e==="image",a=e==="video",i=e==="audio",r=((A=t.extension)==null?void 0:A.toLowerCase())==="pdf",n=ht(t.extension||""),l=Pt(t.extension||""),d=((T=t.extension)==null?void 0:T.toLowerCase())==="svg",h=tt(t),u=s?d?((L=t.url)==null?void 0:L.cdn)||"":h||Fe(((C=t.url)==null?void 0:C.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=a&&((se=t.url)==null?void 0:se.cdn)||"",v=a&&(((ce=t.info)==null?void 0:ce.video_thumbnail)||(($e=t.info)==null?void 0:$e.preview))||"",w=r&&!s?Ot(t):"",b=this._getCurrentIndex(),O=b>0&&this._findNavTarget(b,-1)>=0,$=b>=0&&this._findNavTarget(b,1)>=0,k=this.assets.length>1;return o.html`
4840
+ `}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=ht(t.extension||""),l=Pt(t.extension||""),d=((S=t.extension)==null?void 0:S.toLowerCase())==="svg",h=tt(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`
4806
4841
  <div class="panel">
4807
4842
  <div class="panel-header">
4808
4843
  <span class="panel-title" title=${t.name}>${t.name}</span>
4809
4844
  <div class="header-actions">
4810
- <button class="icon-btn" @click=${this._fullscreen} ?disabled=${!s&&!a&&!i&&!r} aria-label="Fullscreen">
4845
+ <button class="icon-btn" @click=${this._fullscreen} ?disabled=${!s&&!i&&!a&&!r} aria-label="Fullscreen">
4811
4846
  <ap-icon name="fullscreen" .size=${16}></ap-icon>
4812
4847
  </button>
4813
4848
  <button class="icon-btn ${this.asset&&this.selectedIds.includes(this.asset.uuid)?"selected":""}" @click=${this._select} aria-label="Select">
@@ -4820,11 +4855,11 @@
4820
4855
  </div>
4821
4856
 
4822
4857
  <div class="preview-area ${s&&l?"chess":""}">
4823
- ${k?o.html`
4824
- <button class="nav-btn prev" @click=${this._prev} ?disabled=${!O} aria-label="Previous">
4858
+ ${T?o.html`
4859
+ <button class="nav-btn prev" @click=${this._prev} ?disabled=${!k} aria-label="Previous">
4825
4860
  <ap-icon name="chevron-left" .size=${16}></ap-icon>
4826
4861
  </button>
4827
- <button class="nav-btn next" @click=${this._next} ?disabled=${!$} aria-label="Next">
4862
+ <button class="nav-btn next" @click=${this._next} ?disabled=${!w} aria-label="Next">
4828
4863
  <ap-icon name="chevron-right" .size=${16}></ap-icon>
4829
4864
  </button>
4830
4865
  `:o.nothing}
@@ -4859,17 +4894,17 @@
4859
4894
  />
4860
4895
  </div>
4861
4896
  `:o.nothing}
4862
- ${a?o.html`<video src=${g} poster=${v||o.nothing} controls @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
4863
- ${i?o.html`<audio src=${((Ge=t.url)==null?void 0:Ge.cdn)||""} controls></audio>`:o.nothing}
4897
+ ${i?o.html`<video src=${g} poster=${v||o.nothing} controls @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:o.nothing}
4898
+ ${a?o.html`<audio src=${((Ge=t.url)==null?void 0:Ge.cdn)||""} controls></audio>`:o.nothing}
4864
4899
  ${r&&!s?o.html`
4865
4900
  <img
4866
- src=${w||n}
4901
+ src=${$||n}
4867
4902
  alt=${t.name}
4868
- class=${w?"":"icon-fallback"}
4903
+ class=${$?"":"icon-fallback"}
4869
4904
  @error=${de=>{const pe=de.target;pe.src!==n&&(pe.src=n,pe.classList.add("icon-fallback"))}}
4870
4905
  />
4871
4906
  `:o.nothing}
4872
- ${!s&&!a&&!i&&!r?o.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:o.nothing}
4907
+ ${!s&&!i&&!a&&!r?o.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:o.nothing}
4873
4908
  </div>
4874
4909
 
4875
4910
  ${this._renderFileInfoSection(t)}
@@ -4877,7 +4912,7 @@
4877
4912
  ${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
4878
4913
  `:o.nothing}
4879
4914
  </div>
4880
- `}};P.styles=o.css`
4915
+ `}};M.styles=o.css`
4881
4916
  :host {
4882
4917
  display: block;
4883
4918
  }
@@ -5186,7 +5221,7 @@
5186
5221
  .panel { animation: none; }
5187
5222
  .accordion-chevron { transition: none; }
5188
5223
  }
5189
- `;I([c.property({type:Object})],P.prototype,"asset",2);I([c.property({type:Array})],P.prototype,"assets",2);I([c.property({type:Array})],P.prototype,"selectedIds",2);I([c.property()],P.prototype,"containerToken",2);I([c.property({type:Boolean})],P.prototype,"showMetadata",2);I([c.property({type:Array})],P.prototype,"metadataFields",2);I([c.property({type:Array})],P.prototype,"labels",2);I([c.property({type:Object})],P.prototype,"regionalFilters",2);I([c.property({type:Boolean})],P.prototype,"multiSelect",2);I([c.query(".preview-area")],P.prototype,"previewArea",2);I([c.query("video")],P.prototype,"_videoEl",2);I([c.state()],P.prototype,"_isFullscreen",2);I([c.state()],P.prototype,"_fsImageLoaded",2);I([c.state()],P.prototype,"_previewLoading",2);I([c.state()],P.prototype,"_openSections",2);P=I([c.customElement("ap-preview-panel")],P);var Ya=Object.defineProperty,Xa=Object.getOwnPropertyDescriptor,Pe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Xa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ya(e,s,i),i};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`
5224
+ `;O([c.property({type:Object})],M.prototype,"asset",2);O([c.property({type:Array})],M.prototype,"assets",2);O([c.property({type:Array})],M.prototype,"selectedIds",2);O([c.property()],M.prototype,"containerToken",2);O([c.property({type:Boolean})],M.prototype,"showMetadata",2);O([c.property({type:Array})],M.prototype,"metadataFields",2);O([c.property({type:Array})],M.prototype,"labels",2);O([c.property({type:Object})],M.prototype,"regionalFilters",2);O([c.property({type:Boolean})],M.prototype,"multiSelect",2);O([c.query(".preview-area")],M.prototype,"previewArea",2);O([c.query("video")],M.prototype,"_videoEl",2);O([c.state()],M.prototype,"_isFullscreen",2);O([c.state()],M.prototype,"_fsImageLoaded",2);O([c.state()],M.prototype,"_previewLoading",2);O([c.state()],M.prototype,"_openSections",2);M=O([c.customElement("ap-preview-panel")],M);var Xi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,Le=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wi(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&&Xi(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`
5190
5225
  <div class="bar">
5191
5226
  <span class="count">${this.selectedAssets.length} selected</span>
5192
5227
  <span class="select-label">Select:</span>
@@ -5283,12 +5318,12 @@
5283
5318
  @media (prefers-reduced-motion: reduce) {
5284
5319
  .bar { animation: none; }
5285
5320
  }
5286
- `;Pe([c.property({type:Array})],oe.prototype,"selectedAssets",2);Pe([c.property({type:Number})],oe.prototype,"totalCount",2);Pe([c.property({type:Boolean})],oe.prototype,"isSelectingAll",2);Pe([c.property({type:Boolean})],oe.prototype,"multiSelect",2);Pe([c.property({type:Number})],oe.prototype,"maxSelections",2);oe=Pe([c.customElement("ap-selection-bar")],oe);var Wa=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,It=(t,e,s,a)=>{for(var i=a>1?void 0:a?Qa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Wa(e,s,i),i};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`
5321
+ `;Le([c.property({type:Array})],oe.prototype,"selectedAssets",2);Le([c.property({type:Number})],oe.prototype,"totalCount",2);Le([c.property({type:Boolean})],oe.prototype,"isSelectingAll",2);Le([c.property({type:Boolean})],oe.prototype,"multiSelect",2);Le([c.property({type:Number})],oe.prototype,"maxSelections",2);oe=Le([c.customElement("ap-selection-bar")],oe);var Qi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,Dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Zi(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&&Qi(e,s,a),a};let Be=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`
5287
5322
  <div
5288
5323
  class="marquee"
5289
5324
  style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
5290
5325
  ></div>
5291
- `}};Ue.styles=o.css`
5326
+ `}};Be.styles=o.css`
5292
5327
  :host {
5293
5328
  display: block;
5294
5329
  position: absolute;
@@ -5305,7 +5340,7 @@
5305
5340
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
5306
5341
  border-radius: 2px;
5307
5342
  }
5308
- `;It([c.property({type:Boolean})],Ue.prototype,"active",2);It([c.property({type:Object})],Ue.prototype,"rect",2);Ue=It([c.customElement("ap-marquee-overlay")],Ue);var Za=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,Dt=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ja(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Za(e,s,i),i};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",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"}}],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=er[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:a,attrs:i}=s;return a==="circle"?o.svg`<circle cx=${i.cx} cy=${i.cy} r=${i.r} fill=${i.fill??"none"}></circle>`:a==="rect"?o.svg`<rect width=${i.width} height=${i.height} x=${i.x} y=${i.y} rx=${i.rx??"0"} ry=${i.ry??"0"}></rect>`:o.svg`<path d=${i.d}></path>`});return o.html`
5343
+ `;Dt([c.property({type:Boolean})],Be.prototype,"active",2);Dt([c.property({type:Object})],Be.prototype,"rect",2);Be=Dt([c.customElement("ap-marquee-overlay")],Be);var Ji=Object.defineProperty,er=Object.getOwnPropertyDescriptor,zt=(t,e,s,i)=>{for(var a=i>1?void 0:i?er(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&&Ji(e,s,a),a};const tr={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=tr[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`
5309
5344
  <svg
5310
5345
  style="--icon-size: ${this.size}px"
5311
5346
  viewBox="0 0 24 24"
@@ -5327,7 +5362,7 @@
5327
5362
  width: var(--icon-size, 20px);
5328
5363
  height: var(--icon-size, 20px);
5329
5364
  }
5330
- `];Dt([c.property()],Ve.prototype,"name",2);Dt([c.property({type:Number})],Ve.prototype,"size",2);Ve=Dt([c.customElement("ap-icon")],Ve);var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,_s=(t,e,s,a)=>{for(var i=a>1?void 0:a?sr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&tr(e,s,i),i};let rt=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>`}};rt.styles=[o.css`
5365
+ `];zt([c.property()],Ve.prototype,"name",2);zt([c.property({type:Number})],Ve.prototype,"size",2);Ve=zt([c.customElement("ap-icon")],Ve);var sr=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,ys=(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};let rt=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>`}};rt.styles=[o.css`
5331
5366
  :host {
5332
5367
  display: inline-flex;
5333
5368
  }
@@ -5340,7 +5375,7 @@
5340
5375
  @keyframes spin {
5341
5376
  to { transform: rotate(360deg); }
5342
5377
  }
5343
- `];_s([c.property({type:Number})],rt.prototype,"size",2);rt=_s([c.customElement("ap-spinner")],rt);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,ut=(t,e,s,a)=>{for(var i=a>1?void 0:a?ar(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ir(e,s,i),i};let Ae=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
5378
+ `];ys([c.property({type:Number})],rt.prototype,"size",2);rt=ys([c.customElement("ap-spinner")],rt);var ir=Object.defineProperty,rr=Object.getOwnPropertyDescriptor,ut=(t,e,s,i)=>{for(var a=i>1?void 0:i?rr(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&&ir(e,s,a),a};let Ae=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
5344
5379
  <div class="box">
5345
5380
  <svg class="check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
5346
5381
  <path d="M20 6 9 17l-5-5"></path>
@@ -5401,7 +5436,7 @@
5401
5436
  font-size: var(--ap-font-size-sm, 0.875rem);
5402
5437
  color: var(--ap-foreground, oklch(0.37 0.022 248.413));
5403
5438
  }
5404
- `];ut([c.property({type:Boolean,reflect:!0})],Ae.prototype,"checked",2);ut([c.property({type:Boolean,reflect:!0})],Ae.prototype,"indeterminate",2);ut([c.property({type:Boolean,reflect:!0})],Ae.prototype,"disabled",2);Ae=ut([c.customElement("ap-checkbox")],Ae);var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,ys=(t,e,s,a)=>{for(var i=a>1?void 0:a?or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&rr(e,s,i),i};let ot=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`
5439
+ `];ut([c.property({type:Boolean,reflect:!0})],Ae.prototype,"checked",2);ut([c.property({type:Boolean,reflect:!0})],Ae.prototype,"indeterminate",2);ut([c.property({type:Boolean,reflect:!0})],Ae.prototype,"disabled",2);Ae=ut([c.customElement("ap-checkbox")],Ae);var or=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,xs=(t,e,s,i)=>{for(var a=i>1?void 0:i?nr(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&&or(e,s,a),a};let ot=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`
5405
5440
  <slot name="trigger" @click=${()=>this.open=!this.open}></slot>
5406
5441
  <div class="content ${this.open?"open":""}">
5407
5442
  <slot></slot>
@@ -5427,7 +5462,7 @@
5427
5462
  .content.open {
5428
5463
  display: block;
5429
5464
  }
5430
- `];ys([c.state()],ot.prototype,"open",2);ot=ys([c.customElement("ap-popover")],ot);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,N=(t,e,s,a)=>{for(var i=a>1?void 0:a?lr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&nr(e,s,i),i};let z=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
5465
+ `];xs([c.state()],ot.prototype,"open",2);ot=xs([c.customElement("ap-popover")],ot);var lr=Object.defineProperty,cr=Object.getOwnPropertyDescriptor,N=(t,e,s,i)=>{for(var a=i>1?void 0:i?cr(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&&lr(e,s,a),a};let I=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
5431
5466
  <button
5432
5467
  class="trigger"
5433
5468
  role="combobox"
@@ -5452,13 +5487,13 @@
5452
5487
  role="listbox"
5453
5488
  @keydown=${this._handleMenuKeydown}
5454
5489
  >
5455
- ${this.options.map((s,a)=>o.html`
5490
+ ${this.options.map((s,i)=>o.html`
5456
5491
  <button
5457
- class="option ${a===this._focusedIndex?"focused":""}"
5492
+ class="option ${i===this._focusedIndex?"focused":""}"
5458
5493
  role="option"
5459
5494
  aria-selected=${s.value===this.value}
5460
5495
  @click=${()=>this._select(s.value)}
5461
- @mouseenter=${()=>{this._focusedIndex=a}}
5496
+ @mouseenter=${()=>{this._focusedIndex=i}}
5462
5497
  >
5463
5498
  ${s.icon?o.html`<ap-icon name=${s.icon} .size=${16}></ap-icon>`:o.nothing}
5464
5499
  ${s.label}
@@ -5466,7 +5501,7 @@
5466
5501
  `)}
5467
5502
  </div>
5468
5503
  `:o.nothing}
5469
- `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top,a=Math.min(this.options.length*36+8,300);this._menuPosition=e<a&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const i=window.innerWidth-t.left;this._menuAlign=i<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,a,i;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(i=(a=this.shadowRoot)==null?void 0:a.querySelector(".trigger"))==null||i.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};z.styles=[J,o.css`
5504
+ `}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect(),e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};I.styles=[J,o.css`
5470
5505
  :host {
5471
5506
  position: relative;
5472
5507
  display: inline-block;
@@ -5544,7 +5579,7 @@
5544
5579
  .option[aria-selected="true"] ap-icon {
5545
5580
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
5546
5581
  }
5547
- `];N([c.property()],z.prototype,"value",2);N([c.property()],z.prototype,"label",2);N([c.property({reflect:!0})],z.prototype,"variant",2);N([c.property({type:Array})],z.prototype,"options",2);N([c.state()],z.prototype,"_open",2);N([c.state()],z.prototype,"_focusedIndex",2);N([c.state()],z.prototype,"_menuPosition",2);N([c.state()],z.prototype,"_menuAlign",2);N([c.state()],z.prototype,"_menuTop",2);N([c.state()],z.prototype,"_menuBottom",2);N([c.state()],z.prototype,"_menuLeft",2);N([c.state()],z.prototype,"_menuRight",2);z=N([c.customElement("ap-dropdown")],z);var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,xs=(t,e,s,a)=>{for(var i=a>1?void 0:a?dr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&cr(e,s,i),i};let nt=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};nt.styles=[o.css`
5582
+ `];N([c.property()],I.prototype,"value",2);N([c.property()],I.prototype,"label",2);N([c.property({reflect:!0})],I.prototype,"variant",2);N([c.property({type:Array})],I.prototype,"options",2);N([c.state()],I.prototype,"_open",2);N([c.state()],I.prototype,"_focusedIndex",2);N([c.state()],I.prototype,"_menuPosition",2);N([c.state()],I.prototype,"_menuAlign",2);N([c.state()],I.prototype,"_menuTop",2);N([c.state()],I.prototype,"_menuBottom",2);N([c.state()],I.prototype,"_menuLeft",2);N([c.state()],I.prototype,"_menuRight",2);I=N([c.customElement("ap-dropdown")],I);var dr=Object.defineProperty,pr=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?pr(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&&dr(e,s,a),a};let nt=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};nt.styles=[o.css`
5548
5583
  :host {
5549
5584
  display: inline-flex;
5550
5585
  }
@@ -5562,7 +5597,7 @@
5562
5597
  background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
5563
5598
  color: var(--ap-primary, oklch(0.578 0.198 268.129));
5564
5599
  }
5565
- `];xs([c.property({reflect:!0})],nt.prototype,"variant",2);nt=xs([c.customElement("ap-badge")],nt);var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,$s=(t,e,s,a)=>{for(var i=a>1?void 0:a?hr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&pr(e,s,i),i};let lt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
5600
+ `];ws([c.property({reflect:!0})],nt.prototype,"variant",2);nt=ws([c.customElement("ap-badge")],nt);var hr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,$s=(t,e,s,i)=>{for(var a=i>1?void 0:i?ur(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&&hr(e,s,a),a};let lt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
5566
5601
  <slot></slot>
5567
5602
  <div class="tip">${this.text}</div>
5568
5603
  `}};lt.styles=[o.css`
@@ -5588,7 +5623,7 @@
5588
5623
  :host(:hover) .tip {
5589
5624
  display: block;
5590
5625
  }
5591
- `];$s([c.property()],lt.prototype,"text",2);lt=$s([c.customElement("ap-tooltip")],lt);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Le=(t,e,s,a)=>{for(var i=a>1?void 0:a?gr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ur(e,s,i),i};let ne=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(i=>!this.disabled&&!i.disabled);if(e.length===0)return;const s=e.findIndex(i=>i.value===this.value);let a=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),a=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),a=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}a!==null&&this._select(e[a])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
5626
+ `];$s([c.property()],lt.prototype,"text",2);lt=$s([c.customElement("ap-tooltip")],lt);var gr=Object.defineProperty,fr=Object.getOwnPropertyDescriptor,Pe=(t,e,s,i)=>{for(var a=i>1?void 0:i?fr(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&&gr(e,s,a),a};let ne=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
5592
5627
  ${this.options.map(t=>o.html`
5593
5628
  <div
5594
5629
  class="option"
@@ -5660,7 +5695,7 @@
5660
5695
  font-family: inherit;
5661
5696
  user-select: none;
5662
5697
  }
5663
- `];Le([c.property()],ne.prototype,"value",2);Le([c.property({type:Array})],ne.prototype,"options",2);Le([c.property({type:Boolean})],ne.prototype,"disabled",2);Le([c.property({reflect:!0})],ne.prototype,"direction",2);Le([c.property({reflect:!0})],ne.prototype,"columns",2);ne=Le([c.customElement("ap-radio-group")],ne);var fr=Object.defineProperty,zt=(t,e,s,a)=>{for(var i=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=n(e,s,i)||i);return i&&fr(e,s,i),i};const Rt=class Rt 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 a,i;if(!((a=this.config)!=null&&a.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);s.length>0&&this._openUploader(s)},this.store=Os(),this.storeCtrl=new Ms(this,this.store),this.selectionCtrl=new Ps(this,this.store),this.infiniteScrollCtrl=new Ls(this,()=>this._loadMore()),this.marqueeCtrl=new Is(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 i=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,i)}const a=this.renderRoot.querySelector(".main-content");a&&a!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=a,this.marqueeCtrl.attach(a))}_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=wi(),a=s.sortBy??e.defaultSortBy??"created_at",i=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Ci()||e.defaultViewMode||"grid",sortBy:a,sortDirection:i,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new Ds(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await Us(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,l]=await Promise.allSettled([ai(this.apiClient),Ns(this.apiClient),Bs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:v,brandColor:w}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:v,...w?{brandColor:w}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),l.status==="fulfilled"&&this.store.setState({tags:l.value});const{pinnedFilters:d,pinnedMetadata:h}=yi(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}),Ti(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,a=this.store.getState();let i;return e.auth.mode==="securityTemplate"?i={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:i={mode:"session",container:e.auth.projectToken,sessionToken:e.auth.sessionToken,companyToken:e.auth.companyToken},{auth:i,targetFolder:a.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 a;if(!((a=this.config)!=null&&a.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(i){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i instanceof Error?i:new Error(String(i)),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,a;return!!((a=(s=e.dataTransfer)==null?void 0:s.types)!=null&&a.includes("Files"))}async open(){var l,d,h,u,f,p;const e=this.store.getState(),s=De((l=this.config)==null?void 0:l.forcedFilters),a=new Set(Object.keys(s)),i={},r=De((d=this.config)==null?void 0:d.defaultFilters);for(const[g,v]of Object.entries(r))a.has(g)||(i[g]=v);const n=Object.keys(i);this.store.setState({isOpen:!0,activeTab:((u=(h=this.config)==null?void 0:h.tabs)==null?void 0:u[0])??"assets",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:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:((f=this.config)==null?void 0:f.rememberLastFolder)&&ki()||((p=this.config)==null?void 0:p.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 a,i,r,n,l,d,h,u,f,p,g,v,w,b;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const O=s.activeTab;if(O==="assets"){const $=this._buildSearchNotation(),k=s.currentFolderPath||"/",A=Ye(this.apiClient,{folder:k,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:1}),T=Ut(this.apiClient,{folder:k,q:$||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[L,C]=await Promise.all([A,T]);if(e!==this._loadId)return;const se=((a=L.files)==null?void 0:a.length)??0,ce=se>=s.limit,$e=((i=C==null?void 0:C.stats)==null?void 0:i.approx_files_count)??((r=C==null?void 0:C.info)==null?void 0:r.total_files_count)??((n=L.info)==null?void 0:n.total_files_count)??((d=(l=L.base)==null?void 0:l.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:$e,totalFolderCount:0,offset:0,hasMore:ce,isLoading:!1})}else if(O==="folders"){const $=this._buildSearchNotation(),k=s.currentFolderPath||"/",[A,T,L]=await Promise.all([Rs(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:k,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:0}),Ut(this.apiClient,{folder:k,q:$||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const C=A.folders||[];let se={};if(C.length>0)try{se=await js(this.apiClient,C.map(de=>de.uuid))}catch{}if(e!==this._loadId)return;const ce=((f=T.files)==null?void 0:f.length)??0,$e=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=T.info)==null?void 0:v.total_files_count)??((b=(w=T.base)==null?void 0:w.count)==null?void 0:b.files_direct)??ce;this.store.setState({assets:T.files||[],folders:C,folderPreviews:se,totalCount:Ge,totalFolderCount:A.total??C.length,offset:0,hasMore:$e,isLoading:!1})}}catch(O){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:O,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,a=e.offset+e.limit;this.store.setState({isLoading:!0});try{const i=this._buildSearchNotation(),r=await Ye(this.apiClient,{folder:e.currentFolderPath||"/",offset:a,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:i||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,l=r.files||[],d=l.length>=e.limit,h=[...n,...l];this.store.setState({assets:h,offset:a,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,a;this.close(),(a=(s=this.config)==null?void 0:s.onCancel)==null||a.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 a;const s=e.detail.mode;this.store.setState({viewMode:s}),(a=this.config)!=null&&a.rememberLastView&&Si(s),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:a}=e.detail,i=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...i,[s]:a}})}_handleSortChange(e){const s=e.detail.value,a=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Xt(s,a.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,a=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),Xt(a.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var s;this.store.setState({activeTab:e.detail.tab,currentFolder:null,currentFolderPath:((s=this.config)==null?void 0:s.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 a,i;const s=e.detail.asset;(i=(a=this.config)==null?void 0:a.onSelect)==null||i.call(a,[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,a=this.store.getState(),i=s.path||`${a.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&Wt(i),this.store.setState({currentFolder:s.uuid,currentFolderPath:i,breadcrumb:[...a.breadcrumb,{uuid:s.uuid,name:s.name,path:i}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var l,d;const s=e.detail.uuid,a=this.store.getState(),i=s?a.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?a.breadcrumb.slice(0,i+1):[],n=r.length>0?r[r.length-1].path:((l=this.config)==null?void 0:l.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Wt(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 a,i;const s=e.detail.assets;(i=(a=this.config)==null?void 0:a.onSelect)==null||i.call(a,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleSelectAll(){var a;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((a=e.config)==null?void 0:a.multiSelect)??!0))){if(e.assets.length>=e.totalCount){this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const i=this._buildSearchNotation(),r=e.currentFolderPath||"/",n=e.limit,l=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=l.length;b<d;b+=n)u.push(b);const f=4,p=[];for(let b=0;b<u.length;b+=f){const O=u.slice(b,b+f),$=await Promise.all(O.map(k=>Ye(this.apiClient,{folder:r,offset:k,limit:n,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:i||void 0,recursive:h})));for(const k of $)k.files&&p.push(...k.files)}const g=new Set(l.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),w=[...l,...v];this.store.setState({assets:w,offset:Math.max(0,w.length-n),hasMore:!1,isSelectingAll:!1}),this.selectionCtrl.selectAll(w)}catch(i){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,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===R.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:a,operator:i}=e.detail,n={...this.store.getState().filters};let l=a===""||a===null||a===void 0||Array.isArray(a)&&a.length===0||typeof a=="object"&&!Array.isArray(a)&&Object.values(a).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!l&&this._isDateFilterKey(s)&&typeof a=="object"&&!Array.isArray(a)){const{kind:d,preset:h,from:u,to:f}=a;l=!d&&!h&&!u&&!f}if(l){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 a=="object"&&!Array.isArray(a)?d[s]={type:"date",field:a.field||"created",kind:a.kind||null,preset:a.preset||null,from:a.from||null,to:a.to||null}:s===m.IMAGE&&typeof a=="object"&&!Array.isArray(a)?d[s]=a:d[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":"},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,a=e.detail.chipRect,i=this.renderRoot.querySelector("ap-content-toolbar");let r;if(a){const n=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(n){const l=n.getBoundingClientRect();r=a.left-l.left}}i==null||i.openFilterPanel(s,!0,r)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:a}=e.detail,i=this.renderRoot.querySelector("ap-content-toolbar");let r;if(a){const n=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(n){const l=n.getBoundingClientRect();r=a.left-l.left}}i==null||i.openMetadataFieldPanel(s,!0,r)}_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 f,p,g;const{key:s,metadataFieldKey:a}=e.detail,i=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!i||!r)return;a?(this._pendingMetadataField=a,i.pendingMetadataField=a):s&&(this._pendingFilter=s,i.pendingFilter=s),await i.updateComplete;let n=i.renderRoot.querySelector(".chip.pending");if(!n){const v=i.renderRoot.querySelectorAll(".chip.pinned-empty"),w=a?(f=i._getMetadataLabel)==null?void 0:f.call(i,a):void 0;for(const b of v){const O=(g=(p=b.querySelector(".chip-label"))==null?void 0:p.textContent)==null?void 0:g.trim();if(a&&O===w){n=b;break}if(s&&O===(ke[s]||s)){n=b;break}}}if(!n)return;const l=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?l.left-h.left:l.left;a?r.openMetadataFieldPanel(a,!0,u):s&&r.openFilterPanel(s,!0,u)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const i={...this.store.getState().filters},r={...i.applied};delete r[s],i.applied=r,i.pinned.includes(s)||(i.visible=i.visible.filter(l=>l!==s)),this.store.setState({filters:i,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:a,values:i,metadataType:r}=e.detail,l={...this.store.getState().filters},d={...l.metadata},h={...d.applied};if(!i||Array.isArray(i)&&i.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(i)?i:[i],operator:a||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),l.metadata=d,this.store.setState({filters:l,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:a}=e.detail,r={...this.store.getState().filters},n={...r.metadata};a?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(l=>l!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,i={...this.store.getState().filters},r={...i.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(l=>l!==s)),i.metadata=r,this.store.setState({filters:i,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var l,d;const{key:s,pinned:a}=e.detail,r={...this.store.getState().filters};a?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=(l=this.store.getState().config)==null?void 0:l.auth)==null?void 0:d.projectToken)??null;xi(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:a}=e.detail,r={...this.store.getState().filters},n={...r.metadata};a?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 l=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;$i(l,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,i={...this.store.getState().filters};i.visible=i.visible.filter(r=>r!==s),this.store.setState({filters:i})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,i={...this.store.getState().filters},r={...i.metadata};r.visible=r.visible.filter(n=>n!==s),i.metadata=r,this.store.setState({filters:i})}_handleFiltersSet(e){var h;const{applied:s,metadata:a}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),l={...s};for(const u of n)delete l[u];r.applied=l;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],a){const u={...r.metadata};u.applied=a.applied;const f=Object.keys(a.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?Oi:e.activeTab==="folders"?Mi:Ft}_buildSearchNotation(){var i;const e=this.store.getState(),s={...De((i=this.config)==null?void 0:i.forcedFilters),...e.filters.applied};return ni(s,e.filters.metadata.applied).join(" ")}render(){var h,u,f,p,g,v,w,b;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),a=this.selectionCtrl.getSelectedAssets(),i=o.html`
5698
+ `];Pe([c.property()],ne.prototype,"value",2);Pe([c.property({type:Array})],ne.prototype,"options",2);Pe([c.property({type:Boolean})],ne.prototype,"disabled",2);Pe([c.property({reflect:!0})],ne.prototype,"direction",2);Pe([c.property({reflect:!0})],ne.prototype,"columns",2);ne=Pe([c.customElement("ap-radio-group")],ne);var mr=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&&mr(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=Os(),this.storeCtrl=new Ls(this,this.store),this.selectionCtrl=new Ps(this,this.store),this.infiniteScrollCtrl=new Is(this,()=>this._loadMore()),this.marqueeCtrl=new Ds(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=ka(),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&&Ea()||e.defaultViewMode||"grid",sortBy:i,sortDirection:a,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new zs(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await Vs(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,l]=await Promise.allSettled([ra(this.apiClient),Us(this.apiClient),Bs(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||[]}),l.status==="fulfilled"&&this.store.setState({tags:l.value});const{pinnedFilters:d,pinnedMetadata:h}=xa(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}),Ma(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:"session",container:e.auth.projectToken,sessionToken:e.auth.sessionToken,companyToken:e.auth.companyToken},{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 l,d,h,u,f,p;const e=this.store.getState(),s=De((l=this.config)==null?void 0:l.forcedFilters),i=new Set(Object.keys(s)),a={},r=De((d=this.config)==null?void 0:d.defaultFilters);for(const[g,v]of Object.entries(r))i.has(g)||(a[g]=v);const n=Object.keys(a);this.store.setState({isOpen:!0,activeTab:((u=(h=this.config)==null?void 0:h.tabs)==null?void 0:u[0])??"assets",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:((f=this.config)==null?void 0:f.rememberLastFolder)&&Sa()||((p=this.config)==null?void 0:p.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,l,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=(l=L.base)==null?void 0:l.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([Ns(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 js(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,l=r.files||[],d=l.length>=e.limit,h=[...n,...l];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&&Ca(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 s;this.store.setState({activeTab:e.detail.tab,currentFolder:null,currentFolderPath:((s=this.config)==null?void 0:s.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 l,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:((l=this.config)==null?void 0:l.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,l=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=l.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(l.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),$=[...l,...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 l=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(!l&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;l=!d&&!h&&!u&&!f}if(l){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 l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.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 l=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(l){const d=l.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 l=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?l.left-h.left:l.left,f=h?l.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(l=>l!==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,l={...this.store.getState().filters},d={...l.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])),l.metadata=d,this.store.setState({filters:l,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(l=>l!==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(l=>l!==s)),a.metadata=r,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var l,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=(l=this.store.getState().config)==null?void 0:l.auth)==null?void 0:d.projectToken)??null;wa(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 l=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;$a(l,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)??{})),l={...s};for(const u of n)delete l[u];r.applied=l;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?Oa:e.activeTab==="folders"?La:At}_buildSearchNotation(){var a;const e=this.store.getState(),s={...De((a=this.config)==null?void 0:a.forcedFilters),...e.filters.applied};return la(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`
5664
5699
  <ap-header
5665
5700
  .activeTab=${e.activeTab}
5666
5701
  .tabs=${((h=this.config)==null?void 0:h.tabs)??["assets","folders"]}
@@ -5769,10 +5804,10 @@
5769
5804
  </div>
5770
5805
  `,l=o.html`
5771
5806
  <ap-selection-bar
5772
- .selectedAssets=${a}
5807
+ .selectedAssets=${i}
5773
5808
  .totalCount=${e.totalCount}
5774
5809
  .isSelectingAll=${e.isSelectingAll}
5775
- .multiSelect=${((w=this.config)==null?void 0:w.multiSelect)??!0}
5810
+ .multiSelect=${(($=this.config)==null?void 0:$.multiSelect)??!0}
5776
5811
  .maxSelections=${(b=this.config)==null?void 0:b.maxSelections}
5777
5812
  @selection-confirm=${this._handleSelectionConfirm}
5778
5813
  @selection-clear=${this._handleSelectionClear}
@@ -5791,7 +5826,7 @@
5791
5826
  `:o.nothing;return this._isInline?e.isOpen?o.html`
5792
5827
  <div class="ap-inline">
5793
5828
  ${this._isUploaderOpen?d:o.html`
5794
- <div class="inline-header">${i}</div>
5829
+ <div class="inline-header">${a}</div>
5795
5830
  <div class="inline-content">${n}</div>
5796
5831
  <div class="inline-footer">${l}</div>
5797
5832
  `}
@@ -5799,15 +5834,15 @@
5799
5834
  `:o.nothing:o.html`
5800
5835
  <ap-modal
5801
5836
  ?open=${e.isOpen}
5802
- @ap-cancel=${O=>this._handleCancel(O.detail.reason)}
5837
+ @ap-cancel=${k=>this._handleCancel(k.detail.reason)}
5803
5838
  >
5804
5839
  ${this._isUploaderOpen?d:o.html`
5805
- <div slot="header">${i}</div>
5840
+ <div slot="header">${a}</div>
5806
5841
  ${n}
5807
5842
  <div slot="footer">${l}</div>
5808
5843
  `}
5809
5844
  </ap-modal>
5810
- `}_renderContent(e,s){var a,i,r;return e.activeTab==="assets"?!e.isLoading&&e.assets.length===0?o.html`
5845
+ `}_renderContent(e,s){var i,a,r;return e.activeTab==="assets"?!e.isLoading&&e.assets.length===0?o.html`
5811
5846
  <div class="empty-state">
5812
5847
  <ap-icon name="search" .size=${48}></ap-icon>
5813
5848
  <div class="empty-title">No assets found</div>
@@ -5819,7 +5854,7 @@
5819
5854
  .folders=${[]}
5820
5855
  .selectedIds=${s}
5821
5856
  .isLoading=${e.isLoading}
5822
- .multiSelect=${((a=this.config)==null?void 0:a.multiSelect)??!0}
5857
+ .multiSelect=${((i=this.config)==null?void 0:i.multiSelect)??!0}
5823
5858
  @asset-select=${this._handleAssetSelect}
5824
5859
  @asset-preview=${this._handleAssetPreview}
5825
5860
  @asset-quick-select=${this._handleQuickSelect}
@@ -5831,7 +5866,7 @@
5831
5866
  .folders=${[]}
5832
5867
  .selectedIds=${s}
5833
5868
  .isLoading=${e.isLoading}
5834
- .multiSelect=${((i=this.config)==null?void 0:i.multiSelect)??!0}
5869
+ .multiSelect=${((a=this.config)==null?void 0:a.multiSelect)??!0}
5835
5870
  .totalCount=${e.totalCount}
5836
5871
  .isSelectingAll=${e.isSelectingAll}
5837
5872
  @asset-select=${this._handleAssetSelect}
@@ -5877,7 +5912,7 @@
5877
5912
  @selection-clear=${this._handleSelectionClear}
5878
5913
  ></ap-list-view>
5879
5914
  <div id="sentinel"></div>
5880
- `:o.nothing}};Rt.styles=[o.css`
5915
+ `:o.nothing}};Nt.styles=[o.css`
5881
5916
  :host {
5882
5917
  display: contents;
5883
5918
  font-family: var(--ap-font-family, system-ui, -apple-system, sans-serif);
@@ -6037,4 +6072,4 @@
6037
6072
  --sfx-up-border: transparent;
6038
6073
  --sfx-up-radius: 0;
6039
6074
  }
6040
- `];let Te=Rt;zt([c.state()],Te.prototype,"_isDragOver");zt([c.state()],Te.prototype,"_isUploaderOpen");zt([c.property({type:Object})],Te.prototype,"config");exports.AssetPicker=Te;
6075
+ `];let Te=Nt;Rt([c.state()],Te.prototype,"_isDragOver");Rt([c.state()],Te.prototype,"_isUploaderOpen");Rt([c.property({type:Object})],Te.prototype,"config");exports.AssetPicker=Te;