/**
 * @license lucide-preact v1.22.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */

import { h, toChildArray } from 'preact';
import defaultAttributes from './defaultAttributes.mjs';
import { useLucideContext } from './context.mjs';
import { hasA11yProp } from './shared/src/utils/hasA11yProp.mjs';
import { mergeClasses } from './shared/src/utils/mergeClasses.mjs';

const Icon = ({
  color,
  size,
  strokeWidth,
  absoluteStrokeWidth,
  children,
  iconNode,
  class: classes = "",
  ...rest
}) => {
  const {
    size: contextSize = 24,
    strokeWidth: contextStrokeWidth = 2,
    absoluteStrokeWidth: contextAbsoluteStrokeWidth = false,
    color: contextColor = "currentColor",
    class: contextClass = ""
  } = useLucideContext() ?? {};
  const calculatedStrokeWidth = absoluteStrokeWidth ?? contextAbsoluteStrokeWidth ? Number(strokeWidth ?? contextStrokeWidth) * 24 / Number(size ?? contextSize) : strokeWidth ?? contextStrokeWidth;
  return h(
    "svg",
    {
      ...defaultAttributes,
      width: size ?? contextSize ?? 24,
      height: size ?? contextSize ?? 24,
      stroke: color ?? contextColor,
      ["stroke-width"]: calculatedStrokeWidth,
      class: mergeClasses("lucide", contextClass, classes),
      ...!children && !hasA11yProp(rest) && { "aria-hidden": "true" },
      ...rest
    },
    [...iconNode.map(([tag, attrs]) => h(tag, attrs)), ...toChildArray(children)]
  );
};

export { Icon as default };
//# sourceMappingURL=Icon.mjs.map
