1import{m as t,v as l,h as o,d as n}from"./p-169d094d.entry-c3db0371.js";import{o as a,n as d}from"./p-d58e8b24-7ae95e25.js";import"./p-465d9e32-a2caadb5.js";import"./index-7981e740.js";const h='@import url("https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700");.modus-file-dropzone{color:var(--modus-body-color, #252a2e);display:flex;flex-direction:column;font-family:"Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"}.modus-file-dropzone input{display:none}.modus-file-dropzone .header{align-items:start;display:flex;flex-direction:column}.modus-file-dropzone .header label{font-size:1.5rem;font-weight:600;margin-bottom:0.5rem}.modus-file-dropzone .header span{margin-bottom:0.5rem}.modus-file-dropzone .dropzone{align-items:center;background-color:var(--modus-file-upload-dropzone-bg, rgba(241, 241, 246, 0.8));border:0.0625rem dashed var(--modus-file-upload-dropzone-border-color, #6a6e79);border-radius:0.25rem;color:var(--modus-file-upload-dropzone-color, #6a6e79);display:flex;flex-direction:column;font-weight:600;justify-content:center;padding:0.75rem 1rem}.modus-file-dropzone .dropzone .browse{color:var(--modus-file-upload-dropzone-browse-color, #0063a3)}.modus-file-dropzone .dropzone .browse:hover{cursor:pointer}.modus-file-dropzone .dropzone.highlight{background-color:var(--modus-file-upload-dropzone-highlight-bg, #dcedf9);border-color:var(--modus-file-upload-dropzone-highlight-border-color, #0063a3);color:var(--modus-file-upload-dropzone-highlight-color, #0063a3)}.modus-file-dropzone .dropzone.highlight svg{fill:var(--modus-file-upload-dropzone-highlight-color, #0063a3)}.modus-file-dropzone .dropzone.error{background-color:var(--modus-file-upload-dropzone-error-bg, #fbd4d7);border-color:var(--modus-file-upload-dropzone-error-border-color, #ab1f26);color:var(--modus-file-upload-dropzone-error-color, #ab1f26)}.modus-file-dropzone .dropzone.error svg{fill:var(--modus-file-upload-dropzone-error-color, #ab1f26)}.modus-file-dropzone .dropzone .error-messages{align-items:center;display:flex;flex-direction:column}.modus-file-dropzone .dropzone svg{fill:var(--modus-file-upload-dropzone-color, #6a6e79);margin-bottom:0.25rem}',p=class{constructor(e){t(this,e),this.files=l(this,"files",7),this.onDragLeave=r=>{this.fileDraggedOver=!1,r.preventDefault()},this.onDragOver=r=>{this.error||(this.fileDraggedOver=!0,r.preventDefault())},this.onDrop=r=>{this.fileDraggedOver=!1,r.preventDefault(),this.dropzoneFiles=[...this.dropzoneFiles,...Array.from(r.dataTransfer.files)],this.updateDropzoneState(),this.files.emit([this.dropzoneFiles,this.error]),this.fileInput.value=null},this.onFileChange=()=>{this.dropzoneFiles=[...this.dropzoneFiles,...Array.from(this.fileInput.files)],this.updateDropzoneState(),this.files.emit([this.dropzoneFiles,this.error]),this.fileInput.value=null},this.openBrowse=()=>{this.fileInput.click()},this.updateDropzoneState=()=>{if(!this.multiple&&this.dropzoneFiles.length>1){this.error="maxFileCount",this.errorMessageTop="Multiple files are not allowed.";return}if(this.maxFileCount&&this.maxFileCount<this.dropzoneFiles.length){this.error="maxFileCount",this.errorMessageTop=`You can only upload ${this.maxFileCount} ${this.maxFileCount>1?"files":"file"}.`;return}if(this.dropzoneFiles.some(i=>i.name.length>this.maxFileNameLength)){this.error="maxFileNameLength",this.errorMessageTop=`File name exceeds length limit: ${this.dropzoneFiles.find(i=>i.name.length>this.maxFileNameLength).name}`;return}const r=this.dropzoneFiles.reduce((i,s)=>i+s.size,0);if(this.maxTotalFileSizeBytes&&this.maxTotalFileSizeBytes<r){this.error="maxTotalFileSize",this.errorMessageTop="File exceeds size limit.",this.errorMessageBottom=`You can only upload a total file size of ${this.maxTotalFileSizeBytes} bytes.`;return}this.error=null,this.errorMessageTop="",this.errorMessageBottom=""},this.dropzoneFiles=[],this.error=null,this.fileDraggedOver=!1,this.ariaLabel=void 0,this.description=void 0,this.dropzoneHeight=void 0,this.dropzoneWidth=void 0,this.includeStateIcon=!0,this.label=void 0,this.maxFileC
1ount=void 0,this.maxFileNameLength=void 0,this.maxTotalFileSizeBytes=void 0,this.multiple=!0}elementKeydownHandler(e){switch(e.code){case"Enter":this.fileInput.click();break}}async addFile(e){this.dropzoneFiles.push(e),this.updateDropzoneState(),this.files.emit([this.dropzoneFiles,this.error])}async getError(){return this.error}async getFiles(){return this.dropzoneFiles}async removeFile(e){const r=this.dropzoneFiles.find(s=>s.name===e),i=this.dropzoneFiles.indexOf(r);i>-1&&(this.dropzoneFiles.splice(i,1),this.dropzoneFiles=[...this.dropzoneFiles]),this.updateDropzoneState(),this.files.emit([this.dropzoneFiles,this.error])}render(){return o(n,{"aria-label":this.ariaLabel,role:"button"},o("div",{class:"modus-file-dropzone"},o("input",{onChange:this.onFileChange,multiple:this.multiple,ref:e=>this.fileInput=e,type:"file"}),o("div",{class:"header"},o("label",null,this.label),o("span",null,this.description)),o("div",{class:`dropzone ${this.fileDraggedOver?"highlight":null} ${this.error?"error":null}`,onDragLeave:e=>this.onDragLeave(e),onDragOver:e=>this.onDragOver(e),onDrop:e=>this.onDrop(e),style:{height:this.dropzoneHeight,width:this.dropzoneWidth},tabIndex:0},this.includeStateIcon&&(this.error?o(a,{size:"36"}):o(d,{size:"36"})),!this.error&&o("div",null,"Drag files here",!this.fileDraggedOver&&o("span",null," ","or",o("span",{class:"browse",onClick:this.openBrowse}," ","browse")," ","to upload"),"."),this.error&&o("div",{class:"error-messages"},this.errorMessageTop&&o("span",null,this.errorMessageTop),this.errorMessageBottom&&o("span",null,this.errorMessageBottom)))))}};p.style=h;export{p as modus_file_dropzone};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.