import{r as i,c as t,h as e,H as s}from"./p-DBTJNfo7.js";import{t as r}from"./p-Cdx3I2X8.js";import{g as a,a as n,b as h,c as o}from"./p-DlJXKdhK.js";import"./p-CgNJbSP4.js";const l={id:null,text:null,removable:!0},d=class{constructor(e){i(this,e),this.change=t(this,"change"),this.interact=t(this,"interact"),this.required=!1,this.disabled=!1,this.readonly=!1,this.invalid=!1,this.accept="*",this.language="en",this.dropZoneTip=()=>this.getTranslation("file.drag-and-drop-tips"),this.handleNewFiles=i=>{this.preventAndStop(i),this.change.emit(i.detail[0])},this.handleChipSetChange=i=>{i.stopPropagation();const t=0===i.detail.length?i.detail[0]:null;t||this.change.emit(t)},this.handleChipInteract=i=>{this.preventAndStop(i),this.interact.emit(i.detail.id)}}render(){return e(s,{key:"2de03c65bb1c1aba3d2bb09717cc45f3ef618ebc"},e("limel-file-dropzone",{key:"8cb9d8dcbbe0ca9b667bfea72992a11a25f73fdb",disabled:this.disabled||this.readonly||!!this.value,accept:this.accept,onFilesSelected:this.handleNewFiles},this.renderChipset()),this.renderDragAndDropTip())}renderDragAndDropTip(){if(!(this.value||this.disabled||this.readonly))return e("div",{class:"drag-and-drop-tip"},e("span",{class:"invisible-label-mock",role:"presentation"},this.label),e("span",{class:"tip"},this.dropZoneTip()))}getChipArray(){return this.value?[Object.assign(Object.assign({},l),{text:this.value.filename,id:this.value.id,icon:{name:o(this.value),title:h(this.value),color:n(this.value),backgroundColor:a(this.value)},href:this.value.href,menuItems:this.value.menuItems})]:[]}renderChipset(){const i=e("limel-chip-set",{disabled:this.disabled,readonly:this.readonly,invalid:this.invalid,label:this.label,leadingIcon:"upload_to_cloud",language:this.language,onChange:this.handleChipSetChange,onInteract:this.handleChipInteract,required:this.required,type:"input",value:this.getChipArray()});return this.value?i:e("limel-file-input",{accept:this.accept,disabled:this.disabled||this.readonly},i)}preventAndStop(i){i.stopPropagation(),i.preventDefault()}getTranslation(i){return r.get(i,this.language)}};d.style='@charset "UTF-8";:host(limel-file){position:relative}.drag-and-drop-tip{pointer-events:none;position:absolute;box-sizing:border-box;margin:0.25rem;inset:0;display:flex;align-items:center;justify-content:flex-end;flex-wrap:nowrap;border-radius:0.25rem;border:1px dashed rgb(var(--contrast-700));padding:0 0.5rem}.drag-and-drop-tip .invisible-label-mock{flex-shrink:0;opacity:0;padding-right:1rem;padding-left:1.5rem}.drag-and-drop-tip .tip{font-size:smaller;color:var(--limel-theme-text-secondary-on-background-color);height:auto;max-height:3rem;line-height:1;display:-webkit-box;overflow:hidden;white-space:normal;-webkit-box-orient:vertical;-webkit-line-clamp:2}';export{d as limel_file}