1import{_ as t,a as i}from"./chunk-vendor-di.Bh23gdA.js";import{P as u,w as h,$ as l,e as r,b as S,d as E,r as p,t as $}from"./chunk-vendor-lit.NvY0u02.js";import{p as g}from"./chunk-phoenix_custom_element.-3oJuZO.js";import{a as m,b,F as y,c as s,d as v}from"./chunk-file_picker_constants.5Ry9C2V.js";import{c as N}from"./chunk-index.D5AUA1V.js";import{v as x}from"./chunk-v4.FWzwXvE.js";import{I as C}from"./chunk-input_constants.Bz3yUrY.js";import{B as L}from"./chunk-btn_controller.BPcEEeZ.js";import{I as k}from"./chunk-icon_constants.BVm6Vwv.js";import"./chunk-vendor-lodash.CWHFt7Z.js";import"./chunk-keystrokes_controller.BSiCZ0Y.js";let a=class extends u{constructor(){super(...arguments),this.maxFileNameLength=12}connectedCallback(){super.connectedCallback(),this.setAttribute("aria-label",this.name),this.classList.add(m.file),this._separateNameFromExtension(this.name)}render(){return l` 2 <span class="${m.fileName}" 3 >${this._fileNameWithoutExtension.length>this.maxFileNameLength?this._trimNameLength(this._fileNameWithoutExtension):this.name}</span 4 > 5 <button 6 class="${m.fileRemoveButton}" 7 @click="${this._handleClick}" 8 aria-label="${this.removeButtonText} ${this.name}" 9 type="button" 10 > 11 ${this.removeButtonIconName?l`<h-icon class="${b.filePickerIcon}" icon-name=${this.removeButtonIconName} />`:h} 12 ${this.removeButtonText} 13 </button> 14 `}_handleClick(){this.emitCustomEvent(y.removed,{detail:{fileId:this.id}})}_separateNameFromExtension(e){const n=e.lastIndexOf(".");this._fileExtensionWithDot=e.substring(n,e.length),this._fileNameWithoutExtension=e.slice(0,n)}_trimNameLength(e){const n=e.slice(0,11),d=e.slice(-3);return`${n}...${d}${this._fileExtensionWithDot}`}};t([r({type:String}),i("design:type",String)],a.prototype,"name",void 0);t([r({type:String}),i("design:type",String)],a.prototype,"id",void 0);t([r({type:String,attribute:"remove-button-text"}),i("design:type",String)],a.prototype,"removeButtonText",void 0);t([r({type:String,attribute:"remove-button-icon-name"}),i("design:type",String)],a.prototype,"removeButtonIconName",void 0);t([r({type:Number,attribute:"max-file-name-length"}),i("design:type",Number)],a.prototype,"maxFileNameLength",void 0);a=t([g("h-file")],a);class f{constructor({name:e,id:n}){this.name=e,this.id=n}static create(e){return new f(e)}}let o=class extends u{constructor(){super(...arguments),this.type=C.file,this.labelText="Wgraj plik",this.labelIconName="icon-upload",this.removeButtonText="UsuÅ plik",this.removeButtonIconName="icon-x",this._$fileInputRef=S(),this._handleChangeEvent=e=>{const n=this._getFiles(e);n&&n.length>0&&(this._file=f.create({name:this._getFileName(n),id:`file-${x()}`}),this.classList.add(s.filePickerHasValue))},this._getFiles=e=>{const n=e.currentTarget;return n.id===this.controlId?n.files:null},this._getFileName=e=>e[0].name,this._getInputRefValue=()=>this._$fileInputRef.value,this._removeFileItem=()=>{const e=this._getInputRefValue();e&&(e.value="",e.files=null),this._file=null,this.classList.remove(s.filePickerHasValue),this._dispatchChangeEvent()},this._triggerClickOnLabel=()=>{const e=this._getInputRefValue();e&&e.click()},this._dispatchChangeEvent=()=>{this.emitEvent("change")}}connectedCallback(){super.connectedCallback(),this._addEventListeners();const e=N({[s.filePicker]:!0,[s.filePickerDisabled]:this.disabled,[s.filePickerRequired]:this.required,[s.filePickerError]:this.error});e&&this.classList.add(...e.split(" "))}render(){var e,n;return super.render(),l` 15 <input 16 ${E(this._$fileInputRef)} 17 type="file" 18 class="${s.filePickerInput}" 19 id="${p(this.controlId)}" 20 name="${p(this.controlName)}" 21 ?disabled="${this.disabled}" 22 ?required="${this.required}" 23 accept="${p(this.accept)}" 24 @change="${this._handleChangeEvent}" 25 hidden 26 /> 27 28 ${!((e=this._file)===null||e===void 0)&&e.name?h:l` <h-file-picker-label 29 control-id="${this.controlId}" 30 label-text="${this.labelText}" 31 label-icon-name="${p(this.labelIconName)}" 32 aria-required="${this.required?"true":"false"}" 33 validation-container 34 tabindex="0" 35 />`} 36 ${!((n=this._file)===null||n===void 0)&&n.name?l` <h-file 37 name="${this._file.name}" 38 id="${this._file.id}" 39 remove-button-text="${this.removeButtonText}" 40 remove-button-icon-name="${p(this.removeButtonIconName)}" 41 />`:h} 42 `}get files(){return this._getInputRefValue().files}set files(e){if(!e)return;const n=this._getInputRefValue(),d=new DataTransfer;Array.from(e).forEach(I=>d.items.add(I)),n&&(n.files=d.files)}get name(){return this.controlName}get id(){return this.controlId}_addEventListeners(){this.addEventListener(y.removed,this._removeFileItem),this.addEventListener(v.filePickerLabelClickedByEnterKey,this._triggerClickOnLabel)}};t([r({type:String,attribute:"control-id",reflect:!0}),i("design:type",String)],o.prototype,"controlId",void 0);t([r({type:String,attribute:"control-name"}),i("design:type",String)],o.prototype,"controlName",void 0);t([r({type:String}),i("design:type",String)],o.prototype,"type",void 0);t([r({type:Boolean}),i("design:type",Boolean)],o.prototype,"disabled",void 0);t([r({type:Boolean}),i("design:type",Boolean)],o.prototype,"required",void 0);t([r({type:Boolean}),i("design:type",Boolean)],o.prototype,"error",void 0);t([r({type:String,attribute:"label-text"}),i("design:type",String)],o.prototype,"labelText",void 0);t([r({type:String,attribute:"label-icon-name"}),i("design:type",String)],o.prototype,"labelIconName",void 0);t([r({type:String,attribute:"remove-button-text"}),i("design:type",String)],o.prototype,"removeButtonText",void 0);t([r({type:String,attribute:"remove-button-icon-name"}),i("design:type",String)],o.prototype,"removeButtonIconName",void 0);t([r({type:String}),i("design:type",String)],o.prototype,"accept",void 0);t([$(),i("design:type",Object)],o.prototype,"_file",void 0);o=t([g("h-file-picker")],o);let c=class extends u{constructor(){super(),this._dispatchClickEvent=e=>{e.preventDefault(),this.emitCustomEvent(v.filePickerLabelClickedByEnterKey)},this._btnController=new L(this,this._dispatchClickEvent)}render(){return super.render(),l`<label class="${s.filePickerLabel}" for="${this.controlId}"> 43 ${this.labelIconName?l`<h-icon 44 class="${k.icon} ${b.filePickerIcon}" 45 icon-name=${this.labelIconName} 46 />`:h} 47 ${this.labelText} 48 </label>`}};t([r({type:String,attribute:"control-id",reflect:!0}),i("design:type",String)],c.prototype,"controlId",void 0);t([r({type:String,attribute:"label-text"}),i("design:type",String)],c.prototype,"labelText",void 0);t([r({type:String,attribute:"label-icon-name"}),i("design:type",String)],c.prototype,"labelIconName",void 0);c=t([g("h-file-picker-label"),i("design:paramtypes",[])],c);requestAnimationFrame(()=>{});
48globalThis.__phoenix_wc__=[a,o,c];
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.