{"version":3,"file":"create-element.mjs","sources":["../../../src/govuk/common/create-element.mjs"],"sourcesContent":["/**\n * Creates an element with the given attributes and child elements\n *\n * @internal\n * @template {keyof HTMLElementTagNameMap} TagName\n * @param {TagName} tagName - Type of element to create\n * @param {{[key: string]: string}} [attributes] - Attributes to set on the element\n * @param {Array<HTMLElement | string>} [children] - An optional list of children or text to append to the element\n * @returns {HTMLElementTagNameMap[TagName]} Created element\n */\nexport function createElement(tagName, attributes = {}, children = []) {\n  const $element = document.createElement(tagName)\n\n  Object.entries(attributes).forEach(([name, value]) => {\n    $element.setAttribute(name, value)\n  })\n\n  for (const child of children) {\n    $element.append(child)\n  }\n\n  return $element\n}\n"],"names":["createElement","tagName","attributes","children","$element","document","Object","entries","forEach","name","value","setAttribute","child","append"],"mappings":"AAUO,SAASA,aAAaA,CAACC,OAAO,EAAEC,UAAU,GAAG,EAAE,EAAEC,QAAQ,GAAG,EAAE,EAAE;AACrE,EAAA,MAAMC,QAAQ,GAAGC,QAAQ,CAACL,aAAa,CAACC,OAAO,CAAC;AAEhDK,EAAAA,MAAM,CAACC,OAAO,CAACL,UAAU,CAAC,CAACM,OAAO,CAAC,CAAC,CAACC,IAAI,EAAEC,KAAK,CAAC,KAAK;AACpDN,IAAAA,QAAQ,CAACO,YAAY,CAACF,IAAI,EAAEC,KAAK,CAAC;AACpC,EAAA,CAAC,CAAC;AAEF,EAAA,KAAK,MAAME,KAAK,IAAIT,QAAQ,EAAE;AAC5BC,IAAAA,QAAQ,CAACS,MAAM,CAACD,KAAK,CAAC;AACxB,EAAA;AAEA,EAAA,OAAOR,QAAQ;AACjB;;"}