@scaleflex/asset-picker 0.2.0 → 0.2.1
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/.claude/settings.local.json +49 -0
- package/.claude/skills/integrate-asset-picker/SKILL.md +391 -0
- package/README.md +43 -11
- package/dist/{asset-picker-CSsp_Huy.js → asset-picker-CCQPEvDB.js} +8 -18
- package/dist/{asset-picker-DBOWNXd-.cjs → asset-picker-DH2dd4M9.cjs} +81 -81
- package/dist/asset-picker.d.ts.map +1 -1
- package/dist/define.cjs +1 -1
- package/dist/define.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/services/api-client.d.ts +1 -0
- package/dist/services/api-client.d.ts.map +1 -1
- package/dist/types/config.types.d.ts +7 -8
- package/dist/types/config.types.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ws=Object.create;var jt=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,Es=Object.prototype.hasOwnProperty;var Fs=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ss(e))!Es.call(t,i)&&i!==s&&jt(t,i,{get:()=>e[i],enumerable:!(a=ks(e,i))||a.enumerable});return t};var As=(t,e,s)=>(s=t!=null?ws(Cs(t)):{},Fs(e||!t||!t.__esModule?jt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),c=require("lit/decorators.js");class Ts{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(a=>a(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const a=this._pendingState;this._pendingState=null,this.setState(a)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Os(){return new Ts({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map})}class Ms{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}class Ps{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}handleSelect(e,s,a){var d,h;const i=this.store.getState(),r=new Map(i.selectedAssets);if(!(((d=i.config)==null?void 0:d.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r}),this.lastClickedIndex=s;return}if(a.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=i.assets;for(let g=u;g<=f;g++)p[g]&&r.set(p[g].uuid,p[g])}else a.metaKey||a.ctrlKey?r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e):(r.clear(),r.set(e.uuid,e));const l=(h=i.config)==null?void 0:h.maxSelections;l&&r.size>l||(this.lastClickedIndex=s,this.store.setState({selectedAssets:r}))}isSelected(e){return this.store.getState().selectedAssets.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var n;const a=(n=this.store.getState().config)==null?void 0:n.maxSelections,i=new Map,r=a?Math.min(e.length,a):e.length;for(let l=0;l<r;l++)i.set(e[l].uuid,e[l]);return this.store.setState({selectedAssets:i}),this.lastClickedIndex=-1,i.size}clearSelection(){this.store.setState({selectedAssets:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}}class Ls{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(a=>{var i;(i=a[0])!=null&&i.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const Nt=5,we=40,Bt=15;class Is{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=a=>this.onMouseDown(a),this.handleMouseMove=a=>this.onMouseMove(a),this.handleMouseUp=()=>this.onMouseUp(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(a=>{if(!(a instanceof HTMLElement))return!1;if(a instanceof HTMLButtonElement||a instanceof HTMLInputElement)return!0;const i=a.tagName.toLowerCase();return!!(i.startsWith("ap-asset-")||i.startsWith("ap-folder-")||a.classList.contains("check")||a.classList.contains("check-box"))})}onMouseDown(e){if(e.button!==0||this.isInteractiveTarget(e))return;const s=this.container.getBoundingClientRect();this.startX=e.clientX-s.left+this.container.scrollLeft,this.startY=e.clientY-s.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){if(this.container){if(!this._dragging){const s=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(s<Nt&&a<Nt)return;this._dragging=!0,this.isActive=!0,this.preMarqueeSelection=new Map(this.store.getState().selectedAssets)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),a=e.clientX-s.left+this.container.scrollLeft,i=e.clientY-s.top+this.container.scrollTop;this.rect={x:Math.min(this.startX,a),y:Math.min(this.startY,i),width:Math.abs(a-this.startX),height:Math.abs(i-this.startY)},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),a=e.clientY-s.top,i=s.bottom-e.clientY,r=a<we||i<we;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,a=s.clientY-e.top,i=e.bottom-s.clientY;let r=0;a<we?r=-Bt*(1-a/we):i<we&&(r=Bt*(1-i/we)),r!==0&&(this.container.scrollTop+=r,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}queryCards(){for(const e of Array.from(this.container.children))if(e.shadowRoot){const s=e.shadowRoot.querySelectorAll("[data-asset-uuid]");if(s.length>0)return s}return this.container.querySelectorAll("[data-asset-uuid]")}selectIntersecting(){var i;if(!this.container)return;const e=this.queryCards(),s=new Map(this.preMarqueeSelection);e.forEach(r=>{const n=r.getBoundingClientRect(),l=this.container.getBoundingClientRect(),d={x:n.left-l.left+this.container.scrollLeft,y:n.top-l.top+this.container.scrollTop,width:n.width,height:n.height},h=this.rect.x<d.x+d.width&&this.rect.x+this.rect.width>d.x&&this.rect.y<d.y+d.height&&this.rect.y+this.rect.height>d.y,u=r.dataset.assetUuid;if(h){const f=this.store.getState().assets.find(p=>p.uuid===u);f&&s.set(u,f)}});const a=(i=this.store.getState().config)==null?void 0:i.maxSelections;if(a&&s.size>a){const r=Array.from(s.entries()).slice(0,a);this.store.setState({selectedAssets:new Map(r)})}else this.store.setState({selectedAssets:s})}}class Ds{constructor(e,s){this.auth=e;const a=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${a}/v5`}setSassKey(e){this.sassKey=e}getSecurityTemplateKey(){if(this.auth.mode==="securityTemplate")return this.auth.securityTemplateKey}async request(e,s){const a=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([l,d])=>{d!=null&&(Array.isArray(d)?a.searchParams.set(l,d.join(",")):a.searchParams.set(l,String(d)))});const i={};if(this.auth.mode==="session"){const l=this.auth;i["X-Session-Token"]=l.sessionToken,i["X-Company-Token"]=l.companyToken,i["X-Project-Token"]=l.projectToken}else{const l=this.auth;this.sassKey?i["X-Filerobot-Key"]=this.sassKey:i["X-Filerobot-Key"]=l.securityTemplateKey}const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(a.toString(),{headers:i,signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}async post(e,s){const a=new URL(`${this.baseUrl}${e}`),i={"Content-Type":"application/json"};if(this.auth.mode==="session"){const l=this.auth;i["X-Session-Token"]=l.sessionToken,i["X-Company-Token"]=l.companyToken,i["X-Project-Token"]=l.projectToken}else{const l=this.auth;this.sassKey?i["X-Filerobot-Key"]=this.sassKey:i["X-Filerobot-Key"]=l.securityTemplateKey}const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const l=await fetch(a.toString(),{method:"POST",headers:i,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!l.ok){let h=`API error: ${l.status} ${l.statusText}`;try{const u=await l.json();u.msg&&(h=`API error: ${l.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await l.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(l){throw clearTimeout(n),l instanceof DOMException&&l.name==="AbortError"?new Error("API request timed out"):l}}}function zs(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",a=t.sort_direction??"desc",i={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${i[s]||s}:${a}`,t.folder&&(e.folder=t.folder);const r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function Ye(t,e){const s=zs(e);return t.request("/files",s)}async function Ut(t,e){const s={folder:e.folder,recursive:e.recursive??1},a=[];return e.search&&a.push(e.search),e.q&&a.push(e.q),a.length>0&&(s.q=a.join(" ")),t.request("/files/stats",s)}async function Rs(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const a=(e==null?void 0:e.sort_by)??"created_at",i=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[a]||a}:${i}`,await t.request("/folders",s)}async function js(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function Ns(t){return await t.request("/labels")}async function Bs(t){return((await t.request("/tags")).tags||[]).map(a=>({...a,label:a.names.en||Object.values(a.names)[0]||""})).filter(a=>a.label).sort((a,i)=>a.label.localeCompare(i.label))}async function Us(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}const m={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},R={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},_={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Vs={AND:"AND"},x={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},ct={[x.DATE]:"date_",[x.BOOLEAN]:"bool_",[x.NUMERIC]:"num_",[x.DECIMAL2]:"dec_",[x.ATTACHMENTS_ASSETS]:"attach_",[x.ATTACHMENT_URI]:"uri_",[x.SELECT_ONE]:"one_",[x.MULTI_SELECT]:"multi_",[x.SUPERTAGS]:"tags_",[x.TEXT]:"text_",[x.TEXT_AREA]:"area_",[x.GEO_POINT]:"geo_",[x.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(ct).map(([t,e])=>[e,t]));const Zt=Object.values(ct),Ie={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Vt={EMPTY:"empty",NOT_EMPTY:"non-empty"},B="empty",U="non-empty",he="specific",gt=10,ft=10,Xe=10,Jt="filters:pinned:",es="metadata:pinned:",qt=[m.DATE,m.TYPE],ts=_.IS,Qe="20",Ze="1",qs=0,Hs=[{key:m.DATE,label:"Date",icon:"calendar",type:"date"},{key:m.TYPE,label:"Format",icon:"file-type",type:"string"},{key:m.SIZE,label:"Size",icon:"scaling",type:"string"},{key:m.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:m.TAGS,label:"Tags",icon:"hash",type:"string"},{key:m.LABELS,label:"Labels",icon:"tag",type:"string"},{key:m.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:m.IMAGE,label:"Image",icon:"image",type:"string"},{key:m.COLOR,label:"Color",icon:"swatch-book",type:"string"}],Ks={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Gs={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},St=[Ks,...Hs,Gs],ke={[m.TYPE]:"Format",[m.DATE]:"Date",[m.SIZE]:"Size",[m.LICENSE_EXPIRY]:"License expiry",[m.TAGS]:"Tags",[m.LABELS]:"Labels",[m.PRODUCT_REF]:"Products",[m.IMAGE]:"Image",[m.COLOR]:"Color",[m.METADATA]:"Metadata",[m.APPROVAL]:"Approval"},ie={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},ss=[{value:ie.IMAGE,label:"Image",icon:"image"},{value:ie.VIDEO,label:"Video",icon:"clapperboard"},{value:ie.AUDIO,label:"Audio",icon:"music"},{value:ie.DOCUMENT,label:"Document",icon:"document"},{value:ie.ARCHIVE,label:"Archive",icon:"archive"},{value:ie.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ie.FONTS,label:"Fonts",icon:"text"},{value:ie.OTHER,label:"Other",icon:"layout-grid"}],mt={RESOLUTION:0,ORIENTATION:1,FACES:2},Ys=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Xs=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Ws=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],is=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Et=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],as=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],Qs=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],Zs=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],Js=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],vt=[{label:"Is",value:_.IS},{label:"Contains",value:_.CONTAINS_IN_TEXT}],X=[{label:"Is",value:_.IS},{label:"Is not",value:_.IS_NOT}],bt=[{label:"Is",value:_.IS_EXACT},{label:"Contains",value:_.IS},{label:"Does not contain",value:_.IS_NOT}],_t=[{label:"Is",value:_.IS},{label:"Greater than",value:_.GREATER_THAN_OR_EQUAL},{label:"Is not",value:_.IS_NOT},{label:"Less than",value:_.LESS_THAN_OR_EQUAL},{label:"Between",value:_.RANGE}],ei=[{label:"Is",value:_.IS_EXACT},{label:"Is not",value:_.IS_NOT}],Ht=[{label:"Contains",value:_.CONTAINS},{label:"Does not contain",value:_.IS_NOT}],ti=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],ge=[{label:"Empty",value:B},{label:"Not empty",value:U}],yt=[...ge,{label:"Specific",value:he}],si=[{label:"Empty",value:B},{label:"Not empty",value:U},{label:"True",value:"true"},{label:"False",value:"false"}],ii={[x.TEXT]:"text",[x.TEXT_AREA]:"text",[x.NUMERIC]:"number",[x.DECIMAL2]:"number",[x.BOOLEAN]:"boolean",[x.SELECT_ONE]:"select-one",[x.MULTI_SELECT]:"multi-select",[x.SUPERTAGS]:"tags",[x.DATE]:"date",[x.GEO_POINT]:"geo",[x.ATTACHMENTS_ASSETS]:"attachment",[x.ATTACHMENT_URI]:"attachment",[x.INTEGER_LIST]:"attachment"};async function ai(t){var v,w,b,O;const e=await t.request("/settings"),s=e.settings??e,a=(s==null?void 0:s.metadata)??e.metadata,r=((a==null?void 0:a.model)??[])[qs],n=a==null?void 0:a.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map($=>({uuid:$.uuid,label:$.label??$.name??"",variants:($.variants??[]).map(k=>({api_value:k.api_value??k.value??"",internal_unique_value:k.internal_unique_value??k.api_value??"",label:k.label??k.name??""}))})).filter($=>$.variants.length>1),h={};for(const $ of d)h[$.uuid]=((v=$.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??((w=e.settings)==null?void 0:w.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const $ of p){const k=((b=$.name)==null?void 0:b.toLowerCase())==="products"||((O=$.name)==null?void 0:O.toLowerCase())==="product fields";for(const A of $.fields??[]){const T=A.possible_values,L=T==null?void 0:T.map(C=>({api_value:C.api_value??C.value??"",internal_unique_value:C.internal_unique_value??C.api_value??"",label:C.label??C.name??C.api_value??""}));g.push({key:A.key??A.ckey,label:A.title??A.label??A.key??"",type:A.type??"text",slug:A.slug,ckey:A.ckey,possible_values:L,group:k?"product":"root",regionalVariantsGroupUuid:A.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ue(t){return t.toLocaleDateString("en-CA")}function We(){return ue(new Date)}function rs(t){const e=new Date;switch(t){case"today":return{from:We(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ue(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:We(),to:ue(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ue(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:We(),to:ue(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ue(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:We(),to:ue(s)}}default:return null}}function Kt(t,e){return e?e.type==="date"?ri(e):e.type==="string"?oi(e):!0:!1}function ri(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function oi(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ni(t,e={}){const s=[];for(const[a,i]of Object.entries(t)){if(!i||!Kt(a,i))continue;const r=ci(a,i);s.push(...r)}for(const[a,i]of Object.entries(e)){if(!i||!Kt(a,i))continue;const r=gi(a,i);s.push(...r)}return li(s)}function li(t){const e=[],s=[],a=[];for(const i of t)i.startsWith("type:")||i.startsWith("type=")?e.push(i):i.startsWith("mimetype:")||i.startsWith("mimetype=")?s.push(i):a.push(i);if(e.length>0&&s.length>0){const i=[...e,...s].join(" , ");a.push(i)}else a.push(...e,...s);return a}function ci(t,e){if(e.type==="date")return os(t,e);if(t===m.IMAGE)return ui(e);const s=e,{operator:a=ts,values:i=[],logic:r}=s;if(i.length===0)return[];switch(t){case m.SIZE:return di(t,i,"..");case m.FACES:return pi(t,a,i);case m.TAGS:return fe(t,a,Yt(i),",",r);case m.LABELS:return fe(t,a,Yt(i),",",r);case m.COLOR:return hi(a,i,r);case m.TYPE:return Gt(t,i,a);case m.MIME_TYPE:return Gt(t,i,a);case m.PRODUCT_REF:return fe(t,"=%",i,",",r);default:return fe(t,a,i,",",r)}}function os(t,e){const s=e.field||"created";if(e.kind===Ie.PRESET&&e.preset){if(e.preset===Vt.EMPTY)return[`${s}:"empty"`];if(e.preset===Vt.NOT_EMPTY)return[`${s}:"non-empty"`];const a=rs(e.preset);return a?a.to===null?[`${s}>"${a.from}"`]:[`${s}:"${a.from}..${a.to}"`]:[]}if(e.kind===Ie.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ie.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ie.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===Ie.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function di(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function pi(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function fe(t,e,s,a,i){if(s.length===0)return[];if(i===Vs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(a);return[`${t}${e}${r}`]}function hi(t,e,s){const a=[],i=fe("color_search",t,e,",",s);return a.push(...i),a.push('color_operator:"AND"'),a}function Gt(t,e,s,a){if(e.length===0)return[];const i=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${i}`]}function ui(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,l=n.resolution,d=n.orientation,h=n.faces;return l!=null&&l.length&&e.push(`resolution:"${l.join(",")}"`),d!=null&&d.length&&e.push(`orientation:"${d.join(",")}"`),h!=null&&h.length&&e.push(`faces:"${h.join(",")}"`),e}const s=t,a=s[mt.RESOLUTION],i=s[mt.ORIENTATION],r=s[mt.FACES];return a&&e.push(`resolution:"${a}"`),i&&e.push(`orientation:"${i}"`),r&&e.push(`faces:"${r}"`),e}function gi(t,e){const s=vi(t),a=mi(t);if(e.type==="date")return fi(s,e,a);const i=e,{operator:r=ts,values:n=[],logic:l,metadataType:d}=i;if(n.length===0)return[];if(n.length===1&&(n[0]===B||n[0]===U)){const h=d===x.GEO_POINT?_.IS+"~":_.IS;return[`${s}${h}"${n[0]}"`]}if((d===x.NUMERIC||d===x.DECIMAL2)&&r===_.RANGE)return[`${s}${_.IS}"${n.join('","')}"`];if(d===x.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return fe(s,r+"~",h,",",l)}return fe(s,r,n,",",l)}function fi(t,e,s){const a=os(t,e);return!s||a.length===0?a:a.map(i=>{const r=i.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${i}"`;const n=i.slice(0,r),d=i.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function mi(t){return t.startsWith("date_")}function vi(t){for(const e of Zt)if(t.startsWith(e))return t.slice(e.length);return t}function Yt(t){return t.map(e=>e.replace(/#/g,""))}const bi=new Set([m.DATE,m.LICENSE_EXPIRY,R.DUE_DATE]);function De(t){if(!t)return{};const e={};for(const[s,a]of Object.entries(t))a&&(e[s]=_i(s,a));return e}function _i(t,e){return e.type==="string"||e.type==="date"?e:bi.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function yi(t){const e=localStorage.getItem(Jt+t),s=localStorage.getItem(es+t);let a;try{a=e?JSON.parse(e):[...qt]}catch{a=[...qt]}let i;try{i=s?JSON.parse(s):[]}catch{i=[]}return{pinnedFilters:a,pinnedMetadata:i}}function xi(t,e){localStorage.setItem(Jt+t,JSON.stringify(e))}function $i(t,e){localStorage.setItem(es+t,JSON.stringify(e))}const ns="sort-by",ls="sort-order";function Xt(t,e){try{localStorage.setItem(ns,t),localStorage.setItem(ls,e)}catch{}}function wi(){try{const t=localStorage.getItem(ns),e=localStorage.getItem(ls);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const cs="ap-last-folder",ds="ap-last-view";function Wt(t){try{localStorage.setItem(cs,t)}catch{}}function ki(){try{return localStorage.getItem(cs)}catch{return null}}function Si(t){try{localStorage.setItem(ds,t)}catch{}}function Ci(){try{return localStorage.getItem(ds)}catch{return null}}function Ei(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,a=parseInt(s.slice(0,2),16)/255,i=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[a,i,r]}function xt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Fi(t,e,s){const a=xt(t),i=xt(e),r=xt(s),n=.4122214708*a+.5363325363*i+.0514459929*r,l=.2119034982*a+.6806995451*i+.1073969566*r,d=.0883024619*a+.2817188376*i+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(l),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,v=.0259040371*h+.7827717662*u-.808675766*f,w=Math.sqrt(g*g+v*v);let b=Math.atan2(v,g)*(180/Math.PI);return b<0&&(b+=360),[p,w,b]}function Ai(t){return t>.7}function Ti(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[a,i,r]=Ei(e),[n,l,d]=Fi(a,i,r),h=`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)})`,u=Ai(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.1)`),t.style.setProperty("--ap-primary-20",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.2)`),t.style.setProperty("--ap-accent",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.07)`),t.style.setProperty("--ap-accent-foreground",h),t.style.setProperty("--ap-ring",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.7)`),t.style.setProperty("--ap-selection-bg",`oklch(${n.toFixed(3)} ${l.toFixed(3)} ${d.toFixed(1)} / 0.08)`)}const Ft=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Oi=[{value:"relevance",label:"Relevance"},...Ft],Mi=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}];var Pi=Object.defineProperty,Li=Object.getOwnPropertyDescriptor,At=(t,e,s,a)=>{for(var i=a>1?void 0:a?Li(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Pi(e,s,i),i};let Re=class extends o.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return o.html`
|
|
1
|
+
"use strict";var ws=Object.create;var Nt=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var Ss=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,Es=Object.prototype.hasOwnProperty;var Fs=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Ss(e))!Es.call(t,i)&&i!==s&&Nt(t,i,{get:()=>e[i],enumerable:!(a=ks(e,i))||a.enumerable});return t};var As=(t,e,s)=>(s=t!=null?ws(Cs(t)):{},Fs(e||!t||!t.__esModule?Nt(s,"default",{value:t,enumerable:!0}):s,t));const o=require("lit"),l=require("lit/decorators.js");class Ts{constructor(e){this.listeners=new Set,this._notifying=!1,this._pendingState=null,this.state=e}getState(){return this.state}setState(e){if(this._notifying){this._pendingState={...this._pendingState||{},...e};return}const s=this.state;this.state={...s,...e},this._notifying=!0;try{this.listeners.forEach(a=>a(this.state,s))}finally{this._notifying=!1}if(this._pendingState){const a=this._pendingState;this._pendingState=null,this.setState(a)}}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}destroy(){this.listeners.clear()}}function Os(){return new Ts({config:null,projectToken:"",sassKey:"",brandColor:"",isOpen:!1,activeTab:"assets",viewMode:"grid",searchQuery:"",sortBy:"modified_at",sortDirection:"desc",previewAsset:null,isPreviewOpen:!1,assets:[],folders:[],folderPreviews:{},labels:[],tags:[],currentFolder:null,currentFolderPath:"/",breadcrumb:[],offset:0,limit:100,totalCount:0,totalFolderCount:0,isLoading:!1,isSelectingAll:!1,hasMore:!1,filters:{metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},metadataFields:[],regionalVariantGroups:[],regionalFilters:{},selectedAssets:new Map})}class Ms{constructor(e,s){this.host=e,this.store=s,e.addController(this)}get state(){return this.store.getState()}setState(e){this.store.setState(e)}hostConnected(){this.unsubscribe=this.store.subscribe(()=>{this.host.requestUpdate()})}hostDisconnected(){var e;(e=this.unsubscribe)==null||e.call(this)}}class Ls{constructor(e,s){this.lastClickedIndex=-1,this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){}handleSelect(e,s,a){var d,h;const i=this.store.getState(),r=new Map(i.selectedAssets);if(!(((d=i.config)==null?void 0:d.multiSelect)??!0)){r.clear(),r.set(e.uuid,e),this.store.setState({selectedAssets:r}),this.lastClickedIndex=s;return}if(a.shiftKey&&this.lastClickedIndex>=0){const u=Math.min(this.lastClickedIndex,s),f=Math.max(this.lastClickedIndex,s),p=i.assets;for(let g=u;g<=f;g++)p[g]&&r.set(p[g].uuid,p[g])}else a.metaKey||a.ctrlKey?r.has(e.uuid)?r.delete(e.uuid):r.set(e.uuid,e):(r.clear(),r.set(e.uuid,e));const c=(h=i.config)==null?void 0:h.maxSelections;c&&r.size>c||(this.lastClickedIndex=s,this.store.setState({selectedAssets:r}))}isSelected(e){return this.store.getState().selectedAssets.has(e)}resetRange(){this.lastClickedIndex=-1}selectAll(e){var n;const a=(n=this.store.getState().config)==null?void 0:n.maxSelections,i=new Map,r=a?Math.min(e.length,a):e.length;for(let c=0;c<r;c++)i.set(e[c].uuid,e[c]);return this.store.setState({selectedAssets:i}),this.lastClickedIndex=-1,i.size}clearSelection(){this.store.setState({selectedAssets:new Map}),this.lastClickedIndex=-1}getSelectedAssets(){return Array.from(this.store.getState().selectedAssets.values())}}class Ps{constructor(e,s){this.host=e,this.onLoadMore=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.disconnect()}observe(e,s){this.disconnect(),this.sentinel=e,this.observer=new IntersectionObserver(a=>{var i;(i=a[0])!=null&&i.isIntersecting&&this.onLoadMore()},{root:s??null,rootMargin:"200px"}),this.observer.observe(e)}disconnect(){this.observer&&this.sentinel&&(this.observer.unobserve(this.sentinel),this.observer.disconnect()),this.observer=void 0,this.sentinel=void 0}}const jt=5,we=40,Bt=15;class Is{constructor(e,s){this.startX=0,this.startY=0,this.startClientX=0,this.startClientY=0,this.preMarqueeSelection=new Map,this._dragging=!1,this._scrollRAF=null,this._lastMouseEvent=null,this.isActive=!1,this.rect={x:0,y:0,width:0,height:0},this.handleMouseDown=a=>this.onMouseDown(a),this.handleMouseMove=a=>this.onMouseMove(a),this.handleMouseUp=()=>this.onMouseUp(),this.host=e,this.store=s,e.addController(this)}hostConnected(){}hostDisconnected(){this.detach()}attach(e){this.detach(),this.container=e,e.addEventListener("mousedown",this.handleMouseDown)}detach(){this.container&&this.container.removeEventListener("mousedown",this.handleMouseDown),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.stopAutoScroll(),this._lastMouseEvent=null}isInteractiveTarget(e){return e.composedPath().some(a=>{if(!(a instanceof HTMLElement))return!1;if(a instanceof HTMLButtonElement||a instanceof HTMLInputElement)return!0;const i=a.tagName.toLowerCase();return!!(i.startsWith("ap-asset-")||i.startsWith("ap-folder-")||a.classList.contains("check")||a.classList.contains("check-box"))})}onMouseDown(e){if(e.button!==0||this.isInteractiveTarget(e))return;const s=this.container.getBoundingClientRect();this.startX=e.clientX-s.left+this.container.scrollLeft,this.startY=e.clientY-s.top+this.container.scrollTop,this.startClientX=e.clientX,this.startClientY=e.clientY,this._dragging=!1,this.isActive=!1,document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("mouseup",this.handleMouseUp)}onMouseMove(e){if(this.container){if(!this._dragging){const s=Math.abs(e.clientX-this.startClientX),a=Math.abs(e.clientY-this.startClientY);if(s<jt&&a<jt)return;this._dragging=!0,this.isActive=!0,this.preMarqueeSelection=new Map(this.store.getState().selectedAssets)}this._lastMouseEvent=e,this.updateMarqueeRect(e),this.startAutoScroll(e)}}updateMarqueeRect(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),a=e.clientX-s.left+this.container.scrollLeft,i=e.clientY-s.top+this.container.scrollTop;this.rect={x:Math.min(this.startX,a),y:Math.min(this.startY,i),width:Math.abs(a-this.startX),height:Math.abs(i-this.startY)},this.host.requestUpdate(),this.selectIntersecting()}startAutoScroll(e){if(!this.container)return;const s=this.container.getBoundingClientRect(),a=e.clientY-s.top,i=s.bottom-e.clientY,r=a<we||i<we;r&&!this._scrollRAF?this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()):r||this.stopAutoScroll()}autoScrollTick(){if(this._scrollRAF=null,!this.container||!this._dragging||!this._lastMouseEvent)return;const e=this.container.getBoundingClientRect(),s=this._lastMouseEvent,a=s.clientY-e.top,i=e.bottom-s.clientY;let r=0;a<we?r=-Bt*(1-a/we):i<we&&(r=Bt*(1-i/we)),r!==0&&(this.container.scrollTop+=r,this.updateMarqueeRect(s),this._scrollRAF=requestAnimationFrame(()=>this.autoScrollTick()))}stopAutoScroll(){this._scrollRAF&&(cancelAnimationFrame(this._scrollRAF),this._scrollRAF=null)}onMouseUp(){document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),this.stopAutoScroll(),this._lastMouseEvent=null,this._dragging&&(this.isActive=!1,this._dragging=!1,this.rect={x:0,y:0,width:0,height:0},this.host.requestUpdate())}queryCards(){for(const e of Array.from(this.container.children))if(e.shadowRoot){const s=e.shadowRoot.querySelectorAll("[data-asset-uuid]");if(s.length>0)return s}return this.container.querySelectorAll("[data-asset-uuid]")}selectIntersecting(){var i;if(!this.container)return;const e=this.queryCards(),s=new Map(this.preMarqueeSelection);e.forEach(r=>{const n=r.getBoundingClientRect(),c=this.container.getBoundingClientRect(),d={x:n.left-c.left+this.container.scrollLeft,y:n.top-c.top+this.container.scrollTop,width:n.width,height:n.height},h=this.rect.x<d.x+d.width&&this.rect.x+this.rect.width>d.x&&this.rect.y<d.y+d.height&&this.rect.y+this.rect.height>d.y,u=r.dataset.assetUuid;if(h){const f=this.store.getState().assets.find(p=>p.uuid===u);f&&s.set(u,f)}});const a=(i=this.store.getState().config)==null?void 0:i.maxSelections;if(a&&s.size>a){const r=Array.from(s.entries()).slice(0,a);this.store.setState({selectedAssets:new Map(r)})}else this.store.setState({selectedAssets:s})}}class Ds{constructor(e,s){this.auth=e;const a=e.projectToken;this.baseUrl=s||`https://api.filerobot.com/${a}/v5`,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 a=new URL(`${this.baseUrl}${e}`);s&&Object.entries(s).forEach(([c,d])=>{d!=null&&(Array.isArray(d)?a.searchParams.set(c,d.join(",")):a.searchParams.set(c,String(d)))});const i={};this._applyAuthHeaders(i);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(a.toString(),{headers:i,signal:r.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}async post(e,s){const a=new URL(`${this.baseUrl}${e}`),i={"Content-Type":"application/json"};this._applyAuthHeaders(i);const r=new AbortController,n=setTimeout(()=>r.abort(),3e4);try{const c=await fetch(a.toString(),{method:"POST",headers:i,body:JSON.stringify(s),signal:r.signal});if(clearTimeout(n),!c.ok){let h=`API error: ${c.status} ${c.statusText}`;try{const u=await c.json();u.msg&&(h=`API error: ${c.status} - ${u.msg}`)}catch{}throw new Error(h)}const d=await c.json();if(d.status==="error")throw new Error(`API error: ${d.msg||"Unknown error"}`);return d}catch(c){throw clearTimeout(n),c instanceof DOMException&&c.name==="AbortError"?new Error("API request timed out"):c}}}function zs(t){const e={offset:t.offset??0,limit:t.limit??100,format:"json,regvar:api,select:internal",preview:2301,recursive:t.recursive??1},s=t.sort_by??"created_at",a=t.sort_direction??"desc",i={created_at:"created_at",modified_at:"modified_at",name:"name",size:"size",type:"type"};e.sort=`${i[s]||s}:${a}`,t.folder&&(e.folder=t.folder);const r=[];return t.search&&r.push(t.search),t.q&&r.push(t.q),r.length>0&&(e.q=r.join(" ")),e}async function Ye(t,e){const s=zs(e);return t.request("/files",s)}async function Ut(t,e){const s={folder:e.folder,recursive:e.recursive??1},a=[];return e.search&&a.push(e.search),e.q&&a.push(e.q),a.length>0&&(s.q=a.join(" ")),t.request("/files/stats",s)}async function Rs(t,e){const s={recursive:(e==null?void 0:e.recursive)??0,folder:(e==null?void 0:e.folderPath)??"/",limit:(e==null?void 0:e.limit)??1e3,offset:(e==null?void 0:e.offset)??0};e!=null&&e.q&&(s.q=e.q);const a=(e==null?void 0:e.sort_by)??"created_at",i=(e==null?void 0:e.sort_direction)??"asc",r={created_at:"created_at",modified_at:"modified_at",name:"name"};return s.sort=`${r[a]||a}:${i}`,await t.request("/folders",s)}async function Ns(t,e){return e.length===0?{}:(await t.post("/folders/previews",{folders:e})).folders||{}}async function js(t){return await t.request("/labels")}async function Bs(t){return((await t.request("/tags")).tags||[]).map(a=>({...a,label:a.names.en||Object.values(a.names)[0]||""})).filter(a=>a.label).sort((a,i)=>a.label.localeCompare(i.label))}async function Us(t){const e=t.getSecurityTemplateKey();if(!e)throw new Error("Security template key is required for SASS key exchange");return(await t.request(`/key/${e}`)).key}const m={TYPE:"type",MIME_TYPE:"mimetype",METADATA:"metadata",DATE:"date",APPROVAL:"approval",SIZE:"size",LICENSE_EXPIRY:"asset_expiration",TAGS:"tags",IMAGE:"image",LABELS:"labels",PRODUCT_REF:"product_ref",FACES:"faces",COLOR:"color"},R={STATUS:"approval_status",APPROVER:"task_approver",REQUESTOR:"task_requester",DUE_DATE:"task_duedate"},_={IS:":",RANGE:"..",IS_NOT:":-",IS_EXACT:":=",CONTAINS:"~",CONTAINS_IN_TEXT:"~~~",GREATER_THAN_OR_EQUAL:">=",LESS_THAN_OR_EQUAL:"<="},Vs={AND:"AND"},x={NUMERIC:"numeric",SELECT_ONE:"select-one",MULTI_SELECT:"multi-select",TEXT_AREA:"textarea",TEXT:"text",SUPERTAGS:"tags",DATE:"date",BOOLEAN:"boolean",ATTACHMENTS_ASSETS:"attachments-assets",ATTACHMENT_URI:"attachment-uri",GEO_POINT:"geopoint",DECIMAL2:"decimal2",INTEGER_LIST:"integer-list"},ct={[x.DATE]:"date_",[x.BOOLEAN]:"bool_",[x.NUMERIC]:"num_",[x.DECIMAL2]:"dec_",[x.ATTACHMENTS_ASSETS]:"attach_",[x.ATTACHMENT_URI]:"uri_",[x.SELECT_ONE]:"one_",[x.MULTI_SELECT]:"multi_",[x.SUPERTAGS]:"tags_",[x.TEXT]:"text_",[x.TEXT_AREA]:"area_",[x.GEO_POINT]:"geo_",[x.INTEGER_LIST]:"intlist_"};Object.fromEntries(Object.entries(ct).map(([t,e])=>[e,t]));const Zt=Object.values(ct),Ie={PRESET:"preset",AFTER:"after",BEFORE:"before",BETWEEN:"between",SPECIFIC:"specific"},Vt={EMPTY:"empty",NOT_EMPTY:"non-empty"},B="empty",U="non-empty",he="specific",gt=10,ft=10,Xe=10,Jt="filters:pinned:",es="metadata:pinned:",qt=[m.DATE,m.TYPE],ts=_.IS,Qe="20",Ze="1",qs=0,Hs=[{key:m.DATE,label:"Date",icon:"calendar",type:"date"},{key:m.TYPE,label:"Format",icon:"file-type",type:"string"},{key:m.SIZE,label:"Size",icon:"scaling",type:"string"},{key:m.LICENSE_EXPIRY,label:"License expiry",icon:"history",type:"date"},{key:m.TAGS,label:"Tags",icon:"hash",type:"string"},{key:m.LABELS,label:"Labels",icon:"tag",type:"string"},{key:m.PRODUCT_REF,label:"Products",icon:"box",type:"string"},{key:m.IMAGE,label:"Image",icon:"image",type:"string"},{key:m.COLOR,label:"Color",icon:"swatch-book",type:"string"}],Ks={key:m.METADATA,label:"Metadata",icon:"file-text",type:"string"},Gs={key:m.APPROVAL,label:"Approval",icon:"badge-check",type:"string"},St=[Ks,...Hs,Gs],ke={[m.TYPE]:"Format",[m.DATE]:"Date",[m.SIZE]:"Size",[m.LICENSE_EXPIRY]:"License expiry",[m.TAGS]:"Tags",[m.LABELS]:"Labels",[m.PRODUCT_REF]:"Products",[m.IMAGE]:"Image",[m.COLOR]:"Color",[m.METADATA]:"Metadata",[m.APPROVAL]:"Approval"},ie={IMAGE:"image",VIDEO:"video",AUDIO:"audio",DOCUMENT:"document",ARCHIVE:"archive",DESIGN_TEMPLATE:"template_fdt",OTHER:"other",FONTS:"font"},ss=[{value:ie.IMAGE,label:"Image",icon:"image"},{value:ie.VIDEO,label:"Video",icon:"clapperboard"},{value:ie.AUDIO,label:"Audio",icon:"music"},{value:ie.DOCUMENT,label:"Document",icon:"document"},{value:ie.ARCHIVE,label:"Archive",icon:"archive"},{value:ie.DESIGN_TEMPLATE,label:"Design template",icon:"layout-template"},{value:ie.FONTS,label:"Fonts",icon:"text"},{value:ie.OTHER,label:"Other",icon:"layout-grid"}],mt={RESOLUTION:0,ORIENTATION:1,FACES:2},Ys=[{value:"small",label:"Small"},{value:"medium",label:"Medium"},{value:"large",label:"Large"}],Xs=[{value:"portrait",label:"Portrait"},{value:"landscape",label:"Landscape"},{value:"square",label:"Square"},{value:"panorama",label:"Panorama"}],Ws=[{value:"none",label:"None"},{value:"1",label:"1"},{value:"2",label:"2"},{value:"3..",label:"3+"}],is=[{value:"created",label:"Created at"},{value:"updated",label:"Updated at"}],Et=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"last_week",label:"Last week"},{value:"after",label:"After date"},{value:"last_month",label:"Last month"},{value:"between",label:"Between dates"},{value:"last_year",label:"Last year"}],as=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],Qs=[{value:"today",label:"Today"},{value:"before",label:"Before date"},{value:"within_week",label:"Within week"},{value:"after",label:"After date"},{value:"within_month",label:"Within month"},{value:"between",label:"Between dates"},{value:"within_year",label:"Within year"},{value:"specific",label:"Specific date"}],Zs=["#ffffff","#99a1af","#000000","#894b00","#e7000b","#ff8904","#fdc700","#9ae600","#008236","#00bcff","#1447e6","#7f22fe","#e60076"],Js=[{label:"None (Exact)",value:"0"},{label:"Small",value:"1"},{label:"Medium",value:"2"},{label:"Large",value:"4"}],vt=[{label:"Is",value:_.IS},{label:"Contains",value:_.CONTAINS_IN_TEXT}],X=[{label:"Is",value:_.IS},{label:"Is not",value:_.IS_NOT}],bt=[{label:"Is",value:_.IS_EXACT},{label:"Contains",value:_.IS},{label:"Does not contain",value:_.IS_NOT}],_t=[{label:"Is",value:_.IS},{label:"Greater than",value:_.GREATER_THAN_OR_EQUAL},{label:"Is not",value:_.IS_NOT},{label:"Less than",value:_.LESS_THAN_OR_EQUAL},{label:"Between",value:_.RANGE}],ei=[{label:"Is",value:_.IS_EXACT},{label:"Is not",value:_.IS_NOT}],Ht=[{label:"Contains",value:_.CONTAINS},{label:"Does not contain",value:_.IS_NOT}],ti=[{value:"APPROVED",label:"Approved",icon:"circle-check-big",iconColor:"var(--ap-success, oklch(0.637 0.17 151.295))"},{value:"PENDING",label:"Pending",icon:"clock",iconColor:"var(--ap-warning, oklch(0.734 0.157 69.419))"},{value:"REJECTED",label:"Rejected",icon:"x-circle",iconColor:"var(--ap-destructive, oklch(0.577 0.215 27.325))"},{value:"CANCELLED",label:"Cancelled",icon:"ban",iconColor:"var(--ap-muted-foreground, oklch(0.685 0.033 249.82))"}],ge=[{label:"Empty",value:B},{label:"Not empty",value:U}],yt=[...ge,{label:"Specific",value:he}],si=[{label:"Empty",value:B},{label:"Not empty",value:U},{label:"True",value:"true"},{label:"False",value:"false"}],ii={[x.TEXT]:"text",[x.TEXT_AREA]:"text",[x.NUMERIC]:"number",[x.DECIMAL2]:"number",[x.BOOLEAN]:"boolean",[x.SELECT_ONE]:"select-one",[x.MULTI_SELECT]:"multi-select",[x.SUPERTAGS]:"tags",[x.DATE]:"date",[x.GEO_POINT]:"geo",[x.ATTACHMENTS_ASSETS]:"attachment",[x.ATTACHMENT_URI]:"attachment",[x.INTEGER_LIST]:"attachment"};async function ai(t){var v,w,b,O;const e=await t.request("/settings"),s=e.settings??e,a=(s==null?void 0:s.metadata)??e.metadata,r=((a==null?void 0:a.model)??[])[qs],n=a==null?void 0:a.store,d=((n==null?void 0:n.regional_variants_groups)??[]).map($=>({uuid:$.uuid,label:$.label??$.name??"",variants:($.variants??[]).map(k=>({api_value:k.api_value??k.value??"",internal_unique_value:k.internal_unique_value??k.api_value??"",label:k.label??k.name??""}))})).filter($=>$.variants.length>1),h={};for(const $ of d)h[$.uuid]=((v=$.variants[0])==null?void 0:v.api_value)??"";const u=(s==null?void 0:s.project_branding)??((w=e.settings)==null?void 0:w.project_branding),f=u==null?void 0:u.brandColor;if(!r)return{fields:[],regionalVariantGroups:d,regionalFilters:h,brandColor:f};const p=r.groups??[],g=[];for(const $ of p){const k=((b=$.name)==null?void 0:b.toLowerCase())==="products"||((O=$.name)==null?void 0:O.toLowerCase())==="product fields";for(const A of $.fields??[]){const T=A.possible_values,P=T==null?void 0:T.map(C=>({api_value:C.api_value??C.value??"",internal_unique_value:C.internal_unique_value??C.api_value??"",label:C.label??C.name??C.api_value??""}));g.push({key:A.key??A.ckey,label:A.title??A.label??A.key??"",type:A.type??"text",slug:A.slug,ckey:A.ckey,possible_values:P,group:k?"product":"root",regionalVariantsGroupUuid:A.regional_variants_group_uuid})}}return{fields:g,regionalVariantGroups:d,regionalFilters:h,brandColor:f}}function ue(t){return t.toLocaleDateString("en-CA")}function We(){return ue(new Date)}function rs(t){const e=new Date;switch(t){case"today":return{from:We(),to:null};case"last_week":{const s=new Date(e);return s.setDate(s.getDate()-7),{from:ue(s),to:null}}case"within_week":{const s=new Date(e);return s.setDate(s.getDate()+7),{from:We(),to:ue(s)}}case"last_month":{const s=new Date(e);return s.setDate(s.getDate()-30),{from:ue(s),to:null}}case"within_month":{const s=new Date(e);return s.setDate(s.getDate()+30),{from:We(),to:ue(s)}}case"last_year":{const s=new Date(e);return s.setDate(s.getDate()-365),{from:ue(s),to:null}}case"within_year":{const s=new Date(e);return s.setDate(s.getDate()+365),{from:We(),to:ue(s)}}default:return null}}function Kt(t,e){return e?e.type==="date"?ri(e):e.type==="string"?oi(e):!0:!1}function ri(t){return!(!t.kind&&!t.preset||t.kind==="preset"&&!t.preset||t.kind==="between"&&!t.from&&!t.to||t.kind==="after"&&!t.from||t.kind==="before"&&!t.to||t.kind==="specific"&&!t.from||t.from&&t.to&&new Date(t.from)>new Date(t.to))}function oi(t){return!t.values||!Array.isArray(t.values)?!1:t.values.filter(Boolean).length>0}function ni(t,e={}){const s=[];for(const[a,i]of Object.entries(t)){if(!i||!Kt(a,i))continue;const r=ci(a,i);s.push(...r)}for(const[a,i]of Object.entries(e)){if(!i||!Kt(a,i))continue;const r=gi(a,i);s.push(...r)}return li(s)}function li(t){const e=[],s=[],a=[];for(const i of t)i.startsWith("type:")||i.startsWith("type=")?e.push(i):i.startsWith("mimetype:")||i.startsWith("mimetype=")?s.push(i):a.push(i);if(e.length>0&&s.length>0){const i=[...e,...s].join(" , ");a.push(i)}else a.push(...e,...s);return a}function ci(t,e){if(e.type==="date")return os(t,e);if(t===m.IMAGE)return ui(e);const s=e,{operator:a=ts,values:i=[],logic:r}=s;if(i.length===0)return[];switch(t){case m.SIZE:return di(t,i,"..");case m.FACES:return pi(t,a,i);case m.TAGS:return fe(t,a,Yt(i),",",r);case m.LABELS:return fe(t,a,Yt(i),",",r);case m.COLOR:return hi(a,i,r);case m.TYPE:return Gt(t,i,a);case m.MIME_TYPE:return Gt(t,i,a);case m.PRODUCT_REF:return fe(t,"=%",i,",",r);default:return fe(t,a,i,",",r)}}function os(t,e){const s=e.field||"created";if(e.kind===Ie.PRESET&&e.preset){if(e.preset===Vt.EMPTY)return[`${s}:"empty"`];if(e.preset===Vt.NOT_EMPTY)return[`${s}:"non-empty"`];const a=rs(e.preset);return a?a.to===null?[`${s}>"${a.from}"`]:[`${s}:"${a.from}..${a.to}"`]:[]}if(e.kind===Ie.AFTER&&e.from)return[`${s}:>"${e.from}"`];if(e.kind===Ie.BEFORE&&e.to)return[`${s}:<"${e.to}"`];if(e.kind===Ie.BETWEEN){if(e.from&&e.to)return[`${s}:"${e.from}..${e.to}"`];if(e.from&&!e.to)return[`${s}:>"${e.from}"`];if(!e.from&&e.to)return[`${s}:<"${e.to}"`]}return e.kind===Ie.SPECIFIC&&e.from?[`${s}:"${e.from}"`]:[]}function di(t,e,s){return e.length===0?[]:[`${t}:"${e.join(s)}"`]}function pi(t,e,s){return s.length===0?[]:[`${t}${e}"${s.join(",")}"`]}function fe(t,e,s,a,i){if(s.length===0)return[];if(i===Vs.AND)return s.map(n=>`${t}${e}"${n}"`);const r=s.map(n=>`"${n}"`).join(a);return[`${t}${e}${r}`]}function hi(t,e,s){const a=[],i=fe("color_search",t,e,",",s);return a.push(...i),a.push('color_operator:"AND"'),a}function Gt(t,e,s,a){if(e.length===0)return[];const i=e.map(r=>`"${r}"`).join(",");return[`${t}${s}${i}`]}function ui(t){const e=[];if(typeof t=="object"&&t!==null&&!Array.isArray(t)){const n=t,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,a=s[mt.RESOLUTION],i=s[mt.ORIENTATION],r=s[mt.FACES];return a&&e.push(`resolution:"${a}"`),i&&e.push(`orientation:"${i}"`),r&&e.push(`faces:"${r}"`),e}function gi(t,e){const s=vi(t),a=mi(t);if(e.type==="date")return fi(s,e,a);const i=e,{operator:r=ts,values:n=[],logic:c,metadataType:d}=i;if(n.length===0)return[];if(n.length===1&&(n[0]===B||n[0]===U)){const h=d===x.GEO_POINT?_.IS+"~":_.IS;return[`${s}${h}"${n[0]}"`]}if((d===x.NUMERIC||d===x.DECIMAL2)&&r===_.RANGE)return[`${s}${_.IS}"${n.join('","')}"`];if(d===x.GEO_POINT){const h=n.map(u=>{const f=u.indexOf("..");if(f===-1)return`(${u})`;const p=u.slice(0,f),g=u.slice(f);return`(${p})${g}`});return fe(s,r+"~",h,",",c)}return fe(s,r,n,",",c)}function fi(t,e,s){const a=os(t,e);return!s||a.length===0?a:a.map(i=>{const r=i.search(/[^a-zA-Z0-9_]/);if(r===-1)return`"${i}"`;const n=i.slice(0,r),d=i.slice(r).replace(/"/g,"");return`"${n}${d}"`})}function mi(t){return t.startsWith("date_")}function vi(t){for(const e of Zt)if(t.startsWith(e))return t.slice(e.length);return t}function Yt(t){return t.map(e=>e.replace(/#/g,""))}const bi=new Set([m.DATE,m.LICENSE_EXPIRY,R.DUE_DATE]);function De(t){if(!t)return{};const e={};for(const[s,a]of Object.entries(t))a&&(e[s]=_i(s,a));return e}function _i(t,e){return e.type==="string"||e.type==="date"?e:bi.has(t)?{type:"date",field:e.field??"created",kind:e.kind??null,preset:e.preset??null,from:e.from??null,to:e.to??null}:{type:"string",values:e.values,...e.operator!==void 0&&{operator:e.operator},...e.logic!==void 0&&{logic:e.logic}}}function yi(t){const e=localStorage.getItem(Jt+t),s=localStorage.getItem(es+t);let a;try{a=e?JSON.parse(e):[...qt]}catch{a=[...qt]}let i;try{i=s?JSON.parse(s):[]}catch{i=[]}return{pinnedFilters:a,pinnedMetadata:i}}function xi(t,e){localStorage.setItem(Jt+t,JSON.stringify(e))}function $i(t,e){localStorage.setItem(es+t,JSON.stringify(e))}const ns="sort-by",ls="sort-order";function Xt(t,e){try{localStorage.setItem(ns,t),localStorage.setItem(ls,e)}catch{}}function wi(){try{const t=localStorage.getItem(ns),e=localStorage.getItem(ls);return{sortBy:t,sortDirection:e}}catch{return{sortBy:null,sortDirection:null}}}const cs="ap-last-folder",ds="ap-last-view";function Wt(t){try{localStorage.setItem(cs,t)}catch{}}function ki(){try{return localStorage.getItem(cs)}catch{return null}}function Si(t){try{localStorage.setItem(ds,t)}catch{}}function Ci(){try{return localStorage.getItem(ds)}catch{return null}}function Ei(t){const e=t.replace("#",""),s=e.length===3?e[0]+e[0]+e[1]+e[1]+e[2]+e[2]:e,a=parseInt(s.slice(0,2),16)/255,i=parseInt(s.slice(2,4),16)/255,r=parseInt(s.slice(4,6),16)/255;return[a,i,r]}function xt(t){return t<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function Fi(t,e,s){const a=xt(t),i=xt(e),r=xt(s),n=.4122214708*a+.5363325363*i+.0514459929*r,c=.2119034982*a+.6806995451*i+.1073969566*r,d=.0883024619*a+.2817188376*i+.6299787005*r,h=Math.cbrt(n),u=Math.cbrt(c),f=Math.cbrt(d),p=.2104542553*h+.793617785*u-.0040720468*f,g=1.9779984951*h-2.428592205*u+.4505937099*f,v=.0259040371*h+.7827717662*u-.808675766*f,w=Math.sqrt(g*g+v*v);let b=Math.atan2(v,g)*(180/Math.PI);return b<0&&(b+=360),[p,w,b]}function Ai(t){return t>.7}function Ti(t,e){const s=["--ap-primary","--ap-primary-foreground","--ap-primary-10","--ap-primary-20","--ap-accent","--ap-accent-foreground","--ap-ring","--ap-selection-bg"];if(!e){for(const f of s)t.style.removeProperty(f);return}const[a,i,r]=Ei(e),[n,c,d]=Fi(a,i,r),h=`oklch(${n.toFixed(3)} ${c.toFixed(3)} ${d.toFixed(1)})`,u=Ai(n)?"#000":"#fff";t.style.setProperty("--ap-primary",h),t.style.setProperty("--ap-primary-foreground",u),t.style.setProperty("--ap-primary-10",`oklch(${n.toFixed(3)} ${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 Ft=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"size",label:"Size"},{value:"type",label:"Format"}],Oi=[{value:"relevance",label:"Relevance"},...Ft],Mi=[{value:"name",label:"Name"},{value:"created_at",label:"Uploaded"},{value:"modified_at",label:"Modified"},{value:"files_count_recursive",label:"Assets count"},{value:"files_size_recursive",label:"Assets size"}];var Li=Object.defineProperty,Pi=Object.getOwnPropertyDescriptor,At=(t,e,s,a)=>{for(var i=a>1?void 0:a?Pi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Li(e,s,i),i};let Re=class extends o.LitElement{constructor(){super(...arguments),this.open=!1}updated(t){var e;super.updated(t),t.has("open")&&(this.open?this.dialog&&!this.dialog.open&&this.dialog.showModal():(e=this.dialog)!=null&&e.open&&this._animateClose())}_animateClose(){const t=this.dialog;if(t){if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){t.close();return}t.classList.add("closing"),t.addEventListener("animationend",()=>{t.classList.remove("closing"),t.close()},{once:!0})}}_handleBackdropClick(t){t.target===this.dialog&&this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"backdrop"},bubbles:!0,composed:!0}))}_handleCancel(t){t.preventDefault(),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:"escape"},bubbles:!0,composed:!0}))}render(){return o.html`
|
|
2
2
|
<dialog
|
|
3
3
|
@click=${this._handleBackdropClick}
|
|
4
4
|
@cancel=${this._handleCancel}
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
animation: none;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
`;At([
|
|
91
|
+
`;At([l.property({type:Boolean})],Re.prototype,"open",2);At([l.query("dialog")],Re.prototype,"dialog",2);Re=At([l.customElement("ap-modal")],Re);function Ii(t,e){let s;const a=((...i)=>{clearTimeout(s),s=setTimeout(()=>t(...i),e)});return a.cancel=()=>clearTimeout(s),a}const J=o.css`
|
|
92
92
|
*, *::before, *::after {
|
|
93
93
|
box-sizing: border-box;
|
|
94
94
|
}
|
|
@@ -208,7 +208,7 @@
|
|
|
208
208
|
width: 16px;
|
|
209
209
|
flex-shrink: 0;
|
|
210
210
|
}
|
|
211
|
-
`;dt([
|
|
211
|
+
`;dt([l.property({type:Array})],Ce.prototype,"groups",2);dt([l.property({type:Object})],Ce.prototype,"selectedFilters",2);dt([l.state()],Ce.prototype,"_open",2);Ce=dt([l.customElement("ap-regional-settings")],Ce);var Ri=Object.defineProperty,Ni=Object.getOwnPropertyDescriptor,ee=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ni(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ri(e,s,i),i};const ji=[{value:"assets",label:"Assets",icon:"gallery-vertical-end"},{value:"folders",label:"Folders",icon:"folder-open"}];let H=class extends o.LitElement{constructor(){super(...arguments),this.activeTab="assets",this.tabs=["assets","folders"],this.viewMode="grid",this.searchQuery="",this.regionalGroups=[],this.regionalFilters={},this.hideClose=!1,this._localSearch="",this._debouncedSearch=Ii(t=>{(t.length===0||t.length>=3)&&this.dispatchEvent(new CustomEvent("search-change",{detail:{value:t},bubbles:!0,composed:!0}))},300)}disconnectedCallback(){super.disconnectedCallback(),this._debouncedSearch.cancel()}willUpdate(t){t.has("searchQuery")&&(this._localSearch=this.searchQuery)}_handleInput(t){const e=t.target.value;this._localSearch=e,this._debouncedSearch(e)}_clearSearch(){this._localSearch="",this._debouncedSearch.cancel(),this.dispatchEvent(new CustomEvent("search-change",{detail:{value:""},bubbles:!0,composed:!0}))}_toggleView(){const t=this.viewMode==="grid"?"list":"grid";this.dispatchEvent(new CustomEvent("view-change",{detail:{mode:t},bubbles:!0,composed:!0}))}_handleTabChange(t){this.dispatchEvent(new CustomEvent("tab-change",{detail:{tab:t.detail.value},bubbles:!0,composed:!0}))}_handleRegionalChange(t){this.dispatchEvent(new CustomEvent("regional-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleClose(){this.dispatchEvent(new CustomEvent("ap-close",{bubbles:!0,composed:!0}))}render(){var e,s;const t=ji.filter(a=>this.tabs.includes(a.value));return((e=t.find(a=>a.value===this.activeTab))==null?void 0:e.label)??((s=t[0])==null||s.label),o.html`
|
|
212
212
|
<div class="header-row">
|
|
213
213
|
${t.length>1?o.html`<ap-dropdown
|
|
214
214
|
.value=${this.activeTab}
|
|
@@ -357,7 +357,7 @@
|
|
|
357
357
|
height: 24px;
|
|
358
358
|
background: var(--ap-border, oklch(92.86% 0.009 247.92));
|
|
359
359
|
}
|
|
360
|
-
`];ee([
|
|
360
|
+
`];ee([l.property()],H.prototype,"activeTab",2);ee([l.property({type:Array})],H.prototype,"tabs",2);ee([l.property()],H.prototype,"viewMode",2);ee([l.property()],H.prototype,"searchQuery",2);ee([l.property({type:Array})],H.prototype,"regionalGroups",2);ee([l.property({type:Object})],H.prototype,"regionalFilters",2);ee([l.property({type:Boolean})],H.prototype,"hideClose",2);ee([l.state()],H.prototype,"_localSearch",2);H=ee([l.customElement("ap-header")],H);var Bi=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,ps=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ui(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Bi(e,s,i),i};let Je=class extends o.LitElement{constructor(){super(...arguments),this.items=[]}_navigate(t){this.dispatchEvent(new CustomEvent("breadcrumb-navigate",{detail:{uuid:t},bubbles:!0,composed:!0}))}render(){return this.items.length===0?o.html``:o.html`
|
|
361
361
|
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
362
362
|
<button @click=${()=>this._navigate("")}>Root</button>
|
|
363
363
|
${this.items.map((t,e)=>o.html`
|
|
@@ -398,12 +398,12 @@
|
|
|
398
398
|
ap-icon {
|
|
399
399
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
400
400
|
}
|
|
401
|
-
`;ps([
|
|
401
|
+
`;ps([l.property({type:Array})],Je.prototype,"items",2);Je=ps([l.customElement("ap-breadcrumb")],Je);var Vi=Object.defineProperty,qi=Object.getOwnPropertyDescriptor,Tt=(t,e,s,a)=>{for(var i=a>1?void 0:a?qi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Vi(e,s,i),i};let Ne=class extends o.LitElement{constructor(){super(...arguments),this.title="",this.open=!1}render(){return this.open?o.html`
|
|
402
402
|
<div class="popover">
|
|
403
403
|
${this.title?o.html`<div class="title">${this.title}</div>`:""}
|
|
404
404
|
<slot></slot>
|
|
405
405
|
</div>
|
|
406
|
-
`:o.html``}};
|
|
406
|
+
`:o.html``}};Ne.styles=o.css`
|
|
407
407
|
:host {
|
|
408
408
|
display: block;
|
|
409
409
|
}
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
color: var(--ap-foreground, oklch(0.37 0.022 248.413));
|
|
429
429
|
margin-bottom: 12px;
|
|
430
430
|
}
|
|
431
|
-
`;Tt([
|
|
431
|
+
`;Tt([l.property()],Ne.prototype,"title",2);Tt([l.property({type:Boolean})],Ne.prototype,"open",2);Ne=Tt([l.customElement("ap-filter-popover")],Ne);var Hi=Object.defineProperty,Ki=Object.getOwnPropertyDescriptor,hs=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ki(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Hi(e,s,i),i};let et=class extends o.LitElement{constructor(){super(...arguments),this.selected=[]}_toggle(t){const e=this.selected.includes(t)?this.selected.filter(s=>s!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.TYPE,values:e,operator:_.IS},bubbles:!0,composed:!0}))}render(){return o.html`
|
|
432
432
|
<div class="options">
|
|
433
433
|
<span class="section-label">Formats</span>
|
|
434
434
|
${ss.map(t=>o.html`
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
.option.selected ap-icon {
|
|
492
492
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
493
493
|
}
|
|
494
|
-
`;hs([
|
|
494
|
+
`;hs([l.property({type:Array})],et.prototype,"selected",2);et=hs([l.customElement("ap-filter-type")],et);const te=o.css`
|
|
495
495
|
:host {
|
|
496
496
|
display: block;
|
|
497
497
|
}
|
|
@@ -842,7 +842,7 @@
|
|
|
842
842
|
.date-inputs {
|
|
843
843
|
margin-top: 4px;
|
|
844
844
|
}
|
|
845
|
-
`];_e([
|
|
845
|
+
`];_e([l.property()],W.prototype,"filterKey",2);_e([l.property()],W.prototype,"field",2);_e([l.property()],W.prototype,"kind",2);_e([l.property()],W.prototype,"preset",2);_e([l.property()],W.prototype,"from",2);_e([l.property()],W.prototype,"to",2);W=_e([l.customElement("ap-filter-date")],W);var Xi=Object.defineProperty,Wi=Object.getOwnPropertyDescriptor,Oe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Wi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Xi(e,s,i),i};let ae=class extends o.LitElement{constructor(){super(...arguments),this.tags=[],this.selected=[],this.filterKey=m.TAGS,this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _suggestedTags(){return this.tags.filter(t=>t.primary)}get _otherTags(){return this.tags.filter(t=>!t.primary)}get _atLimit(){return this.selected.length>=gt}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(a=>a!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:s,operator:_.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:e,operator:_.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:this.filterKey,values:[],operator:_.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getTagBySid(t){return this.tags.find(e=>e.sid===t)}_renderTagItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
|
|
846
846
|
<div
|
|
847
847
|
class="tag-item ${s?"disabled":""}"
|
|
848
848
|
title=${s?`You can select up to ${gt} tags`:o.nothing}
|
|
@@ -1020,7 +1020,7 @@
|
|
|
1020
1020
|
max-height: none;
|
|
1021
1021
|
overflow-y: visible;
|
|
1022
1022
|
}
|
|
1023
|
-
`];Oe([
|
|
1023
|
+
`];Oe([l.property({type:Array})],ae.prototype,"tags",2);Oe([l.property({type:Array})],ae.prototype,"selected",2);Oe([l.property()],ae.prototype,"filterKey",2);Oe([l.query(".tag-search")],ae.prototype,"_searchInput",2);Oe([l.state()],ae.prototype,"_search",2);ae=Oe([l.customElement("ap-filter-tags")],ae);var Qi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,qe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Zi(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Qi(e,s,i),i};let me=class extends o.LitElement{constructor(){super(...arguments),this.labels=[],this.selected=[],this._search=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}get _atLimit(){return this.selected.length>=ft}get _isSearching(){return this._search.trim().length>0}_toggle(t){const e=this.selected.includes(t);if(!e&&this._atLimit)return;const s=e?this.selected.filter(a=>a!==t):[...this.selected,t];this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:s,operator:_.IS},bubbles:!0,composed:!0}))}_remove(t){const e=this.selected.filter(s=>s!==t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:e,operator:_.IS},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.LABELS,values:[],operator:_.IS},bubbles:!0,composed:!0}))}_onSearchInput(t){this._search=t.target.value}_clearSearch(){this._search=""}_getLabelBySid(t){return this.labels.find(e=>e.sid===t)}_renderLabelItem(t){const e=this.selected.includes(t.sid),s=!e&&this._atLimit;return o.html`
|
|
1024
1024
|
<div
|
|
1025
1025
|
class="label-item ${s?"disabled":""}"
|
|
1026
1026
|
title=${s?`You can select up to ${ft} labels`:o.nothing}
|
|
@@ -1142,7 +1142,7 @@
|
|
|
1142
1142
|
flex-shrink: 0;
|
|
1143
1143
|
line-height: 0;
|
|
1144
1144
|
}
|
|
1145
|
-
`];qe([
|
|
1145
|
+
`];qe([l.property({type:Array})],me.prototype,"labels",2);qe([l.property({type:Array})],me.prototype,"selected",2);qe([l.query(".search-input")],me.prototype,"_searchInput",2);qe([l.state()],me.prototype,"_search",2);me=qe([l.customElement("ap-filter-labels")],me);var Ji=Object.defineProperty,ea=Object.getOwnPropertyDescriptor,Me=(t,e,s,a)=>{for(var i=a>1?void 0:a?ea(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ji(e,s,i),i};const wt=3,Ct=/^#[0-9A-Fa-f]{6}$/;function ta(t){const e=t.trim().split(/\s+/);return e.length<1||!Ct.test(e[0])?null:{hex:e[0],tolerance:e[1]||Ze,coverage:e[3]||Qe}}let re=class extends o.LitElement{constructor(){super(...arguments),this.values=[],this._colors=[],this._advanced=!1,this._showPalette=!1,this._initialized=!1}get _hasSelection(){return this._colors.length>0}get _selectedHexes(){return new Set(this._colors.map(t=>t.hex))}willUpdate(t){if(t.has("values")){const e=[];for(const s of this.values){const a=ta(s);a&&e.push(a)}(!this._initialized||this.values.length===0&&this._colors.length>0)&&(this._colors=e,e.length>0&&(this._advanced=e.some(s=>s.tolerance!==Ze||s.coverage!==Qe)),this._initialized=!0)}}_selectColor(t){if(!Ct.test(t))return;const e=this._colors.findIndex(s=>s.hex.toLowerCase()===t.toLowerCase());if(e>=0){this._removeColor(e);return}this._colors.length>=wt||(this._colors=[...this._colors,{hex:t,tolerance:Ze,coverage:Qe}],this._showPalette=!1,this._dispatchChange())}_removeColor(t){this._colors=this._colors.filter((e,s)=>s!==t),this._dispatchChange()}_clearAll(){this._colors=[],this._showPalette=!1,this._dispatchChange()}_toggleAdvanced(){this._advanced=!this._advanced,this._colors.length>0&&this._dispatchChange()}_handleHexInput(t,e){let a=e.target.value.trim();if(a.startsWith("#")||(a="#"+a),!Ct.test(a)||this._colors.some((n,c)=>c!==t&&n.hex.toLowerCase()===a.toLowerCase()))return;const r=[...this._colors];r[t]={...r[t],hex:a},this._colors=r,this._dispatchChange()}_handleToleranceChange(t,e){const s=[...this._colors];s[t]={...s[t],tolerance:e.detail.value},this._colors=s,this._dispatchChange()}_handleCoverageInput(t,e){const s=e.target.value,a=parseInt(s,10);if(!isNaN(a)&&a>=1&&a<=100){const i=[...this._colors];i[t]={...i[t],coverage:String(a)},this._colors=i,this._dispatchChange()}}_showAddPalette(){this._showPalette=!0}_dispatchChange(){if(this._colors.length===0){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:"",operator:":"},bubbles:!0,composed:!0}));return}const t=this._colors.map(e=>{const s=this._advanced?e.tolerance:Ze,a=this._advanced?e.coverage:Qe;return`${e.hex} ${s} ${s} ${a}`});this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:"color",values:t,operator:":"},bubbles:!0,composed:!0}))}_renderPalette(){const t=this._selectedHexes,e=this._colors.length>=wt;return o.html`
|
|
1146
1146
|
<div class="palette">
|
|
1147
1147
|
${Zs.map(s=>{const a=t.has(s),i=e&&!a;return o.html`
|
|
1148
1148
|
<button
|
|
@@ -1488,7 +1488,7 @@
|
|
|
1488
1488
|
border-color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
1489
1489
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
1490
1490
|
}
|
|
1491
|
-
`];Me([
|
|
1491
|
+
`];Me([l.property({type:Array})],re.prototype,"values",2);Me([l.state()],re.prototype,"_colors",2);Me([l.state()],re.prototype,"_advanced",2);Me([l.state()],re.prototype,"_showPalette",2);Me([l.state()],re.prototype,"_initialized",2);re=Me([l.customElement("ap-filter-color")],re);var sa=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,ye=(t,e,s,a)=>{for(var i=a>1?void 0:a?ia(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&sa(e,s,i),i};const aa={KB:1/1e3,MB:1,GB:1e3},ra=[{value:"MB",label:"MB"},{value:"GB",label:"GB"}];let Q=class extends o.LitElement{constructor(){super(...arguments),this.min=0,this.max=0,this._minVal="",this._maxVal="",this._unit="MB",this._initialized=!1}willUpdate(t){!this._initialized&&(t.has("min")||t.has("max"))&&(this._initialized=!0,this.min>0&&(this._minVal=String(this.min)),this.max>0&&(this._maxVal=String(this.max)))}get _hasFilter(){return this._minVal!==""||this._maxVal!==""}_clearAll(){this._minVal="",this._maxVal="",this._emitChange()}_setUnit(t){this._unit=t.detail.value,this._emitChange()}_emitChange(){const t=aa[this._unit],e=this._minVal!==""?parseFloat((parseFloat(this._minVal)*t).toFixed(2)).toString():null,s=this._maxVal!==""?parseFloat((parseFloat(this._maxVal)*t).toFixed(2)).toString():null;let a;if(e!==null&&s!==null)a=`${e}..${s}`;else if(e!==null)a=`${e}..`;else if(s!==null)a=`..${s}`;else{this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[],operator:_.RANGE},bubbles:!0,composed:!0}));return}this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.SIZE,values:[a],operator:_.RANGE},bubbles:!0,composed:!0}))}_onMinInput(t){this._minVal=t.target.value,this._emitChange()}_onMaxInput(t){this._maxVal=t.target.value,this._emitChange()}render(){return o.html`
|
|
1492
1492
|
<div class="filter-content">
|
|
1493
1493
|
<span class="section-label">Size</span>
|
|
1494
1494
|
<button
|
|
@@ -1551,7 +1551,7 @@
|
|
|
1551
1551
|
display: block;
|
|
1552
1552
|
width: 100%;
|
|
1553
1553
|
}
|
|
1554
|
-
`];ye([
|
|
1554
|
+
`];ye([l.property({type:Number})],Q.prototype,"min",2);ye([l.property({type:Number})],Q.prototype,"max",2);ye([l.state()],Q.prototype,"_minVal",2);ye([l.state()],Q.prototype,"_maxVal",2);ye([l.state()],Q.prototype,"_unit",2);ye([l.state()],Q.prototype,"_initialized",2);Q=ye([l.customElement("ap-filter-size")],Q);var oa=Object.defineProperty,na=Object.getOwnPropertyDescriptor,pt=(t,e,s,a)=>{for(var i=a>1?void 0:a?na(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&oa(e,s,i),i};const la=o.svg`
|
|
1555
1555
|
<svg width="20" height="20" viewBox="0 0 12 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1556
1556
|
<path d="M2.66666 1.9987C2.29847 1.9987 1.99999 2.29717 1.99999 2.66536L1.99999 13.332C1.99999 13.7002 2.29847 13.9987 2.66666 13.9987L9.33332 13.9987C9.70151 13.9987 9.99999 13.7002 9.99999 13.332L9.99999 2.66536C9.99999 2.29717 9.70151 1.9987 9.33332 1.9987L2.66666 1.9987ZM9.33332 0.665364C10.4379 0.665364 11.3333 1.56079 11.3333 2.66536L11.3333 13.332C11.3333 14.4366 10.4379 15.332 9.33332 15.332L2.66666 15.332C1.56209 15.332 0.666656 14.4366 0.666656 13.332L0.666656 2.66536C0.666656 1.56079 1.56209 0.665364 2.66666 0.665364L9.33332 0.665364Z" fill="#9747FF"/>
|
|
1557
1557
|
<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"/>
|
|
@@ -1644,15 +1644,15 @@
|
|
|
1644
1644
|
.orientation-label svg {
|
|
1645
1645
|
flex-shrink: 0;
|
|
1646
1646
|
}
|
|
1647
|
-
`];pt([
|
|
1647
|
+
`];pt([l.property({type:Array})],Ee.prototype,"selectedResolution",2);pt([l.property({type:Array})],Ee.prototype,"selectedOrientation",2);pt([l.property({type:Array})],Ee.prototype,"selectedFaces",2);Ee=pt([l.customElement("ap-filter-image")],Ee);var ua=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,M=(t,e,s,a)=>{for(var i=a>1?void 0:a?ga(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ua(e,s,i),i};function y(t){return`${ct[t.type]||""}${t.key}`}let E=class extends o.LitElement{constructor(){super(...arguments),this.fields=[],this.appliedFilters={},this.visibleFields=[],this.mode="full",this.activeFieldKey="",this.pinnedFields=[],this.appliedMetadata={},this._showFieldSelection=!1,this._fieldSearch="",this._collapsedFields=new Set,this._tagInputs={},this._tagSuggestions={},this._tagLoading={},this._datePresets={},this._dateFroms={},this._dateTos={},this._specificModeFields=new Set,this._selectSearches={},this._tagDebounceTimers={}}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>this._focusSearch())}disconnectedCallback(){super.disconnectedCallback();for(const t of Object.values(this._tagDebounceTimers))clearTimeout(t)}_focusSearch(){const t=this.renderRoot.querySelector(".field-search, .search-input");t==null||t.focus()}get _atFieldLimit(){return this.visibleFields.length>=Xe}_getField(t){return this.fields.find(e=>y(e)===t)}_getUIType(t){return ii[t.type]}_getApplied(t){return this.appliedMetadata[t]||this.appliedFilters[t]||{}}_isSpecialValue(t){return!t||t.length!==1?!1:t[0]===B||t[0]===U}_getContentMode(t){var s,a;const e=this._getApplied(t);return((s=e.values)==null?void 0:s[0])===B?B:((a=e.values)==null?void 0:a[0])===U?U:this._specificModeFields.has(t)||e.values&&e.values.length>0?he:""}_emitFilterChange(t,e,s){const a=y(t);this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:{fieldKey:a,operator:e,values:s,metadataType:t.type},bubbles:!0,composed:!0}))}_emitFieldToggle(t,e){const s=y(t);this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:{fieldKey:s,visible:e},bubbles:!0,composed:!0}))}_emitFieldSelect(t){const e=y(t);!this.visibleFields.includes(e)&&this._atFieldLimit||(this.visibleFields.includes(e)||this._emitFieldToggle(t,!0),this.dispatchEvent(new CustomEvent("metadata-field-select",{detail:{fieldKey:e},bubbles:!0,composed:!0})))}_emitPin(t,e){this.dispatchEvent(new CustomEvent("metadata-pin",{detail:{fieldKey:t,pinned:e},bubbles:!0,composed:!0}))}_openFieldSelection(){this._showFieldSelection=!0,this._fieldSearch=""}_closeFieldSelection(){this._showFieldSelection=!1,this._fieldSearch=""}_addField(t){if(this._atFieldLimit)return;const e=y(t);this.visibleFields.includes(e)||this._emitFieldToggle(t,!0)}_removeField(t){this._emitFieldToggle(t,!1),this._emitFilterChange(t,void 0,[])}_toggleCollapse(t){const e=new Set(this._collapsedFields);e.has(t)?e.delete(t):e.add(t),this._collapsedFields=e}_onOperatorChange(t,e){const a=this._getApplied(y(t)).values||[];this._emitFilterChange(t,e,a)}_onContentModeChange(t,e){const s=y(t);if(e===he){const a=new Set(this._specificModeFields);a.add(s),this._specificModeFields=a;const i=this._getApplied(s);this._isSpecialValue(i.values)&&this._emitFilterChange(t,i.operator,[])}else{if(this._specificModeFields.has(s)){const a=new Set(this._specificModeFields);a.delete(s),this._specificModeFields=a}this._onEmptyOption(t,e)}}_clearFieldFilter(t){const e=y(t);if(this._specificModeFields.has(e)){const p=new Set(this._specificModeFields);p.delete(e),this._specificModeFields=p}const{[e]:s,...a}=this._datePresets;this._datePresets=a;const{[e]:i,...r}=this._dateFroms;this._dateFroms=r;const{[e]:n,...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,i=this._getApplied(y(t)).operator||vt[0].value;this._emitFilterChange(t,i,s?[s]:[])}_onNumberInput(t,e,s){const a=e.target.value,i=y(t),r=this._getApplied(i),n=r.operator||_t[0].value,c=[...r.values||[]];s===0?c[0]=a:c[1]=a;const d=c.filter(h=>h!==""&&h!==void 0);if(d.length>0){const h=t.type===x.DECIMAL2;if(!d.every(f=>h?!isNaN(parseFloat(f)):/^-?\d+$/.test(f)))return}this._emitFilterChange(t,n,c)}_onBooleanSelect(t,e){var i;const s=this._getApplied(y(t));((i=s.values)==null?void 0:i[0])===e?this._emitFilterChange(t,void 0,[]):this._emitFilterChange(t,s.operator,[e])}_onSelectOneToggle(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||X[0].value,r=a.values||[];r.length===1&&r[0]===e?this._emitFilterChange(t,i,[]):this._emitFilterChange(t,i,[e])}_onMultiSelectToggle(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||bt[0].value,r=a.values||[],n=r.includes(e)?r.filter(c=>c!==e):[...r,e];this._emitFilterChange(t,i,n)}_onTagKeydown(t,e){const s=y(t);(e.key==="Enter"||e.key===",")&&(e.preventDefault(),this._commitTagInput(t,s))}_onTagInput(t,e,s){const a=s.target.value;if(a.includes(",")){const i=a.replace(/,/g,"").trim();i&&(this._tagInputs={...this._tagInputs,[e]:i},this._commitTagInput(t,e));return}this._tagInputs={...this._tagInputs,[e]:a},this._fetchTagSuggestions(t,e,a.trim())}_selectTagSuggestion(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||X[0].value,r=a.values||[];r.includes(e)||this._emitFilterChange(t,i,[...r,e]),this._tagInputs={...this._tagInputs,[s]:""},this._tagSuggestions={...this._tagSuggestions,[s]:[]}}_fetchTagSuggestions(t,e,s){if(this._tagDebounceTimers[e]&&clearTimeout(this._tagDebounceTimers[e]),!s||!this.apiClient){this._tagSuggestions={...this._tagSuggestions,[e]:[]},this._tagLoading={...this._tagLoading,[e]:!1};return}this._tagDebounceTimers[e]=setTimeout(async()=>{this._tagLoading={...this._tagLoading,[e]:!0};try{const a=`_${t.ckey||t.key}`,i=await this.apiClient.request("/metadata/autocomplete",{q:s,meta_key:a});(this._tagInputs[e]||"").trim()===s&&(this._tagSuggestions={...this._tagSuggestions,[e]:(i.tags||[]).map(r=>r.tag)})}catch{this._tagSuggestions={...this._tagSuggestions,[e]:[]}}finally{this._tagLoading={...this._tagLoading,[e]:!1}}},300)}_commitTagInput(t,e){const s=(this._tagInputs[e]||"").trim();if(!s)return;const a=this._getApplied(e),i=a.operator||X[0].value,r=a.values||[];r.includes(s)||this._emitFilterChange(t,i,[...r,s]),this._tagInputs={...this._tagInputs,[e]:""},this._tagSuggestions={...this._tagSuggestions,[e]:[]}}_removeTag(t,e){const s=y(t),a=this._getApplied(s),i=a.operator||X[0].value,r=a.values||[];this._emitFilterChange(t,i,r.filter(n=>n!==e))}_onTagOperatorChange(t,e){const s=y(t),i=this._getApplied(s).values||[];this._emitFilterChange(t,e,i)}_onDatePreset(t,e){const s=y(t);if(this._datePresets={...this._datePresets,[s]:e},["before","after","between"].includes(e)){this._dateFroms={...this._dateFroms,[s]:""},this._dateTos={...this._dateTos,[s]:""};return}if(e==="empty"||e==="non-empty"){this._emitFilterChange(t,void 0,[e]);return}const a=new Date;let i="",r="";switch(e){case"today":{const n=new Date(a);n.setHours(0,0,0,0),i=n.toISOString(),r=a.toISOString();break}case"last_week":{const n=new Date(a),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),i=d.toISOString(),r=n.toISOString();break}case"last_month":{const n=new Date(a.getFullYear(),a.getMonth(),1),c=new Date(n);c.setMonth(c.getMonth()-1),i=c.toISOString(),r=n.toISOString();break}case"last_year":{const n=new Date(a.getFullYear(),0,1),c=new Date(n);c.setFullYear(c.getFullYear()-1),i=c.toISOString(),r=n.toISOString();break}}i&&r&&(this._dateFroms={...this._dateFroms,[s]:i},this._dateTos={...this._dateTos,[s]:r},this._emitFilterChange(t,"..",[i,r]))}_onDateInput(t,e,s){const a=s.target.value,i=y(t),r=this._datePresets[i]||"",n=a?new Date(a+"T00:00:00").toISOString():"";e==="from"?this._dateFroms={...this._dateFroms,[i]:n}:this._dateTos={...this._dateTos,[i]:n};let c=this._dateFroms[i]||"",d=this._dateTos[i]||"";r==="after"&&c&&(d=new Date().toISOString(),this._dateTos={...this._dateTos,[i]:d}),r==="before"&&d&&(c=new Date(0).toISOString(),this._dateFroms={...this._dateFroms,[i]:c}),c&&d&&this._emitFilterChange(t,"..",[c,d])}_onGeoLocationInput(t,e){var f;const s=e.target.value.trim(),a=y(t),i=(f=this.shadowRoot)==null?void 0:f.querySelector(`[data-geo-radius="${a}"]`),r=(i==null?void 0:i.value)||"";if(!s){this._emitFilterChange(t,void 0,[]);return}const n=s.split(",").map(p=>p.trim());if(n.length!==2||n.some(p=>isNaN(Number(p))||p===""))return;const[c,d]=n;let u=`${c},${d}..${r||"0"}`;this._emitFilterChange(t,_.IS,[u])}_onGeoRadiusInput(t,e){var d;const s=e.target.value,a=y(t),i=this._getApplied(a);if(!((d=i.values)!=null&&d[0]))return;const r=i.values[0],[n]=r.split("..");let c=n;s&&(c+=`..${s}`),this._emitFilterChange(t,_.IS,[c])}_onEmptyOption(t,e){var i;const s=this._getApplied(y(t));((i=s.values)==null?void 0:i[0])===e?this._emitFilterChange(t,s.operator,[]):this._emitFilterChange(t,s.operator,[e])}_renderFieldSelection(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(r=>r.label.toLowerCase().includes(t)),s=e.filter(r=>!r.group||r.group==="root"),a=e.filter(r=>r.group==="product"),i=(r,n)=>n.length===0?o.nothing:o.html`
|
|
1648
1648
|
<div class="field-group-label">${r}</div>
|
|
1649
|
-
${n.map(
|
|
1649
|
+
${n.map(c=>{const d=y(c),h=this.visibleFields.includes(d),u=!h&&this._atFieldLimit;return o.html`
|
|
1650
1650
|
<div
|
|
1651
1651
|
class="field-item ${h?"selected":""} ${u?"disabled":""}"
|
|
1652
|
-
@click=${()=>!u&&!h&&this._addField(
|
|
1652
|
+
@click=${()=>!u&&!h&&this._addField(c)}
|
|
1653
1653
|
>
|
|
1654
1654
|
${h?o.html`<ap-icon name="check" .size=${14}></ap-icon>`:o.nothing}
|
|
1655
|
-
<span>${
|
|
1655
|
+
<span>${c.label}</span>
|
|
1656
1656
|
</div>
|
|
1657
1657
|
`})}
|
|
1658
1658
|
`;return o.html`
|
|
@@ -1680,7 +1680,7 @@
|
|
|
1680
1680
|
`}
|
|
1681
1681
|
</div>
|
|
1682
1682
|
</div>
|
|
1683
|
-
`}_renderTextFilter(t){var h,u;const e=y(t),s=this._getApplied(e),i=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===B||r===U,
|
|
1683
|
+
`}_renderTextFilter(t){var h,u;const e=y(t),s=this._getApplied(e),i=this._isSpecialValue(s.values)?"":((h=s.values)==null?void 0:h[0])||"",r=this._getContentMode(e),n=r===B||r===U,c=s.operator||vt[0].value,d=t.type===x.TEXT_AREA;return o.html`
|
|
1684
1684
|
<div class="filter-content" style="position: relative;">
|
|
1685
1685
|
<button
|
|
1686
1686
|
class="clear-btn"
|
|
@@ -1693,7 +1693,7 @@
|
|
|
1693
1693
|
<ap-radio-group
|
|
1694
1694
|
direction="horizontal"
|
|
1695
1695
|
.options=${vt}
|
|
1696
|
-
.value=${
|
|
1696
|
+
.value=${c}
|
|
1697
1697
|
?disabled=${n}
|
|
1698
1698
|
@ap-change=${f=>this._onOperatorChange(t,f.detail.value)}
|
|
1699
1699
|
></ap-radio-group>
|
|
@@ -1731,7 +1731,7 @@
|
|
|
1731
1731
|
</div>
|
|
1732
1732
|
`:o.nothing}
|
|
1733
1733
|
</div>
|
|
1734
|
-
`}_renderNumberFilter(t){var $,k,A;const e=y(t),s=this._getApplied(e),a=s.operator||_t[0].value,i=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===B||r===U,
|
|
1734
|
+
`}_renderNumberFilter(t){var $,k,A;const e=y(t),s=this._getApplied(e),a=s.operator||_t[0].value,i=this._isSpecialValue(s.values),r=this._getContentMode(e),n=r===B||r===U,c=a===_.RANGE,d=a===_.GREATER_THAN_OR_EQUAL,h=a===_.LESS_THAN_OR_EQUAL,u=t.type===x.DECIMAL2,f=u?"0.01":"1",p=u?"0.00":"0",g=i?"":(($=s.values)==null?void 0:$[0])||"",v=i?"":((k=s.values)==null?void 0:k[1])||"",w=c||d||h,b=c||d||h?"Min":"Value";return o.html`
|
|
1735
1735
|
<div class="filter-content" style="position: relative;">
|
|
1736
1736
|
<button
|
|
1737
1737
|
class="clear-btn"
|
|
@@ -1809,7 +1809,7 @@
|
|
|
1809
1809
|
></ap-radio-group>
|
|
1810
1810
|
</div>
|
|
1811
1811
|
</div>
|
|
1812
|
-
`}_renderSelectOneFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=t.possible_values||[],n=s.operator||X[0].value,
|
|
1812
|
+
`}_renderSelectOneFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=t.possible_values||[],n=s.operator||X[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=i.length>0||a,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=i.length>=Xe;return o.html`
|
|
1813
1813
|
<div class="filter-content">
|
|
1814
1814
|
<!-- Search input -->
|
|
1815
1815
|
<div class="search-wrapper">
|
|
@@ -1905,7 +1905,7 @@
|
|
|
1905
1905
|
</div>
|
|
1906
1906
|
</div>
|
|
1907
1907
|
</div>
|
|
1908
|
-
`}_renderMultiSelectFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=t.possible_values||[],n=s.operator||bt[0].value,
|
|
1908
|
+
`}_renderMultiSelectFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=t.possible_values||[],n=s.operator||bt[0].value,c=(this._selectSearches[e]||"").toLowerCase(),d=c.length>0,h=i.length>0||a,u=c?r.filter(p=>p.label.toLowerCase().includes(c)):r,f=i.length>=Xe;return o.html`
|
|
1909
1909
|
<div class="filter-content">
|
|
1910
1910
|
<!-- Search input -->
|
|
1911
1911
|
<div class="search-wrapper">
|
|
@@ -2001,7 +2001,7 @@
|
|
|
2001
2001
|
</div>
|
|
2002
2002
|
</div>
|
|
2003
2003
|
</div>
|
|
2004
|
-
`}_renderTagsFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||X[0].value,
|
|
2004
|
+
`}_renderTagsFilter(t){const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=a?[]:s.values||[],r=this._tagInputs[e]||"",n=s.operator||X[0].value,c=i.length>0||a,d=this._tagSuggestions[e]||[],h=this._tagLoading[e]||!1,u=r.trim().length>0,f=i.length>=Xe;return o.html`
|
|
2005
2005
|
<div class="filter-content">
|
|
2006
2006
|
<!-- Search input -->
|
|
2007
2007
|
<div class="search-wrapper">
|
|
@@ -2025,7 +2025,7 @@
|
|
|
2025
2025
|
<span class="section-label"></span>
|
|
2026
2026
|
<button
|
|
2027
2027
|
class="clear-btn"
|
|
2028
|
-
?disabled=${!
|
|
2028
|
+
?disabled=${!c&&!s.operator}
|
|
2029
2029
|
@click=${()=>this._clearFieldFilter(t)}
|
|
2030
2030
|
>Clear all</button>
|
|
2031
2031
|
</div>
|
|
@@ -2036,7 +2036,7 @@
|
|
|
2036
2036
|
<span class="section-label">Condition</span>
|
|
2037
2037
|
<button
|
|
2038
2038
|
class="clear-btn"
|
|
2039
|
-
?disabled=${!
|
|
2039
|
+
?disabled=${!c&&!s.operator}
|
|
2040
2040
|
@click=${()=>this._clearFieldFilter(t)}
|
|
2041
2041
|
>Clear all</button>
|
|
2042
2042
|
</div>
|
|
@@ -2099,7 +2099,7 @@
|
|
|
2099
2099
|
</div>
|
|
2100
2100
|
`:o.nothing}
|
|
2101
2101
|
</div>
|
|
2102
|
-
`}_renderDateFilter(t){var u,f;const e=y(t),s=this._datePresets[e]||"",a=this._getApplied(e),r=this._isSpecialValue(a.values)?((u=a.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],
|
|
2102
|
+
`}_renderDateFilter(t){var u,f;const e=y(t),s=this._datePresets[e]||"",a=this._getApplied(e),r=this._isSpecialValue(a.values)?((u=a.values)==null?void 0:u[0])||"":s,n=[{value:"empty",label:"Empty"},{value:"non-empty",label:"Not empty"}],c=this._dateFroms[e]?new Date(this._dateFroms[e]).toISOString().split("T")[0]:"",d=this._dateTos[e]?new Date(this._dateTos[e]).toISOString().split("T")[0]:"",h=["before","after","between"].includes(r);return o.html`
|
|
2103
2103
|
<div class="filter-content" style="position: relative;">
|
|
2104
2104
|
<button
|
|
2105
2105
|
class="clear-btn"
|
|
@@ -2143,7 +2143,7 @@
|
|
|
2143
2143
|
<input
|
|
2144
2144
|
type="date"
|
|
2145
2145
|
class="filter-input"
|
|
2146
|
-
.value=${
|
|
2146
|
+
.value=${c}
|
|
2147
2147
|
@change=${p=>this._onDateInput(t,"from",p)}
|
|
2148
2148
|
/>
|
|
2149
2149
|
</div>
|
|
@@ -2153,7 +2153,7 @@
|
|
|
2153
2153
|
<input
|
|
2154
2154
|
type="date"
|
|
2155
2155
|
class="filter-input"
|
|
2156
|
-
.value=${
|
|
2156
|
+
.value=${c}
|
|
2157
2157
|
@change=${p=>this._onDateInput(t,"from",p)}
|
|
2158
2158
|
/>
|
|
2159
2159
|
</div>
|
|
@@ -2171,7 +2171,7 @@
|
|
|
2171
2171
|
</div>
|
|
2172
2172
|
`:o.nothing}
|
|
2173
2173
|
</div>
|
|
2174
|
-
`}_renderGeoFilter(t){var u,f;const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=this._getContentMode(e);let r="",n="";if(!a&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const
|
|
2174
|
+
`}_renderGeoFilter(t){var u,f;const e=y(t),s=this._getApplied(e),a=this._isSpecialValue(s.values),i=this._getContentMode(e);let r="",n="";if(!a&&((u=s.values)!=null&&u[0])){const p=s.values[0],[g,v]=p.split("..");r=g||"",n=v||""}const c=r.length>0,d=r.split(",").map(p=>p.trim()),h=!c||d.length===2&&d.every(p=>!isNaN(Number(p))&&p!=="");return o.html`
|
|
2175
2175
|
<div class="filter-content" style="position: relative;">
|
|
2176
2176
|
<button
|
|
2177
2177
|
class="clear-btn"
|
|
@@ -2200,7 +2200,7 @@
|
|
|
2200
2200
|
.value=${r}
|
|
2201
2201
|
@change=${p=>this._onGeoLocationInput(t,p)}
|
|
2202
2202
|
/>
|
|
2203
|
-
${
|
|
2203
|
+
${c&&!h?o.html`<div class="error-text">Enter coordinates as "latitude, longitude"</div>`:o.nothing}
|
|
2204
2204
|
</div>
|
|
2205
2205
|
<div class="geo-radius">
|
|
2206
2206
|
<span class="input-label">Max radius (°)</span>
|
|
@@ -2254,7 +2254,7 @@
|
|
|
2254
2254
|
type="text"
|
|
2255
2255
|
placeholder="Search faces..."
|
|
2256
2256
|
.value=${a.join(", ")}
|
|
2257
|
-
@change=${r=>{const
|
|
2257
|
+
@change=${r=>{const c=r.target.value.split(",").map(d=>d.trim()).filter(Boolean);this._emitFilterChange(t,i,c)}}
|
|
2258
2258
|
/>
|
|
2259
2259
|
</div>
|
|
2260
2260
|
</div>
|
|
@@ -2288,12 +2288,12 @@
|
|
|
2288
2288
|
</div>
|
|
2289
2289
|
`}_renderSelectorMode(){const t=this._fieldSearch.toLowerCase(),e=this.fields.filter(r=>r.label.toLowerCase().includes(t)),s=e.filter(r=>!r.group||r.group==="root"),a=e.filter(r=>r.group==="product"),i=(r,n)=>n.length===0?o.nothing:o.html`
|
|
2290
2290
|
<div class="field-group-label">${r}</div>
|
|
2291
|
-
${n.map(
|
|
2291
|
+
${n.map(c=>{const d=y(c),h=this.visibleFields.includes(d),u=!!this.appliedMetadata[d]||!!this.appliedFilters[d],f=this.pinnedFields.includes(d),p=!h&&this._atFieldLimit;return o.html`
|
|
2292
2292
|
<div
|
|
2293
2293
|
class="field-item ${u?"has-filter":""} ${p?"disabled":""}"
|
|
2294
|
-
@click=${()=>!p&&this._emitFieldSelect(
|
|
2294
|
+
@click=${()=>!p&&this._emitFieldSelect(c)}
|
|
2295
2295
|
>
|
|
2296
|
-
<span class="field-item-label">${
|
|
2296
|
+
<span class="field-item-label">${c.label}</span>
|
|
2297
2297
|
<button
|
|
2298
2298
|
class="field-item-pin ${f?"pinned":""}"
|
|
2299
2299
|
@click=${g=>{g.stopPropagation(),this._emitPin(d,!f)}}
|
|
@@ -2703,7 +2703,7 @@
|
|
|
2703
2703
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
2704
2704
|
background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
|
|
2705
2705
|
}
|
|
2706
|
-
`];M([
|
|
2706
|
+
`];M([l.property({type:Array})],E.prototype,"fields",2);M([l.property({type:Object})],E.prototype,"appliedFilters",2);M([l.property({type:Array})],E.prototype,"visibleFields",2);M([l.property()],E.prototype,"mode",2);M([l.property()],E.prototype,"activeFieldKey",2);M([l.property({type:Array})],E.prototype,"pinnedFields",2);M([l.property({type:Object})],E.prototype,"appliedMetadata",2);M([l.property({attribute:!1})],E.prototype,"apiClient",2);M([l.state()],E.prototype,"_showFieldSelection",2);M([l.state()],E.prototype,"_fieldSearch",2);M([l.state()],E.prototype,"_collapsedFields",2);M([l.state()],E.prototype,"_tagInputs",2);M([l.state()],E.prototype,"_tagSuggestions",2);M([l.state()],E.prototype,"_tagLoading",2);M([l.state()],E.prototype,"_datePresets",2);M([l.state()],E.prototype,"_dateFroms",2);M([l.state()],E.prototype,"_dateTos",2);M([l.state()],E.prototype,"_specificModeFields",2);M([l.state()],E.prototype,"_selectSearches",2);E=M([l.customElement("ap-filter-metadata")],E);var fa=Object.defineProperty,ma=Object.getOwnPropertyDescriptor,G=(t,e,s,a)=>{for(var i=a>1?void 0:a?ma(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&fa(e,s,i),i};let V=class extends o.LitElement{constructor(){super(...arguments),this.selectedStatus=[],this.statusOperator=":=",this.approverValue="",this.approverOperator="~",this.requesterValue="",this.requesterOperator="~",this.dueDatePreset="",this.dueDateFrom="",this.dueDateTo=""}get _hasAnySelection(){return this.selectedStatus.length>0||!!this.approverValue||!!this.requesterValue||!!this.dueDatePreset||!!this.dueDateFrom||!!this.dueDateTo}get _statusHasEmptyValue(){return this.selectedStatus.includes(B)||this.selectedStatus.includes(U)}get _statusHasOnlyEmptyValues(){return this.selectedStatus.length>0&&this.selectedStatus.every(t=>t===B||t===U)}get _dueDateNeedsInputs(){return["before","after","between","specific"].includes(this.dueDatePreset)}_toggleStatus(t){const e=this.selectedStatus.includes(t)?this.selectedStatus.filter(s=>s!==t):[...this.selectedStatus,t];this._emitChange(R.STATUS,e,this.statusOperator)}_handleStatusOperator(t){const e=t.detail.value;this._emitChange(R.STATUS,this.selectedStatus,e)}_clearStatus(){this._emitChange(R.STATUS,[],this.statusOperator)}_handleApproverInput(t){const e=t.target.value;this._emitChange(R.APPROVER,e?[e]:[],this.approverOperator)}_handleApproverOperator(t){const e=t.detail.value;this._emitChange(R.APPROVER,this.approverValue?[this.approverValue]:[],e)}_clearApprover(){this._emitChange(R.APPROVER,[],this.approverOperator)}_handleRequesterInput(t){const e=t.target.value;this._emitChange(R.REQUESTOR,e?[e]:[],this.requesterOperator)}_handleRequesterOperator(t){const e=t.detail.value;this._emitChange(R.REQUESTOR,this.requesterValue?[this.requesterValue]:[],e)}_clearRequester(){this._emitChange(R.REQUESTOR,[],this.requesterOperator)}_handleDueDatePreset(t){const e=t.detail.value,s=this.dueDatePreset===e?"":e;this._emitChange(R.DUE_DATE,s?[s]:[],":")}_handleDueDateFrom(t){const e=t.target.value;this._emitDateChange(e,this.dueDateTo)}_handleDueDateTo(t){const e=t.target.value;this._emitDateChange(this.dueDateFrom,e)}_clearDueDate(){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:R.DUE_DATE,values:[],operator:":"},bubbles:!0,composed:!0}))}_emitDateChange(t,e){const s=[];t&&s.push(t),e&&s.push(e),this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:R.DUE_DATE,values:s,operator:t&&e?"..":t?">=":"<="},bubbles:!0,composed:!0}))}_emitChange(t,e,s){this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:t,values:e,operator:s},bubbles:!0,composed:!0}))}_renderStatusSection(){const t=this.selectedStatus.length>0;return o.html`
|
|
2707
2707
|
<div class="filter-section">
|
|
2708
2708
|
<button
|
|
2709
2709
|
class="clear-btn"
|
|
@@ -2888,7 +2888,7 @@
|
|
|
2888
2888
|
.mt-12 {
|
|
2889
2889
|
margin-top: 12px;
|
|
2890
2890
|
}
|
|
2891
|
-
`];G([
|
|
2891
|
+
`];G([l.property({type:Array})],V.prototype,"selectedStatus",2);G([l.property()],V.prototype,"statusOperator",2);G([l.property()],V.prototype,"approverValue",2);G([l.property()],V.prototype,"approverOperator",2);G([l.property()],V.prototype,"requesterValue",2);G([l.property()],V.prototype,"requesterOperator",2);G([l.property()],V.prototype,"dueDatePreset",2);G([l.property()],V.prototype,"dueDateFrom",2);G([l.property()],V.prototype,"dueDateTo",2);V=G([l.customElement("ap-filter-approval")],V);var va=Object.defineProperty,ba=Object.getOwnPropertyDescriptor,Y=(t,e,s,a)=>{for(var i=a>1?void 0:a?ba(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&va(e,s,i),i};const _a=300;function ya(t){return t.filter(e=>e.toLowerCase().includes("*")||!t.some(s=>s.toLowerCase().includes("*")&&e.toLowerCase().startsWith(s.slice(0,-1).toLowerCase())))}let q=class extends o.LitElement{constructor(){super(...arguments),this.selected=[],this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._showAddList=!1,this._addListText=""}connectedCallback(){super.connectedCallback(),this.updateComplete.then(()=>{var t;return(t=this._searchInput)==null?void 0:t.focus()})}disconnectedCallback(){super.disconnectedCallback(),this._debounceTimer&&clearTimeout(this._debounceTimer)}get _isSearching(){return this._debouncedSearch.length>0}_emit(t){const e=ya(t);this.dispatchEvent(new CustomEvent("filter-change",{detail:{key:m.PRODUCT_REF,values:e,operator:_.IS},bubbles:!0,composed:!0}))}_toggle(t){const s=this.selected.includes(t)?this.selected.filter(a=>a!==t):[...this.selected,t];this._emit(s)}_remove(t){this._emit(this.selected.filter(e=>e!==t))}_clearAll(){this._emit([]),this._search="",this._debouncedSearch="",this._products=[]}_onSearchInput(t){const e=t.target.value;this._search=e,this._debounceTimer&&clearTimeout(this._debounceTimer),this._debounceTimer=setTimeout(()=>{const s=e.trim().toLowerCase();this._debouncedSearch=s,s?this._fetchProducts(s):(this._products=[],this._isLoading=!1)},_a)}_clearSearch(){this._search="",this._debouncedSearch="",this._products=[],this._isLoading=!1,this._debounceTimer&&clearTimeout(this._debounceTimer)}async _fetchProducts(t){if(this.apiClient){this._isLoading=!0;try{const e=await this.apiClient.request("/products",{q:`reference~^${t}`});this._debouncedSearch===t&&(this._products=e.products??[])}catch{this._debouncedSearch===t&&(this._products=[])}finally{this._debouncedSearch===t&&(this._isLoading=!1)}}}_openAddList(){this._showAddList=!0,this._addListText=""}_closeAddList(){this._showAddList=!1,this._addListText=""}_onAddListInput(t){this._addListText=t.target.value}_onAddListKeydown(t){t.key==="Enter"&&!t.shiftKey&&t.stopPropagation()}_submitAddList(){const t=this._addListText.split(`
|
|
2892
2892
|
`).map(e=>e.trim()).filter(e=>e!=="");if(t.length>0){const e=new Set(this.selected),s=[...this.selected,...t.filter(a=>!e.has(a))];this._emit(s)}this._closeAddList()}_renderProductItem(t){const e=this.selected.includes(t);return o.html`
|
|
2893
2893
|
<div
|
|
2894
2894
|
class="product-item"
|
|
@@ -3231,7 +3231,7 @@
|
|
|
3231
3231
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
3232
3232
|
margin-left: 4px;
|
|
3233
3233
|
}
|
|
3234
|
-
`];Y([
|
|
3234
|
+
`];Y([l.property({type:Array})],q.prototype,"selected",2);Y([l.property({attribute:!1})],q.prototype,"apiClient",2);Y([l.query(".product-search")],q.prototype,"_searchInput",2);Y([l.state()],q.prototype,"_search",2);Y([l.state()],q.prototype,"_debouncedSearch",2);Y([l.state()],q.prototype,"_products",2);Y([l.state()],q.prototype,"_isLoading",2);Y([l.state()],q.prototype,"_showAddList",2);Y([l.state()],q.prototype,"_addListText",2);q=Y([l.customElement("ap-filter-product-ref")],q);var xa=Object.defineProperty,$a=Object.getOwnPropertyDescriptor,F=(t,e,s,a)=>{for(var i=a>1?void 0:a?$a(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&xa(e,s,i),i};let S=class extends o.LitElement{constructor(){super(...arguments),this.totalCount=0,this.totalFolderCount=0,this.isLoading=!1,this.showUpload=!1,this.sortBy="created_at",this.sortDirection="desc",this.sortOptions=Ft,this.filters={metadata:{pinned:[],visible:[],applied:{}},pinned:[],visible:[],applied:{}},this.labels=[],this.tags=[],this.metadataFields=[],this.pinnedFilters=[],this.forcedFilterKeys=[],this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,this._outsideClickHandler=t=>{const e=t.composedPath();if(this._externalTrigger&&e.some(r=>{var n;return r instanceof HTMLElement&&r.classList.contains("chip")&&((n=r.closest)==null?void 0:n.call(r,"ap-filters-bar"))}))return;const s=this._openFilter&&e.some(i=>i instanceof HTMLElement?i.classList.contains("popover-anchor")||i.classList.contains("popover-panel"):!1),a=(this._showDropdown||this._showMetadataSelector)&&e.some(i=>i instanceof HTMLElement&&(i.classList.contains("dropdown-menu")||i.classList.contains("filter-dropdown")));s||a||(this._openFilter&&(this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null),(this._showDropdown||this._showMetadataSelector)&&(this._showDropdown=!1,this._showMetadataSelector=!1))}}connectedCallback(){super.connectedCallback(),document.addEventListener("mousedown",this._outsideClickHandler)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("mousedown",this._outsideClickHandler)}updated(t){if((t.has("_openFilter")||t.has("_externalTrigger")||t.has("_openMetadataField"))&&this.dispatchEvent(new CustomEvent("filter-panel-change",{detail:{key:this._externalTrigger?this._openFilter:null,metadataFieldKey:this._externalTrigger?this._openMetadataField:null},bubbles:!0,composed:!0})),this._externalTrigger&&this._externalLeft!=null&&(t.has("_openFilter")||t.has("_externalLeft")||t.has("_openMetadataField"))){const e=this.renderRoot.querySelector(".popover-panel");if(e){const s=e.closest(".popover-anchor"),a=s?s.offsetWidth:this.offsetWidth,i=e.offsetWidth;this._externalLeft+i>a-8&&(e.style.left=`${Math.max(8,a-i-8)}px`)}}}_closeAllDropdowns(){var t;this._showDropdown=!1,this._showMetadataSelector=!1,this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null,(t=this._sortDropdown)==null||t.close()}_handleUploadClick(){this.dispatchEvent(new CustomEvent("upload-click",{bubbles:!0,composed:!0}))}_toggleDropdown(){const t=this._showDropdown;this._closeAllDropdowns(),this._showDropdown=!t}_toggleMetadataSelector(){this._showMetadataSelector=!this._showMetadataSelector,this._showDropdown=!1}closeFilterPanel(){this._openFilter=null,this._openMetadataField=null,this._externalTrigger=!1,this._externalLeft=null}openFilterPanel(t,e=!1,s){if(e&&this._externalTrigger&&this._openFilter===t&&!this._openMetadataField){this.closeFilterPanel();return}if(!e&&!this._isFilterActive(t)){this._showDropdown=!1,this.dispatchEvent(new CustomEvent("filter-pending",{detail:{key:t},bubbles:!0,composed:!0}));return}this._showDropdown=!1,this._openFilter=t,this._openMetadataField=null,this._externalTrigger=e,this._externalLeft=s??null}_handleSortOpen(){this._showDropdown=!1,this._openFilter=null,this._openMetadataField=null}_handleSort(t){this.dispatchEvent(new CustomEvent("sort-change",{detail:t.detail,bubbles:!0,composed:!0}))}_toggleSortDirection(){const t=this.sortDirection==="asc"?"desc":"asc";this.dispatchEvent(new CustomEvent("sort-direction-change",{detail:{value:t},bubbles:!0,composed:!0}))}_isFilterActive(t){return t in this.filters.applied&&this.filters.applied[t]!==void 0}_handleFilterChange(t){t.stopPropagation();const{key:e,values:s,operator:a}=t.detail;this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:e,values:s,operator:a},bubbles:!0,composed:!0}))}_handleMetadataFilterChange(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-filter-change",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldToggle(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-field-toggle",{detail:t.detail,bubbles:!0,composed:!0}))}_handleMetadataFieldSelect(t){t.stopPropagation(),this._openMetadataField=t.detail.fieldKey}_handleMetadataSelectorFieldSelect(t){var s;t.stopPropagation();const e=t.detail.fieldKey;if(this._showMetadataSelector=!1,!(e in(((s=this.filters.metadata)==null?void 0:s.applied)||{}))){this.dispatchEvent(new CustomEvent("filter-pending",{detail:{metadataFieldKey:e},bubbles:!0,composed:!0}));return}this._openFilter="metadata",this._openMetadataField=e}_handleMetadataPin(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("metadata-pin",{detail:t.detail,bubbles:!0,composed:!0}))}openMetadataFieldPanel(t,e=!1,s){if(e&&this._externalTrigger&&this._openMetadataField===t){this.closeFilterPanel();return}this._showDropdown=!1,this._openFilter="metadata",this._openMetadataField=t,this._externalTrigger=e,this._externalLeft=s??null}_getMetadataFieldLabel(t){for(const e of this.metadataFields)if(`${ct[e.type]||""}${e.key}`===t)return e.label;return t}_togglePin(t,e){e.stopPropagation();const s=this.pinnedFilters.includes(t);this.dispatchEvent(new CustomEvent("filter-pin",{detail:{key:t,pinned:!s},bubbles:!0,composed:!0}))}_getFilterIcon(t){const e=St.find(s=>s.key===t);return(e==null?void 0:e.icon)||"filter"}_renderFilterContent(t){var s,a,i;const e=this.filters.applied;switch(t){case"type":{const r=e.type;return o.html`<ap-filter-type
|
|
3235
3235
|
.selected=${(r==null?void 0:r.values)||[]}
|
|
3236
3236
|
@filter-change=${this._handleFilterChange}
|
|
3237
3237
|
></ap-filter-type>`}case"tags":{const r=e.tags;return o.html`<ap-filter-tags
|
|
@@ -3261,7 +3261,7 @@
|
|
|
3261
3261
|
.to=${(r==null?void 0:r.to)||""}
|
|
3262
3262
|
.preset=${(r==null?void 0:r.preset)||""}
|
|
3263
3263
|
@filter-change=${this._handleFilterChange}
|
|
3264
|
-
></ap-filter-date>`}case"size":{const r=e.size,n=((s=r==null?void 0:r.values)==null?void 0:s[0])||"",[
|
|
3264
|
+
></ap-filter-date>`}case"size":{const r=e.size,n=((s=r==null?void 0:r.values)==null?void 0:s[0])||"",[c,d]=n.split(".."),h=c?parseFloat(c)/1e6:0,u=d?parseFloat(d)/1e6:0;return o.html`<ap-filter-size
|
|
3265
3265
|
.min=${h}
|
|
3266
3266
|
.max=${u}
|
|
3267
3267
|
@filter-change=${this._handleFilterChange}
|
|
@@ -3270,13 +3270,13 @@
|
|
|
3270
3270
|
.selectedOrientation=${(n==null?void 0:n.orientation)||[]}
|
|
3271
3271
|
.selectedFaces=${(n==null?void 0:n.faces)||[]}
|
|
3272
3272
|
@filter-change=${this._handleFilterChange}
|
|
3273
|
-
></ap-filter-image>`}case"approval":{const r=e.approval_status,n=e.task_approver,
|
|
3273
|
+
></ap-filter-image>`}case"approval":{const r=e.approval_status,n=e.task_approver,c=e.task_requester,d=e.task_duedate;return o.html`<ap-filter-approval
|
|
3274
3274
|
.selectedStatus=${(r==null?void 0:r.values)||[]}
|
|
3275
3275
|
.statusOperator=${(r==null?void 0:r.operator)||":"}
|
|
3276
3276
|
.approverValue=${((a=n==null?void 0:n.values)==null?void 0:a[0])||""}
|
|
3277
3277
|
.approverOperator=${(n==null?void 0:n.operator)||":"}
|
|
3278
|
-
.requesterValue=${((i=
|
|
3279
|
-
.requesterOperator=${(
|
|
3278
|
+
.requesterValue=${((i=c==null?void 0:c.values)==null?void 0:i[0])||""}
|
|
3279
|
+
.requesterOperator=${(c==null?void 0:c.operator)||":"}
|
|
3280
3280
|
.dueDatePreset=${(d==null?void 0:d.preset)||""}
|
|
3281
3281
|
.dueDateFrom=${(d==null?void 0:d.from)||""}
|
|
3282
3282
|
.dueDateTo=${(d==null?void 0:d.to)||""}
|
|
@@ -3728,7 +3728,7 @@
|
|
|
3728
3728
|
border-radius: 8px;
|
|
3729
3729
|
top: 0;
|
|
3730
3730
|
}
|
|
3731
|
-
`;F([
|
|
3731
|
+
`;F([l.property({type:Number})],S.prototype,"totalCount",2);F([l.property({type:Number})],S.prototype,"totalFolderCount",2);F([l.property({type:Boolean})],S.prototype,"isLoading",2);F([l.property({type:Boolean})],S.prototype,"showUpload",2);F([l.property()],S.prototype,"sortBy",2);F([l.property()],S.prototype,"sortDirection",2);F([l.property({type:Array})],S.prototype,"sortOptions",2);F([l.property({type:Object})],S.prototype,"filters",2);F([l.property({type:Array})],S.prototype,"labels",2);F([l.property({type:Array})],S.prototype,"tags",2);F([l.property({type:Array})],S.prototype,"metadataFields",2);F([l.property({type:Array})],S.prototype,"pinnedFilters",2);F([l.property({type:Array})],S.prototype,"forcedFilterKeys",2);F([l.property({attribute:!1})],S.prototype,"apiClient",2);F([l.query("ap-dropdown")],S.prototype,"_sortDropdown",2);F([l.state()],S.prototype,"_showDropdown",2);F([l.state()],S.prototype,"_showMetadataSelector",2);F([l.state()],S.prototype,"_openFilter",2);F([l.state()],S.prototype,"_openMetadataField",2);F([l.state()],S.prototype,"_externalTrigger",2);F([l.state()],S.prototype,"_externalLeft",2);S=F([l.customElement("ap-content-toolbar")],S);var wa=Object.defineProperty,ka=Object.getOwnPropertyDescriptor,N=(t,e,s,a)=>{for(var i=a>1?void 0:a?ka(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&wa(e,s,i),i};let D=class extends o.LitElement{constructor(){super(...arguments),this.appliedFilters={},this.appliedMetadata={},this.forcedFilters={},this.metadataFields=[],this.pinnedFilters=[],this.pinnedMetadataFields=[],this.tags=[],this.labels=[],this.activeFilter=null,this.activeMetadataField=null,this.pendingFilter=null,this.pendingMetadataField=null}_mapTypeLabel(t){var e;return((e=ss.find(s=>s.value===t))==null?void 0:e.label)||t}_getSizeSummary(t){if(t.values.length===0)return"";const e=t.values[0],[s,a]=e.split(".."),i=s?parseFloat(s):null,r=a?parseFloat(a):null,n=c=>c>=1e3?`${(c/1e3).toFixed(c%1e3===0?0:1)} GB`:`${c} MB`;return i!==null&&r!==null?`${n(i)} – ${n(r)}`:i!==null?`> ${n(i)}`:r!==null?`< ${n(r)}`:""}_getFilterSummary(t,e){if(t.type==="string"){const s=t;if(s.values.length===0)return"";if(e===m.SIZE)return this._getSizeSummary(s);if(e===m.COLOR){const i=s.values.map(r=>r.split(" ")[0]).filter(Boolean);return i.length===0?"":i.length===1?i[0]:`${i[0]} +${i.length-1}`}const a=e===m.TYPE?i=>this._mapTypeLabel(i):e===m.TAGS?i=>{var r;return((r=this.tags.find(n=>n.sid===i))==null?void 0:r.label)||i}:e===m.LABELS?i=>{var r;return((r=this.labels.find(n=>n.sid===i))==null?void 0:r.name)||i}:i=>i;return s.values.length===1?a(s.values[0]):`${a(s.values[0])} +${s.values.length-1}`}if(t.type==="date")return this._getDateSummary(t);if(typeof t=="object"&&"resolution"in t){const s=t,a=[...s.resolution,...s.orientation,...s.faces];return a.length===0?"":a.length===1?a[0]:`${a[0]} +${a.length-1}`}return""}_getDateSummary(t){var n,c;const e=((n=is.find(d=>d.value===t.field))==null?void 0:n.label)||t.field,s=[...Et,...as],a=t.preset?((c=s.find(d=>d.value===t.preset))==null?void 0:c.label)||t.preset:"",i=d=>{try{return d.split("T")[0]}catch{return d}};let r="";switch(t.kind){case"preset":r=a;break;case"before":r=t.to?`Before ${i(t.to)}`:a;break;case"after":r=t.from?`After ${i(t.from)}`:a;break;case"between":t.from&&t.to?r=`${i(t.from)} – ${i(t.to)}`:t.from?r=`After ${i(t.from)}`:t.to&&(r=`Before ${i(t.to)}`);break;case"specific":r=t.from?i(t.from):"";break;default:r=a}return r?`${e}: ${r}`:""}_getFilterIcon(t){var e;return((e=St.find(s=>s.key===t))==null?void 0:e.icon)||"filter"}_getMetadataLabel(t){const e=this._stripMetadataPrefix(t),s=this.metadataFields.find(a=>a.key===e);return(s==null?void 0:s.label)||e}_stripMetadataPrefix(t){for(const e of Zt)if(t.startsWith(e))return t.slice(e.length);return t}_removeFilter(t){this.dispatchEvent(new CustomEvent("filter-remove",{detail:{key:t},bubbles:!0,composed:!0}))}_removeMetadataFilter(t){this.dispatchEvent(new CustomEvent("metadata-filter-remove",{detail:{fieldKey:t},bubbles:!0,composed:!0}))}_clearAll(){this.dispatchEvent(new CustomEvent("filters-clear-all",{bubbles:!0,composed:!0}))}_openFilter(t,e){const a=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("filter-open",{detail:{key:t,chipRect:{left:a.left,right:a.right,bottom:a.bottom,width:a.width}},bubbles:!0,composed:!0}))}_openMetadataFilter(t,e){const a=e.currentTarget.getBoundingClientRect();this.dispatchEvent(new CustomEvent("metadata-filter-open",{detail:{fieldKey:t,chipRect:{left:a.left,right:a.right,bottom:a.bottom,width:a.width}},bubbles:!0,composed:!0}))}_renderForcedChip(t,e){const s=this._getFilterSummary(e,t),a=e.type==="date";return o.html`
|
|
3732
3732
|
<span class="chip forced">
|
|
3733
3733
|
${(a||t===m.TYPE||t===m.SIZE)&&s?o.html`<span class="chip-label">${s}</span>`:o.html`
|
|
3734
3734
|
<span class="chip-label">${ke[t]||t}</span>
|
|
@@ -3770,13 +3770,13 @@
|
|
|
3770
3770
|
<ap-icon name="close" .size=${12}></ap-icon>
|
|
3771
3771
|
</button>
|
|
3772
3772
|
</span>
|
|
3773
|
-
`}render(){const t=De(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),a=Object.keys(this.appliedMetadata),i=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),
|
|
3773
|
+
`}render(){const t=De(this.forcedFilters),e=new Set(Object.keys(t)),s=Object.keys(this.appliedFilters).filter(g=>!e.has(g)),a=Object.keys(this.appliedMetadata),i=new Set(this.pinnedFilters),r=new Set(this.pinnedMetadataFields),n=this.pinnedFilters.filter(g=>!e.has(g)),c=s.filter(g=>!i.has(g)),d=a.filter(g=>!r.has(g)),h=this.pendingFilter&&!i.has(this.pendingFilter)&&!(this.pendingFilter in this.appliedFilters),u=this.pendingMetadataField&&!r.has(this.pendingMetadataField)&&!(this.pendingMetadataField in this.appliedMetadata),f=s.length+a.length>0;return e.size+n.length+this.pinnedMetadataFields.length+c.length+d.length+(h?1:0)+(u?1:0)===0?o.nothing:o.html`
|
|
3774
3774
|
<div class="chips-row">
|
|
3775
3775
|
<div class="chips">
|
|
3776
3776
|
${[...e].map(g=>this._renderForcedChip(g,t[g]))}
|
|
3777
3777
|
${n.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
|
|
3778
3778
|
${this.pinnedMetadataFields.map(g=>this._renderMetadataChip(g,this.appliedMetadata[g]))}
|
|
3779
|
-
${
|
|
3779
|
+
${c.map(g=>this._renderFilterChip(g,this.appliedFilters[g]))}
|
|
3780
3780
|
${h?o.html`
|
|
3781
3781
|
<span class="chip pinned-empty active pending" @click=${g=>this._openFilter(this.pendingFilter,g)}>
|
|
3782
3782
|
<span class="chip-icon"><ap-icon name=${this._getFilterIcon(this.pendingFilter)} .size=${16}></ap-icon></span>
|
|
@@ -3942,7 +3942,7 @@
|
|
|
3942
3942
|
align-items: center;
|
|
3943
3943
|
opacity: 0.6;
|
|
3944
3944
|
}
|
|
3945
|
-
`;
|
|
3945
|
+
`;N([l.property({type:Object})],D.prototype,"appliedFilters",2);N([l.property({type:Object})],D.prototype,"appliedMetadata",2);N([l.property({type:Object})],D.prototype,"forcedFilters",2);N([l.property({type:Array})],D.prototype,"metadataFields",2);N([l.property({type:Array})],D.prototype,"pinnedFilters",2);N([l.property({type:Array})],D.prototype,"pinnedMetadataFields",2);N([l.property({type:Array})],D.prototype,"tags",2);N([l.property({type:Array})],D.prototype,"labels",2);N([l.property()],D.prototype,"activeFilter",2);N([l.property()],D.prototype,"activeMetadataField",2);N([l.property()],D.prototype,"pendingFilter",2);N([l.property()],D.prototype,"pendingMetadataField",2);D=N([l.customElement("ap-filters-bar")],D);var Sa=Object.defineProperty,Ca=Object.getOwnPropertyDescriptor,xe=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ca(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Sa(e,s,i),i};const Ea=6;let Z=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.folderPreviews={},this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this._prevCount=0}willUpdate(t){if(t.has("assets")){const e=t.get("assets");e&&this.assets.length>e.length?this._prevCount=e.length:this._prevCount=0}}render(){return o.html`
|
|
3946
3946
|
<div class="grid" role="list" aria-label="Assets">
|
|
3947
3947
|
${this.folders.map(t=>o.html`
|
|
3948
3948
|
<ap-folder-card
|
|
@@ -3995,7 +3995,7 @@
|
|
|
3995
3995
|
@media (prefers-reduced-motion: reduce) {
|
|
3996
3996
|
.ghost-card { animation: none; }
|
|
3997
3997
|
}
|
|
3998
|
-
`;xe([
|
|
3998
|
+
`;xe([l.property({type:Array})],Z.prototype,"assets",2);xe([l.property({type:Array})],Z.prototype,"folders",2);xe([l.property({type:Object})],Z.prototype,"folderPreviews",2);xe([l.property({type:Array})],Z.prototype,"selectedIds",2);xe([l.property({type:Boolean})],Z.prototype,"isLoading",2);xe([l.property({type:Boolean})],Z.prototype,"multiSelect",2);Z=xe([l.customElement("ap-grid-view")],Z);var Fa=Object.defineProperty,Aa=Object.getOwnPropertyDescriptor,le=(t,e,s,a)=>{for(var i=a>1?void 0:a?Aa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Fa(e,s,i),i};const Ta=5;let K=class extends o.LitElement{constructor(){super(...arguments),this.assets=[],this.folders=[],this.selectedIds=[],this.isLoading=!1,this.multiSelect=!0,this.totalCount=0,this.isSelectingAll=!1}get _allVisibleSelected(){if(this.assets.length===0||this.selectedIds.length===0)return!1;const t=new Set(this.selectedIds);return this.assets.every(e=>t.has(e.uuid))}_handleHeaderCheckboxClick(){this.isSelectingAll||(this._allVisibleSelected&&this.selectedIds.length>=this.totalCount?this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0})):this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0})))}render(){const t=this._allVisibleSelected&&this.selectedIds.length>=this.totalCount;return o.html`
|
|
3999
3999
|
<div class="list-header ${this.multiSelect?"has-checkbox":""}" role="row" aria-label="Column headers">
|
|
4000
4000
|
${this.multiSelect?o.html`<span class="header-checkbox" @click=${this._handleHeaderCheckboxClick}>
|
|
4001
4001
|
<div class="header-check-box ${t?"checked":this.selectedIds.length>0?"indeterminate":""}">
|
|
@@ -4109,20 +4109,20 @@
|
|
|
4109
4109
|
@media (prefers-reduced-motion: reduce) {
|
|
4110
4110
|
.ghost-row { animation: none; }
|
|
4111
4111
|
}
|
|
4112
|
-
`;le([
|
|
4112
|
+
`;le([l.property({type:Array})],K.prototype,"assets",2);le([l.property({type:Array})],K.prototype,"folders",2);le([l.property({type:Array})],K.prototype,"selectedIds",2);le([l.property({type:Boolean})],K.prototype,"isLoading",2);le([l.property({type:Boolean})],K.prototype,"multiSelect",2);le([l.property({type:Number})],K.prototype,"totalCount",2);le([l.property({type:Boolean})],K.prototype,"isSelectingAll",2);K=le([l.customElement("ap-list-view")],K);function tt(t){var a;const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||(e==null?void 0:e.preview)||((a=t.url)==null?void 0:a.cdn)||"";return Fe(s)}function us(t){const e=t.info,s=(e==null?void 0:e.video_thumbnail)||(e==null?void 0:e.image_thumbnail)||(e==null?void 0:e.thumbnail)||"";return s?Fe(s):""}function Ot(t){var s,a;let e=Fe(((s=t.url)==null?void 0:s.cdn)||((a=t.url)==null?void 0:a.public)||"");return e?(e=e.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(e,{w:"200",force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):""}function ze(t,e){try{const s=new URL(t);for(const[a,i]of Object.entries(e))s.searchParams.set(a,i);return s.toString()}catch{return t}}const Qt=/^(https:\/\/)([a-z0-9_-]+)\.filerobot\.com\//i;function Fe(t,e){if(!t)return"";if(t.includes("assets.filerobot.com"))return t;const s=t.match(Qt);if(s){const a=s[2];return t.replace(Qt,`$1assets.filerobot.com/${a}/`)}if(e)try{const a=new URL(t);return`https://assets.filerobot.com/${e}${a.pathname}${a.search}`}catch{}return t}function Mt(t){if(t===0)return"0 B";const e=["B","KB","MB","GB","TB"],s=1024,a=Math.floor(Math.log(t)/Math.log(s));return`${(t/Math.pow(s,a)).toFixed(a===0?0:1)} ${e[a]}`}function st(t){if(!t)return"—";const e=new Date(t);return isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function gs(t,e){return!t||!e?"":`${t} x ${e}`}const Oa=new Set(["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","tif","avif","heic","heif"]),Ma=new Set([...Oa,"pdf","psd","eps","ai","ttf","otf","woff","woff2","eot"]);function Se(t){if(!t)return"other";const e={image:"image",video:"video",audio:"audio",application:"document",font:"font",text:"document"};return e[t]?e[t]:t.startsWith("image/")?"image":t.startsWith("video/")?"video":t.startsWith("audio/")?"audio":t.startsWith("application/pdf")||t.startsWith("text/")||t.startsWith("application/msword")||t.startsWith("application/vnd.")?"document":t.startsWith("application/zip")||t.startsWith("application/x-rar")||t.startsWith("application/x-7z")||t.startsWith("application/gzip")?"archive":t.startsWith("font/")?"font":"other"}function fs(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Ma.has(e)}const ms="https://assets.filerobot.com/scaleflex/assets/file-types/v2/",La={png:"PNG",jpg:"JPG",jpeg:"JPG",gif:"GIF",bmp:"BMP",webp:"WEBP",svg:"SVG",tiff:"TIFF",tif:"TIFF",heic:"HEIC",avif:"AVIF",ico:"ICO",pdf:"PDF",doc:"DOC",docx:"DOCX",txt:"TXT",rtf:"RTF",xls:"XLS",xlsx:"XLSX",ppt:"PPT",pptx:"PPTX",csv:"CSV",odt:"ODT",ods:"ODS",odp:"ODP",mp4:"MP4",webm:"WEBM",mov:"MOV",avi:"AVI",mkv:"MKV",mpeg:"MPEG",mp3:"MP3",wav:"WAV",aac:"AAC",flac:"FLAC",ogg:"OGG",wma:"WMA",zip:"ZIP",rar:"RAR","7z":"7Z",tar:"TAR",gz:"GZ",ttf:"TTF",otf:"OTF",woff:"WOFF",woff2:"WOFF2",eot:"EOT",psd:"PSD",ai:"AI",dwg:"DWG",js:"JS",ts:"TS",css:"CSS",html:"HTML",json:"JSON",xml:"XML",php:"PHP",sh:"SH",exe:"EXE",iso:"ISO",bin:"BIN"};function ht(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"",s=La[e];return`${ms}${s||"DEFAULT"}.png`}function je(){return`${ms}DEFAULT.png`}function kt(t){if(!t)return"";const e=t.split("/");return e.length>1?e[1]:e[0]}const Pa=new Set(["png","svg","webp","gif","avif"]);function Lt(t){const e=(t==null?void 0:t.toLowerCase().replace(".",""))||"";return Pa.has(e)}var Ia=Object.defineProperty,Da=Object.getOwnPropertyDescriptor,He=(t,e,s,a)=>{for(var i=a>1?void 0:a?Da(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ia(e,s,i),i};let ve=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.stopPropagation(),t.composedPath().some(a=>a instanceof HTMLElement&&(a.classList.contains("check")||a.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}_formatDuration(t){const e=Math.floor(t/3600),s=Math.floor(t%3600/60),a=Math.floor(t%60),i=r=>String(r).padStart(2,"0");return e>0?`${e}:${i(s)}:${i(a)}`:`${s}:${i(a)}`}_handleQuickSelect(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u,f;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",a=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",i=fs(t.extension||"");let r="";s?r=us(t):a?r=Ot(t):i&&(r=tt(t));const n=ht(t.extension||""),c=Lt(t.extension||"");return o.html`
|
|
4113
4113
|
<div class="card" @click=${this._handleSelect}>
|
|
4114
|
-
<div class="thumbnail ${
|
|
4114
|
+
<div class="thumbnail ${c&&r?"chess":""}">
|
|
4115
4115
|
${r?o.html`<img
|
|
4116
4116
|
src=${r}
|
|
4117
4117
|
alt=${t.name}
|
|
4118
4118
|
loading="lazy"
|
|
4119
|
-
class="thumb-img ${
|
|
4120
|
-
@error=${p=>{const g=p.target,v=
|
|
4119
|
+
class="thumb-img ${c?"transparent-asset":""}"
|
|
4120
|
+
@error=${p=>{const g=p.target,v=je();g.src!==n&&g.src!==v?(g.src=n,g.classList.add("icon-fallback")):g.src!==v&&(g.src=v)}}
|
|
4121
4121
|
/>`:o.html`<img
|
|
4122
4122
|
src=${n}
|
|
4123
4123
|
alt=${t.name}
|
|
4124
4124
|
class="thumb-img icon-fallback"
|
|
4125
|
-
@error=${p=>{const g=p.target,v=
|
|
4125
|
+
@error=${p=>{const g=p.target,v=je();g.src!==v&&(g.src=v)}}
|
|
4126
4126
|
/>`}
|
|
4127
4127
|
${s&&((h=t.info)!=null&&h.duration)?o.html`<span class="duration">${this._formatDuration(t.info.duration)}</span>`:o.nothing}
|
|
4128
4128
|
<div class="overlay">
|
|
@@ -4326,7 +4326,7 @@
|
|
|
4326
4326
|
:host { animation: none; }
|
|
4327
4327
|
.overlay { transition: none; }
|
|
4328
4328
|
}
|
|
4329
|
-
`;He([
|
|
4329
|
+
`;He([l.property({type:Object})],ve.prototype,"asset",2);He([l.property({type:Number})],ve.prototype,"index",2);He([l.property({type:Boolean,reflect:!0})],ve.prototype,"selected",2);He([l.property({type:Boolean})],ve.prototype,"multiSelect",2);ve=He([l.customElement("ap-asset-card")],ve);var za=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,Ke=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ra(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&za(e,s,i),i};let be=class extends o.LitElement{constructor(){super(...arguments),this.index=0,this.selected=!1,this.multiSelect=!0}_handleSelect(t){if(t.composedPath().some(a=>a instanceof HTMLElement&&(a.classList.contains("check")||a.classList.contains("check-box")))){this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0,shiftKey:t.shiftKey})},bubbles:!0}));return}this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:this.index,event:t},bubbles:!0}))}_handlePreview(t){t.stopPropagation(),this.dispatchEvent(new CustomEvent("asset-preview",{detail:{asset:this.asset},bubbles:!0}))}render(){var d,h,u;const t=this.asset;if(!t)return o.html``;const s=Se(t.type)==="video",a=((d=t.extension)==null?void 0:d.toLowerCase())==="pdf",i=fs(t.extension||"");let r="";s?r=us(t):a?r=Ot(t):i&&(r=tt(t));const n=ht(t.extension||""),c=Lt(t.extension||"");return o.html`
|
|
4330
4330
|
<div class="row" @click=${this._handleSelect}>
|
|
4331
4331
|
${this.multiSelect?o.html`
|
|
4332
4332
|
<div class="check">
|
|
@@ -4337,18 +4337,18 @@
|
|
|
4337
4337
|
</div>
|
|
4338
4338
|
</div>
|
|
4339
4339
|
`:o.nothing}
|
|
4340
|
-
<div class="thumb ${
|
|
4340
|
+
<div class="thumb ${c&&r?"chess":""}">
|
|
4341
4341
|
${r?o.html`<img
|
|
4342
4342
|
src=${r}
|
|
4343
4343
|
alt=${t.name}
|
|
4344
|
-
class="${
|
|
4344
|
+
class="${c?"transparent-asset":""}"
|
|
4345
4345
|
loading="lazy"
|
|
4346
|
-
@error=${f=>{const p=f.target,g=
|
|
4346
|
+
@error=${f=>{const p=f.target,g=je();p.src!==n&&p.src!==g?(p.src=n,p.classList.add("icon-fallback")):p.src!==g&&(p.src=g)}}
|
|
4347
4347
|
/>`:o.html`<img
|
|
4348
4348
|
src=${n}
|
|
4349
4349
|
alt=${t.name}
|
|
4350
4350
|
class="icon-fallback"
|
|
4351
|
-
@error=${f=>{const p=f.target,g=
|
|
4351
|
+
@error=${f=>{const p=f.target,g=je();p.src!==g&&(p.src=g)}}
|
|
4352
4352
|
/>`}
|
|
4353
4353
|
</div>
|
|
4354
4354
|
<div class="name" title=${t.name}>${t.name}</div>
|
|
@@ -4486,14 +4486,14 @@
|
|
|
4486
4486
|
:host([selected]) .check-icon {
|
|
4487
4487
|
display: block;
|
|
4488
4488
|
}
|
|
4489
|
-
`;Ke([
|
|
4489
|
+
`;Ke([l.property({type:Object})],be.prototype,"asset",2);Ke([l.property({type:Number})],be.prototype,"index",2);Ke([l.property({type:Boolean,reflect:!0})],be.prototype,"selected",2);Ke([l.property({type:Boolean})],be.prototype,"multiSelect",2);be=Ke([l.customElement("ap-asset-row")],be);var Na=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,Pt=(t,e,s,a)=>{for(var i=a>1?void 0:a?ja(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Na(e,s,i),i};let Be=class extends o.LitElement{constructor(){super(...arguments),this.previews=[]}_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}_isAlternativeDisplay(t){const e=kt(t).toLowerCase();return["svg","svg+xml","png","pdf"].includes(e)}_getPreviewUrl(t){const e=t.file_uri_cdn;if(!e)return"";let s=Fe(e);const a=Se(t.file_type),i=String(window.devicePixelRatio||1);return a==="video"?ze(s,{w:"200",dpr:i,force_format:"webp,jpeg"}):t.file_type==="application/pdf"||kt(t.file_type).toLowerCase()==="pdf"?(s=s.replace(/([?&])func=proxy&?/,"$1").replace(/[?&]$/,""),ze(s,{w:"200",dpr:i,force_format:"webp,jpeg",doc_page:"1",bypass_process_proxy:"1"})):ze(s,{w:"200",dpr:i})}_renderPreviewImg(t){const e=this._isAlternativeDisplay(t.file_type),s=this._getPreviewUrl(t),a=ht(kt(t.file_type)),i=je();return o.html`<div class="preview-slot ${e?"icon-bg":""}">
|
|
4490
4490
|
<img
|
|
4491
4491
|
class="preview-img ${e?"icon-mode":""}"
|
|
4492
4492
|
src="${s||a}"
|
|
4493
4493
|
alt=""
|
|
4494
4494
|
loading="lazy"
|
|
4495
|
-
@error=${r=>{const n=r.target,
|
|
4496
|
-
@load=${r=>{const n=r.target,
|
|
4495
|
+
@error=${r=>{const n=r.target,c=n.parentElement;n.src!==a&&n.src!==i?(n.src=a,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg")):n.src!==i&&(n.src=i,n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
|
|
4496
|
+
@load=${r=>{const n=r.target,c=n.parentElement;n.src.includes("scaleflex/assets/file-types")&&(n.classList.add("icon-mode"),c==null||c.classList.add("icon-bg"))}}
|
|
4497
4497
|
/>
|
|
4498
4498
|
</div>`}_renderPreviews(){if(this.previews.length===0)return o.html`<div class="empty-preview"><ap-icon name="folder" .size=${48}></ap-icon></div>`;const t=this.previews.slice(0,3);return t.length===1?o.html`<div class="preview-left">${this._renderPreviewImg(t[0])}</div>`:o.html`
|
|
4499
4499
|
<div class="preview-grid">
|
|
@@ -4656,7 +4656,7 @@
|
|
|
4656
4656
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
4657
4657
|
margin-top: 2px;
|
|
4658
4658
|
}
|
|
4659
|
-
`];
|
|
4659
|
+
`];Pt([l.property({type:Object})],Be.prototype,"folder",2);Pt([l.property({type:Array})],Be.prototype,"previews",2);Be=Pt([l.customElement("ap-folder-card")],Be);var Ba=Object.defineProperty,Ua=Object.getOwnPropertyDescriptor,vs=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ua(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ba(e,s,i),i};let it=class extends o.LitElement{_handleOpen(){this.dispatchEvent(new CustomEvent("folder-open",{detail:{folder:this.folder},bubbles:!0,composed:!0}))}render(){var e,s;const t=this.folder;return t?o.html`
|
|
4660
4660
|
<div class="row" @click=${this._handleOpen}>
|
|
4661
4661
|
<div class="icon"><ap-icon name="folder" .size=${22}></ap-icon></div>
|
|
4662
4662
|
<div class="name">${t.name}</div>
|
|
@@ -4697,7 +4697,7 @@
|
|
|
4697
4697
|
font-size: 0.8125rem;
|
|
4698
4698
|
color: var(--ap-muted-foreground, oklch(0.685 0.033 249.82));
|
|
4699
4699
|
}
|
|
4700
|
-
`;vs([
|
|
4700
|
+
`;vs([l.property({type:Object})],it.prototype,"folder",2);it=vs([l.customElement("ap-folder-row")],it);var Va=Object.defineProperty,qa=Object.getOwnPropertyDescriptor,bs=(t,e,s,a)=>{for(var i=a>1?void 0:a?qa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Va(e,s,i),i};let at=class extends o.LitElement{constructor(){super(...arguments),this.variant="grid"}render(){return this.variant==="grid"?o.html`
|
|
4701
4701
|
<div class="grid-skeleton">
|
|
4702
4702
|
${Array.from({length:18},()=>o.html`<div class="skeleton card-skel"></div>`)}
|
|
4703
4703
|
</div>
|
|
@@ -4735,7 +4735,7 @@
|
|
|
4735
4735
|
@media (prefers-reduced-motion: reduce) {
|
|
4736
4736
|
.skeleton { animation: none; }
|
|
4737
4737
|
}
|
|
4738
|
-
`;bs([
|
|
4738
|
+
`;bs([l.property()],at.prototype,"variant",2);at=bs([l.customElement("ap-skeleton")],at);function Ha(t){var i,r;const e=(i=t.info)==null?void 0:i.playlists;if(!(e!=null&&e.length))return null;const s=(r=e[0])==null?void 0:r.playlists;return s!=null&&s.length&&s[0]||null}var Ka=Object.defineProperty,Ga=Object.getOwnPropertyDescriptor,I=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ga(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ka(e,s,i),i};let L=class extends o.LitElement{constructor(){super(...arguments),this.asset=null,this.assets=[],this.selectedIds=[],this.containerToken="",this.showMetadata=!0,this.metadataFields=[],this.labels=[],this.regionalFilters={},this.multiSelect=!0,this._isFullscreen=!1,this._fsImageLoaded=!1,this._previewLoading=!1,this._openSections=new Set(["file-info","metadata"]),this._hls=null}connectedCallback(){super.connectedCallback(),this._onFullscreenChange=this._onFullscreenChange.bind(this),this._onKeyDown=this._onKeyDown.bind(this),document.addEventListener("fullscreenchange",this._onFullscreenChange),document.addEventListener("keydown",this._onKeyDown)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("keydown",this._onKeyDown),this._destroyHls()}_onKeyDown(t){if(t.key!=="ArrowLeft"&&t.key!=="ArrowRight")return;const e=t.composedPath()[0];if(!e)return;const s=e.tagName;s==="INPUT"||s==="TEXTAREA"||s==="SELECT"||e.getAttribute("role")==="radio"||e.getAttribute("role")==="listbox"||e.isContentEditable||(t.preventDefault(),t.key==="ArrowLeft"?this._prev():this._next())}_destroyHls(){this._hls&&(this._hls.destroy(),this._hls=null)}updated(t){if(super.updated(t),t.has("asset")&&(this._destroyHls(),this._previewLoading=!0,this.asset)){const e=Se(this.asset.type);e==="video"&&this._setupHls(this.asset),e!=="image"&&e!=="video"&&(this._previewLoading=!1)}}async _setupHls(t){var a,i;const e=Ha(t);if(!e||(await this.updateComplete,((a=this.asset)==null?void 0:a.uuid)!==t.uuid))return;const s=this._videoEl;if(s){if(s.canPlayType("application/vnd.apple.mpegurl")){s.src=e;return}try{const{default:r}=await Promise.resolve().then(()=>require("./hls.light-C3NKRmfw.cjs"));if(!r.isSupported()||((i=this.asset)==null?void 0:i.uuid)!==t.uuid||!this.isConnected)return;const n=new r;this._hls=n,n.loadSource(e),n.attachMedia(s),n.on(r.Events.ERROR,(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,a,i,r,n;if(((s=(e=this.asset)==null?void 0:e.extension)==null?void 0:s.toLowerCase())==="pdf"&&((i=(a=this.asset)==null?void 0:a.url)!=null&&i.cdn)){window.open(this.asset.url.cdn,"_blank","noopener");return}this._fsImageLoaded=!1,(n=(r=this.previewArea)==null?void 0:r.requestFullscreen)==null||n.call(r)}_select(){if(!this.asset)return;if(!this.multiSelect){this.dispatchEvent(new CustomEvent("asset-quick-select",{detail:{asset:this.asset},bubbles:!0,composed:!0}));return}const t=this._getCurrentIndex();this.dispatchEvent(new CustomEvent("asset-select",{detail:{asset:this.asset,index:t,event:new MouseEvent("click",{ctrlKey:!0,metaKey:!0})},bubbles:!0,composed:!0}))}_getCurrentIndex(){return!this.asset||this.assets.length===0?-1:this.assets.findIndex(t=>t.uuid===this.asset.uuid)}_navigateTo(t){this._fsImageLoaded=!1,this.dispatchEvent(new CustomEvent("preview-navigate",{detail:{asset:t},bubbles:!0,composed:!0}))}_supportsFullscreen(t){const e=Se(t.type);return e==="image"||e==="video"||e==="audio"}_findNavTarget(t,e){const s=e===1?this.assets.length:-1;for(let a=t+e;a!==s;a+=e)if(!this._isFullscreen||this._supportsFullscreen(this.assets[a]))return a;return-1}_prev(){const t=this._getCurrentIndex();if(t<=0)return;const e=this._findNavTarget(t,-1);e>=0&&this._navigateTo(this.assets[e])}_next(){const t=this._getCurrentIndex();if(t<0||t>=this.assets.length-1)return;const e=this._findNavTarget(t,1);e>=0&&this._navigateTo(this.assets[e])}_getFullscreenImageUrl(t){var a,i;const e=(a=t.url)==null?void 0:a.cdn;if(!e)return tt(t)||"";if(((i=t.extension)==null?void 0:i.toLowerCase())==="svg")return e;const s=Fe(e,this.containerToken);return ze(s,{w:String(window.screen.width),dpr:String(window.devicePixelRatio||1),org_if_sml:"1"})}_getBlurDimensions(t){var n,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 a=window.innerWidth,i=window.innerHeight,r=Math.min(a/e,i/s,1);return{width:`${Math.round(e*r)}px`,height:`${Math.round(s*r)}px`}}_onFsImageLoad(){this._fsImageLoaded=!0}_getTagEntries(t){if(!t)return[];if(Array.isArray(t))return this._parseTagArray(t);const e=Object.values(t);if(e.length>0&&Array.isArray(e[0])){const s=e.flat(),a=new Set;return s.filter(i=>!i.label||a.has(i.sid)?!1:(a.add(i.sid),!0))}return e.map(s=>({label:s.label,sid:s.sid})).filter(s=>s.label)}_parseTagArray(t){return t.map(e=>{if(typeof e=="string")return{label:e,sid:e};const s=e;return{label:s.label||Object.values(s.names||{})[0]||"",sid:s.sid||""}}).filter(e=>e.label)}_applyTagFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.TAGS,values:[t],operator:_.IS},bubbles:!0,composed:!0}))}_applyLabelFilter(t){this.dispatchEvent(new CustomEvent("filter-update",{detail:{key:m.LABELS,values:[t],operator:_.IS},bubbles:!0,composed:!0}))}_toggleSection(t){const e=new Set(this._openSections);e.has(t)?e.delete(t):e.add(t),this._openSections=e}_renderFileInfoSection(t){const e=this._getFileInfoRows(t);if(e.length===0)return o.nothing;const s=this._openSections.has("file-info");return o.html`
|
|
4739
4739
|
<div class="accordion">
|
|
4740
4740
|
<button
|
|
4741
4741
|
class="accordion-trigger"
|
|
@@ -4779,7 +4779,7 @@
|
|
|
4779
4779
|
`)}
|
|
4780
4780
|
</div>
|
|
4781
4781
|
</div>
|
|
4782
|
-
`}_getFileInfoRows(t){var s,a,i,r,n;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:Mt(t.size.bytes)}),(a=t.info)!=null&&a.img_w&&e.push({label:"Dimensions",value:gs(t.info.img_w,t.info.img_h)}),(i=t.info)!=null&&i.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(r=t.info)!=null&&r.duration&&e.push({label:"Duration",value:`${Math.round(t.info.duration)}s`}),(n=t.info)!=null&&n.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:st(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:st(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var a;if(!((a=e.possible_values)!=null&&a.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(i=>i.internal_unique_value===t||i.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const a=this.regionalFilters[e.regionalVariantsGroupUuid];if(a){const i=t[a];if(i!=null&&i!=="")return this._resolveFieldValue(i,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(i=>this._resolveSlug(String(i),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const a=JSON.stringify(t);return a==="{}"||a==="[]"?"":a}return String(t)}_getAllMetadataRows(t){var r,n,
|
|
4782
|
+
`}_getFileInfoRows(t){var s,a,i,r,n;const e=[];return e.push({label:"File name",value:t.name}),t.extension&&e.push({label:"Type",value:t.extension.toUpperCase()}),(s=t.size)!=null&&s.bytes&&e.push({label:"Size",value:Mt(t.size.bytes)}),(a=t.info)!=null&&a.img_w&&e.push({label:"Dimensions",value:gs(t.info.img_w,t.info.img_h)}),(i=t.info)!=null&&i.video_w&&e.push({label:"Video resolution",value:`${t.info.video_w} x ${t.info.video_h}`}),(r=t.info)!=null&&r.duration&&e.push({label:"Duration",value:`${Math.round(t.info.duration)}s`}),(n=t.info)!=null&&n.color_space&&e.push({label:"Color space",value:t.info.color_space}),t.created_at&&e.push({label:"Created",value:st(t.created_at)}),t.modified_at&&e.push({label:"Modified",value:st(t.modified_at)}),e}_buildFieldMap(){const t=new Map;for(const e of this.metadataFields)t.set(e.key,e),e.ckey&&t.set(e.ckey,e),e.slug&&t.set(e.slug,e);return t}_resolveSlug(t,e){var a;if(!((a=e.possible_values)!=null&&a.length)||!t.startsWith("@"))return t;const s=e.possible_values.find(i=>i.internal_unique_value===t||i.api_value===t);return(s==null?void 0:s.label)??t}_resolveFieldValue(t,e){var s;if(t==null||t==="")return"";if(e.regionalVariantsGroupUuid&&typeof t=="object"&&t!==null&&!Array.isArray(t)){const a=this.regionalFilters[e.regionalVariantsGroupUuid];if(a){const i=t[a];if(i!=null&&i!=="")return this._resolveFieldValue(i,{...e,regionalVariantsGroupUuid:void 0})}return""}if((s=e.possible_values)!=null&&s.length)return Array.isArray(t)?t.map(i=>this._resolveSlug(String(i),e)).filter(Boolean).join(", "):this._resolveSlug(String(t),e);if(Array.isArray(t))return t.join(", ");if(typeof t=="object"){const a=JSON.stringify(t);return a==="{}"||a==="[]"?"":a}return String(t)}_getAllMetadataRows(t){var r,n,c,d;const e=[],s=this._buildFieldMap(),a=new Set;if(this.metadataFields.length>0){const h=t;for(const u of this.metadataFields){const f=h[u.key]??((n=(r=t.info)==null?void 0:r.metadata)==null?void 0:n[u.key])??((c=t.meta)==null?void 0:c[u.key]),p=this._resolveFieldValue(f,u);if(!p)continue;a.add(u.key),u.slug&&a.add(u.slug);const g=p.length>50;e.push({label:u.label,value:p,wrap:g})}}if(t.meta)for(const[h,u]of Object.entries(t.meta)){if(a.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;a.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;a.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}const i=(d=t.info)==null?void 0:d.metadata;if(i&&typeof i=="object")for(const[h,u]of Object.entries(i)){if(a.has(h)||u==null||u==="")continue;const f=s.get(h);if(f){const p=this._resolveFieldValue(u,f);if(!p)continue;a.add(h);const g=p.length>50;e.push({label:f.label,value:p,wrap:g})}else{const p=typeof u=="object"?JSON.stringify(u):String(u);if(!p||p==="{}"||p==="[]")continue;a.add(h);const g=h.charAt(0).toUpperCase()+h.slice(1).replace(/_/g," "),v=p.length>50;e.push({label:g,value:p,wrap:v})}}return e}_getAssetLabels(t){return!t.labels||t.labels.length===0?[]:t.labels.map(e=>this.labels.find(s=>s.sid===e||s.uuid===e)).filter(e=>!!e)}_renderLabelsRow(t){const e=this._getAssetLabels(t);return e.length===0?o.nothing:o.html`
|
|
4783
4783
|
<div class="meta-row" style="flex-direction:column;gap:6px">
|
|
4784
4784
|
<span class="meta-label">Labels</span>
|
|
4785
4785
|
<div class="tags-list">
|
|
@@ -4802,7 +4802,7 @@
|
|
|
4802
4802
|
`)}
|
|
4803
4803
|
</div>
|
|
4804
4804
|
</div>
|
|
4805
|
-
`}render(){var A,T,
|
|
4805
|
+
`}render(){var A,T,P,C,se,ce,$e,Ge;const t=this.asset;if(!t)return o.nothing;const e=Se(t.type),s=e==="image",a=e==="video",i=e==="audio",r=((A=t.extension)==null?void 0:A.toLowerCase())==="pdf",n=ht(t.extension||""),c=Lt(t.extension||""),d=((T=t.extension)==null?void 0:T.toLowerCase())==="svg",h=tt(t),u=s?d?((P=t.url)==null?void 0:P.cdn)||"":h||Fe(((C=t.url)==null?void 0:C.cdn)||"",this.containerToken):"",f=s?this._getFullscreenImageUrl(t):"",p=s&&!d?this._getBlurDimensions(t):null,g=a&&((se=t.url)==null?void 0:se.cdn)||"",v=a&&(((ce=t.info)==null?void 0:ce.video_thumbnail)||(($e=t.info)==null?void 0:$e.preview))||"",w=r&&!s?Ot(t):"",b=this._getCurrentIndex(),O=b>0&&this._findNavTarget(b,-1)>=0,$=b>=0&&this._findNavTarget(b,1)>=0,k=this.assets.length>1;return o.html`
|
|
4806
4806
|
<div class="panel">
|
|
4807
4807
|
<div class="panel-header">
|
|
4808
4808
|
<span class="panel-title" title=${t.name}>${t.name}</span>
|
|
@@ -4819,7 +4819,7 @@
|
|
|
4819
4819
|
</div>
|
|
4820
4820
|
</div>
|
|
4821
4821
|
|
|
4822
|
-
<div class="preview-area ${s&&
|
|
4822
|
+
<div class="preview-area ${s&&c?"chess":""}">
|
|
4823
4823
|
${k?o.html`
|
|
4824
4824
|
<button class="nav-btn prev" @click=${this._prev} ?disabled=${!O} aria-label="Previous">
|
|
4825
4825
|
<ap-icon name="chevron-left" .size=${16}></ap-icon>
|
|
@@ -4877,7 +4877,7 @@
|
|
|
4877
4877
|
${this._renderAccordion("metadata","Metadata",this._getAllMetadataRows(t))}
|
|
4878
4878
|
`:o.nothing}
|
|
4879
4879
|
</div>
|
|
4880
|
-
`}};
|
|
4880
|
+
`}};L.styles=o.css`
|
|
4881
4881
|
:host {
|
|
4882
4882
|
display: block;
|
|
4883
4883
|
}
|
|
@@ -5186,7 +5186,7 @@
|
|
|
5186
5186
|
.panel { animation: none; }
|
|
5187
5187
|
.accordion-chevron { transition: none; }
|
|
5188
5188
|
}
|
|
5189
|
-
`;I([
|
|
5189
|
+
`;I([l.property({type:Object})],L.prototype,"asset",2);I([l.property({type:Array})],L.prototype,"assets",2);I([l.property({type:Array})],L.prototype,"selectedIds",2);I([l.property()],L.prototype,"containerToken",2);I([l.property({type:Boolean})],L.prototype,"showMetadata",2);I([l.property({type:Array})],L.prototype,"metadataFields",2);I([l.property({type:Array})],L.prototype,"labels",2);I([l.property({type:Object})],L.prototype,"regionalFilters",2);I([l.property({type:Boolean})],L.prototype,"multiSelect",2);I([l.query(".preview-area")],L.prototype,"previewArea",2);I([l.query("video")],L.prototype,"_videoEl",2);I([l.state()],L.prototype,"_isFullscreen",2);I([l.state()],L.prototype,"_fsImageLoaded",2);I([l.state()],L.prototype,"_previewLoading",2);I([l.state()],L.prototype,"_openSections",2);L=I([l.customElement("ap-preview-panel")],L);var Ya=Object.defineProperty,Xa=Object.getOwnPropertyDescriptor,Le=(t,e,s,a)=>{for(var i=a>1?void 0:a?Xa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Ya(e,s,i),i};let oe=class extends o.LitElement{constructor(){super(...arguments),this.selectedAssets=[],this.totalCount=0,this.isSelectingAll=!1,this.multiSelect=!0}_confirm(){this.dispatchEvent(new CustomEvent("selection-confirm",{detail:{assets:this.selectedAssets},bubbles:!0,composed:!0}))}_clear(){this.dispatchEvent(new CustomEvent("selection-clear",{bubbles:!0,composed:!0}))}_selectAll(){this.dispatchEvent(new CustomEvent("select-all",{bubbles:!0,composed:!0}))}render(){return this.selectedAssets.length===0?o.nothing:o.html`
|
|
5190
5190
|
<div class="bar">
|
|
5191
5191
|
<span class="count">${this.selectedAssets.length} selected</span>
|
|
5192
5192
|
<span class="select-label">Select:</span>
|
|
@@ -5283,7 +5283,7 @@
|
|
|
5283
5283
|
@media (prefers-reduced-motion: reduce) {
|
|
5284
5284
|
.bar { animation: none; }
|
|
5285
5285
|
}
|
|
5286
|
-
`;
|
|
5286
|
+
`;Le([l.property({type:Array})],oe.prototype,"selectedAssets",2);Le([l.property({type:Number})],oe.prototype,"totalCount",2);Le([l.property({type:Boolean})],oe.prototype,"isSelectingAll",2);Le([l.property({type:Boolean})],oe.prototype,"multiSelect",2);Le([l.property({type:Number})],oe.prototype,"maxSelections",2);oe=Le([l.customElement("ap-selection-bar")],oe);var Wa=Object.defineProperty,Qa=Object.getOwnPropertyDescriptor,It=(t,e,s,a)=>{for(var i=a>1?void 0:a?Qa(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Wa(e,s,i),i};let Ue=class extends o.LitElement{constructor(){super(...arguments),this.active=!1,this.rect={x:0,y:0,width:0,height:0}}render(){return!this.active||this.rect.width<5||this.rect.height<5?o.nothing:o.html`
|
|
5287
5287
|
<div
|
|
5288
5288
|
class="marquee"
|
|
5289
5289
|
style="left:${this.rect.x}px;top:${this.rect.y}px;width:${this.rect.width}px;height:${this.rect.height}px"
|
|
@@ -5305,7 +5305,7 @@
|
|
|
5305
5305
|
background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
|
|
5306
5306
|
border-radius: 2px;
|
|
5307
5307
|
}
|
|
5308
|
-
`;It([c.property({type:Boolean})],Ue.prototype,"active",2);It([c.property({type:Object})],Ue.prototype,"rect",2);Ue=It([c.customElement("ap-marquee-overlay")],Ue);var Za=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,Dt=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ja(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Za(e,s,i),i};const er={search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5",close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let Ve=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=er[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:a,attrs:i}=s;return a==="circle"?o.svg`<circle cx=${i.cx} cy=${i.cy} r=${i.r} fill=${i.fill??"none"}></circle>`:a==="rect"?o.svg`<rect width=${i.width} height=${i.height} x=${i.x} y=${i.y} rx=${i.rx??"0"} ry=${i.ry??"0"}></rect>`:o.svg`<path d=${i.d}></path>`});return o.html`
|
|
5308
|
+
`;It([l.property({type:Boolean})],Ue.prototype,"active",2);It([l.property({type:Object})],Ue.prototype,"rect",2);Ue=It([l.customElement("ap-marquee-overlay")],Ue);var Za=Object.defineProperty,Ja=Object.getOwnPropertyDescriptor,Dt=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ja(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&Za(e,s,i),i};const er={search:[{tag:"circle",attrs:{cx:"11",cy:"11",r:"8"}},{tag:"path",attrs:{d:"m21 21-4.3-4.3"}}],check:"M20 6 9 17l-5-5",close:[{tag:"path",attrs:{d:"M18 6 6 18"}},{tag:"path",attrs:{d:"m6 6 12 12"}}],"chevron-left":"m15 18-6-6 6-6","chevron-right":"m9 18 6-6-6-6","chevron-down":"m6 9 6 6 6-6",download:[{tag:"path",attrs:{d:"M12 15V3"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m7 10 5 5 5-5"}}],upload:[{tag:"path",attrs:{d:"M12 3v12"}},{tag:"path",attrs:{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}},{tag:"path",attrs:{d:"m17 8-5-5-5 5"}}],fullscreen:[{tag:"path",attrs:{d:"M8 3H5a2 2 0 0 0-2 2v3"}},{tag:"path",attrs:{d:"M21 8V5a2 2 0 0 0-2-2h-3"}},{tag:"path",attrs:{d:"M3 16v3a2 2 0 0 0 2 2h3"}},{tag:"path",attrs:{d:"M16 21h3a2 2 0 0 0 2-2v-3"}}],trash:[{tag:"path",attrs:{d:"M10 11v6"}},{tag:"path",attrs:{d:"M14 11v6"}},{tag:"path",attrs:{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6"}},{tag:"path",attrs:{d:"M3 6h18"}},{tag:"path",attrs:{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"}}],more:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"19",cy:"12",r:"1"}},{tag:"circle",attrs:{cx:"5",cy:"12",r:"1"}}],grid:[{tag:"rect",attrs:{x:"3",y:"3",width:"18",height:"18",rx:"2"}},{tag:"path",attrs:{d:"M12 3v18"}},{tag:"path",attrs:{d:"M3 12h18"}}],list:[{tag:"path",attrs:{d:"M3 5h.01"}},{tag:"path",attrs:{d:"M3 12h.01"}},{tag:"path",attrs:{d:"M3 19h.01"}},{tag:"path",attrs:{d:"M8 5h13"}},{tag:"path",attrs:{d:"M8 12h13"}},{tag:"path",attrs:{d:"M8 19h13"}}],preview:[{tag:"path",attrs:{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}},{tag:"circle",attrs:{cx:"12",cy:"12",r:"3"}}],select:[{tag:"path",attrs:{d:"M5 12h14"}},{tag:"path",attrs:{d:"M12 5v14"}}],"gallery-vertical-end":[{tag:"path",attrs:{d:"M7 2h10"}},{tag:"path",attrs:{d:"M5 6h14"}},{tag:"rect",attrs:{width:"18",height:"12",x:"3",y:"10",rx:"2"}}],filter:[{tag:"path",attrs:{d:"M2 5h20"}},{tag:"path",attrs:{d:"M6 12h12"}},{tag:"path",attrs:{d:"M9 19h6"}}],sort:[{tag:"path",attrs:{d:"m21 16-4 4-4-4"}},{tag:"path",attrs:{d:"M17 20V4"}},{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}}],"sort-asc":[{tag:"path",attrs:{d:"m3 8 4-4 4 4"}},{tag:"path",attrs:{d:"M7 4v16"}},{tag:"path",attrs:{d:"M11 12h4"}},{tag:"path",attrs:{d:"M11 16h7"}},{tag:"path",attrs:{d:"M11 20h10"}}],"sort-desc":[{tag:"path",attrs:{d:"m3 16 4 4 4-4"}},{tag:"path",attrs:{d:"M7 20V4"}},{tag:"path",attrs:{d:"M11 4h4"}},{tag:"path",attrs:{d:"M11 8h7"}},{tag:"path",attrs:{d:"M11 12h10"}}],image:[{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2"}},{tag:"circle",attrs:{cx:"9",cy:"9",r:"2"}},{tag:"path",attrs:{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"}}],video:[{tag:"path",attrs:{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5"}},{tag:"rect",attrs:{x:"2",y:"6",width:"14",height:"12",rx:"2"}}],audio:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],music:[{tag:"path",attrs:{d:"M9 18V5l12-2v13"}},{tag:"circle",attrs:{cx:"6",cy:"18",r:"3"}},{tag:"circle",attrs:{cx:"18",cy:"16",r:"3"}}],document:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],"file-text":[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}},{tag:"path",attrs:{d:"M10 9H8"}},{tag:"path",attrs:{d:"M16 13H8"}},{tag:"path",attrs:{d:"M16 17H8"}}],file:[{tag:"path",attrs:{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z"}},{tag:"path",attrs:{d:"M14 2v5a1 1 0 0 0 1 1h5"}}],archive:[{tag:"rect",attrs:{width:"20",height:"5",x:"2",y:"3",rx:"1"}},{tag:"path",attrs:{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8"}},{tag:"path",attrs:{d:"M10 12h4"}}],font:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],text:[{tag:"path",attrs:{d:"M12 4v16"}},{tag:"path",attrs:{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2"}},{tag:"path",attrs:{d:"M9 20h6"}}],clapperboard:[{tag:"path",attrs:{d:"m12.296 3.464 3.02 3.956"}},{tag:"path",attrs:{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z"}},{tag:"path",attrs:{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}},{tag:"path",attrs:{d:"m6.18 5.276 3.1 3.899"}}],folder:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z","folder-open":"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",tags:[{tag:"path",attrs:{d:"M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1z"}},{tag:"path",attrs:{d:"M2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193"}},{tag:"circle",attrs:{cx:"10.5",cy:"6.5",r:".5",fill:"currentColor"}}],tag:[{tag:"path",attrs:{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z"}},{tag:"circle",attrs:{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor"}}],hash:[{tag:"path",attrs:{d:"M4 9h16"}},{tag:"path",attrs:{d:"M4 15h16"}},{tag:"path",attrs:{d:"M10 3 8 21"}},{tag:"path",attrs:{d:"M14 3 16 21"}}],calendar:[{tag:"path",attrs:{d:"M8 2v4"}},{tag:"path",attrs:{d:"M16 2v4"}},{tag:"rect",attrs:{width:"18",height:"18",x:"3",y:"4",rx:"2"}},{tag:"path",attrs:{d:"M3 10h18"}}],"file-type":[{tag:"path",attrs:{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4"}},{tag:"path",attrs:{d:"M14 2v4a2 2 0 0 0 2 2h4"}},{tag:"path",attrs:{d:"M2 13v-1h6v1"}},{tag:"path",attrs:{d:"M5 12v6"}},{tag:"path",attrs:{d:"M4 18h2"}}],scaling:[{tag:"path",attrs:{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}},{tag:"path",attrs:{d:"M14 15H9v-5"}},{tag:"path",attrs:{d:"M20 9V4h-5"}},{tag:"path",attrs:{d:"M20 4l-6 6"}}],history:[{tag:"path",attrs:{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"}},{tag:"path",attrs:{d:"M3 3v5h5"}},{tag:"path",attrs:{d:"M12 7v5l4 2"}}],"swatch-book":[{tag:"path",attrs:{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"}},{tag:"path",attrs:{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"}},{tag:"path",attrs:{d:"M7 17h.01"}},{tag:"path",attrs:{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"}}],"badge-check":[{tag:"path",attrs:{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z"}},{tag:"path",attrs:{d:"m9 12 2 2 4-4"}}],box:[{tag:"path",attrs:{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z"}},{tag:"path",attrs:{d:"m3.3 7 8.7 5 8.7-5"}},{tag:"path",attrs:{d:"M12 22V12"}}],"layout-grid":[{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"14",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"7",height:"7",x:"3",y:"14",rx:"1"}}],"layout-template":[{tag:"rect",attrs:{width:"18",height:"7",x:"3",y:"3",rx:"1"}},{tag:"rect",attrs:{width:"9",height:"7",x:"3",y:"14",rx:"1"}},{tag:"rect",attrs:{width:"5",height:"7",x:"16",y:"14",rx:"1"}}],pin:[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1z"}}],"pin-off":[{tag:"path",attrs:{d:"M12 17v5"}},{tag:"path",attrs:{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 2-2H6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v2.34"}},{tag:"path",attrs:{d:"M2 2l20 20"}},{tag:"path",attrs:{d:"M9 12a2 2 0 0 1-1.11 1.79l-1.78.9"}},{tag:"path",attrs:{d:"M17 17H5"}}],lock:[{tag:"rect",attrs:{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"}},{tag:"path",attrs:{d:"M7 11V7a5 5 0 0 1 10 0v4"}}],globe:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"}},{tag:"path",attrs:{d:"M2 12h20"}}],"circle-check-big":[{tag:"path",attrs:{d:"M21.801 10A10 10 0 1 1 17 3.335"}},{tag:"path",attrs:{d:"m9 11 3 3L22 4"}}],"x-circle":[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m15 9-6 6"}},{tag:"path",attrs:{d:"m9 9 6 6"}}],ban:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"m4.9 4.9 14.2 14.2"}}],clock:[{tag:"circle",attrs:{cx:"12",cy:"12",r:"10"}},{tag:"path",attrs:{d:"M12 6v6l4 2"}}],component:[{tag:"path",attrs:{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"}},{tag:"path",attrs:{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"}}]};let Ve=class extends o.LitElement{constructor(){super(...arguments),this.name="",this.size=20}render(){const t=er[this.name];if(!t)return o.nothing;const e=typeof t=="string"?o.svg`<path d=${t}></path>`:t.map(s=>{const{tag:a,attrs:i}=s;return a==="circle"?o.svg`<circle cx=${i.cx} cy=${i.cy} r=${i.r} fill=${i.fill??"none"}></circle>`:a==="rect"?o.svg`<rect width=${i.width} height=${i.height} x=${i.x} y=${i.y} rx=${i.rx??"0"} ry=${i.ry??"0"}></rect>`:o.svg`<path d=${i.d}></path>`});return o.html`
|
|
5309
5309
|
<svg
|
|
5310
5310
|
style="--icon-size: ${this.size}px"
|
|
5311
5311
|
viewBox="0 0 24 24"
|
|
@@ -5327,7 +5327,7 @@
|
|
|
5327
5327
|
width: var(--icon-size, 20px);
|
|
5328
5328
|
height: var(--icon-size, 20px);
|
|
5329
5329
|
}
|
|
5330
|
-
`];Dt([
|
|
5330
|
+
`];Dt([l.property()],Ve.prototype,"name",2);Dt([l.property({type:Number})],Ve.prototype,"size",2);Ve=Dt([l.customElement("ap-icon")],Ve);var tr=Object.defineProperty,sr=Object.getOwnPropertyDescriptor,_s=(t,e,s,a)=>{for(var i=a>1?void 0:a?sr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&tr(e,s,i),i};let rt=class extends o.LitElement{constructor(){super(...arguments),this.size=24}render(){return o.html`<div class="spinner" style="width:${this.size}px;height:${this.size}px"></div>`}};rt.styles=[o.css`
|
|
5331
5331
|
:host {
|
|
5332
5332
|
display: inline-flex;
|
|
5333
5333
|
}
|
|
@@ -5340,7 +5340,7 @@
|
|
|
5340
5340
|
@keyframes spin {
|
|
5341
5341
|
to { transform: rotate(360deg); }
|
|
5342
5342
|
}
|
|
5343
|
-
`];_s([
|
|
5343
|
+
`];_s([l.property({type:Number})],rt.prototype,"size",2);rt=_s([l.customElement("ap-spinner")],rt);var ir=Object.defineProperty,ar=Object.getOwnPropertyDescriptor,ut=(t,e,s,a)=>{for(var i=a>1?void 0:a?ar(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ir(e,s,i),i};let Ae=class extends o.LitElement{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this._hasLabel=!1,this._handleHostClick=()=>{this.dispatchEvent(new CustomEvent("ap-toggle",{detail:{checked:!this.checked},bubbles:!0,composed:!0}))}}connectedCallback(){super.connectedCallback(),this.addEventListener("click",this._handleHostClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleHostClick)}_onSlotChange(t){const e=t.target;this._hasLabel=e.assignedNodes({flatten:!0}).length>0,this.requestUpdate()}render(){return o.html`
|
|
5344
5344
|
<div class="box">
|
|
5345
5345
|
<svg class="check" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round">
|
|
5346
5346
|
<path d="M20 6 9 17l-5-5"></path>
|
|
@@ -5401,7 +5401,7 @@
|
|
|
5401
5401
|
font-size: var(--ap-font-size-sm, 0.875rem);
|
|
5402
5402
|
color: var(--ap-foreground, oklch(0.37 0.022 248.413));
|
|
5403
5403
|
}
|
|
5404
|
-
`];ut([
|
|
5404
|
+
`];ut([l.property({type:Boolean,reflect:!0})],Ae.prototype,"checked",2);ut([l.property({type:Boolean,reflect:!0})],Ae.prototype,"indeterminate",2);ut([l.property({type:Boolean,reflect:!0})],Ae.prototype,"disabled",2);Ae=ut([l.customElement("ap-checkbox")],Ae);var rr=Object.defineProperty,or=Object.getOwnPropertyDescriptor,ys=(t,e,s,a)=>{for(var i=a>1?void 0:a?or(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&rr(e,s,i),i};let ot=class extends o.LitElement{constructor(){super(...arguments),this.open=!1,this._handleOutsideClick=t=>{this.open&&!t.composedPath().includes(this)&&(this.open=!1)}}render(){return o.html`
|
|
5405
5405
|
<slot name="trigger" @click=${()=>this.open=!this.open}></slot>
|
|
5406
5406
|
<div class="content ${this.open?"open":""}">
|
|
5407
5407
|
<slot></slot>
|
|
@@ -5427,7 +5427,7 @@
|
|
|
5427
5427
|
.content.open {
|
|
5428
5428
|
display: block;
|
|
5429
5429
|
}
|
|
5430
|
-
`];ys([
|
|
5430
|
+
`];ys([l.state()],ot.prototype,"open",2);ot=ys([l.customElement("ap-popover")],ot);var nr=Object.defineProperty,lr=Object.getOwnPropertyDescriptor,j=(t,e,s,a)=>{for(var i=a>1?void 0:a?lr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&nr(e,s,i),i};let z=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.label="",this.variant="default",this.options=[],this._open=!1,this._focusedIndex=-1,this._menuPosition="below",this._menuAlign="align-left",this._menuTop=0,this._menuBottom=0,this._menuLeft=0,this._menuRight=0,this._handleOutsideClick=t=>{t.composedPath().includes(this)||(this._open=!1,document.removeEventListener("click",this._handleOutsideClick))}}close(){this._open=!1}render(){const t=this.options.find(s=>s.value===this.value),e="ap-dropdown-menu";return o.html`
|
|
5431
5431
|
<button
|
|
5432
5432
|
class="trigger"
|
|
5433
5433
|
role="combobox"
|
|
@@ -5544,7 +5544,7 @@
|
|
|
5544
5544
|
.option[aria-selected="true"] ap-icon {
|
|
5545
5545
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
5546
5546
|
}
|
|
5547
|
-
`];
|
|
5547
|
+
`];j([l.property()],z.prototype,"value",2);j([l.property()],z.prototype,"label",2);j([l.property({reflect:!0})],z.prototype,"variant",2);j([l.property({type:Array})],z.prototype,"options",2);j([l.state()],z.prototype,"_open",2);j([l.state()],z.prototype,"_focusedIndex",2);j([l.state()],z.prototype,"_menuPosition",2);j([l.state()],z.prototype,"_menuAlign",2);j([l.state()],z.prototype,"_menuTop",2);j([l.state()],z.prototype,"_menuBottom",2);j([l.state()],z.prototype,"_menuLeft",2);j([l.state()],z.prototype,"_menuRight",2);z=j([l.customElement("ap-dropdown")],z);var cr=Object.defineProperty,dr=Object.getOwnPropertyDescriptor,xs=(t,e,s,a)=>{for(var i=a>1?void 0:a?dr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&cr(e,s,i),i};let nt=class extends o.LitElement{constructor(){super(...arguments),this.variant="default"}render(){return o.html`<span class="badge"><slot></slot></span>`}};nt.styles=[o.css`
|
|
5548
5548
|
:host {
|
|
5549
5549
|
display: inline-flex;
|
|
5550
5550
|
}
|
|
@@ -5562,7 +5562,7 @@
|
|
|
5562
5562
|
background: var(--ap-primary-10, oklch(0.578 0.198 268.129 / 0.1));
|
|
5563
5563
|
color: var(--ap-primary, oklch(0.578 0.198 268.129));
|
|
5564
5564
|
}
|
|
5565
|
-
`];xs([
|
|
5565
|
+
`];xs([l.property({reflect:!0})],nt.prototype,"variant",2);nt=xs([l.customElement("ap-badge")],nt);var pr=Object.defineProperty,hr=Object.getOwnPropertyDescriptor,$s=(t,e,s,a)=>{for(var i=a>1?void 0:a?hr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&pr(e,s,i),i};let lt=class extends o.LitElement{constructor(){super(...arguments),this.text=""}render(){return o.html`
|
|
5566
5566
|
<slot></slot>
|
|
5567
5567
|
<div class="tip">${this.text}</div>
|
|
5568
5568
|
`}};lt.styles=[o.css`
|
|
@@ -5588,7 +5588,7 @@
|
|
|
5588
5588
|
:host(:hover) .tip {
|
|
5589
5589
|
display: block;
|
|
5590
5590
|
}
|
|
5591
|
-
`];$s([
|
|
5591
|
+
`];$s([l.property()],lt.prototype,"text",2);lt=$s([l.customElement("ap-tooltip")],lt);var ur=Object.defineProperty,gr=Object.getOwnPropertyDescriptor,Pe=(t,e,s,a)=>{for(var i=a>1?void 0:a?gr(e,s):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=(a?n(e,s,i):n(i))||i);return a&&i&&ur(e,s,i),i};let ne=class extends o.LitElement{constructor(){super(...arguments),this.value="",this.options=[],this.disabled=!1,this.direction="vertical",this._onKeydown=t=>{const e=this.options.filter(i=>!this.disabled&&!i.disabled);if(e.length===0)return;const s=e.findIndex(i=>i.value===this.value);let a=null;switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),a=s<0?0:(s+1)%e.length;break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),a=s<0?e.length-1:(s-1+e.length)%e.length;break;case" ":case"Enter":t.preventDefault(),s>=0?this._select(e[s]):e.length>0&&this._select(e[0]);return;default:return}a!==null&&this._select(e[a])}}connectedCallback(){super.connectedCallback(),this.setAttribute("role","radiogroup"),this.hasAttribute("tabindex")||this.setAttribute("tabindex","0"),this.addEventListener("keydown",this._onKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._onKeydown)}render(){return o.html`
|
|
5592
5592
|
${this.options.map(t=>o.html`
|
|
5593
5593
|
<div
|
|
5594
5594
|
class="option"
|
|
@@ -5660,7 +5660,7 @@
|
|
|
5660
5660
|
font-family: inherit;
|
|
5661
5661
|
user-select: none;
|
|
5662
5662
|
}
|
|
5663
|
-
`];Le([c.property()],ne.prototype,"value",2);Le([c.property({type:Array})],ne.prototype,"options",2);Le([c.property({type:Boolean})],ne.prototype,"disabled",2);Le([c.property({reflect:!0})],ne.prototype,"direction",2);Le([c.property({reflect:!0})],ne.prototype,"columns",2);ne=Le([c.customElement("ap-radio-group")],ne);var fr=Object.defineProperty,zt=(t,e,s,a)=>{for(var i=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=n(e,s,i)||i);return i&&fr(e,s,i),i};const Rt=class Rt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var a,i;if(!((a=this.config)!=null&&a.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);s.length>0&&this._openUploader(s)},this.store=Os(),this.storeCtrl=new Ms(this,this.store),this.selectionCtrl=new Ps(this,this.store),this.infiniteScrollCtrl=new Ls(this,()=>this._loadMore()),this.marqueeCtrl=new Is(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const i=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,i)}const a=this.renderRoot.querySelector(".main-content");a&&a!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=a,this.marqueeCtrl.attach(a))}_initConfig(e){this._initFailed=!1,this._initPromise=this._doInit(e).catch(()=>{this._initFailed=!0}),e.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=wi(),a=s.sortBy??e.defaultSortBy??"created_at",i=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Ci()||e.defaultViewMode||"grid",sortBy:a,sortDirection:i,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new Ds(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await Us(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,l]=await Promise.allSettled([ai(this.apiClient),Ns(this.apiClient),Bs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:v,brandColor:w}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:v,...w?{brandColor:w}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),l.status==="fulfilled"&&this.store.setState({tags:l.value});const{pinnedFilters:d,pinnedMetadata:h}=yi(e.auth.projectToken??null),u=this.store.getState().filters;this.store.setState({filters:{...u,pinned:d,visible:[...d],metadata:{...u.metadata,pinned:h,visible:[...h]}}});const f=e.brandColor||this.store.getState().brandColor;f&&(this.store.setState({brandColor:f}),Ti(this,f))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,a=this.store.getState();let i;return e.auth.mode==="securityTemplate"?i={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:i={mode:"session",container:e.auth.projectToken,sessionToken:e.auth.sessionToken,companyToken:e.auth.companyToken},{auth:i,targetFolder:a.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}async _openUploader(e){var a;if(!((a=this.config)!=null&&a.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(i){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i instanceof Error?i:new Error(String(i)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl=null}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,a;return!!((a=(s=e.dataTransfer)==null?void 0:s.types)!=null&&a.includes("Files"))}async open(){var l,d,h,u,f,p;const e=this.store.getState(),s=De((l=this.config)==null?void 0:l.forcedFilters),a=new Set(Object.keys(s)),i={},r=De((d=this.config)==null?void 0:d.defaultFilters);for(const[g,v]of Object.entries(r))a.has(g)||(i[g]=v);const n=Object.keys(i);this.store.setState({isOpen:!0,activeTab:((u=(h=this.config)==null?void 0:h.tabs)==null?void 0:u[0])??"assets",searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...n])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:((f=this.config)==null?void 0:f.rememberLastFolder)&&ki()||((p=this.config)==null?void 0:p.rootFolderPath)||"/",breadcrumb:[],selectedAssets:new Map,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var a,i,r,n,l,d,h,u,f,p,g,v,w,b;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const O=s.activeTab;if(O==="assets"){const $=this._buildSearchNotation(),k=s.currentFolderPath||"/",A=Ye(this.apiClient,{folder:k,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:1}),T=Ut(this.apiClient,{folder:k,q:$||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[L,C]=await Promise.all([A,T]);if(e!==this._loadId)return;const se=((a=L.files)==null?void 0:a.length)??0,ce=se>=s.limit,$e=((i=C==null?void 0:C.stats)==null?void 0:i.approx_files_count)??((r=C==null?void 0:C.info)==null?void 0:r.total_files_count)??((n=L.info)==null?void 0:n.total_files_count)??((d=(l=L.base)==null?void 0:l.count)==null?void 0:d.files_recursive)??((u=(h=L.base)==null?void 0:h.count)==null?void 0:u.files_direct)??se;this.store.setState({assets:L.files||[],folders:[],totalCount:$e,totalFolderCount:0,offset:0,hasMore:ce,isLoading:!1})}else if(O==="folders"){const $=this._buildSearchNotation(),k=s.currentFolderPath||"/",[A,T,L]=await Promise.all([Rs(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ye(this.apiClient,{folder:k,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:0}),Ut(this.apiClient,{folder:k,q:$||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const C=A.folders||[];let se={};if(C.length>0)try{se=await js(this.apiClient,C.map(de=>de.uuid))}catch{}if(e!==this._loadId)return;const ce=((f=T.files)==null?void 0:f.length)??0,$e=ce>=s.limit,Ge=((p=L==null?void 0:L.stats)==null?void 0:p.approx_files_count)??((g=L==null?void 0:L.info)==null?void 0:g.total_files_count)??((v=T.info)==null?void 0:v.total_files_count)??((b=(w=T.base)==null?void 0:w.count)==null?void 0:b.files_direct)??ce;this.store.setState({assets:T.files||[],folders:C,folderPreviews:se,totalCount:Ge,totalFolderCount:A.total??C.length,offset:0,hasMore:$e,isLoading:!1})}}catch(O){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:O,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,a=e.offset+e.limit;this.store.setState({isLoading:!0});try{const i=this._buildSearchNotation(),r=await Ye(this.apiClient,{folder:e.currentFolderPath||"/",offset:a,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:i||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,l=r.files||[],d=l.length>=e.limit,h=[...n,...l];this.store.setState({assets:h,offset:a,hasMore:d,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,a;this.close(),(a=(s=this.config)==null?void 0:s.onCancel)==null||a.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleViewChange(e){var a;const s=e.detail.mode;this.store.setState({viewMode:s}),(a=this.config)!=null&&a.rememberLastView&&Si(s),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:a}=e.detail,i=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...i,[s]:a}})}_handleSortChange(e){const s=e.detail.value,a=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Xt(s,a.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,a=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),Xt(a.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var s;this.store.setState({activeTab:e.detail.tab,currentFolder:null,currentFolderPath:((s=this.config)==null?void 0:s.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var a,i;const s=e.detail.asset;(i=(a=this.config)==null?void 0:a.onSelect)==null||i.call(a,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,a=this.store.getState(),i=s.path||`${a.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&Wt(i),this.store.setState({currentFolder:s.uuid,currentFolderPath:i,breadcrumb:[...a.breadcrumb,{uuid:s.uuid,name:s.name,path:i}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var l,d;const s=e.detail.uuid,a=this.store.getState(),i=s?a.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?a.breadcrumb.slice(0,i+1):[],n=r.length>0?r[r.length-1].path:((l=this.config)==null?void 0:l.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Wt(n),this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,i;const s=e.detail.assets;(i=(a=this.config)==null?void 0:a.onSelect)==null||i.call(a,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleSelectAll(){var a;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((a=e.config)==null?void 0:a.multiSelect)??!0))){if(e.assets.length>=e.totalCount){this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const i=this._buildSearchNotation(),r=e.currentFolderPath||"/",n=e.limit,l=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=l.length;b<d;b+=n)u.push(b);const f=4,p=[];for(let b=0;b<u.length;b+=f){const O=u.slice(b,b+f),$=await Promise.all(O.map(k=>Ye(this.apiClient,{folder:r,offset:k,limit:n,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:i||void 0,recursive:h})));for(const k of $)k.files&&p.push(...k.files)}const g=new Set(l.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),w=[...l,...v];this.store.setState({assets:w,offset:Math.max(0,w.length-n),hasMore:!1,isSelectingAll:!1}),this.selectionCtrl.selectAll(w)}catch(i){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"selectAll"},bubbles:!0,composed:!0}))}}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===m.DATE||e===m.LICENSE_EXPIRY||e===R.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:a,operator:i}=e.detail,n={...this.store.getState().filters};let l=a===""||a===null||a===void 0||Array.isArray(a)&&a.length===0||typeof a=="object"&&!Array.isArray(a)&&Object.values(a).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!l&&this._isDateFilterKey(s)&&typeof a=="object"&&!Array.isArray(a)){const{kind:d,preset:h,from:u,to:f}=a;l=!d&&!h&&!u&&!f}if(l){const d={...n.applied};delete d[s],n.applied=d,n.pinned.includes(s)||(n.visible=n.visible.filter(h=>h!==s))}else{const d={...n.applied};this._isDateFilterKey(s)&&typeof a=="object"&&!Array.isArray(a)?d[s]={type:"date",field:a.field||"created",kind:a.kind||null,preset:a.preset||null,from:a.from||null,to:a.to||null}:s===m.IMAGE&&typeof a=="object"&&!Array.isArray(a)?d[s]=a:d[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,a=e.detail.chipRect,i=this.renderRoot.querySelector("ap-content-toolbar");let r;if(a){const n=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(n){const l=n.getBoundingClientRect();r=a.left-l.left}}i==null||i.openFilterPanel(s,!0,r)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:a}=e.detail,i=this.renderRoot.querySelector("ap-content-toolbar");let r;if(a){const n=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(n){const l=n.getBoundingClientRect();r=a.left-l.left}}i==null||i.openMetadataFieldPanel(s,!0,r)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var f,p,g;const{key:s,metadataFieldKey:a}=e.detail,i=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!i||!r)return;a?(this._pendingMetadataField=a,i.pendingMetadataField=a):s&&(this._pendingFilter=s,i.pendingFilter=s),await i.updateComplete;let n=i.renderRoot.querySelector(".chip.pending");if(!n){const v=i.renderRoot.querySelectorAll(".chip.pinned-empty"),w=a?(f=i._getMetadataLabel)==null?void 0:f.call(i,a):void 0;for(const b of v){const O=(g=(p=b.querySelector(".chip-label"))==null?void 0:p.textContent)==null?void 0:g.trim();if(a&&O===w){n=b;break}if(s&&O===(ke[s]||s)){n=b;break}}}if(!n)return;const l=n.getBoundingClientRect(),d=this.renderRoot.querySelector(".toolbar-filters-wrapper"),h=d==null?void 0:d.getBoundingClientRect(),u=h?l.left-h.left:l.left;a?r.openMetadataFieldPanel(a,!0,u):s&&r.openFilterPanel(s,!0,u)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const i={...this.store.getState().filters},r={...i.applied};delete r[s],i.applied=r,i.pinned.includes(s)||(i.visible=i.visible.filter(l=>l!==s)),this.store.setState({filters:i,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:a,values:i,metadataType:r}=e.detail,l={...this.store.getState().filters},d={...l.metadata},h={...d.applied};if(!i||Array.isArray(i)&&i.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),l.metadata=d,this.store.setState({filters:l,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingMetadataField===s){this._pendingMetadataField=null;const f=this.renderRoot.querySelector("ap-filters-bar");f&&(f.pendingMetadataField=null)}}_handleMetadataFieldToggle(e){const{fieldKey:s,visible:a}=e.detail,r={...this.store.getState().filters},n={...r.metadata};a?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(l=>l!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,i={...this.store.getState().filters},r={...i.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(l=>l!==s)),i.metadata=r,this.store.setState({filters:i,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var l,d;const{key:s,pinned:a}=e.detail,r={...this.store.getState().filters};a?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(l=this.store.getState().config)==null?void 0:l.auth)==null?void 0:d.projectToken)??null;xi(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:a}=e.detail,r={...this.store.getState().filters},n={...r.metadata};a?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),r.metadata=n,this.store.setState({filters:r});const l=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;$i(l,n.pinned)}_handleFiltersClearAll(){const e=this.store.getState();this.store.setState({filters:{...e.filters,applied:{},visible:[...e.filters.pinned],metadata:{...e.filters.metadata,applied:{},visible:[...e.filters.metadata.pinned]}},offset:0,assets:[],folders:[],isLoading:!0});const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=null),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterDeactivate(e){const s=e.detail.key,i={...this.store.getState().filters};i.visible=i.visible.filter(r=>r!==s),this.store.setState({filters:i})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,i={...this.store.getState().filters},r={...i.metadata};r.visible=r.visible.filter(n=>n!==s),i.metadata=r,this.store.setState({filters:i})}_handleFiltersSet(e){var h;const{applied:s,metadata:a}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),l={...s};for(const u of n)delete l[u];r.applied=l;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],a){const u={...r.metadata};u.applied=a.applied;const f=Object.keys(a.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Oi:e.activeTab==="folders"?Mi:Ft}_buildSearchNotation(){var i;const e=this.store.getState(),s={...De((i=this.config)==null?void 0:i.forcedFilters),...e.filters.applied};return ni(s,e.filters.metadata.applied).join(" ")}render(){var h,u,f,p,g,v,w,b;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),a=this.selectionCtrl.getSelectedAssets(),i=o.html`
|
|
5663
|
+
`];Pe([l.property()],ne.prototype,"value",2);Pe([l.property({type:Array})],ne.prototype,"options",2);Pe([l.property({type:Boolean})],ne.prototype,"disabled",2);Pe([l.property({reflect:!0})],ne.prototype,"direction",2);Pe([l.property({reflect:!0})],ne.prototype,"columns",2);ne=Pe([l.customElement("ap-radio-group")],ne);var fr=Object.defineProperty,zt=(t,e,s,a)=>{for(var i=void 0,r=t.length-1,n;r>=0;r--)(n=t[r])&&(i=n(e,s,i)||i);return i&&fr(e,s,i),i};const Rt=class Rt extends o.LitElement{constructor(){super(),this._initFailed=!1,this._loadId=0,this._loadMoreId=0,this._loadDataTimer=null,this._pendingFilter=null,this._pendingMetadataField=null,this._uploaderEl=null,this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1,this._onDragEnter=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter++,this._dragCounter===1&&(this._isDragOver=!0))},this._onDragOver=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),e.dataTransfer&&(e.dataTransfer.dropEffect="copy"))},this._onDragLeave=e=>{var s;!((s=this.config)!=null&&s.uploader)||!this._hasFileTransfer(e)||(e.preventDefault(),this._dragCounter--,this._dragCounter<=0&&(this._dragCounter=0,this._isDragOver=!1))},this._onDrop=e=>{var a,i;if(!((a=this.config)!=null&&a.uploader)||!this._hasFileTransfer(e))return;e.preventDefault(),this._dragCounter=0,this._isDragOver=!1;const s=Array.from(((i=e.dataTransfer)==null?void 0:i.files)??[]);s.length>0&&this._openUploader(s)},this.store=Os(),this.storeCtrl=new Ms(this,this.store),this.selectionCtrl=new Ls(this,this.store),this.infiniteScrollCtrl=new Ps(this,()=>this._loadMore()),this.marqueeCtrl=new Is(this,this.store)}get _isInline(){var e;return((e=this.config)==null?void 0:e.displayMode)==="inline"}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this._uploaderEl&&(this._uploaderEl.remove(),this._uploaderEl=null),this._uploaderImportPromise=null,this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}updated(e){super.updated(e),e.has("config")&&this.config&&this._initConfig(this.config);const s=this.renderRoot.querySelector("#sentinel");if(s&&s!==this._lastSentinel){this._lastSentinel=s;const i=this.renderRoot.querySelector(".main-content");this.infiniteScrollCtrl.observe(s,i)}const a=this.renderRoot.querySelector(".main-content");a&&a!==this._lastMarqueeContainer&&(this._lastMarqueeContainer=a,this.marqueeCtrl.attach(a))}_initConfig(e){this._initFailed=!1,this._initPromise=this._doInit(e).catch(()=>{this._initFailed=!0}),e.displayMode==="inline"&&!this.store.getState().isOpen&&this.open()}async _doInit(e){const s=wi(),a=s.sortBy??e.defaultSortBy??"created_at",i=s.sortDirection??e.defaultSortDirection??"desc";this.store.setState({config:e,projectToken:e.auth.projectToken,viewMode:e.rememberLastView&&Ci()||e.defaultViewMode||"grid",sortBy:a,sortDirection:i,currentFolder:null,currentFolderPath:e.rootFolderPath??"/"}),this.apiClient=new Ds(e.auth,e.apiBase);try{if(e.auth.mode==="securityTemplate"){const p=await Us(this.apiClient);this.apiClient.setSassKey(p),this.store.setState({sassKey:p})}const[r,n,c]=await Promise.allSettled([ai(this.apiClient),js(this.apiClient),Bs(this.apiClient)]);if(r.status==="fulfilled"){const{fields:p,regionalVariantGroups:g,regionalFilters:v,brandColor:w}=r.value;this.store.setState({metadataFields:p,regionalVariantGroups:g,regionalFilters:v,...w?{brandColor:w}:{}})}n.status==="fulfilled"&&this.store.setState({labels:n.value.labels||[]}),c.status==="fulfilled"&&this.store.setState({tags:c.value});const{pinnedFilters:d,pinnedMetadata:h}=yi(e.auth.projectToken??null),u=this.store.getState().filters;this.store.setState({filters:{...u,pinned:d,visible:[...d],metadata:{...u.metadata,pinned:h,visible:[...h]}}});const f=e.brandColor||this.store.getState().brandColor;f&&(this.store.setState({brandColor:f}),Ti(this,f))}catch(r){throw this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:r,context:"init"},bubbles:!0,composed:!0})),r}}_ensureUploaderImport(){return this._uploaderImportPromise?this._uploaderImportPromise:(this._uploaderImportPromise=import("@scaleflex/uploader/define").then(()=>{},e=>{throw this._uploaderImportPromise=null,e}),this._uploaderImportPromise)}_buildUploaderConfig(){const e=this.config,s=e.uploader,a=this.store.getState();let i;return e.auth.mode==="securityTemplate"?i={mode:"security-template",container:e.auth.projectToken,securityTemplateId:e.auth.securityTemplateKey}:i={mode:"sass-key",container:e.auth.projectToken,sassKey:e.auth.sassKey},{auth:i,targetFolder:a.currentFolderPath||"/",mode:"inline",restrictions:s.restrictions,concurrency:s.concurrency,autoProceed:s.autoProceed,showFillMetadata:s.showFillMetadata,connectors:s.connectors,sourcesLayout:s.sourcesLayout,headerButton:s.headerButton??"back",clearOnClose:s.clearOnClose,clearOnComplete:s.clearOnComplete,rejectedFileAutoRemoveDelay:s.rejectedFileAutoRemoveDelay}}async _openUploader(e){var a;if(!((a=this.config)!=null&&a.uploader)||this._isUploaderOpen)return;try{await this._ensureUploaderImport()}catch(i){this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i instanceof Error?i:new Error(String(i)),context:"uploader-load"},bubbles:!0,composed:!0}));return}this._uploaderEl=document.createElement("sfx-uploader");const s=this._uploaderEl;s.addEventListener("sfx-all-complete",()=>{this.store.getState().isOpen&&this._loadData()}),s.addEventListener("sfx-complete-action",()=>{this._closeUploader()}),s.addEventListener("sfx-cancel",()=>{this._closeUploader()}),this._isUploaderOpen=!0,await this.updateComplete,s.config=this._buildUploaderConfig(),await s.updateComplete,e!=null&&e.length&&s.addFiles(e)}_closeUploader(){this._isUploaderOpen=!1,this._uploaderEl=null}_handleUploadClick(){this._openUploader()}_hasFileTransfer(e){var s,a;return!!((a=(s=e.dataTransfer)==null?void 0:s.types)!=null&&a.includes("Files"))}async open(){var c,d,h,u,f,p;const e=this.store.getState(),s=De((c=this.config)==null?void 0:c.forcedFilters),a=new Set(Object.keys(s)),i={},r=De((d=this.config)==null?void 0:d.defaultFilters);for(const[g,v]of Object.entries(r))a.has(g)||(i[g]=v);const n=Object.keys(i);this.store.setState({isOpen:!0,activeTab:((u=(h=this.config)==null?void 0:h.tabs)==null?void 0:u[0])??"assets",searchQuery:"",filters:{metadata:{pinned:e.filters.metadata.pinned,visible:[...e.filters.metadata.pinned],applied:{}},pinned:e.filters.pinned,visible:[...new Set([...e.filters.pinned,...n])],applied:i},offset:0,assets:[],folders:[],currentFolder:null,currentFolderPath:((f=this.config)==null?void 0:f.rememberLastFolder)&&ki()||((p=this.config)==null?void 0:p.rootFolderPath)||"/",breadcrumb:[],selectedAssets:new Map,folderPreviews:{},isPreviewOpen:!1,previewAsset:null,isLoading:!0,isSelectingAll:!1}),this._dragCounter=0,this._isDragOver=!1,this.dispatchEvent(new CustomEvent("ap-open",{detail:{timestamp:Date.now()},bubbles:!0,composed:!0})),await this.updateComplete,!this._initPromise&&this.config&&this._initConfig(this.config),!(this._initPromise&&(await this._initPromise,this._initFailed))&&this._loadData()}close(){this.store.setState({isOpen:!1}),this._dragCounter=0,this._isDragOver=!1,this._isUploaderOpen=!1}_scrollToTop(){var e;(e=this.renderRoot.querySelector(".main-content"))==null||e.scrollTo({top:0})}async _loadData(){var a,i,r,n,c,d,h,u,f,p,g,v,w,b;if(!this.apiClient)return;const e=++this._loadId,s=this.store.getState();this._scrollToTop(),this.store.setState({isLoading:!0});try{const O=s.activeTab;if(O==="assets"){const $=this._buildSearchNotation(),k=s.currentFolderPath||"/",A=Ye(this.apiClient,{folder:k,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:1}),T=Ut(this.apiClient,{folder:k,q:$||void 0,search:s.searchQuery||void 0,recursive:1}).catch(()=>null),[P,C]=await Promise.all([A,T]);if(e!==this._loadId)return;const se=((a=P.files)==null?void 0:a.length)??0,ce=se>=s.limit,$e=((i=C==null?void 0:C.stats)==null?void 0:i.approx_files_count)??((r=C==null?void 0:C.info)==null?void 0:r.total_files_count)??((n=P.info)==null?void 0:n.total_files_count)??((d=(c=P.base)==null?void 0:c.count)==null?void 0:d.files_recursive)??((u=(h=P.base)==null?void 0:h.count)==null?void 0:u.files_direct)??se;this.store.setState({assets:P.files||[],folders:[],totalCount:$e,totalFolderCount:0,offset:0,hasMore:ce,isLoading:!1})}else if(O==="folders"){const $=this._buildSearchNotation(),k=s.currentFolderPath||"/",[A,T,P]=await Promise.all([Rs(this.apiClient,{folderPath:s.currentFolderPath,q:s.searchQuery||void 0,recursive:s.searchQuery?1:0,sort_by:s.sortBy,sort_direction:s.sortDirection}),Ye(this.apiClient,{folder:k,offset:0,limit:s.limit,sort_by:s.sortBy,sort_direction:s.sortDirection,search:s.searchQuery||void 0,q:$||void 0,recursive:0}),Ut(this.apiClient,{folder:k,q:$||void 0,search:s.searchQuery||void 0,recursive:0}).catch(()=>null)]);if(e!==this._loadId)return;const C=A.folders||[];let se={};if(C.length>0)try{se=await Ns(this.apiClient,C.map(de=>de.uuid))}catch{}if(e!==this._loadId)return;const ce=((f=T.files)==null?void 0:f.length)??0,$e=ce>=s.limit,Ge=((p=P==null?void 0:P.stats)==null?void 0:p.approx_files_count)??((g=P==null?void 0:P.info)==null?void 0:g.total_files_count)??((v=T.info)==null?void 0:v.total_files_count)??((b=(w=T.base)==null?void 0:w.count)==null?void 0:b.files_direct)??ce;this.store.setState({assets:T.files||[],folders:C,folderPreviews:se,totalCount:Ge,totalFolderCount:A.total??C.length,offset:0,hasMore:$e,isLoading:!1})}}catch(O){if(e!==this._loadId)return;this.store.setState({isLoading:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:O,context:"loadData"},bubbles:!0,composed:!0}))}}async _loadMore(){const e=this.store.getState();if(e.isLoading||!e.hasMore||!this.apiClient)return;const s=++this._loadMoreId,a=e.offset+e.limit;this.store.setState({isLoading:!0});try{const i=this._buildSearchNotation(),r=await Ye(this.apiClient,{folder:e.currentFolderPath||"/",offset:a,limit:e.limit,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:i||void 0,recursive:e.activeTab==="folders"?0:1});if(s!==this._loadMoreId)return;const n=this.store.getState().assets,c=r.files||[],d=c.length>=e.limit,h=[...n,...c];this.store.setState({assets:h,offset:a,hasMore:d,isLoading:!1})}catch{if(s!==this._loadMoreId)return;this.store.setState({isLoading:!1})}}_debouncedLoadData(e=120){this._loadDataTimer&&clearTimeout(this._loadDataTimer),this._loadDataTimer=setTimeout(()=>{this._loadDataTimer=null,this._loadData()},e)}_handleCancel(e){var s,a;this.close(),(a=(s=this.config)==null?void 0:s.onCancel)==null||a.call(s),this.dispatchEvent(new CustomEvent("ap-cancel",{detail:{reason:e},bubbles:!0,composed:!0}))}_handleSearchChange(e){this.store.setState({searchQuery:e.detail.value,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleViewChange(e){var a;const s=e.detail.mode;this.store.setState({viewMode:s}),(a=this.config)!=null&&a.rememberLastView&&Si(s),this._scrollToTop()}_handleRegionalChange(e){const{groupUuid:s,value:a}=e.detail,i=this.store.getState().regionalFilters;this.store.setState({regionalFilters:{...i,[s]:a}})}_handleSortChange(e){const s=e.detail.value,a=this.store.getState();this.store.setState({sortBy:s,offset:0,assets:[],folders:[]}),Xt(s,a.sortDirection),this.selectionCtrl.resetRange(),this._loadData()}_handleSortDirectionChange(e){const s=e.detail.value,a=this.store.getState();this.store.setState({sortDirection:s,offset:0,assets:[],folders:[]}),Xt(a.sortBy,s),this.selectionCtrl.resetRange(),this._loadData()}_handleTabChange(e){var s;this.store.setState({activeTab:e.detail.tab,currentFolder:null,currentFolderPath:((s=this.config)==null?void 0:s.rootFolderPath)??"/",breadcrumb:[],offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleAssetSelect(e){this.selectionCtrl.handleSelect(e.detail.asset,e.detail.index,e.detail.event)}_handleAssetPreview(e){this.store.setState({previewAsset:e.detail.asset,isPreviewOpen:!0})}_handleQuickSelect(e){var a,i;const s=e.detail.asset;(i=(a=this.config)==null?void 0:a.onSelect)==null||i.call(a,[s]),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:[s]},bubbles:!0,composed:!0})),this._isInline||this.close()}_handleFolderOpen(e){var r;const s=e.detail.folder,a=this.store.getState(),i=s.path||`${a.currentFolderPath}${s.name}/`;(r=this.config)!=null&&r.rememberLastFolder&&Wt(i),this.store.setState({currentFolder:s.uuid,currentFolderPath:i,breadcrumb:[...a.breadcrumb,{uuid:s.uuid,name:s.name,path:i}],searchQuery:"",offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handleBreadcrumbNavigate(e){var c,d;const s=e.detail.uuid,a=this.store.getState(),i=s?a.breadcrumb.findIndex(h=>h.uuid===s):-1,r=s?a.breadcrumb.slice(0,i+1):[],n=r.length>0?r[r.length-1].path:((c=this.config)==null?void 0:c.rootFolderPath)||"/";(d=this.config)!=null&&d.rememberLastFolder&&Wt(n),this.store.setState({currentFolder:s||null,currentFolderPath:n,breadcrumb:r,offset:0,assets:[],folders:[]}),this.selectionCtrl.resetRange(),this._loadData()}_handlePreviewClose(){this.store.setState({isPreviewOpen:!1,previewAsset:null})}_handlePreviewNavigate(e){this.store.setState({previewAsset:e.detail.asset})}_handleSelectionConfirm(e){var a,i;const s=e.detail.assets;(i=(a=this.config)==null?void 0:a.onSelect)==null||i.call(a,s),this.dispatchEvent(new CustomEvent("ap-select",{detail:{assets:s},bubbles:!0,composed:!0})),this._isInline||this.close()}async _handleSelectAll(){var a;const e=this.store.getState();if(!(e.isSelectingAll||!this.apiClient||!(((a=e.config)==null?void 0:a.multiSelect)??!0))){if(e.assets.length>=e.totalCount){this.selectionCtrl.selectAll(e.assets);return}this.store.setState({isSelectingAll:!0});try{const i=this._buildSearchNotation(),r=e.currentFolderPath||"/",n=e.limit,c=e.assets,d=e.totalCount,h=e.activeTab==="folders"?0:1,u=[];for(let b=c.length;b<d;b+=n)u.push(b);const f=4,p=[];for(let b=0;b<u.length;b+=f){const O=u.slice(b,b+f),$=await Promise.all(O.map(k=>Ye(this.apiClient,{folder:r,offset:k,limit:n,sort_by:e.sortBy,sort_direction:e.sortDirection,search:e.searchQuery||void 0,q:i||void 0,recursive:h})));for(const k of $)k.files&&p.push(...k.files)}const g=new Set(c.map(b=>b.uuid)),v=p.filter(b=>g.has(b.uuid)?!1:(g.add(b.uuid),!0)),w=[...c,...v];this.store.setState({assets:w,offset:Math.max(0,w.length-n),hasMore:!1,isSelectingAll:!1}),this.selectionCtrl.selectAll(w)}catch(i){this.store.setState({isSelectingAll:!1}),this.dispatchEvent(new CustomEvent("ap-error",{detail:{error:i,context:"selectAll"},bubbles:!0,composed:!0}))}}}_handleSelectionClear(){this.selectionCtrl.clearSelection()}_handleSelectionDeselect(e){const s=new Map(this.store.getState().selectedAssets);s.delete(e.detail.uuid),this.store.setState({selectedAssets:s})}_isDateFilterKey(e){return e===m.DATE||e===m.LICENSE_EXPIRY||e===R.DUE_DATE}_handleFilterUpdate(e){const{key:s,values:a,operator:i}=e.detail,n={...this.store.getState().filters};let c=a===""||a===null||a===void 0||Array.isArray(a)&&a.length===0||typeof a=="object"&&!Array.isArray(a)&&Object.values(a).every(d=>d==null||d===""||Array.isArray(d)&&d.length===0);if(!c&&this._isDateFilterKey(s)&&typeof a=="object"&&!Array.isArray(a)){const{kind:d,preset:h,from:u,to:f}=a;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 a=="object"&&!Array.isArray(a)?d[s]={type:"date",field:a.field||"created",kind:a.kind||null,preset:a.preset||null,from:a.from||null,to:a.to||null}:s===m.IMAGE&&typeof a=="object"&&!Array.isArray(a)?d[s]=a:d[s]={type:"string",values:Array.isArray(a)?a:[a],operator:i||":"},n.applied=d,n.visible.includes(s)||(n.visible=[...n.visible,s])}if(this.store.setState({filters:n,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData(),this._pendingFilter===s){this._pendingFilter=null;const d=this.renderRoot.querySelector("ap-filters-bar");d&&(d.pendingFilter=null)}}_handleFilterOpen(e){const s=e.detail.key,a=e.detail.chipRect,i=this.renderRoot.querySelector("ap-content-toolbar");let r;if(a){const n=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(n){const c=n.getBoundingClientRect();r=a.left-c.left}}i==null||i.openFilterPanel(s,!0,r)}_handleMetadataFilterOpen(e){const{fieldKey:s,chipRect:a}=e.detail,i=this.renderRoot.querySelector("ap-content-toolbar");let r;if(a){const n=this.renderRoot.querySelector(".toolbar-filters-wrapper");if(n){const c=n.getBoundingClientRect();r=a.left-c.left}}i==null||i.openMetadataFieldPanel(s,!0,r)}_handleFilterPanelChange(e){const s=this.renderRoot.querySelector("ap-filters-bar");s&&(s.activeFilter=e.detail.key,s.activeMetadataField=e.detail.metadataFieldKey||null),!e.detail.key&&!e.detail.metadataFieldKey&&(this._pendingFilter||this._pendingMetadataField)&&(this._pendingFilter=null,this._pendingMetadataField=null,s&&(s.pendingFilter=null,s.pendingMetadataField=null))}async _handleFilterPending(e){var f,p,g;const{key:s,metadataFieldKey:a}=e.detail,i=this.renderRoot.querySelector("ap-filters-bar"),r=this.renderRoot.querySelector("ap-content-toolbar");if(!i||!r)return;a?(this._pendingMetadataField=a,i.pendingMetadataField=a):s&&(this._pendingFilter=s,i.pendingFilter=s),await i.updateComplete;let n=i.renderRoot.querySelector(".chip.pending");if(!n){const v=i.renderRoot.querySelectorAll(".chip.pinned-empty"),w=a?(f=i._getMetadataLabel)==null?void 0:f.call(i,a):void 0;for(const b of v){const O=(g=(p=b.querySelector(".chip-label"))==null?void 0:p.textContent)==null?void 0:g.trim();if(a&&O===w){n=b;break}if(s&&O===(ke[s]||s)){n=b;break}}}if(!n)return;const 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;a?r.openMetadataFieldPanel(a,!0,u):s&&r.openFilterPanel(s,!0,u)}_handleFilterRemove(e){var n;const s=e.detail.key;if(s in(((n=this.config)==null?void 0:n.forcedFilters)??{}))return;const i={...this.store.getState().filters},r={...i.applied};delete r[s],i.applied=r,i.pinned.includes(s)||(i.visible=i.visible.filter(c=>c!==s)),this.store.setState({filters:i,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleMetadataFilterChange(e){const{fieldKey:s,operator:a,values:i,metadataType:r}=e.detail,c={...this.store.getState().filters},d={...c.metadata},h={...d.applied};if(!i||Array.isArray(i)&&i.length===0?(delete h[s],d.applied=h,d.pinned.includes(s)||(d.visible=d.visible.filter(f=>f!==s))):(h[s]={type:"string",values:Array.isArray(i)?i:[i],operator:a||":",metadataType:r},d.applied=h,d.visible.includes(s)||(d.visible=[...d.visible,s])),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:a}=e.detail,r={...this.store.getState().filters},n={...r.metadata};a?n.visible.includes(s)||(n.visible=[...n.visible,s]):n.visible=n.visible.filter(c=>c!==s),r.metadata=n,this.store.setState({filters:r})}_handleMetadataFilterRemove(e){const{fieldKey:s}=e.detail,i={...this.store.getState().filters},r={...i.metadata},n={...r.applied};delete n[s],r.applied=n,r.pinned.includes(s)||(r.visible=r.visible.filter(c=>c!==s)),i.metadata=r,this.store.setState({filters:i,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_handleFilterPin(e){var c,d;const{key:s,pinned:a}=e.detail,r={...this.store.getState().filters};a?r.pinned.includes(s)||(r.pinned=[...r.pinned,s]):(r.pinned=r.pinned.filter(h=>h!==s),s in r.applied||(r.visible=r.visible.filter(h=>h!==s))),this.store.setState({filters:r});const n=((d=(c=this.store.getState().config)==null?void 0:c.auth)==null?void 0:d.projectToken)??null;xi(n,r.pinned)}_handleMetadataPin(e){var d,h;const{fieldKey:s,pinned:a}=e.detail,r={...this.store.getState().filters},n={...r.metadata};a?n.pinned.includes(s)||(n.pinned=[...n.pinned,s]):(n.pinned=n.pinned.filter(u=>u!==s),s in n.applied||(n.visible=n.visible.filter(u=>u!==s))),r.metadata=n,this.store.setState({filters:r});const c=((h=(d=this.store.getState().config)==null?void 0:d.auth)==null?void 0:h.projectToken)??null;$i(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,i={...this.store.getState().filters};i.visible=i.visible.filter(r=>r!==s),this.store.setState({filters:i})}_handleMetadataFieldDeactivate(e){const{fieldKey:s}=e.detail,i={...this.store.getState().filters},r={...i.metadata};r.visible=r.visible.filter(n=>n!==s),i.metadata=r,this.store.setState({filters:i})}_handleFiltersSet(e){var h;const{applied:s,metadata:a}=e.detail,r={...this.store.getState().filters},n=new Set(Object.keys(((h=this.config)==null?void 0:h.forcedFilters)??{})),c={...s};for(const u of n)delete c[u];r.applied=c;const d=Object.keys(s);if(r.visible=[...new Set([...r.pinned,...d])],a){const u={...r.metadata};u.applied=a.applied;const f=Object.keys(a.applied);u.visible=[...new Set([...u.pinned,...f])],r.metadata=u}this.store.setState({filters:r,offset:0,assets:[],folders:[],isLoading:!0}),this.selectionCtrl.resetRange(),this._debouncedLoadData()}_getSortOptions(){const e=this.storeCtrl.state;return e.searchQuery?Oi:e.activeTab==="folders"?Mi:Ft}_buildSearchNotation(){var i;const e=this.store.getState(),s={...De((i=this.config)==null?void 0:i.forcedFilters),...e.filters.applied};return ni(s,e.filters.metadata.applied).join(" ")}render(){var h,u,f,p,g,v,w,b;const e=this.storeCtrl.state,s=Array.from(e.selectedAssets.keys()),a=this.selectionCtrl.getSelectedAssets(),i=o.html`
|
|
5664
5664
|
<ap-header
|
|
5665
5665
|
.activeTab=${e.activeTab}
|
|
5666
5666
|
.tabs=${((h=this.config)==null?void 0:h.tabs)??["assets","folders"]}
|
|
@@ -5767,7 +5767,7 @@
|
|
|
5767
5767
|
@filter-update=${this._handleFilterUpdate}
|
|
5768
5768
|
></ap-preview-panel>`:o.nothing}
|
|
5769
5769
|
</div>
|
|
5770
|
-
`,
|
|
5770
|
+
`,c=o.html`
|
|
5771
5771
|
<ap-selection-bar
|
|
5772
5772
|
.selectedAssets=${a}
|
|
5773
5773
|
.totalCount=${e.totalCount}
|
|
@@ -5793,7 +5793,7 @@
|
|
|
5793
5793
|
${this._isUploaderOpen?d:o.html`
|
|
5794
5794
|
<div class="inline-header">${i}</div>
|
|
5795
5795
|
<div class="inline-content">${n}</div>
|
|
5796
|
-
<div class="inline-footer">${
|
|
5796
|
+
<div class="inline-footer">${c}</div>
|
|
5797
5797
|
`}
|
|
5798
5798
|
</div>
|
|
5799
5799
|
`:o.nothing:o.html`
|
|
@@ -5804,7 +5804,7 @@
|
|
|
5804
5804
|
${this._isUploaderOpen?d:o.html`
|
|
5805
5805
|
<div slot="header">${i}</div>
|
|
5806
5806
|
${n}
|
|
5807
|
-
<div slot="footer">${
|
|
5807
|
+
<div slot="footer">${c}</div>
|
|
5808
5808
|
`}
|
|
5809
5809
|
</ap-modal>
|
|
5810
5810
|
`}_renderContent(e,s){var a,i,r;return e.activeTab==="assets"?!e.isLoading&&e.assets.length===0?o.html`
|
|
@@ -6037,4 +6037,4 @@
|
|
|
6037
6037
|
--sfx-up-border: transparent;
|
|
6038
6038
|
--sfx-up-radius: 0;
|
|
6039
6039
|
}
|
|
6040
|
-
`];let Te=Rt;zt([
|
|
6040
|
+
`];let Te=Rt;zt([l.state()],Te.prototype,"_isDragOver");zt([l.state()],Te.prototype,"_isUploaderOpen");zt([l.property({type:Object})],Te.prototype,"config");exports.AssetPicker=Te;
|