{"version":3,"sources":["../src/lib/jsx-dev-runtime.ts","../src/lib/jsx-runtime.ts"],"sourcesContent":["import {Fragment, jsx} from './jsx-runtime';\nexport {Fragment, jsx as jsxDEV};\n","import type {\n  ComponentChildren,\n  FunctionComponent,\n  JSXProps,\n  Node,\n  NodeConstructor,\n} from './components';\n\nexport namespace JSX {\n  export type Element = Node;\n  export type ElementClass = Node;\n  export interface ElementChildrenAttribute {\n    children: any;\n  }\n}\n\nfunction isClassComponent(\n  // eslint-disable-next-line @typescript-eslint/ban-types\n  fn: Function,\n): fn is new (...args: unknown[]) => unknown {\n  return !!fn.prototype?.isClass;\n}\n\nexport const Fragment: FunctionComponent = ({children}) => children;\n\nexport function jsx(\n  type: NodeConstructor | FunctionComponent | typeof Fragment,\n  config: JSXProps,\n  key?: any,\n): ComponentChildren {\n  const {ref, children, ...rest} = config;\n  const flatChildren = Array.isArray(children) ? children.flat() : children;\n\n  if (type === Fragment) {\n    return flatChildren;\n  }\n\n  if (isClassComponent(type)) {\n    const node = new type({...rest, children: flatChildren, key});\n    ref?.(node);\n    return node;\n  } else {\n    return type({...rest, ref, children: flatChildren, key});\n  }\n}\nexport {jsx as jsxs};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgBA,SAAS,iBAEP,IAC2C;AAC3C,SAAO,CAAC,CAAC,GAAG,WAAW;AACzB;AAEO,IAAM,WAA8B,CAAC,EAAC,SAAQ,MAAM;AAEpD,SAAS,IACd,MACA,QACA,KACmB;AACnB,QAAM,EAAC,KAAK,UAAU,GAAG,KAAI,IAAI;AACjC,QAAM,eAAe,MAAM,QAAQ,QAAQ,IAAI,SAAS,KAAK,IAAI;AAEjE,MAAI,SAAS,UAAU;AACrB,WAAO;AAAA,EACT;AAEA,MAAI,iBAAiB,IAAI,GAAG;AAC1B,UAAM,OAAO,IAAI,KAAK,EAAC,GAAG,MAAM,UAAU,cAAc,IAAG,CAAC;AAC5D,UAAM,IAAI;AACV,WAAO;AAAA,EACT,OAAO;AACL,WAAO,KAAK,EAAC,GAAG,MAAM,KAAK,UAAU,cAAc,IAAG,CAAC;AAAA,EACzD;AACF;","names":[]}