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AAO,CACH,CACI,KAAM,qCACN,SAAA,CAAU,EAAQ,GACd,GAAK,GAGD,EAAe,KAAK,IAAW,EAAS,KAAK,GAAW,CACxD,GAAI,GAAuB,EAAe,KAAK,GAC3C,OAEJ,MAAM,EAAe,aAAa,GAElC,OADY,EAAI,OAAO,UAAS,EAAI,OAAO,SAAS,GAAW,GAAG,WAAgB,IAEtF,CACJ,EACA,QAAS,OAEb,CACI,KAAM,sCACN,SAAA,CAAU,EAAM,GACZ,GAAK,EAAO,KAAO,EAAG,SAAS,gBAG/B,GAAI,EAAS,KAAK,GAAK,CACnB,MAAM,EAAW,KAAK,MAAM,GACtB,GAAU,EAAI,6BAA6B,4BAA4B,GAS7E,KARsB,GAAS,MAAM,GAC7B,EACO,EAAe,KAAK,KAAW,EAAe,KAAK,GAGnD,EAAe,KAAK,KAGlB,CACb,MAAM,EAAe,aAAa,GAC5B,EAAa,EACb,QAAQ,KAAc,IACtB,QAAQ,IACR,GAAS,EAAI,cAAc,+BAA+B,EAAU,GAE1E,OADgB,EAAI,YAAY,UAAU,EAE9C,CACJ,MAEI,GAAI,EAAe,KAAK,oBAAoB,IAAM,CAC9C,GAAI,GAAuB,EAAe,KAAK,GAC3C,OAEJ,MAAM,EAAe,gBAAgB,GAC/B,EAAa,EAAQ,WACrB,QAAQ,EAAQ,cAAc,IAC9B,QAAQ,IACd,OAAO,EAAI,YAAY,UAAU,EAAM,oBAAoB,GAAK,EACpE,CAER,GAGZ","file":"/npm/rollup-plugin-react-scoped-css@1.2.1/dist/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/rollup-plugin-react-scoped-css@1.2.1/dist/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.reactScopedCssPlugin = reactScopedCssPlugin;\nconst path_1 = require(\"path\");\nconst js_xxhash_1 = require(\"js-xxhash\");\nconst pluginutils_1 = require(\"@rollup/pluginutils\");\nconst escodegen_1 = require(\"escodegen\");\nconst ast_program_1 = require(\"./ast-program\");\nconst scope_css_1 = require(\"./css/scope-css\");\nconst getImportDeclarationsValue_1 = require(\"./utils/getImportDeclarationsValue\");\nconst getFilenameFromPath = (filePath) => {\n    const parts = filePath.split(\"/\");\n    return parts[parts.length - 1].split(\"?\")[0];\n};\nconst getHashFromPath = (filePath) => {\n    const search = \"?scope=\";\n    const hash = filePath.slice(filePath.indexOf(search) + search.length);\n    return hash;\n};\nconst generateHash = (input, seed = 0) => {\n    const hashNum = (0, js_xxhash_1.xxHash32)(Buffer.from(input, \"utf8\"), seed);\n    return hashNum.toString(16);\n};\nfunction reactScopedCssPlugin(optionsIn = {}) {\n    const options = {\n        scopeStyleByDefault: false,\n        scopedStyleSuffix: \"scoped\",\n        globalStyleSuffix: \"global\",\n        styleFileExtensions: [\"css\", \"scss\", \"sass\", \"less\"],\n        jsxFileExtensions: [\"jsx\", \"tsx\"],\n        ...optionsIn,\n    };\n    const { exclude, globalStyleSuffix, hashPrefix, jsxFileExtensions, include, scopeStyleByDefault, scopedStyleSuffix, styleFileExtensions, } = options;\n    if (!styleFileExtensions || !styleFileExtensions.length) {\n        throw new Error(\"You need to provide at least one style file extension\");\n    }\n    if (!jsxFileExtensions || !jsxFileExtensions.length) {\n        throw new Error(\"You need to provide at least one jsx file extension\");\n    }\n    const filter = (0, pluginutils_1.createFilter)(include, exclude);\n    const scopedCssRegex = new RegExp(!scopeStyleByDefault\n        ? `([^\\.]+\\.${scopedStyleSuffix}\\.(${styleFileExtensions.join(\"|\")}))$`\n        : `([^\\.]+\\.(${styleFileExtensions.join(\"|\")}))$`);\n    const globalCssRegex = new RegExp(`\\.${globalStyleSuffix}\\.(${styleFileExtensions.join(\"|\")})$`);\n    const jsxRegex = new RegExp(`\\.(${jsxFileExtensions.join(\"|\")})$`);\n    return [\n        {\n            name: \"rollup-plugin-react-scoped-css:pre\",\n            resolveId(source, importer) {\n                if (!importer) {\n                    return;\n                }\n                if (scopedCssRegex.test(source) && jsxRegex.test(importer)) {\n                    if (scopeStyleByDefault && globalCssRegex.test(source)) {\n                        return;\n                    }\n                    const importerHash = generateHash(importer);\n                    const url = (0, path_1.resolve)((0, path_1.dirname)(importer), `${source}?scope=${importerHash}`);\n                    return url;\n                }\n            },\n            enforce: \"pre\",\n        },\n        {\n            name: \"rollup-plugin-react-scoped-css:post\",\n            transform(code, id) {\n                if (!filter(id) || id.includes(\"node_modules\")) {\n                    return;\n                }\n                if (jsxRegex.test(id)) {\n                    const rootNode = this.parse(code);\n                    const imports = (0, getImportDeclarationsValue_1.getImportDeclarationsValue)(rootNode);\n                    const shouldScope = !!imports?.some((match) => {\n                        if (scopeStyleByDefault) {\n                            return scopedCssRegex.test(match) && !globalCssRegex.test(match);\n                        }\n                        else {\n                            return scopedCssRegex.test(match);\n                        }\n                    });\n                    if (shouldScope) {\n                        const importerHash = generateHash(id);\n                        const scopedAttr = hashPrefix\n                            ? `data-${hashPrefix}-${importerHash}`\n                            : `data-${importerHash}`;\n                        const newAst = (0, ast_program_1.addHashAttributesToJsxTagsAst)(rootNode, scopedAttr);\n                        const newCode = (0, escodegen_1.generate)(newAst);\n                        return newCode;\n                    }\n                }\n                else {\n                    if (scopedCssRegex.test(getFilenameFromPath(id))) {\n                        if (scopeStyleByDefault && globalCssRegex.test(id)) {\n                            return;\n                        }\n                        const importerHash = getHashFromPath(id);\n                        const scopedAttr = options.hashPrefix\n                            ? `data-${options.hashPrefix}-${importerHash}`\n                            : `data-${importerHash}`;\n                        return (0, scope_css_1.scopeCss)(code, getFilenameFromPath(id), scopedAttr);\n                    }\n                }\n            },\n        },\n    ];\n}\n"]}