import regexpu = require ( "regexpu-core" ) ; /**
 * CSS <ident-token> RegExp.
 * Defined: https://www.w3.org/TR/css-syntax-3/#typedef-ident-token
 */ export const CLASS_NAME_IDENT = new RegExp ( regexpu ( "^(-?(?:\\\\.|[A-Za-z_\\u{0080}-\\u{10ffff}])(?:\\\\.|[A-Za-z0-9_\\-\\u{0080}-\\u{10ffff}])*)$" , "u" ) ) ; export const EXTENDS = "extends" ; export const IMPLEMENTS = "implements" ; export const BLOCK_NAME = "block-name" ; export const BLOCK_ID = "block-id" ; export const BLOCK_CLASS = "block-class" ; export const BLOCK_ALIAS = "block-alias" ; export const COMPOSES = "composes" ; export const BLOCK_PROP_NAMES = new Set ( [ BLOCK_ID , BLOCK_NAME , BLOCK_CLASS , BLOCK_ALIAS , EXTENDS , IMPLEMENTS , COMPOSES ] ) ; export const BLOCK_PROP_NAMES_RE = /^(extends|implements|block-name|block-id|block-class|composes|block-alias)$/ ; export const BLOCK_DEBUG = "block-debug" ; export const BLOCK_GLOBAL = "block-global" ; export const BLOCK_IMPORT = "block" ; export const BLOCK_EXPORT = "export" ; export const BLOCK_SYNTAX_VERSION = "block-syntax-version" ; export const BLOCK_AT_RULES = new Set ( [ BLOCK_DEBUG , BLOCK_GLOBAL , BLOCK_IMPORT , BLOCK_EXPORT , BLOCK_SYNTAX_VERSION ] ) ; export interface Resolution { isInherited : boolean ; path : string ; } const RESOLVE_RE = /resolve(-inherited)?\(("|')([^\2]*)\2\)/ ; const CONSTRAIN_RE = /constrain\(("|')([^\1]*)\1\)/ ; export function isResolution ( value ) { return RESOLVE_RE . test ( value ) ; } export function isConstraint ( value ) { return CONSTRAIN_RE . test ( value ) ; } export function getResolution ( value ) { let res = value . match ( RESOLVE_RE ) || [ ] ; return { isInherited : ! ! res [ 1 ] , path : ( res [ 3 ] || "" ) , } ; } export function getConstraints ( value ) { let res = ( value . match ( CONSTRAIN_RE ) || [ ] ) [ 3 ] || "" ; return res . split ( /\s*,\s*/ ) ; } export const SELF_SELECTOR = "::self" ; export const ATTR_PRESENT = "::attr-present" ; export const ROOT_CLASS = ":scope" ; export const DEFAULT_EXPORT = "default" ; export const DEFAULT_NAMESPACE = "block" ; /**
 * Names that a block cannot have as a namespace.
 */ export const RESERVED_NAMESPACES = new Set < string > ( [ DEFAULT_EXPORT , "html" , "svg" , "math" , "mathml" , "xlink" , "xml" , "xmlns" , "xhtml" ] ) ; /**
 * Names that a block cannot have lest it collides with other syntax.
 */ export const RESERVED_BLOCK_NAMES = new Set < string > ( [ DEFAULT_EXPORT , DEFAULT_NAMESPACE , ... RESERVED_NAMESPACES ] ) ; export function isNamespaceReserved ( name ) { return name && RESERVED_NAMESPACES . has ( name . toLowerCase ( ) ) || false ; } export function isBlockNameReserved ( name ) { return name && RESERVED_BLOCK_NAMES . has ( name . toLowerCase ( ) ) || false ; }