function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } import * as React from 'react'; import Icon from "./Icon"; const customCache = new Set(); function isValidCustomScriptUrl(scriptUrl) { return Boolean(typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl)); } function createScriptUrlElements(scriptUrls, index = 0) { const currentScriptUrl = scriptUrls[index]; if (isValidCustomScriptUrl(currentScriptUrl)) { const script = document.createElement('script'); script.setAttribute('src', currentScriptUrl); script.setAttribute('data-namespace', currentScriptUrl); if (scriptUrls.length > index + 1) { script.onload = () => { createScriptUrlElements(scriptUrls, index + 1); }; script.onerror = () => { createScriptUrlElements(scriptUrls, index + 1); }; } customCache.add(currentScriptUrl); document.body.appendChild(script); } } export default function create(options = {}) { const { scriptUrl, extraCommonProps = {} } = options; /** * DOM API required. * Make sure in browser environment. * The Custom Icon will create a