{"version":3,"file":"insert-css-0762b083.js","sources":["../../node_modules/insert-css/index.js"],"sourcesContent":["var containers = []; // will store container HTMLElement references\nvar styleElements = []; // will store {prepend: HTMLElement, append: HTMLElement}\n\nvar usage = 'insert-css: You need to provide a CSS string. Usage: insertCss(cssString[, options]).';\n\nfunction insertCss(css, options) {\n options = options || {};\n\n if (css === undefined) {\n throw new Error(usage);\n }\n\n var position = options.prepend === true ? 'prepend' : 'append';\n var container = options.container !== undefined ? options.container : document.querySelector('head');\n var containerId = containers.indexOf(container);\n\n // first time we see this container, create the necessary entries\n if (containerId === -1) {\n containerId = containers.push(container) - 1;\n styleElements[containerId] = {};\n }\n\n // try to get the correponding container + position styleElement, create it otherwise\n var styleElement;\n\n if (styleElements[containerId] !== undefined && styleElements[containerId][position] !== undefined) {\n styleElement = styleElements[containerId][position];\n } else {\n styleElement = styleElements[containerId][position] = createStyleElement();\n\n if (position === 'prepend') {\n container.insertBefore(styleElement, container.childNodes[0]);\n } else {\n container.appendChild(styleElement);\n }\n }\n\n // strip potential UTF-8 BOM if css was read from a file\n if (css.charCodeAt(0) === 0xFEFF) { css = css.substr(1, css.length); }\n\n // actually add the stylesheet\n if (styleElement.styleSheet) {\n styleElement.styleSheet.cssText += css\n } else {\n styleElement.textContent += css;\n }\n\n return styleElement;\n};\n\nfunction createStyleElement() {\n var styleElement = document.createElement('style');\n styleElement.setAttribute('type', 'text/css');\n return styleElement;\n}\n\nmodule.exports = insertCss;\nmodule.exports.insertCss = insertCss;\n"],"names":["containers","styleElements","usage","insertCss","css","options","position","container","containerId","styleElement","createStyleElement","insertCssModule"],"mappings":"4DAAA,IAAIA,EAAa,CAAA,EACbC,EAAgB,CAAA,EAEhBC,EAAQ,wFAEZ,SAASC,EAAUC,EAAKC,EAAS,CAG7B,GAFAA,EAAUA,GAAW,GAEjBD,IAAQ,OACR,MAAM,IAAI,MAAMF,CAAK,EAGzB,IAAII,EAAWD,EAAQ,UAAY,GAAO,UAAY,SAClDE,EAAYF,EAAQ,YAAc,OAAYA,EAAQ,UAAY,SAAS,cAAc,MAAM,EAC/FG,EAAcR,EAAW,QAAQO,CAAS,EAG1CC,IAAgB,KAChBA,EAAcR,EAAW,KAAKO,CAAS,EAAI,EAC3CN,EAAcO,CAAW,EAAI,IAIjC,IAAIC,EAEJ,OAAIR,EAAcO,CAAW,IAAM,QAAaP,EAAcO,CAAW,EAAEF,CAAQ,IAAM,OACrFG,EAAeR,EAAcO,CAAW,EAAEF,CAAQ,GAElDG,EAAeR,EAAcO,CAAW,EAAEF,CAAQ,EAAII,EAAkB,EAEpEJ,IAAa,UACbC,EAAU,aAAaE,EAAcF,EAAU,WAAW,CAAC,CAAC,EAE5DA,EAAU,YAAYE,CAAY,GAKtCL,EAAI,WAAW,CAAC,IAAM,QAAUA,EAAMA,EAAI,OAAO,EAAGA,EAAI,MAAM,GAG9DK,EAAa,WACbA,EAAa,WAAW,SAAWL,EAEnCK,EAAa,aAAeL,EAGzBK,CAEX,CACA,SAASC,GAAqB,CAC1B,IAAID,EAAe,SAAS,cAAc,OAAO,EACjD,OAAAA,EAAa,aAAa,OAAQ,UAAU,EACrCA,CACV,CAEaE,OAAAA,EAAA,QAAGR,EACjBQ,EAAA,QAAA,UAA2BR","x_google_ignoreList":[0]}