{"version":3,"file":"jsxRuntime.mjs","sources":["../src/index.js"],"sourcesContent":["import { options, Fragment } from 'preact';\n\n/** @typedef {import('preact').VNode} VNode */\n\nlet vnodeId = 0;\n\n/**\n * @fileoverview\n * This file exports various methods that implement Babel's \"automatic\" JSX runtime API:\n * - jsx(type, props, key)\n * - jsxs(type, props, key)\n * - jsxDEV(type, props, key, __source, __self)\n *\n * The implementation of createVNode here is optimized for performance.\n * Benchmarks: https://esbench.com/bench/5f6b54a0b4632100a7dcd2b3\n */\n\n/**\n * JSX.Element factory used by Babel's {runtime:\"automatic\"} JSX transform\n * @param {VNode['type']} type\n * @param {VNode['props']} props\n * @param {VNode['key']} [key]\n * @param {string} [__source]\n * @param {string} [__self]\n */\nfunction createVNode(type, props, key, __source, __self) {\n\t// We'll want to preserve `ref` in props to get rid of the need for\n\t// forwardRef components in the future, but that should happen via\n\t// a separate PR.\n\tlet normalizedProps = {};\n\tfor (let i in props) {\n\t\tif (i != 'ref') {\n\t\t\tnormalizedProps[i] = props[i];\n\t\t}\n\t}\n\n\tconst vnode = {\n\t\ttype,\n\t\tprops: normalizedProps,\n\t\tkey,\n\t\tref: props && props.ref,\n\t\tconstructor: undefined,\n\t\t_vnodeId: --vnodeId,\n\t\t__source,\n\t\t__self\n\t};\n\n\t// If a Component VNode, check for and apply defaultProps.\n\t// Note: `type` is often a String, and can be `undefined` in development.\n\tlet defaults, i;\n\tif (typeof type === 'function' && (defaults = type.defaultProps)) {\n\t\tfor (i in defaults)\n\t\t\tif (normalizedProps[i] === undefined) {\n\t\t\t\tnormalizedProps[i] = defaults[i];\n\t\t\t}\n\t}\n\n\tif (options.vnode) options.vnode(vnode);\n\treturn vnode;\n}\n\nexport {\n\tcreateVNode as jsx,\n\tcreateVNode as jsxs,\n\tcreateVNode as jsxDEV,\n\tFragment\n};\n"],"names":["vnodeId","createVNode","type","props","key","__source","__self","normalizedProps","i","vnode","ref","constructor","undefined","__v","defaults","defaultProps","options"],"mappings":"8DAIA,IAAIA,EAAU,EAqBd,SAASC,EAAYC,EAAMC,EAAOC,EAAKC,EAAUC,GAIhD,IAAIC,EAAkB,GACtB,IAAK,IAAIC,KAAKL,EACJ,OAALK,IACHD,EAAgBC,GAAKL,EAAMK,IAI7B,MAAMC,EAAQ,CACbP,KAAAA,EACAC,MAAOI,EACPH,IAAAA,EACAM,IAAKP,GAASA,EAAMO,IACpBC,iBAAaC,EACbC,MAAYb,EACZK,SAAAA,EACAC,OAAAA,GAKD,IAAIQ,EAAUN,EACd,GAAoB,mBAATN,IAAwBY,EAAWZ,EAAKa,cAClD,IAAKP,KAAKM,OACkBF,IAAvBL,EAAgBC,KACnBD,EAAgBC,GAAKM,EAASN,IAKjC,OADIQ,EAAQP,OAAOO,EAAQP,MAAMA,GAC1BA"}