"use strict";var E=Object.create;var l=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var O=Object.getPrototypeOf;var D=Object.prototype.hasOwnProperty;var d=(e,t)=>l(e,"name",{value:t,configurable:true});var M=(e,t)=>{for(var n in t)l(e,n,{get:t[n],enumerable:true})};var g=(e,t,n,s)=>{if(t&&typeof t==="object"||typeof t==="function"){for(let o of I(t))if(!D.call(e,o)&&o!==n)l(e,o,{get:()=>t[o],enumerable:!(s=u(t,o))||s.enumerable})}return e};var v=(e,t,n)=>(n=e!=null?E(O(e)):{},g(t||!e||!e.__esModule?l(n,"default",{value:e,enumerable:true}):n,e));var R=e=>g(l({},"__esModule",{value:true}),e);var f=(e,t,n,s)=>{var o=s>1?void 0:s?u(t,n):t;for(var a=e.length-1,c;a>=0;a--)if(c=e[a])o=(s?c(t,n,o):c(o))||o;if(s&&o)l(t,n,o);return o};var N={};M(N,{default:()=>F});module.exports=R(N);var i=require("react/jsx-runtime");var p=require("@mdi/js");var C=v(require("classnames"));var r=require("lodash");var b=require("mobx-react");var y=require("react");var m=v(require("./icon"));let h=class extends y.Component{input=null;constructor(t){super(t);this.state={value:t.value||""};this.throttledOnChange=(0,r.debounce)(this.throttledOnChange,this.props.throttleDelay)}componentDidMount(){const{autoFocus:t=false}=this.props;if(t&&this.input){this.input.focus()}}onChange(t){const{throttle:n=false,onChange:s=r.noop}=this.props;const{value:o}=t.target;this.setState({value:o});if(n){t.persist();this.throttledOnChange(o)}else{s(o)}}throttledOnChange(t){const{onChange:n=r.noop}=this.props;n(t)}reset(){const{onReset:t=r.noop}=this.props;this.setState({value:""});t()}render(){const{className:t="",name:n="searchInput",placeholder:s=""}=this.props;const{value:o=""}=this.state;return(0,i.jsxs)("div",{className:(0,C.default)([t,"search-input"]),children:[(0,i.jsxs)("label",{htmlFor:n,children:[(0,i.jsx)(m.default,{icon:p.mdiMagnify}),(0,i.jsx)("input",{name:n,id:n,type:"text",placeholder:s,value:o,onChange:a=>this.onChange(a),ref:a=>{this.input=a}})]}),o.length>0&&(0,i.jsx)("span",{onClick:()=>this.reset(),onKeyDown:r.noop,children:(0,i.jsx)(m.default,{icon:p.mdiCloseCircleOutline})})]})}};d(h,"SearchInput");h=f([b.observer],h);var F=h;
