{"version":3,"file":"Input-Bqx5-60n.cjs","sources":["../../../node_modules/.pnpm/lucide-react@1.8.0_react@19.2.5/node_modules/lucide-react/dist/esm/icons/eye-off.js","../../../node_modules/.pnpm/lucide-react@1.8.0_react@19.2.5/node_modules/lucide-react/dist/esm/icons/eye.js","../src/components/Input/Input.tsx"],"sourcesContent":["/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n  [\n    \"path\",\n    {\n      d: \"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49\",\n      key: \"ct8e1f\"\n    }\n  ],\n  [\"path\", { d: \"M14.084 14.158a3 3 0 0 1-4.242-4.242\", key: \"151rxh\" }],\n  [\n    \"path\",\n    {\n      d: \"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143\",\n      key: \"13bj9a\"\n    }\n  ],\n  [\"path\", { d: \"m2 2 20 20\", key: \"1ooewy\" }]\n];\nconst EyeOff = createLucideIcon(\"eye-off\", __iconNode);\n\nexport { __iconNode, EyeOff as default };\n//# sourceMappingURL=eye-off.js.map\n","/**\n * @license lucide-react v1.8.0 - ISC\n *\n * This source code is licensed under the ISC license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createLucideIcon from '../createLucideIcon.js';\n\nconst __iconNode = [\n  [\n    \"path\",\n    {\n      d: \"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0\",\n      key: \"1nclc0\"\n    }\n  ],\n  [\"circle\", { cx: \"12\", cy: \"12\", r: \"3\", key: \"1v7zrd\" }]\n];\nconst Eye = createLucideIcon(\"eye\", __iconNode);\n\nexport { __iconNode, Eye as default };\n//# sourceMappingURL=eye.js.map\n","'use client';\nimport { forwardRef, useId, useImperativeHandle, useRef, useState } from 'react';\nimport type { ChangeEvent, MouseEvent as ReactMouseEvent, ReactNode } from 'react';\nimport { Eye, EyeOff, X } from 'lucide-react';\nimport { withSx } from '../../utils/withSx';\nimport type { InputProps } from './Input.types';\n\nexport const Input = forwardRef<HTMLInputElement, InputProps>(function Input(\n  {\n    color = 'primary',\n    size,\n    prefix,\n    suffix,\n    clearable = false,\n    onClear,\n    showPasswordToggle = false,\n    showCount = false,\n    filled = false,\n    type = 'text',\n    disabled,\n    className,\n    style,\n    sx,\n    value,\n    defaultValue,\n    onChange,\n    maxLength,\n    ...rest\n  },\n  ref,\n) {\n  const countId = useId();\n  const isControlled = value !== undefined;\n  const [internal, setInternal] = useState<string>(\n    defaultValue != null ? String(defaultValue) : '',\n  );\n  const current = isControlled ? String(value ?? '') : internal;\n\n  const innerRef = useRef<HTMLInputElement | null>(null);\n  useImperativeHandle(ref, () => innerRef.current as HTMLInputElement, []);\n\n  const [visible, setVisible] = useState(false);\n  const effectiveType =\n    showPasswordToggle && visible && type === 'password' ? 'text' : type;\n\n  const showClear = clearable && !disabled && current !== '';\n  const hasAction = showClear || showPasswordToggle;\n  const hasAffixSlots = prefix != null || suffix != null || hasAction;\n\n  const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n    if (!isControlled) setInternal(event.target.value);\n    onChange?.(event);\n  };\n\n  const handleClear = (event: ReactMouseEvent<HTMLButtonElement>) => {\n    event.preventDefault();\n    if (!isControlled) setInternal('');\n    // Clearing must reach every consumer — React's synthetic onChange (which\n    // listens for native 'input' events at the root) and any external DOM\n    // listeners alike — so set the value through the native setter (bypassing\n    // React's value tracker, otherwise the dispatched event is ignored) and\n    // dispatch a real 'input' event.\n    const node = innerRef.current;\n    if (node) {\n      const setter = Object.getOwnPropertyDescriptor(\n        window.HTMLInputElement.prototype,\n        'value',\n      )?.set;\n      setter?.call(node, '');\n      node.dispatchEvent(new Event('input', { bubbles: true }));\n    }\n    onClear?.();\n  };\n\n  // When there are no affix slots the input is the outermost element, so sx lands\n  // on it. Otherwise sx lands on the affix wrapper (the outermost element) below.\n  const bare = withSx(\n    !hasAffixSlots ? sx : undefined,\n    !hasAffixSlots ? style : undefined,\n    'input',\n    color !== 'primary' && color,\n    size === 'sm' || size === 'lg' ? size : null,\n    filled && 'filled',\n    className,\n  );\n\n  const inputEl = (\n    <input\n      ref={innerRef}\n      type={effectiveType}\n      className={bare.className}\n      style={bare.style}\n      disabled={disabled}\n      value={isControlled ? value : undefined}\n      defaultValue={isControlled ? undefined : defaultValue}\n      onChange={handleChange}\n      maxLength={maxLength}\n      {...rest}\n      aria-describedby={\n        showCount\n          ? [rest['aria-describedby'], countId].filter(Boolean).join(' ')\n          : rest['aria-describedby']\n      }\n    />\n  );\n\n  const withCount = (node: ReactNode) =>\n    showCount ? (\n      <span className=\"cny-input-counted\">\n        {node}\n        <span id={countId} className=\"cny-input-count\">\n          {current.length}\n          {maxLength != null ? `/${maxLength}` : ''}\n        </span>\n      </span>\n    ) : (\n      node\n    );\n\n  if (!hasAffixSlots) {\n    return withCount(\n      <>\n        {bare.styleTag}\n        {inputEl}\n      </>,\n    );\n  }\n\n  const wrapper = withSx(\n    sx,\n    style,\n    'cny-input-affix',\n    prefix != null && 'has-prefix',\n    suffix != null && !hasAction && 'has-suffix',\n    hasAction && 'has-action',\n  );\n\n  return withCount(\n    <span className={wrapper.className} style={wrapper.style}>\n      {wrapper.styleTag}\n      {prefix != null && <span className=\"cny-input-prefix\">{prefix}</span>}\n      {inputEl}\n      {suffix != null && !hasAction && <span className=\"cny-input-suffix\">{suffix}</span>}\n      {showClear && (\n        <button\n          type=\"button\"\n          className=\"cny-input-action\"\n          onClick={handleClear}\n          aria-label=\"Clear\"\n          tabIndex={-1}\n        >\n          <X size={14} aria-hidden=\"true\" />\n        </button>\n      )}\n      {showPasswordToggle && type === 'password' && (\n        <button\n          type=\"button\"\n          className=\"cny-input-action\"\n          onClick={() => setVisible((v) => !v)}\n          aria-label={visible ? 'Hide password' : 'Show password'}\n          aria-pressed={visible}\n        >\n          {visible ? <EyeOff size={14} aria-hidden=\"true\" /> : <Eye size={14} aria-hidden=\"true\" />}\n        </button>\n      )}\n    </span>,\n  );\n});\n"],"names":["__iconNode","EyeOff","createLucideIcon","Eye","Input","forwardRef","color","size","prefix","suffix","clearable","onClear","showPasswordToggle","showCount","filled","type","disabled","className","style","sx","value","defaultValue","onChange","maxLength","rest","ref","countId","useId","isControlled","internal","setInternal","useState","current","innerRef","useRef","useImperativeHandle","visible","setVisible","effectiveType","showClear","hasAction","hasAffixSlots","handleChange","event","handleClear","node","setter","_a","bare","withSx","inputEl","jsx","withCount","jsxs","Fragment","wrapper","X","v"],"mappings":"gMAAA;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAMA,EAAa,CACjB,CACE,OACA,CACE,EAAG,iGACH,IAAK,QACX,CACA,EACE,CAAC,OAAQ,CAAE,EAAG,uCAAwC,IAAK,QAAQ,CAAE,EACrE,CACE,OACA,CACE,EAAG,+FACH,IAAK,QACX,CACA,EACE,CAAC,OAAQ,CAAE,EAAG,aAAc,IAAK,QAAQ,CAAE,CAC7C,EACMC,EAASC,EAAAA,iBAAiB,UAAWF,CAAU,EC3BrD;AAAA;AAAA;AAAA;AAAA;AAAA,GASA,MAAMA,EAAa,CACjB,CACE,OACA,CACE,EAAG,wGACH,IAAK,QACX,CACA,EACE,CAAC,SAAU,CAAE,GAAI,KAAM,GAAI,KAAM,EAAG,IAAK,IAAK,QAAQ,CAAE,CAC1D,EACMG,EAAMD,EAAAA,iBAAiB,MAAOF,CAAU,ECZjCI,EAAQC,EAAAA,WAAyC,SAC5D,CACE,MAAAC,EAAQ,UACR,KAAAC,EACA,OAAAC,EACA,OAAAC,EACA,UAAAC,EAAY,GACZ,QAAAC,EACA,mBAAAC,EAAqB,GACrB,UAAAC,EAAY,GACZ,OAAAC,EAAS,GACT,KAAAC,EAAO,OACP,SAAAC,EACA,UAAAC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