@scaleflex/asset-picker 0.2.20 → 0.2.21
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.
- package/dist/{asset-picker-B3Nrm0Le.js → asset-picker-Q4043aB2.js} +1737 -1701
- package/dist/{asset-picker-Dsnu-Ana.cjs → asset-picker-iM7pJfrx.cjs} +258 -258
- package/dist/define.cjs +1 -1
- package/dist/define.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/file-type.d.ts +2 -2
- package/dist/utils/file-type.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var $i=Object.create;var Ns=Object.defineProperty;var ki=Object.getOwnPropertyDescriptor;var Si=Object.getOwnPropertyNames;var Ci=Object.getPrototypeOf,Fi=Object.prototype.hasOwnProperty;var Ei=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Si(e))!Fi.call(t,a)&&a!==s&&Ns(t,a,{get:()=>e[a],enumerable:!(i=ki(e,a))||i.enumerable});return t};var Ai=(t,e,s)=>(s=t!=null?$i(Ci(t)):{},Ei(e||!t||!t.__esModule?Ns(s,"default",{value:t,enumerable:!0}):s,t));const r=require("lit"),l=require("lit/decorators.js");class Ti{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 Li(){return new Ti({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",isAISearchActive:!1,sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],activeLabelUuid:null,collections:[],activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},fileTypes:[],metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Oi{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Mi(t){return"extension"in t&&!("path"in t)}class Ii{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const o=this._getCombinedList();for(let n=e;n<=s;n++){const c=o[n];c&&(Mi(c)?i.set(c.uuid,c):a.set(c.uuid,c))}}handleSelect(e,s,i){var c,d,h,u;const a=this.store.getState(),o=new Map(a.selectedAssets);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=new Map(a.selectedFolders);this._applyRangeSelection(g,p,o,f);const v=(d=a.config)==null?void 0:d.maxSelections;if(v&&o.size+f.size>v)return;this.store.setState({selectedAssets:o,selectedFolders:f})}else{const g=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),f=a.assets;for(let b=g;b<=p;b++)f[b]&&o.set(f[b].uuid,f[b]);const v=(h=a.config)==null?void 0:h.maxSelections;if(v&&o.size>v)return;this.store.setState({selectedAssets:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const g=(u=a.config)==null?void 0:u.maxSelections,p=o.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(g&&p>g)return;this.store.setState({selectedAssets:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var c,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),o=new Map(a.selectedFolders);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),g=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,g,p,o);const f=(d=a.config)==null?void 0:d.maxSelections;if(f&&p.size+o.size>f)return;this.store.setState({selectedAssets:p,selectedFolders:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,g=o.size+a.selectedAssets.size;if(u&&g>u)return;this.store.setState({selectedFolders:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var c;const s=this.store.getState(),i=(c=s.config)==null?void 0:c.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,o=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)o.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:o}),this.lastClickedIndex=-1,o.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,o=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let c=0;c<o;c++)a.set(e[c].uuid,e[c]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class Pi{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 Us=5,Ze=40,Bs=15;class Di{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){var a;if(e.button!==0||this.isInteractiveTarget(e)||!(((a=this.store.getState().config)==null?void 0:a.multiSelect)??!0))return;const i=this.container.getBoundingClientRect();this.startX=e.clientX-i.left+this.container.scrollLeft,this.startY=e.clientY-i.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<Us&&a<Us)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let o=Math.min(this.startX,i),n=Math.min(this.startY,a),c=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;o+c>h&&(c=h-o),n+d>u&&(d=u-n),o<0&&(c+=o,o=0),n<0&&(d+=n,n=0),this.rect={x:o,y:n,width:c,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,o=i<Ze||a<Ze;o&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):o||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let o=0;i<Ze?o=-Bs*(1-i/Ze):a<Ze&&(o=Bs*(1-a/Ze)),o!==0&&(this.container.scrollTop+=o,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const o=i.shadowRoot.querySelectorAll("[data-folder-uuid]");o.length>0&&s.push(...Array.from(o))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),o=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.assetUuid;if(this.intersectsMarquee(p)){const v=e.assets.find(b=>b.uuid===f);v&&o.set(f,v)}}),s&&a.forEach(g=>{const p=this.getCardRelativeRect(g),f=g.dataset.folderUuid;if(this.intersectsMarquee(p)){const v=e.folders.find(b=>b.uuid===f);v&&n.set(f,v)}});const c=(u=e.config)==null?void 0:u.maxSelections,d=o.size+(s?n.size:0);if(c&&d>c){const g=Array.from(o.entries()).slice(0,Math.max(0,c-n.size));this.store.setState({selectedAssets:new Map(g),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:o,...s?{selectedFolders:n}:{}})}}class zi{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function Ri(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const o=[];return t.search&&!t.with_ai&&o.push(t.search),t.q&&o.push(t.q),o.length>0&&(e.q=o.join(" ")),t.with_ai&&(e.with_ai=!0,t.ai_query&&(e.ai_query=t.ai_query),t.ai_lang&&(e.ai_lang=t.ai_lang)),t.collection_uuid&&(e.collection_uuid=t.collection_uuid),t.f64&&(e.f64=t.f64),e}async function Pe(t,e){const s=Ri(e);return t.request("/files",s)}async function Et(t,e){const s={recursive:e.recursive??1};e.folder&&(s.folder=e.folder);const i=[];return e.search&&!e.with_ai&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),e.with_ai&&(s.with_ai=!0,e.ai_query&&(s.ai_query=e.ai_query),e.ai_lang&&(s.ai_lang=e.ai_lang)),e.collection_uuid&&(s.collection_uuid=e.collection_uuid),e.f64&&(s.f64=e.f64),t.request("/files/stats",s)}async function ji(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",o={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${o[i]||i}:${a}`,await t.request("/folders",s)}async function Ni(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Ui(t){return await t.request("/labels")}async function Bi(t){return t.request("/collections")}async function qi(t,e){return t.request(`/collections/${e}/folders`)}function Zs(t){return t.filter(e=>!!e.name).map(e=>({...e,children:Zs(e.children??[])})).filter(e=>{var s;return!((((s=e.children)==null?void 0:s.length)??0)<1&&!e.filters)})}async function Vi(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 Hi(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}function qt(t){var a,o;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(o=e[0])==null?void 0:o.playlists;return s!=null&&s.length&&s[0]||null}function Re(t){return(t.type??"").startsWith("image")}function Gi(t){return(t.type??"").startsWith("video")}function Ki(t){return(t.type??"").startsWith("audio")}function Js(t){var e,s;return((e=t.url)==null?void 0:e.cdn)??((s=t.url)==null?void 0:s.public)??""}function Qi(t,e){const{meta:s,name:i}=t;if(s!=null&&s.alt)return s.alt;const a=s==null?void 0:s.title;if(typeof a=="string"&&a)return a;if(a&&typeof a=="object"){if(e){const n=a[e];if(n)return n}const o=Object.keys(a)[0];if(o){const n=a[o];if(n)return n}}return i.split(".")[0]}function It(t){var e,s;return((e=t.info)==null?void 0:e.img_w)??((s=t.info)==null?void 0:s.video_w)??0}function Pt(t){var e,s;return((e=t.info)==null?void 0:e.img_h)??((s=t.info)==null?void 0:s.video_h)??0}function Yi(t){return{width:It(t),height:Pt(t)}}function Wi(t){return qt(t)!==null}function Xi(t){return qt(t)}function Zi(t){return qt(t)??Js(t)}const Ji={excellent:90,good:75,fair:60},ea=[{label:"WEBP",value:"webp"},{label:"JPEG",value:"jpeg"},{label:"PNG",value:"png"},{label:"GIF",value:"gif"}],ta=[{label:"Excellent",value:"excellent"},{label:"Good",value:"good"},{label:"Fair",value:"fair"}],sa=[{label:"Original",value:"original"},{label:"Full HD",value:"full_hd",width:1920},{label:"Large",value:"large",width:1200},{label:"Medium",value:"medium",width:600},{label:"Small",value:"small",width:300}],ia={webp:"awebp,webp",jpeg:"jpeg",png:"png",gif:"agif,gif"},aa=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),oa=new Set([...aa,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function et(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 ei(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return oa.has(e)}const ti="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",ra={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 wt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=ra[e];return`${ti}${s||"DEFAULT"}.png`}function tt(){return`${ti}DEFAULT.png`}function Vt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const na=new Set(["png","svg","webp","gif","avif"]);function ps(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return na.has(e)}const la=new Set(["svg","svg+xml","png","pdf"]);function si(t){return la.has(Vt(t).toLowerCase())}function Dt(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 Ue(s)}function ii(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?Ue(s):""}function hs(t){var s,i;let e=Ue(((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(/[?&]$/,""),ye(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function ye(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const qs=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Ue(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(qs);if(s){const i=s[2];return t.replace(qs,`$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 ai(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=Ue(s);const a=et(t.file_type),o=String(window.devicePixelRatio||1);return a==="video"?ye(i,{w:e,dpr:o,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||Vt(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ye(i,{w:e,dpr:o,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):ye(i,{w:e,dpr:o})}function us(t,e){const s={};return t.format&&(s.force_format=ia[t.format]),t.quality&&t.format!=="png"&&(s.q=String(Ji[t.quality])),t.width&&(s.w=String(t.width)),t.height&&(s.h=String(t.height)),(t.width||t.height)&&(s.org_if_sml="1",e!=null&&e.isMultiSelect?s.func="bound":(e==null?void 0:e.isAspectLocked)===!1&&(s.func="cover")),s}function ca(t,e,s){const i=Ue(t);if(!i)return t;const a=us(e,s);return Object.keys(a).length>0?ye(i,a):i}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"},H={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},k={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},da={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"},Ht={[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(Ht).map(([t,e])=>[e,t]));const oi=Object.values(Ht),dt={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Vs={EMPTY:"empty",NOT_EMPTY:"non-empty"},oe="empty",re="non-empty",De="specific",Zt=10,Jt=10,At=10,ri="filters:pinned:",ni="metadata:pinned:",Hs=[m.DATE,m.TYPE,m.SIZE],li=k.IS,Lt="20",Ot="1",pa=0,ha=[{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"}],ua={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},fa={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},ls=[ua,...ha,fa],Je={[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"},G={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},zt=[{value:G.IMAGE,label:"Image",icon:"image"},{value:G.VIDEO,label:"Video",icon:"clapperboard"},{value:G.AUDIO,label:"Audio",icon:"music"},{value:G.DOCUMENT,label:"Document",icon:"document"},{value:G.ARCHIVE,label:"Archive",icon:"archive"},{value:G.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:G.FONTS,label:"Fonts",icon:"text"},{value:G.OTHER,label:"Other",icon:"layout-grid"}],ga={[G.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[G.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[G.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[G.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[G.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[G.FONTS]:["ttf","otf","woff","woff2","eot"]},es={RESOLUTION:0,ORIENTATION:1,FACES:2},va=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ma=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],ba=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],ci=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],fs=[{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"}],di=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],_a=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],ya=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],xa=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],ts=[{label:"Is",value:k.IS},{label:"Contains",value:k.CONTAINS_IN_TEXT}],_e=[{label:"Is",value:k.IS},{label:"Is not",value:k.IS_NOT}],ss=[{label:"Is",value:k.IS_EXACT},{label:"Contains",value:k.IS},{label:"Does not contain",value:k.IS_NOT}],is=[{label:"Is",value:k.IS},{label:"Greater than",value:k.GREATER_THAN_OR_EQUAL},{label:"Is not",value:k.IS_NOT},{label:"Less than",value:k.LESS_THAN_OR_EQUAL},{label:"Between",value:k.RANGE}],wa=[{label:"Is",value:k.IS_EXACT},{label:"Is not",value:k.IS_NOT}],Gs=[{label:"Contains",value:k.CONTAINS},{label:"Does not contain",value:k.IS_NOT}],$a=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],je=[{label:"Empty",value:oe},{label:"Not empty",value:re}],as=[...je,{label:"Specific",value:De}],ka=[{label:"Empty",value:oe},{label:"Not empty",value:re},{label:"True",value:"true"},{label:"False",value:"false"}],Mt={[x.DATE]:"calendar",[x.BOOLEAN]:"toggle-left",[x.NUMERIC]:"file-digit",[x.DECIMAL2]:"decimals-arrow-right",[x.ATTACHMENTS_ASSETS]:"paperclip",[x.ATTACHMENT_URI]:"link-2",[x.SELECT_ONE]:"circle-dot",[x.MULTI_SELECT]:"square-check",[x.SUPERTAGS]:"hash",[x.TEXT]:"text-initial",[x.TEXT_AREA]:"text-align-justify",[x.GEO_POINT]:"locate",[x.INTEGER_LIST]:"list-ordered"},Sa={[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 Ca(t){var i;return(((i=(await t.request("/filters",{filter_by:"filetype",format:"list",limit:200})).filters)==null?void 0:i.file_types)??[]).map(a=>({name:a.name,value:a.value,count:a.count,category:a.category??a.value.split("_")[0],label:Fa(a.name)}))}function Fa(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function Ea(t){var v,b;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,o=((i==null?void 0:i.model)??[])[pa],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(_=>({uuid:_.uuid,label:_.label??_.name??"",variants:(_.variants??[]).map(S=>({api_value:S.api_value??S.value??"",internal_unique_value:S.internal_unique_value??S.api_value??"",label:S.label??S.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)??((b=e.settings)==null?void 0:b.project_branding),g=u==null?void 0:u.brandColor;if(!o)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:g};const p=o.groups??[],f=[];for(const _ of p){const S=_.name||"Root fields";for(const y of _.fields??[]){const O=y.possible_values,w=O==null?void 0:O.map($=>({api_value:$.api_value??$.value??"",internal_unique_value:$.internal_unique_value??$.api_value??"",label:$.label??$.name??$.api_value??""}));f.push({key:y.key??y.ckey,label:y.title??y.label??y.key??"",type:y.type??"text",slug:y.slug,ckey:y.ckey,possible_values:w,group:S,regionalVariantsGroupUuid:y.regional_variants_group_uuid})}}return{fields:f,regionalVariantGroups:d,regionalFilters:h,brandColor:g}}function ze(t){return t.toLocaleDateString("en-CA")}function Tt(){return ze(new Date)}function pi(t){const e=new Date;switch(t){case"today":return{from:Tt(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ze(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:Tt(),to:ze(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ze(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:Tt(),to:ze(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ze(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:Tt(),to:ze(s)}}default:return null}}function Ks(t,e){return e?e.type==="date"?Aa(e):e.type==="string"?Ta(e):!0:!1}function Aa(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function Ta(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function La(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Ks(i,a))continue;const o=Ma(i,a);s.push(...o)}for(const[i,a]of Object.entries(e)){if(!a||!Ks(i,a))continue;const o=Na(i,a);s.push(...o)}return Oa(s)}function Oa(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function Ma(t,e){if(e.type==="date")return hi(t,e);if(t===m.IMAGE)return ja(e);const s=e,{operator:i=li,values:a=[],logic:o}=s;if(a.length===0)return[];switch(t){case m.SIZE:return Ia(t,a,"..");case m.FACES:return Pa(t,i,a);case m.TAGS:return Ne(t,i,Qs(a),",",o);case m.LABELS:return Ne(t,i,Qs(a),",",o);case m.COLOR:return Da(i,a,o);case m.TYPE:return za(a,i);case m.MIME_TYPE:return Ra(t,a,i);case m.PRODUCT_REF:return Ne(t,"=%",a,",",o);default:return Ne(t,i,a,",",o)}}function hi(t,e){const s=e.field||"created";if(e.kind===dt.PRESET&&e.preset){if(e.preset===Vs.EMPTY)return[`${s}:"empty"`];if(e.preset===Vs.NOT_EMPTY)return[`${s}:"non-empty"`];const i=pi(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===dt.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===dt.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===dt.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===dt.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function Ia(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function Pa(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function Ne(t,e,s,i,a){if(s.length===0)return[];if(a===da.AND)return s.map(n=>`${t}${e}"${n}"`);const o=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${o}`]}function Da(t,e,s){const i=[],a=Ne("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function za(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const o of t){const n=ga[o];if(n)for(const c of n){const d=`${o}_${c}`;s.has(d)||(s.add(d),i.push(d))}else s.has(o)||(s.add(o),i.push(o))}const a=i.map(o=>`"${o}"`).join(",");return[`type${e}${a}`]}function Ra(t,e,s,i){if(e.length===0)return[];const a=e.map(o=>`"${o}"`).join(",");return[`${t}${s}${a}`]}function ja(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[es.RESOLUTION],a=s[es.ORIENTATION],o=s[es.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),o&&e.push(`faces:"${o}"`),e}function Na(t,e){const s=qa(t),i=Ba(t);if(e.type==="date")return Ua(s,e,i);const a=e,{operator:o=li,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===oe||n[0]===re)){const h=d===x.GEO_POINT?k.IS+"~":k.IS;return[`${s}${h}"${n[0]}"`]}if((d===x.NUMERIC||d===x.DECIMAL2)&&o===k.RANGE)return[`${s}${k.IS}"${n.join('","')}"`];if(d===x.GEO_POINT){const h=n.map(u=>{const g=u.indexOf("..");if(g===-1)return`(${u})`;const p=u.slice(0,g),f=u.slice(g);return`(${p})${f}`});return Ne(s,o+"~",h,",",c)}return Ne(s,o,n,",",c)}function Ua(t,e,s){const i=hi(t,e);return!s||i.length===0?i:i.map(a=>{const o=a.search(/[^a-zA-Z0-9_]/);if(o===-1)return`"${a}"`;const n=a.slice(0,o),d=a.slice(o).replace(/"/g,"");return`"${n}${d}"`})}function Ba(t){return t.startsWith("date_")}function qa(t){for(const e of oi)if(t.startsWith(e))return t.slice(e.length);return t}function Qs(t){return t.map(e=>e.replace(/#/g,""))}const Va=new Set([m.DATE,m.LICENSE_EXPIRY,H.DUE_DATE]);function cs(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Ha(s,i));return e}function Ha(t,e){return e.type==="string"||e.type==="date"?e:Va.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function Ga(t){const e=localStorage.getItem(ri+t),s=localStorage.getItem(ni+t);let i;try{i=e?JSON.parse(e):[...Hs]}catch{i=[...Hs]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Ka(t,e){localStorage.setItem(ri+t,JSON.stringify(e))}function Qa(t,e){localStorage.setItem(ni+t,JSON.stringify(e))}const ui="sort-by",fi="sort-order";function Ys(t,e){try{localStorage.setItem(ui,t),localStorage.setItem(fi,e)}catch{}}function Ya(){try{const t=localStorage.getItem(ui),e=localStorage.getItem(fi);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const gi="ap-last-folder",vi="ap-last-view",mi="ap-last-tab";function rt(t,e){return e?`${t}:${e}`:t}function Ws(t,e){try{localStorage.setItem(rt(gi,e),t)}catch{}}function Wa(t){try{return localStorage.getItem(rt(gi,t))}catch{return null}}function Xa(t,e){try{localStorage.setItem(rt(vi,e),t)}catch{}}function Za(t){try{return localStorage.getItem(rt(vi,t))}catch{return null}}function Ja(t,e){try{localStorage.setItem(rt(mi,e),t)}catch{}}function eo(t){try{const e=localStorage.getItem(rt(mi,t));return e==="assets"||e==="folders"||e==="labels"||e==="collections"?e:null}catch{return null}}function to(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,o=parseInt(s.slice(4,6),16)/255;return[i,a,o]}function os(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function so(t,e,s){const i=os(t),a=os(e),o=os(s),n=.4122214708*i+.5363325363*a+.0514459929*o,c=.2119034982*i+.6806995451*a+.1073969566*o,d=.0883024619*i+.2817188376*a+.6299787005*o,h=Math.cbrt(n),u=Math.cbrt(c),g=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*g,f=1.9779984951*h-2.428592205*u+.4505937099*g,v=.0259040371*h+.7827717662*u-.808675766*g,b=Math.sqrt(f*f+v*v);let _=Math.atan2(v,f)*(180/Math.PI);return _<0&&(_+=360),[p,b,_]}function io(t){return t>.7}function ao(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const g of s)t.style.removeProperty(g);return}const[i,a,o]=to(e),[n,c,d]=so(i,a,o),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=io(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const gs=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],oo=[{value:"relevance",label:"Relevance"},...gs],ro=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}],no=[{value:"name",label:"Name"}],lo=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"updated_at",label:"Modified"}],co=[{value:"name",label:"Name"}];var po=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,vs=(t,e,s,i)=>{for(var a=i>1?void 0:i?ho(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&po(e,s,a),a};let pt=class extends r.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return r.html`
|
|
1
|
+
"use strict";var ki=Object.create;var Bs=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Ci=Object.getOwnPropertyNames;var Fi=Object.getPrototypeOf,Ei=Object.prototype.hasOwnProperty;var Ai=(t,e,s,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ci(e))!Ei.call(t,a)&&a!==s&&Bs(t,a,{get:()=>e[a],enumerable:!(i=Si(e,a))||i.enumerable});return t};var Ti=(t,e,s)=>(s=t!=null?ki(Fi(t)):{},Ai(e||!t||!t.__esModule?Bs(s,"default",{value:t,enumerable:!0}):s,t));const r=require("lit"),l=require("lit/decorators.js");class Li{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(i=>i(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const i=this._pendingState;this._pendingState=null,this.setState(i)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Oi(){return new Li({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",isAISearchActive:!1,sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],activeLabelUuid:null,collections:[],activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},fileTypes:[],metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1})}class Mi{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}function Ii(t){return"extension"in t&&!("path"in t)}class Pi{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}get _folderSelectionEnabled(){var e;return((e=this.store.getState().config)==null?void 0:e.folderSelection)===!0}_getCombinedList(){const e=this.store.getState();return this._folderSelectionEnabled?[...e.folders,...e.assets]:e.assets}_applyRangeSelection(e,s,i,a){const o=this._getCombinedList();for(let n=e;n<=s;n++){const c=o[n];c&&(Ii(c)?i.set(c.uuid,c):a.set(c.uuid,c))}}handleSelect(e,s,i){var c,d,h,u;const a=this.store.getState(),o=new Map(a.selectedAssets);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0)if(this._folderSelectionEnabled){const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=new Map(a.selectedFolders);this._applyRangeSelection(f,p,o,g);const m=(d=a.config)==null?void 0:d.maxSelections;if(m&&o.size+g.size>m)return;this.store.setState({selectedAssets:o,selectedFolders:g})}else{const f=Math.min(this.lastClickedIndex,s),p=Math.max(this.lastClickedIndex,s),g=a.assets;for(let _=f;_<=p;_++)g[_]&&o.set(g[_].uuid,g[_]);const m=(h=a.config)==null?void 0:h.maxSelections;if(m&&o.size>m)return;this.store.setState({selectedAssets:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const f=(u=a.config)==null?void 0:u.maxSelections,p=o.size+(this._folderSelectionEnabled?a.selectedFolders.size:0);if(f&&p>f)return;this.store.setState({selectedAssets:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedAssets:o,selectedFolders:new Map});this.lastClickedIndex=s}handleFolderSelect(e,s,i){var c,d,h;if(!this._folderSelectionEnabled)return;const a=this.store.getState(),o=new Map(a.selectedFolders);if(!(((c=a.config)==null?void 0:c.multiSelect)??!0)){o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map}),this.lastClickedIndex=s;return}if(i.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=new Map(a.selectedAssets);this._applyRangeSelection(u,f,p,o);const g=(d=a.config)==null?void 0:d.maxSelections;if(g&&p.size+o.size>g)return;this.store.setState({selectedAssets:p,selectedFolders:o})}else if(i.metaKey||i.ctrlKey){o.has(e.uuid)?o.delete(e.uuid):o.set(e.uuid,e);const u=(h=a.config)==null?void 0:h.maxSelections,f=o.size+a.selectedAssets.size;if(u&&f>u)return;this.store.setState({selectedFolders:o})}else o.clear(),o.set(e.uuid,e),this.store.setState({selectedFolders:o,selectedAssets:new Map});this.lastClickedIndex=s}isSelected(e){return this.store.getState().selectedAssets.has(e)}isFolderSelected(e){return this.store.getState().selectedFolders.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var c;const s=this.store.getState(),i=(c=s.config)==null?void 0:c.maxSelections,a=this._folderSelectionEnabled?s.selectedFolders.size:0,o=new Map,n=i?Math.max(0,Math.min(e.length,i-a)):e.length;for(let d=0;d<n;d++)o.set(e[d].uuid,e[d]);return this.store.setState({selectedAssets:o}),this.lastClickedIndex=-1,o.size}selectAllFolders(e){var n;if(!this._folderSelectionEnabled)return;const s=this.store.getState(),i=(n=s.config)==null?void 0:n.maxSelections,a=new Map,o=i?Math.max(0,Math.min(e.length,i-s.selectedAssets.size)):e.length;for(let c=0;c<o;c++)a.set(e[c].uuid,e[c]);this.store.setState({selectedFolders:a})}clearSelection(){this.store.setState({selectedAssets:new Map,selectedFolders:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}getSelectedFolders(){return Array.from(this.store.getState().selectedFolders.values())}}class Di{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(i=>{var a;(a=i[0])!=null&&a.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const qs=5,Je=40,Vs=15;class zi{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this.preMarqueeFolderSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=i=>this.onMouseDown(i),this.handleMouseMove=i=>this.onMouseMove(i),this.handleMouseUp=()=>this.onMouseUp(),this.preventSelect=i=>i.preventDefault(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(i=>{if(!(i instanceof HTMLElement))return!1;if(i instanceof HTMLButtonElement||i instanceof HTMLInputElement)return!0;const a=i.tagName.toLowerCase();return!!(a.startsWith("ap-asset-")||a.startsWith("ap-folder-")||i.classList.contains("check")||i.classList.contains("check-box"))})}onMouseDown(e){var a;if(e.button!==0||this.isInteractiveTarget(e)||!(((a=this.store.getState().config)==null?void 0:a.multiSelect)??!0))return;const i=this.container.getBoundingClientRect();this.startX=e.clientX-i.left+this.container.scrollLeft,this.startY=e.clientY-i.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){var s;if(this.container){if(!this._dragging){const i=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(i<qs&&a<qs)return;this._dragging=!0,this.isActive=!0,document.addEventListener("selectstart",this.preventSelect),(s=window.getSelection())==null||s.removeAllRanges(),this.preMarqueeSelection=new Map(this.store.getState().selectedAssets),this.preMarqueeFolderSelection=new Map(this.store.getState().selectedFolders)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),i=e.clientX-s.left+this.container.scrollLeft,a=e.clientY-s.top+this.container.scrollTop;let o=Math.min(this.startX,i),n=Math.min(this.startY,a),c=Math.abs(i-this.startX),d=Math.abs(a-this.startY);const h=this.container.scrollWidth,u=this.container.scrollHeight;o+c>h&&(c=h-o),n+d>u&&(d=u-n),o<0&&(c+=o,o=0),n<0&&(d+=n,n=0),this.rect={x:o,y:n,width:c,height:d},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;if(this.container.scrollHeight<=this.container.clientHeight){this.stopAutoScroll();return}const s=this.container.getBoundingClientRect(),i=e.clientY-s.top,a=s.bottom-e.clientY,o=i<Je||a<Je;o&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):o||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent||this.container.scrollHeight<=this.container.clientHeight)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,i=s.clientY-e.top,a=e.bottom-s.clientY;let o=0;i<Je?o=-Vs*(1-i/Je):a<Je&&(o=Vs*(1-a/Je)),o!==0&&(this.container.scrollTop+=o,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("selectstart",this.preventSelect),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}querySelectableElements(){const e=[],s=[];for(const i of Array.from(this.container.children))if(i.shadowRoot){const a=i.shadowRoot.querySelectorAll("[data-asset-uuid]");a.length>0&&e.push(...Array.from(a));const o=i.shadowRoot.querySelectorAll("[data-folder-uuid]");o.length>0&&s.push(...Array.from(o))}return e.length===0&&e.push(...Array.from(this.container.querySelectorAll("[data-asset-uuid]"))),s.length===0&&s.push(...Array.from(this.container.querySelectorAll("[data-folder-uuid]"))),{assetCards:e,folderCards:s}}getCardRelativeRect(e){const s=e.getBoundingClientRect(),i=this.container.getBoundingClientRect();return{x:s.left-i.left+this.container.scrollLeft,y:s.top-i.top+this.container.scrollTop,width:s.width,height:s.height}}intersectsMarquee(e){return this.rect.x<e.x+e.width&&this.rect.x+this.rect.width>e.x&&this.rect.y<e.y+e.height&&this.rect.y+this.rect.height>e.y}selectIntersecting(){var h,u;if(!this.container)return;const e=this.store.getState(),s=((h=e.config)==null?void 0:h.folderSelection)===!0,{assetCards:i,folderCards:a}=this.querySelectableElements(),o=new Map(this.preMarqueeSelection),n=s?new Map(this.preMarqueeFolderSelection):e.selectedFolders;i.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.assetUuid;if(this.intersectsMarquee(p)){const m=e.assets.find(_=>_.uuid===g);m&&o.set(g,m)}}),s&&a.forEach(f=>{const p=this.getCardRelativeRect(f),g=f.dataset.folderUuid;if(this.intersectsMarquee(p)){const m=e.folders.find(_=>_.uuid===g);m&&n.set(g,m)}});const c=(u=e.config)==null?void 0:u.maxSelections,d=o.size+(s?n.size:0);if(c&&d>c){const f=Array.from(o.entries()).slice(0,Math.max(0,c-n.size));this.store.setState({selectedAssets:new Map(f),...s?{selectedFolders:n}:{}})}else this.store.setState({selectedAssets:o,...s?{selectedFolders:n}:{}})}}class Ri{constructor(e,s){this.auth=e;const i=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${i}/v5`,e.mode==="sassKey"&&(this.sassKey=e.sassKey)}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}_applyAuthHeaders(e){this.sassKey?e["X-Filerobot-Key"]=this.sassKey:this.auth.mode==="securityTemplate"&&(e["X-Filerobot-Key"]=this.auth.securityTemplateKey)}async request(e,s){const i=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([c,d])=>{d!=null&&(Array.isArray(d)?i.searchParams.set(c,d.join(",")):i.searchParams.set(c,String(d)))});const a={};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{headers:a,signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const i=new URL(`${this.baseUrl}${e}`),a={"Content-Type":"application/json"};this._applyAuthHeaders(a);const o=new AbortController,n=setTimeout(()=>o.abort(),3e4);try{const c=await fetch(i.toString(),{method:"POST",headers:a,body:JSON.stringify(s),signal:o.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function ji(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",i=t.sort_direction??"desc",a={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${a[s]||s}:${i}`,t.folder&&(e.folder=t.folder);const o=[];return t.search&&!t.with_ai&&o.push(t.search),t.q&&o.push(t.q),o.length>0&&(e.q=o.join(" ")),t.with_ai&&(e.with_ai=!0,t.ai_query&&(e.ai_query=t.ai_query),t.ai_lang&&(e.ai_lang=t.ai_lang)),t.collection_uuid&&(e.collection_uuid=t.collection_uuid),t.f64&&(e.f64=t.f64),e}async function De(t,e){const s=ji(e);return t.request("/files",s)}async function At(t,e){const s={recursive:e.recursive??1};e.folder&&(s.folder=e.folder);const i=[];return e.search&&!e.with_ai&&i.push(e.search),e.q&&i.push(e.q),i.length>0&&(s.q=i.join(" ")),e.with_ai&&(s.with_ai=!0,e.ai_query&&(s.ai_query=e.ai_query),e.ai_lang&&(s.ai_lang=e.ai_lang)),e.collection_uuid&&(s.collection_uuid=e.collection_uuid),e.f64&&(s.f64=e.f64),t.request("/files/stats",s)}async function Ni(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const i=(e==null?void 0:e.sort_by)??"created_at",a=(e==null?void 0:e.sort_direction)??"asc",o={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${o[i]||i}:${a}`,await t.request("/folders",s)}async function Ui(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Bi(t){return await t.request("/labels")}async function qi(t){return t.request("/collections")}async function Vi(t,e){return t.request(`/collections/${e}/folders`)}function ei(t){return t.filter(e=>!!e.name).map(e=>({...e,children:ei(e.children??[])})).filter(e=>{var s;return!((((s=e.children)==null?void 0:s.length)??0)<1&&!e.filters)})}async function Hi(t){return((await t.request("/tags")).tags||[]).map(i=>({...i,label:i.names.en||Object.values(i.names)[0]||""})).filter(i=>i.label).sort((i,a)=>i.label.localeCompare(a.label))}async function Gi(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}function Vt(t){var a,o;const e=(a=t.info)==null?void 0:a.playlists;if(!(e!=null&&e.length))return null;const s=(o=e[0])==null?void 0:o.playlists;return s!=null&&s.length&&s[0]||null}function je(t){return(t.type??"").startsWith("image")}function Ki(t){return(t.type??"").startsWith("video")}function Qi(t){return(t.type??"").startsWith("audio")}function ti(t){var e,s;return((e=t.url)==null?void 0:e.cdn)??((s=t.url)==null?void 0:s.public)??""}function Yi(t,e){const{meta:s,name:i}=t;if(s!=null&&s.alt)return s.alt;const a=s==null?void 0:s.title;if(typeof a=="string"&&a)return a;if(a&&typeof a=="object"){if(e){const n=a[e];if(n)return n}const o=Object.keys(a)[0];if(o){const n=a[o];if(n)return n}}return i.split(".")[0]}function Pt(t){var e,s;return((e=t.info)==null?void 0:e.img_w)??((s=t.info)==null?void 0:s.video_w)??0}function Dt(t){var e,s;return((e=t.info)==null?void 0:e.img_h)??((s=t.info)==null?void 0:s.video_h)??0}function Wi(t){return{width:Pt(t),height:Dt(t)}}function Xi(t){return Vt(t)!==null}function Zi(t){return Vt(t)}function Ji(t){return Vt(t)??ti(t)}const ea={excellent:90,good:75,fair:60},ta=[{label:"WEBP",value:"webp"},{label:"JPEG",value:"jpeg"},{label:"PNG",value:"png"},{label:"GIF",value:"gif"}],sa=[{label:"Excellent",value:"excellent"},{label:"Good",value:"good"},{label:"Fair",value:"fair"}],ia=[{label:"Original",value:"original"},{label:"Full HD",value:"full_hd",width:1920},{label:"Large",value:"large",width:1200},{label:"Medium",value:"medium",width:600},{label:"Small",value:"small",width:300}],aa={webp:"awebp,webp",jpeg:"jpeg",png:"png",gif:"agif,gif"},oa=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"]),ra=new Set([...oa,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function tt(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function si(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return ra.has(e)}const v="https://scaleflex.cloudimg.io/v7/assets/file-types/v3/",cs={_default:v+"GENERIC.svg?vh=9a518a",png:v+"PNG.svg?vh=96cd9a",jpg:v+"JPG.svg?vh=06e819",jpg2:v+"JPG2.svg?vh=f0eb7f",jpeg:v+"JPEG.svg?vh=6a65e9",gif:v+"GIF.svg?vh=c3c2c3",bmp:v+"BMP.svg?vh=d2243a",webp:v+"WEBP.svg?vh=fedd74",svg:v+"SVG.svg?vh=a15e46",tiff:v+"TIFF.svg?vh=1f30c3",tif:v+"TIF.svg?vh=b383c9",heic:v+"HEIC.svg?vh=84adfe",avif:v+"AVIF.svg?vh=536b30",ico:v+"ICO.svg?vh=79063d",psd:v+"PSD.svg?vh=be6140",psb:v+"PSB.svg?vh=678646",ai:v+"AI.svg?vh=84b254",dwg:v+"DWG.svg?vh=971fb3",mp4:v+"MP4.svg?vh=42f175",webm:v+"WEBM.svg?vh=26a84a",avi:v+"AVI.svg?vh=d22ba8",mpeg:v+"MPEG.svg?vh=ba93bb",ogv:v+"OGV.svg?vh=74d453","3gp":v+"3GP.svg?vh=f0d388","3g2":v+"3G2.svg?vh=04c652",swf:v+"SWF.svg?vh=3955e2",fla:v+"FLA.svg?vh=daf585",m3u8:v+"M3U8.svg?vh=7d5e62",mp3:v+"MP3.svg?vh=66bbef",wav:v+"WAV.svg?vh=d7a7d5",aac:v+"AAC.svg?vh=07f3f9",oga:v+"OGA.svg?vh=a5c622",opus:v+"OPUS.svg?vh=9548b1",weba:v+"WEBA.svg?vh=4dcf70",mid:v+"MID.svg?vh=3f0e29",midi:v+"MIDI.svg?vh=9fedec",cda:v+"CDA.svg?vh=85b83b",pdf:v+"PDF.svg?vh=18c5f7",doc:v+"DOC.svg?vh=d1b47c",docx:v+"DOCX.svg?vh=1eb6b0",txt:v+"TXT.svg?vh=307979",rtf:v+"RTF.svg?vh=978c5f",xls:v+"XLS.svg?vh=13b5f7",xlsx:v+"XLSX.svg?vh=79d64a",ppt:v+"PPT.svg?vh=4ee29b",pptx:v+"PPTX.svg?vh=8b1568",csv:v+"CSV.svg?vh=4add78",odt:v+"ODT.svg?vh=940781",ods:v+"ODS.svg?vh=9fbe9a",odp:v+"ODP.svg?vh=bf892d",dbf:v+"DBF.svg?vh=457bd4",vsd:v+"VSD.svg?vh=8a9ccb",abw:v+"ABW.svg?vh=313dc7",epub:v+"EPUB.svg?vh=15263d",azw:v+"AZW.svg?vh=a018b1",ics:v+"ICS.svg?vh=909f63",ogx:v+"OGX.svg?vh=f694d2",zip:v+"ZIP.svg?vh=84f98b",rar:v+"RAR.svg?vh=1d6423","7z":v+"7Z.svg?vh=e007e5",tar:v+"TAR.svg?vh=603aed",gz:v+"GZ.svg?vh=de13f7",bz:v+"BZ.svg?vh=0374ff",bz2:v+"BZ2.svg?vh=e14294",arc:v+"ARC.svg?vh=942fad",jar:v+"JAR.svg?vh=149796",mpkg:v+"MPKG.svg?vh=dea655",ttf:v+"TTF.svg?vh=d2e2c1",otf:v+"OTF.svg?vh=c904fd",woff:v+"WOFF.svg?vh=4b8177",woff2:v+"WOFF2.svg?vh=b532d3",eot:v+"EOT.svg?vh=a54980",js:v+"JS.svg?vh=524691",mjs:v+"MJS.svg?vh=d57921",ts:v+"TS.svg?vh=9af3ae",css:v+"CSS.svg?vh=287863",html:v+"HTML.svg?vh=fa7a87",htm:v+"HTM.svg?vh=21323d",xhtml:v+"XHTML.svg?vh=e6d6a9",xul:v+"XUL.svg?vh=6c9c71",json:v+"JSON.svg?vh=104c9e",jsonld:v+"JSONLD.svg?vh=f30c0f",xml:v+"XML.svg?vh=7f7194",php:v+"PHP.svg?vh=503e36",sh:v+"SH.svg?vh=3b820e",csh:v+"CSH.svg?vh=08c0cc",exe:v+"EXE.svg?vh=ccca53",iso:v+"ISO.svg?vh=064b8f",bin:v+"BIN.svg?vh=1e9618"};function $t(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return cs[e]||cs._default}function st(){return cs._default}function Ht(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const na=new Set(["png","svg","webp","gif","avif"]);function us(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return na.has(e)}const la=new Set(["svg","svg+xml","png","pdf"]);function ii(t){return la.has(Ht(t).toLowerCase())}function zt(t){var i;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((i=t.url)==null?void 0:i.cdn)||"";return Be(s)}function ai(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?Be(s):""}function gs(t){var s,i;let e=Be(((s=t.url)==null?void 0:s.cdn)||((i=t.url)==null?void 0:i.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),xe(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function xe(t,e){try{const s=new URL(t);for(const[i,a]of Object.entries(e))s.searchParams.set(i,a);return s.toString()}catch{return t}}const Hs=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Be(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(Hs);if(s){const i=s[2];return t.replace(Hs,`$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 oi(t,e){const s=t.file_uri_cdn;if(!s)return"";let i=Be(s);const a=tt(t.file_type),o=String(window.devicePixelRatio||1);return a==="video"?xe(i,{w:e,dpr:o,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||Ht(t.file_type).toLowerCase()==="pdf"?(i=i.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),xe(i,{w:e,dpr:o,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):xe(i,{w:e,dpr:o})}function fs(t,e){const s={};return t.format&&(s.force_format=aa[t.format]),t.quality&&t.format!=="png"&&(s.q=String(ea[t.quality])),t.width&&(s.w=String(t.width)),t.height&&(s.h=String(t.height)),(t.width||t.height)&&(s.org_if_sml="1",e!=null&&e.isMultiSelect?s.func="bound":(e==null?void 0:e.isAspectLocked)===!1&&(s.func="cover")),s}function ca(t,e,s){const i=Be(t);if(!i)return t;const a=fs(e,s);return Object.keys(a).length>0?xe(i,a):i}const b={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},G={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},S={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},da={AND:"AND"},w={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},Gt={[w.DATE]:"date_",[w.BOOLEAN]:"bool_",[w.NUMERIC]:"num_",[w.DECIMAL2]:"dec_",[w.ATTACHMENTS_ASSETS]:"attach_",[w.ATTACHMENT_URI]:"uri_",[w.SELECT_ONE]:"one_",[w.MULTI_SELECT]:"multi_",[w.SUPERTAGS]:"tags_",[w.TEXT]:"text_",[w.TEXT_AREA]:"area_",[w.GEO_POINT]:"geo_",[w.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(Gt).map(([t,e])=>[e,t]));const ri=Object.values(Gt),pt={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Gs={EMPTY:"empty",NOT_EMPTY:"non-empty"},re="empty",ne="non-empty",ze="specific",Jt=10,es=10,Tt=10,ni="filters:pinned:",li="metadata:pinned:",Ks=[b.DATE,b.TYPE,b.SIZE],ci=S.IS,Ot="20",Mt="1",pa=0,ha=[{key:b.DATE,label:"Date",icon:"calendar",type:"date"},{key:b.TYPE,label:"Format",icon:"file-type",type:"string"},{key:b.SIZE,label:"Size",icon:"scaling",type:"string"},{key:b.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:b.TAGS,label:"Tags",icon:"hash",type:"string"},{key:b.LABELS,label:"Labels",icon:"tag",type:"string"},{key:b.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:b.IMAGE,label:"Image",icon:"image",type:"string"},{key:b.COLOR,label:"Color",icon:"swatch-book",type:"string"}],ua={key:b.METADATA,label:"Metadata",icon:"file-text",type:"string"},ga={key:b.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},ds=[ua,...ha,ga],et={[b.TYPE]:"Format",[b.DATE]:"Date",[b.SIZE]:"Size",[b.LICENSE_EXPIRY]:"License expiry",[b.TAGS]:"Tags",[b.LABELS]:"Labels",[b.PRODUCT_REF]:"Products",[b.IMAGE]:"Image",[b.COLOR]:"Color",[b.METADATA]:"Metadata",[b.APPROVAL]:"Approval"},K={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},Rt=[{value:K.IMAGE,label:"Image",icon:"image"},{value:K.VIDEO,label:"Video",icon:"clapperboard"},{value:K.AUDIO,label:"Audio",icon:"music"},{value:K.DOCUMENT,label:"Document",icon:"document"},{value:K.ARCHIVE,label:"Archive",icon:"archive"},{value:K.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:K.FONTS,label:"Fonts",icon:"text"},{value:K.OTHER,label:"Other",icon:"layout-grid"}],fa={[K.IMAGE]:["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif","psd","eps"],[K.VIDEO]:["mp4","webm","ogg","mov","avi","mkv","flv","wmv","m4v"],[K.AUDIO]:["mp3","wav","ogg","flac","aac","wma","m4a","opus"],[K.DOCUMENT]:["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","csv","rtf","odt","ods","odp","html"],[K.ARCHIVE]:["zip","rar","7z","tar","gz","bz2","xz"],[K.FONTS]:["ttf","otf","woff","woff2","eot"]},ts={RESOLUTION:0,ORIENTATION:1,FACES:2},va=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],ma=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],ba=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],di=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],vs=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],pi=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],_a=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],ya=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],xa=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],ss=[{label:"Is",value:S.IS},{label:"Contains",value:S.CONTAINS_IN_TEXT}],ye=[{label:"Is",value:S.IS},{label:"Is not",value:S.IS_NOT}],is=[{label:"Is",value:S.IS_EXACT},{label:"Contains",value:S.IS},{label:"Does not contain",value:S.IS_NOT}],as=[{label:"Is",value:S.IS},{label:"Greater than",value:S.GREATER_THAN_OR_EQUAL},{label:"Is not",value:S.IS_NOT},{label:"Less than",value:S.LESS_THAN_OR_EQUAL},{label:"Between",value:S.RANGE}],wa=[{label:"Is",value:S.IS_EXACT},{label:"Is not",value:S.IS_NOT}],Qs=[{label:"Contains",value:S.CONTAINS},{label:"Does not contain",value:S.IS_NOT}],$a=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],Ne=[{label:"Empty",value:re},{label:"Not empty",value:ne}],os=[...Ne,{label:"Specific",value:ze}],ka=[{label:"Empty",value:re},{label:"Not empty",value:ne},{label:"True",value:"true"},{label:"False",value:"false"}],It={[w.DATE]:"calendar",[w.BOOLEAN]:"toggle-left",[w.NUMERIC]:"file-digit",[w.DECIMAL2]:"decimals-arrow-right",[w.ATTACHMENTS_ASSETS]:"paperclip",[w.ATTACHMENT_URI]:"link-2",[w.SELECT_ONE]:"circle-dot",[w.MULTI_SELECT]:"square-check",[w.SUPERTAGS]:"hash",[w.TEXT]:"text-initial",[w.TEXT_AREA]:"text-align-justify",[w.GEO_POINT]:"locate",[w.INTEGER_LIST]:"list-ordered"},Sa={[w.TEXT]:"text",[w.TEXT_AREA]:"text",[w.NUMERIC]:"number",[w.DECIMAL2]:"number",[w.BOOLEAN]:"boolean",[w.SELECT_ONE]:"select-one",[w.MULTI_SELECT]:"multi-select",[w.SUPERTAGS]:"tags",[w.DATE]:"date",[w.GEO_POINT]:"geo",[w.ATTACHMENTS_ASSETS]:"attachment",[w.ATTACHMENT_URI]:"attachment",[w.INTEGER_LIST]:"attachment"};async function Ca(t){var i;return(((i=(await t.request("/filters",{filter_by:"filetype",format:"list",limit:200})).filters)==null?void 0:i.file_types)??[]).map(a=>({name:a.name,value:a.value,count:a.count,category:a.category??a.value.split("_")[0],label:Fa(a.name)}))}function Fa(t){const e=t.indexOf("›");return(e!==-1?t.slice(e+1).trim():t).toUpperCase()}async function Ea(t){var m,_;const e=await t.request("/settings"),s=e.settings??e,i=(s==null?void 0:s.metadata)??e.metadata,o=((i==null?void 0:i.model)??[])[pa],n=i==null?void 0:i.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map(y=>({uuid:y.uuid,label:y.label??y.name??"",variants:(y.variants??[]).map(C=>({api_value:C.api_value??C.value??"",internal_unique_value:C.internal_unique_value??C.api_value??"",label:C.label??C.name??""}))})).filter(y=>y.variants.length>1),h={};for(const y of d)h[y.uuid]=((m=y.variants[0])==null?void 0:m.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(!o)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=o.groups??[],g=[];for(const y of p){const C=y.name||"Root fields";for(const x of y.fields??[]){const M=x.possible_values,$=M==null?void 0:M.map(k=>({api_value:k.api_value??k.value??"",internal_unique_value:k.internal_unique_value??k.api_value??"",label:k.label??k.name??k.api_value??""}));g.push({key:x.key??x.ckey,label:x.title??x.label??x.key??"",type:x.type??"text",slug:x.slug,ckey:x.ckey,possible_values:$,group:C,regionalVariantsGroupUuid:x.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function Re(t){return t.toLocaleDateString("en-CA")}function Lt(){return Re(new Date)}function hi(t){const e=new Date;switch(t){case"today":return{from:Lt(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:Re(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:Lt(),to:Re(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:Re(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:Lt(),to:Re(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:Re(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:Lt(),to:Re(s)}}default:return null}}function Ys(t,e){return e?e.type==="date"?Aa(e):e.type==="string"?Ta(e):!0:!1}function Aa(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function Ta(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function La(t,e={}){const s=[];for(const[i,a]of Object.entries(t)){if(!a||!Ys(i,a))continue;const o=Ma(i,a);s.push(...o)}for(const[i,a]of Object.entries(e)){if(!a||!Ys(i,a))continue;const o=Na(i,a);s.push(...o)}return Oa(s)}function Oa(t){const e=[],s=[],i=[];for(const a of t)a.startsWith("type:")||a.startsWith("type=")?e.push(a):a.startsWith("mimetype:")||a.startsWith("mimetype=")?s.push(a):i.push(a);if(e.length>0&&s.length>0){const a=[...e,...s].join(" , ");i.push(a)}else i.push(...e,...s);return i}function Ma(t,e){if(e.type==="date")return ui(t,e);if(t===b.IMAGE)return ja(e);const s=e,{operator:i=ci,values:a=[],logic:o}=s;if(a.length===0)return[];switch(t){case b.SIZE:return Ia(t,a,"..");case b.FACES:return Pa(t,i,a);case b.TAGS:return Ue(t,i,Ws(a),",",o);case b.LABELS:return Ue(t,i,Ws(a),",",o);case b.COLOR:return Da(i,a,o);case b.TYPE:return za(a,i);case b.MIME_TYPE:return Ra(t,a,i);case b.PRODUCT_REF:return Ue(t,"=%",a,",",o);default:return Ue(t,i,a,",",o)}}function ui(t,e){const s=e.field||"created";if(e.kind===pt.PRESET&&e.preset){if(e.preset===Gs.EMPTY)return[`${s}:"empty"`];if(e.preset===Gs.NOT_EMPTY)return[`${s}:"non-empty"`];const i=hi(e.preset);return i?i.to===null?[`${s}>"${i.from}"`]:[`${s}:"${i.from}..${i.to}"`]:[]}if(e.kind===pt.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===pt.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===pt.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===pt.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function Ia(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function Pa(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function Ue(t,e,s,i,a){if(s.length===0)return[];if(a===da.AND)return s.map(n=>`${t}${e}"${n}"`);const o=s.map(n=>`"${n}"`).join(i);return[`${t}${e}${o}`]}function Da(t,e,s){const i=[],a=Ue("color_search",t,e,",",s);return i.push(...a),i.push('color_operator:"AND"'),i}function za(t,e){if(t.length===0)return[];const s=new Set,i=[];for(const o of t){const n=fa[o];if(n)for(const c of n){const d=`${o}_${c}`;s.has(d)||(s.add(d),i.push(d))}else s.has(o)||(s.add(o),i.push(o))}const a=i.map(o=>`"${o}"`).join(",");return[`type${e}${a}`]}function Ra(t,e,s,i){if(e.length===0)return[];const a=e.map(o=>`"${o}"`).join(",");return[`${t}${s}${a}`]}function ja(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,c=n.resolution,d=n.orientation,h=n.faces;return c!=null&&c.length&&e.push(`resolution:"${c.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,i=s[ts.RESOLUTION],a=s[ts.ORIENTATION],o=s[ts.FACES];return i&&e.push(`resolution:"${i}"`),a&&e.push(`orientation:"${a}"`),o&&e.push(`faces:"${o}"`),e}function Na(t,e){const s=qa(t),i=Ba(t);if(e.type==="date")return Ua(s,e,i);const a=e,{operator:o=ci,values:n=[],logic:c,metadataType:d}=a;if(n.length===0)return[];if(n.length===1&&(n[0]===re||n[0]===ne)){const h=d===w.GEO_POINT?S.IS+"~":S.IS;return[`${s}${h}"${n[0]}"`]}if((d===w.NUMERIC||d===w.DECIMAL2)&&o===S.RANGE)return[`${s}${S.IS}"${n.join('","')}"`];if(d===w.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 Ue(s,o+"~",h,",",c)}return Ue(s,o,n,",",c)}function Ua(t,e,s){const i=ui(t,e);return!s||i.length===0?i:i.map(a=>{const o=a.search(/[^a-zA-Z0-9_]/);if(o===-1)return`"${a}"`;const n=a.slice(0,o),d=a.slice(o).replace(/"/g,"");return`"${n}${d}"`})}function Ba(t){return t.startsWith("date_")}function qa(t){for(const e of ri)if(t.startsWith(e))return t.slice(e.length);return t}function Ws(t){return t.map(e=>e.replace(/#/g,""))}const Va=new Set([b.DATE,b.LICENSE_EXPIRY,G.DUE_DATE]);function ps(t){if(!t)return{};const e={};for(const[s,i]of Object.entries(t))i&&(e[s]=Ha(s,i));return e}function Ha(t,e){return e.type==="string"||e.type==="date"?e:Va.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function Ga(t){const e=localStorage.getItem(ni+t),s=localStorage.getItem(li+t);let i;try{i=e?JSON.parse(e):[...Ks]}catch{i=[...Ks]}let a;try{a=s?JSON.parse(s):[]}catch{a=[]}return{pinnedFilters:i,pinnedMetadata:a}}function Ka(t,e){localStorage.setItem(ni+t,JSON.stringify(e))}function Qa(t,e){localStorage.setItem(li+t,JSON.stringify(e))}const gi="sort-by",fi="sort-order";function Xs(t,e){try{localStorage.setItem(gi,t),localStorage.setItem(fi,e)}catch{}}function Ya(){try{const t=localStorage.getItem(gi),e=localStorage.getItem(fi);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const vi="ap-last-folder",mi="ap-last-view",bi="ap-last-tab";function nt(t,e){return e?`${t}:${e}`:t}function Zs(t,e){try{localStorage.setItem(nt(vi,e),t)}catch{}}function Wa(t){try{return localStorage.getItem(nt(vi,t))}catch{return null}}function Xa(t,e){try{localStorage.setItem(nt(mi,e),t)}catch{}}function Za(t){try{return localStorage.getItem(nt(mi,t))}catch{return null}}function Ja(t,e){try{localStorage.setItem(nt(bi,e),t)}catch{}}function eo(t){try{const e=localStorage.getItem(nt(bi,t));return e==="assets"||e==="folders"||e==="labels"||e==="collections"?e:null}catch{return null}}function to(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,i=parseInt(s.slice(0,2),16)/255,a=parseInt(s.slice(2,4),16)/255,o=parseInt(s.slice(4,6),16)/255;return[i,a,o]}function rs(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function so(t,e,s){const i=rs(t),a=rs(e),o=rs(s),n=.4122214708*i+.5363325363*a+.0514459929*o,c=.2119034982*i+.6806995451*a+.1073969566*o,d=.0883024619*i+.2817188376*a+.6299787005*o,h=Math.cbrt(n),u=Math.cbrt(c),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,m=.0259040371*h+.7827717662*u-.808675766*f,_=Math.sqrt(g*g+m*m);let y=Math.atan2(m,g)*(180/Math.PI);return y<0&&(y+=360),[p,_,y]}function io(t){return t>.7}function ao(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[i,a,o]=to(e),[n,c,d]=so(i,a,o),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=io(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const ms=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],oo=[{value:"relevance",label:"Relevance"},...ms],ro=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}],no=[{value:"name",label:"Name"}],lo=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"updated_at",label:"Modified"}],co=[{value:"name",label:"Name"}];var po=Object.defineProperty,ho=Object.getOwnPropertyDescriptor,bs=(t,e,s,i)=>{for(var a=i>1?void 0:i?ho(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&po(e,s,a),a};let ht=class extends r.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return r.html`
|
|
2
2
|
<dialog
|
|
3
3
|
@click=${this._handleBackdropClick}
|
|
4
4
|
@cancel=${this._handleCancel}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
</div>
|
|
16
16
|
</div>
|
|
17
17
|
</dialog>
|
|
18
|
-
`}};
|
|
18
|
+
`}};ht.styles=r.css`
|
|
19
19
|
:host {
|
|
20
20
|
display: contents;
|
|
21
21
|
}
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
animation: none;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
`;
|
|
91
|
+
`;bs([l.property({type:Boolean})],ht.prototype,"open",2);bs([l.query("dialog")],ht.prototype,"dialog",2);ht=bs([l.customElement("ap-modal")],ht);function uo(t,e){let s;const i=((...a)=>{clearTimeout(s),s=setTimeout(()=>t(...a),e)});return i.cancel=()=>clearTimeout(s),i}const Y=r.css`
|
|
92
92
|
*, *::before, *::after {
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
}
|
|
95
|
-
`;var
|
|
95
|
+
`;var go=Object.defineProperty,fo=Object.getOwnPropertyDescriptor,Kt=(t,e,s,i)=>{for(var a=i>1?void 0:i?fo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&go(e,s,a),a};let it=class extends r.LitElement{constructor(){super(...arguments),this.groups=[],this.selectedFilters={},this._open=!1,this._handleOutsideClick=t=>{this._open&&!t.composedPath().includes(this)&&(this._open=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}_selectVariant(t,e){this.dispatchEvent(new CustomEvent("regional-change",{detail:{groupUuid:t,value:e},bubbles:!0,composed:!0}))}render(){const t=this.groups.length>0;return r.html`
|
|
96
96
|
<button
|
|
97
97
|
class="trigger ${this._open?"active":""}"
|
|
98
98
|
@click=${()=>this._open=!this._open}
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
</div>
|
|
124
124
|
`)}
|
|
125
125
|
</div>
|
|
126
|
-
`}};
|
|
126
|
+
`}};it.styles=r.css`
|
|
127
127
|
:host {
|
|
128
128
|
position: relative;
|
|
129
129
|
display: inline-block;
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
width: 16px;
|
|
209
209
|
flex-shrink: 0;
|
|
210
210
|
}
|
|
211
|
-
`;
|
|
211
|
+
`;Kt([l.property({type:Array})],it.prototype,"groups",2);Kt([l.property({type:Object})],it.prototype,"selectedFilters",2);Kt([l.state()],it.prototype,"_open",2);it=Kt([l.customElement("ap-regional-settings")],it);var vo=Object.defineProperty,mo=Object.getOwnPropertyDescriptor,W=(t,e,s,i)=>{for(var a=i>1?void 0:i?mo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&vo(e,s,a),a};const bo=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"},{value:"labels",label:"Labels",icon:"tag"},{value:"collections",label:"Collections",icon:"layout-grid"}];let N=class extends r.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.isInsideLabel=!1,this.isInsideCollection=!1,this.isInsideCollectionLeaf=!1,this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this.enableAISearch=!1,this.isAISearchActive=!1,this._localSearch="",this._debouncedSearch=uo(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleAISearch(){this.dispatchEvent(new CustomEvent("ai-search-toggle",{detail:{active:!this.isAISearchActive},bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=bo.filter(i=>this.tabs.includes(i.value));return((e=t.find(i=>i.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),r.html`
|
|
212
212
|
<div class="header-row">
|
|
213
213
|
${t.length>1?r.html`<ap-dropdown
|
|
214
214
|
.value=${this.activeTab}
|
|
@@ -264,7 +264,7 @@
|
|
|
264
264
|
`}
|
|
265
265
|
</div>
|
|
266
266
|
</div>
|
|
267
|
-
`}};
|
|
267
|
+
`}};N.styles=[Y,r.css`
|
|
268
268
|
:host {
|
|
269
269
|
display: block;
|
|
270
270
|
padding: 16px 20px;
|
|
@@ -415,7 +415,7 @@
|
|
|
415
415
|
height: 24px;
|
|
416
416
|
background: var(--ap-border, oklch(92.86% 0.009 247.92));
|
|
417
417
|
}
|
|
418
|
-
`];
|
|
418
|
+
`];W([l.property()],N.prototype,"activeTab",2);W([l.property({type:Array})],N.prototype,"tabs",2);W([l.property({type:Boolean})],N.prototype,"isInsideLabel",2);W([l.property({type:Boolean})],N.prototype,"isInsideCollection",2);W([l.property({type:Boolean})],N.prototype,"isInsideCollectionLeaf",2);W([l.property()],N.prototype,"viewMode",2);W([l.property()],N.prototype,"searchQuery",2);W([l.property({type:Array})],N.prototype,"regionalGroups",2);W([l.property({type:Object})],N.prototype,"regionalFilters",2);W([l.property({type:Boolean})],N.prototype,"hideClose",2);W([l.property({type:Boolean,reflect:!0,attribute:"ai-search"})],N.prototype,"enableAISearch",2);W([l.property({type:Boolean})],N.prototype,"isAISearchActive",2);W([l.state()],N.prototype,"_localSearch",2);N=W([l.customElement("ap-header")],N);var _o=Object.defineProperty,yo=Object.getOwnPropertyDescriptor,_s=(t,e,s,i)=>{for(var a=i>1?void 0:i?yo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_o(e,s,a),a};let ut=class extends r.LitElement{constructor(){super(...arguments),this.items=[],this.rootLabel="Root"}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?r.html``:r.html`
|
|
419
419
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
420
420
|
<button @click=${()=>this._navigate("")}>${this.rootLabel}</button>
|
|
421
421
|
${this.items.map((t,e)=>r.html`
|
|
@@ -423,7 +423,7 @@
|
|
|
423
423
|
${e<this.items.length-1?r.html`<button @click=${()=>this._navigate(t.uuid)}>${t.name}</button>`:r.html`<span class="current">${t.name}</span>`}
|
|
424
424
|
`)}
|
|
425
425
|
</nav>
|
|
426
|
-
`}};
|
|
426
|
+
`}};ut.styles=r.css`
|
|
427
427
|
:host {
|
|
428
428
|
display: block;
|
|
429
429
|
padding: 4px 20px 12px;
|
|
@@ -459,12 +459,12 @@
|
|
|
459
459
|
ap-icon {
|
|
460
460
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
461
461
|
}
|
|
462
|
-
`;
|
|
462
|
+
`;_s([l.property({type:Array})],ut.prototype,"items",2);_s([l.property()],ut.prototype,"rootLabel",2);ut=_s([l.customElement("ap-breadcrumb")],ut);var xo=Object.defineProperty,wo=Object.getOwnPropertyDescriptor,ys=(t,e,s,i)=>{for(var a=i>1?void 0:i?wo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xo(e,s,a),a};let gt=class extends r.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?r.html`
|
|
463
463
|
<div class="popover">
|
|
464
464
|
${this.title?r.html`<div class="title">${this.title}</div>`:""}
|
|
465
465
|
<slot></slot>
|
|
466
466
|
</div>
|
|
467
|
-
`:r.html``}};
|
|
467
|
+
`:r.html``}};gt.styles=r.css`
|
|
468
468
|
:host {
|
|
469
469
|
display: block;
|
|
470
470
|
}
|
|
@@ -489,7 +489,7 @@
|
|
|
489
489
|
color: var(--ap-foreground, oklch(0.37 0.022 248.413));
|
|
490
490
|
margin-bottom: 12px;
|
|
491
491
|
}
|
|
492
|
-
`;
|
|
492
|
+
`;ys([l.property()],gt.prototype,"title",2);ys([l.property({type:Boolean})],gt.prototype,"open",2);gt=ys([l.customElement("ap-filter-popover")],gt);var $o=Object.defineProperty,ko=Object.getOwnPropertyDescriptor,kt=(t,e,s,i)=>{for(var a=i>1?void 0:i?ko(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$o(e,s,a),a};function Js(t){var i;const e=new Map;for(const a of t){const o=a.category||a.value.split("_")[0];if(!e.has(o)){const c=Rt.find(d=>d.value===o);e.set(o,{key:o,label:(c==null?void 0:c.label)||o.charAt(0).toUpperCase()+o.slice(1),icon:(c==null?void 0:c.icon)||"file",extensions:[],totalCount:0})}const n=e.get(o);n.extensions.push({value:a.value,label:a.label||((i=a.value.split("_").pop())==null?void 0:i.toUpperCase())||a.value,count:a.count}),n.totalCount+=a.count}const s=Rt.map(a=>a.value);return[...e.values()].sort((a,o)=>{const n=s.indexOf(a.key),c=s.indexOf(o.key);return(n===-1?999:n)-(c===-1?999:c)})}let qe=class extends r.LitElement{constructor(){super(...arguments),this.selected=[],this.fileTypes=[],this._search="",this._expanded=new Set}_extValues(t){return t.extensions.map(e=>e.value)}_isGroupFullySelected(t){if(this.selected.includes(t.key))return!0;const e=this._extValues(t);return e.length>0&&e.every(s=>this.selected.includes(s))}_isGroupPartial(t){if(this.selected.includes(t.key))return!1;const e=this._extValues(t),s=e.filter(i=>this.selected.includes(i)).length;return s>0&&s<e.length}_isExtSelected(t,e){return this.selected.includes(e)||this.selected.includes(t)}_toggleGroup(t){const e=this._extValues(t),s=this._isGroupFullySelected(t);let i;if(s){const a=new Set([t.key,...e]);i=this.selected.filter(o=>!a.has(o))}else{const a=new Set(e);i=this.selected.filter(o=>!a.has(o)),i.push(t.key)}this._emit(i)}_toggleExt(t,e){const s=this._extValues(e);let i=[...this.selected];i.includes(e.key)&&(i=i.filter(a=>a!==e.key),i.push(...s)),i.includes(t)?i=i.filter(a=>a!==t):(i.push(t),s.every(a=>i.includes(a))&&(i=i.filter(a=>!s.includes(a)),i.push(e.key))),this._emit(i)}_clearAll(){this._emit([])}_emit(t){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.TYPE,values:t,operator:S.IS},bubbles:!0,composed:!0}))}_toggleExpand(t){const e=new Set(this._expanded);e.has(t)?e.delete(t):e.add(t),this._expanded=e}_filteredGroups(t){const e=this._search.toLowerCase().trim();return e?t.map(s=>{if(s.label.toLowerCase().includes(e)||s.key.toLowerCase().includes(e))return s;const a=s.extensions.filter(o=>o.label.toLowerCase().includes(e)||o.value.toLowerCase().includes(e));return a.length===0?null:{...s,extensions:a}}).filter(s=>s!==null):t}_toggleCategory(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this._emit(e)}updated(t){if(t.has("fileTypes")&&this.fileTypes.length>0){const e=Js(this.fileTypes),s=new Set(this._expanded);for(const i of e)(this._isGroupFullySelected(i)||this._isGroupPartial(i))&&s.add(i.key);this._expanded=s}}render(){if(this.fileTypes.length===0)return this._renderFallback();const t=Js(this.fileTypes),e=this._filteredGroups(t),s=this.selected.length>0;return r.html`
|
|
493
493
|
<input
|
|
494
494
|
class="search-input"
|
|
495
495
|
type="text"
|
|
@@ -541,7 +541,7 @@
|
|
|
541
541
|
`}_renderFallback(){return r.html`
|
|
542
542
|
<div class="options">
|
|
543
543
|
<span class="section-label">Formats</span>
|
|
544
|
-
${
|
|
544
|
+
${Rt.map(t=>r.html`
|
|
545
545
|
<div
|
|
546
546
|
class="option ${this.selected.includes(t.value)?"selected":""}"
|
|
547
547
|
@click=${()=>this._toggleCategory(t.value)}
|
|
@@ -552,7 +552,7 @@
|
|
|
552
552
|
</div>
|
|
553
553
|
`)}
|
|
554
554
|
</div>
|
|
555
|
-
`}};
|
|
555
|
+
`}};qe.styles=r.css`
|
|
556
556
|
:host {
|
|
557
557
|
display: block;
|
|
558
558
|
}
|
|
@@ -706,7 +706,7 @@
|
|
|
706
706
|
font-size: var(--ap-font-size-sm, 0.875rem);
|
|
707
707
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
708
708
|
}
|
|
709
|
-
|
|
709
|
+
`;kt([l.property({type:Array})],qe.prototype,"selected",2);kt([l.property({type:Array})],qe.prototype,"fileTypes",2);kt([l.state()],qe.prototype,"_search",2);kt([l.state()],qe.prototype,"_expanded",2);qe=kt([l.customElement("ap-filter-type")],qe);const Ce=r.css`
|
|
710
710
|
:host {
|
|
711
711
|
display: block;
|
|
712
712
|
}
|
|
@@ -989,11 +989,11 @@
|
|
|
989
989
|
font-size: var(--ap-font-size-sm, 0.875rem);
|
|
990
990
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
991
991
|
}
|
|
992
|
-
`;var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,
|
|
992
|
+
`;var So=Object.defineProperty,Co=Object.getOwnPropertyDescriptor,Ke=(t,e,s,i)=>{for(var a=i>1?void 0:i?Co(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&So(e,s,a),a};function ns(t){return t.toISOString().split("T")[0]}let we=class extends r.LitElement{constructor(){super(...arguments),this.filterKey=b.DATE,this.field="created",this.kind=null,this.preset="",this.from="",this.to=""}get _isLicenseExpiry(){return this.filterKey===b.LICENSE_EXPIRY}get _rangeOptions(){return this._isLicenseExpiry?pi:vs}get _todayStr(){return ns(new Date)}get _hasFilter(){return!!(this.kind||this.preset||this.from||this.to)}_kindFromValue(t){return["before","after","between","specific"].includes(t)?t:"preset"}_selectField(t){this.field=t,this._dispatchChange()}_selectPreset(t){if(!t){this._clearAll();return}const e=this._kindFromValue(t);if(this.kind=e,this.preset=t,["before","after","between","specific"].includes(t)){this.from="",this.to="",this.requestUpdate();return}const s=hi(t);s&&(this.from=s.from,this.to=s.to??""),this._dispatchChange()}_clearAll(){this.field="created",this.kind=null,this.preset="",this.from="",this.to="",this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:{field:this.field,kind:this.kind,preset:this.preset,from:this.from,to:this.to}},bubbles:!0,composed:!0}))}_handleDateInput(t,e){const s=e.target.value,i=s?new Date(s+"T00:00:00").toISOString():"";if(t==="from"?this.from=i:this.to=i,this.preset==="specific"&&t==="from"&&i){const a=new Date(s+"T23:59:59");this.to=a.toISOString()}this.preset==="after"&&t==="from"&&i&&(this.to=new Date().toISOString()),this.preset==="before"&&t==="to"&&i&&(this.from=new Date(0).toISOString()),this._dispatchChange()}_renderDateTypeSection(){return this._isLicenseExpiry?r.nothing:r.html`
|
|
993
993
|
<div class="filter-section">
|
|
994
994
|
<span class="section-label">Date type</span>
|
|
995
995
|
<ap-radio-group
|
|
996
|
-
.options=${
|
|
996
|
+
.options=${di}
|
|
997
997
|
.value=${this.field}
|
|
998
998
|
@ap-change=${t=>this._selectField(t.detail.value)}
|
|
999
999
|
></ap-radio-group>
|
|
@@ -1009,7 +1009,7 @@
|
|
|
1009
1009
|
@ap-change=${t=>this._selectPreset(t.detail.value)}
|
|
1010
1010
|
></ap-radio-group>
|
|
1011
1011
|
</div>
|
|
1012
|
-
`}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return r.nothing;const e=this.from?
|
|
1012
|
+
`}_renderDateInputs(){const t=this.preset;if(!["before","after","between","specific"].includes(t))return r.nothing;const e=this.from?ns(new Date(this.from)):"",s=this.to?ns(new Date(this.to)):"",i=this._todayStr;return t==="specific"?r.html`
|
|
1013
1013
|
<div class="filter-section date-inputs">
|
|
1014
1014
|
<div>
|
|
1015
1015
|
<span class="input-label">Date</span>
|
|
@@ -1085,14 +1085,14 @@
|
|
|
1085
1085
|
${this._renderRangeSection()}
|
|
1086
1086
|
${this._renderDateInputs()}
|
|
1087
1087
|
</div>
|
|
1088
|
-
`}};
|
|
1088
|
+
`}};we.styles=[Ce,r.css`
|
|
1089
1089
|
.date-inputs {
|
|
1090
1090
|
margin-top: 4px;
|
|
1091
1091
|
}
|
|
1092
|
-
`];
|
|
1092
|
+
`];Ke([l.property()],we.prototype,"filterKey",2);Ke([l.property()],we.prototype,"field",2);Ke([l.property()],we.prototype,"kind",2);Ke([l.property()],we.prototype,"preset",2);Ke([l.property()],we.prototype,"from",2);Ke([l.property()],we.prototype,"to",2);we=Ke([l.customElement("ap-filter-date")],we);var Fo=Object.defineProperty,Eo=Object.getOwnPropertyDescriptor,lt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Eo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fo(e,s,a),a};let Te=class extends r.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=b.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=Jt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:S.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:S.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:S.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return r.html`
|
|
1093
1093
|
<div
|
|
1094
1094
|
class="tag-item ${s?"disabled":""}"
|
|
1095
|
-
title=${s?`You can select up to ${
|
|
1095
|
+
title=${s?`You can select up to ${Jt} tags`:r.nothing}
|
|
1096
1096
|
@click=${()=>!s&&this._toggle(t.sid)}
|
|
1097
1097
|
>
|
|
1098
1098
|
<ap-checkbox ?checked=${e}></ap-checkbox>
|
|
@@ -1145,7 +1145,7 @@
|
|
|
1145
1145
|
${this._atLimit?r.html`
|
|
1146
1146
|
<div class="info-alert">
|
|
1147
1147
|
<ap-icon name="info" .size=${14}></ap-icon>
|
|
1148
|
-
<span>You can select up to ${
|
|
1148
|
+
<span>You can select up to ${Jt} tags.</span>
|
|
1149
1149
|
</div>
|
|
1150
1150
|
`:r.nothing}
|
|
1151
1151
|
</div>
|
|
@@ -1194,7 +1194,7 @@
|
|
|
1194
1194
|
${t.length>0?r.html`<div class="separator"></div>`:r.nothing}
|
|
1195
1195
|
|
|
1196
1196
|
<div class="hint-message">Find more tags by using search</div>
|
|
1197
|
-
`}};
|
|
1197
|
+
`}};Te.styles=[Y,Ce,r.css`
|
|
1198
1198
|
.tag-item {
|
|
1199
1199
|
display: flex;
|
|
1200
1200
|
align-items: center;
|
|
@@ -1279,10 +1279,10 @@
|
|
|
1279
1279
|
max-height: none;
|
|
1280
1280
|
overflow-y: visible;
|
|
1281
1281
|
}
|
|
1282
|
-
`];
|
|
1282
|
+
`];lt([l.property({type:Array})],Te.prototype,"tags",2);lt([l.property({type:Array})],Te.prototype,"selected",2);lt([l.property()],Te.prototype,"filterKey",2);lt([l.query(".tag-search")],Te.prototype,"_searchInput",2);lt([l.state()],Te.prototype,"_search",2);Te=lt([l.customElement("ap-filter-tags")],Te);var Ao=Object.defineProperty,To=Object.getOwnPropertyDescriptor,St=(t,e,s,i)=>{for(var a=i>1?void 0:i?To(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ao(e,s,a),a};let Ve=class extends r.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=es}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(i=>i!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:s,operator:S.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:e,operator:S.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.LABELS,values:[],operator:S.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return r.html`
|
|
1283
1283
|
<div
|
|
1284
1284
|
class="label-item ${s?"disabled":""}"
|
|
1285
|
-
title=${s?`You can select up to ${
|
|
1285
|
+
title=${s?`You can select up to ${es} labels`:r.nothing}
|
|
1286
1286
|
@click=${()=>!s&&this._toggle(t.sid)}
|
|
1287
1287
|
>
|
|
1288
1288
|
<ap-checkbox ?checked=${e}></ap-checkbox>
|
|
@@ -1356,11 +1356,11 @@
|
|
|
1356
1356
|
${this._atLimit?r.html`
|
|
1357
1357
|
<div class="info-alert">
|
|
1358
1358
|
<ap-icon name="info" .size=${14}></ap-icon>
|
|
1359
|
-
<span>You can select up to ${
|
|
1359
|
+
<span>You can select up to ${es} labels.</span>
|
|
1360
1360
|
</div>
|
|
1361
1361
|
`:r.nothing}
|
|
1362
1362
|
</div>
|
|
1363
|
-
`}};
|
|
1363
|
+
`}};Ve.styles=[Ce,r.css`
|
|
1364
1364
|
.label-item {
|
|
1365
1365
|
display: flex;
|
|
1366
1366
|
align-items: center;
|
|
@@ -1409,7 +1409,7 @@
|
|
|
1409
1409
|
flex-shrink: 0;
|
|
1410
1410
|
line-height: 0;
|
|
1411
1411
|
}
|
|
1412
|
-
`];
|
|
1412
|
+
`];St([l.property({type:Array})],Ve.prototype,"labels",2);St([l.property({type:Array})],Ve.prototype,"selected",2);St([l.query(".search-input")],Ve.prototype,"_searchInput",2);St([l.state()],Ve.prototype,"_search",2);Ve=St([l.customElement("ap-filter-labels")],Ve);var Lo=Object.defineProperty,Oo=Object.getOwnPropertyDescriptor,ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?Oo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lo(e,s,a),a};const ls=3,hs=/^#[0-9A-Fa-f]{6}$/;function Mo(t){const e=t.trim().split(/\s+/);return e.length<1||!hs.test(e[0])?null:{hex:e[0],tolerance:e[1]||Mt,coverage:e[3]||Ot}}let Le=class extends r.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const i=Mo(s);i&&e.push(i)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Mt||s.coverage!==Ot)),this._initialized=!0)}}_selectColor(t){if(!hs.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=ls||(this._colors=[...this._colors,{hex:t,tolerance:Mt,coverage:Ot}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let i=e.target.value.trim();if(i.startsWith("#")||(i="#"+i),!hs.test(i)||this._colors.some((n,c)=>c!==t&&n.hex.toLowerCase()===i.toLowerCase()))return;const o=[...this._colors];o[t]={...o[t],hex:i},this._colors=o,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,i=parseInt(s,10);if(!isNaN(i)&&i>=1&&i<=100){const a=[...this._colors];a[t]={...a[t],coverage:String(i)},this._colors=a,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Mt,i=this._advanced?e.coverage:Ot;return`${e.hex} ${s} ${s} ${i}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=ls;return r.html`
|
|
1413
1413
|
<div class="palette">
|
|
1414
1414
|
${ya.map(s=>{const i=t.has(s),a=e&&!i;return r.html`
|
|
1415
1415
|
<button
|
|
@@ -1476,7 +1476,7 @@
|
|
|
1476
1476
|
<ap-icon name="close" .size=${14}></ap-icon>
|
|
1477
1477
|
</button>
|
|
1478
1478
|
</div>
|
|
1479
|
-
`}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<
|
|
1479
|
+
`}render(){const t=this._colors.length===0||this._showPalette,e=this._colors.length<ls&&!this._showPalette;return r.html`
|
|
1480
1480
|
<div class="filter-content">
|
|
1481
1481
|
<button
|
|
1482
1482
|
class="clear-btn"
|
|
@@ -1521,7 +1521,7 @@
|
|
|
1521
1521
|
<span>Requires image processing to be enabled.</span>
|
|
1522
1522
|
</div>
|
|
1523
1523
|
</div>
|
|
1524
|
-
`}};
|
|
1524
|
+
`}};Le.styles=[Y,Ce,r.css`
|
|
1525
1525
|
/* ── Palette ── */
|
|
1526
1526
|
.palette {
|
|
1527
1527
|
display: grid;
|
|
@@ -1758,7 +1758,7 @@
|
|
|
1758
1758
|
.add-color-btn:hover {
|
|
1759
1759
|
opacity: 0.8;
|
|
1760
1760
|
}
|
|
1761
|
-
`];
|
|
1761
|
+
`];ct([l.property({type:Array})],Le.prototype,"values",2);ct([l.state()],Le.prototype,"_colors",2);ct([l.state()],Le.prototype,"_advanced",2);ct([l.state()],Le.prototype,"_showPalette",2);ct([l.state()],Le.prototype,"_initialized",2);Le=ct([l.customElement("ap-filter-color")],Le);var Io=Object.defineProperty,Po=Object.getOwnPropertyDescriptor,Qe=(t,e,s,i)=>{for(var a=i>1?void 0:i?Po(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Io(e,s,a),a};const Do={KB:1/1e3,MB:1,GB:1e3},zo=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let $e=class extends r.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=Do[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let i;if(e!==null&&s!==null)i=`${e}..${s}`;else if(e!==null)i=`${e}..`;else if(s!==null)i=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[],operator:S.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.SIZE,values:[i],operator:S.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return r.html`
|
|
1762
1762
|
<div class="filter-content">
|
|
1763
1763
|
<span class="section-label">Size</span>
|
|
1764
1764
|
<button
|
|
@@ -1802,7 +1802,7 @@
|
|
|
1802
1802
|
</div>
|
|
1803
1803
|
</div>
|
|
1804
1804
|
</div>
|
|
1805
|
-
`}}
|
|
1805
|
+
`}};$e.styles=[Ce,r.css`
|
|
1806
1806
|
/* Hide number input spinners */
|
|
1807
1807
|
.filter-input[type='number']::-webkit-inner-spin-button,
|
|
1808
1808
|
.filter-input[type='number']::-webkit-outer-spin-button {
|
|
@@ -1821,7 +1821,7 @@
|
|
|
1821
1821
|
display: block;
|
|
1822
1822
|
width: 100%;
|
|
1823
1823
|
}
|
|
1824
|
-
`];
|
|
1824
|
+
`];Qe([l.property({type:Number})],$e.prototype,"min",2);Qe([l.property({type:Number})],$e.prototype,"max",2);Qe([l.state()],$e.prototype,"_minVal",2);Qe([l.state()],$e.prototype,"_maxVal",2);Qe([l.state()],$e.prototype,"_unit",2);Qe([l.state()],$e.prototype,"_initialized",2);$e=Qe([l.customElement("ap-filter-size")],$e);var Ro=Object.defineProperty,jo=Object.getOwnPropertyDescriptor,Qt=(t,e,s,i)=>{for(var a=i>1?void 0:i?jo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ro(e,s,a),a};const No=r.svg`
|
|
1825
1825
|
<svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1826
1826
|
<path d="M2.66666 1.9987C2.29847 1.9987 1.99999 2.29717 1.99999 2.66536L1.99999 13.332C1.99999 13.7002 2.29847 13.9987 2.66666 13.9987L9.33332 13.9987C9.70151 13.9987 9.99999 13.7002 9.99999 13.332L9.99999 2.66536C9.99999 2.29717 9.70151 1.9987 9.33332 1.9987L2.66666 1.9987ZM9.33332 0.665364C10.4379 0.665364 11.3333 1.56079 11.3333 2.66536L11.3333 13.332C11.3333 14.4366 10.4379 15.332 9.33332 15.332L2.66666 15.332C1.56209 15.332 0.666656 14.4366 0.666656 13.332L0.666656 2.66536C0.666656 1.56079 1.56209 0.665364 2.66666 0.665364L9.33332 0.665364Z" fill="#9747FF"/>
|
|
1827
1827
|
<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"/>
|
|
@@ -1847,7 +1847,7 @@
|
|
|
1847
1847
|
<path d="M11.3398 3.33203C11.708 3.33203 12.0065 3.63051 12.0065 3.9987C12.0065 4.36689 11.708 4.66536 11.3398 4.66536H11.3333C10.9651 4.66536 10.6667 4.36689 10.6667 3.9987C10.6667 3.63051 10.9651 3.33203 11.3333 3.33203H11.3398Z" fill="#4BA3AD"/>
|
|
1848
1848
|
<path d="M4.67317 3.33203C5.04136 3.33203 5.33983 3.63051 5.33983 3.9987C5.33983 4.36689 5.04136 4.66536 4.67317 4.66536H4.66666C4.29847 4.66536 3.99999 4.36689 3.99999 3.9987C3.99999 3.63051 4.29847 3.33203 4.66666 3.33203H4.67317Z" fill="#4BA3AD"/>
|
|
1849
1849
|
</svg>
|
|
1850
|
-
`,Vo={portrait:No,landscape:Uo,square:Bo,panorama:qo};let
|
|
1850
|
+
`,Vo={portrait:No,landscape:Uo,square:Bo,panorama:qo};let at=class extends r.LitElement{constructor(){super(...arguments),this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[]}get _hasSelection(){return this.selectedResolution.length>0||this.selectedOrientation.length>0||this.selectedFaces.length>0}_toggle(t,e){return t.includes(e)?t.filter(s=>s!==e):[...t,e]}_toggleResolution(t){this.selectedResolution=this._toggle(this.selectedResolution,t),this._dispatchChange()}_toggleOrientation(t){this.selectedOrientation=this._toggle(this.selectedOrientation,t),this._dispatchChange()}_toggleFaces(t){this.selectedFaces=this._toggle(this.selectedFaces,t),this._dispatchChange()}_clearAll(){this.selectedResolution=[],this.selectedOrientation=[],this.selectedFaces=[],this._dispatchChange()}_dispatchChange(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"image",values:{resolution:this.selectedResolution,orientation:this.selectedOrientation,faces:this.selectedFaces}},bubbles:!0,composed:!0}))}render(){return r.html`
|
|
1851
1851
|
<div class="filter-content">
|
|
1852
1852
|
<button
|
|
1853
1853
|
class="clear-btn"
|
|
@@ -1896,7 +1896,7 @@
|
|
|
1896
1896
|
<span>Some images might not have been processed, so they won't be displayed.</span>
|
|
1897
1897
|
</div>
|
|
1898
1898
|
</div>
|
|
1899
|
-
`}};
|
|
1899
|
+
`}};at.styles=[Ce,r.css`
|
|
1900
1900
|
.options-horizontal {
|
|
1901
1901
|
display: flex;
|
|
1902
1902
|
gap: 28px;
|
|
@@ -1917,14 +1917,14 @@
|
|
|
1917
1917
|
.orientation-label svg {
|
|
1918
1918
|
flex-shrink: 0;
|
|
1919
1919
|
}
|
|
1920
|
-
`];
|
|
1920
|
+
`];Qt([l.property({type:Array})],at.prototype,"selectedResolution",2);Qt([l.property({type:Array})],at.prototype,"selectedOrientation",2);Qt([l.property({type:Array})],at.prototype,"selectedFaces",2);at=Qt([l.customElement("ap-filter-image")],at);var Ho=Object.defineProperty,Go=Object.getOwnPropertyDescriptor,P=(t,e,s,i)=>{for(var a=i>1?void 0:i?Go(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ho(e,s,a),a};function F(t){return`${Gt[t.type]||""}${t.key}`}let I=class extends r.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=Tt}_getField(t){return this.fields.find(e=>F(e)===t)}_getUIType(t){return Sa[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===re||t[0]===ne}_getContentMode(t){var s,i;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===re?re:((i=e.values)==null?void 0:i[0])===ne?ne:this._specificModeFields.has(t)||e.values&&e.values.length>0?ze:""}_emitFilterChange(t,e,s){const i=F(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=F(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=F(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=F(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(F(t)).values||[];this._emitFilterChange(t,e,i)}_onContentModeChange(t,e){const s=F(t);if(e===ze){const i=new Set(this._specificModeFields);i.add(s),this._specificModeFields=i;const a=this._getApplied(s);this._isSpecialValue(a.values)&&this._emitFilterChange(t,a.operator,[])}else{if(this._specificModeFields.has(s)){const i=new Set(this._specificModeFields);i.delete(s),this._specificModeFields=i}if(e)this._onEmptyOption(t,e);else{const i=this._getApplied(s);this._emitFilterChange(t,i.operator,[])}}}_clearFieldFilter(t){const e=F(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...i}=this._datePresets;this._datePresets=i;const{[e]:a,...o}=this._dateFroms;this._dateFroms=o;const{[e]:n,...c}=this._dateTos;this._dateTos=c;const{[e]:d,...h}=this._selectSearches;this._selectSearches=h;const{[e]:u,...f}=this._tagInputs;this._tagInputs=f,this._emitFilterChange(t,void 0,[])}_onTextInput(t,e){const s=e.target.value,a=this._getApplied(F(t)).operator||ss[0].value;this._emitFilterChange(t,a,s?[s]:[])}_onNumberInput(t,e,s){const i=e.target.value,a=F(t),o=this._getApplied(a),n=o.operator||as[0].value,c=[...o.values||[]];s===0?c[0]=i:c[1]=i;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===w.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var a;const s=this._getApplied(F(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=F(t),i=this._getApplied(s),a=i.operator||ye[0].value,o=i.values||[];o.length===1&&o[0]===e?this._emitFilterChange(t,a,[]):this._emitFilterChange(t,a,[e])}_onMultiSelectToggle(t,e){const s=F(t),i=this._getApplied(s),a=i.operator||is[0].value,o=i.values||[],n=o.includes(e)?o.filter(c=>c!==e):[...o,e];this._emitFilterChange(t,a,n)}_onTagKeydown(t,e){const s=F(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=F(t),i=this._getApplied(s),a=i.operator||ye[0].value,o=i.values||[];o.includes(e)||this._emitFilterChange(t,a,[...o,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const i=`_${t.ckey||t.key}`,a=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:i});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(a.tags||[]).map(o=>o.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const i=this._getApplied(e),a=i.operator||ye[0].value,o=i.values||[];o.includes(s)||this._emitFilterChange(t,a,[...o,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=F(t),i=this._getApplied(s),a=i.operator||ye[0].value,o=i.values||[];this._emitFilterChange(t,a,o.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=F(t),a=this._getApplied(s).values||[];this._emitFilterChange(t,e,a)}_onDatePreset(t,e){const s=F(t);if(!e){this._clearFieldFilter(t);return}if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const i=new Date;let a="",o="";switch(e){case"today":{const n=new Date(i);n.setHours(0,0,0,0),a=n.toISOString(),o=i.toISOString();break}case"last_week":{const n=new Date(i),c=n.getDay();n.setDate(n.getDate()-(c===0?6:c-1)),n.setHours(0,0,0,0);const d=new Date(n);d.setDate(d.getDate()-7),a=d.toISOString(),o=n.toISOString();break}case"last_month":{const n=new Date(i.getFullYear(),i.getMonth(),1),c=new Date(n);c.setMonth(c.getMonth()-1),a=c.toISOString(),o=n.toISOString();break}case"last_year":{const n=new Date(i.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),a=c.toISOString(),o=n.toISOString();break}}a&&o&&(this._dateFroms={...this._dateFroms,[s]:a},this._dateTos={...this._dateTos,[s]:o},this._emitFilterChange(t,"..",[a,o]))}_onDateInput(t,e,s){const i=s.target.value,a=F(t),o=this._datePresets[a]||"",n=i?new Date(i+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[a]:n}:this._dateTos={...this._dateTos,[a]:n};let c=this._dateFroms[a]||"",d=this._dateTos[a]||"";o==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[a]:d}),o==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[a]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),i=F(t),a=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${i}"]`),o=(a==null?void 0:a.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[c,d]=n;let u=`${c},${d}..${o||"0"}`;this._emitFilterChange(t,S.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,i=F(t),a=this._getApplied(i);if(!((d=a.values)!=null&&d[0]))return;const o=a.values[0],[n]=o.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,S.IS,[c])}_onEmptyOption(t,e){var a;const s=this._getApplied(F(t)),i=(a=s.values)==null?void 0:a[0];!e||i===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_getGroupedFields(t){const e=new Map;for(const s of t){const i=s.group||"Root fields";e.has(i)||e.set(i,[]),e.get(i).push(s)}return e}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,o)=>o.length===0?r.nothing:r.html`
|
|
1921
1921
|
<div class="field-group-label">${a}</div>
|
|
1922
|
-
${o.map(n=>{const c=
|
|
1922
|
+
${o.map(n=>{const c=F(n),d=this.visibleFields.includes(c),h=!d&&this._atFieldLimit;return r.html`
|
|
1923
1923
|
<div
|
|
1924
1924
|
class="field-item ${d?"selected":""} ${h?"disabled":""}"
|
|
1925
1925
|
@click=${()=>!h&&!d&&this._addField(n)}
|
|
1926
1926
|
>
|
|
1927
|
-
${d?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.html`<ap-icon name=${
|
|
1927
|
+
${d?r.html`<ap-icon name="check" .size=${14}></ap-icon>`:r.html`<ap-icon name=${It[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>`}
|
|
1928
1928
|
<span>${n.label}</span>
|
|
1929
1929
|
</div>
|
|
1930
1930
|
`})}
|
|
@@ -1953,7 +1953,7 @@
|
|
|
1953
1953
|
${e.length===0?r.html`<div class="empty-msg">No fields found</div>`:r.html`${[...s.entries()].map(([a,o])=>i(a,o))}`}
|
|
1954
1954
|
</div>
|
|
1955
1955
|
</div>
|
|
1956
|
-
`}_renderTextFilter(t){var h,u;const e=
|
|
1956
|
+
`}_renderTextFilter(t){var h,u;const e=F(t),s=this._getApplied(e),a=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",o=this._getContentMode(e),n=o===re||o===ne,c=s.operator||ss[0].value,d=t.type===w.TEXT_AREA;return r.html`
|
|
1957
1957
|
<div class="filter-content" style="position: relative;">
|
|
1958
1958
|
<button
|
|
1959
1959
|
class="clear-btn"
|
|
@@ -1965,10 +1965,10 @@
|
|
|
1965
1965
|
<span class="section-label">Operator</span>
|
|
1966
1966
|
<ap-radio-group
|
|
1967
1967
|
direction="horizontal"
|
|
1968
|
-
.options=${
|
|
1968
|
+
.options=${ss}
|
|
1969
1969
|
.value=${c}
|
|
1970
1970
|
?disabled=${n}
|
|
1971
|
-
@ap-change=${
|
|
1971
|
+
@ap-change=${f=>this._onOperatorChange(t,f.detail.value)}
|
|
1972
1972
|
></ap-radio-group>
|
|
1973
1973
|
</div>
|
|
1974
1974
|
|
|
@@ -1976,13 +1976,13 @@
|
|
|
1976
1976
|
<span class="section-label">Content</span>
|
|
1977
1977
|
<ap-radio-group
|
|
1978
1978
|
clearable
|
|
1979
|
-
.options=${
|
|
1979
|
+
.options=${os}
|
|
1980
1980
|
.value=${o}
|
|
1981
|
-
@ap-change=${
|
|
1981
|
+
@ap-change=${f=>this._onContentModeChange(t,f.detail.value)}
|
|
1982
1982
|
></ap-radio-group>
|
|
1983
1983
|
</div>
|
|
1984
1984
|
|
|
1985
|
-
${o===
|
|
1985
|
+
${o===ze?r.html`
|
|
1986
1986
|
<div class="filter-section">
|
|
1987
1987
|
<span class="section-label">Value</span>
|
|
1988
1988
|
${d?r.html`
|
|
@@ -1990,7 +1990,7 @@
|
|
|
1990
1990
|
class="filter-input"
|
|
1991
1991
|
placeholder="Enter value"
|
|
1992
1992
|
.value=${a}
|
|
1993
|
-
@change=${
|
|
1993
|
+
@change=${f=>this._onTextInput(t,f)}
|
|
1994
1994
|
></textarea>
|
|
1995
1995
|
`:r.html`
|
|
1996
1996
|
<input
|
|
@@ -1998,18 +1998,18 @@
|
|
|
1998
1998
|
type="text"
|
|
1999
1999
|
placeholder="Enter value"
|
|
2000
2000
|
.value=${a}
|
|
2001
|
-
@change=${
|
|
2002
|
-
@keydown=${
|
|
2001
|
+
@change=${f=>this._onTextInput(t,f)}
|
|
2002
|
+
@keydown=${f=>{f.key==="Enter"&&f.preventDefault()}}
|
|
2003
2003
|
/>
|
|
2004
2004
|
`}
|
|
2005
2005
|
</div>
|
|
2006
2006
|
`:r.nothing}
|
|
2007
2007
|
</div>
|
|
2008
|
-
`}_renderNumberFilter(t){var
|
|
2008
|
+
`}_renderNumberFilter(t){var x,M,$;const e=F(t),s=this._getApplied(e),i=s.operator||as[0].value,a=this._isSpecialValue(s.values),o=this._getContentMode(e),n=o===re||o===ne,c=i===S.RANGE,d=i===S.GREATER_THAN_OR_EQUAL,h=i===S.LESS_THAN_OR_EQUAL,u=t.type===w.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=a?"":((x=s.values)==null?void 0:x[0])||"",m=a?"":((M=s.values)==null?void 0:M[1])||"",_=c||d||h,y=c||d||h?"Min":"Value";return r.html`
|
|
2009
2009
|
<div class="filter-content" style="position: relative;">
|
|
2010
2010
|
<button
|
|
2011
2011
|
class="clear-btn"
|
|
2012
|
-
?disabled=${!((
|
|
2012
|
+
?disabled=${!(($=s.values)!=null&&$.length)&&!s.operator}
|
|
2013
2013
|
@click=${()=>this._clearFieldFilter(t)}
|
|
2014
2014
|
>Clear all</button>
|
|
2015
2015
|
|
|
@@ -2017,10 +2017,10 @@
|
|
|
2017
2017
|
<span class="section-label">Condition</span>
|
|
2018
2018
|
<ap-radio-group
|
|
2019
2019
|
columns="2"
|
|
2020
|
-
.options=${
|
|
2020
|
+
.options=${as}
|
|
2021
2021
|
.value=${i}
|
|
2022
2022
|
?disabled=${n}
|
|
2023
|
-
@ap-change=${
|
|
2023
|
+
@ap-change=${k=>this._onOperatorChange(t,k.detail.value)}
|
|
2024
2024
|
></ap-radio-group>
|
|
2025
2025
|
</div>
|
|
2026
2026
|
|
|
@@ -2028,38 +2028,38 @@
|
|
|
2028
2028
|
<span class="section-label">Content</span>
|
|
2029
2029
|
<ap-radio-group
|
|
2030
2030
|
clearable
|
|
2031
|
-
.options=${
|
|
2031
|
+
.options=${os}
|
|
2032
2032
|
.value=${o}
|
|
2033
|
-
@ap-change=${
|
|
2033
|
+
@ap-change=${k=>this._onContentModeChange(t,k.detail.value)}
|
|
2034
2034
|
></ap-radio-group>
|
|
2035
2035
|
</div>
|
|
2036
2036
|
|
|
2037
|
-
${o===
|
|
2037
|
+
${o===ze?r.html`
|
|
2038
2038
|
<div class="filter-section">
|
|
2039
2039
|
<div class="grid-2">
|
|
2040
2040
|
<div>
|
|
2041
|
-
<span class="input-label" aria-disabled=${h?"true":r.nothing}>${
|
|
2041
|
+
<span class="input-label" aria-disabled=${h?"true":r.nothing}>${y}</span>
|
|
2042
2042
|
<input
|
|
2043
2043
|
class="filter-input"
|
|
2044
2044
|
type="number"
|
|
2045
|
-
step=${
|
|
2045
|
+
step=${f}
|
|
2046
2046
|
placeholder=${p}
|
|
2047
|
-
.value=${
|
|
2047
|
+
.value=${g}
|
|
2048
2048
|
?disabled=${h}
|
|
2049
|
-
@change=${
|
|
2049
|
+
@change=${k=>this._onNumberInput(t,k,0)}
|
|
2050
2050
|
/>
|
|
2051
2051
|
</div>
|
|
2052
|
-
${
|
|
2052
|
+
${_?r.html`
|
|
2053
2053
|
<div>
|
|
2054
2054
|
<span class="input-label" aria-disabled=${d?"true":r.nothing}>${"Max"}</span>
|
|
2055
2055
|
<input
|
|
2056
2056
|
class="filter-input"
|
|
2057
2057
|
type="number"
|
|
2058
|
-
step=${
|
|
2058
|
+
step=${f}
|
|
2059
2059
|
placeholder=${p}
|
|
2060
|
-
.value=${
|
|
2060
|
+
.value=${m}
|
|
2061
2061
|
?disabled=${d}
|
|
2062
|
-
@change=${
|
|
2062
|
+
@change=${k=>this._onNumberInput(t,k,1)}
|
|
2063
2063
|
/>
|
|
2064
2064
|
</div>
|
|
2065
2065
|
`:r.nothing}
|
|
@@ -2067,7 +2067,7 @@
|
|
|
2067
2067
|
</div>
|
|
2068
2068
|
`:r.nothing}
|
|
2069
2069
|
</div>
|
|
2070
|
-
`}_renderBooleanFilter(t){var i,a;const e=this._getApplied(
|
|
2070
|
+
`}_renderBooleanFilter(t){var i,a;const e=this._getApplied(F(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
|
|
2071
2071
|
<div class="filter-content" style="position: relative;">
|
|
2072
2072
|
<button
|
|
2073
2073
|
class="clear-btn"
|
|
@@ -2085,7 +2085,7 @@
|
|
|
2085
2085
|
></ap-radio-group>
|
|
2086
2086
|
</div>
|
|
2087
2087
|
</div>
|
|
2088
|
-
`}_renderSelectOneFilter(t){const e=
|
|
2088
|
+
`}_renderSelectOneFilter(t){const e=F(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||ye[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,f=a.length>=Tt;return r.html`
|
|
2089
2089
|
<div class="filter-content">
|
|
2090
2090
|
<!-- Search input -->
|
|
2091
2091
|
<div class="search-wrapper">
|
|
@@ -2126,7 +2126,7 @@
|
|
|
2126
2126
|
</div>
|
|
2127
2127
|
<ap-radio-group
|
|
2128
2128
|
direction="horizontal"
|
|
2129
|
-
.options=${
|
|
2129
|
+
.options=${ye}
|
|
2130
2130
|
.value=${n}
|
|
2131
2131
|
@ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
|
|
2132
2132
|
></ap-radio-group>
|
|
@@ -2143,9 +2143,9 @@
|
|
|
2143
2143
|
>Clear all</button>
|
|
2144
2144
|
</div>
|
|
2145
2145
|
<div class="chips-wrap">
|
|
2146
|
-
${a.map(p=>{const
|
|
2146
|
+
${a.map(p=>{const g=o.find(m=>m.api_value===p);return r.html`
|
|
2147
2147
|
<div class="chip">
|
|
2148
|
-
<span class="chip-label">${(
|
|
2148
|
+
<span class="chip-label">${(g==null?void 0:g.label)||p}</span>
|
|
2149
2149
|
<button class="chip-remove" @click=${()=>this._onSelectOneToggle(t,p)}>
|
|
2150
2150
|
<ap-icon name="close" .size=${10}></ap-icon>
|
|
2151
2151
|
</button>
|
|
@@ -2162,12 +2162,12 @@
|
|
|
2162
2162
|
|
|
2163
2163
|
<!-- Empty/Not empty checkboxes -->
|
|
2164
2164
|
<div class="options-list short">
|
|
2165
|
-
${
|
|
2165
|
+
${Ne.map(p=>{var g;return r.html`
|
|
2166
2166
|
<div
|
|
2167
2167
|
class="option-item"
|
|
2168
2168
|
@click=${()=>this._onEmptyOption(t,p.value)}
|
|
2169
2169
|
>
|
|
2170
|
-
<ap-checkbox ?checked=${((
|
|
2170
|
+
<ap-checkbox ?checked=${((g=s.values)==null?void 0:g[0])===p.value}></ap-checkbox>
|
|
2171
2171
|
<span>${p.label}</span>
|
|
2172
2172
|
</div>
|
|
2173
2173
|
`})}
|
|
@@ -2177,19 +2177,19 @@
|
|
|
2177
2177
|
|
|
2178
2178
|
<!-- Regular options -->
|
|
2179
2179
|
<div class="options-list">
|
|
2180
|
-
${u.length===0?r.html`<div class="no-results">No options found</div>`:u.map(p=>{const
|
|
2180
|
+
${u.length===0?r.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),m=!g&&f;return r.html`
|
|
2181
2181
|
<div
|
|
2182
|
-
class="option-item ${
|
|
2183
|
-
@click=${()=>!
|
|
2182
|
+
class="option-item ${m?"disabled":""}"
|
|
2183
|
+
@click=${()=>!m&&this._onSelectOneToggle(t,p.api_value)}
|
|
2184
2184
|
>
|
|
2185
|
-
<ap-checkbox ?checked=${
|
|
2185
|
+
<ap-checkbox ?checked=${g}></ap-checkbox>
|
|
2186
2186
|
<span>${p.label}</span>
|
|
2187
2187
|
</div>
|
|
2188
2188
|
`})}
|
|
2189
2189
|
</div>
|
|
2190
2190
|
</div>
|
|
2191
2191
|
</div>
|
|
2192
|
-
`}_renderMultiSelectFilter(t){const e=
|
|
2192
|
+
`}_renderMultiSelectFilter(t){const e=F(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=t.possible_values||[],n=s.operator||is[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=a.length>0||i,u=c?o.filter(p=>p.label.toLowerCase().includes(c)):o,f=a.length>=Tt;return r.html`
|
|
2193
2193
|
<div class="filter-content">
|
|
2194
2194
|
<!-- Search input -->
|
|
2195
2195
|
<div class="search-wrapper">
|
|
@@ -2230,7 +2230,7 @@
|
|
|
2230
2230
|
</div>
|
|
2231
2231
|
<ap-radio-group
|
|
2232
2232
|
direction="horizontal"
|
|
2233
|
-
.options=${
|
|
2233
|
+
.options=${is}
|
|
2234
2234
|
.value=${n}
|
|
2235
2235
|
@ap-change=${p=>this._onOperatorChange(t,p.detail.value)}
|
|
2236
2236
|
></ap-radio-group>
|
|
@@ -2247,9 +2247,9 @@
|
|
|
2247
2247
|
>Clear all</button>
|
|
2248
2248
|
</div>
|
|
2249
2249
|
<div class="chips-wrap">
|
|
2250
|
-
${a.map(p=>{const
|
|
2250
|
+
${a.map(p=>{const g=o.find(m=>m.api_value===p);return r.html`
|
|
2251
2251
|
<div class="chip">
|
|
2252
|
-
<span class="chip-label">${(
|
|
2252
|
+
<span class="chip-label">${(g==null?void 0:g.label)||p}</span>
|
|
2253
2253
|
<button class="chip-remove" @click=${()=>this._onMultiSelectToggle(t,p)}>
|
|
2254
2254
|
<ap-icon name="close" .size=${10}></ap-icon>
|
|
2255
2255
|
</button>
|
|
@@ -2266,12 +2266,12 @@
|
|
|
2266
2266
|
|
|
2267
2267
|
<!-- Empty/Not empty checkboxes -->
|
|
2268
2268
|
<div class="options-list short">
|
|
2269
|
-
${
|
|
2269
|
+
${Ne.map(p=>{var g;return r.html`
|
|
2270
2270
|
<div
|
|
2271
2271
|
class="option-item"
|
|
2272
2272
|
@click=${()=>this._onEmptyOption(t,p.value)}
|
|
2273
2273
|
>
|
|
2274
|
-
<ap-checkbox ?checked=${((
|
|
2274
|
+
<ap-checkbox ?checked=${((g=s.values)==null?void 0:g[0])===p.value}></ap-checkbox>
|
|
2275
2275
|
<span>${p.label}</span>
|
|
2276
2276
|
</div>
|
|
2277
2277
|
`})}
|
|
@@ -2281,19 +2281,19 @@
|
|
|
2281
2281
|
|
|
2282
2282
|
<!-- Regular options -->
|
|
2283
2283
|
<div class="options-list">
|
|
2284
|
-
${u.length===0?r.html`<div class="no-results">No options found</div>`:u.map(p=>{const
|
|
2284
|
+
${u.length===0?r.html`<div class="no-results">No options found</div>`:u.map(p=>{const g=a.includes(p.api_value),m=!g&&f;return r.html`
|
|
2285
2285
|
<div
|
|
2286
|
-
class="option-item ${
|
|
2287
|
-
@click=${()=>!
|
|
2286
|
+
class="option-item ${m?"disabled":""}"
|
|
2287
|
+
@click=${()=>!m&&this._onMultiSelectToggle(t,p.api_value)}
|
|
2288
2288
|
>
|
|
2289
|
-
<ap-checkbox ?checked=${
|
|
2289
|
+
<ap-checkbox ?checked=${g}></ap-checkbox>
|
|
2290
2290
|
<span>${p.label}</span>
|
|
2291
2291
|
</div>
|
|
2292
2292
|
`})}
|
|
2293
2293
|
</div>
|
|
2294
2294
|
</div>
|
|
2295
2295
|
</div>
|
|
2296
|
-
`}_renderTagsFilter(t){const e=
|
|
2296
|
+
`}_renderTagsFilter(t){const e=F(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=i?[]:s.values||[],o=this._tagInputs[e]||"",n=s.operator||ye[0].value,c=a.length>0||i,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=o.trim().length>0,f=a.length>=Tt;return r.html`
|
|
2297
2297
|
<div class="filter-content">
|
|
2298
2298
|
<!-- Search input -->
|
|
2299
2299
|
<div class="search-wrapper">
|
|
@@ -2335,7 +2335,7 @@
|
|
|
2335
2335
|
</div>
|
|
2336
2336
|
<ap-radio-group
|
|
2337
2337
|
direction="horizontal"
|
|
2338
|
-
.options=${
|
|
2338
|
+
.options=${ye}
|
|
2339
2339
|
.value=${n}
|
|
2340
2340
|
?disabled=${i}
|
|
2341
2341
|
@ap-change=${p=>this._onTagOperatorChange(t,p.detail.value)}
|
|
@@ -2369,12 +2369,12 @@
|
|
|
2369
2369
|
<div class="filter-section">
|
|
2370
2370
|
<span class="section-label">All options</span>
|
|
2371
2371
|
<div class="options-list short">
|
|
2372
|
-
${
|
|
2372
|
+
${Ne.map(p=>{var g;return r.html`
|
|
2373
2373
|
<div
|
|
2374
2374
|
class="option-item"
|
|
2375
2375
|
@click=${()=>this._onEmptyOption(t,p.value)}
|
|
2376
2376
|
>
|
|
2377
|
-
<ap-checkbox ?checked=${((
|
|
2377
|
+
<ap-checkbox ?checked=${((g=s.values)==null?void 0:g[0])===p.value}></ap-checkbox>
|
|
2378
2378
|
<span>${p.label}</span>
|
|
2379
2379
|
</div>
|
|
2380
2380
|
`})}
|
|
@@ -2386,12 +2386,12 @@
|
|
|
2386
2386
|
${u?r.html`
|
|
2387
2387
|
<div class="filter-section">
|
|
2388
2388
|
<div class="options-list">
|
|
2389
|
-
${h?r.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const
|
|
2389
|
+
${h?r.html`<div class="option-item disabled"><span>Loading...</span></div>`:d.length>0?d.map(p=>{const g=a.includes(p),m=!g&&f;return r.html`
|
|
2390
2390
|
<div
|
|
2391
|
-
class="option-item ${
|
|
2392
|
-
@click=${()=>!
|
|
2391
|
+
class="option-item ${m?"disabled":""}"
|
|
2392
|
+
@click=${()=>!m&&(g?this._removeTag(t,p):this._selectTagSuggestion(t,p))}
|
|
2393
2393
|
>
|
|
2394
|
-
<ap-checkbox ?checked=${
|
|
2394
|
+
<ap-checkbox ?checked=${g}></ap-checkbox>
|
|
2395
2395
|
<span>${p}</span>
|
|
2396
2396
|
</div>
|
|
2397
2397
|
`}):r.html`<div class="option-item disabled"><span>No results</span></div>`}
|
|
@@ -2399,11 +2399,11 @@
|
|
|
2399
2399
|
</div>
|
|
2400
2400
|
`:r.nothing}
|
|
2401
2401
|
</div>
|
|
2402
|
-
`}_renderDateFilter(t){var u,
|
|
2402
|
+
`}_renderDateFilter(t){var u,f;const e=F(t),s=this._datePresets[e]||"",i=this._getApplied(e),o=this._isSpecialValue(i.values)?((u=i.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(o);return r.html`
|
|
2403
2403
|
<div class="filter-content" style="position: relative;">
|
|
2404
2404
|
<button
|
|
2405
2405
|
class="clear-btn"
|
|
2406
|
-
?disabled=${!o&&!((
|
|
2406
|
+
?disabled=${!o&&!((f=i.values)!=null&&f.length)}
|
|
2407
2407
|
@click=${()=>this._clearFieldFilter(t)}
|
|
2408
2408
|
>Clear all</button>
|
|
2409
2409
|
|
|
@@ -2420,7 +2420,7 @@
|
|
|
2420
2420
|
<ap-radio-group
|
|
2421
2421
|
clearable
|
|
2422
2422
|
columns="2"
|
|
2423
|
-
.options=${
|
|
2423
|
+
.options=${vs}
|
|
2424
2424
|
.value=${o!=="empty"&&o!=="non-empty"?o:""}
|
|
2425
2425
|
@ap-change=${p=>this._onDatePreset(t,p.detail.value)}
|
|
2426
2426
|
></ap-radio-group>
|
|
@@ -2473,11 +2473,11 @@
|
|
|
2473
2473
|
</div>
|
|
2474
2474
|
`:r.nothing}
|
|
2475
2475
|
</div>
|
|
2476
|
-
`}_renderGeoFilter(t){var u,
|
|
2476
|
+
`}_renderGeoFilter(t){var u,f;const e=F(t),s=this._getApplied(e),i=this._isSpecialValue(s.values),a=this._getContentMode(e);let o="",n="";if(!i&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,m]=p.split("..");o=g||"",n=m||""}const c=o.length>0,d=o.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return r.html`
|
|
2477
2477
|
<div class="filter-content" style="position: relative;">
|
|
2478
2478
|
<button
|
|
2479
2479
|
class="clear-btn"
|
|
2480
|
-
?disabled=${!((
|
|
2480
|
+
?disabled=${!((f=s.values)!=null&&f.length)}
|
|
2481
2481
|
@click=${()=>this._clearFieldFilter(t)}
|
|
2482
2482
|
>Clear all</button>
|
|
2483
2483
|
|
|
@@ -2485,13 +2485,13 @@
|
|
|
2485
2485
|
<span class="section-label">Content</span>
|
|
2486
2486
|
<ap-radio-group
|
|
2487
2487
|
clearable
|
|
2488
|
-
.options=${
|
|
2488
|
+
.options=${os}
|
|
2489
2489
|
.value=${a}
|
|
2490
2490
|
@ap-change=${p=>this._onContentModeChange(t,p.detail.value)}
|
|
2491
2491
|
></ap-radio-group>
|
|
2492
2492
|
</div>
|
|
2493
2493
|
|
|
2494
|
-
${a===
|
|
2494
|
+
${a===ze?r.html`
|
|
2495
2495
|
<div class="filter-section">
|
|
2496
2496
|
<div class="geo-row">
|
|
2497
2497
|
<div class="geo-location">
|
|
@@ -2520,7 +2520,7 @@
|
|
|
2520
2520
|
</div>
|
|
2521
2521
|
`:r.nothing}
|
|
2522
2522
|
</div>
|
|
2523
|
-
`}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(
|
|
2523
|
+
`}_renderAttachmentFilter(t){var i,a;const e=this._getApplied(F(t)),s=((i=e.values)==null?void 0:i[0])||"";return r.html`
|
|
2524
2524
|
<div class="filter-content" style="position: relative;">
|
|
2525
2525
|
<button
|
|
2526
2526
|
class="clear-btn"
|
|
@@ -2531,13 +2531,13 @@
|
|
|
2531
2531
|
<div class="filter-section">
|
|
2532
2532
|
<ap-radio-group
|
|
2533
2533
|
clearable
|
|
2534
|
-
.options=${
|
|
2534
|
+
.options=${Ne}
|
|
2535
2535
|
.value=${s}
|
|
2536
2536
|
@ap-change=${o=>this._onEmptyOption(t,o.detail.value)}
|
|
2537
2537
|
></ap-radio-group>
|
|
2538
2538
|
</div>
|
|
2539
2539
|
</div>
|
|
2540
|
-
`}_renderFaceMatcherFilter(t){const e=
|
|
2540
|
+
`}_renderFaceMatcherFilter(t){const e=F(t),s=this._getApplied(e),i=s.values||[],a=s.operator||S.IS;return r.html`
|
|
2541
2541
|
<div class="filter-content" style="position: relative;">
|
|
2542
2542
|
<button
|
|
2543
2543
|
class="clear-btn"
|
|
@@ -2549,7 +2549,7 @@
|
|
|
2549
2549
|
<span class="section-label">Condition</span>
|
|
2550
2550
|
<ap-radio-group
|
|
2551
2551
|
direction="horizontal"
|
|
2552
|
-
.options=${
|
|
2552
|
+
.options=${ye}
|
|
2553
2553
|
.value=${a}
|
|
2554
2554
|
@ap-change=${o=>this._emitFilterChange(t,o.detail.value,i)}
|
|
2555
2555
|
></ap-radio-group>
|
|
@@ -2562,7 +2562,7 @@
|
|
|
2562
2562
|
/>
|
|
2563
2563
|
</div>
|
|
2564
2564
|
</div>
|
|
2565
|
-
`}_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===
|
|
2565
|
+
`}_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===w.INTEGER_LIST&&t.slug==="face_matcher"?this._renderFaceMatcherFilter(t):this._renderAttachmentFilter(t);default:return r.nothing}}_renderFieldSection(t){const e=this._getField(t);if(!e)return r.nothing;const s=this._collapsedFields.has(t);return r.html`
|
|
2566
2566
|
<div class="field-section">
|
|
2567
2567
|
<div
|
|
2568
2568
|
class="field-header"
|
|
@@ -2574,7 +2574,7 @@
|
|
|
2574
2574
|
name="chevron-right"
|
|
2575
2575
|
.size=${14}
|
|
2576
2576
|
></ap-icon>
|
|
2577
|
-
<ap-icon name=${
|
|
2577
|
+
<ap-icon name=${It[e.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
|
|
2578
2578
|
<span>${e.label}</span>
|
|
2579
2579
|
</div>
|
|
2580
2580
|
<div class="field-header-actions">
|
|
@@ -2593,12 +2593,12 @@
|
|
|
2593
2593
|
</div>
|
|
2594
2594
|
`}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(a=>a.label.toLowerCase().includes(t)),s=this._getGroupedFields(e),i=(a,o)=>o.length===0?r.nothing:r.html`
|
|
2595
2595
|
<div class="field-group-label">${a}</div>
|
|
2596
|
-
${o.map(n=>{const c=
|
|
2596
|
+
${o.map(n=>{const c=F(n),d=this.visibleFields.includes(c),h=!!this.appliedMetadata[c]||!!this.appliedFilters[c],u=this.pinnedFields.includes(c),f=!d&&this._atFieldLimit;return r.html`
|
|
2597
2597
|
<div
|
|
2598
|
-
class="field-item ${h?"has-filter":""} ${
|
|
2599
|
-
@click=${()=>!
|
|
2598
|
+
class="field-item ${h?"has-filter":""} ${f?"disabled":""}"
|
|
2599
|
+
@click=${()=>!f&&this._emitFieldSelect(n)}
|
|
2600
2600
|
>
|
|
2601
|
-
<ap-icon name=${
|
|
2601
|
+
<ap-icon name=${It[n.type]||"file-text"} .size=${14} style="color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"></ap-icon>
|
|
2602
2602
|
<span class="field-item-label">${n.label}</span>
|
|
2603
2603
|
<button
|
|
2604
2604
|
class="field-item-pin ${u?"pinned":""}"
|
|
@@ -2645,7 +2645,7 @@
|
|
|
2645
2645
|
</button>
|
|
2646
2646
|
`:r.nothing}
|
|
2647
2647
|
`:r.nothing}
|
|
2648
|
-
`}};
|
|
2648
|
+
`}};I.styles=[Y,Ce,r.css`
|
|
2649
2649
|
/* ── Field selection panel ─────────────────────────────── */
|
|
2650
2650
|
|
|
2651
2651
|
.add-field-btn {
|
|
@@ -3022,7 +3022,7 @@
|
|
|
3022
3022
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
3023
3023
|
background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
|
|
3024
3024
|
}
|
|
3025
|
-
`];
|
|
3025
|
+
`];P([l.property({type:Array})],I.prototype,"fields",2);P([l.property({type:Object})],I.prototype,"appliedFilters",2);P([l.property({type:Array})],I.prototype,"visibleFields",2);P([l.property()],I.prototype,"mode",2);P([l.property()],I.prototype,"activeFieldKey",2);P([l.property({type:Array})],I.prototype,"pinnedFields",2);P([l.property({type:Object})],I.prototype,"appliedMetadata",2);P([l.property({attribute:!1})],I.prototype,"apiClient",2);P([l.state()],I.prototype,"_showFieldSelection",2);P([l.state()],I.prototype,"_fieldSearch",2);P([l.state()],I.prototype,"_collapsedFields",2);P([l.state()],I.prototype,"_tagInputs",2);P([l.state()],I.prototype,"_tagSuggestions",2);P([l.state()],I.prototype,"_tagLoading",2);P([l.state()],I.prototype,"_datePresets",2);P([l.state()],I.prototype,"_dateFroms",2);P([l.state()],I.prototype,"_dateTos",2);P([l.state()],I.prototype,"_specificModeFields",2);P([l.state()],I.prototype,"_selectSearches",2);I=P([l.customElement("ap-filter-metadata")],I);var Ko=Object.defineProperty,Qo=Object.getOwnPropertyDescriptor,me=(t,e,s,i)=>{for(var a=i>1?void 0:i?Qo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ko(e,s,a),a};let le=class extends r.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(re)||this.selectedStatus.includes(ne)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===re||t===ne)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(G.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(G.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(G.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(G.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(G.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(G.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(G.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(G.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(G.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(G.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:G.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:G.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return r.html`
|
|
3026
3026
|
<div class="filter-section">
|
|
3027
3027
|
<button
|
|
3028
3028
|
class="clear-btn"
|
|
@@ -3044,7 +3044,7 @@
|
|
|
3044
3044
|
|
|
3045
3045
|
<!-- Empty / Not empty checkboxes -->
|
|
3046
3046
|
<div class="options-list short mt-12">
|
|
3047
|
-
${
|
|
3047
|
+
${Ne.map(e=>r.html`
|
|
3048
3048
|
<ap-checkbox
|
|
3049
3049
|
?checked=${this.selectedStatus.includes(e.value)}
|
|
3050
3050
|
@ap-toggle=${()=>this._toggleStatus(e.value)}
|
|
@@ -3083,7 +3083,7 @@
|
|
|
3083
3083
|
<span class="section-label condition-label">Condition</span>
|
|
3084
3084
|
<ap-radio-group
|
|
3085
3085
|
direction="horizontal"
|
|
3086
|
-
.options=${
|
|
3086
|
+
.options=${Qs}
|
|
3087
3087
|
.value=${this.approverOperator}
|
|
3088
3088
|
@ap-change=${this._handleApproverOperator}
|
|
3089
3089
|
></ap-radio-group>
|
|
@@ -3110,7 +3110,7 @@
|
|
|
3110
3110
|
<span class="section-label condition-label">Condition</span>
|
|
3111
3111
|
<ap-radio-group
|
|
3112
3112
|
direction="horizontal"
|
|
3113
|
-
.options=${
|
|
3113
|
+
.options=${Qs}
|
|
3114
3114
|
.value=${this.requesterOperator}
|
|
3115
3115
|
@ap-change=${this._handleRequesterOperator}
|
|
3116
3116
|
></ap-radio-group>
|
|
@@ -3136,8 +3136,8 @@
|
|
|
3136
3136
|
<!-- Empty / Not empty radio buttons -->
|
|
3137
3137
|
<ap-radio-group
|
|
3138
3138
|
clearable
|
|
3139
|
-
.options=${
|
|
3140
|
-
.value=${this.dueDatePreset===
|
|
3139
|
+
.options=${Ne}
|
|
3140
|
+
.value=${this.dueDatePreset===re||this.dueDatePreset===ne?this.dueDatePreset:""}
|
|
3141
3141
|
@ap-change=${this._handleDueDatePreset}
|
|
3142
3142
|
></ap-radio-group>
|
|
3143
3143
|
|
|
@@ -3148,7 +3148,7 @@
|
|
|
3148
3148
|
clearable
|
|
3149
3149
|
columns="2"
|
|
3150
3150
|
.options=${_a}
|
|
3151
|
-
.value=${this.dueDatePreset!==
|
|
3151
|
+
.value=${this.dueDatePreset!==re&&this.dueDatePreset!==ne?this.dueDatePreset:""}
|
|
3152
3152
|
@ap-change=${this._handleDueDatePreset}
|
|
3153
3153
|
></ap-radio-group>
|
|
3154
3154
|
|
|
@@ -3190,7 +3190,7 @@
|
|
|
3190
3190
|
<div class="separator"></div>
|
|
3191
3191
|
${this._renderDueDateSection()}
|
|
3192
3192
|
</div>
|
|
3193
|
-
`}};
|
|
3193
|
+
`}};le.styles=[Y,Ce,r.css`
|
|
3194
3194
|
.options-list.short {
|
|
3195
3195
|
max-height: none;
|
|
3196
3196
|
}
|
|
@@ -3209,7 +3209,7 @@
|
|
|
3209
3209
|
.mt-12 {
|
|
3210
3210
|
margin-top: 12px;
|
|
3211
3211
|
}
|
|
3212
|
-
`];
|
|
3212
|
+
`];me([l.property({type:Array})],le.prototype,"selectedStatus",2);me([l.property()],le.prototype,"statusOperator",2);me([l.property()],le.prototype,"approverValue",2);me([l.property()],le.prototype,"approverOperator",2);me([l.property()],le.prototype,"requesterValue",2);me([l.property()],le.prototype,"requesterOperator",2);me([l.property()],le.prototype,"dueDatePreset",2);me([l.property()],le.prototype,"dueDateFrom",2);me([l.property()],le.prototype,"dueDateTo",2);le=me([l.customElement("ap-filter-approval")],le);var Yo=Object.defineProperty,Wo=Object.getOwnPropertyDescriptor,be=(t,e,s,i)=>{for(var a=i>1?void 0:i?Wo(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Yo(e,s,a),a};const Xo=300;function Zo(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let ce=class extends r.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=Zo(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:b.PRODUCT_REF,values:e,operator:S.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(i=>i!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},Xo)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
|
|
3213
3213
|
`).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(i=>!e.has(i))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return r.html`
|
|
3214
3214
|
<div
|
|
3215
3215
|
class="product-item"
|
|
@@ -3335,7 +3335,7 @@
|
|
|
3335
3335
|
</div>
|
|
3336
3336
|
</div>
|
|
3337
3337
|
`:r.nothing}
|
|
3338
|
-
`}};
|
|
3338
|
+
`}};ce.styles=[Y,Ce,r.css`
|
|
3339
3339
|
.product-item {
|
|
3340
3340
|
display: flex;
|
|
3341
3341
|
align-items: center;
|
|
@@ -3575,7 +3575,7 @@
|
|
|
3575
3575
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
3576
3576
|
margin-left: 4px;
|
|
3577
3577
|
}
|
|
3578
|
-
`];
|
|
3578
|
+
`];be([l.property({type:Array})],ce.prototype,"selected",2);be([l.property({attribute:!1})],ce.prototype,"apiClient",2);be([l.query(".product-search")],ce.prototype,"_searchInput",2);be([l.state()],ce.prototype,"_search",2);be([l.state()],ce.prototype,"_debouncedSearch",2);be([l.state()],ce.prototype,"_products",2);be([l.state()],ce.prototype,"_isLoading",2);be([l.state()],ce.prototype,"_showAddList",2);be([l.state()],ce.prototype,"_addListText",2);ce=be([l.customElement("ap-filter-product-ref")],ce);var Jo=Object.defineProperty,er=Object.getOwnPropertyDescriptor,L=(t,e,s,i)=>{for(var a=i>1?void 0:i?er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Jo(e,s,a),a};let T=class extends r.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.showFilters=!0,this.countLabel="",this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=ms,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.fileTypes=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(o=>{var n;return o instanceof HTMLElement&&o.classList.contains("chip")&&((n=o.closest)==null?void 0:n.call(o,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(a=>a instanceof HTMLElement?a.classList.contains("popover-anchor")||a.classList.contains("popover-panel"):!1),i=(this._showDropdown||this._showMetadataSelector)&&e.some(a=>a instanceof HTMLElement&&(a.classList.contains("dropdown-menu")||a.classList.contains("filter-dropdown")||a.classList.contains("metadata-selector-overlay")));s||i||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),i=s?s.offsetWidth:this.offsetWidth,a=e.offsetWidth;this._externalLeft+a>i-8&&(e.style.left=`${Math.max(8,i-a-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}openFilterPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this._showMetadataSelector=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_handleSortOpen(){this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:i}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:i},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,this._showDropdown=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s,i){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null,this._externalTop=i??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${Gt[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=ds.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,i,a;const e=this.filters.applied;switch(t){case"type":{const o=e.type;return r.html`<ap-filter-type
|
|
3579
3579
|
.selected=${(o==null?void 0:o.values)||[]}
|
|
3580
3580
|
.fileTypes=${this.fileTypes}
|
|
3581
3581
|
@filter-change=${this._handleFilterChange}
|
|
@@ -3704,7 +3704,7 @@
|
|
|
3704
3704
|
</button>
|
|
3705
3705
|
${this._showDropdown?r.html`
|
|
3706
3706
|
<div class="dropdown-menu">
|
|
3707
|
-
${
|
|
3707
|
+
${ds.filter(e=>!this.forcedFilterKeys.includes(e.key)).map(e=>this._renderFilterButton(e))}
|
|
3708
3708
|
</div>
|
|
3709
3709
|
`:r.nothing}
|
|
3710
3710
|
</div>
|
|
@@ -3744,7 +3744,7 @@
|
|
|
3744
3744
|
${this._getMetadataFieldLabel(this._openMetadataField)}
|
|
3745
3745
|
`:r.html`
|
|
3746
3746
|
<ap-icon name=${this._getFilterIcon(this._openFilter)} .size=${16}></ap-icon>
|
|
3747
|
-
${
|
|
3747
|
+
${et[this._openFilter]||this._openFilter}
|
|
3748
3748
|
`}
|
|
3749
3749
|
<button class="anchor-close" @click=${()=>{this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._externalTop=null}} title="Close">
|
|
3750
3750
|
<ap-icon name="close" .size=${14}></ap-icon>
|
|
@@ -3756,7 +3756,7 @@
|
|
|
3756
3756
|
</div>
|
|
3757
3757
|
</div>
|
|
3758
3758
|
`:r.nothing}
|
|
3759
|
-
`}};
|
|
3759
|
+
`}};T.styles=r.css`
|
|
3760
3760
|
:host {
|
|
3761
3761
|
display: block;
|
|
3762
3762
|
padding: 8px 20px 6px;
|
|
@@ -4094,10 +4094,10 @@
|
|
|
4094
4094
|
border-radius: 8px;
|
|
4095
4095
|
top: 0;
|
|
4096
4096
|
}
|
|
4097
|
-
`;
|
|
4097
|
+
`;L([l.property({type:Number})],T.prototype,"totalCount",2);L([l.property({type:Number})],T.prototype,"totalFolderCount",2);L([l.property({type:Boolean})],T.prototype,"isLoading",2);L([l.property({type:Boolean})],T.prototype,"showUpload",2);L([l.property({type:Boolean})],T.prototype,"showFilters",2);L([l.property()],T.prototype,"countLabel",2);L([l.property()],T.prototype,"sortBy",2);L([l.property()],T.prototype,"sortDirection",2);L([l.property({type:Array})],T.prototype,"sortOptions",2);L([l.property({type:Object})],T.prototype,"filters",2);L([l.property({type:Array})],T.prototype,"labels",2);L([l.property({type:Array})],T.prototype,"tags",2);L([l.property({type:Array})],T.prototype,"fileTypes",2);L([l.property({type:Array})],T.prototype,"metadataFields",2);L([l.property({type:Array})],T.prototype,"pinnedFilters",2);L([l.property({type:Array})],T.prototype,"forcedFilterKeys",2);L([l.property({attribute:!1})],T.prototype,"apiClient",2);L([l.query("ap-dropdown")],T.prototype,"_sortDropdown",2);L([l.state()],T.prototype,"_showDropdown",2);L([l.state()],T.prototype,"_showMetadataSelector",2);L([l.state()],T.prototype,"_openFilter",2);L([l.state()],T.prototype,"_openMetadataField",2);L([l.state()],T.prototype,"_externalTrigger",2);L([l.state()],T.prototype,"_externalLeft",2);L([l.state()],T.prototype,"_externalTop",2);T=L([l.customElement("ap-content-toolbar")],T);var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,se=(t,e,s,i)=>{for(var a=i>1?void 0:i?sr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&tr(e,s,a),a};let q=class extends r.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var i;const e=(i=Rt.find(a=>a.value===t))==null?void 0:i.label;if(e)return e;const s=t.indexOf("_");return s!==-1?t.slice(s+1).toUpperCase():t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,i]=e.split(".."),a=s?parseFloat(s):null,o=i?parseFloat(i):null,n=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} MB`;return a!==null&&o!==null?`${n(a)} – ${n(o)}`:a!==null?`> ${n(a)}`:o!==null?`< ${n(o)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===b.SIZE)return this._getSizeSummary(s);if(e===b.COLOR){const a=s.values.map(o=>o.split(" ")[0]).filter(Boolean);return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}const i=e===b.TYPE?a=>this._mapTypeLabel(a):e===b.TAGS?a=>{var o;return((o=this.tags.find(n=>n.sid===a))==null?void 0:o.label)||a}:e===b.LABELS?a=>{var o;return((o=this.labels.find(n=>n.sid===a))==null?void 0:o.name)||a}:a=>a;return s.values.length===1?i(s.values[0]):`${i(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,i=[...s.resolution,...s.orientation,...s.faces];return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}return""}_getDateSummary(t){var n,c;const e=((n=di.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...vs,...pi],i=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.label)||t.preset:"",a=d=>{try{return d.split("T")[0]}catch{return d}};let o="";switch(t.kind){case"preset":o=i;break;case"before":o=t.to?`Before ${a(t.to)}`:i;break;case"after":o=t.from?`After ${a(t.from)}`:i;break;case"between":t.from&&t.to?o=`${a(t.from)} – ${a(t.to)}`:t.from?o=`After ${a(t.from)}`:t.to&&(o=`Before ${a(t.to)}`);break;case"specific":o=t.from?a(t.from):"";break;default:o=i}return o?`${e}: ${o}`:""}_getFilterIcon(t){var e;return((e=ds.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return(s==null?void 0:s.label)||e}_getMetadataIcon(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(i=>i.key===e);return s&&It[s.type]||"file-text"}_stripMetadataPrefix(t){for(const e of ri)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const i=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:i.left,right:i.right,bottom:i.bottom,width:i.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),i=e.type==="date";return r.html`
|
|
4098
4098
|
<span class="chip forced">
|
|
4099
|
-
${(i||t===
|
|
4100
|
-
<span class="chip-label">${
|
|
4099
|
+
${(i||t===b.TYPE||t===b.SIZE)&&s?r.html`<span class="chip-label">${s}</span>`:r.html`
|
|
4100
|
+
<span class="chip-label">${et[t]||t}</span>
|
|
4101
4101
|
${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
|
|
4102
4102
|
`}
|
|
4103
4103
|
<span class="chip-lock">
|
|
@@ -4107,15 +4107,15 @@
|
|
|
4107
4107
|
`}_renderFilterChip(t,e){if(!e)return r.html`
|
|
4108
4108
|
<span class="chip pinned-empty ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
|
|
4109
4109
|
<span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
|
|
4110
|
-
<span class="chip-label">${
|
|
4110
|
+
<span class="chip-label">${et[t]||t}</span>
|
|
4111
4111
|
<span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
|
|
4112
4112
|
</span>
|
|
4113
4113
|
`;const s=this._getFilterSummary(e,t),i=e.type==="date";return r.html`
|
|
4114
4114
|
<span class="chip ${t===this.activeFilter?"active":""}" @click=${a=>this._openFilter(t,a)}>
|
|
4115
|
-
${(i||t===
|
|
4115
|
+
${(i||t===b.TYPE||t===b.SIZE)&&s?r.html`
|
|
4116
4116
|
<span class="chip-icon"><ap-icon name=${this._getFilterIcon(t)} .size=${16}></ap-icon></span>
|
|
4117
4117
|
<span class="chip-label">${s}</span>`:r.html`
|
|
4118
|
-
<span class="chip-label">${
|
|
4118
|
+
<span class="chip-label">${et[t]||t}</span>
|
|
4119
4119
|
${s?r.html`<span class="chip-summary">${s}</span>`:r.nothing}
|
|
4120
4120
|
`}
|
|
4121
4121
|
<button class="chip-remove" @click=${a=>{a.stopPropagation(),this._removeFilter(t)}} title="Remove filter">
|
|
@@ -4137,32 +4137,32 @@
|
|
|
4137
4137
|
<ap-icon name="close" .size=${12}></ap-icon>
|
|
4138
4138
|
</button>
|
|
4139
4139
|
</span>
|
|
4140
|
-
`}render(){const t=
|
|
4140
|
+
`}render(){const t=ps(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),o=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),c=s.filter(g=>!a.has(g)),d=i.filter(g=>!o.has(g)),h=this.pendingFilter&&!a.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!o.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+i.length>0;return e.size+n.length+this.pinnedMetadataFields.length+c.length+d.length+(h?1:0)+(u?1:0)===0?r.nothing:r.html`
|
|
4141
4141
|
<div class="chips-row">
|
|
4142
4142
|
<div class="chips">
|
|
4143
|
-
${[...e].map(
|
|
4144
|
-
${n.map(
|
|
4145
|
-
${this.pinnedMetadataFields.map(
|
|
4146
|
-
${c.map(
|
|
4143
|
+
${[...e].map(g=>this._renderForcedChip(g,t[g]))}
|
|
4144
|
+
${n.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
|
|
4145
|
+
${this.pinnedMetadataFields.map(g=>this._renderMetadataChip(g,this.appliedMetadata[g]))}
|
|
4146
|
+
${c.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
|
|
4147
4147
|
${h?r.html`
|
|
4148
|
-
<span class="chip pinned-empty active pending" @click=${
|
|
4148
|
+
<span class="chip pinned-empty active pending" @click=${g=>this._openFilter(this.pendingFilter,g)}>
|
|
4149
4149
|
<span class="chip-icon"><ap-icon name=${this._getFilterIcon(this.pendingFilter)} .size=${16}></ap-icon></span>
|
|
4150
|
-
<span class="chip-label">${
|
|
4150
|
+
<span class="chip-label">${et[this.pendingFilter]||this.pendingFilter}</span>
|
|
4151
4151
|
<span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
|
|
4152
4152
|
</span>
|
|
4153
4153
|
`:r.nothing}
|
|
4154
|
-
${d.map(
|
|
4154
|
+
${d.map(g=>this._renderMetadataChip(g,this.appliedMetadata[g]))}
|
|
4155
4155
|
${u?r.html`
|
|
4156
|
-
<span class="chip pinned-empty active pending" @click=${
|
|
4156
|
+
<span class="chip pinned-empty active pending" @click=${g=>this._openMetadataFilter(this.pendingMetadataField,g)}>
|
|
4157
4157
|
<span class="chip-icon"><ap-icon name=${this._getMetadataIcon(this.pendingMetadataField)} .size=${16}></ap-icon></span>
|
|
4158
4158
|
<span class="chip-label">${this._getMetadataLabel(this.pendingMetadataField)}</span>
|
|
4159
4159
|
<span class="chip-chevron"><ap-icon name="chevron-down" .size=${14}></ap-icon></span>
|
|
4160
4160
|
</span>
|
|
4161
4161
|
`:r.nothing}
|
|
4162
|
-
${
|
|
4162
|
+
${f?r.html`<button class="clear-all" @click=${this._clearAll}>Clear filters</button>`:r.nothing}
|
|
4163
4163
|
</div>
|
|
4164
4164
|
</div>
|
|
4165
|
-
`}};
|
|
4165
|
+
`}};q.styles=r.css`
|
|
4166
4166
|
:host {
|
|
4167
4167
|
display: block;
|
|
4168
4168
|
}
|
|
@@ -4309,7 +4309,7 @@
|
|
|
4309
4309
|
align-items: center;
|
|
4310
4310
|
opacity: 0.6;
|
|
4311
4311
|
}
|
|
4312
|
-
`;
|
|
4312
|
+
`;se([l.property({type:Object})],q.prototype,"appliedFilters",2);se([l.property({type:Object})],q.prototype,"appliedMetadata",2);se([l.property({type:Object})],q.prototype,"forcedFilters",2);se([l.property({type:Array})],q.prototype,"metadataFields",2);se([l.property({type:Array})],q.prototype,"pinnedFilters",2);se([l.property({type:Array})],q.prototype,"pinnedMetadataFields",2);se([l.property({type:Array})],q.prototype,"tags",2);se([l.property({type:Array})],q.prototype,"labels",2);se([l.property()],q.prototype,"activeFilter",2);se([l.property()],q.prototype,"activeMetadataField",2);se([l.property()],q.prototype,"pendingFilter",2);se([l.property()],q.prototype,"pendingMetadataField",2);q=se([l.customElement("ap-filters-bar")],q);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,_e=(t,e,s,i)=>{for(var a=i>1?void 0:i?ar(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ir(e,s,a),a};const or=6;let de=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.gridSize="normal",this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){const t=this.gridSize==="large"?"280px":"220px";return r.html`
|
|
4313
4313
|
<div class="grid" role="list" aria-label="Assets" style="--ap-grid-min-col: ${t}">
|
|
4314
4314
|
${this.folders.map((e,s)=>r.html`
|
|
4315
4315
|
<ap-folder-card
|
|
@@ -4345,7 +4345,7 @@
|
|
|
4345
4345
|
</div>
|
|
4346
4346
|
</div>`):r.nothing}
|
|
4347
4347
|
</div>
|
|
4348
|
-
`}};
|
|
4348
|
+
`}};de.styles=r.css`
|
|
4349
4349
|
:host {
|
|
4350
4350
|
display: block;
|
|
4351
4351
|
padding: 0 20px 16px;
|
|
@@ -4400,7 +4400,7 @@
|
|
|
4400
4400
|
@media (prefers-reduced-motion: reduce) {
|
|
4401
4401
|
.ghost-thumb, .ghost-line { animation: none; }
|
|
4402
4402
|
}
|
|
4403
|
-
`;
|
|
4403
|
+
`;_e([l.property({type:Array})],de.prototype,"assets",2);_e([l.property({type:Array})],de.prototype,"folders",2);_e([l.property({type:Object})],de.prototype,"folderPreviews",2);_e([l.property({type:Array})],de.prototype,"selectedIds",2);_e([l.property({type:Array})],de.prototype,"selectedFolderIds",2);_e([l.property({type:Boolean})],de.prototype,"isLoading",2);_e([l.property({type:Boolean})],de.prototype,"multiSelect",2);_e([l.property({type:Boolean})],de.prototype,"folderSelectable",2);_e([l.property({type:String})],de.prototype,"gridSize",2);de=_e([l.customElement("ap-grid-view")],de);var rr=Object.defineProperty,nr=Object.getOwnPropertyDescriptor,pe=(t,e,s,i)=>{for(var a=i>1?void 0:i?nr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&rr(e,s,a),a};const lr=5;let Q=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.selectedFolderIds=[],this.isLoading=!1,this.multiSelect=!0,this.folderSelectable=!1,this.totalCount=0,this.isSelectingAll=!1,this.folderPreviews={},this._compactLevel=0}connectedCallback(){super.connectedCallback(),this._resizeObserver=new ResizeObserver(t=>{var i;const e=((i=t[0])==null?void 0:i.contentRect.width)??0,s=e<550?2:e<680?1:0;s!==this._compactLevel&&(this._compactLevel=s)}),this._resizeObserver.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._resizeObserver)==null||t.disconnect()}_getGridColumns(t){const e=[];return t&&e.push("32px"),e.push("48px"),e.push("minmax(120px, 1fr)"),e.push("72px"),this._compactLevel<2&&e.push("100px"),this._compactLevel<1&&e.push("120px"),e.push("64px"),e.join(" ")}get _allVisibleSelected(){if(this.assets.length===0&&this.folders.length===0||this.selectedIds.length===0&&this.selectedFolderIds.length===0)return!1;const t=new Set(this.selectedIds),e=this.assets.length===0||this.assets.every(a=>t.has(a.uuid));if(!this.folderSelectable)return e&&this.assets.length>0;const s=new Set(this.selectedFolderIds),i=this.folders.length===0||this.folders.every(a=>s.has(a.uuid));return e&&i}_handleHeaderCheckboxClick(){if(this.isSelectingAll)return;const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length;this._allVisibleSelected&&e>=t?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:"all"},bubbles:!0,composed:!0}))}render(){const t=this.folderSelectable?this.totalCount+this.folders.length:this.totalCount,e=this.folderSelectable?this.selectedIds.length+this.selectedFolderIds.length:this.selectedIds.length,s=this._allVisibleSelected&&e>=t;return r.html`
|
|
4404
4404
|
<div class="list-header" style="grid-template-columns: ${this._getGridColumns(this.multiSelect)}" role="row" aria-label="Column headers">
|
|
4405
4405
|
${this.multiSelect?r.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
|
|
4406
4406
|
<div class="header-check-box ${s?"checked":e>0?"indeterminate":""}">
|
|
@@ -4459,7 +4459,7 @@
|
|
|
4459
4459
|
</div>
|
|
4460
4460
|
`}):r.nothing}
|
|
4461
4461
|
</div>
|
|
4462
|
-
`}};
|
|
4462
|
+
`}};Q.styles=r.css`
|
|
4463
4463
|
:host {
|
|
4464
4464
|
display: block;
|
|
4465
4465
|
padding: 0 20px 16px;
|
|
@@ -4546,7 +4546,7 @@
|
|
|
4546
4546
|
@media (prefers-reduced-motion: reduce) {
|
|
4547
4547
|
.ghost-el { animation: none; }
|
|
4548
4548
|
}
|
|
4549
|
-
`;
|
|
4549
|
+
`;pe([l.property({type:Array})],Q.prototype,"assets",2);pe([l.property({type:Array})],Q.prototype,"folders",2);pe([l.property({type:Array})],Q.prototype,"selectedIds",2);pe([l.property({type:Array})],Q.prototype,"selectedFolderIds",2);pe([l.property({type:Boolean})],Q.prototype,"isLoading",2);pe([l.property({type:Boolean})],Q.prototype,"multiSelect",2);pe([l.property({type:Boolean})],Q.prototype,"folderSelectable",2);pe([l.property({type:Number})],Q.prototype,"totalCount",2);pe([l.property({type:Boolean})],Q.prototype,"isSelectingAll",2);pe([l.property({type:Object})],Q.prototype,"folderPreviews",2);pe([l.state()],Q.prototype,"_compactLevel",2);Q=pe([l.customElement("ap-list-view")],Q);function xs(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,i=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,i)).toFixed(i===0?0:1)} ${e[i]}`}function jt(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function _i(t,e){return!t||!e?"":`${t} x ${e}`}var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,Ct=(t,e,s,i)=>{for(var a=i>1?void 0:i?dr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&cr(e,s,a),a};let He=class extends r.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),i=Math.floor(t%60),a=o=>String(o).padStart(2,"0");return e>0?`${e}:${a(s)}:${a(i)}`:`${a(s)}:${a(i)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f,p;const t=this.asset;if(!t)return r.html``;const s=tt(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=si(t.extension||"");let o="";s?o=ai(t):i?o=gs(t):a&&(o=zt(t));const n=$t(t.extension||""),c=us(t.extension||"");return r.html`
|
|
4550
4550
|
<div class="card" @click=${this._handleSelect}>
|
|
4551
4551
|
<div class="thumbnail ${c&&o?"chess":""}">
|
|
4552
4552
|
${o?r.html`<img
|
|
@@ -4554,12 +4554,12 @@
|
|
|
4554
4554
|
alt=${t.name}
|
|
4555
4555
|
loading="lazy"
|
|
4556
4556
|
class="thumb-img ${c?"transparent-asset":""}"
|
|
4557
|
-
@error=${
|
|
4557
|
+
@error=${g=>{const m=g.target,_=st();m.src!==n&&m.src!==_?(m.src=n,m.classList.add("icon-fallback")):m.src!==_&&(m.src=_)}}
|
|
4558
4558
|
/>`:r.html`<img
|
|
4559
4559
|
src=${n}
|
|
4560
4560
|
alt=${t.name}
|
|
4561
4561
|
class="thumb-img icon-fallback"
|
|
4562
|
-
@error=${
|
|
4562
|
+
@error=${g=>{const m=g.target,_=st();m.src!==_&&(m.src=_)}}
|
|
4563
4563
|
/>`}
|
|
4564
4564
|
${s&&(((h=t.info)==null?void 0:h.video_duration)??((u=t.info)==null?void 0:u.duration))!=null?r.html`<span class="duration">${this._formatDuration(t.info.video_duration??t.info.duration)}</span>`:r.nothing}
|
|
4565
4565
|
<div class="overlay">
|
|
@@ -4584,10 +4584,10 @@
|
|
|
4584
4584
|
</div>
|
|
4585
4585
|
<div class="info">
|
|
4586
4586
|
<div class="name" title=${t.name}>${t.name}</div>
|
|
4587
|
-
<div class="meta">${(
|
|
4587
|
+
<div class="meta">${(f=t.extension)==null?void 0:f.toUpperCase()}${(()=>{var y,C,x,M;const g=((y=t.info)==null?void 0:y.img_w)||((C=t.info)==null?void 0:C.video_w),m=((x=t.info)==null?void 0:x.img_h)||((M=t.info)==null?void 0:M.video_h),_=_i(g,m);return _?` · ${_}`:""})()} · ${xs(((p=t.size)==null?void 0:p.bytes)||0)}</div>
|
|
4588
4588
|
</div>
|
|
4589
4589
|
</div>
|
|
4590
|
-
`}};
|
|
4590
|
+
`}};He.styles=r.css`
|
|
4591
4591
|
:host {
|
|
4592
4592
|
display: block;
|
|
4593
4593
|
animation: ap-card-in 300ms ease-out both;
|
|
@@ -4766,7 +4766,7 @@
|
|
|
4766
4766
|
:host { animation: none; }
|
|
4767
4767
|
.overlay { transition: none; }
|
|
4768
4768
|
}
|
|
4769
|
-
`;
|
|
4769
|
+
`;Ct([l.property({type:Object})],He.prototype,"asset",2);Ct([l.property({type:Number})],He.prototype,"index",2);Ct([l.property({type:Boolean,reflect:!0})],He.prototype,"selected",2);Ct([l.property({type:Boolean})],He.prototype,"multiSelect",2);He=Ct([l.customElement("ap-asset-card")],He);var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,dt=(t,e,s,i)=>{for(var a=i>1?void 0:i?hr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&pr(e,s,a),a};let Oe=class extends r.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_handleSelect(t){if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u;const t=this.asset;if(!t)return r.html``;const s=tt(t.type)==="video",i=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",a=si(t.extension||"");let o="";s?o=ai(t):i?o=gs(t):a&&(o=zt(t));const n=$t(t.extension||""),c=us(t.extension||"");return r.html`
|
|
4770
4770
|
<div class="row" style="grid-template-columns: ${this._getGridColumns()}" @click=${this._handleSelect}>
|
|
4771
4771
|
${this.multiSelect?r.html`
|
|
4772
4772
|
<div class="check">
|
|
@@ -4783,18 +4783,18 @@
|
|
|
4783
4783
|
alt=${t.name}
|
|
4784
4784
|
class="${c?"transparent-asset":""}"
|
|
4785
4785
|
loading="lazy"
|
|
4786
|
-
@error=${
|
|
4786
|
+
@error=${f=>{const p=f.target,g=st();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
|
|
4787
4787
|
/>`:r.html`<img
|
|
4788
4788
|
src=${n}
|
|
4789
4789
|
alt=${t.name}
|
|
4790
4790
|
class="icon-fallback"
|
|
4791
|
-
@error=${
|
|
4791
|
+
@error=${f=>{const p=f.target,g=st();p.src!==g&&(p.src=g)}}
|
|
4792
4792
|
/>`}
|
|
4793
4793
|
</div>
|
|
4794
4794
|
<div class="name" title=${t.name}>${t.name}</div>
|
|
4795
4795
|
<div class="type">${(h=t.extension)==null?void 0:h.toUpperCase()}</div>
|
|
4796
|
-
${this.compactLevel<2?r.html`<div class="desc">${
|
|
4797
|
-
${this.compactLevel<1?r.html`<div class="date">${
|
|
4796
|
+
${this.compactLevel<2?r.html`<div class="desc">${xs(((u=t.size)==null?void 0:u.bytes)||0)}</div>`:r.nothing}
|
|
4797
|
+
${this.compactLevel<1?r.html`<div class="date">${jt(t.created_at||"")}</div>`:r.nothing}
|
|
4798
4798
|
<div class="actions">
|
|
4799
4799
|
<button class="icon-btn select-btn" @click=${this._handleQuickSelect} aria-label="Select" title="Select">
|
|
4800
4800
|
<ap-icon name="select" .size=${16}></ap-icon>
|
|
@@ -4804,7 +4804,7 @@
|
|
|
4804
4804
|
</button>
|
|
4805
4805
|
</div>
|
|
4806
4806
|
</div>
|
|
4807
|
-
`}};
|
|
4807
|
+
`}};Oe.styles=r.css`
|
|
4808
4808
|
:host {
|
|
4809
4809
|
display: block;
|
|
4810
4810
|
}
|
|
@@ -4934,14 +4934,14 @@
|
|
|
4934
4934
|
:host([selected]) .check-icon {
|
|
4935
4935
|
display: block;
|
|
4936
4936
|
}
|
|
4937
|
-
`;
|
|
4937
|
+
`;dt([l.property({type:Object})],Oe.prototype,"asset",2);dt([l.property({type:Number})],Oe.prototype,"index",2);dt([l.property({type:Boolean,reflect:!0})],Oe.prototype,"selected",2);dt([l.property({type:Boolean})],Oe.prototype,"multiSelect",2);dt([l.property({type:Number})],Oe.prototype,"compactLevel",2);Oe=dt([l.customElement("ap-asset-row")],Oe);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Ye=(t,e,s,i)=>{for(var a=i>1?void 0:i?gr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ur(e,s,a),a};let ke=class extends r.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0}_handleClick(t){if(!this.selectable){this._handleOpen();return}if(t.composedPath().some(i=>i instanceof HTMLElement&&(i.classList.contains("check")||i.classList.contains("check-box")))){t.stopPropagation(),this.dispatchEvent(new CustomEvent("folder-select",{detail:{folder:this.folder,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0,composed:!0}));return}this._handleOpen()}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_getPreviewUrl(t){return oi(t,"200")}_renderPreviewImg(t){const e=ii(t.file_type),s=this._getPreviewUrl(t),i=$t(Ht(t.file_type)),a=st();return r.html`<div class="preview-slot ${e?"icon-bg":""}">
|
|
4938
4938
|
<img
|
|
4939
4939
|
class="preview-img ${e?"icon-mode":""}"
|
|
4940
4940
|
src="${s||i}"
|
|
4941
4941
|
alt=""
|
|
4942
4942
|
loading="lazy"
|
|
4943
4943
|
@error=${o=>{const n=o.target,c=n.parentElement;n.src!==i&&n.src!==a?(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==a&&(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
|
|
4944
|
-
@load=${o=>{const n=o.target,c=n.parentElement;n.src.includes("
|
|
4944
|
+
@load=${o=>{const n=o.target,c=n.parentElement;n.src.includes("assets/file-types")&&(n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
|
|
4945
4945
|
/>
|
|
4946
4946
|
</div>`}_renderPreviews(){if(this.previews.length===0)return r.html`<div class="empty-preview"><ap-icon name="inbox" .size=${64}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?r.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:r.html`
|
|
4947
4947
|
<div class="preview-grid">
|
|
@@ -4981,7 +4981,7 @@
|
|
|
4981
4981
|
</div>
|
|
4982
4982
|
</div>
|
|
4983
4983
|
</div>
|
|
4984
|
-
`}}
|
|
4984
|
+
`}};ke.styles=[Y,r.css`
|
|
4985
4985
|
:host {
|
|
4986
4986
|
display: block;
|
|
4987
4987
|
}
|
|
@@ -5159,7 +5159,7 @@
|
|
|
5159
5159
|
:host([selected]) .check-icon {
|
|
5160
5160
|
display: block;
|
|
5161
5161
|
}
|
|
5162
|
-
`];
|
|
5162
|
+
`];Ye([l.property({type:Object})],ke.prototype,"folder",2);Ye([l.property({type:Array})],ke.prototype,"previews",2);Ye([l.property({type:Boolean,reflect:!0})],ke.prototype,"selected",2);Ye([l.property({type:Boolean})],ke.prototype,"selectable",2);Ye([l.property({type:Boolean})],ke.prototype,"multiSelect",2);Ye([l.property({type:Number})],ke.prototype,"index",2);ke=Ye([l.customElement("ap-folder-card")],ke);var fr=Object.defineProperty,vr=Object.getOwnPropertyDescriptor,Ie=(t,e,s,i)=>{for(var a=i>1?void 0:i?vr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&fr(e,s,a),a};let ve=class extends r.LitElement{constructor(){super(...arguments),this.previews=[],this.selected=!1,this.selectable=!1,this.multiSelect=!0,this.index=0,this.compactLevel=0}_getGridColumns(){const t=[];return this.multiSelect&&t.push("32px"),t.push("48px"),t.push("minmax(120px, 1fr)"),t.push("72px"),this.compactLevel<2&&t.push("100px"),this.compactLevel<1&&t.push("120px"),t.push("64px"),t.join(" ")}_renderPreviewImg(t){const e=ii(t.file_type),s=oi(t,"80"),i=$t(Ht(t.file_type)),a=st();return r.html`<div class="preview-slot ${e?"icon-bg":""}"><img
|
|
5163
5163
|
class="preview-img ${e?"icon-mode":""}"
|
|
5164
5164
|
src="${s||i}"
|
|
5165
5165
|
alt=""
|
|
@@ -5191,10 +5191,10 @@
|
|
|
5191
5191
|
<div class="name">${t.name}</div>
|
|
5192
5192
|
<div class="meta">Folder</div>
|
|
5193
5193
|
${this.compactLevel<2?r.html`<div class="meta">${((e=t.count)==null?void 0:e.files_recursive)??((s=t.count)==null?void 0:s.files_direct)??0} items</div>`:r.nothing}
|
|
5194
|
-
${this.compactLevel<1?r.html`<div class="meta">${
|
|
5194
|
+
${this.compactLevel<1?r.html`<div class="meta">${jt(t.modified_at||t.updated_at||"")}</div>`:r.nothing}
|
|
5195
5195
|
<div></div>
|
|
5196
5196
|
</div>
|
|
5197
|
-
`:r.html``}};
|
|
5197
|
+
`:r.html``}};ve.styles=r.css`
|
|
5198
5198
|
:host {
|
|
5199
5199
|
display: block;
|
|
5200
5200
|
}
|
|
@@ -5313,7 +5313,7 @@
|
|
|
5313
5313
|
:host([selected]) .check-icon {
|
|
5314
5314
|
display: block;
|
|
5315
5315
|
}
|
|
5316
|
-
`;
|
|
5316
|
+
`;Ie([l.property({type:Object})],ve.prototype,"folder",2);Ie([l.property({type:Array})],ve.prototype,"previews",2);Ie([l.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);Ie([l.property({type:Boolean})],ve.prototype,"selectable",2);Ie([l.property({type:Boolean})],ve.prototype,"multiSelect",2);Ie([l.property({type:Number})],ve.prototype,"index",2);Ie([l.property({type:Number})],ve.prototype,"compactLevel",2);ve=Ie([l.customElement("ap-folder-row")],ve);var mr=Object.defineProperty,br=Object.getOwnPropertyDescriptor,ws=(t,e,s,i)=>{for(var a=i>1?void 0:i?br(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&mr(e,s,a),a};let ft=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
|
|
5317
5317
|
<div class="card" @click=${this._handleClick}>
|
|
5318
5318
|
<div class="icon-wrapper" style="background: color-mix(in srgb, ${s} 10%, transparent)">
|
|
5319
5319
|
<ap-icon name="tag" .size=${18} style="color: ${s}"></ap-icon>
|
|
@@ -5323,7 +5323,7 @@
|
|
|
5323
5323
|
<div class="count">${e} asset${e!==1?"s":""}</div>
|
|
5324
5324
|
</div>
|
|
5325
5325
|
</div>
|
|
5326
|
-
`}};ft.styles=[
|
|
5326
|
+
`}};ft.styles=[Y,r.css`
|
|
5327
5327
|
:host {
|
|
5328
5328
|
display: block;
|
|
5329
5329
|
}
|
|
@@ -5370,7 +5370,7 @@
|
|
|
5370
5370
|
color: var(--ap-secondary-foreground, oklch(53.03% 0.039 249.89));
|
|
5371
5371
|
margin-top: 2px;
|
|
5372
5372
|
}
|
|
5373
|
-
`];
|
|
5373
|
+
`];ws([l.property({type:Object})],ft.prototype,"label",2);ws([l.property({type:Number})],ft.prototype,"index",2);ft=ws([l.customElement("ap-label-card")],ft);var _r=Object.defineProperty,yr=Object.getOwnPropertyDescriptor,$s=(t,e,s,i)=>{for(var a=i>1?void 0:i?yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&_r(e,s,a),a};let vt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("label-open",{detail:{label:this.label},bubbles:!0,composed:!0}))}render(){const t=this.label;if(!t)return r.html``;const e=t.assets_count??0,s=t.color||"#94a3b8";return r.html`
|
|
5374
5374
|
<div class="row" @click=${this._handleClick}>
|
|
5375
5375
|
<div class="icon-wrapper" style="background: color-mix(in srgb, ${s} 10%, transparent)">
|
|
5376
5376
|
<ap-icon name="tag" .size=${16} style="color: ${s}"></ap-icon>
|
|
@@ -5378,7 +5378,7 @@
|
|
|
5378
5378
|
<div class="name" title=${t.name}>${t.name}</div>
|
|
5379
5379
|
<div class="count">${e} asset${e!==1?"s":""}</div>
|
|
5380
5380
|
</div>
|
|
5381
|
-
`}};
|
|
5381
|
+
`}};vt.styles=r.css`
|
|
5382
5382
|
:host {
|
|
5383
5383
|
display: block;
|
|
5384
5384
|
}
|
|
@@ -5418,7 +5418,7 @@
|
|
|
5418
5418
|
white-space: nowrap;
|
|
5419
5419
|
text-align: right;
|
|
5420
5420
|
}
|
|
5421
|
-
|
|
5421
|
+
`;$s([l.property({type:Object})],vt.prototype,"label",2);$s([l.property({type:Number})],vt.prototype,"index",2);vt=$s([l.customElement("ap-label-row")],vt);var xr=Object.defineProperty,wr=Object.getOwnPropertyDescriptor,ks=(t,e,s,i)=>{for(var a=i>1?void 0:i?wr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&xr(e,s,a),a};let mt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
|
|
5422
5422
|
<div class="card" @click=${this._handleClick}>
|
|
5423
5423
|
<div class="icon-wrapper">
|
|
5424
5424
|
<ap-icon name="layout-grid" .size=${22}></ap-icon>
|
|
@@ -5430,7 +5430,7 @@
|
|
|
5430
5430
|
<ap-icon name="chevron-right" .size=${16}></ap-icon>
|
|
5431
5431
|
</div>
|
|
5432
5432
|
</div>
|
|
5433
|
-
`:r.html``}};
|
|
5433
|
+
`:r.html``}};mt.styles=[Y,r.css`
|
|
5434
5434
|
@keyframes ap-card-in {
|
|
5435
5435
|
from { opacity: 0; transform: translateY(8px); }
|
|
5436
5436
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -5492,7 +5492,7 @@
|
|
|
5492
5492
|
opacity: 0.5;
|
|
5493
5493
|
transition: opacity 150ms;
|
|
5494
5494
|
}
|
|
5495
|
-
`];
|
|
5495
|
+
`];ks([l.property({type:Object})],mt.prototype,"collection",2);ks([l.property({type:Number})],mt.prototype,"index",2);mt=ks([l.customElement("ap-collection-card")],mt);var $r=Object.defineProperty,kr=Object.getOwnPropertyDescriptor,Ss=(t,e,s,i)=>{for(var a=i>1?void 0:i?kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&$r(e,s,a),a};let bt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_formatDate(t){if(!t)return"";try{return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})}catch{return""}}_handleClick(){this.dispatchEvent(new CustomEvent("collection-open",{detail:{collection:this.collection},bubbles:!0,composed:!0}))}render(){const t=this.collection;return t?r.html`
|
|
5496
5496
|
<div class="row" @click=${this._handleClick}>
|
|
5497
5497
|
<div class="icon-wrapper">
|
|
5498
5498
|
<ap-icon name="layout-grid" .size=${16}></ap-icon>
|
|
@@ -5503,7 +5503,7 @@
|
|
|
5503
5503
|
<ap-icon name="chevron-right" .size=${16}></ap-icon>
|
|
5504
5504
|
</div>
|
|
5505
5505
|
</div>
|
|
5506
|
-
`:r.html``}};
|
|
5506
|
+
`:r.html``}};bt.styles=r.css`
|
|
5507
5507
|
:host {
|
|
5508
5508
|
display: block;
|
|
5509
5509
|
}
|
|
@@ -5558,7 +5558,7 @@
|
|
|
5558
5558
|
opacity: 0.5;
|
|
5559
5559
|
transition: opacity 150ms;
|
|
5560
5560
|
}
|
|
5561
|
-
|
|
5561
|
+
`;Ss([l.property({type:Object})],bt.prototype,"collection",2);Ss([l.property({type:Number})],bt.prototype,"index",2);bt=Ss([l.customElement("ap-collection-row")],bt);var Sr=Object.defineProperty,Cr=Object.getOwnPropertyDescriptor,Cs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Cr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Sr(e,s,a),a};let _t=class extends r.LitElement{constructor(){super(...arguments),this.index=0}connectedCallback(){super.connectedCallback(),this.style.setProperty("--ap-stagger-index",String(this.index))}updated(t){t.has("index")&&this.style.setProperty("--ap-stagger-index",String(this.index))}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
|
|
5562
5562
|
<div class="card" @click=${this._handleClick}>
|
|
5563
5563
|
<div class="icon-wrapper">
|
|
5564
5564
|
<ap-icon name="folder" .size=${22}></ap-icon>
|
|
@@ -5570,7 +5570,7 @@
|
|
|
5570
5570
|
<ap-icon name="chevron-right" .size=${16}></ap-icon>
|
|
5571
5571
|
</div>
|
|
5572
5572
|
</div>
|
|
5573
|
-
`:r.html``}};
|
|
5573
|
+
`:r.html``}};_t.styles=[Y,r.css`
|
|
5574
5574
|
@keyframes ap-card-in {
|
|
5575
5575
|
from { opacity: 0; transform: translateY(8px); }
|
|
5576
5576
|
to { opacity: 1; transform: translateY(0); }
|
|
@@ -5628,7 +5628,7 @@
|
|
|
5628
5628
|
opacity: 0.5;
|
|
5629
5629
|
transition: opacity 150ms;
|
|
5630
5630
|
}
|
|
5631
|
-
`];
|
|
5631
|
+
`];Cs([l.property({type:Object})],_t.prototype,"folder",2);Cs([l.property({type:Number})],_t.prototype,"index",2);_t=Cs([l.customElement("ap-collection-folder-card")],_t);var Fr=Object.defineProperty,Er=Object.getOwnPropertyDescriptor,Fs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Er(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Fr(e,s,a),a};let yt=class extends r.LitElement{constructor(){super(...arguments),this.index=0}_handleClick(){this.dispatchEvent(new CustomEvent("collection-folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){const t=this.folder;return t?r.html`
|
|
5632
5632
|
<div class="row" @click=${this._handleClick}>
|
|
5633
5633
|
<div class="icon-wrapper">
|
|
5634
5634
|
<ap-icon name="folder" .size=${16}></ap-icon>
|
|
@@ -5638,7 +5638,7 @@
|
|
|
5638
5638
|
<ap-icon name="chevron-right" .size=${16}></ap-icon>
|
|
5639
5639
|
</div>
|
|
5640
5640
|
</div>
|
|
5641
|
-
`:r.html``}};
|
|
5641
|
+
`:r.html``}};yt.styles=r.css`
|
|
5642
5642
|
:host {
|
|
5643
5643
|
display: block;
|
|
5644
5644
|
}
|
|
@@ -5683,7 +5683,7 @@
|
|
|
5683
5683
|
opacity: 0.5;
|
|
5684
5684
|
transition: opacity 150ms;
|
|
5685
5685
|
}
|
|
5686
|
-
`;
|
|
5686
|
+
`;Fs([l.property({type:Object})],yt.prototype,"folder",2);Fs([l.property({type:Number})],yt.prototype,"index",2);yt=Fs([l.customElement("ap-collection-folder-row")],yt);var Ar=Object.defineProperty,Tr=Object.getOwnPropertyDescriptor,Ft=(t,e,s,i)=>{for(var a=i>1?void 0:i?Tr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Ar(e,s,a),a};let Ge=class extends r.LitElement{constructor(){super(...arguments),this.variant="grid",this.gridSize="normal",this.multiSelect=!0,this.folderCount=0}render(){if(this.variant==="grid"){const n=this.gridSize==="large"?"280px":"220px";return r.html`
|
|
5687
5687
|
<div class="grid-skeleton" style="--ap-grid-min-col: ${n}">
|
|
5688
5688
|
${Array.from({length:18},()=>r.html`<div class="card-skel">
|
|
5689
5689
|
<div class="skeleton card-skel-thumb"></div>
|
|
@@ -5729,7 +5729,7 @@
|
|
|
5729
5729
|
</div>
|
|
5730
5730
|
${Array.from({length:this.folderCount},()=>s)}
|
|
5731
5731
|
${Array.from({length:o},(n,c)=>i(a[c%a.length]))}
|
|
5732
|
-
`}};
|
|
5732
|
+
`}};Ge.styles=r.css`
|
|
5733
5733
|
:host {
|
|
5734
5734
|
display: block;
|
|
5735
5735
|
padding: 0 20px 16px;
|
|
@@ -5854,7 +5854,7 @@
|
|
|
5854
5854
|
@media (prefers-reduced-motion: reduce) {
|
|
5855
5855
|
.skeleton { animation: none; }
|
|
5856
5856
|
}
|
|
5857
|
-
`;
|
|
5857
|
+
`;Ft([l.property({reflect:!0})],Ge.prototype,"variant",2);Ft([l.property({type:String})],Ge.prototype,"gridSize",2);Ft([l.property({type:Boolean})],Ge.prototype,"multiSelect",2);Ft([l.property({type:Number})],Ge.prototype,"folderCount",2);Ge=Ft([l.customElement("ap-skeleton")],Ge);var Lr=Object.defineProperty,Or=Object.getOwnPropertyDescriptor,U=(t,e,s,i)=>{for(var a=i>1?void 0:i?Or(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Lr(e,s,a),a};let z=class extends r.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=tt(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var i,a;const e=Vt(t);if(!e||(await this.updateComplete,((i=this.asset)==null?void 0:i.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:o}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!o.isSupported()||((a=this.asset)==null?void 0:a.uuid)!==t.uuid||!this.isConnected)return;const n=new o;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(o.Events.ERROR,(c,d)=>{var h;d.fatal&&(this._destroyHls(),s.src=((h=t.url)==null?void 0:h.cdn)||"")})}catch{}}}_onFullscreenChange(){this._isFullscreen=!!document.fullscreenElement,this._isFullscreen&&(this._fsImageLoaded=!1)}_close(){this.dispatchEvent(new CustomEvent("preview-close",{bubbles:!0,composed:!0}))}_exitFullscreen(){var t;(t=document.exitFullscreen)==null||t.call(document)}_fullscreen(){var e,s,i,a,o,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((a=(i=this.asset)==null?void 0:i.url)!=null&&a.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(o=this.previewArea)==null?void 0:o.requestFullscreen)==null||n.call(o)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=tt(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let i=t+e;i!==s;i+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[i]))return i;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var i,a;const e=(i=t.url)==null?void 0:i.cdn;if(!e)return zt(t)||"";if(((a=t.extension)==null?void 0:a.toLowerCase())==="svg")return e;const s=Be(e,this.containerToken);return xe(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,c;const e=(n=t.info)==null?void 0:n.img_w,s=(c=t.info)==null?void 0:c.img_h;if(!e||!s)return{width:"100vw",height:"100vh"};const i=window.innerWidth,a=window.innerHeight,o=Math.min(i/e,a/s,1);return{width:`${Math.round(e*o)}px`,height:`${Math.round(s*o)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),i=new Set;return s.filter(a=>!a.label||i.has(a.sid)?!1:(i.add(a.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.TAGS,values:[t],operator:S.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:b.LABELS,values:[t],operator:S.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return r.nothing;const s=this._openSections.has("file-info");return r.html`
|
|
5858
5858
|
<div class="accordion">
|
|
5859
5859
|
<button
|
|
5860
5860
|
class="accordion-trigger"
|
|
@@ -5898,7 +5898,7 @@
|
|
|
5898
5898
|
`)}
|
|
5899
5899
|
</div>
|
|
5900
5900
|
</div>
|
|
5901
|
-
`}_getFileInfoRows(t){var s,i,a,o,n,c;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:
|
|
5901
|
+
`}_getFileInfoRows(t){var s,i,a,o,n,c;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:xs(t.size.bytes)}),(i=t.info)!=null&&i.img_w&&e.push({label:"Dimensions",value:_i(t.info.img_w,t.info.img_h)}),(a=t.info)!=null&&a.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(((o=t.info)==null?void 0:o.video_duration)??((n=t.info)==null?void 0:n.duration))!=null&&e.push({label:"Duration",value:`${Math.round(t.info.video_duration??t.info.duration)}s`}),(c=t.info)!=null&&c.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:jt(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:jt(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var i;if(!((i=e.possible_values)!=null&&i.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(a=>a.internal_unique_value===t||a.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const i=this.regionalFilters[e.regionalVariantsGroupUuid];if(i){const a=t[i];if(a!=null&&a!=="")return this._resolveFieldValue(a,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(a=>this._resolveSlug(String(a),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const i=JSON.stringify(t);return i==="{}"||i==="[]"?"":i}return String(t)}_getAllMetadataRows(t){var o,n,c,d;const e=[],s=this._buildFieldMap(),i=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const f=h[u.key]??((n=(o=t.info)==null?void 0:o.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(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," "),m=p.length>50;e.push({label:g,value:p,wrap:m})}}const a=(d=t.info)==null?void 0:d.metadata;if(a&&typeof a=="object")for(const[h,u]of Object.entries(a)){if(i.has(h)||u==null||u==="")continue;const 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," "),m=p.length>50;e.push({label:g,value:p,wrap:m})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?r.nothing:r.html`
|
|
5902
5902
|
<div class="meta-row" style="flex-direction:column;gap:6px">
|
|
5903
5903
|
<span class="meta-label">Labels</span>
|
|
5904
5904
|
<div class="tags-list">
|
|
@@ -5921,7 +5921,7 @@
|
|
|
5921
5921
|
`)}
|
|
5922
5922
|
</div>
|
|
5923
5923
|
</div>
|
|
5924
|
-
`}render(){var
|
|
5924
|
+
`}render(){var $,k,E,A,fe,ie,O,X;const t=this.asset;if(!t)return r.nothing;const e=tt(t.type),s=e==="image",i=e==="video",a=e==="audio",o=(($=t.extension)==null?void 0:$.toLowerCase())==="pdf",n=$t(t.extension||""),c=us(t.extension||""),d=((k=t.extension)==null?void 0:k.toLowerCase())==="svg",h=zt(t),u=s?d?((E=t.url)==null?void 0:E.cdn)||"":h||Be(((A=t.url)==null?void 0:A.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=i&&((fe=t.url)==null?void 0:fe.cdn)||"",m=i&&(((ie=t.info)==null?void 0:ie.video_thumbnail)||((O=t.info)==null?void 0:O.preview))||"",_=o&&!s?gs(t):"",y=this._getCurrentIndex(),C=y>0&&this._findNavTarget(y,-1)>=0,x=y>=0&&this._findNavTarget(y,1)>=0,M=this.assets.length>1;return r.html`
|
|
5925
5925
|
<div class="panel">
|
|
5926
5926
|
<div class="panel-header">
|
|
5927
5927
|
<span class="panel-title" title=${t.name}>${t.name}</span>
|
|
@@ -5940,11 +5940,11 @@
|
|
|
5940
5940
|
</div>
|
|
5941
5941
|
|
|
5942
5942
|
<div class="preview-area ${s&&c?"chess":""}">
|
|
5943
|
-
${
|
|
5944
|
-
<button class="nav-btn prev" @click=${this._prev} ?disabled=${!
|
|
5943
|
+
${M?r.html`
|
|
5944
|
+
<button class="nav-btn prev" @click=${this._prev} ?disabled=${!C} aria-label="Previous">
|
|
5945
5945
|
<ap-icon name="chevron-left" .size=${16}></ap-icon>
|
|
5946
5946
|
</button>
|
|
5947
|
-
<button class="nav-btn next" @click=${this._next} ?disabled=${!
|
|
5947
|
+
<button class="nav-btn next" @click=${this._next} ?disabled=${!x} aria-label="Next">
|
|
5948
5948
|
<ap-icon name="chevron-right" .size=${16}></ap-icon>
|
|
5949
5949
|
</button>
|
|
5950
5950
|
`:r.nothing}
|
|
@@ -5958,8 +5958,8 @@
|
|
|
5958
5958
|
<img
|
|
5959
5959
|
src=${u}
|
|
5960
5960
|
alt=${t.name}
|
|
5961
|
-
@load=${
|
|
5962
|
-
@error=${
|
|
5961
|
+
@load=${Z=>{Z.target.classList.remove("icon-fallback"),this._previewLoading=!1}}
|
|
5962
|
+
@error=${Z=>{const D=Z.target;this._previewLoading=!1,D.src!==n&&(D.src=n,D.classList.add("icon-fallback"))}}
|
|
5963
5963
|
/>
|
|
5964
5964
|
<div class="fs-wrapper">
|
|
5965
5965
|
${d?r.nothing:r.html`
|
|
@@ -5972,21 +5972,21 @@
|
|
|
5972
5972
|
`}
|
|
5973
5973
|
<img
|
|
5974
5974
|
class="fs-full ${d||this._fsImageLoaded?"loaded":""}"
|
|
5975
|
-
src=${this._isFullscreen?
|
|
5975
|
+
src=${this._isFullscreen?f:""}
|
|
5976
5976
|
alt=${t.name}
|
|
5977
5977
|
style=${d?"width:100vw;height:100vh":""}
|
|
5978
5978
|
@load=${this._onFsImageLoad}
|
|
5979
5979
|
/>
|
|
5980
5980
|
</div>
|
|
5981
5981
|
`:r.nothing}
|
|
5982
|
-
${i?r.html`<video src=${
|
|
5983
|
-
${a?r.html`<audio src=${((
|
|
5982
|
+
${i?r.html`<video src=${g} poster=${m||r.nothing} controls controlsList="nofullscreen" @loadeddata=${()=>{this._previewLoading=!1}} @error=${()=>{this._previewLoading=!1}}></video>`:r.nothing}
|
|
5983
|
+
${a?r.html`<audio src=${((X=t.url)==null?void 0:X.cdn)||""} controls></audio>`:r.nothing}
|
|
5984
5984
|
${o&&!s?r.html`
|
|
5985
5985
|
<img
|
|
5986
|
-
src=${
|
|
5986
|
+
src=${_||n}
|
|
5987
5987
|
alt=${t.name}
|
|
5988
|
-
class=${
|
|
5989
|
-
@error=${
|
|
5988
|
+
class=${_?"":"icon-fallback"}
|
|
5989
|
+
@error=${Z=>{const D=Z.target;D.src!==n&&(D.src=n,D.classList.add("icon-fallback"))}}
|
|
5990
5990
|
/>
|
|
5991
5991
|
`:r.nothing}
|
|
5992
5992
|
${!s&&!i&&!a&&!o?r.html`<img src=${n} alt=${t.name} class="icon-fallback" />`:r.nothing}
|
|
@@ -5997,7 +5997,7 @@
|
|
|
5997
5997
|
${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
|
|
5998
5998
|
`:r.nothing}
|
|
5999
5999
|
</div>
|
|
6000
|
-
`}};
|
|
6000
|
+
`}};z.styles=r.css`
|
|
6001
6001
|
:host {
|
|
6002
6002
|
display: block;
|
|
6003
6003
|
}
|
|
@@ -6308,7 +6308,7 @@
|
|
|
6308
6308
|
.panel { animation: none; }
|
|
6309
6309
|
.accordion-chevron { transition: none; }
|
|
6310
6310
|
}
|
|
6311
|
-
`;N([l.property({type:Object})],D.prototype,"asset",2);N([l.property({type:Array})],D.prototype,"assets",2);N([l.property({type:Array})],D.prototype,"selectedIds",2);N([l.property()],D.prototype,"containerToken",2);N([l.property({type:Boolean})],D.prototype,"showMetadata",2);N([l.property({type:Array})],D.prototype,"metadataFields",2);N([l.property({type:Array})],D.prototype,"labels",2);N([l.property({type:Object})],D.prototype,"regionalFilters",2);N([l.property({type:Boolean})],D.prototype,"multiSelect",2);N([l.query(".preview-area")],D.prototype,"previewArea",2);N([l.query("video")],D.prototype,"_videoEl",2);N([l.state()],D.prototype,"_isFullscreen",2);N([l.state()],D.prototype,"_fsImageLoaded",2);N([l.state()],D.prototype,"_previewLoading",2);N([l.state()],D.prototype,"_openSections",2);D=N([l.customElement("ap-preview-panel")],D);var Mr=Object.defineProperty,Ir=Object.getOwnPropertyDescriptor,Cs=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ir(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mr(e,s,a),a};const Pr={sparkles:[{tag:"path",attrs:{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}},{tag:"path",attrs:{d:"M5 3v4"}},{tag:"path",attrs:{d:"M19 17v4"}},{tag:"path",attrs:{d:"M3 5h4"}},{tag:"path",attrs:{d:"M17 19h4"}}],search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let yt=class extends r.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=Pr[this.name];if(!t)return r.nothing;const e=typeof t=="string"?r.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?r.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?r.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:r.svg`<path d=${a.d}></path>`});return r.html`
|
|
6311
|
+
`;U([l.property({type:Object})],z.prototype,"asset",2);U([l.property({type:Array})],z.prototype,"assets",2);U([l.property({type:Array})],z.prototype,"selectedIds",2);U([l.property()],z.prototype,"containerToken",2);U([l.property({type:Boolean})],z.prototype,"showMetadata",2);U([l.property({type:Array})],z.prototype,"metadataFields",2);U([l.property({type:Array})],z.prototype,"labels",2);U([l.property({type:Object})],z.prototype,"regionalFilters",2);U([l.property({type:Boolean})],z.prototype,"multiSelect",2);U([l.query(".preview-area")],z.prototype,"previewArea",2);U([l.query("video")],z.prototype,"_videoEl",2);U([l.state()],z.prototype,"_isFullscreen",2);U([l.state()],z.prototype,"_fsImageLoaded",2);U([l.state()],z.prototype,"_previewLoading",2);U([l.state()],z.prototype,"_openSections",2);z=U([l.customElement("ap-preview-panel")],z);var Mr=Object.defineProperty,Ir=Object.getOwnPropertyDescriptor,Es=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ir(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Mr(e,s,a),a};const Pr={sparkles:[{tag:"path",attrs:{d:"m12 3-1.912 5.813a2 2 0 0 1-1.275 1.275L3 12l5.813 1.912a2 2 0 0 1 1.275 1.275L12 21l1.912-5.813a2 2 0 0 1 1.275-1.275L21 12l-5.813-1.912a2 2 0 0 1-1.275-1.275L12 3Z"}},{tag:"path",attrs:{d:"M5 3v4"}},{tag:"path",attrs:{d:"M19 17v4"}},{tag:"path",attrs:{d:"M3 5h4"}},{tag:"path",attrs:{d:"M17 19h4"}}],search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5","check-check":[{tag:"path",attrs:{d:"M18 6 7 17l-5-5"}},{tag:"path",attrs:{d:"m22 10-7.5 7.5L13 16"}}],close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",inbox:[{tag:"path",attrs:{d:"M22 12L16 12L14 15L10 15L8 12L2 12"}},{tag:"path",attrs:{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"}}],tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],"toggle-left":[{tag:"rect",attrs:{width:"20",height:"14",x:"2",y:"5",rx:"7"}},{tag:"circle",attrs:{cx:"9",cy:"12",r:"3"}}],"file-digit":[{tag:"path",attrs:{d:"M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 16h2v6"}},{tag:"path",attrs:{d:"M10 22h4"}},{tag:"rect",attrs:{width:"4",height:"6",x:"2",y:"16",rx:"2"}}],"decimals-arrow-right":[{tag:"path",attrs:{d:"M10 18h10"}},{tag:"path",attrs:{d:"m17 21 3-3-3-3"}},{tag:"path",attrs:{d:"M3 11h.01"}},{tag:"rect",attrs:{width:"5",height:"8",x:"15",y:"3",rx:"2.5"}},{tag:"rect",attrs:{width:"5",height:"8",x:"6",y:"3",rx:"2.5"}}],"text-initial":[{tag:"path",attrs:{d:"M15 5h6"}},{tag:"path",attrs:{d:"M15 12h6"}},{tag:"path",attrs:{d:"M3 19h18"}},{tag:"path",attrs:{d:"m3 12 3.553-7.724a.5.5 0 0 1 .894 0L11 12"}},{tag:"path",attrs:{d:"M3.92 10h6.16"}}],"text-align-justify":[{tag:"path",attrs:{d:"M3 5h18"}},{tag:"path",attrs:{d:"M3 12h18"}},{tag:"path",attrs:{d:"M3 19h18"}}],paperclip:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551","link-2":[{tag:"path",attrs:{d:"M9 17H7A5 5 0 0 1 7 7h2"}},{tag:"path",attrs:{d:"M15 7h2a5 5 0 1 1 0 10h-2"}},{tag:"path",attrs:{d:"M8 12h8"}}],"circle-dot":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}}],"square-check":[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],locate:[{tag:"path",attrs:{d:"M2 12h3"}},{tag:"path",attrs:{d:"M19 12h3"}},{tag:"path",attrs:{d:"M12 2v3"}},{tag:"path",attrs:{d:"M12 19v3"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"7"}}],"list-ordered":[{tag:"path",attrs:{d:"M11 5h10"}},{tag:"path",attrs:{d:"M11 12h10"}},{tag:"path",attrs:{d:"M11 19h10"}},{tag:"path",attrs:{d:"M4 4h1v5"}},{tag:"path",attrs:{d:"M4 9h2"}},{tag:"path",attrs:{d:"M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02"}}],plus:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let xt=class extends r.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=Pr[this.name];if(!t)return r.nothing;const e=typeof t=="string"?r.svg`<path d=${t}></path>`:t.map(s=>{const{tag:i,attrs:a}=s;return i==="circle"?r.svg`<circle cx=${a.cx} cy=${a.cy} r=${a.r} fill=${a.fill??"none"}></circle>`:i==="rect"?r.svg`<rect width=${a.width} height=${a.height} x=${a.x} y=${a.y} rx=${a.rx??"0"} ry=${a.ry??"0"}></rect>`:r.svg`<path d=${a.d}></path>`});return r.html`
|
|
6312
6312
|
<svg
|
|
6313
6313
|
style="--icon-size: ${this.size}px"
|
|
6314
6314
|
viewBox="0 0 24 24"
|
|
@@ -6320,7 +6320,7 @@
|
|
|
6320
6320
|
>
|
|
6321
6321
|
${e}
|
|
6322
6322
|
</svg>
|
|
6323
|
-
`}};
|
|
6323
|
+
`}};xt.styles=[r.css`
|
|
6324
6324
|
:host {
|
|
6325
6325
|
display: inline-flex;
|
|
6326
6326
|
align-items: center;
|
|
@@ -6330,7 +6330,7 @@
|
|
|
6330
6330
|
width: var(--icon-size, 20px);
|
|
6331
6331
|
height: var(--icon-size, 20px);
|
|
6332
6332
|
}
|
|
6333
|
-
`];
|
|
6333
|
+
`];Es([l.property()],xt.prototype,"name",2);Es([l.property({type:Number})],xt.prototype,"size",2);xt=Es([l.customElement("ap-icon")],xt);var Dr=Object.defineProperty,zr=Object.getOwnPropertyDescriptor,Fe=(t,e,s,i)=>{for(var a=i>1?void 0:i?zr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Dr(e,s,a),a};let ue=class extends r.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.selectedFolders=[],this.totalCount=0,this.totalFolderCount=0,this.isSelectingAll=!1,this.multiSelect=!0,this.showTransform=!1}get _totalSelected(){return this.selectedAssets.length+this.selectedFolders.length}_formatCount(){const t=this.selectedAssets.length,e=this.selectedFolders.length;if(e===0)return`${t} selected`;if(t===0)return`${e} folder${e!==1?"s":""} selected`;const s=`${e} folder${e!==1?"s":""}`,i=`${t} asset${t!==1?"s":""}`;return`${s} and ${i} selected`}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_transform(){this.dispatchEvent(new CustomEvent("selection-transform",{detail:{assets:this.selectedAssets,folders:this.selectedFolders},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_canSelectMore(){if(this.maxSelections&&this._totalSelected>=this.maxSelections)return!1;const t=this._selectScope;return t==="assets"?this.selectedAssets.length<this.totalCount:t==="folders"?this.selectedFolders.length<this.totalFolderCount:this._totalSelected<this.totalCount+this.totalFolderCount}get _scopeTotal(){const t=this._selectScope;return t==="assets"?this.totalCount:t==="folders"?this.totalFolderCount:this.totalCount+this.totalFolderCount}get _selectScope(){const t=this.selectedAssets.length>0,e=this.selectedFolders.length>0;return t&&!e?"assets":e&&!t?"folders":"all"}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{detail:{scope:this._selectScope},bubbles:!0,composed:!0}))}render(){return this._totalSelected===0?r.nothing:r.html`
|
|
6334
6334
|
<div class="bar">
|
|
6335
6335
|
<span class="count">${this._formatCount()}</span>
|
|
6336
6336
|
${this.multiSelect?r.html`
|
|
@@ -6350,7 +6350,7 @@
|
|
|
6350
6350
|
`:r.nothing}
|
|
6351
6351
|
<button class="btn-confirm" @click=${this._confirm}>Confirm</button>
|
|
6352
6352
|
</div>
|
|
6353
|
-
`}};
|
|
6353
|
+
`}};ue.styles=r.css`
|
|
6354
6354
|
:host {
|
|
6355
6355
|
display: block;
|
|
6356
6356
|
padding: 0 8px 8px;
|
|
@@ -6441,12 +6441,12 @@
|
|
|
6441
6441
|
@media (prefers-reduced-motion: reduce) {
|
|
6442
6442
|
.bar { animation: none; }
|
|
6443
6443
|
}
|
|
6444
|
-
`;
|
|
6444
|
+
`;Fe([l.property({type:Array})],ue.prototype,"selectedAssets",2);Fe([l.property({type:Array})],ue.prototype,"selectedFolders",2);Fe([l.property({type:Number})],ue.prototype,"totalCount",2);Fe([l.property({type:Number})],ue.prototype,"totalFolderCount",2);Fe([l.property({type:Boolean})],ue.prototype,"isSelectingAll",2);Fe([l.property({type:Boolean})],ue.prototype,"multiSelect",2);Fe([l.property({type:Number})],ue.prototype,"maxSelections",2);Fe([l.property({type:Boolean})],ue.prototype,"showTransform",2);ue=Fe([l.customElement("ap-selection-bar")],ue);var Rr=Object.defineProperty,jr=Object.getOwnPropertyDescriptor,As=(t,e,s,i)=>{for(var a=i>1?void 0:i?jr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Rr(e,s,a),a};let wt=class extends r.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?r.nothing:r.html`
|
|
6445
6445
|
<div
|
|
6446
6446
|
class="marquee"
|
|
6447
6447
|
style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
|
|
6448
6448
|
></div>
|
|
6449
|
-
`}};
|
|
6449
|
+
`}};wt.styles=r.css`
|
|
6450
6450
|
:host {
|
|
6451
6451
|
display: block;
|
|
6452
6452
|
position: absolute;
|
|
@@ -6463,7 +6463,7 @@
|
|
|
6463
6463
|
background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
|
|
6464
6464
|
border-radius: 2px;
|
|
6465
6465
|
}
|
|
6466
|
-
`;
|
|
6466
|
+
`;As([l.property({type:Boolean})],wt.prototype,"active",2);As([l.property({type:Object})],wt.prototype,"rect",2);wt=As([l.customElement("ap-marquee-overlay")],wt);var Nr=Object.defineProperty,Ur=Object.getOwnPropertyDescriptor,We=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ur(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Nr(e,s,a),a};let Se=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.clearable=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(a=>!this.disabled&&!a.disabled);if(e.length===0)return;const s=e.findIndex(a=>a.value===this.value);let i=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),i=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),i=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}i!==null&&this._select(e[i])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return r.html`
|
|
6467
6467
|
${this.options.map(t=>r.html`
|
|
6468
6468
|
<div
|
|
6469
6469
|
class="option"
|
|
@@ -6477,7 +6477,7 @@
|
|
|
6477
6477
|
<span class="label">${t.label}</span>
|
|
6478
6478
|
</div>
|
|
6479
6479
|
`)}
|
|
6480
|
-
`}_select(t){if(this.disabled||t.disabled)return;const e=this.clearable&&t.value===this.value?"":t.value;this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:e},bubbles:!0,composed:!0}))}};
|
|
6480
|
+
`}_select(t){if(this.disabled||t.disabled)return;const e=this.clearable&&t.value===this.value?"":t.value;this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:e},bubbles:!0,composed:!0}))}};Se.styles=[Y,r.css`
|
|
6481
6481
|
:host {
|
|
6482
6482
|
display: flex;
|
|
6483
6483
|
flex-direction: column;
|
|
@@ -6538,7 +6538,7 @@
|
|
|
6538
6538
|
font-family: inherit;
|
|
6539
6539
|
user-select: none;
|
|
6540
6540
|
}
|
|
6541
|
-
`];
|
|
6541
|
+
`];We([l.property()],Se.prototype,"value",2);We([l.property({type:Array})],Se.prototype,"options",2);We([l.property({type:Boolean})],Se.prototype,"disabled",2);We([l.property({type:Boolean})],Se.prototype,"clearable",2);We([l.property({reflect:!0})],Se.prototype,"direction",2);We([l.property({reflect:!0})],Se.prototype,"columns",2);Se=We([l.customElement("ap-radio-group")],Se);var Br=Object.defineProperty,qr=Object.getOwnPropertyDescriptor,yi=(t,e,s,i)=>{for(var a=i>1?void 0:i?qr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Br(e,s,a),a};let Nt=class extends r.LitElement{constructor(){super(...arguments),this.size=24}render(){return r.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};Nt.styles=[r.css`
|
|
6542
6542
|
:host {
|
|
6543
6543
|
display: inline-flex;
|
|
6544
6544
|
}
|
|
@@ -6551,7 +6551,7 @@
|
|
|
6551
6551
|
@keyframes spin {
|
|
6552
6552
|
to { transform: rotate(360deg); }
|
|
6553
6553
|
}
|
|
6554
|
-
`];
|
|
6554
|
+
`];yi([l.property({type:Number})],Nt.prototype,"size",2);Nt=yi([l.customElement("ap-spinner")],Nt);var Vr=Object.defineProperty,Hr=Object.getOwnPropertyDescriptor,Yt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Hr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Vr(e,s,a),a};let ot=class extends r.LitElement{constructor(){super(...arguments),this.folders=[],this.loading=!1,this._mode="recursive"}_handleConfirm(){this.dispatchEvent(new CustomEvent("folder-resolve-confirm",{detail:{mode:this._mode},bubbles:!0,composed:!0}))}_handleCancel(){this.dispatchEvent(new CustomEvent("folder-resolve-cancel",{bubbles:!0,composed:!0}))}_handleModeChange(t){this._mode=t.detail.value}render(){const t=this.folders.length;return r.html`
|
|
6555
6555
|
<div class="backdrop" @click=${e=>{e.target===e.currentTarget&&this._handleCancel()}}>
|
|
6556
6556
|
<div class="dialog">
|
|
6557
6557
|
<div class="title">Add folder contents</div>
|
|
@@ -6573,7 +6573,7 @@
|
|
|
6573
6573
|
</div>
|
|
6574
6574
|
</div>
|
|
6575
6575
|
</div>
|
|
6576
|
-
`}};
|
|
6576
|
+
`}};ot.styles=[Y,r.css`
|
|
6577
6577
|
:host {
|
|
6578
6578
|
display: block;
|
|
6579
6579
|
}
|
|
@@ -6646,7 +6646,7 @@
|
|
|
6646
6646
|
align-items: center;
|
|
6647
6647
|
gap: 8px;
|
|
6648
6648
|
}
|
|
6649
|
-
`];
|
|
6649
|
+
`];Yt([l.property({type:Array})],ot.prototype,"folders",2);Yt([l.property({type:Boolean})],ot.prototype,"loading",2);Yt([l.state()],ot.prototype,"_mode",2);ot=Yt([l.customElement("ap-folder-resolve-dialog")],ot);var Gr=Object.defineProperty,Kr=Object.getOwnPropertyDescriptor,V=(t,e,s,i)=>{for(var a=i>1?void 0:i?Kr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Gr(e,s,a),a};let R=class extends r.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.clearable=!1,this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._menuWidth=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return r.html`
|
|
6650
6650
|
<button
|
|
6651
6651
|
class="trigger"
|
|
6652
6652
|
role="combobox"
|
|
@@ -6689,7 +6689,7 @@
|
|
|
6689
6689
|
`)}
|
|
6690
6690
|
</div>
|
|
6691
6691
|
`:r.nothing}
|
|
6692
|
-
`}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_clear(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:""},bubbles:!0,composed:!0}))}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect();this._menuWidth=t.width;const e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};
|
|
6692
|
+
`}_toggle(){this._open=!this._open,this._open?(this._focusedIndex=this.options.findIndex(t=>t.value===this.value),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption())):document.removeEventListener("click",this._handleOutsideClick)}_clear(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:""},bubbles:!0,composed:!0}))}_select(t){this._open=!1,document.removeEventListener("click",this._handleOutsideClick),this.dispatchEvent(new CustomEvent("ap-change",{detail:{value:t},bubbles:!0,composed:!0}))}_updateMenuPosition(){const t=this.getBoundingClientRect();this._menuWidth=t.width;const e=window.innerHeight-t.bottom,s=t.top,i=Math.min(this.options.length*36+8,300);this._menuPosition=e<i&&s>e?"above":"below",this._menuPosition==="below"?this._menuTop=t.bottom+4:this._menuBottom=window.innerHeight-t.top+4;const a=window.innerWidth-t.left;this._menuAlign=a<200?"align-right":"align-left",this._menuAlign==="align-left"?this._menuLeft=t.left:this._menuRight=window.innerWidth-t.right}_handleTriggerKeydown(t){t.key==="ArrowDown"||t.key==="ArrowUp"||t.key==="Enter"||t.key===" "?(t.preventDefault(),this._open||(this._open=!0,this._focusedIndex=t.key==="ArrowUp"?this.options.length-1:Math.max(0,this.options.findIndex(e=>e.value===this.value)),this._updateMenuPosition(),this.dispatchEvent(new CustomEvent("dropdown-open",{bubbles:!0,composed:!0})),document.addEventListener("click",this._handleOutsideClick),this.updateComplete.then(()=>this._focusCurrentOption()))):t.key==="Escape"&&this._open&&(t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}_handleMenuKeydown(t){var e,s,i,a;switch(t.key){case"ArrowDown":t.preventDefault(),this._focusedIndex=(this._focusedIndex+1)%this.options.length,this._focusCurrentOption();break;case"ArrowUp":t.preventDefault(),this._focusedIndex=(this._focusedIndex-1+this.options.length)%this.options.length,this._focusCurrentOption();break;case"Enter":case" ":t.preventDefault(),this._focusedIndex>=0&&this._focusedIndex<this.options.length&&(this._select(this.options[this._focusedIndex].value),(s=(e=this.shadowRoot)==null?void 0:e.querySelector(".trigger"))==null||s.focus());break;case"Escape":t.preventDefault(),this._open=!1,document.removeEventListener("click",this._handleOutsideClick),(a=(i=this.shadowRoot)==null?void 0:i.querySelector(".trigger"))==null||a.focus();break;case"Tab":this._open=!1,document.removeEventListener("click",this._handleOutsideClick);break;case"Home":t.preventDefault(),this._focusedIndex=0,this._focusCurrentOption();break;case"End":t.preventDefault(),this._focusedIndex=this.options.length-1,this._focusCurrentOption();break}}_focusCurrentOption(){var e;const t=(e=this.shadowRoot)==null?void 0:e.querySelectorAll(".option");t&&this._focusedIndex>=0&&this._focusedIndex<t.length&&t[this._focusedIndex].focus()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};R.styles=[Y,r.css`
|
|
6693
6693
|
:host {
|
|
6694
6694
|
position: relative;
|
|
6695
6695
|
display: inline-block;
|
|
@@ -6798,7 +6798,7 @@
|
|
|
6798
6798
|
.option[aria-selected="true"] ap-icon {
|
|
6799
6799
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
6800
6800
|
}
|
|
6801
|
-
`];
|
|
6801
|
+
`];V([l.property()],R.prototype,"value",2);V([l.property()],R.prototype,"label",2);V([l.property({reflect:!0})],R.prototype,"variant",2);V([l.property({type:Boolean})],R.prototype,"clearable",2);V([l.property({type:Array})],R.prototype,"options",2);V([l.state()],R.prototype,"_open",2);V([l.state()],R.prototype,"_focusedIndex",2);V([l.state()],R.prototype,"_menuPosition",2);V([l.state()],R.prototype,"_menuAlign",2);V([l.state()],R.prototype,"_menuTop",2);V([l.state()],R.prototype,"_menuBottom",2);V([l.state()],R.prototype,"_menuLeft",2);V([l.state()],R.prototype,"_menuRight",2);V([l.state()],R.prototype,"_menuWidth",2);R=V([l.customElement("ap-dropdown")],R);var Qr=Object.defineProperty,Yr=Object.getOwnPropertyDescriptor,Ee=(t,e,s,i)=>{for(var a=i>1?void 0:i?Yr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Qr(e,s,a),a};const Wr=["webp","jpeg","png","gif"];function Xr(t){const e=(t??"").toLowerCase();return Wr.includes(e)?e:"jpeg"}let ge=class extends r.LitElement{constructor(){super(...arguments),this.assets=[],this.isMultiSelect=!1,this._format="jpeg",this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this._defaultFormat="jpeg"}get _ratio(){const t=this.assets.find(i=>je(i));if(!t)return 1.5;const e=Pt(t),s=Dt(t);return e&&s?e/s:1.5}get _isDirty(){return this._format!==this._defaultFormat||this._quality!=="excellent"||this._width!==this._defaultWidth||this._height!==this._defaultHeight}willUpdate(t){t.has("assets")&&this._initDefaults()}_initDefaults(){const t=this.assets.find(e=>je(e));if(this._defaultFormat=Xr(t==null?void 0:t.extension),this._format=this._defaultFormat,this._quality="excellent",this._lockAspect=!0,this._activePreset="original",this.isMultiSelect)this._defaultWidth=void 0,this._defaultHeight=void 0;else if(t){const e=Pt(t),s=Dt(t);this._defaultWidth=e||void 0,this._defaultHeight=s||void 0}else this._defaultWidth=void 0,this._defaultHeight=void 0;this._width=this._defaultWidth,this._height=this._defaultHeight}_handleFormatChange(t){this._format=t.detail.value}_handleQualityChange(t){this._quality=t.detail.value}_handleWidthInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._activePreset="",this._lockAspect&&i&&(this._height=Math.round(i/this._ratio))}_handleHeightInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._height=i,this._activePreset="",this._lockAspect&&i&&(this._width=Math.round(i*this._ratio))}_handleMaxSizeInput(t){const e=t.target.value,s=parseInt(e,10),i=e===""||isNaN(s)||s<=0?void 0:s;this._width=i,this._height=i,this._activePreset=""}_toggleLock(){this._lockAspect=!this._lockAspect}_handlePreset(t){this._activePreset=t.value,t.value==="original"?(this._width=this._defaultWidth,this._height=this._defaultHeight):t.width&&(this._width=t.width,this._height=Math.round(t.width/this._ratio))}_handleApply(){const t={format:this._format,quality:this._format!=="png"?this._quality:void 0,width:this._width,height:this._height};this.dispatchEvent(new CustomEvent("transform-confirm",{detail:{params:t,isAspectLocked:this._lockAspect},bubbles:!0,composed:!0}))}_handleSkip(){this.dispatchEvent(new CustomEvent("transform-skip",{bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("transform-cancel",{bubbles:!0,composed:!0}))}_handleBackdropClick(t){t.target===t.currentTarget&&this._handleClose()}render(){const t=this._format==="png";return r.html`
|
|
6802
6802
|
<div class="backdrop" @click=${this._handleBackdropClick}>
|
|
6803
6803
|
<div class="dialog">
|
|
6804
6804
|
<div class="header">
|
|
@@ -6813,7 +6813,7 @@
|
|
|
6813
6813
|
<ap-radio-group
|
|
6814
6814
|
direction="horizontal"
|
|
6815
6815
|
.value=${this._format}
|
|
6816
|
-
.options=${
|
|
6816
|
+
.options=${ta}
|
|
6817
6817
|
@ap-change=${this._handleFormatChange}
|
|
6818
6818
|
></ap-radio-group>
|
|
6819
6819
|
</div>
|
|
@@ -6823,7 +6823,7 @@
|
|
|
6823
6823
|
<span class="section-label">Quality</span>
|
|
6824
6824
|
<ap-dropdown
|
|
6825
6825
|
.value=${this._quality}
|
|
6826
|
-
.options=${
|
|
6826
|
+
.options=${sa}
|
|
6827
6827
|
@ap-change=${this._handleQualityChange}
|
|
6828
6828
|
></ap-dropdown>
|
|
6829
6829
|
</div>
|
|
@@ -6881,7 +6881,7 @@
|
|
|
6881
6881
|
</div>
|
|
6882
6882
|
`}
|
|
6883
6883
|
<div class="presets-row">
|
|
6884
|
-
${
|
|
6884
|
+
${ia.map(e=>r.html`
|
|
6885
6885
|
<button
|
|
6886
6886
|
class="preset-btn ${this._activePreset===e.value?"active":""}"
|
|
6887
6887
|
@click=${()=>this._handlePreset(e)}
|
|
@@ -6896,7 +6896,7 @@
|
|
|
6896
6896
|
</div>
|
|
6897
6897
|
</div>
|
|
6898
6898
|
</div>
|
|
6899
|
-
`}};
|
|
6899
|
+
`}};ge.styles=[Y,r.css`
|
|
6900
6900
|
:host {
|
|
6901
6901
|
display: block;
|
|
6902
6902
|
}
|
|
@@ -7100,7 +7100,7 @@
|
|
|
7100
7100
|
display: block;
|
|
7101
7101
|
width: 100%;
|
|
7102
7102
|
}
|
|
7103
|
-
`];
|
|
7103
|
+
`];Ee([l.property({type:Array})],ge.prototype,"assets",2);Ee([l.property({type:Boolean})],ge.prototype,"isMultiSelect",2);Ee([l.state()],ge.prototype,"_format",2);Ee([l.state()],ge.prototype,"_quality",2);Ee([l.state()],ge.prototype,"_width",2);Ee([l.state()],ge.prototype,"_height",2);Ee([l.state()],ge.prototype,"_lockAspect",2);Ee([l.state()],ge.prototype,"_activePreset",2);ge=Ee([l.customElement("ap-transformation-dialog")],ge);var Zr=Object.defineProperty,Jr=Object.getOwnPropertyDescriptor,Wt=(t,e,s,i)=>{for(var a=i>1?void 0:i?Jr(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&Zr(e,s,a),a};let rt=class extends r.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return r.html`
|
|
7104
7104
|
<div class="box">
|
|
7105
7105
|
<svg class="check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
7106
7106
|
<path d="M20 6 9 17l-5-5"></path>
|
|
@@ -7110,7 +7110,7 @@
|
|
|
7110
7110
|
</svg>
|
|
7111
7111
|
</div>
|
|
7112
7112
|
<span class="label" ?hidden=${!this._hasLabel}><slot @slotchange=${this._onSlotChange}></slot></span>
|
|
7113
|
-
`}};
|
|
7113
|
+
`}};rt.styles=[r.css`
|
|
7114
7114
|
:host {
|
|
7115
7115
|
display: inline-flex;
|
|
7116
7116
|
align-items: center;
|
|
@@ -7169,12 +7169,12 @@
|
|
|
7169
7169
|
.label[hidden] {
|
|
7170
7170
|
display: none;
|
|
7171
7171
|
}
|
|
7172
|
-
`];
|
|
7172
|
+
`];Wt([l.property({type:Boolean,reflect:!0})],rt.prototype,"checked",2);Wt([l.property({type:Boolean,reflect:!0})],rt.prototype,"indeterminate",2);Wt([l.property({type:Boolean,reflect:!0})],rt.prototype,"disabled",2);rt=Wt([l.customElement("ap-checkbox")],rt);var en=Object.defineProperty,tn=Object.getOwnPropertyDescriptor,xi=(t,e,s,i)=>{for(var a=i>1?void 0:i?tn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&en(e,s,a),a};let Ut=class extends r.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return r.html`
|
|
7173
7173
|
<slot name="trigger" @click=${()=>this.open=!this.open}></slot>
|
|
7174
7174
|
<div class="content ${this.open?"open":""}">
|
|
7175
7175
|
<slot></slot>
|
|
7176
7176
|
</div>
|
|
7177
|
-
`}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};
|
|
7177
|
+
`}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleOutsideClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleOutsideClick)}};Ut.styles=[r.css`
|
|
7178
7178
|
:host {
|
|
7179
7179
|
position: relative;
|
|
7180
7180
|
display: inline-block;
|
|
@@ -7195,7 +7195,7 @@
|
|
|
7195
7195
|
.content.open {
|
|
7196
7196
|
display: block;
|
|
7197
7197
|
}
|
|
7198
|
-
`];
|
|
7198
|
+
`];xi([l.state()],Ut.prototype,"open",2);Ut=xi([l.customElement("ap-popover")],Ut);var sn=Object.defineProperty,an=Object.getOwnPropertyDescriptor,wi=(t,e,s,i)=>{for(var a=i>1?void 0:i?an(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&sn(e,s,a),a};let Bt=class extends r.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return r.html`<span class="badge"><slot></slot></span>`}};Bt.styles=[r.css`
|
|
7199
7199
|
:host {
|
|
7200
7200
|
display: inline-flex;
|
|
7201
7201
|
}
|
|
@@ -7214,10 +7214,10 @@
|
|
|
7214
7214
|
background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
|
|
7215
7215
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
7216
7216
|
}
|
|
7217
|
-
`];
|
|
7217
|
+
`];wi([l.property({reflect:!0})],Bt.prototype,"variant",2);Bt=wi([l.customElement("ap-badge")],Bt);var on=Object.defineProperty,rn=Object.getOwnPropertyDescriptor,$i=(t,e,s,i)=>{for(var a=i>1?void 0:i?rn(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&on(e,s,a),a};let qt=class extends r.LitElement{constructor(){super(...arguments),this.text=""}render(){return r.html`
|
|
7218
7218
|
<slot></slot>
|
|
7219
7219
|
<div class="tip">${this.text}</div>
|
|
7220
|
-
`}};
|
|
7220
|
+
`}};qt.styles=[r.css`
|
|
7221
7221
|
:host {
|
|
7222
7222
|
position: relative;
|
|
7223
7223
|
display: inline-flex;
|
|
@@ -7240,16 +7240,16 @@
|
|
|
7240
7240
|
:host(:hover) .tip {
|
|
7241
7241
|
display: block;
|
|
7242
7242
|
}
|
|
7243
|
-
`];wi([l.property()],Bt.prototype,"text",2);Bt=wi([l.customElement("ap-tooltip")],Bt);var nn=Object.defineProperty,Ft=(t,e,s,i)=>{for(var a=void 0,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(e,s,a)||a);return a&&nn(e,s,a),a};const Es=class Es extends r.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._selectAllId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._normalizedForcedFilters={},this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Li(),this.storeCtrl=new Oi(this,this.store),this.selectionCtrl=new Ii(this,this.store),this.infiniteScrollCtrl=new Pi(this,()=>this._loadMore()),this.marqueeCtrl=new Di(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._normalizedForcedFilters=cs(s.forcedFilters),this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Ya(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Za(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new zi(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const b=await Hi(this.apiClient);this.apiClient.setSassKey(b),this.store.setState({sassKey:b})}const[o,n,c,d,h]=await Promise.allSettled([Ea(this.apiClient),Ui(this.apiClient),Vi(this.apiClient),Ca(this.apiClient),Bi(this.apiClient)]),u={};if(o.status==="fulfilled"){const{fields:b,regionalVariantGroups:_,regionalFilters:S,brandColor:y}=o.value;u.metadataFields=b,u.regionalVariantGroups=_,u.regionalFilters=S,y&&(u.brandColor=y)}n.status==="fulfilled"&&(u.labels=n.value.labels||[]),c.status==="fulfilled"&&(u.tags=c.value),h.status==="fulfilled"&&(u.collections=h.value.collections||[]),d.status==="fulfilled"&&(u.fileTypes=d.value);const{pinnedFilters:g,pinnedMetadata:p}=Ga(e.auth.projectToken??null),f=this.store.getState().filters;u.filters={...f,pinned:g,visible:[...g],metadata:{...f.metadata,pinned:p,visible:[...p]}},this.store.setState(u);const v=e.brandColor||u.brandColor||this.store.getState().brandColor;v&&(u.brandColor||this.store.setState({brandColor:v}),ao(this,v))}catch(o){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:o,context:"init"},bubbles:!0,composed:!0})),o}}_ensureUploaderImport(){return customElements.get("sfx-uploader")?Promise.resolve():this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,header:s.header??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,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&&(this._uploaderEl.remove(),this._uploaderEl=null)}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var h,u,g,p,f,v,b;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=cs((h=this.config)==null?void 0:h.defaultFilters);for(const[_,S]of Object.entries(a))s.has(_)||(i[_]=S);const o=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],c=(g=this.config)!=null&&g.rememberLastTab?eo(this.config.auth.projectToken):null,d=(c&&n.includes(c)?c:null)??((p=this.config)!=null&&p.defaultTab&&n.includes(this.config.defaultTab)?this.config.defaultTab:null)??n[0]??"assets";this.store.setState({isOpen:!0,activeTab:d,searchQuery:"",isAISearchActive:!!((f=this.config)!=null&&f.enableAISearch&&((v=this.config)!=null&&v.defaultAISearch)),filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...o])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((b=this.config)==null?void 0:b.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,o,n,c,d,h,u,g,p,f,v,b,_,S,y,O,w,$,F,E,fe,se,L,W,X,P,Ie,As,Ts,Ls,Os,Ms,Is,Ps,Ds,zs,Rs,js;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const We=s.activeTab;if(We==="assets"){const ie=this._buildSearchNotation(),Ee=s.currentFolderPath||"/",pe=s.isAISearchActive&&!!s.searchQuery,ae=Pe(this.apiClient,{folder:Ee,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ie||void 0,recursive:1,...pe&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),V=Et(this.apiClient,{folder:Ee,q:ie||void 0,search:s.searchQuery||void 0,recursive:1,...pe&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[U,Z]=await Promise.all([ae,V]);if(e!==this._loadId)return;const J=((o=U.files)==null?void 0:o.length)??0,R=J>=s.limit,ee=((n=Z==null?void 0:Z.stats)==null?void 0:n.approx_files_count)??((c=Z==null?void 0:Z.info)==null?void 0:c.total_files_count)??((d=U.info)==null?void 0:d.total_files_count)??((u=(h=U.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(g=U.base)==null?void 0:g.count)==null?void 0:p.files_direct)??J;this.store.setState({assets:U.files||[],folders:[],totalCount:ee,totalFolderCount:0,offset:0,hasMore:R,isLoading:!1})}else if(We==="folders"){const ie=this._buildSearchNotation(),Ee=s.currentFolderPath||"/",[pe,ae,V]=await Promise.all([ji(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Pe(this.apiClient,{folder:Ee,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ie||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((f=s.config)==null?void 0:f.locale)??"en"}}),Et(this.apiClient,{folder:Ee,q:ie||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((v=s.config)==null?void 0:v.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const U=pe.folders||[];let Z={};if(U.length>0)try{Z=await Ni(this.apiClient,U.map(Xe=>Xe.uuid))}catch{}if(e!==this._loadId)return;const J=((b=ae.files)==null?void 0:b.length)??0,R=J>=s.limit,ee=((_=V==null?void 0:V.stats)==null?void 0:_.approx_files_count)??((S=V==null?void 0:V.info)==null?void 0:S.total_files_count)??((y=ae.info)==null?void 0:y.total_files_count)??((w=(O=ae.base)==null?void 0:O.count)==null?void 0:w.files_direct)??J;this.store.setState({assets:ae.files||[],folders:U,folderPreviews:Z,totalCount:ee,totalFolderCount:pe.total??U.length,offset:0,hasMore:R,isLoading:!1})}else if(We==="labels"){if(!s.activeLabelUuid){this.store.setState({assets:[],folders:[],totalCount:s.labels.length,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ie=s.labels.find(Xt=>Xt.uuid===s.activeLabelUuid);if(!ie){this.store.setState({isLoading:!1});return}const Ee=ie.sid.replace("#",""),pe=this._buildSearchNotation(),ae=`labels:${Ee}${pe?" "+pe:""}`,V=s.isAISearchActive&&!!s.searchQuery,U=Pe(this.apiClient,{folder:"/",offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ae,recursive:1,...V&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:(($=s.config)==null?void 0:$.locale)??"en"}}),Z=Et(this.apiClient,{folder:"/",q:ae,search:s.searchQuery||void 0,recursive:1,...V&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((F=s.config)==null?void 0:F.locale)??"en"}}).catch(()=>null),[J,R]=await Promise.all([U,Z]);if(e!==this._loadId)return;const ee=((E=J.files)==null?void 0:E.length)??0,Xe=ee>=s.limit,Wt=((fe=R==null?void 0:R.stats)==null?void 0:fe.approx_files_count)??((se=R==null?void 0:R.info)==null?void 0:se.total_files_count)??((L=J.info)==null?void 0:L.total_files_count)??((X=(W=J.base)==null?void 0:W.count)==null?void 0:X.files_recursive)??((Ie=(P=J.base)==null?void 0:P.count)==null?void 0:Ie.files_direct)??ee;this.store.setState({assets:J.files||[],folders:[],totalCount:Wt,totalFolderCount:0,offset:0,hasMore:Xe,isLoading:!1})}else if(We==="collections"){if(!s.activeCollectionUuid){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ie=s.activeCollectionFolder;if(!(ie&&!((As=ie.children)!=null&&As.length))){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const pe=s.activeCollectionUuid,ae=ie.filters||void 0,V=this._buildSearchNotation(),U=s.isAISearchActive&&!!s.searchQuery,Z=Pe(this.apiClient,{offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:V||void 0,recursive:1,collection_uuid:pe,f64:ae,...U&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ts=s.config)==null?void 0:Ts.locale)??"en"}}),J=Et(this.apiClient,{q:V||void 0,search:s.searchQuery||void 0,recursive:1,collection_uuid:pe,f64:ae,...U&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ls=s.config)==null?void 0:Ls.locale)??"en"}}).catch(()=>null),[R,ee]=await Promise.all([Z,J]);if(e!==this._loadId)return;const Xe=((Os=R.files)==null?void 0:Os.length)??0,Wt=Xe>=s.limit,Xt=((Ms=ee==null?void 0:ee.stats)==null?void 0:Ms.approx_files_count)??((Is=ee==null?void 0:ee.info)==null?void 0:Is.total_files_count)??((Ps=R.info)==null?void 0:Ps.total_files_count)??((zs=(Ds=R.base)==null?void 0:Ds.count)==null?void 0:zs.files_recursive)??((js=(Rs=R.base)==null?void 0:Rs.count)==null?void 0:js.files_direct)??Xe;this.store.setState({assets:R.files||[],folders:[],totalCount:Xt,totalFolderCount:0,offset:0,hasMore:Wt,isLoading:!1})}}catch(We){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:We,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a,o;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient||e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((a=e.activeCollectionFolder.children)!=null&&a.length)))return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const n=this._buildSearchNotation();let c=n||void 0,d=e.currentFolderPath||"/",h=e.activeTab==="folders"?0:1;if(e.activeTab==="labels"&&e.activeLabelUuid){const S=e.labels.find(y=>y.uuid===e.activeLabelUuid);S&&(c=`labels:${S.sid.replace("#","")}${n?" "+n:""}`),d="/",h=1}let u,g;e.activeTab==="collections"&&e.activeCollectionFolder&&(u=e.activeCollectionUuid||void 0,g=e.activeCollectionFolder.filters||void 0,d="",h=1);const p=await Pe(this.apiClient,{...d?{folder:d}:{},offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:c,recursive:h,...u&&{collection_uuid:u},...g&&{f64:g},...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((o=e.config)==null?void 0:o.locale)??"en"}});if(s!==this._loadMoreId)return;const f=this.store.getState().assets,v=p.files||[],b=v.length>=e.limit,_=[...f,...v];this.store.setState({assets:_,offset:i,hasMore:b,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){var a;const s=this.store.getState();if(s.activeTab==="labels"&&!s.activeLabelUuid){this.store.setState({searchQuery:e.detail.value});return}if(s.activeTab==="collections"&&!(s.activeCollectionFolder&&!((a=s.activeCollectionFolder.children)!=null&&a.length))){this.store.setState({searchQuery:e.detail.value});return}const i={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};s.isAISearchActive&&e.detail.value&&(i.sortBy="relevance"),this.store.setState(i),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleAISearchToggle(e){var o;const s=e.detail.active,i=this.store.getState(),a={isAISearchActive:s};i.searchQuery&&(s?a.sortBy="relevance":i.sortBy==="relevance"&&(a.sortBy=((o=this.config)==null?void 0:o.defaultSortBy)??"created_at"),a.offset=0,a.assets=[],a.folders=[],a.isLoading=!0),this.store.setState(a),i.searchQuery&&this._debouncedLoadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Xa(s,this.config.auth.projectToken),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Ys(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:[]}),Ys(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Ja(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i;const s=e.detail.asset;if((i=this.config)!=null&&i.transformations&&Re(s)){this._transformAssets=[s],this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect([s])}_emitSelect(e,s){var a,o;const i={assets:e};s!=null&&s.length&&(i.folders=s),(o=(a=this.config)==null?void 0:a.onSelect)==null||o.call(a,e,s!=null&&s.length?s:void 0),this.dispatchEvent(new CustomEvent("ap-select",{detail:i,bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var o;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(o=this.config)!=null&&o.rememberLastFolder&&Ws(a,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var c,d;const s=e.detail.uuid,i=this.store.getState();if(i.activeTab==="labels"){this._selectAllId++,this.store.setState({activeLabelUuid:null,breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData();return}if(i.activeTab==="collections"){if(this._selectAllId++,!s){this.store.setState({activeCollectionUuid:null,activeCollectionFolder:null,activeCollectionFolders:[],breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}if(s===i.activeCollectionUuid){this.store.setState({activeCollectionFolder:null,breadcrumb:[i.breadcrumb[0]],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}const h=this._findCollectionFolder(i.activeCollectionFolders,s);if(h){const u=i.breadcrumb.findIndex(p=>p.uuid===s),g=i.breadcrumb.slice(0,u+1);this.store.setState({activeCollectionFolder:h,breadcrumb:g,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}return}const a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,o=s?i.breadcrumb.slice(0,a+1):[],n=o.length>0?o[o.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Ws(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:o,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleLabelOpen(e){const s=e.detail.label;this._selectAllId++,this.store.setState({activeLabelUuid:s.uuid,breadcrumb:[{uuid:s.uuid,name:s.name,path:""}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}async _handleCollectionOpen(e){const s=e.detail.collection;if(this.apiClient){this._selectAllId++,this.store.setState({activeCollectionUuid:s.uuid,activeCollectionFolder:null,activeCollectionFolders:[],isLoadingCollectionFolders:!0,breadcrumb:[{uuid:s.uuid,name:s.title,path:""}],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange();try{const i=await qi(this.apiClient,s.uuid),a=Zs(i.folders||[]);this.store.setState({activeCollectionFolders:a,isLoadingCollectionFolders:!1,isLoading:!1})}catch(i){this.store.setState({isLoadingCollectionFolders:!1,isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"loadCollectionFolders"},bubbles:!0,composed:!0}))}}}_handleCollectionFolderOpen(e){var c;const s=e.detail.folder,i=this.store.getState(),a=s.path.split(" -> ").filter(Boolean),o=[{uuid:i.activeCollectionUuid,name:((c=i.breadcrumb[0])==null?void 0:c.name)||"Collection",path:""}];let n="";for(const d of a)n=n?`${n} -> ${d}`:d,o.push({uuid:n,name:d,path:n});this._selectAllId++,this.store.setState({activeCollectionFolder:s,breadcrumb:o,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_findCollectionFolder(e,s){for(const i of e){if(i.path===s)return i;if(i.children){const a=this._findCollectionFolder(i.children,s);if(a)return a}}return null}_getVisibleCollectionFolders(){const e=this.store.getState();return e.activeCollectionUuid?e.activeCollectionFolder?e.activeCollectionFolder.children??[]:e.activeCollectionFolders:[]}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Wa(this.config.auth.projectToken)||((i=this.config)==null?void 0:i.rootFolderPath)||"/"}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),o=[];let n=s.endsWith("/")?s:s+"/";for(const c of a)n+=c+"/",o.push({uuid:n,name:c,path:n});return o}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,o;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1&&((o=this.config)==null?void 0:o.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}this._emitSelect(s,i.length?i:void 0)}_handleSelectionTransform(e){var o,n;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((o=this.config)==null?void 0:o.folderSelection)!==!1&&((n=this.config)==null?void 0:n.folderSelectionMode)==="assets"){this._transformAfterResolve=!0,this._folderResolveOpen=!0;return}if(s.filter(Re).length===0){this._emitSelect(s,i.length?i:void 0);return}this._transformAssets=s,this._transformFolders=i,this._transformOpen=!0}async _handleFolderResolveConfirm(e){var o;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const n=await Promise.all(i.map(p=>Pe(this.apiClient,{folder:p.path,recursive:s==="recursive"?1:0,limit:1e4}))),c=[];for(const p of n)c.push(...p.files);const d=[...a],h=new Set(d.map(p=>p.uuid));for(const p of c)h.has(p.uuid)||(d.push(p),h.add(p.uuid));const u=(o=this.config)==null?void 0:o.maxSelections,g=u?d.slice(0,u):d;if(this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._transformAfterResolve){this._transformAfterResolve=!1,this._transformAssets=g,this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect(g)}catch(n){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1,this._transformAfterResolve=!1}_handleTransformConfirm(e){const s=e.detail.params,i=e.detail.isAspectLocked??!0,a=this._transformAssets,o=this._transformFolders,n=a.length>1,c=us(s,{isMultiSelect:n,isAspectLocked:i}),d=a.map(h=>{var f,v;if(!Re(h))return h;const u=(f=h.url)==null?void 0:f.cdn,g=(v=h.url)==null?void 0:v.permalink,p={cdn:u?ye(u,c):""};return g&&(p.permalink_cdn=ye(g,c)),{...h,transformation:{params:s,url:p}}});this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(d,o.length?o:void 0)}_handleTransformSkip(){const e=this._transformAssets,s=this._transformFolders;this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(e,s.length?s:void 0)}_handleTransformCancel(){this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[]}async _handleSelectAll(e){var d,h,u;const s=this.store.getState();if(s.isSelectingAll||!this.apiClient||!(((d=s.config)==null?void 0:d.multiSelect)??!0))return;const a=((h=e==null?void 0:e.detail)==null?void 0:h.scope)??"all",o=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){o&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const c=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const g=this._buildSearchNotation();let p=s.currentFolderPath||"/";const f=s.limit,v=s.assets,b=s.totalCount;let _=s.activeTab==="folders"?0:1,S=g||void 0;if(s.activeTab==="labels"&&s.activeLabelUuid){const L=s.labels.find(W=>W.uuid===s.activeLabelUuid);L&&(S=`labels:${L.sid.replace("#","")}${g?" "+g:""}`),p="/",_=1}let y,O;s.activeTab==="collections"&&s.activeCollectionFolder&&(y=s.activeCollectionUuid||void 0,O=s.activeCollectionFolder.filters||void 0,p="",_=1);const w=[];for(let L=v.length;L<b;L+=f)w.push(L);const $=4,F=[];for(let L=0;L<w.length;L+=$){if(c!==this._selectAllId)return;const W=w.slice(L,L+$),X=await Promise.all(W.map(P=>{var Ie;return Pe(this.apiClient,{...p?{folder:p}:{},offset:P,limit:f,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:S,recursive:_,...y&&{collection_uuid:y},...O&&{f64:O},...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ie=s.config)==null?void 0:Ie.locale)??"en"}})}));if(c!==this._selectAllId)return;for(const P of X)P.files&&F.push(...P.files)}if(c!==this._selectAllId)return;const E=new Set(v.map(L=>L.uuid)),fe=F.filter(L=>E.has(L.uuid)?!1:(E.add(L.uuid),!0)),se=[...v,...fe];this.store.setState({assets:se,offset:Math.max(0,se.length-f),hasMore:!1,isSelectingAll:!1}),o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(se)}catch(g){if(c!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:g,context:"selectAll"},bubbles:!0,composed:!0}))}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===m.DATE||e===m.LICENSE_EXPIRY||e===H.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:g}=i;c=!d&&!h&&!u&&!g}if(c){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===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 o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,o,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,o,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,f,v;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),o=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!o)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const b=a.renderRoot.querySelectorAll(".chip.pinned-empty"),_=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const S of b){const y=(v=(f=S.querySelector(".chip-label"))==null?void 0:f.textContent)==null?void 0:v.trim();if(i&&y===_){n=S;break}if(s&&y===(Je[s]||s)){n=S;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,g=h?c.bottom-h.top:void 0;i?o.openMetadataFieldPanel(i,!0,u,g):s&&o.openFilterPanel(s,!0,u,g)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const a={...this.store.getState().filters},o={...a.applied};delete o[s],a.applied=o,a.pinned.includes(s)||(a.visible=a.visible.filter(c=>c!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:o}=e.detail,c={...this.store.getState().filters},d={...c.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(g=>g!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:o},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),c.metadata=d,this.store.setState({filters:c,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const g=this.renderRoot.querySelector("ap-filters-bar");g&&(g.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),o.metadata=n,this.store.setState({filters:o})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata},n={...o.applied};delete n[s],o.applied=n,o.pinned.includes(s)||(o.visible=o.visible.filter(c=>c!==s)),a.metadata=o,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:i}=e.detail,o={...this.store.getState().filters};i?o.pinned.includes(s)||(o.pinned=[...o.pinned,s]):(o.pinned=o.pinned.filter(h=>h!==s),s in o.applied||(o.visible=o.visible.filter(h=>h!==s))),this.store.setState({filters:o});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;Ka(n,o.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),o.metadata=n,this.store.setState({filters:o});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Qa(c,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(o=>o!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata};o.visible=o.visible.filter(n=>n!==s),a.metadata=o,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,o={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];o.applied=c;const d=Object.keys(s);if(o.visible=[...new Set([...o.pinned,...d])],i){const u={...o.metadata};u.applied=i.applied;const g=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...g])],o.metadata=u}this.store.setState({filters:o,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){var s;const e=this.storeCtrl.state;if(e.activeTab==="labels"&&!e.activeLabelUuid)return no;if(e.activeTab==="collections"){if(!e.activeCollectionUuid)return lo;if(!(e.activeCollectionFolder&&!((s=e.activeCollectionFolder.children)!=null&&s.length)))return co}return e.searchQuery?oo:e.activeTab==="folders"?ro:gs}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return La(s,e.filters.metadata.applied).join(" ")}render(){var p,f,v,b,_,S,y,O,w,$,F,E,fe,se,L,W,X,P;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),o=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,c=r.html`
|
|
7243
|
+
`];$i([l.property()],qt.prototype,"text",2);qt=$i([l.customElement("ap-tooltip")],qt);var nn=Object.defineProperty,Et=(t,e,s,i)=>{for(var a=void 0,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(e,s,a)||a);return a&&nn(e,s,a),a};const Ts=class Ts extends r.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._selectAllId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._normalizedForcedFilters={},this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var i,a;if(!((i=this.config)!=null&&i.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((a=e.dataTransfer)==null?void 0:a.files)??[]);s.length>0&&this._openUploader(s)},this.store=Oi(),this.storeCtrl=new Mi(this,this.store),this.selectionCtrl=new Pi(this,this.store),this.infiniteScrollCtrl=new Di(this,()=>this._loadMore()),this.marqueeCtrl=new zi(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const a=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,a)}const i=this.renderRoot.querySelector(".main-content");i&&i!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=i,this.marqueeCtrl.attach(i))}_initConfig(e){const s={folderSelection:!0,...e};this._initFailed=!1,this._normalizedForcedFilters=ps(s.forcedFilters),this._initPromise=this._doInit(s).catch(()=>{this._initFailed=!0}),this.toggleAttribute("inline",s.displayMode==="inline"),s.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=Ya(),i=s.sortBy??e.defaultSortBy??"created_at",a=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Za(e.auth.projectToken)||e.defaultViewMode||"grid",sortBy:i,sortDirection:a}),this.apiClient=new Ri(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const _=await Gi(this.apiClient);this.apiClient.setSassKey(_),this.store.setState({sassKey:_})}const[o,n,c,d,h]=await Promise.allSettled([Ea(this.apiClient),Bi(this.apiClient),Hi(this.apiClient),Ca(this.apiClient),qi(this.apiClient)]),u={};if(o.status==="fulfilled"){const{fields:_,regionalVariantGroups:y,regionalFilters:C,brandColor:x}=o.value;u.metadataFields=_,u.regionalVariantGroups=y,u.regionalFilters=C,x&&(u.brandColor=x)}n.status==="fulfilled"&&(u.labels=n.value.labels||[]),c.status==="fulfilled"&&(u.tags=c.value),h.status==="fulfilled"&&(u.collections=h.value.collections||[]),d.status==="fulfilled"&&(u.fileTypes=d.value);const{pinnedFilters:f,pinnedMetadata:p}=Ga(e.auth.projectToken??null),g=this.store.getState().filters;u.filters={...g,pinned:f,visible:[...f],metadata:{...g.metadata,pinned:p,visible:[...p]}},this.store.setState(u);const m=e.brandColor||u.brandColor||this.store.getState().brandColor;m&&(u.brandColor||this.store.setState({brandColor:m}),ao(this,m))}catch(o){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:o,context:"init"},bubbles:!0,composed:!0})),o}}_ensureUploaderImport(){return customElements.get("sfx-uploader")?Promise.resolve():this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,i=this.store.getState();let a;return e.auth.mode==="securityTemplate"?a={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:a={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:a,targetFolder:i.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,header:s.header??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,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&&(this._uploaderEl.remove(),this._uploaderEl=null)}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,i;return!!((i=(s=e.dataTransfer)==null?void 0:s.types)!=null&&i.includes("Files"))}async open(){var h,u,f,p,g,m,_;const e=this.store.getState(),s=new Set(Object.keys(this._normalizedForcedFilters)),i={},a=ps((h=this.config)==null?void 0:h.defaultFilters);for(const[y,C]of Object.entries(a))s.has(y)||(i[y]=C);const o=Object.keys(i),n=((u=this.config)==null?void 0:u.tabs)??["assets","folders"],c=(f=this.config)!=null&&f.rememberLastTab?eo(this.config.auth.projectToken):null,d=(c&&n.includes(c)?c:null)??((p=this.config)!=null&&p.defaultTab&&n.includes(this.config.defaultTab)?this.config.defaultTab:null)??n[0]??"assets";this.store.setState({isOpen:!0,activeTab:d,searchQuery:"",isAISearchActive:!!((g=this.config)!=null&&g.enableAISearch&&((m=this.config)!=null&&m.defaultAISearch)),filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...o])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:this._resolveInitialFolderPath(d),activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,breadcrumb:this._buildBreadcrumbFromPath(this._resolveInitialFolderPath(d),((_=this.config)==null?void 0:_.rootFolderPath)||"/"),selectedAssets:new Map,selectedFolders:new Map,isResolvingFolders:!1,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._folderResolveOpen=!1,this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._transformAfterResolve=!1,this._selectAllId++}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var i,a,o,n,c,d,h,u,f,p,g,m,_,y,C,x,M,$,k,E,A,fe,ie,O,X,Z,D,Pe,Ls,Os,Ms,Is,Ps,Ds,zs,Rs,js,Ns,Us;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const Xe=s.activeTab;if(Xe==="assets"){const ae=this._buildSearchNotation(),Ae=s.currentFolderPath||"/",he=s.isAISearchActive&&!!s.searchQuery,oe=De(this.apiClient,{folder:Ae,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ae||void 0,recursive:1,...he&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((i=s.config)==null?void 0:i.locale)??"en"}}),H=At(this.apiClient,{folder:Ae,q:ae||void 0,search:s.searchQuery||void 0,recursive:1,...he&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((a=s.config)==null?void 0:a.locale)??"en"}}).catch(()=>null),[B,J]=await Promise.all([oe,H]);if(e!==this._loadId)return;const ee=((o=B.files)==null?void 0:o.length)??0,j=ee>=s.limit,te=((n=J==null?void 0:J.stats)==null?void 0:n.approx_files_count)??((c=J==null?void 0:J.info)==null?void 0:c.total_files_count)??((d=B.info)==null?void 0:d.total_files_count)??((u=(h=B.base)==null?void 0:h.count)==null?void 0:u.files_recursive)??((p=(f=B.base)==null?void 0:f.count)==null?void 0:p.files_direct)??ee;this.store.setState({assets:B.files||[],folders:[],totalCount:te,totalFolderCount:0,offset:0,hasMore:j,isLoading:!1})}else if(Xe==="folders"){const ae=this._buildSearchNotation(),Ae=s.currentFolderPath||"/",[he,oe,H]=await Promise.all([Ni(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),De(this.apiClient,{folder:Ae,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:ae||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((g=s.config)==null?void 0:g.locale)??"en"}}),At(this.apiClient,{folder:Ae,q:ae||void 0,search:s.searchQuery||void 0,recursive:0,...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((m=s.config)==null?void 0:m.locale)??"en"}}).catch(()=>null)]);if(e!==this._loadId)return;const B=he.folders||[];let J={};if(B.length>0)try{J=await Ui(this.apiClient,B.map(Ze=>Ze.uuid))}catch{}if(e!==this._loadId)return;const ee=((_=oe.files)==null?void 0:_.length)??0,j=ee>=s.limit,te=((y=H==null?void 0:H.stats)==null?void 0:y.approx_files_count)??((C=H==null?void 0:H.info)==null?void 0:C.total_files_count)??((x=oe.info)==null?void 0:x.total_files_count)??(($=(M=oe.base)==null?void 0:M.count)==null?void 0:$.files_direct)??ee;this.store.setState({assets:oe.files||[],folders:B,folderPreviews:J,totalCount:te,totalFolderCount:he.total??B.length,offset:0,hasMore:j,isLoading:!1})}else if(Xe==="labels"){if(!s.activeLabelUuid){this.store.setState({assets:[],folders:[],totalCount:s.labels.length,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ae=s.labels.find(Zt=>Zt.uuid===s.activeLabelUuid);if(!ae){this.store.setState({isLoading:!1});return}const Ae=ae.sid.replace("#",""),he=this._buildSearchNotation(),oe=`labels:${Ae}${he?" "+he:""}`,H=s.isAISearchActive&&!!s.searchQuery,B=De(this.apiClient,{folder:"/",offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:oe,recursive:1,...H&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((k=s.config)==null?void 0:k.locale)??"en"}}),J=At(this.apiClient,{folder:"/",q:oe,search:s.searchQuery||void 0,recursive:1,...H&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((E=s.config)==null?void 0:E.locale)??"en"}}).catch(()=>null),[ee,j]=await Promise.all([B,J]);if(e!==this._loadId)return;const te=((A=ee.files)==null?void 0:A.length)??0,Ze=te>=s.limit,Xt=((fe=j==null?void 0:j.stats)==null?void 0:fe.approx_files_count)??((ie=j==null?void 0:j.info)==null?void 0:ie.total_files_count)??((O=ee.info)==null?void 0:O.total_files_count)??((Z=(X=ee.base)==null?void 0:X.count)==null?void 0:Z.files_recursive)??((Pe=(D=ee.base)==null?void 0:D.count)==null?void 0:Pe.files_direct)??te;this.store.setState({assets:ee.files||[],folders:[],totalCount:Xt,totalFolderCount:0,offset:0,hasMore:Ze,isLoading:!1})}else if(Xe==="collections"){if(!s.activeCollectionUuid){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const ae=s.activeCollectionFolder;if(!(ae&&!((Ls=ae.children)!=null&&Ls.length))){this.store.setState({assets:[],folders:[],totalCount:0,totalFolderCount:0,offset:0,hasMore:!1,isLoading:!1});return}const he=s.activeCollectionUuid,oe=ae.filters||void 0,H=this._buildSearchNotation(),B=s.isAISearchActive&&!!s.searchQuery,J=De(this.apiClient,{offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:H||void 0,recursive:1,collection_uuid:he,f64:oe,...B&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Os=s.config)==null?void 0:Os.locale)??"en"}}),ee=At(this.apiClient,{q:H||void 0,search:s.searchQuery||void 0,recursive:1,collection_uuid:he,f64:oe,...B&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Ms=s.config)==null?void 0:Ms.locale)??"en"}}).catch(()=>null),[j,te]=await Promise.all([J,ee]);if(e!==this._loadId)return;const Ze=((Is=j.files)==null?void 0:Is.length)??0,Xt=Ze>=s.limit,Zt=((Ps=te==null?void 0:te.stats)==null?void 0:Ps.approx_files_count)??((Ds=te==null?void 0:te.info)==null?void 0:Ds.total_files_count)??((zs=j.info)==null?void 0:zs.total_files_count)??((js=(Rs=j.base)==null?void 0:Rs.count)==null?void 0:js.files_recursive)??((Us=(Ns=j.base)==null?void 0:Ns.count)==null?void 0:Us.files_direct)??Ze;this.store.setState({assets:j.files||[],folders:[],totalCount:Zt,totalFolderCount:0,offset:0,hasMore:Xt,isLoading:!1})}}catch(Xe){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:Xe,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){var a,o;const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient||e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((a=e.activeCollectionFolder.children)!=null&&a.length)))return;const s=++this._loadMoreId,i=e.offset+e.limit;this.store.setState({isLoading:!0});try{const n=this._buildSearchNotation();let c=n||void 0,d=e.currentFolderPath||"/",h=e.activeTab==="folders"?0:1;if(e.activeTab==="labels"&&e.activeLabelUuid){const C=e.labels.find(x=>x.uuid===e.activeLabelUuid);C&&(c=`labels:${C.sid.replace("#","")}${n?" "+n:""}`),d="/",h=1}let u,f;e.activeTab==="collections"&&e.activeCollectionFolder&&(u=e.activeCollectionUuid||void 0,f=e.activeCollectionFolder.filters||void 0,d="",h=1);const p=await De(this.apiClient,{...d?{folder:d}:{},offset:i,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:c,recursive:h,...u&&{collection_uuid:u},...f&&{f64:f},...e.isAISearchActive&&e.searchQuery&&{with_ai:!0,ai_query:e.searchQuery,ai_lang:((o=e.config)==null?void 0:o.locale)??"en"}});if(s!==this._loadMoreId)return;const g=this.store.getState().assets,m=p.files||[],_=m.length>=e.limit,y=[...g,...m];this.store.setState({assets:y,offset:i,hasMore:_,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,i;this.close(),(i=(s=this.config)==null?void 0:s.onCancel)==null||i.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){var a;const s=this.store.getState();if(s.activeTab==="labels"&&!s.activeLabelUuid){this.store.setState({searchQuery:e.detail.value});return}if(s.activeTab==="collections"&&!(s.activeCollectionFolder&&!((a=s.activeCollectionFolder.children)!=null&&a.length))){this.store.setState({searchQuery:e.detail.value});return}const i={searchQuery:e.detail.value,offset:0,assets:[],folders:[],isLoading:!0};s.isAISearchActive&&e.detail.value&&(i.sortBy="relevance"),this.store.setState(i),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleAISearchToggle(e){var o;const s=e.detail.active,i=this.store.getState(),a={isAISearchActive:s};i.searchQuery&&(s?a.sortBy="relevance":i.sortBy==="relevance"&&(a.sortBy=((o=this.config)==null?void 0:o.defaultSortBy)??"created_at"),a.offset=0,a.assets=[],a.folders=[],a.isLoading=!0),this.store.setState(a),i.searchQuery&&this._debouncedLoadData()}_handleViewChange(e){var i;const s=e.detail.mode;this.store.setState({viewMode:s}),(i=this.config)!=null&&i.rememberLastView&&Xa(s,this.config.auth.projectToken),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:i}=e.detail,a=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...a,[s]:i}})}_handleSortChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Xs(s,i.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,i=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),Xs(i.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var i,a;const s=e.detail.tab;(i=this.config)!=null&&i.rememberLastTab&&Ja(s,this.config.auth.projectToken),this._selectAllId++,this.store.setState({activeTab:s,activeLabelUuid:null,activeCollectionUuid:null,activeCollectionFolders:[],activeCollectionFolder:null,isLoadingCollectionFolders:!1,currentFolder:null,currentFolderPath:((a=this.config)==null?void 0:a.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleFolderSelect(e){this.selectionCtrl.handleFolderSelect(e.detail.folder,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var i;const s=e.detail.asset;if((i=this.config)!=null&&i.transformations&&je(s)){this._transformAssets=[s],this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect([s])}_emitSelect(e,s){var a,o;const i={assets:e};s!=null&&s.length&&(i.folders=s),(o=(a=this.config)==null?void 0:a.onSelect)==null||o.call(a,e,s!=null&&s.length?s:void 0),this.dispatchEvent(new CustomEvent("ap-select",{detail:i,bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var o;const s=e.detail.folder,i=this.store.getState(),a=s.path||`${i.currentFolderPath}${s.name}/`;(o=this.config)!=null&&o.rememberLastFolder&&Zs(a,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s.uuid,currentFolderPath:a,breadcrumb:[...i.breadcrumb,{uuid:s.uuid,name:s.name,path:a}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var c,d;const s=e.detail.uuid,i=this.store.getState();if(i.activeTab==="labels"){this._selectAllId++,this.store.setState({activeLabelUuid:null,breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData();return}if(i.activeTab==="collections"){if(this._selectAllId++,!s){this.store.setState({activeCollectionUuid:null,activeCollectionFolder:null,activeCollectionFolders:[],breadcrumb:[],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}if(s===i.activeCollectionUuid){this.store.setState({activeCollectionFolder:null,breadcrumb:[i.breadcrumb[0]],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!1}),this.selectionCtrl.resetRange();return}const h=this._findCollectionFolder(i.activeCollectionFolders,s);if(h){const u=i.breadcrumb.findIndex(p=>p.uuid===s),f=i.breadcrumb.slice(0,u+1);this.store.setState({activeCollectionFolder:h,breadcrumb:f,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}return}const a=s?i.breadcrumb.findIndex(h=>h.uuid===s):-1,o=s?i.breadcrumb.slice(0,a+1):[],n=o.length>0?o[o.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Zs(n,this.config.auth.projectToken),this._selectAllId++,this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:o,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleLabelOpen(e){const s=e.detail.label;this._selectAllId++,this.store.setState({activeLabelUuid:s.uuid,breadcrumb:[{uuid:s.uuid,name:s.name,path:""}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}async _handleCollectionOpen(e){const s=e.detail.collection;if(this.apiClient){this._selectAllId++,this.store.setState({activeCollectionUuid:s.uuid,activeCollectionFolder:null,activeCollectionFolders:[],isLoadingCollectionFolders:!0,breadcrumb:[{uuid:s.uuid,name:s.title,path:""}],searchQuery:"",offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange();try{const i=await Vi(this.apiClient,s.uuid),a=ei(i.folders||[]);this.store.setState({activeCollectionFolders:a,isLoadingCollectionFolders:!1,isLoading:!1})}catch(i){this.store.setState({isLoadingCollectionFolders:!1,isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"loadCollectionFolders"},bubbles:!0,composed:!0}))}}}_handleCollectionFolderOpen(e){var c;const s=e.detail.folder,i=this.store.getState(),a=s.path.split(" -> ").filter(Boolean),o=[{uuid:i.activeCollectionUuid,name:((c=i.breadcrumb[0])==null?void 0:c.name)||"Collection",path:""}];let n="";for(const d of a)n=n?`${n} -> ${d}`:d,o.push({uuid:n,name:d,path:n});this._selectAllId++,this.store.setState({activeCollectionFolder:s,breadcrumb:o,searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_findCollectionFolder(e,s){for(const i of e){if(i.path===s)return i;if(i.children){const a=this._findCollectionFolder(i.children,s);if(a)return a}}return null}_getVisibleCollectionFolders(){const e=this.store.getState();return e.activeCollectionUuid?e.activeCollectionFolder?e.activeCollectionFolder.children??[]:e.activeCollectionFolders:[]}_resolveInitialFolderPath(e){var s,i;return e==="folders"&&((s=this.config)==null?void 0:s.rememberLastFolder)&&Wa(this.config.auth.projectToken)||((i=this.config)==null?void 0:i.rootFolderPath)||"/"}_buildBreadcrumbFromPath(e,s){if(!e||e===s||e==="/")return[];const a=(e.startsWith(s)?e.slice(s.length):e.replace(/^\//,"")).split("/").filter(Boolean),o=[];let n=s.endsWith("/")?s:s+"/";for(const c of a)n+=c+"/",o.push({uuid:n,name:c,path:n});return o}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,o;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((a=this.config)==null?void 0:a.folderSelection)!==!1&&((o=this.config)==null?void 0:o.folderSelectionMode)==="assets"){this._folderResolveOpen=!0;return}this._emitSelect(s,i.length?i:void 0)}_handleSelectionTransform(e){var o,n;const s=e.detail.assets,i=e.detail.folders||[];if(i.length>0&&((o=this.config)==null?void 0:o.folderSelection)!==!1&&((n=this.config)==null?void 0:n.folderSelectionMode)==="assets"){this._transformAfterResolve=!0,this._folderResolveOpen=!0;return}if(s.filter(je).length===0){this._emitSelect(s,i.length?i:void 0);return}this._transformAssets=s,this._transformFolders=i,this._transformOpen=!0}async _handleFolderResolveConfirm(e){var o;const s=e.detail.mode,i=this.selectionCtrl.getSelectedFolders(),a=this.selectionCtrl.getSelectedAssets();this.store.setState({isResolvingFolders:!0});try{const n=await Promise.all(i.map(p=>De(this.apiClient,{folder:p.path,recursive:s==="recursive"?1:0,limit:1e4}))),c=[];for(const p of n)c.push(...p.files);const d=[...a],h=new Set(d.map(p=>p.uuid));for(const p of c)h.has(p.uuid)||(d.push(p),h.add(p.uuid));const u=(o=this.config)==null?void 0:o.maxSelections,f=u?d.slice(0,u):d;if(this._folderResolveOpen=!1,this.store.setState({isResolvingFolders:!1}),this._transformAfterResolve){this._transformAfterResolve=!1,this._transformAssets=f,this._transformFolders=[],this._transformOpen=!0;return}this._emitSelect(f)}catch(n){this.store.setState({isResolvingFolders:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:n,context:"folderResolve"},bubbles:!0,composed:!0}))}}_handleFolderResolveCancel(){this._folderResolveOpen=!1,this._transformAfterResolve=!1}_handleTransformConfirm(e){const s=e.detail.params,i=e.detail.isAspectLocked??!0,a=this._transformAssets,o=this._transformFolders,n=a.length>1,c=fs(s,{isMultiSelect:n,isAspectLocked:i}),d=a.map(h=>{var g,m;if(!je(h))return h;const u=(g=h.url)==null?void 0:g.cdn,f=(m=h.url)==null?void 0:m.permalink,p={cdn:u?xe(u,c):""};return f&&(p.permalink_cdn=xe(f,c)),{...h,transformation:{params:s,url:p}}});this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(d,o.length?o:void 0)}_handleTransformSkip(){const e=this._transformAssets,s=this._transformFolders;this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[],this._emitSelect(e,s.length?s:void 0)}_handleTransformCancel(){this._transformOpen=!1,this._transformAssets=[],this._transformFolders=[]}async _handleSelectAll(e){var d,h,u;const s=this.store.getState();if(s.isSelectingAll||!this.apiClient||!(((d=s.config)==null?void 0:d.multiSelect)??!0))return;const a=((h=e==null?void 0:e.detail)==null?void 0:h.scope)??"all",o=a!=="assets"&&((u=this.config)==null?void 0:u.folderSelection)!==!1&&s.folders.length>0;if(!(a!=="folders")){o&&this.selectionCtrl.selectAllFolders(s.folders);return}if(s.assets.length>=s.totalCount){o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(s.assets);return}const c=++this._selectAllId;this.store.setState({isSelectingAll:!0});try{const f=this._buildSearchNotation();let p=s.currentFolderPath||"/";const g=s.limit,m=s.assets,_=s.totalCount;let y=s.activeTab==="folders"?0:1,C=f||void 0;if(s.activeTab==="labels"&&s.activeLabelUuid){const O=s.labels.find(X=>X.uuid===s.activeLabelUuid);O&&(C=`labels:${O.sid.replace("#","")}${f?" "+f:""}`),p="/",y=1}let x,M;s.activeTab==="collections"&&s.activeCollectionFolder&&(x=s.activeCollectionUuid||void 0,M=s.activeCollectionFolder.filters||void 0,p="",y=1);const $=[];for(let O=m.length;O<_;O+=g)$.push(O);const k=4,E=[];for(let O=0;O<$.length;O+=k){if(c!==this._selectAllId)return;const X=$.slice(O,O+k),Z=await Promise.all(X.map(D=>{var Pe;return De(this.apiClient,{...p?{folder:p}:{},offset:D,limit:g,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:C,recursive:y,...x&&{collection_uuid:x},...M&&{f64:M},...s.isAISearchActive&&s.searchQuery&&{with_ai:!0,ai_query:s.searchQuery,ai_lang:((Pe=s.config)==null?void 0:Pe.locale)??"en"}})}));if(c!==this._selectAllId)return;for(const D of Z)D.files&&E.push(...D.files)}if(c!==this._selectAllId)return;const A=new Set(m.map(O=>O.uuid)),fe=E.filter(O=>A.has(O.uuid)?!1:(A.add(O.uuid),!0)),ie=[...m,...fe];this.store.setState({assets:ie,offset:Math.max(0,ie.length-g),hasMore:!1,isSelectingAll:!1}),o&&this.selectionCtrl.selectAllFolders(s.folders),this.selectionCtrl.selectAll(ie)}catch(f){if(c!==this._selectAllId)return;this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:f,context:"selectAll"},bubbles:!0,composed:!0}))}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===b.DATE||e===b.LICENSE_EXPIRY||e===G.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:i,operator:a}=e.detail,n={...this.store.getState().filters};let c=i===""||i===null||i===void 0||Array.isArray(i)&&i.length===0||typeof i=="object"&&!Array.isArray(i)&&Object.values(i).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!c&&this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)){const{kind:d,preset:h,from:u,to:f}=i;c=!d&&!h&&!u&&!f}if(c){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof i=="object"&&!Array.isArray(i)?d[s]={type:"date",field:i.field||"created",kind:i.kind||null,preset:i.preset||null,from:i.from||null,to:i.to||null}:s===b.IMAGE&&typeof i=="object"&&!Array.isArray(i)?d[s]=i:d[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,i=e.detail.chipRect,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openFilterPanel(s,!0,o,n)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:i}=e.detail,a=this.renderRoot.querySelector("ap-content-toolbar");let o,n;if(i){const c=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(c){const d=c.getBoundingClientRect();o=i.left-d.left,n=i.bottom-d.top}}a==null||a.openMetadataFieldPanel(s,!0,o,n)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var p,g,m;const{key:s,metadataFieldKey:i}=e.detail,a=this.renderRoot.querySelector("ap-filters-bar"),o=this.renderRoot.querySelector("ap-content-toolbar");if(!a||!o)return;i?(this._pendingMetadataField=i,a.pendingMetadataField=i):s&&(this._pendingFilter=s,a.pendingFilter=s),await a.updateComplete;let n=a.renderRoot.querySelector(".chip.pending");if(!n){const _=a.renderRoot.querySelectorAll(".chip.pinned-empty"),y=i?(p=a._getMetadataLabel)==null?void 0:p.call(a,i):void 0;for(const C of _){const x=(m=(g=C.querySelector(".chip-label"))==null?void 0:g.textContent)==null?void 0:m.trim();if(i&&x===y){n=C;break}if(s&&x===(et[s]||s)){n=C;break}}}if(!n)return;const c=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?c.left-h.left:c.left,f=h?c.bottom-h.top:void 0;i?o.openMetadataFieldPanel(i,!0,u,f):s&&o.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},o={...a.applied};delete o[s],a.applied=o,a.pinned.includes(s)||(a.visible=a.visible.filter(c=>c!==s)),this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:i,values:a,metadataType:o}=e.detail,c={...this.store.getState().filters},d={...c.metadata},h={...d.applied};if(!a||Array.isArray(a)&&a.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":",metadataType:o},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),c.metadata=d,this.store.setState({filters:c,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),o.metadata=n,this.store.setState({filters:o})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata},n={...o.applied};delete n[s],o.applied=n,o.pinned.includes(s)||(o.visible=o.visible.filter(c=>c!==s)),a.metadata=o,this.store.setState({filters:a,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:i}=e.detail,o={...this.store.getState().filters};i?o.pinned.includes(s)||(o.pinned=[...o.pinned,s]):(o.pinned=o.pinned.filter(h=>h!==s),s in o.applied||(o.visible=o.visible.filter(h=>h!==s))),this.store.setState({filters:o});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;Ka(n,o.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:i}=e.detail,o={...this.store.getState().filters},n={...o.metadata};i?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),o.metadata=n,this.store.setState({filters:o});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;Qa(c,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,a={...this.store.getState().filters};a.visible=a.visible.filter(o=>o!==s),this.store.setState({filters:a})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,a={...this.store.getState().filters},o={...a.metadata};o.visible=o.visible.filter(n=>n!==s),a.metadata=o,this.store.setState({filters:a})}_handleFiltersSet(e){var h;const{applied:s,metadata:i}=e.detail,o={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];o.applied=c;const d=Object.keys(s);if(o.visible=[...new Set([...o.pinned,...d])],i){const u={...o.metadata};u.applied=i.applied;const f=Object.keys(i.applied);u.visible=[...new Set([...u.pinned,...f])],o.metadata=u}this.store.setState({filters:o,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){var s;const e=this.storeCtrl.state;if(e.activeTab==="labels"&&!e.activeLabelUuid)return no;if(e.activeTab==="collections"){if(!e.activeCollectionUuid)return lo;if(!(e.activeCollectionFolder&&!((s=e.activeCollectionFolder.children)!=null&&s.length)))return co}return e.searchQuery?oo:e.activeTab==="folders"?ro:ms}_buildSearchNotation(){const e=this.store.getState(),s={...this._normalizedForcedFilters,...e.filters.applied};return La(s,e.filters.metadata.applied).join(" ")}render(){var p,g,m,_,y,C,x,M,$,k,E,A,fe,ie,O,X,Z,D;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),i=Array.from(e.selectedFolders.keys()),a=this.selectionCtrl.getSelectedAssets(),o=this.selectionCtrl.getSelectedFolders(),n=((p=this.config)==null?void 0:p.folderSelection)!==!1,c=r.html`
|
|
7244
7244
|
<ap-header
|
|
7245
7245
|
.activeTab=${e.activeTab}
|
|
7246
|
-
.tabs=${((
|
|
7246
|
+
.tabs=${((g=this.config)==null?void 0:g.tabs)??["assets","folders"]}
|
|
7247
7247
|
.isInsideLabel=${e.activeTab==="labels"&&!!e.activeLabelUuid}
|
|
7248
7248
|
.isInsideCollection=${e.activeTab==="collections"&&!!e.activeCollectionUuid}
|
|
7249
|
-
.isInsideCollectionLeaf=${e.activeTab==="collections"&&!!e.activeCollectionFolder&&!((
|
|
7249
|
+
.isInsideCollectionLeaf=${e.activeTab==="collections"&&!!e.activeCollectionFolder&&!((m=e.activeCollectionFolder.children)!=null&&m.length)}
|
|
7250
7250
|
.viewMode=${e.viewMode}
|
|
7251
7251
|
.searchQuery=${e.searchQuery}
|
|
7252
|
-
.enableAISearch=${!!((
|
|
7252
|
+
.enableAISearch=${!!((_=this.config)!=null&&_.enableAISearch)}
|
|
7253
7253
|
.isAISearchActive=${e.isAISearchActive}
|
|
7254
7254
|
.regionalGroups=${e.regionalVariantGroups}
|
|
7255
7255
|
.regionalFilters=${e.regionalFilters}
|
|
@@ -7261,7 +7261,7 @@
|
|
|
7261
7261
|
@regional-change=${this._handleRegionalChange}
|
|
7262
7262
|
@ap-close=${()=>this._handleCancel("close-button")}
|
|
7263
7263
|
></ap-header>
|
|
7264
|
-
`,d=!!((
|
|
7264
|
+
`,d=!!((y=this.config)!=null&&y.uploader),h=r.html`
|
|
7265
7265
|
<div class="content-area"
|
|
7266
7266
|
@dragenter=${this._onDragEnter}
|
|
7267
7267
|
@dragover=${this._onDragOver}
|
|
@@ -7277,14 +7277,14 @@
|
|
|
7277
7277
|
</div>
|
|
7278
7278
|
`:r.nothing}
|
|
7279
7279
|
<div class="main-content">
|
|
7280
|
-
<div class="toolbar-filters-wrapper${(
|
|
7280
|
+
<div class="toolbar-filters-wrapper${(C=this.config)!=null&&C.stickyFilters?" sticky":""}">
|
|
7281
7281
|
<ap-content-toolbar
|
|
7282
7282
|
.isLoading=${e.isLoading}
|
|
7283
7283
|
.totalCount=${e.totalCount}
|
|
7284
7284
|
.totalFolderCount=${e.totalFolderCount}
|
|
7285
7285
|
.showUpload=${d}
|
|
7286
|
-
.showFilters=${!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((
|
|
7287
|
-
.countLabel=${e.activeTab==="labels"&&!e.activeLabelUuid?`${e.labels.length} label${e.labels.length!==1?"s":""}`:e.activeTab==="collections"&&!e.activeCollectionUuid?`${e.collections.length} collection${e.collections.length!==1?"s":""}`:e.activeTab==="collections"&&e.activeCollectionUuid&&!(e.activeCollectionFolder&&!((
|
|
7286
|
+
.showFilters=${!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((x=e.activeCollectionFolder.children)!=null&&x.length)))}
|
|
7287
|
+
.countLabel=${e.activeTab==="labels"&&!e.activeLabelUuid?`${e.labels.length} label${e.labels.length!==1?"s":""}`:e.activeTab==="collections"&&!e.activeCollectionUuid?`${e.collections.length} collection${e.collections.length!==1?"s":""}`:e.activeTab==="collections"&&e.activeCollectionUuid&&!(e.activeCollectionFolder&&!((M=e.activeCollectionFolder.children)!=null&&M.length))?`${this._getVisibleCollectionFolders().length} folder${this._getVisibleCollectionFolders().length!==1?"s":""}`:""}
|
|
7288
7288
|
.sortBy=${e.sortBy}
|
|
7289
7289
|
.sortDirection=${e.sortDirection}
|
|
7290
7290
|
.sortOptions=${this._getSortOptions()}
|
|
@@ -7308,7 +7308,7 @@
|
|
|
7308
7308
|
@upload-click=${this._handleUploadClick}
|
|
7309
7309
|
></ap-content-toolbar>
|
|
7310
7310
|
|
|
7311
|
-
${e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((
|
|
7311
|
+
${e.activeTab==="labels"&&!e.activeLabelUuid||e.activeTab==="collections"&&!(e.activeCollectionFolder&&!(($=e.activeCollectionFolder.children)!=null&&$.length))?r.nothing:r.html`
|
|
7312
7312
|
<ap-filters-bar
|
|
7313
7313
|
.appliedFilters=${e.filters.applied}
|
|
7314
7314
|
.appliedMetadata=${e.filters.metadata.applied}
|
|
@@ -7317,7 +7317,7 @@
|
|
|
7317
7317
|
.labels=${e.labels}
|
|
7318
7318
|
.pinnedFilters=${e.filters.pinned}
|
|
7319
7319
|
.pinnedMetadataFields=${e.filters.metadata.pinned}
|
|
7320
|
-
.forcedFilters=${((
|
|
7320
|
+
.forcedFilters=${((k=this.config)==null?void 0:k.forcedFilters)??{}}
|
|
7321
7321
|
@filter-remove=${this._handleFilterRemove}
|
|
7322
7322
|
@filter-deactivate=${this._handleFilterDeactivate}
|
|
7323
7323
|
@filter-open=${this._handleFilterOpen}
|
|
@@ -7337,7 +7337,7 @@
|
|
|
7337
7337
|
></ap-breadcrumb>`:r.nothing}
|
|
7338
7338
|
</div>
|
|
7339
7339
|
|
|
7340
|
-
${e.isLoading&&e.assets.length===0&&e.folders.length===0&&!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((
|
|
7340
|
+
${e.isLoading&&e.assets.length===0&&e.folders.length===0&&!(e.activeTab==="labels"&&!e.activeLabelUuid)&&!(e.activeTab==="collections"&&!(e.activeCollectionFolder&&!((E=e.activeCollectionFolder.children)!=null&&E.length)))?r.html`<ap-skeleton .variant=${e.viewMode} .gridSize=${((A=this.config)==null?void 0:A.gridSize)??"normal"} .multiSelect=${((fe=this.config)==null?void 0:fe.multiSelect)!==!1} .folderCount=${2}></ap-skeleton>`:this._renderContent(e,s,i,n)}
|
|
7341
7341
|
|
|
7342
7342
|
<ap-marquee-overlay .active=${this.marqueeCtrl.isActive} .rect=${this.marqueeCtrl.rect}></ap-marquee-overlay>
|
|
7343
7343
|
${this._folderResolveOpen?r.html`
|
|
@@ -7364,11 +7364,11 @@
|
|
|
7364
7364
|
.assets=${e.assets}
|
|
7365
7365
|
.selectedIds=${s}
|
|
7366
7366
|
.containerToken=${e.projectToken}
|
|
7367
|
-
.showMetadata=${((
|
|
7367
|
+
.showMetadata=${((ie=this.config)==null?void 0:ie.showMetadata)!==!1}
|
|
7368
7368
|
.metadataFields=${e.metadataFields}
|
|
7369
7369
|
.labels=${e.labels}
|
|
7370
7370
|
.regionalFilters=${e.regionalFilters}
|
|
7371
|
-
.multiSelect=${((
|
|
7371
|
+
.multiSelect=${((O=this.config)==null?void 0:O.multiSelect)??!0}
|
|
7372
7372
|
@preview-close=${this._handlePreviewClose}
|
|
7373
7373
|
@preview-navigate=${this._handlePreviewNavigate}
|
|
7374
7374
|
@asset-select=${this._handleAssetSelect}
|
|
@@ -7383,22 +7383,22 @@
|
|
|
7383
7383
|
.totalCount=${e.totalCount}
|
|
7384
7384
|
.totalFolderCount=${e.totalFolderCount}
|
|
7385
7385
|
.isSelectingAll=${e.isSelectingAll}
|
|
7386
|
-
.multiSelect=${((
|
|
7387
|
-
.maxSelections=${(
|
|
7388
|
-
.showTransform=${!!((
|
|
7386
|
+
.multiSelect=${((X=this.config)==null?void 0:X.multiSelect)??!0}
|
|
7387
|
+
.maxSelections=${(Z=this.config)==null?void 0:Z.maxSelections}
|
|
7388
|
+
.showTransform=${!!((D=this.config)!=null&&D.transformations)&&a.some(je)}
|
|
7389
7389
|
@selection-confirm=${this._handleSelectionConfirm}
|
|
7390
7390
|
@selection-transform=${this._handleSelectionTransform}
|
|
7391
7391
|
@selection-clear=${this._handleSelectionClear}
|
|
7392
7392
|
@selection-deselect=${this._handleSelectionDeselect}
|
|
7393
7393
|
@select-all=${this._handleSelectAll}
|
|
7394
7394
|
></ap-selection-bar>
|
|
7395
|
-
`,
|
|
7395
|
+
`,f=this._isUploaderOpen?r.html`
|
|
7396
7396
|
<div class="uploader-overlay">
|
|
7397
7397
|
<div class="uploader-body">${this._uploaderEl}</div>
|
|
7398
7398
|
</div>
|
|
7399
7399
|
`:r.nothing;return this._isInline?e.isOpen?r.html`
|
|
7400
7400
|
<div class="ap-inline">
|
|
7401
|
-
${this._isUploaderOpen?
|
|
7401
|
+
${this._isUploaderOpen?f:r.html`
|
|
7402
7402
|
<div class="inline-header">${c}</div>
|
|
7403
7403
|
<div class="inline-content">${h}</div>
|
|
7404
7404
|
<div class="inline-footer">${u}</div>
|
|
@@ -7407,15 +7407,15 @@
|
|
|
7407
7407
|
`:r.nothing:r.html`
|
|
7408
7408
|
<ap-modal
|
|
7409
7409
|
?open=${e.isOpen}
|
|
7410
|
-
@ap-cancel=${
|
|
7410
|
+
@ap-cancel=${Pe=>this._handleCancel(Pe.detail.reason)}
|
|
7411
7411
|
>
|
|
7412
|
-
${this._isUploaderOpen?
|
|
7412
|
+
${this._isUploaderOpen?f:r.html`
|
|
7413
7413
|
<div slot="header">${c}</div>
|
|
7414
7414
|
${h}
|
|
7415
7415
|
<div slot="footer">${u}</div>
|
|
7416
7416
|
`}
|
|
7417
7417
|
</ap-modal>
|
|
7418
|
-
`}_renderContent(e,s,i=[],a=!1){var o,n,c,d,h,u,
|
|
7418
|
+
`}_renderContent(e,s,i=[],a=!1){var o,n,c,d,h,u,f,p,g,m,_,y,C;if(e.activeTab==="assets")return!e.isLoading&&e.assets.length===0?r.html`
|
|
7419
7419
|
<div class="empty-state">
|
|
7420
7420
|
<ap-icon name="search" .size=${48}></ap-icon>
|
|
7421
7421
|
<div class="empty-title">No assets found</div>
|
|
@@ -7501,7 +7501,7 @@
|
|
|
7501
7501
|
@selection-clear=${this._handleSelectionClear}
|
|
7502
7502
|
></ap-list-view>
|
|
7503
7503
|
<div id="sentinel"></div>
|
|
7504
|
-
`;if(e.activeTab==="labels"){if(!e.activeLabelUuid){let
|
|
7504
|
+
`;if(e.activeTab==="labels"){if(!e.activeLabelUuid){let x=e.labels;if(e.searchQuery){const $=e.searchQuery.toLowerCase();x=e.labels.filter(k=>k.name.toLowerCase().includes($))}const M=e.sortDirection==="asc"?1:-1;return x=[...x].sort(($,k)=>M*$.name.localeCompare(k.name)),x.length===0?r.html`
|
|
7505
7505
|
<div class="empty-state">
|
|
7506
7506
|
<ap-icon name="tag" .size=${48}></ap-icon>
|
|
7507
7507
|
<div class="empty-title">${e.searchQuery?"No labels match your search":"No labels found"}</div>
|
|
@@ -7509,14 +7509,14 @@
|
|
|
7509
7509
|
</div>
|
|
7510
7510
|
`:e.viewMode==="grid"?r.html`
|
|
7511
7511
|
<div class="labels-grid">
|
|
7512
|
-
${
|
|
7513
|
-
<ap-label-card .label=${
|
|
7512
|
+
${x.map(($,k)=>r.html`
|
|
7513
|
+
<ap-label-card .label=${$} .index=${k} @label-open=${this._handleLabelOpen}></ap-label-card>
|
|
7514
7514
|
`)}
|
|
7515
7515
|
</div>
|
|
7516
7516
|
`:r.html`
|
|
7517
7517
|
<div class="labels-list">
|
|
7518
|
-
${
|
|
7519
|
-
<ap-label-row .label=${
|
|
7518
|
+
${x.map(($,k)=>r.html`
|
|
7519
|
+
<ap-label-row .label=${$} .index=${k} @label-open=${this._handleLabelOpen}></ap-label-row>
|
|
7520
7520
|
`)}
|
|
7521
7521
|
</div>
|
|
7522
7522
|
`}return!e.isLoading&&e.assets.length===0?r.html`
|
|
@@ -7532,7 +7532,7 @@
|
|
|
7532
7532
|
.selectedIds=${s}
|
|
7533
7533
|
.selectedFolderIds=${i}
|
|
7534
7534
|
.isLoading=${e.isLoading}
|
|
7535
|
-
.multiSelect=${((
|
|
7535
|
+
.multiSelect=${((f=this.config)==null?void 0:f.multiSelect)??!0}
|
|
7536
7536
|
.folderSelectable=${!1}
|
|
7537
7537
|
.gridSize=${((p=this.config)==null?void 0:p.gridSize)??"normal"}
|
|
7538
7538
|
@asset-select=${this._handleAssetSelect}
|
|
@@ -7547,7 +7547,7 @@
|
|
|
7547
7547
|
.selectedIds=${s}
|
|
7548
7548
|
.selectedFolderIds=${i}
|
|
7549
7549
|
.isLoading=${e.isLoading}
|
|
7550
|
-
.multiSelect=${((
|
|
7550
|
+
.multiSelect=${((g=this.config)==null?void 0:g.multiSelect)??!0}
|
|
7551
7551
|
.folderSelectable=${!1}
|
|
7552
7552
|
.totalCount=${e.totalCount}
|
|
7553
7553
|
.isSelectingAll=${e.isSelectingAll}
|
|
@@ -7558,7 +7558,7 @@
|
|
|
7558
7558
|
@selection-clear=${this._handleSelectionClear}
|
|
7559
7559
|
></ap-list-view>
|
|
7560
7560
|
<div id="sentinel"></div>
|
|
7561
|
-
`}if(e.activeTab==="collections"){if(!e.activeCollectionUuid){let
|
|
7561
|
+
`}if(e.activeTab==="collections"){if(!e.activeCollectionUuid){let $=e.collections;if(e.searchQuery){const E=e.searchQuery.toLowerCase();$=e.collections.filter(A=>A.title.toLowerCase().includes(E))}const k=e.sortDirection==="asc"?1:-1;return e.sortBy==="created_at"?$=[...$].sort((E,A)=>k*(new Date(E.created_at).getTime()-new Date(A.created_at).getTime())):e.sortBy==="updated_at"?$=[...$].sort((E,A)=>k*(new Date(E.updated_at).getTime()-new Date(A.updated_at).getTime())):$=[...$].sort((E,A)=>k*E.title.localeCompare(A.title)),$.length===0?r.html`
|
|
7562
7562
|
<div class="empty-state">
|
|
7563
7563
|
<ap-icon name="layout-grid" .size=${48}></ap-icon>
|
|
7564
7564
|
<div class="empty-title">${e.searchQuery?"No collections match your search":"No collections found"}</div>
|
|
@@ -7566,17 +7566,17 @@
|
|
|
7566
7566
|
</div>
|
|
7567
7567
|
`:e.viewMode==="grid"?r.html`
|
|
7568
7568
|
<div class="collections-grid">
|
|
7569
|
-
${
|
|
7570
|
-
<ap-collection-card .collection=${
|
|
7569
|
+
${$.map((E,A)=>r.html`
|
|
7570
|
+
<ap-collection-card .collection=${E} .index=${A} @collection-open=${this._handleCollectionOpen}></ap-collection-card>
|
|
7571
7571
|
`)}
|
|
7572
7572
|
</div>
|
|
7573
7573
|
`:r.html`
|
|
7574
7574
|
<div class="collections-list">
|
|
7575
|
-
${
|
|
7576
|
-
<ap-collection-row .collection=${
|
|
7575
|
+
${$.map((E,A)=>r.html`
|
|
7576
|
+
<ap-collection-row .collection=${E} .index=${A} @collection-open=${this._handleCollectionOpen}></ap-collection-row>
|
|
7577
7577
|
`)}
|
|
7578
7578
|
</div>
|
|
7579
|
-
`}if(e.isLoadingCollectionFolders)return r.html`<div class="loading-center"><ap-spinner></ap-spinner></div>`;const
|
|
7579
|
+
`}if(e.isLoadingCollectionFolders)return r.html`<div class="loading-center"><ap-spinner></ap-spinner></div>`;const x=this._getVisibleCollectionFolders();if(!e.activeCollectionFolder||(((m=e.activeCollectionFolder.children)==null?void 0:m.length)??0)>0){let $=x;if(e.searchQuery){const E=e.searchQuery.toLowerCase();$=x.filter(A=>A.name.toLowerCase().includes(E))}const k=e.sortDirection==="asc"?1:-1;return $=[...$].sort((E,A)=>k*E.name.localeCompare(A.name)),$.length===0?r.html`
|
|
7580
7580
|
<div class="empty-state">
|
|
7581
7581
|
<ap-icon name="folder" .size=${48}></ap-icon>
|
|
7582
7582
|
<div class="empty-title">${e.searchQuery?"No folders match your search":"No folders in this collection"}</div>
|
|
@@ -7584,14 +7584,14 @@
|
|
|
7584
7584
|
</div>
|
|
7585
7585
|
`:e.viewMode==="grid"?r.html`
|
|
7586
7586
|
<div class="collection-folders-grid">
|
|
7587
|
-
${
|
|
7588
|
-
<ap-collection-folder-card .folder=${
|
|
7587
|
+
${$.map((E,A)=>r.html`
|
|
7588
|
+
<ap-collection-folder-card .folder=${E} .index=${A} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-card>
|
|
7589
7589
|
`)}
|
|
7590
7590
|
</div>
|
|
7591
7591
|
`:r.html`
|
|
7592
7592
|
<div class="collection-folders-list">
|
|
7593
|
-
${
|
|
7594
|
-
<ap-collection-folder-row .folder=${
|
|
7593
|
+
${$.map((E,A)=>r.html`
|
|
7594
|
+
<ap-collection-folder-row .folder=${E} .index=${A} @collection-folder-open=${this._handleCollectionFolderOpen}></ap-collection-folder-row>
|
|
7595
7595
|
`)}
|
|
7596
7596
|
</div>
|
|
7597
7597
|
`}return!e.isLoading&&e.assets.length===0?r.html`
|
|
@@ -7607,9 +7607,9 @@
|
|
|
7607
7607
|
.selectedIds=${s}
|
|
7608
7608
|
.selectedFolderIds=${i}
|
|
7609
7609
|
.isLoading=${e.isLoading}
|
|
7610
|
-
.multiSelect=${((
|
|
7610
|
+
.multiSelect=${((_=this.config)==null?void 0:_.multiSelect)??!0}
|
|
7611
7611
|
.folderSelectable=${!1}
|
|
7612
|
-
.gridSize=${((
|
|
7612
|
+
.gridSize=${((y=this.config)==null?void 0:y.gridSize)??"normal"}
|
|
7613
7613
|
@asset-select=${this._handleAssetSelect}
|
|
7614
7614
|
@asset-preview=${this._handleAssetPreview}
|
|
7615
7615
|
@asset-quick-select=${this._handleQuickSelect}
|
|
@@ -7622,7 +7622,7 @@
|
|
|
7622
7622
|
.selectedIds=${s}
|
|
7623
7623
|
.selectedFolderIds=${i}
|
|
7624
7624
|
.isLoading=${e.isLoading}
|
|
7625
|
-
.multiSelect=${((
|
|
7625
|
+
.multiSelect=${((C=this.config)==null?void 0:C.multiSelect)??!0}
|
|
7626
7626
|
.folderSelectable=${!1}
|
|
7627
7627
|
.totalCount=${e.totalCount}
|
|
7628
7628
|
.isSelectingAll=${e.isSelectingAll}
|
|
@@ -7633,7 +7633,7 @@
|
|
|
7633
7633
|
@selection-clear=${this._handleSelectionClear}
|
|
7634
7634
|
></ap-list-view>
|
|
7635
7635
|
<div id="sentinel"></div>
|
|
7636
|
-
`}return r.nothing}};
|
|
7636
|
+
`}return r.nothing}};Ts.styles=[r.css`
|
|
7637
7637
|
:host {
|
|
7638
7638
|
display: contents;
|
|
7639
7639
|
font-family: var(--ap-font-family, system-ui, -apple-system, sans-serif);
|
|
@@ -7807,4 +7807,4 @@
|
|
|
7807
7807
|
width: 100%;
|
|
7808
7808
|
height: 100%;
|
|
7809
7809
|
}
|
|
7810
|
-
`];let
|
|
7810
|
+
`];let Me=Ts;Et([l.state()],Me.prototype,"_isDragOver");Et([l.state()],Me.prototype,"_isUploaderOpen");Et([l.state()],Me.prototype,"_folderResolveOpen");Et([l.state()],Me.prototype,"_transformOpen");Et([l.property({type:Object})],Me.prototype,"config");exports.AssetPicker=Me;exports.addCdnParams=xe;exports.buildTransformCdnParams=fs;exports.buildTransformedUrl=ca;exports.getAltText=Yi;exports.getAssetDimensions=Wi;exports.getAssetHeight=Dt;exports.getAssetWidth=Pt;exports.getBestVideoUrl=Ji;exports.getCdnUrl=ti;exports.getTranscodedUrl=Zi;exports.isAudio=Qi;exports.isImage=je;exports.isTranscoded=Xi;exports.isVideo=Ki;
|