var j=Object.create;var C=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var R=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var W=(t,e,s,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of K(e))!G.call(t,n)&&n!==s&&C(t,n,{get:()=>e[n],enumerable:!(u=D(e,n))||u.enumerable});return t};var Z=(t,e,s)=>(s=t!=null?j(A(t)):{},W(e||!t||!t.__esModule?C(s,"default",{value:t,enumerable:!0}):s,t));var g=R((Q,p)=>{(function(){"use strict";var t={}.hasOwnProperty;function e(){for(var n="",o=0;o<arguments.length;o++){var i=arguments[o];i&&(n=u(n,s(i)))}return n}function s(n){if(typeof n=="string"||typeof n=="number")return n;if(typeof n!="object")return"";if(Array.isArray(n))return e.apply(null,n);if(n.toString!==Object.prototype.toString&&!n.toString.toString().includes("[native code]"))return n.toString();var o="";for(var i in n)t.call(n,i)&&n[i]&&(o=u(o,i));return o}function u(n,o){return o?n?n+" "+o:n+o:n}typeof p<"u"&&p.exports?(e.default=e,p.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var d=Z(g());import a,{useState as y}from"react";import{useEffect as q,useRef as z}from"react";function v(t){let e=z(null);return q(()=>{t&&(typeof t=="function"?t(e.current):t.current=e.current)},[e,t]),e}import f from"react";function b({opened:t,...e}){return f.createElement("svg",{viewBox:"0 0 32 32",fill:"none",...e},!t&&f.createElement("g",{className:"closed"},f.createElement("circle",{cx:"16",cy:"18",r:"3",fill:"currentColor"}),f.createElement("path",{d:"M4 17C4 13 8 8 16 8C24 8 28 13 28 17",stroke:"currentColor",strokeWidth:"2"})),t&&f.createElement("g",{className:"opened"},f.createElement("path",{d:"M2 28L11 22M30 3C30 3 27 9 23 13",stroke:"currentColor",strokeWidth:"2"}),f.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16 27C19 27 26 24 26 17C26 11 26 7 16 7C6 7 6 11 6 17C6 24 13 27 16 27ZM11.2929 13.7071L14.5858 17L11.2929 20.2929L12.7071 21.7071L16 18.4142L19.2929 21.7071L20.7071 20.2929L17.4142 17L20.7071 13.7071L19.2929 12.2929L16 15.5858L12.7071 12.2929L11.2929 13.7071Z",fill:"currentColor"})))}var re=a.forwardRef(function({label:e,clearable:s=!0,errorMessage:u,onChange:n,onValueChange:o,onEnter:i,...l},x){let c=v(x),[w,I]=y(L(l.value)),[N,h]=y(!1),[E,T]=y(!1);function L(r){return r!==""&&r!==void 0}function M(r){let m=r.currentTarget.value;c.current&&(c.current.value=m),n?.(r),o?.(m),I(L(r.target.value))}function S(r){l.onFocus?.(r),h(!0)}function F(r){l.onBlur?.(r),h(!1)}function H(r){l.onKeyDown?.(r),r.key==="Enter"&&i?.(r.currentTarget.value)}function O(){V("")}function V(r){if(!c.current)return;Object.getOwnPropertyDescriptor(window.HTMLInputElement.prototype,"value")?.set?.call(c.current,r);let B=new Event("input",{bubbles:!0});c.current.dispatchEvent(B)}let k=s&&w&&!l.disabled&&!l.readOnly;return a.createElement("div",{className:(0,d.default)("leaf-input-container","leaf-password-input",{filled:w,focused:N,error:!!u,disabled:l.disabled})},a.createElement("div",{className:"leaf-label-area"},e&&a.createElement("label",{className:"leaf-label"},e)),a.createElement("div",{className:(0,d.default)("leaf-input-area")},a.createElement("input",{type:E?"text":"password",...l,className:(0,d.default)("leaf-input",{clearable:s},l.className),ref:c,onChange:M,onFocus:S,onBlur:F,onKeyDown:H}),!l.disabled&&!l.readOnly&&a.createElement("button",{type:"button",className:"leaf-password-eye",onClick:()=>T(r=>!r),tabIndex:-1},a.createElement(b,{opened:E})),k&&a.createElement("button",{type:"button",className:"leaf-clear-button",onClick:O,tabIndex:-1})),a.createElement("div",{className:"leaf-extra-area"},u&&a.createElement("p",{className:(0,d.default)("leaf-error-message","leaf-desc")},u)))});export{re as default};
/*! Bundled license information:

classnames/index.js:
  (*!
  	Copyright (c) 2018 Jed Watson.
  	Licensed under the MIT License (MIT), see
  	http://jedwatson.github.io/classnames
  *)
*/
