"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { DOMEventNames: () => DOMEventNames, DOMPropNames: () => DOMPropNames, filterDOMProps: () => filterDOMProps, getValidChildren: () => getValidChildren, pickChildren: () => pickChildren, renderFn: () => renderFn }); module.exports = __toCommonJS(src_exports); // src/children.ts var import_react = require("react"); function getValidChildren(children) { return import_react.Children.toArray(children).filter( (child) => (0, import_react.isValidElement)(child) ); } var pickChildren = (children, targetChild) => { var _a; let target = []; const withoutTargetChildren = (_a = import_react.Children.map(children, (item) => { if (!(0, import_react.isValidElement)(item)) return item; if (item.type === targetChild) { target.push(item); return null; } return item; })) == null ? void 0 : _a.filter(Boolean); const targetChildren = target.length >= 0 ? target : void 0; return [withoutTargetChildren, targetChildren]; }; // src/dom-props.ts var DOMPropNames = /* @__PURE__ */ new Set([ "id", "type", "style", "title", "role", "tabIndex", "htmlFor", "width", "height", "abbr", "accept", "acceptCharset", "accessKey", "action", "allowFullScreen", "allowTransparency", "alt", "async", "autoComplete", "autoFocus", "autoPlay", "cellPadding", "cellSpacing", "challenge", "charset", "checked", "cite", "class", "className", "cols", "colSpan", "command", "content", "contentEditable", "contextMenu", "controls", "coords", "crossOrigin", "data", "dateTime", "default", "defer", "dir", "disabled", "download", "draggable", "dropzone", "encType", "enterKeyHint", "for", "form", "formAction", "formEncType", "formMethod", "formNoValidate", "formTarget", "frameBorder", "headers", "hidden", "high", "href", "hrefLang", "httpEquiv", "icon", "inputMode", "isMap", "itemId", "itemProp", "itemRef", "itemScope", "itemType", "kind", "label", "lang", "list", "loop", "manifest", "max", "maxLength", "media", "mediaGroup", "method", "min", "minLength", "multiple", "muted", "name", "noValidate", "open", "optimum", "pattern", "ping", "placeholder", "poster", "preload", "radioGroup", "referrerPolicy", "readOnly", "rel", "required", "rows", "rowSpan", "sandbox", "scope", "scoped", "scrolling", "seamless", "selected", "shape", "size", "sizes", "slot", "sortable", "span", "spellCheck", "src", "srcDoc", "srcSet", "start", "step", "target", "translate", "typeMustMatch", "useMap", "value", "wmode", "wrap" ]); var DOMEventNames = /* @__PURE__ */ new Set([ "onCopy", "onCut", "onPaste", "onLoad", "onError", "onWheel", "onScroll", "onCompositionEnd", "onCompositionStart", "onCompositionUpdate", "onKeyDown", "onKeyPress", "onKeyUp", "onFocus", "onBlur", "onChange", "onInput", "onSubmit", "onClick", "onContextMenu", "onDoubleClick", "onDrag", "onDragEnd", "onDragEnter", "onDragExit", "onDragLeave", "onDragOver", "onDragStart", "onDrop", "onMouseDown", "onMouseEnter", "onMouseLeave", "onMouseMove", "onMouseOut", "onMouseOver", "onMouseUp", "onPointerDown", "onPointerEnter", "onPointerLeave", "onPointerUp", "onSelect", "onTouchCancel", "onTouchEnd", "onTouchMove", "onTouchStart", "onAnimationStart", "onAnimationEnd", "onAnimationIteration", "onTransitionEnd" ]); // src/filter-dom-props.ts var propRe = /^(data-.*)$/; var ariaRe = /^(aria-.*)$/; var funcRe = /^(on[A-Z].*)$/; function filterDOMProps(props, opts = {}) { let { labelable = true, enabled = true, propNames, omitPropNames, omitEventNames, omitDataProps, omitEventProps } = opts; let filteredProps = {}; if (!enabled) { return props; } for (const prop in props) { if (omitPropNames == null ? void 0 : omitPropNames.has(prop)) { continue; } if ((omitEventNames == null ? void 0 : omitEventNames.has(prop)) && funcRe.test(prop)) { continue; } if (funcRe.test(prop) && !DOMEventNames.has(prop)) { continue; } if (omitDataProps && propRe.test(prop)) { continue; } if (omitEventProps && funcRe.test(prop)) { continue; } if (Object.prototype.hasOwnProperty.call(props, prop) && (DOMPropNames.has(prop) || labelable && ariaRe.test(prop) || (propNames == null ? void 0 : propNames.has(prop)) || propRe.test(prop)) || funcRe.test(prop)) { filteredProps[prop] = props[prop]; } } return filteredProps; } // src/functions.ts var React = __toESM(require("react")); function renderFn({ Component, props, renderCustom }) { if (renderCustom && typeof renderCustom === "function") { return renderCustom(props); } else { return React.createElement(Component, props); } } // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { DOMEventNames, DOMPropNames, filterDOMProps, getValidChildren, pickChildren, renderFn });