PromoCursed/node_modules/.cache/babel-loader/b9c4e2eaa65d5d018c7f59ca7a868b91464dfd8291d02e34a24f26bc7358358d.json
2024-08-20 23:25:37 +04:00

1 line
17 KiB
JSON

{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport canUseDom from \"./canUseDom\";\nimport contains from \"./contains\";\nvar APPEND_ORDER = 'data-rc-order';\nvar APPEND_PRIORITY = 'data-rc-priority';\nvar MARK_KEY = \"rc-util-key\";\nvar containerCache = new Map();\nfunction getMark() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n mark = _ref.mark;\n if (mark) {\n return mark.startsWith('data-') ? mark : \"data-\".concat(mark);\n }\n return MARK_KEY;\n}\nfunction getContainer(option) {\n if (option.attachTo) {\n return option.attachTo;\n }\n var head = document.querySelector('head');\n return head || document.body;\n}\nfunction getOrder(prepend) {\n if (prepend === 'queue') {\n return 'prependQueue';\n }\n return prepend ? 'prepend' : 'append';\n}\n\n/**\n * Find style which inject by rc-util\n */\nfunction findStyles(container) {\n return Array.from((containerCache.get(container) || container).children).filter(function (node) {\n return node.tagName === 'STYLE';\n });\n}\nexport function injectCSS(css) {\n var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!canUseDom()) {\n return null;\n }\n var csp = option.csp,\n prepend = option.prepend,\n _option$priority = option.priority,\n priority = _option$priority === void 0 ? 0 : _option$priority;\n var mergedOrder = getOrder(prepend);\n var isPrependQueue = mergedOrder === 'prependQueue';\n var styleNode = document.createElement('style');\n styleNode.setAttribute(APPEND_ORDER, mergedOrder);\n if (isPrependQueue && priority) {\n styleNode.setAttribute(APPEND_PRIORITY, \"\".concat(priority));\n }\n if (csp !== null && csp !== void 0 && csp.nonce) {\n styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;\n }\n styleNode.innerHTML = css;\n var container = getContainer(option);\n var firstChild = container.firstChild;\n if (prepend) {\n // If is queue `prepend`, it will prepend first style and then append rest style\n if (isPrependQueue) {\n var existStyle = (option.styles || findStyles(container)).filter(function (node) {\n // Ignore style which not injected by rc-util with prepend\n if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {\n return false;\n }\n\n // Ignore style which priority less then new style\n var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);\n return priority >= nodePriority;\n });\n if (existStyle.length) {\n container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);\n return styleNode;\n }\n }\n\n // Use `insertBefore` as `prepend`\n container.insertBefore(styleNode, firstChild);\n } else {\n container.appendChild(styleNode);\n }\n return styleNode;\n}\nfunction findExistNode(key) {\n var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var container = getContainer(option);\n return (option.styles || findStyles(container)).find(function (node) {\n return node.getAttribute(getMark(option)) === key;\n });\n}\nexport function removeCSS(key) {\n var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var existNode = findExistNode(key, option);\n if (existNode) {\n var container = getContainer(option);\n container.removeChild(existNode);\n }\n}\n\n/**\n * qiankun will inject `appendChild` to insert into other\n */\nfunction syncRealContainer(container, option) {\n var cachedRealContainer = containerCache.get(container);\n\n // Find real container when not cached or cached container removed\n if (!cachedRealContainer || !contains(document, cachedRealContainer)) {\n var placeholderStyle = injectCSS('', option);\n var parentNode = placeholderStyle.parentNode;\n containerCache.set(container, parentNode);\n container.removeChild(placeholderStyle);\n }\n}\n\n/**\n * manually clear container cache to avoid global cache in unit testes\n */\nexport function clearContainerCache() {\n containerCache.clear();\n}\nexport function updateCSS(css, key) {\n var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var container = getContainer(originOption);\n var styles = findStyles(container);\n var option = _objectSpread(_objectSpread({}, originOption), {}, {\n styles: styles\n });\n\n // Sync real parent\n syncRealContainer(container, option);\n var existNode = findExistNode(key, option);\n if (existNode) {\n var _option$csp, _option$csp2;\n if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {\n var _option$csp3;\n existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;\n }\n if (existNode.innerHTML !== css) {\n existNode.innerHTML = css;\n }\n return existNode;\n }\n var newNode = injectCSS(css, option);\n newNode.setAttribute(getMark(option), key);\n return newNode;\n}","map":{"version":3,"names":["_objectSpread","canUseDom","contains","APPEND_ORDER","APPEND_PRIORITY","MARK_KEY","containerCache","Map","getMark","_ref","arguments","length","undefined","mark","startsWith","concat","getContainer","option","attachTo","head","document","querySelector","body","getOrder","prepend","findStyles","container","Array","from","get","children","filter","node","tagName","injectCSS","css","csp","_option$priority","priority","mergedOrder","isPrependQueue","styleNode","createElement","setAttribute","nonce","innerHTML","firstChild","existStyle","styles","includes","getAttribute","nodePriority","Number","insertBefore","nextSibling","appendChild","findExistNode","key","find","removeCSS","existNode","removeChild","syncRealContainer","cachedRealContainer","placeholderStyle","parentNode","set","clearContainerCache","clear","updateCSS","originOption","_option$csp","_option$csp2","_option$csp3","newNode"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-util/es/Dom/dynamicCSS.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport canUseDom from \"./canUseDom\";\nimport contains from \"./contains\";\nvar APPEND_ORDER = 'data-rc-order';\nvar APPEND_PRIORITY = 'data-rc-priority';\nvar MARK_KEY = \"rc-util-key\";\nvar containerCache = new Map();\nfunction getMark() {\n var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},\n mark = _ref.mark;\n if (mark) {\n return mark.startsWith('data-') ? mark : \"data-\".concat(mark);\n }\n return MARK_KEY;\n}\nfunction getContainer(option) {\n if (option.attachTo) {\n return option.attachTo;\n }\n var head = document.querySelector('head');\n return head || document.body;\n}\nfunction getOrder(prepend) {\n if (prepend === 'queue') {\n return 'prependQueue';\n }\n return prepend ? 'prepend' : 'append';\n}\n\n/**\n * Find style which inject by rc-util\n */\nfunction findStyles(container) {\n return Array.from((containerCache.get(container) || container).children).filter(function (node) {\n return node.tagName === 'STYLE';\n });\n}\nexport function injectCSS(css) {\n var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!canUseDom()) {\n return null;\n }\n var csp = option.csp,\n prepend = option.prepend,\n _option$priority = option.priority,\n priority = _option$priority === void 0 ? 0 : _option$priority;\n var mergedOrder = getOrder(prepend);\n var isPrependQueue = mergedOrder === 'prependQueue';\n var styleNode = document.createElement('style');\n styleNode.setAttribute(APPEND_ORDER, mergedOrder);\n if (isPrependQueue && priority) {\n styleNode.setAttribute(APPEND_PRIORITY, \"\".concat(priority));\n }\n if (csp !== null && csp !== void 0 && csp.nonce) {\n styleNode.nonce = csp === null || csp === void 0 ? void 0 : csp.nonce;\n }\n styleNode.innerHTML = css;\n var container = getContainer(option);\n var firstChild = container.firstChild;\n if (prepend) {\n // If is queue `prepend`, it will prepend first style and then append rest style\n if (isPrependQueue) {\n var existStyle = (option.styles || findStyles(container)).filter(function (node) {\n // Ignore style which not injected by rc-util with prepend\n if (!['prepend', 'prependQueue'].includes(node.getAttribute(APPEND_ORDER))) {\n return false;\n }\n\n // Ignore style which priority less then new style\n var nodePriority = Number(node.getAttribute(APPEND_PRIORITY) || 0);\n return priority >= nodePriority;\n });\n if (existStyle.length) {\n container.insertBefore(styleNode, existStyle[existStyle.length - 1].nextSibling);\n return styleNode;\n }\n }\n\n // Use `insertBefore` as `prepend`\n container.insertBefore(styleNode, firstChild);\n } else {\n container.appendChild(styleNode);\n }\n return styleNode;\n}\nfunction findExistNode(key) {\n var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var container = getContainer(option);\n return (option.styles || findStyles(container)).find(function (node) {\n return node.getAttribute(getMark(option)) === key;\n });\n}\nexport function removeCSS(key) {\n var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var existNode = findExistNode(key, option);\n if (existNode) {\n var container = getContainer(option);\n container.removeChild(existNode);\n }\n}\n\n/**\n * qiankun will inject `appendChild` to insert into other\n */\nfunction syncRealContainer(container, option) {\n var cachedRealContainer = containerCache.get(container);\n\n // Find real container when not cached or cached container removed\n if (!cachedRealContainer || !contains(document, cachedRealContainer)) {\n var placeholderStyle = injectCSS('', option);\n var parentNode = placeholderStyle.parentNode;\n containerCache.set(container, parentNode);\n container.removeChild(placeholderStyle);\n }\n}\n\n/**\n * manually clear container cache to avoid global cache in unit testes\n */\nexport function clearContainerCache() {\n containerCache.clear();\n}\nexport function updateCSS(css, key) {\n var originOption = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var container = getContainer(originOption);\n var styles = findStyles(container);\n var option = _objectSpread(_objectSpread({}, originOption), {}, {\n styles: styles\n });\n\n // Sync real parent\n syncRealContainer(container, option);\n var existNode = findExistNode(key, option);\n if (existNode) {\n var _option$csp, _option$csp2;\n if ((_option$csp = option.csp) !== null && _option$csp !== void 0 && _option$csp.nonce && existNode.nonce !== ((_option$csp2 = option.csp) === null || _option$csp2 === void 0 ? void 0 : _option$csp2.nonce)) {\n var _option$csp3;\n existNode.nonce = (_option$csp3 = option.csp) === null || _option$csp3 === void 0 ? void 0 : _option$csp3.nonce;\n }\n if (existNode.innerHTML !== css) {\n existNode.innerHTML = css;\n }\n return existNode;\n }\n var newNode = injectCSS(css, option);\n newNode.setAttribute(getMark(option), key);\n return newNode;\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,QAAQ,MAAM,YAAY;AACjC,IAAIC,YAAY,GAAG,eAAe;AAClC,IAAIC,eAAe,GAAG,kBAAkB;AACxC,IAAIC,QAAQ,GAAG,aAAa;AAC5B,IAAIC,cAAc,GAAG,IAAIC,GAAG,CAAC,CAAC;AAC9B,SAASC,OAAOA,CAAA,EAAG;EACjB,IAAIC,IAAI,GAAGC,SA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