import { createComponent, render, spreadAttributes, unescapeHTML } from "../runtime/server/index.js"; function createSvgComponent({ meta, attributes, children }) { const Component = createComponent((_, props) => { const normalizedProps = normalizeProps(attributes, props); return render`${unescapeHTML(children)}`; }); if (import.meta.env.DEV) { makeNonEnumerable(Component); Object.defineProperty(Component, Symbol.for("nodejs.util.inspect.custom"), { value: (_, opts, inspect) => inspect(meta, opts) }); } Object.defineProperty(Component, "toJSON", { value: () => meta, enumerable: false }); return Object.assign(Component, meta); } const ATTRS_TO_DROP = ["xmlns", "xmlns:xlink", "version"]; const DEFAULT_ATTRS = {}; function dropAttributes(attributes) { for (const attr of ATTRS_TO_DROP) { delete attributes[attr]; } return attributes; } function normalizeProps(attributes, props) { return dropAttributes({ ...DEFAULT_ATTRS, ...attributes, ...props }); } function makeNonEnumerable(object) { for (const property in object) { Object.defineProperty(object, property, { enumerable: false }); } } export { createSvgComponent, dropAttributes };