securityos/node_modules/next/dist/compiled/postcss-modules-scope/index.js

2 lines
64 KiB
JavaScript
Raw Permalink Normal View History

2024-09-06 15:32:35 +00:00
(()=>{var e={441:e=>{"use strict";
/*! https://mths.be/cssesc v3.0.0 by @mathias */var t={};var r=t.hasOwnProperty;var n=function merge(e,t){if(!e){return t}var n={};for(var i in t){n[i]=r.call(e,i)?e[i]:t[i]}return n};var i=/[ -,\.\/:-@\[-\^`\{-~]/;var s=/[ -,\.\/:-@\[\]\^`\{-~]/;var o=/['"\\]/;var a=/(^|\\+)?(\\[A-F0-9]{1,6})\x20(?![a-fA-F0-9\x20])/g;var u=function cssesc(e,t){t=n(t,cssesc.options);if(t.quotes!="single"&&t.quotes!="double"){t.quotes="single"}var r=t.quotes=="double"?'"':"'";var o=t.isIdentifier;var u=e.charAt(0);var c="";var f=0;var l=e.length;while(f<l){var p=e.charAt(f++);var h=p.charCodeAt();var d=void 0;if(h<32||h>126){if(h>=55296&&h<=56319&&f<l){var v=e.charCodeAt(f++);if((v&64512)==56320){h=((h&1023)<<10)+(v&1023)+65536}else{f--}}d="\\"+h.toString(16).toUpperCase()+" "}else{if(t.escapeEverything){if(i.test(p)){d="\\"+p}else{d="\\"+h.toString(16).toUpperCase()+" "}}else if(/[\t\n\f\r\x0B]/.test(p)){d="\\"+h.toString(16).toUpperCase()+" "}else if(p=="\\"||!o&&(p=='"'&&r==p||p=="'"&&r==p)||o&&s.test(p)){d="\\"+p}else{d=p}}c+=d}if(o){if(/^-[-\d]/.test(c)){c="\\-"+c.slice(1)}else if(/\d/.test(u)){c="\\3"+u+" "+c.slice(1)}}c=c.replace(a,(function(e,t,r){if(t&&t.length%2){return e}return(t||"")+r}));if(!o&&t.wrap){return r+c+r}return c};u.options={escapeEverything:false,isIdentifier:false,quotes:"single",wrap:false};u.version="3.0.0";e.exports=u},361:(e,t,r)=>{"use strict";const n=r(475);const i=Object.prototype.hasOwnProperty;function getSingleLocalNamesForComposes(e){return e.nodes.map((t=>{if(t.type!=="selector"||t.nodes.length!==1){throw new Error(`composition is only allowed when selector is single :local class name not in "${e}"`)}t=t.nodes[0];if(t.type!=="pseudo"||t.value!==":local"||t.nodes.length!==1){throw new Error('composition is only allowed when selector is single :local class name not in "'+e+'", "'+t+'" is weird')}t=t.first;if(t.type!=="selector"||t.length!==1){throw new Error('composition is only allowed when selector is single :local class name not in "'+e+'", "'+t+'" is weird')}t=t.first;if(t.type!=="class"){throw new Error('composition is only allowed when selector is single :local class name not in "'+e+'", "'+t+'" is weird')}return t.value}))}const s="[\\x20\\t\\r\\n\\f]";const o=new RegExp("\\\\([\\da-f]{1,6}"+s+"?|("+s+")|.)","ig");function unescape(e){return e.replace(o,((e,t,r)=>{const n="0x"+t-65536;return n!==n||r?t:n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,n&1023|56320)}))}const plugin=(e={})=>{const t=e&&e.generateScopedName||plugin.generateScopedName;const r=e&&e.generateExportEntry||plugin.generateExportEntry;const s=e&&e.exportGlobals;return{postcssPlugin:"postcss-modules-scope",Once(e,{rule:o}){const a=Object.create(null);function exportScopedName(n,i){const s=t(i?i:n,e.source.input.from,e.source.input.css);const o=r(i?i:n,s,e.source.input.from,e.source.input.css);const{key:u,value:c}=o;a[u]=a[u]||[];if(a[u].indexOf(c)<0){a[u].push(c)}return s}function localizeNode(e){switch(e.type){case"selector":e.nodes=e.map(localizeNode);return e;case"class":return n.className({value:exportScopedName(e.value,e.raws&&e.raws.value?e.raws.value:null)});case"id":{return n.id({value:exportScopedName(e.value,e.raws&&e.raws.value?e.raws.value:null)})}}throw new Error(`${e.type} ("${e}") is not allowed in a :local block`)}function traverseNode(e){switch(e.type){case"pseudo":if(e.value===":local"){if(e.nodes.length!==1){throw new Error('Unexpected comma (",") in :local block')}const t=localizeNode(e.first,e.spaces);t.first.spaces=e.spaces;const r=e.next();if(r&&r.type==="combinator"&&r.value===" "&&/\\[A-F0-9]{1,6}$/.test(t.last.value)){t.last.spaces.after=" "}e.replaceWith(t);return}case"root":case"selector":{e.each(traverseNode);break}case"id":case"class":if(s){a[e.value]=[e.value]}break}return e}const u={};e.walkRules(/^:import\(.+\)$/,(e=>{e.walkDecls((e=>{u[e.prop]=true}))}));e.walkRules((e=>{let t=n().astSync(e);e.selector=traverseNode(t.clone()).toString();e.walkDecls(/composes|compose-with/i,(e=>{const r=getSingleLocalNamesForComposes(t);const n=e.value.split(/\s+/);n.forEach((t=>{const n=/^glo